summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp16
-rw-r--r--Swift/QtUI/QtLoginWindow.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index 655e3b9..83a6ba0 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -24,6 +24,7 @@
#include "Swift/Controllers/UIEvents/UIEventStream.h"
#include "Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h"
#include "Swift/Controllers/UIEvents/ToggleSoundsUIEvent.h"
+#include "Swift/Controllers/UIEvents/ToggleNotificationsUIEvent.h"
#include "Swiften/Base/Platform.h"
#include "QtAboutWidget.h"
@@ -149,6 +150,14 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream) : QMainWindow() {
connect(toggleSoundsAction_, SIGNAL(toggled(bool)), SLOT(handleToggleSounds(bool)));
generalMenu_->addAction(toggleSoundsAction_);
+ toggleNotificationsAction_ = new QAction(tr("Show Notifications"), this);
+ toggleNotificationsAction_->setCheckable(true);
+ toggleNotificationsAction_->setChecked(true);
+ connect(toggleNotificationsAction_, SIGNAL(toggled(bool)), SLOT(handleToggleNotifications(bool)));
+#ifdef SWIFTEN_PLATFORM_LINUX
+ generalMenu_->addAction(toggleNotificationsAction_);
+#endif
+
QAction* quitAction = new QAction("Quit", this);
connect(quitAction, SIGNAL(triggered()), SLOT(handleQuit()));
@@ -164,6 +173,10 @@ void QtLoginWindow::handleUIEvent(boost::shared_ptr<UIEvent> event) {
if (soundEvent) {
toggleSoundsAction_->setChecked(soundEvent->getEnabled());
}
+ boost::shared_ptr<ToggleNotificationsUIEvent> notificationsEvent = boost::dynamic_pointer_cast<ToggleNotificationsUIEvent>(event);
+ if (notificationsEvent) {
+ toggleNotificationsAction_->setChecked(notificationsEvent->getEnabled());
+ }
}
/**
@@ -298,6 +311,9 @@ void QtLoginWindow::handleToggleSounds(bool enabled) {
uiEventStream_->send(boost::shared_ptr<ToggleSoundsUIEvent>(new ToggleSoundsUIEvent(enabled)));
}
+void QtLoginWindow::handleToggleNotifications(bool enabled) {
+ uiEventStream_->send(boost::shared_ptr<ToggleNotificationsUIEvent>(new ToggleNotificationsUIEvent(enabled)));
+}
void QtLoginWindow::handleQuit() {
QApplication::quit();
diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h
index c84033a..d9484b7 100644
--- a/Swift/QtUI/QtLoginWindow.h
+++ b/Swift/QtUI/QtLoginWindow.h
@@ -48,6 +48,7 @@ namespace Swift {
void handleQuit();
void handleShowXMLConsole();
void handleToggleSounds(bool enabled);
+ void handleToggleNotifications(bool enabled);
void handleAbout();
void bringToFront();
void handleUsernameTextChanged();
@@ -75,6 +76,7 @@ namespace Swift {
QMenu* generalMenu_;
QMenu* toolsMenu_;
QAction* toggleSoundsAction_;
+ QAction* toggleNotificationsAction_;
UIEventStream* uiEventStream_;
QPointer<QtAboutWidget> aboutDialog_;
};