From 671ca11caba0dc80636ff76035f55b6b8fc3893e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 6 Aug 2012 22:50:39 +0300 Subject: Add equip button to outfits window. --- src/gui/outfitwindow.cpp | 33 +++++++++++++++++++++------------ src/gui/outfitwindow.h | 1 + 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index 8b498f46c..fafb69896 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -78,9 +78,9 @@ OutfitWindow::OutfitWindow(): setCloseButton(true); setStickyButtonLock(true); - setDefaultSize(250, 400, 150, 230); + setDefaultSize(250, 400, 150, 290); setMinWidth(145); - setMinHeight(260); + setMinHeight(283); mBorderColor = Theme::getThemeColor(Theme::BORDER, 64); mBackgroundColor = Theme::getThemeColor(Theme::BACKGROUND, 32); @@ -94,6 +94,7 @@ OutfitWindow::OutfitWindow(): mKeyLabel->setAlignment(gcn::Graphics::CENTER); mUnequipCheck = new CheckBox(_("Unequip first"), serverConfig.getValueBool("OutfitUnequip0", true)); + mEquipButtom = new Button(_("Equip"), "equip", this); mAwayOutfitCheck = new CheckBox(_("Away outfit"), serverConfig.getValue("OutfitAwayIndex", OUTFITS_COUNT - 1)); @@ -104,12 +105,13 @@ OutfitWindow::OutfitWindow(): mAwayOutfitCheck->setActionEventId("away"); mAwayOutfitCheck->addActionListener(this); - place(0, 3, mKeyLabel, 4); - place(0, 4, mPreviousButton, 1); - place(1, 4, mCurrentLabel, 2); - place(3, 4, mNextButton, 1); - place(0, 5, mUnequipCheck, 4); - place(0, 6, mAwayOutfitCheck, 4); + place(1, 3, mEquipButtom, 2); + place(0, 4, mKeyLabel, 4); + place(0, 5, mPreviousButton, 1); + place(1, 5, mCurrentLabel, 2); + place(3, 5, mNextButton, 1); + place(0, 6, mUnequipCheck, 4); + place(0, 7, mAwayOutfitCheck, 4); Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); @@ -228,20 +230,27 @@ void OutfitWindow::save() void OutfitWindow::action(const gcn::ActionEvent &event) { - if (event.getId() == "next") + const std::string eventId = event.getId(); + if (eventId == "next") { next(); } - else if (event.getId() == "previous") + else if (eventId == "previous") { previous(); } - else if (event.getId() == "unequip") + else if (eventId == "unequip") { if (mCurrentOutfit < OUTFITS_COUNT) mItemsUnequip[mCurrentOutfit] = mUnequipCheck->isSelected(); } - else if (event.getId() == "away") + else if (eventId == "equip") + { + wearOutfit(mCurrentOutfit); + if (Game::instance()) + Game::instance()->setValidSpeed(); + } + else if (eventId == "away") { mAwayOutfit = mCurrentOutfit; if (!mAwayOutfitCheck->isSelected()) diff --git a/src/gui/outfitwindow.h b/src/gui/outfitwindow.h index 29751f488..5c5e4778e 100644 --- a/src/gui/outfitwindow.h +++ b/src/gui/outfitwindow.h @@ -109,6 +109,7 @@ class OutfitWindow : public Window, gcn::ActionListener private: Button *mPreviousButton; Button *mNextButton; + Button *mEquipButtom; Label *mCurrentLabel; CheckBox *mUnequipCheck; CheckBox *mAwayOutfitCheck; -- cgit v1.2.3-60-g2f50