summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-09-12 18:55:01 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-09-12 18:55:01 (GMT)
commit7dafb815ca404f1e15c9cdf6b26817c941dae4ec (patch)
tree5f1a523042bd4b9ccb84efce74ab2441dacef8ea /Swift/Controllers
parent7e157ace6678dd4af7a091ea5cc5fbc3baabe7f7 (diff)
downloadswift-7dafb815ca404f1e15c9cdf6b26817c941dae4ec.zip
swift-7dafb815ca404f1e15c9cdf6b26817c941dae4ec.tar.bz2
Getting ready for sounds to be turned off.
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/MainController.cpp2
-rw-r--r--Swift/Controllers/SoundEventController.cpp8
-rw-r--r--Swift/Controllers/SoundEventController.h4
3 files changed, 10 insertions, 4 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 1fc0b2d..6bed7da 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -70,7 +70,7 @@ MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowF
eventController_ = new EventController();
eventController_->onEventQueueLengthChange.connect(boost::bind(&MainController::handleEventQueueLengthChange, this, _1));
systemTrayController_ = new SystemTrayController(eventController_, systemTray);
- soundEventController_ = new SoundEventController(eventController_, soundPlayer);
+ soundEventController_ = new SoundEventController(eventController_, soundPlayer, settings->getBoolSetting("playSounds", true));
loginWindow_ = loginWindowFactory_->createLoginWindow(settings->getStringSetting("jid"), settings->getStringSetting("pass"), settings->getStringSetting("certificate"));
loginWindow_->onLoginRequest.connect(boost::bind(&MainController::handleLoginRequest, this, _1, _2, _3, _4));
}
diff --git a/Swift/Controllers/SoundEventController.cpp b/Swift/Controllers/SoundEventController.cpp
index 46d6ddb..133becf 100644
--- a/Swift/Controllers/SoundEventController.cpp
+++ b/Swift/Controllers/SoundEventController.cpp
@@ -7,15 +7,19 @@
namespace Swift {
-SoundEventController::SoundEventController(EventController* eventController, SoundPlayer* soundPlayer) {
+SoundEventController::SoundEventController(EventController* eventController, SoundPlayer* soundPlayer, bool playSounds) {
eventController_ = eventController;
soundPlayer_ = soundPlayer;
+ playSounds_ = playSounds;
eventController_->onEventQueueEventAdded.connect(boost::bind(&SoundEventController::handleEventQueueEventAdded, this, _1));
}
void SoundEventController::handleEventQueueEventAdded(boost::shared_ptr<MessageEvent> event) {
- soundPlayer_->playSound(SoundPlayer::MessageReceived);
+ if (playSounds_) soundPlayer_->playSound(SoundPlayer::MessageReceived);
}
+void SoundEventController::setPlaySounds(bool playSounds) {
+ playSounds_ = playSounds;
+}
}
diff --git a/Swift/Controllers/SoundEventController.h b/Swift/Controllers/SoundEventController.h
index 8da057d..9ac6f76 100644
--- a/Swift/Controllers/SoundEventController.h
+++ b/Swift/Controllers/SoundEventController.h
@@ -9,10 +9,12 @@ namespace Swift {
class SoundPlayer;
class SoundEventController {
public:
- SoundEventController(EventController* eventController, SoundPlayer* soundPlayer);
+ SoundEventController(EventController* eventController, SoundPlayer* soundPlayer, bool playSounds);
+ void setPlaySounds(bool playSounds);
private:
void handleEventQueueEventAdded(boost::shared_ptr<MessageEvent> event);
EventController* eventController_;
SoundPlayer* soundPlayer_;
+ bool playSounds_;
};
}