Skip to content

Commit

Permalink
Fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
leducthanhig committed Mar 25, 2024
1 parent 31a679b commit 40f4650
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Change Log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 8 additions & 8 deletions comboBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand All @@ -230,4 +230,4 @@ void MainWindow::on_comboBox_Denoise_currentIndexChanged(int index) {
msg.exec();
ui->comboBox_Denoise->setCurrentIndex(0);
}
}
}
2 changes: 1 addition & 1 deletion mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ double getDuration(QFileInfo file);
QString readStdOutput(QProcess* process);
QStringList getGPUID(QString output);

#endif
#endif
2 changes: 2 additions & 0 deletions pushButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion setting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 40f4650

Please sign in to comment.