diff --git a/src/Gui/DlgSettingsNotificationArea.cpp b/src/Gui/DlgSettingsNotificationArea.cpp index e81ac86c06..6ec60374d1 100644 --- a/src/Gui/DlgSettingsNotificationArea.cpp +++ b/src/Gui/DlgSettingsNotificationArea.cpp @@ -40,20 +40,12 @@ DlgSettingsNotificationArea::DlgSettingsNotificationArea(QWidget* parent) { ui->setupUi(this); + adaptUiToAreaEnabledState(ui->NotificationAreaEnabled->isChecked()); + connect(ui->NotificationAreaEnabled, &QCheckBox::stateChanged, [this](int state) { bool enabled = state == Qt::CheckState::Checked; + this->adaptUiToAreaEnabledState(enabled); - ui->NonIntrusiveNotificationsEnabled->setEnabled(enabled); - ui->maxDuration->setEnabled(enabled); - ui->maxDuration->setEnabled(enabled); - ui->minDuration->setEnabled(enabled); - ui->maxNotifications->setEnabled(enabled); - ui->maxWidgetMessages->setEnabled(enabled); - ui->autoRemoveUserNotifications->setEnabled(enabled); - ui->hideNonIntrusiveNotificationsWhenWindowDeactivated->setEnabled(enabled); - ui->preventNonIntrusiveNotificationsWhenWindowNotActive->setEnabled(enabled); - ui->developerErrorSubscriptionEnabled->setEnabled(enabled); - ui->developerWarningSubscriptionEnabled->setEnabled(enabled); if (enabled) { QMessageBox::information(this, tr("Notification Area"), @@ -100,6 +92,21 @@ void DlgSettingsNotificationArea::loadSettings() ui->developerWarningSubscriptionEnabled->onRestore(); } +void DlgSettingsNotificationArea::adaptUiToAreaEnabledState(bool enabled) +{ + ui->NonIntrusiveNotificationsEnabled->setEnabled(enabled); + ui->maxDuration->setEnabled(enabled); + ui->maxDuration->setEnabled(enabled); + ui->minDuration->setEnabled(enabled); + ui->maxNotifications->setEnabled(enabled); + ui->maxWidgetMessages->setEnabled(enabled); + ui->autoRemoveUserNotifications->setEnabled(enabled); + ui->hideNonIntrusiveNotificationsWhenWindowDeactivated->setEnabled(enabled); + ui->preventNonIntrusiveNotificationsWhenWindowNotActive->setEnabled(enabled); + ui->developerErrorSubscriptionEnabled->setEnabled(enabled); + ui->developerWarningSubscriptionEnabled->setEnabled(enabled); +} + void DlgSettingsNotificationArea::changeEvent(QEvent* e) { if (e->type() == QEvent::LanguageChange) { diff --git a/src/Gui/DlgSettingsNotificationArea.h b/src/Gui/DlgSettingsNotificationArea.h index 4aac834a3b..75e1395fe2 100644 --- a/src/Gui/DlgSettingsNotificationArea.h +++ b/src/Gui/DlgSettingsNotificationArea.h @@ -49,6 +49,9 @@ public: protected: void changeEvent(QEvent *e) override; +private: + void adaptUiToAreaEnabledState(bool enabled); + private: std::unique_ptr ui; };