Fix bug: ui did not in initialize correctly when you start the pref page with area disabled, the other settings were not disabled as they are when you disable the area.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -49,6 +49,9 @@ public:
|
||||
protected:
|
||||
void changeEvent(QEvent *e) override;
|
||||
|
||||
private:
|
||||
void adaptUiToAreaEnabledState(bool enabled);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgSettingsNotificationArea> ui;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user