properly enable notification checkboxes (#4356)

This commit is contained in:
ebbit1q 2021-05-17 02:37:12 +02:00 committed by GitHub
parent 19a7c4092c
commit 66d24f086e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -411,7 +411,7 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
notificationsEnabledCheckBox.setChecked(SettingsCache::instance().getNotificationsEnabled());
connect(&notificationsEnabledCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
SLOT(setNotificationsEnabled(int)));
connect(&notificationsEnabledCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSpecNotificationEnabled(int)));
connect(&notificationsEnabledCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setNotificationEnabled(int)));
specNotificationsEnabledCheckBox.setChecked(SettingsCache::instance().getSpectatorNotificationsEnabled());
specNotificationsEnabledCheckBox.setEnabled(SettingsCache::instance().getNotificationsEnabled());
@ -473,9 +473,14 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
setLayout(mainLayout);
}
void UserInterfaceSettingsPage::setSpecNotificationEnabled(int i)
void UserInterfaceSettingsPage::setNotificationEnabled(int i)
{
specNotificationsEnabledCheckBox.setEnabled(i != 0);
buddyConnectNotificationsEnabledCheckBox.setEnabled(i != 0);
if (i == 0) {
specNotificationsEnabledCheckBox.setChecked(false);
buddyConnectNotificationsEnabledCheckBox.setChecked(false);
}
}
void UserInterfaceSettingsPage::retranslateUi()

View file

@ -108,7 +108,7 @@ class UserInterfaceSettingsPage : public AbstractSettingsPage
{
Q_OBJECT
private slots:
void setSpecNotificationEnabled(int);
void setNotificationEnabled(int);
private:
QCheckBox notificationsEnabledCheckBox;