summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-04-05 11:01:48 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-04-05 11:01:48 (GMT)
commit348a4f13c5f00a27ad5c7e4f392948de7cc454e3 (patch)
tree43392423f5939190075d62aaae1478f52571af5c /Swift/QtUI/QtLoginWindow.cpp
parent326cd32e2c9e3ec9bac54f5bb952928680c93749 (diff)
downloadswift-348a4f13c5f00a27ad5c7e4f392948de7cc454e3.zip
swift-348a4f13c5f00a27ad5c7e4f392948de7cc454e3.tar.bz2
Persist Sound Toggleness.
Resolves: #192
Diffstat (limited to 'Swift/QtUI/QtLoginWindow.cpp')
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index 4f6b423..ff2a50b 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -1,5 +1,7 @@
#include "QtLoginWindow.h"
+#include <boost/bind.hpp>
+
#include "Swift/Controllers/UIEvents/UIEventStream.h"
#include "Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h"
#include "Swift/Controllers/UIEvents/ToggleSoundsUIEvent.h"
@@ -117,21 +119,29 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream) : QMainWindow() {
connect(xmlConsoleAction, SIGNAL(activated()), SLOT(handleShowXMLConsole()));
toolsMenu_->addAction(xmlConsoleAction);
- QAction* toggleSoundsAction = new QAction(tr("Toggle Sounds"), this);
- toggleSoundsAction->setCheckable(true);
- toggleSoundsAction->setChecked(true);
- connect(toggleSoundsAction, SIGNAL(toggled(bool)), SLOT(handleToggleSounds(bool)));
- swiftMenu_->addAction(toggleSoundsAction);
+ toggleSoundsAction_ = new QAction(tr("Toggle Sounds"), this);
+ toggleSoundsAction_->setCheckable(true);
+ toggleSoundsAction_->setChecked(true);
+ connect(toggleSoundsAction_, SIGNAL(toggled(bool)), SLOT(handleToggleSounds(bool)));
+ swiftMenu_->addAction(toggleSoundsAction_);
QAction* quitAction = new QAction("Quit", this);
connect(quitAction, SIGNAL(activated()), SLOT(handleQuit()));
swiftMenu_->addAction(quitAction);
-
+
setInitialMenus();
+ uiEventStream_->onUIEvent.connect(boost::bind(&QtLoginWindow::handleUIEvent, this, _1));
this->show();
}
+void QtLoginWindow::handleUIEvent(boost::shared_ptr<UIEvent> event) {
+ boost::shared_ptr<ToggleSoundsUIEvent> soundEvent = boost::dynamic_pointer_cast<ToggleSoundsUIEvent>(event);
+ if (soundEvent) {
+ toggleSoundsAction_->setChecked(soundEvent->getEnabled());
+ }
+}
+
/**
* Move and resize the window, but respect minimum sizes.
* (Like QWidget::setGeometry, only that will truncate the window