Disable actionOpen_Project_in_Text_Editor when no command is set

This commit is contained in:
BigBahss 2020-12-01 10:13:56 -05:00
parent dbafb99fd4
commit e704793350
2 changed files with 12 additions and 0 deletions

View file

@ -224,6 +224,7 @@ private slots:
void on_actionRegion_Map_Editor_triggered();
void on_actionEdit_Preferences_triggered();
void togglePreferenceSpecificUi();
private:
Ui::MainWindow *ui;

View file

@ -81,6 +81,8 @@ void MainWindow::setWindowDisabled(bool disabled) {
ui->action_Exit->setDisabled(false);
ui->menuHelp->setDisabled(false);
ui->actionAbout_Porymap->setDisabled(false);
if (!disabled)
togglePreferenceSpecificUi();
}
void MainWindow::initWindow() {
@ -2519,6 +2521,8 @@ void MainWindow::on_actionEdit_Preferences_triggered() {
this, &MainWindow::setTheme);
connect(preferenceEditor, &PreferenceEditor::themeChanged,
editor, &Editor::maskNonVisibleConnectionTiles);
connect(preferenceEditor, &PreferenceEditor::preferencesSaved,
this, &MainWindow::togglePreferenceSpecificUi);
connect(preferenceEditor, &QObject::destroyed, [=](QObject *) { preferenceEditor = nullptr; });
}
@ -2531,6 +2535,13 @@ void MainWindow::on_actionEdit_Preferences_triggered() {
}
}
void MainWindow::togglePreferenceSpecificUi() {
if (porymapConfig.getTextEditorOpenFolder().isEmpty())
ui->actionOpen_Project_in_Text_Editor->setEnabled(false);
else
ui->actionOpen_Project_in_Text_Editor->setEnabled(true);
}
void MainWindow::on_pushButton_AddCustomHeaderField_clicked()
{
int rowIndex = this->ui->tableWidget_CustomHeaderFields->rowCount();