Merge pull request #765 from Cockatrice/no-spec-alerts
Game events do not notify taskbar while spectating.
This commit is contained in:
commit
66678e95dc
6 changed files with 41 additions and 12 deletions
|
@ -446,6 +446,11 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
|
|
||||||
notificationsEnabledCheckBox.setChecked(settingsCache->getNotificationsEnabled());
|
notificationsEnabledCheckBox.setChecked(settingsCache->getNotificationsEnabled());
|
||||||
connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setNotificationsEnabled(int)));
|
connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setNotificationsEnabled(int)));
|
||||||
|
connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSpecNotificationEnabled(int)));
|
||||||
|
|
||||||
|
specNotificationsEnabledCheckBox.setChecked(settingsCache->getSpectatorNotificationsEnabled());
|
||||||
|
specNotificationsEnabledCheckBox.setEnabled(settingsCache->getNotificationsEnabled());
|
||||||
|
connect(&specNotificationsEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setSpectatorNotificationsEnabled(int)));
|
||||||
|
|
||||||
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)));
|
||||||
|
@ -455,8 +460,9 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
|
|
||||||
QGridLayout *generalGrid = new QGridLayout;
|
QGridLayout *generalGrid = new QGridLayout;
|
||||||
generalGrid->addWidget(¬ificationsEnabledCheckBox, 0, 0);
|
generalGrid->addWidget(¬ificationsEnabledCheckBox, 0, 0);
|
||||||
generalGrid->addWidget(&doubleClickToPlayCheckBox, 1, 0);
|
generalGrid->addWidget(&specNotificationsEnabledCheckBox, 1, 0);
|
||||||
generalGrid->addWidget(&playToStackCheckBox, 2, 0);
|
generalGrid->addWidget(&doubleClickToPlayCheckBox, 2, 0);
|
||||||
|
generalGrid->addWidget(&playToStackCheckBox, 3, 0);
|
||||||
|
|
||||||
generalGroupBox = new QGroupBox;
|
generalGroupBox = new QGroupBox;
|
||||||
generalGroupBox->setLayout(generalGrid);
|
generalGroupBox->setLayout(generalGrid);
|
||||||
|
@ -500,10 +506,15 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UserInterfaceSettingsPage::setSpecNotificationEnabled(int i) {
|
||||||
|
specNotificationsEnabledCheckBox.setEnabled(i != 0);
|
||||||
|
}
|
||||||
|
|
||||||
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"));
|
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)"));
|
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"));
|
||||||
|
|
|
@ -115,10 +115,12 @@ class UserInterfaceSettingsPage : public AbstractSettingsPage {
|
||||||
private slots:
|
private slots:
|
||||||
void soundPathClearButtonClicked();
|
void soundPathClearButtonClicked();
|
||||||
void soundPathButtonClicked();
|
void soundPathButtonClicked();
|
||||||
|
void setSpecNotificationEnabled(int);
|
||||||
signals:
|
signals:
|
||||||
void soundPathChanged();
|
void soundPathChanged();
|
||||||
private:
|
private:
|
||||||
QCheckBox notificationsEnabledCheckBox;
|
QCheckBox notificationsEnabledCheckBox;
|
||||||
|
QCheckBox specNotificationsEnabledCheckBox;
|
||||||
QCheckBox doubleClickToPlayCheckBox;
|
QCheckBox doubleClickToPlayCheckBox;
|
||||||
QCheckBox playToStackCheckBox;
|
QCheckBox playToStackCheckBox;
|
||||||
QCheckBox tapAnimationCheckBox;
|
QCheckBox tapAnimationCheckBox;
|
||||||
|
|
|
@ -35,6 +35,7 @@ SettingsCache::SettingsCache()
|
||||||
|
|
||||||
mainWindowGeometry = settings->value("interface/main_window_geometry").toByteArray();
|
mainWindowGeometry = settings->value("interface/main_window_geometry").toByteArray();
|
||||||
notificationsEnabled = settings->value("interface/notificationsenabled", true).toBool();
|
notificationsEnabled = settings->value("interface/notificationsenabled", true).toBool();
|
||||||
|
spectatorNotificationsEnabled = settings->value("interface/specnotificationsenabled", false).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();
|
||||||
|
@ -183,6 +184,11 @@ void SettingsCache::setNotificationsEnabled(int _notificationsEnabled)
|
||||||
settings->setValue("interface/notificationsenabled", notificationsEnabled);
|
settings->setValue("interface/notificationsenabled", notificationsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setSpectatorNotificationsEnabled(int _spectatorNotificationsEnabled) {
|
||||||
|
spectatorNotificationsEnabled = _spectatorNotificationsEnabled;
|
||||||
|
settings->setValue("interface/specnotificationsenabled", spectatorNotificationsEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setDoubleClickToPlay(int _doubleClickToPlay)
|
void SettingsCache::setDoubleClickToPlay(int _doubleClickToPlay)
|
||||||
{
|
{
|
||||||
doubleClickToPlay = _doubleClickToPlay;
|
doubleClickToPlay = _doubleClickToPlay;
|
||||||
|
|
|
@ -48,6 +48,7 @@ private:
|
||||||
bool picDownload;
|
bool picDownload;
|
||||||
bool picDownloadHq;
|
bool picDownloadHq;
|
||||||
bool notificationsEnabled;
|
bool notificationsEnabled;
|
||||||
|
bool spectatorNotificationsEnabled;
|
||||||
bool doubleClickToPlay;
|
bool doubleClickToPlay;
|
||||||
bool playToStack;
|
bool playToStack;
|
||||||
int cardInfoMinimized;
|
int cardInfoMinimized;
|
||||||
|
@ -91,6 +92,8 @@ public:
|
||||||
bool getPicDownload() const { return picDownload; }
|
bool getPicDownload() const { return picDownload; }
|
||||||
bool getPicDownloadHq() const { return picDownloadHq; }
|
bool getPicDownloadHq() const { return picDownloadHq; }
|
||||||
bool getNotificationsEnabled() const { return notificationsEnabled; }
|
bool getNotificationsEnabled() const { return notificationsEnabled; }
|
||||||
|
bool getSpectatorNotificationsEnabled() const { return spectatorNotificationsEnabled; }
|
||||||
|
|
||||||
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; }
|
||||||
|
@ -139,6 +142,7 @@ public slots:
|
||||||
void setPicDownload(int _picDownload);
|
void setPicDownload(int _picDownload);
|
||||||
void setPicDownloadHq(int _picDownloadHq);
|
void setPicDownloadHq(int _picDownloadHq);
|
||||||
void setNotificationsEnabled(int _notificationsEnabled);
|
void setNotificationsEnabled(int _notificationsEnabled);
|
||||||
|
void setSpectatorNotificationsEnabled(int _spectatorNotificationsEnabled);
|
||||||
void setDoubleClickToPlay(int _doubleClickToPlay);
|
void setDoubleClickToPlay(int _doubleClickToPlay);
|
||||||
void setPlayToStack(int _playToStack);
|
void setPlayToStack(int _playToStack);
|
||||||
void setCardInfoMinimized(int _cardInfoMinimized);
|
void setCardInfoMinimized(int _cardInfoMinimized);
|
||||||
|
|
|
@ -514,6 +514,11 @@ void TabGame::addMentionTag(QString value) {
|
||||||
sayEdit->setFocus();
|
sayEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabGame::emitUserEvent() {
|
||||||
|
bool globalEvent = !spectator || settingsCache->getSpectatorNotificationsEnabled();
|
||||||
|
emit userEvent(globalEvent);
|
||||||
|
}
|
||||||
|
|
||||||
TabGame::~TabGame()
|
TabGame::~TabGame()
|
||||||
{
|
{
|
||||||
delete replay;
|
delete replay;
|
||||||
|
@ -806,7 +811,7 @@ void TabGame::processGameEventContainer(const GameEventContainer &cont, Abstract
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
player->processGameEvent(eventType, event, context);
|
player->processGameEvent(eventType, event, context);
|
||||||
emit userEvent();
|
emitUserEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -929,7 +934,7 @@ void TabGame::eventSpectatorLeave(const Event_Leave & /*event*/, int eventPlayer
|
||||||
playerListWidget->removePlayer(eventPlayerId);
|
playerListWidget->removePlayer(eventPlayerId);
|
||||||
spectators.remove(eventPlayerId);
|
spectators.remove(eventPlayerId);
|
||||||
|
|
||||||
emit userEvent();
|
emitUserEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::eventGameStateChanged(const Event_GameStateChanged &event, int /*eventPlayerId*/, const GameEventContext & /*context*/)
|
void TabGame::eventGameStateChanged(const Event_GameStateChanged &event, int /*eventPlayerId*/, const GameEventContext & /*context*/)
|
||||||
|
@ -988,7 +993,7 @@ void TabGame::eventGameStateChanged(const Event_GameStateChanged &event, int /*e
|
||||||
scene->clearViews();
|
scene->clearViews();
|
||||||
}
|
}
|
||||||
gameStateKnown = true;
|
gameStateKnown = true;
|
||||||
emit userEvent();
|
emitUserEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::eventPlayerPropertiesChanged(const Event_PlayerPropertiesChanged &event, int eventPlayerId, const GameEventContext &context)
|
void TabGame::eventPlayerPropertiesChanged(const Event_PlayerPropertiesChanged &event, int eventPlayerId, const GameEventContext &context)
|
||||||
|
@ -1056,7 +1061,7 @@ void TabGame::eventJoin(const Event_Join &event, int /*eventPlayerId*/, const Ga
|
||||||
messageLog->logJoin(newPlayer);
|
messageLog->logJoin(newPlayer);
|
||||||
}
|
}
|
||||||
playerListWidget->addPlayer(playerInfo);
|
playerListWidget->addPlayer(playerInfo);
|
||||||
emit userEvent();
|
emitUserEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::eventLeave(const Event_Leave & /*event*/, int eventPlayerId, const GameEventContext & /*context*/)
|
void TabGame::eventLeave(const Event_Leave & /*event*/, int eventPlayerId, const GameEventContext & /*context*/)
|
||||||
|
@ -1077,7 +1082,7 @@ void TabGame::eventLeave(const Event_Leave & /*event*/, int eventPlayerId, const
|
||||||
while (playerIterator.hasNext())
|
while (playerIterator.hasNext())
|
||||||
playerIterator.next().value()->updateZones();
|
playerIterator.next().value()->updateZones();
|
||||||
|
|
||||||
emit userEvent();
|
emitUserEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::eventKicked(const Event_Kicked & /*event*/, int /*eventPlayerId*/, const GameEventContext & /*context*/)
|
void TabGame::eventKicked(const Event_Kicked & /*event*/, int /*eventPlayerId*/, const GameEventContext & /*context*/)
|
||||||
|
@ -1092,7 +1097,7 @@ void TabGame::eventKicked(const Event_Kicked & /*event*/, int /*eventPlayerId*/,
|
||||||
msgBox.setIcon(QMessageBox::Information);
|
msgBox.setIcon(QMessageBox::Information);
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
|
|
||||||
emit userEvent();
|
emitUserEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::eventGameHostChanged(const Event_GameHostChanged & /*event*/, int eventPlayerId, const GameEventContext & /*context*/)
|
void TabGame::eventGameHostChanged(const Event_GameHostChanged & /*event*/, int eventPlayerId, const GameEventContext & /*context*/)
|
||||||
|
@ -1104,7 +1109,7 @@ void TabGame::eventGameClosed(const Event_GameClosed & /*event*/, int /*eventPla
|
||||||
{
|
{
|
||||||
closeGame();
|
closeGame();
|
||||||
messageLog->logGameClosed();
|
messageLog->logGameClosed();
|
||||||
emit userEvent();
|
emitUserEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
Player *TabGame::setActivePlayer(int id)
|
Player *TabGame::setActivePlayer(int id)
|
||||||
|
@ -1128,7 +1133,7 @@ Player *TabGame::setActivePlayer(int id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentPhase = -1;
|
currentPhase = -1;
|
||||||
emit userEvent();
|
emitUserEvent();
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1138,7 +1143,7 @@ void TabGame::eventSetActivePlayer(const Event_SetActivePlayer &event, int /*eve
|
||||||
if (!player)
|
if (!player)
|
||||||
return;
|
return;
|
||||||
messageLog->logSetActivePlayer(player);
|
messageLog->logSetActivePlayer(player);
|
||||||
emit userEvent();
|
emitUserEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::setActivePhase(int phase)
|
void TabGame::setActivePhase(int phase)
|
||||||
|
@ -1155,7 +1160,7 @@ void TabGame::eventSetActivePhase(const Event_SetActivePhase &event, int /*event
|
||||||
if (currentPhase != phase)
|
if (currentPhase != phase)
|
||||||
messageLog->logSetActivePhase(phase);
|
messageLog->logSetActivePhase(phase);
|
||||||
setActivePhase(phase);
|
setActivePhase(phase);
|
||||||
emit userEvent();
|
emitUserEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::newCardAdded(AbstractCardItem *card)
|
void TabGame::newCardAdded(AbstractCardItem *card)
|
||||||
|
|
|
@ -164,6 +164,7 @@ private:
|
||||||
void setActivePhase(int phase);
|
void setActivePhase(int phase);
|
||||||
void eventSetActivePhase(const Event_SetActivePhase &event, int eventPlayerId, const GameEventContext &context);
|
void eventSetActivePhase(const Event_SetActivePhase &event, int eventPlayerId, const GameEventContext &context);
|
||||||
void eventPing(const Event_Ping &event, int eventPlayerId, const GameEventContext &context);
|
void eventPing(const Event_Ping &event, int eventPlayerId, const GameEventContext &context);
|
||||||
|
void emitUserEvent();
|
||||||
signals:
|
signals:
|
||||||
void gameClosing(TabGame *tab);
|
void gameClosing(TabGame *tab);
|
||||||
void playerAdded(Player *player);
|
void playerAdded(Player *player);
|
||||||
|
|
Loading…
Reference in a new issue