Skip to content

Commit

Permalink
Disable complevel comboBox when playing demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro-Beirao committed May 23, 2024
1 parent 0b96b1a commit 0c46918
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/demodialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class demodialog : public QDialog
QVector<QPair<QString, QString>> files_paths;
QLabel *selected_count;
void update_selected_count();
void findFiles();
};

#endif // DEMODIALOG_H
Expand Down
1 change: 1 addition & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class MainWindow : public QMainWindow
void gameIsRunningDialog();

void enable_disable_skill_comboBox();
void enable_disable_complevel_comboBox();

// Prevents launching the game twice if the button "Launch" is pressed twice quickly
bool canLaunch = true;
Expand Down
6 changes: 5 additions & 1 deletion src/mainwindow_demos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ void MainWindow::on_playback_comboBox_currentIndexChanged(int index)
}
}

void MainWindow::on_playback_lineEdit_textChanged(const QString &arg1) { enable_disable_skill_comboBox(); }
void MainWindow::on_playback_lineEdit_textChanged(const QString &arg1)
{
enable_disable_skill_comboBox();
enable_disable_complevel_comboBox();
}

void MainWindow::on_viddump_lineEdit_textChanged(const QString &arg1)
{
Expand Down
17 changes: 17 additions & 0 deletions src/mainwindow_top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,20 @@ void MainWindow::enable_disable_skill_comboBox()
ui->difficulty_comboBox->setToolTip("");
}
}

void MainWindow::enable_disable_complevel_comboBox()
{
if (!ui->playback_lineEdit->text().isEmpty())
{
ui->complevel_comboBox->setEnabled(false);
ui->complevel_label->setEnabled(false);
ui->complevel_comboBox->setToolTip("Cannot select a complevel\n"
"during demo playback");
}
else
{
ui->complevel_comboBox->setEnabled(true);
ui->complevel_label->setEnabled(true);
ui->complevel_comboBox->setToolTip("");
}
}

0 comments on commit 0c46918

Please sign in to comment.