Skip to content

Commit

Permalink
fix unnecessary prompts to restart app cause by notification settings…
Browse files Browse the repository at this point in the history
… in settings dialog
  • Loading branch information
martinrotter committed Nov 2, 2023
1 parent 24cbeb9 commit 79d7147
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/librssguard/gui/settings/settingsnotifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ SettingsNotifications::SettingsNotifications(Settings* settings, QWidget* parent
connect(m_ui.m_sbScreen, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsNotifications::dirtifySettings);
connect(m_ui.m_sbScreen, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsNotifications::requireRestart);

m_ui.m_sbScreen->setMinimum(-1);
m_ui.m_sbScreen->setMaximum(QGuiApplication::screens().size() - 1);

connect(m_ui.m_sbScreen, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsNotifications::showScreenInfo);

connect(m_ui.m_cbCustomNotificationsPosition,
Expand All @@ -43,6 +40,13 @@ SettingsNotifications::SettingsNotifications(Settings* settings, QWidget* parent
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&SettingsNotifications::requireRestart);
}

void SettingsNotifications::loadSettings() {
onBeginLoadSettings();

m_ui.m_sbScreen->setMinimum(-1);
m_ui.m_sbScreen->setMaximum(QGuiApplication::screens().size() - 1);

QMetaEnum enm = QMetaEnum::fromType<ToastNotificationsManager::NotificationPosition>();

Expand All @@ -52,10 +56,6 @@ SettingsNotifications::SettingsNotifications(Settings* settings, QWidget* parent
textForPosition(ToastNotificationsManager::NotificationPosition(enm.value(i))),
enm.value(i));
}
}

void SettingsNotifications::loadSettings() {
onBeginLoadSettings();

// Load fancy notification settings.
m_ui.m_checkEnableNotifications
Expand Down
7 changes: 5 additions & 2 deletions src/librssguard/gui/settings/settingspanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#include "miscellaneous/settings.h"

SettingsPanel::SettingsPanel(Settings* settings, QWidget* parent)
: QWidget(parent), m_requiresRestart(false), m_isDirty(false), m_isLoading(false), m_isLoaded(false), m_settings(settings) {}
: QWidget(parent), m_requiresRestart(false), m_isDirty(false), m_isLoading(false), m_isLoaded(false),
m_settings(settings) {}

void SettingsPanel::onBeginLoadSettings() {
m_isLoading = true;
Expand Down Expand Up @@ -41,7 +42,9 @@ void SettingsPanel::setRequiresRestart(bool requiresRestart) {
}

void SettingsPanel::requireRestart() {
setRequiresRestart(true);
if (!m_isLoading) {
setRequiresRestart(true);
}
}

bool SettingsPanel::isLoaded() const {
Expand Down

0 comments on commit 79d7147

Please sign in to comment.