Added setting to enable/disable notifications
When something happens, the taskbar icon lights up/the dock icon bounces. This can be annoying, so here is a setting to disable that.
This commit is contained in:
parent
f699cd4b0f
commit
b1af4237e7
5 changed files with 21 additions and 3 deletions
|
@ -431,6 +431,10 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
{
|
{
|
||||||
QIcon deleteIcon(":/resources/icon_delete.svg");
|
QIcon deleteIcon(":/resources/icon_delete.svg");
|
||||||
|
|
||||||
|
notificationsEnabledCheckBox = new QCheckBox;
|
||||||
|
notificationsEnabledCheckBox->setChecked(settingsCache->getNotificationsEnabled());
|
||||||
|
connect(notificationsEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setNotificationsEnabled(int)));
|
||||||
|
|
||||||
doubleClickToPlayCheckBox = new QCheckBox;
|
doubleClickToPlayCheckBox = new QCheckBox;
|
||||||
doubleClickToPlayCheckBox->setChecked(settingsCache->getDoubleClickToPlay());
|
doubleClickToPlayCheckBox->setChecked(settingsCache->getDoubleClickToPlay());
|
||||||
connect(doubleClickToPlayCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDoubleClickToPlay(int)));
|
connect(doubleClickToPlayCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDoubleClickToPlay(int)));
|
||||||
|
@ -440,8 +444,9 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
connect(playToStackCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPlayToStack(int)));
|
connect(playToStackCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPlayToStack(int)));
|
||||||
|
|
||||||
QGridLayout *generalGrid = new QGridLayout;
|
QGridLayout *generalGrid = new QGridLayout;
|
||||||
generalGrid->addWidget(doubleClickToPlayCheckBox, 0, 0);
|
generalGrid->addWidget(notificationsEnabledCheckBox, 0, 0);
|
||||||
generalGrid->addWidget(playToStackCheckBox, 1, 0);
|
generalGrid->addWidget(doubleClickToPlayCheckBox, 1, 0);
|
||||||
|
generalGrid->addWidget(playToStackCheckBox, 2, 0);
|
||||||
|
|
||||||
generalGroupBox = new QGroupBox;
|
generalGroupBox = new QGroupBox;
|
||||||
generalGroupBox->setLayout(generalGrid);
|
generalGroupBox->setLayout(generalGrid);
|
||||||
|
@ -489,6 +494,7 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
void UserInterfaceSettingsPage::retranslateUi()
|
void UserInterfaceSettingsPage::retranslateUi()
|
||||||
{
|
{
|
||||||
generalGroupBox->setTitle(tr("General interface settings"));
|
generalGroupBox->setTitle(tr("General interface settings"));
|
||||||
|
notificationsEnabledCheckBox->setText(tr("Enable notifications in taskbar"));
|
||||||
doubleClickToPlayCheckBox->setText(tr("&Double-click cards to play them (instead of single-click)"));
|
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"));
|
playToStackCheckBox->setText(tr("&Play all nonlands onto the stack (not the battlefield) by default"));
|
||||||
animationGroupBox->setTitle(tr("Animation settings"));
|
animationGroupBox->setTitle(tr("Animation settings"));
|
||||||
|
|
|
@ -81,6 +81,7 @@ private slots:
|
||||||
signals:
|
signals:
|
||||||
void soundPathChanged();
|
void soundPathChanged();
|
||||||
private:
|
private:
|
||||||
|
QCheckBox *notificationsEnabledCheckBox;
|
||||||
QCheckBox *doubleClickToPlayCheckBox;
|
QCheckBox *doubleClickToPlayCheckBox;
|
||||||
QCheckBox *playToStackCheckBox;
|
QCheckBox *playToStackCheckBox;
|
||||||
QCheckBox *tapAnimationCheckBox;
|
QCheckBox *tapAnimationCheckBox;
|
||||||
|
|
|
@ -21,6 +21,7 @@ SettingsCache::SettingsCache()
|
||||||
|
|
||||||
mainWindowGeometry = settings->value("interface/main_window_geometry").toByteArray();
|
mainWindowGeometry = settings->value("interface/main_window_geometry").toByteArray();
|
||||||
picDownload = settings->value("personal/picturedownload", true).toBool();
|
picDownload = settings->value("personal/picturedownload", true).toBool();
|
||||||
|
notificationsEnabled = settings->value("interface/notificationsenabled", true).toBool();
|
||||||
doubleClickToPlay = settings->value("interface/doubleclicktoplay", true).toBool();
|
doubleClickToPlay = settings->value("interface/doubleclicktoplay", true).toBool();
|
||||||
playToStack = settings->value("interface/playtostack", false).toBool();
|
playToStack = settings->value("interface/playtostack", false).toBool();
|
||||||
cardInfoMinimized = settings->value("interface/cardinfominimized", 0).toInt();
|
cardInfoMinimized = settings->value("interface/cardinfominimized", 0).toInt();
|
||||||
|
@ -124,6 +125,12 @@ void SettingsCache::setPicDownload(int _picDownload)
|
||||||
emit picDownloadChanged();
|
emit picDownloadChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setNotificationsEnabled(int _notificationsEnabled)
|
||||||
|
{
|
||||||
|
notificationsEnabled = _notificationsEnabled;
|
||||||
|
settings->setValue("interface/notificationsenabled", notificationsEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setDoubleClickToPlay(int _doubleClickToPlay)
|
void SettingsCache::setDoubleClickToPlay(int _doubleClickToPlay)
|
||||||
{
|
{
|
||||||
doubleClickToPlay = _doubleClickToPlay;
|
doubleClickToPlay = _doubleClickToPlay;
|
||||||
|
|
|
@ -33,6 +33,7 @@ private:
|
||||||
QString deckPath, replaysPath, picsPath, cardDatabasePath, tokenDatabasePath;
|
QString deckPath, replaysPath, picsPath, cardDatabasePath, tokenDatabasePath;
|
||||||
QString handBgPath, stackBgPath, tableBgPath, playerBgPath, cardBackPicturePath;
|
QString handBgPath, stackBgPath, tableBgPath, playerBgPath, cardBackPicturePath;
|
||||||
bool picDownload;
|
bool picDownload;
|
||||||
|
bool notificationsEnabled;
|
||||||
bool doubleClickToPlay;
|
bool doubleClickToPlay;
|
||||||
bool playToStack;
|
bool playToStack;
|
||||||
int cardInfoMinimized;
|
int cardInfoMinimized;
|
||||||
|
@ -62,6 +63,7 @@ public:
|
||||||
QString getPlayerBgPath() const { return playerBgPath; }
|
QString getPlayerBgPath() const { return playerBgPath; }
|
||||||
QString getCardBackPicturePath() const { return cardBackPicturePath; }
|
QString getCardBackPicturePath() const { return cardBackPicturePath; }
|
||||||
bool getPicDownload() const { return picDownload; }
|
bool getPicDownload() const { return picDownload; }
|
||||||
|
bool getNotificationsEnabled() const { return notificationsEnabled; }
|
||||||
bool getDoubleClickToPlay() const { return doubleClickToPlay; }
|
bool getDoubleClickToPlay() const { return doubleClickToPlay; }
|
||||||
bool getPlayToStack() const { return playToStack; }
|
bool getPlayToStack() const { return playToStack; }
|
||||||
int getCardInfoMinimized() const { return cardInfoMinimized; }
|
int getCardInfoMinimized() const { return cardInfoMinimized; }
|
||||||
|
@ -91,6 +93,7 @@ public slots:
|
||||||
void setPlayerBgPath(const QString &_playerBgPath);
|
void setPlayerBgPath(const QString &_playerBgPath);
|
||||||
void setCardBackPicturePath(const QString &_cardBackPicturePath);
|
void setCardBackPicturePath(const QString &_cardBackPicturePath);
|
||||||
void setPicDownload(int _picDownload);
|
void setPicDownload(int _picDownload);
|
||||||
|
void setNotificationsEnabled(int _notificationsEnabled);
|
||||||
void setDoubleClickToPlay(int _doubleClickToPlay);
|
void setDoubleClickToPlay(int _doubleClickToPlay);
|
||||||
void setPlayToStack(int _playToStack);
|
void setPlayToStack(int _playToStack);
|
||||||
void setCardInfoMinimized(int _cardInfoMinimized);
|
void setCardInfoMinimized(int _cardInfoMinimized);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "tab_deck_editor.h"
|
#include "tab_deck_editor.h"
|
||||||
#include "pixmapgenerator.h"
|
#include "pixmapgenerator.h"
|
||||||
#include "userlist.h"
|
#include "userlist.h"
|
||||||
|
#include "settingscache.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
@ -417,7 +418,7 @@ void TabSupervisor::tabUserEvent(bool globalEvent)
|
||||||
tab->setContentsChanged(true);
|
tab->setContentsChanged(true);
|
||||||
setTabIcon(indexOf(tab), *tabChangedIcon);
|
setTabIcon(indexOf(tab), *tabChangedIcon);
|
||||||
}
|
}
|
||||||
if (globalEvent)
|
if (globalEvent && settingsCache->getNotificationsEnabled())
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue