diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-03 23:46:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-03 23:46:10 +0300 |
commit | ba8c196534f110e14e13915b299f9f658b875357 (patch) | |
tree | e855f7f3e6e66a971b29551fdb870f273930e439 /src | |
parent | be5390833be676363630fcf69e81c838ba52bac2 (diff) | |
download | plus-ba8c196534f110e14e13915b299f9f658b875357.tar.gz plus-ba8c196534f110e14e13915b299f9f658b875357.tar.bz2 plus-ba8c196534f110e14e13915b299f9f658b875357.tar.xz plus-ba8c196534f110e14e13915b299f9f658b875357.zip |
Add sound effects for open/close windows.
Diffstat (limited to 'src')
30 files changed, 52 insertions, 7 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp index 770c61ee0..fd6feeee9 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -241,6 +241,8 @@ DefaultsData* getConfigDefaults() AddDEF("soundinfo", "notify"); AddDEF("soundrequest", "attention"); AddDEF("soundguild", "newmessage"); + AddDEF("soundshowwindow", "page"); + AddDEF("soundhidewindow", "book"); AddDEF("autohideButtons", true); AddDEF("autohideChat", false); AddDEF("downloadProxy", ""); diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp index c01925c05..63721c242 100644 --- a/src/gui/botcheckerwindow.cpp +++ b/src/gui/botcheckerwindow.cpp @@ -334,6 +334,7 @@ BotCheckerWindow::BotCheckerWindow(): setWidth(w); setHeight(h); loadWindowState(); + enableVisibleSound(true); config.addListener("enableBotCheker", this); mEnabled = config.getBoolValue("enableBotCheker"); diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp index 9eba7796b..e30da6702 100644 --- a/src/gui/buydialog.cpp +++ b/src/gui/buydialog.cpp @@ -145,6 +145,7 @@ void BuyDialog::init() center(); loadWindowState(); + enableVisibleSound(true); instances.push_back(this); setVisible(true); diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp index 31a1aa315..e0cdf2f31 100644 --- a/src/gui/buyselldialog.cpp +++ b/src/gui/buyselldialog.cpp @@ -84,6 +84,7 @@ void BuySellDialog::init() center(); setDefaultSize(); loadWindowState(); + enableVisibleSound(true); instances.push_back(this); setVisible(true); diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 43d0f9634..190961839 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -229,6 +229,7 @@ ChatWindow::ChatWindow(): mAutoHide = config.getBoolValue("autohideChat"); mShowBattleEvents = config.getBoolValue("showBattleEvents"); + enableVisibleSound(true); } ChatWindow::~ChatWindow() diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 673edc914..0fe1e7d2b 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -75,6 +75,7 @@ DebugWindow::DebugWindow(): mTargetWidget->resize(getWidth(), getHeight()); mNetWidget->resize(getWidth(), getHeight()); loadWindowState(); + enableVisibleSound(true); } DebugWindow::~DebugWindow() diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp index 24965848e..fb90d0576 100644 --- a/src/gui/didyouknowwindow.cpp +++ b/src/gui/didyouknowwindow.cpp @@ -87,6 +87,7 @@ DidYouKnowWindow::DidYouKnowWindow(): layout.setRowHeight(0, Layout::AUTO_SET); loadWindowState(); + enableVisibleSound(true); } void DidYouKnowWindow::action(const gcn::ActionEvent &event) diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index d8e79e0c1..b40a73afd 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -108,7 +108,7 @@ EquipmentWindow::EquipmentWindow(Equipment *const equipment, mSlotHighlightedBackground = rect.grid[1]; add(mPlayerBox); add(mUnequip); - + enableVisibleSound(true); } EquipmentWindow::~EquipmentWindow() diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index 6dbb6ec09..62be2fd1a 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -77,6 +77,7 @@ HelpWindow::HelpWindow(): loadWindowState(); loadTags(); + enableVisibleSound(true); } void HelpWindow::action(const gcn::ActionEvent &event) diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 6faa4e5d1..ffa1f29d8 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -238,6 +238,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): } loadWindowState(); + enableVisibleSound(true); slotsChanged(mInventory); widgetResized(nullptr); diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index 3ce85db33..d26b3bf84 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -132,7 +132,7 @@ KillStats::KillStats(): place(5, 14, mResetButton).setPadding(0); loadWindowState(); - + enableVisibleSound(true); } KillStats::~KillStats() diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index a93e0a422..b773976c3 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -70,6 +70,7 @@ Minimap::Minimap(): loadWindowState(); setVisible(mShow, isSticky()); + enableVisibleSound(true); } Minimap::~Minimap() diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 57501a35f..4298d8b68 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -160,6 +160,7 @@ NpcDialog::NpcDialog(const int npcId) : instances.push_back(this); setVisible(true); requestFocus(); + enableVisibleSound(true); config.addListener("logNpcInGui", this); } diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp index 7871ba09c..846788204 100644 --- a/src/gui/npcpostdialog.cpp +++ b/src/gui/npcpostdialog.cpp @@ -82,6 +82,7 @@ NpcPostDialog::NpcPostDialog(const int npcId): instances.push_back(this); setVisible(true); + enableVisibleSound(true); } NpcPostDialog::~NpcPostDialog() diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index 8afc92b43..21ef7e2cb 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -116,6 +116,7 @@ OutfitWindow::OutfitWindow(): loadWindowState(); + enableVisibleSound(true); load(); } diff --git a/src/gui/questswindow.cpp b/src/gui/questswindow.cpp index c9e05cd14..3407ba891 100644 --- a/src/gui/questswindow.cpp +++ b/src/gui/questswindow.cpp @@ -133,6 +133,7 @@ QuestsWindow::QuestsWindow() : layout.setRowHeight(0, Layout::AUTO_SET); loadWindowState(); + enableVisibleSound(true); loadXml(); } diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index f8f37bdec..8e3bc4d25 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -26,6 +26,7 @@ #include "game.h" #include "keydata.h" #include "keyevent.h" +#include "sound.h" #include "gui/chatwindow.h" #include "gui/npcdialog.h" @@ -96,12 +97,15 @@ QuitDialog::QuitDialog(QuitDialog **const pointerToMe): reflowLayout(200, 0); setLocationRelativeTo(getParent()); setVisible(true); + sound.playGuiSound(SOUND_SHOW_WINDOW); +// enableVisibleSound(true); requestModalFocus(); mOkButton->requestFocus(); } QuitDialog::~QuitDialog() { + sound.playGuiSound(SOUND_HIDE_WINDOW); if (mMyPointer) *mMyPointer = nullptr; // Optional widgets, so delete them by hand. diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp index 777c60c10..06b622930 100644 --- a/src/gui/selldialog.cpp +++ b/src/gui/selldialog.cpp @@ -131,6 +131,7 @@ void SellDialog::init() instances.push_back(this); setVisible(true); + enableVisibleSound(true); } SellDialog::~SellDialog() diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 51c8eb9f8..ddcf13d77 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -132,6 +132,7 @@ Setup::Setup(): center(); setInGame(false); + enableVisibleSound(true); } Setup::~Setup() diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index 1faeca28a..ccd304c84 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -118,6 +118,12 @@ Setup_Audio::Setup_Audio() : new SetupItemSound(_("Trade request sound"), "", "soundtrade", this, "soundtradeEvent", mSoundModel); + new SetupItemSound(_("Show window sound"), "", + "soundshowwindow", this, "soundshowwindowEvent", mSoundModel); + + new SetupItemSound(_("Hide window sound"), "", + "soundhidewindow", this, "soundhidewindowEvent", mSoundModel); + new SetupItemLabel(_("Other"), "", this); new SetupItemCheckBox(_("Enable mumble voice chat"), "", diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 016ad2d26..9b32d0a38 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -114,25 +114,20 @@ ShopWindow::ShopWindow(): setMinHeight(230); setDefaultSize(380, 300, ImageRect::CENTER); - mAnnounceCounter[BUY] = 0; mAnnounceCounter[SELL] = 0; loadList(); - mBuyShopItemList->setPriceCheck(false); mSellShopItemList->setPriceCheck(false); mBuyScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mSellScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mBuyShopItemList->addSelectionListener(this); mSellShopItemList->addSelectionListener(this); - - ContainerPlacer placer; placer = getPlacer(0, 0); @@ -170,6 +165,7 @@ ShopWindow::ShopWindow(): instances.push_back(this); setVisible(false); + enableVisibleSound(true); updateButtonsAndLabels(); } diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index 846bbb497..bc8cd5fc1 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -98,6 +98,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title, layout.setMargin(0); loadWindowState(); + enableVisibleSound(true); } ShortcutWindow::ShortcutWindow(const std::string &title, std::string skinFile, @@ -134,6 +135,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title, std::string skinFile, layout.setMargin(0); loadWindowState(); + enableVisibleSound(true); } ShortcutWindow::~ShortcutWindow() diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 0c79d0bd6..e3316486f 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -245,6 +245,7 @@ SkillDialog::SkillDialog() : setLocationRelativeTo(getParent()); loadWindowState(); + enableVisibleSound(true); } SkillDialog::~SkillDialog() diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 549b2bcc4..1b1d0e6e8 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -1277,6 +1277,7 @@ SocialWindow::SocialWindow() : if (player_node && player_node->getGuild()) addTab(player_node->getGuild()); + enableVisibleSound(true); updateButtons(); } diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 10a30f1b9..2a8c39240 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -253,6 +253,7 @@ StatusWindow::StatusWindow() : } loadWindowState(); + enableVisibleSound(true); // Update bars updateHPBar(mHpBar, true); diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp index b696bad39..054a0237f 100644 --- a/src/gui/tradewindow.cpp +++ b/src/gui/tradewindow.cpp @@ -135,6 +135,7 @@ TradeWindow::TradeWindow(): layout.setColWidth(1, Layout::AUTO_SET); loadWindowState(); + enableVisibleSound(true); reset(); } diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index b522b8157..962a0993b 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -117,6 +117,7 @@ WhoIsOnline::WhoIsOnline(): setLocationRelativeTo(getParent()); loadWindowState(); + enableVisibleSound(true); download(); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 7680600ff..a975f2db1 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -26,6 +26,7 @@ #include "configuration.h" #include "graphicsvertexes.h" #include "logger.h" +#include "sound.h" #include "gui/gui.h" #include "gui/palette.h" @@ -79,6 +80,7 @@ Window::Window(const std::string &caption, const bool modal, mGripPadding(2), mResizeHandles(-1), mRedraw(true), + mPlayVisibleSound(false), mCaptionFont(getFont()) { logger->log("Window::Window(\"%s\")", caption.c_str()); @@ -504,6 +506,8 @@ void Window::setVisible(bool visible, bool forceSticky) gcn::Window::setVisible((!forceSticky && isSticky()) || visible); if (visible) { + if (mPlayVisibleSound) + sound.playGuiSound(SOUND_SHOW_WINDOW); if (gui) { gcn::MouseEvent *event = reinterpret_cast<gcn::MouseEvent*>( @@ -521,6 +525,11 @@ void Window::setVisible(bool visible, bool forceSticky) } } } + else + { + if (mPlayVisibleSound) + sound.playGuiSound(SOUND_HIDE_WINDOW); + } } void Window::scheduleDelete() diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index c8b8fb080..6739b5186 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -405,6 +405,9 @@ class Window : public gcn::Window, private gcn::WidgetListener void setCaptionFont(gcn::Font *font) { mCaptionFont = font; } + void enableVisibleSound(bool b) + { mPlayVisibleSound = b; } + protected: bool canMove() const; @@ -488,6 +491,7 @@ class Window : public gcn::Window, private gcn::WidgetListener int mGripPadding; int mResizeHandles; bool mRedraw; + bool mPlayVisibleSound; gcn::Font *mCaptionFont; }; diff --git a/src/sound.h b/src/sound.h index c3e5e469a..071b77597 100644 --- a/src/sound.h +++ b/src/sound.h @@ -41,6 +41,8 @@ static const std::string SOUND_WHISPER = "soundwhisper"; static const std::string SOUND_HIGHLIGHT = "soundhighlight"; static const std::string SOUND_GLOBAL = "soundglobal"; static const std::string SOUND_GUILD = "soundguild"; +static const std::string SOUND_SHOW_WINDOW = "soundshowwindow"; +static const std::string SOUND_HIDE_WINDOW = "soundhidewindow"; /** Sound engine * |