From 40f46502414250299972fbb2b9296aa6a625d328 Mon Sep 17 00:00:00 2001 From: leducthanhig Date: Mon, 25 Mar 2024 23:50:29 +0700 Subject: [PATCH] Fix some bugs --- Change Log.txt | 2 +- comboBox.cpp | 16 ++++++++-------- mainwindow.h | 2 +- pushButton.cpp | 2 ++ setting.cpp | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Change Log.txt b/Change Log.txt index 58d0fd7..a01c918 100644 --- a/Change Log.txt +++ b/Change Log.txt @@ -27,7 +27,7 @@ - Add some tool tips - Fix some issues of the combo boxs -24/03/2024 +25/03/2024 - Optimize some features - Add feature to handle gif file - Fix some bugs \ No newline at end of file diff --git a/comboBox.cpp b/comboBox.cpp index bd48ec7..629fa6c 100644 --- a/comboBox.cpp +++ b/comboBox.cpp @@ -101,7 +101,7 @@ void MainWindow::on_comboBox_Tool_currentIndexChanged(int index) { } else { // Interpolating ui->comboBox_Engine->addItems(QStringList{ "RIFE-NCNN-Vulkan", "IFRNet-NCNN-Vulkan" }); - ui->comboBox_Presets->addItems(QStringList{ "Fast but low quality", "Slow but high quality" }); + ui->comboBox_Presets->addItems(QStringList{ "Fast and medium quality", "Slow and high quality" }); ui->comboBox_Res->setCurrentIndex(0); setEnabled_Res(0); setEnabled_Segment(1); @@ -118,9 +118,9 @@ void MainWindow::on_comboBox_Tool_currentIndexChanged(int index) { ui->comboBox_Presets->setCurrentIndex(0); // Update the model name in output file name QString fileName = fo.completeBaseName(); - int idx = fileName.sliced(fileName.indexOf('_') + 1).indexOf('_') + fileName.indexOf('_') + 1; // Find the second index of '_' + int idx = fileName.remove(fi.completeBaseName() + "_").indexOf('_'); if (idx != -1) { - fileName = fileName.remove(fileName.sliced(idx + 1)); + fileName = fi.completeBaseName() + "_" + fileName.remove(fileName.sliced(idx + 1)); fileName += ui->comboBox_Model->currentText(); ui->lineEdit_Output->setText(fo.absolutePath() + "/" + fileName + "." + fo.suffix()); } @@ -151,9 +151,9 @@ void MainWindow::on_comboBox_Engine_currentIndexChanged(int index) { } // Update the model name in output file name QString fileName = fo.completeBaseName(); - int idx = fileName.sliced(fileName.indexOf('_') + 1).indexOf('_') + fileName.indexOf('_') + 1; // Find the second index of '_' + int idx = fileName.remove(fi.completeBaseName() + "_").indexOf('_'); if (idx != -1) { - fileName = fileName.remove(fileName.sliced(idx + 1)); + fileName = fi.completeBaseName() + "_" + fileName.remove(fileName.sliced(idx + 1)); fileName += ui->comboBox_Model->currentText(); ui->lineEdit_Output->setText(fo.absolutePath() + "/" + fileName + "." + fo.suffix()); } @@ -215,9 +215,9 @@ void MainWindow::on_comboBox_Model_currentIndexChanged(int index) { } // Update the model name in output file name QString fileName = fo.completeBaseName(); - int idx = fileName.sliced(fileName.indexOf('_') + 1).indexOf('_') + fileName.indexOf('_') + 1; // Find the second index of '_' + int idx = fileName.remove(fi.completeBaseName() + "_").indexOf('_'); if (idx != -1) { - fileName = fileName.remove(fileName.sliced(idx + 1)); + fileName = fi.completeBaseName() + "_" + fileName.remove(fileName.sliced(idx + 1)); fileName += ui->comboBox_Model->currentText(); ui->lineEdit_Output->setText(fo.absolutePath() + "/" + fileName + "." + fo.suffix()); } @@ -230,4 +230,4 @@ void MainWindow::on_comboBox_Denoise_currentIndexChanged(int index) { msg.exec(); ui->comboBox_Denoise->setCurrentIndex(0); } -} \ No newline at end of file +} diff --git a/mainwindow.h b/mainwindow.h index bf66bce..29f74ec 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -116,4 +116,4 @@ double getDuration(QFileInfo file); QString readStdOutput(QProcess* process); QStringList getGPUID(QString output); -#endif \ No newline at end of file +#endif diff --git a/pushButton.cpp b/pushButton.cpp index a8e079b..d53459e 100644 --- a/pushButton.cpp +++ b/pushButton.cpp @@ -118,6 +118,7 @@ void MainWindow::on_pushButton_Start_released() { ui->pushButton_Info->setEnabled(0); ui->groupBox_Setting->setEnabled(0); setVisible_ViewState(1); + setAcceptDrops(0); switch (ui->comboBox_Tool->currentIndex()) { case 0: @@ -277,6 +278,7 @@ end:; msg.setStyleSheet("QPushButton{height: 25px}"); msg.exec(); + setAcceptDrops(1); setVisible_ViewState(0); ui->pushButton_Start->setVisible(1); ui->progressBar->setValue(0); diff --git a/setting.cpp b/setting.cpp index 57ede31..737e12d 100644 --- a/setting.cpp +++ b/setting.cpp @@ -81,7 +81,7 @@ void MainWindow::setRemaining(QTime startTime) { QString stage = str.sliced(str.indexOf(':') + 2, str.indexOf("...") - str.indexOf(":") - 2); double weight; // Estimate: Upscaling = 6 Encoding, Encoding = 5 Decoding => 30 + 5 + 1 = 36; if (stage == "Decoding") weight = 1.0 / 36; - else if (stage == "Upscaling") weight = 31.0 / 36; + else if (stage == "Upscaling" || stage == "Interpolating") weight = 31.0 / 36; else if (stage == "Encoding") weight = 1; finished += weight * ui->progressBar->value() / 100.0;