From 1562c234ca9fd61841b6161bbfcbe5452964caea Mon Sep 17 00:00:00 2001 From: Gavin Bises Date: Fri, 20 Feb 2015 20:57:22 -0500 Subject: [PATCH] Add spec notification toggle to UI settings. --- cockatrice/src/dlg_settings.cpp | 14 ++++++++++++-- cockatrice/src/dlg_settings.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/dlg_settings.cpp b/cockatrice/src/dlg_settings.cpp index 1695c1d9..364a5e3a 100644 --- a/cockatrice/src/dlg_settings.cpp +++ b/cockatrice/src/dlg_settings.cpp @@ -446,6 +446,10 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage() notificationsEnabledCheckBox.setChecked(settingsCache->getNotificationsEnabled()); connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setNotificationsEnabled(int))); + connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSpecNotificationEnabled(int))); + + specNotificationsEnabledCheckBox.setChecked(settingsCache->getSpectatorNotificationsEnabled()); + connect(&specNotificationsEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setSpectatorNotificationsEnabled(int))); doubleClickToPlayCheckBox.setChecked(settingsCache->getDoubleClickToPlay()); connect(&doubleClickToPlayCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDoubleClickToPlay(int))); @@ -455,8 +459,9 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage() QGridLayout *generalGrid = new QGridLayout; generalGrid->addWidget(¬ificationsEnabledCheckBox, 0, 0); - generalGrid->addWidget(&doubleClickToPlayCheckBox, 1, 0); - generalGrid->addWidget(&playToStackCheckBox, 2, 0); + generalGrid->addWidget(&specNotificationsEnabledCheckBox, 1, 0); + generalGrid->addWidget(&doubleClickToPlayCheckBox, 2, 0); + generalGrid->addWidget(&playToStackCheckBox, 3, 0); generalGroupBox = new QGroupBox; generalGroupBox->setLayout(generalGrid); @@ -500,10 +505,15 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage() setLayout(mainLayout); } +void UserInterfaceSettingsPage::setSpecNotificationEnabled(int i) { + specNotificationsEnabledCheckBox.setEnabled(i != 0); +} + void UserInterfaceSettingsPage::retranslateUi() { generalGroupBox->setTitle(tr("General interface settings")); notificationsEnabledCheckBox.setText(tr("Enable notifications in taskbar")); + specNotificationsEnabledCheckBox.setText(tr("Notify in the taskbar for game events while you are spectating")); doubleClickToPlayCheckBox.setText(tr("&Double-click cards to play them (instead of single-click)")); playToStackCheckBox.setText(tr("&Play all nonlands onto the stack (not the battlefield) by default")); animationGroupBox->setTitle(tr("Animation settings")); diff --git a/cockatrice/src/dlg_settings.h b/cockatrice/src/dlg_settings.h index cd525264..794939ee 100644 --- a/cockatrice/src/dlg_settings.h +++ b/cockatrice/src/dlg_settings.h @@ -115,10 +115,12 @@ class UserInterfaceSettingsPage : public AbstractSettingsPage { private slots: void soundPathClearButtonClicked(); void soundPathButtonClicked(); + void setSpecNotificationEnabled(int); signals: void soundPathChanged(); private: QCheckBox notificationsEnabledCheckBox; + QCheckBox specNotificationsEnabledCheckBox; QCheckBox doubleClickToPlayCheckBox; QCheckBox playToStackCheckBox; QCheckBox tapAnimationCheckBox;