diff --git a/forms/mainwindow.ui b/forms/mainwindow.ui
index 91dfc192..7b8aa8b4 100644
--- a/forms/mainwindow.ui
+++ b/forms/mainwindow.ui
@@ -3012,9 +3012,6 @@
Options
-
-
-
@@ -3064,22 +3061,6 @@
Ctrl+S
-
-
- true
-
-
- Monitor Project Files
-
-
-
-
- true
-
-
- Open Recent Project On Launch
-
-
New Map...
diff --git a/forms/preferenceeditor.ui b/forms/preferenceeditor.ui
index c44fa98c..6a055480 100644
--- a/forms/preferenceeditor.ui
+++ b/forms/preferenceeditor.ui
@@ -18,6 +18,58 @@
9
+ -
+
+
+ Miscellaneous
+
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Open recent project on launch
+
+
+
+ -
+
+
+ Monitor project files
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Maximum
+
+
+
+ 20
+ 20
+
+
+
+
+
+
+
-
@@ -65,8 +117,8 @@
0
0
- 582
- 372
+ 570
+ 322
diff --git a/include/mainwindow.h b/include/mainwindow.h
index 36f89d48..9b51bc12 100644
--- a/include/mainwindow.h
+++ b/include/mainwindow.h
@@ -199,8 +199,6 @@ private slots:
void on_checkBox_AllowBiking_stateChanged(int selected);
void on_checkBox_AllowEscaping_stateChanged(int selected);
void on_spinBox_FloorNumber_valueChanged(int offset);
- void on_actionMonitor_Project_Files_triggered(bool checked);
- void on_actionOpen_Recent_Project_On_Launch_triggered(bool checked);
void on_actionShortcuts_triggered();
void on_actionZoom_In_triggered();
diff --git a/include/ui/preferenceeditor.h b/include/ui/preferenceeditor.h
index c16716d9..c59641c2 100644
--- a/include/ui/preferenceeditor.h
+++ b/include/ui/preferenceeditor.h
@@ -18,6 +18,7 @@ class PreferenceEditor : public QMainWindow
public:
explicit PreferenceEditor(QWidget *parent = nullptr);
~PreferenceEditor();
+ void updateFields();
signals:
void preferencesSaved();
@@ -27,9 +28,10 @@ private:
Ui::PreferenceEditor *ui;
NoScrollComboBox *themeSelector;
- void populateFields();
+ void initFields();
void saveFields();
+
private slots:
void dialogButtonClicked(QAbstractButton *button);
};
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index e26dd382..92fbb23f 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -452,8 +452,6 @@ void MainWindow::loadUserSettings() {
ui->horizontalSlider_MetatileZoom->blockSignals(true);
ui->horizontalSlider_MetatileZoom->setValue(porymapConfig.getMetatilesZoom());
ui->horizontalSlider_MetatileZoom->blockSignals(false);
- ui->actionMonitor_Project_Files->setChecked(porymapConfig.getMonitorFiles());
- ui->actionOpen_Recent_Project_On_Launch->setChecked(porymapConfig.getReopenOnLaunch());
setTheme(porymapConfig.getTheme());
}
@@ -524,8 +522,11 @@ bool MainWindow::openProject(QString dir) {
QObject::connect(editor->project, &Project::reloadProject, this, &MainWindow::on_action_Reload_Project_triggered);
QObject::connect(editor->project, &Project::mapCacheCleared, this, &MainWindow::onMapCacheCleared);
QObject::connect(editor->project, &Project::disableWildEncountersUI, [this]() { this->setWildEncountersUIEnabled(false); });
- QObject::connect(editor->project, &Project::uncheckMonitorFilesAction, [this]() { ui->actionMonitor_Project_Files->setChecked(false); });
- on_actionMonitor_Project_Files_triggered(porymapConfig.getMonitorFiles());
+ QObject::connect(editor->project, &Project::uncheckMonitorFilesAction, [this]() {
+ porymapConfig.setMonitorFiles(false);
+ if (this->preferenceEditor)
+ this->preferenceEditor->updateFields();
+ });
editor->project->set_root(dir);
success = loadDataStructures()
&& populateMapList()
@@ -1770,16 +1771,6 @@ void MainWindow::on_actionCursor_Tile_Outline_triggered()
}
}
-void MainWindow::on_actionMonitor_Project_Files_triggered(bool checked)
-{
- porymapConfig.setMonitorFiles(checked);
-}
-
-void MainWindow::on_actionOpen_Recent_Project_On_Launch_triggered(bool checked)
-{
- porymapConfig.setReopenOnLaunch(checked);
-}
-
void MainWindow::on_actionShortcuts_triggered()
{
if (!shortcutsEditor)
diff --git a/src/ui/preferenceeditor.cpp b/src/ui/preferenceeditor.cpp
index 0ef62dce..e2e4d916 100644
--- a/src/ui/preferenceeditor.cpp
+++ b/src/ui/preferenceeditor.cpp
@@ -21,7 +21,8 @@ PreferenceEditor::PreferenceEditor(QWidget *parent) :
setAttribute(Qt::WA_DeleteOnClose);
connect(ui->buttonBox, &QDialogButtonBox::clicked,
this, &PreferenceEditor::dialogButtonClicked);
- populateFields();
+ initFields();
+ updateFields();
}
PreferenceEditor::~PreferenceEditor()
@@ -29,7 +30,7 @@ PreferenceEditor::~PreferenceEditor()
delete ui;
}
-void PreferenceEditor::populateFields() {
+void PreferenceEditor::initFields() {
QStringList themes = { "default" };
static const QRegularExpression re(":/themes/([A-z0-9_-]+).qss");
QDirIterator it(":/themes", QDirIterator::Subdirectories);
@@ -38,11 +39,14 @@ void PreferenceEditor::populateFields() {
themes.append(themeName);
}
themeSelector->addItems(themes);
+}
+
+void PreferenceEditor::updateFields() {
themeSelector->setCurrentText(porymapConfig.getTheme());
-
ui->lineEdit_TextEditorOpenFolder->setText(porymapConfig.getTextEditorOpenFolder());
-
ui->lineEdit_TextEditorGotoLine->setText(porymapConfig.getTextEditorGotoLine());
+ ui->checkBox_MonitorProjectFiles->setChecked(porymapConfig.getMonitorFiles());
+ ui->checkBox_OpenRecentProject->setChecked(porymapConfig.getReopenOnLaunch());
}
void PreferenceEditor::saveFields() {
@@ -53,8 +57,9 @@ void PreferenceEditor::saveFields() {
}
porymapConfig.setTextEditorOpenFolder(ui->lineEdit_TextEditorOpenFolder->text());
-
porymapConfig.setTextEditorGotoLine(ui->lineEdit_TextEditorGotoLine->text());
+ porymapConfig.setMonitorFiles(ui->checkBox_MonitorProjectFiles->isChecked());
+ porymapConfig.setReopenOnLaunch(ui->checkBox_OpenRecentProject->isChecked());
emit preferencesSaved();
}