diff options
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/MainController.cpp | 2 | ||||
-rw-r--r-- | Swift/Controllers/SoundEventController.cpp | 8 | ||||
-rw-r--r-- | Swift/Controllers/SoundEventController.h | 4 |
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_; }; } |