2 #include "ui_mainwindow.h"
17 void MainWindow::on_frameSlider_valueChanged(
int value)
19 ui->glWidget->setFrameOffset(value);
22 void MainWindow::on_pushButton_LoadVideo_clicked()
24 QApplication::setOverrideCursor(Qt::WaitCursor);
25 VFLResult vr = ui->glWidget->loadVideoFile(ui->lineEdit_Settings_StartFrame->text().toInt(),
26 ui->lineEdit_Settings_StepSize->text().toInt(),
27 ui->lineEdit_Settings_EndFrame->text().toInt());
31 QMessageBox::critical(
this,
"Error",
"Couldn't load video file!");
32 QApplication::restoreOverrideCursor();
35 int frameCount = ui->glWidget->getFrameCount();
36 ui->labelSlider_1->setText(QString::number(frameCount));
37 ui->frameSlider->setRange(0, frameCount - 1);
38 ui->frameSlider->setEnabled(
true);
39 ui->labelSlider_0->setEnabled(
true);
40 ui->labelSlider_1->setEnabled(
true);
41 ui->groupBox_Visualization->setEnabled(
true);
42 QApplication::restoreOverrideCursor();
45 void MainWindow::on_radioButton_Style_HorseShoe_toggled(
bool checked)
49 ui->glWidget->setStyle(
true);
50 ui->groupBox_BoxSize->setEnabled(
false);
54 ui->glWidget->setStyle(
false);
55 ui->groupBox_BoxSize->setEnabled(
true);
60 void MainWindow::on_radioButton_Style_Block_toggled(
bool checked)
66 void MainWindow::on_lineEdit_StepSize_editingFinished()
68 float stepSize = ui->lineEdit_StepSize->text().toFloat();
70 ui->glWidget->setStepSize(stepSize);
73 ui->horizontalSlider_StepSize->setValue(1);
75 if (stepSize <= 0.0001)
76 ui->horizontalSlider_StepSize->setValue(100);
78 ui->horizontalSlider_StepSize->setValue(ceil(0.01 / stepSize - 0.5));
81 void MainWindow::on_lineEdit_BoxSize_editingFinished()
83 int boxSize = ui->lineEdit_BoxSize->text().toInt();
85 ui->horizontalSlider_BoxSize->setValue(boxSize);
88 void MainWindow::on_horizontalSlider_StepSize_valueChanged(
int value)
90 ui->lineEdit_StepSize->setText(QString::number(floor(pow(10.0, 3) / (
float) value + 0.5) / pow(10.0, 5)));
93 void MainWindow::on_horizontalSlider_StepSize_sliderReleased()
95 ui->glWidget->setStepSize(ui->lineEdit_StepSize->text().toFloat());
98 void MainWindow::on_horizontalSlider_BoxSize_valueChanged(
int value)
100 ui->lineEdit_BoxSize->setText(QString::number(value));
101 ui->glWidget->setBoxSize(value);
104 void MainWindow::on_radioButton_Metric_None_toggled(
bool checked)
108 QApplication::setOverrideCursor(Qt::WaitCursor);
110 QApplication::restoreOverrideCursor();
114 void MainWindow::on_radioButton_Metric_YDIF_toggled(
bool checked)
118 QApplication::setOverrideCursor(Qt::WaitCursor);
120 QApplication::restoreOverrideCursor();
124 void MainWindow::on_radioButton_Metric_YMSE_toggled(
bool checked)
128 QApplication::setOverrideCursor(Qt::WaitCursor);
130 QApplication::restoreOverrideCursor();
134 void MainWindow::on_radioButton_Metric_YNDIF_toggled(
bool checked)
138 QApplication::setOverrideCursor(Qt::WaitCursor);
140 QApplication::restoreOverrideCursor();
144 void MainWindow::on_radioButton_Metric_YNMSE_toggled(
bool checked)
148 QApplication::setOverrideCursor(Qt::WaitCursor);
150 QApplication::restoreOverrideCursor();
154 void MainWindow::on_radioButton_Metric_IQDIF_toggled(
bool checked)
158 QApplication::setOverrideCursor(Qt::WaitCursor);
160 QApplication::restoreOverrideCursor();
164 void MainWindow::on_pushButton_SelectFile_clicked()
166 QString videoPath = QFileDialog::getOpenFileName(
this, tr(
"Open Video File"),
"", tr(
"Video files (*.avi *.wmv *.mpq *.mpeq *.mkv);;All files (*.*)"));
168 if (videoPath.count() == 0)
171 int hRes = 0, vRes = 0;
173 QApplication::setOverrideCursor(Qt::WaitCursor);
175 if (
VFL_OK != ui->glWidget->openVideoFile(videoPath, &hRes, &vRes))
177 QMessageBox::critical(
this,
"Error",
"Couldn't open video file!");
178 QApplication::restoreOverrideCursor();
182 ui->label_Info_Path_Value->setText(videoPath);
183 ui->label_Info_HRes_Value->setText(QString::number(hRes));
184 ui->label_Info_VRes_Value->setText(QString::number(vRes));
185 ui->pushButton_LoadVideo->setEnabled(
true);
186 QApplication::restoreOverrideCursor();
189 void MainWindow::on_transferBox_valueChanged(
float * value)
191 ui->glWidget->setTransferFunction((GLfloat *) value, 150);