summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLostDragonist <lost.dragonist@gmail.com>2019-04-30 04:51:32 -0500
committerLostDragonist <lost.dragonist@gmail.com>2019-04-30 04:51:32 -0500
commit3061a15822dda0f7ed01aeb45ce9ccf4ad0f6af5 (patch)
tree59f48c3441d44ce273cc8f3082008113cbe0a5d3
parent8c47ba2252ff226d646a13a82a7b30ee652efc25 (diff)
Restart MO if the API key is changed or the reset geometries button was clicked
-rw-r--r--src/settings.cpp33
-rw-r--r--src/settings.h1
-rw-r--r--src/settingsdialog.cpp14
-rw-r--r--src/settingsdialog.h5
4 files changed, 42 insertions, 11 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 1e932e49..231487bb 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -788,6 +788,25 @@ void Settings::query(PluginContainer *pluginContainer, QWidget *parent)
}
m_Settings.setValue(key, dialog.saveGeometry());
+ // These changes happen regardless of accepted or rejected
+ bool restartNeeded = false;
+ if (dialog.getApiKeyChanged()) {
+ restartNeeded = true;
+ }
+ if (dialog.getResetGeometries()) {
+ restartNeeded = true;
+ m_Settings.setValue("reset_geometry", true);
+ }
+ if (restartNeeded) {
+ if (QMessageBox::question(nullptr,
+ tr("Restart Mod Organizer?"),
+ tr("In order to finish configuration changes, MO must be restarted.\n"
+ "Restart it now?"),
+ QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
+ qApp->exit(INT_MAX);
+ }
+ }
+
}
Settings::SettingsTab::SettingsTab(Settings *m_parent, SettingsDialog &m_dialog)
@@ -1181,6 +1200,7 @@ Settings::WorkaroundsTab::WorkaroundsTab(Settings *m_parent,
, m_displayForeignBox(m_dialog.findChild<QCheckBox *>("displayForeignBox"))
, m_lockGUIBox(m_dialog.findChild<QCheckBox *>("lockGUIBox"))
, m_enableArchiveParsingBox(m_dialog.findChild<QCheckBox *>("enableArchiveParsingBox"))
+ , m_resetGeometriesBtn(m_dialog.findChild<QPushButton *>("resetGeometryBtn"))
{
m_appIDEdit->setText(m_parent->getSteamAppID());
@@ -1216,6 +1236,8 @@ Settings::WorkaroundsTab::WorkaroundsTab(Settings *m_parent,
m_lockGUIBox->setChecked(m_parent->lockGUI());
m_enableArchiveParsingBox->setChecked(m_parent->archiveParsing());
+ m_resetGeometriesBtn->setChecked(m_parent->directInterface().value("reset_geometry", false).toBool());
+
m_dialog.setExecutableBlacklist(m_parent->executablesBlacklist());
}
@@ -1235,15 +1257,4 @@ void Settings::WorkaroundsTab::update()
m_Settings.setValue("Settings/archive_parsing_experimental", m_enableArchiveParsingBox->isChecked());
m_Settings.setValue("Settings/executable_blacklist", m_dialog.getExecutableBlacklist());
-
- if (m_dialog.getResetGeometries()) {
- m_Settings.setValue("reset_geometry", true);
- if (QMessageBox::question(nullptr,
- tr("Restart Mod Organizer?"),
- tr("In order to reset the window geometries, MO must be restarted.\n"
- "Restart it now?"),
- QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- qApp->exit(INT_MAX);
- }
- }
}
diff --git a/src/settings.h b/src/settings.h
index 324fa0b6..ed49a1bc 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -531,6 +531,7 @@ private:
QCheckBox *m_displayForeignBox;
QCheckBox *m_lockGUIBox;
QCheckBox *m_enableArchiveParsingBox;
+ QPushButton *m_resetGeometriesBtn;
};
private slots:
diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp
index f9f4f255..74091469 100644
--- a/src/settingsdialog.cpp
+++ b/src/settingsdialog.cpp
@@ -53,6 +53,8 @@ SettingsDialog::SettingsDialog(PluginContainer *pluginContainer, QWidget *parent
, m_PluginContainer(pluginContainer)
, m_nexusLogin(new QWebSocket)
, m_KeyReceived(false)
+ , m_KeyCleared(false)
+ , m_GeometriesReset(false)
{
ui->setupUi(this);
ui->pluginSettingsList->setStyleSheet("QTreeWidget::item {padding-right: 10px;}");
@@ -131,6 +133,11 @@ bool SettingsDialog::getResetGeometries()
return ui->resetGeometryBtn->isChecked();
}
+bool SettingsDialog::getApiKeyChanged()
+{
+ return m_KeyReceived || m_KeyCleared;
+}
+
void SettingsDialog::on_categoriesBtn_clicked()
{
CategoriesDialog dialog(this);
@@ -476,6 +483,7 @@ void SettingsDialog::on_clearCacheButton_clicked()
void SettingsDialog::on_revokeNexusAuthButton_clicked()
{
emit revokeApiKey(ui->nexusConnect);
+ m_KeyCleared = true;
}
void SettingsDialog::normalizePath(QLineEdit *lineEdit)
@@ -516,3 +524,9 @@ void SettingsDialog::on_overwriteDirEdit_editingFinished()
{
normalizePath(ui->overwriteDirEdit);
}
+
+void SettingsDialog::on_resetGeometryBtn_clicked()
+{
+ m_GeometriesReset = true;
+ ui->resetGeometryBtn->setChecked(true);
+}
diff --git a/src/settingsdialog.h b/src/settingsdialog.h
index d6dfe384..92a97c3f 100644
--- a/src/settingsdialog.h
+++ b/src/settingsdialog.h
@@ -82,6 +82,7 @@ public:
QColor getContainedColor() { return m_ContainedColor; }
QString getExecutableBlacklist() { return m_ExecutableBlacklist; }
bool getResetGeometries();
+ bool getApiKeyChanged();
void setOverwritingColor(QColor col) { m_OverwritingColor = col; }
void setOverwrittenColor(QColor col) { m_OverwrittenColor = col; }
@@ -165,6 +166,8 @@ private slots:
void completeApiConnection();
+ void on_resetGeometryBtn_clicked();
+
private:
Ui::SettingsDialog *ui;
PluginContainer *m_PluginContainer;
@@ -177,6 +180,8 @@ private:
QColor m_ContainedColor;
bool m_KeyReceived;
+ bool m_KeyCleared;
+ bool m_GeometriesReset;
QString m_UUID;
QString m_AuthToken;