Move remaining Porymap config settings to Preferences

This commit is contained in:
GriffinR
2023-09-11 16:54:15 -04:00
parent 30a01b7061
commit a508677b1d
6 changed files with 72 additions and 43 deletions

View File

@@ -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();
}