diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-12-22 15:23:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-12-22 15:23:28 +0300 |
commit | d7131239c18eafecef2e8b8fa6898ba9962ff0e8 (patch) | |
tree | f54629cc0e2616281957e24e18f27f9d33ceaa4b /src/gui/windows | |
parent | 0dd6ab2bfdee4527ca0960b4e7a64e257bb93fa3 (diff) | |
download | plus-d7131239c18eafecef2e8b8fa6898ba9962ff0e8.tar.gz plus-d7131239c18eafecef2e8b8fa6898ba9962ff0e8.tar.bz2 plus-d7131239c18eafecef2e8b8fa6898ba9962ff0e8.tar.xz plus-d7131239c18eafecef2e8b8fa6898ba9962ff0e8.zip |
allow use different theme file for different progress bars.
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 26 | ||||
-rw-r--r-- | src/gui/windows/ministatuswindow.h | 1 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 13 | ||||
-rw-r--r-- | src/gui/windows/updaterwindow.cpp | 3 |
5 files changed, 30 insertions, 19 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index bdc0b342e..b477e2b5a 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -117,7 +117,8 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): mRetrieveButton(nullptr), mInvCloseButton(nullptr), mWeightBar(nullptr), - mSlotsBar(new ProgressBar(this, 0.0F, 100, 0, Theme::PROG_INVY_SLOTS)), + mSlotsBar(new ProgressBar(this, 0.0F, 100, 0, Theme::PROG_INVY_SLOTS, + "slotsprogressbar.xml")), mFilter(nullptr), mSortModel(new SortListModelInv), mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort")), @@ -225,7 +226,8 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): mShopButton = new Button(this, _("Shop"), "shop", this); // TRANSLATORS: inventory button mEquipmentButton = new Button(this, _("Equipment"), "equipment", this); - mWeightBar = new ProgressBar(this, 0.0F, 100, 0, Theme::PROG_WEIGHT); + mWeightBar = new ProgressBar(this, 0.0F, 100, 0, Theme::PROG_WEIGHT, + "weightprogressbar.xml"); mWeightBar->setColor(Theme::getThemeColor(Theme::WEIGHT_BAR), Theme::getThemeColor(Theme::WEIGHT_BAR_OUTLINE)); diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 4d1a0ba82..cd3f3701d 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -63,35 +63,38 @@ MiniStatusWindow::MiniStatusWindow() : mMaxX(0), // TRANSLATORS: status bar name mHpBar(createBar(0, 100, 0, Theme::HP_BAR, Theme::PROG_HP, - "hp bar", _("health bar"))), + "hpprogressbar.xml", "hp bar", _("health bar"))), mMpBar(Net::getGameHandler()->canUseMagicBar() ? createBar(0, 100, 0, Net::getPlayerHandler()->canUseMagic() ? Theme::MP_BAR : Theme::NO_MP_BAR, Net::getPlayerHandler()->canUseMagic() + ? Theme::PROG_MP : Theme::PROG_NO_MP, + Net::getPlayerHandler()->canUseMagic() + ? "mpprogressbar.xml" : "nompprogressbar.xml", // TRANSLATORS: status bar name - ? Theme::PROG_MP : Theme::PROG_NO_MP, "mp bar", _("mana bar")) - : nullptr), + "mp bar", _("mana bar")) : nullptr), mXpBar(createBar(0, 100, 0, Theme::XP_BAR, Theme::PROG_EXP, // TRANSLATORS: status bar name - "xp bar", _("experience bar"))), + "xpprogressbar.xml", "xp bar", _("experience bar"))), mJobBar(nullptr), mWeightBar(createBar(0, 140, 0, Theme::WEIGHT_BAR, Theme::PROG_WEIGHT, // TRANSLATORS: status bar name - "weight bar", _("weight bar"))), + "weightprogressbar.xml", "weight bar", _("weight bar"))), mInvSlotsBar(createBar(0, 45, 0, Theme::SLOTS_BAR, Theme::PROG_INVY_SLOTS, + "slotsprogressbar.xml", "inventory slots bar", // TRANSLATORS: status bar name - "inventory slots bar", _("inventory slots bar"))), + _("inventory slots bar"))), mMoneyBar(createBar(0, 130, 0, Theme::MONEY_BAR, Theme::PROG_MONEY, // TRANSLATORS: status bar name - "money bar", _("money bar"))), + "moneyprogressbar.xml", "money bar", _("money bar"))), mArrowsBar(createBar(0, 50, 0, Theme::ARROWS_BAR, Theme::PROG_ARROWS, // TRANSLATORS: status bar name - "arrows bar", _("arrows bar"))), + "arrowsprogressbar.xml", "arrows bar", _("arrows bar"))), mStatusBar(createBar(100, (config.getIntValue("fontSize") > 16 ? 250 : 165), 0, Theme::STATUS_BAR, Theme::PROG_STATUS, // TRANSLATORS: status bar name - "status bar", _("status bar"))), + "statusprogressbar.xml", "status bar", _("status bar"))), mTextPopup(new TextPopup), mStatusPopup(new StatusPopup) { @@ -114,7 +117,7 @@ MiniStatusWindow::MiniStatusWindow() : { mJobBar = createBar(0, 100, 0, Theme::JOB_BAR, Theme::PROG_JOB, // TRANSLATORS: status bar name - "job bar", _("job bar")); + "jobprogressbar.xml", "job bar", _("job bar")); StatusWindow::updateJobBar(mJobBar); } @@ -160,12 +163,13 @@ ProgressBar *MiniStatusWindow::createBar(const float progress, const int width, const int height, const int textColor, const int backColor, + const std::string &restrict skin, const std::string &restrict name, const std::string &restrict description) { ProgressBar *const bar = new ProgressBar(this, - progress, width, height, backColor); + progress, width, height, backColor, skin); bar->setActionEventId(name); bar->setId(description); bar->setColor(Theme::getThemeColor(textColor), diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h index f40518d9b..e2bae8a49 100644 --- a/src/gui/windows/ministatuswindow.h +++ b/src/gui/windows/ministatuswindow.h @@ -99,6 +99,7 @@ class MiniStatusWindow final : public Popup, ProgressBar *createBar(const float progress, const int width, const int height, const int textColor, const int backColor, + const std::string &restrict skin, const std::string &restrict name, const std::string &restrict description) A_WARN_UNUSED; diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 2cf1e9168..1f0fb4d91 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -191,15 +191,16 @@ StatusWindow::StatusWindow() : max = 1; mHpBar = new ProgressBar(this, static_cast<float>(PlayerInfo::getAttribute( - PlayerInfo::HP)) / static_cast<float>(max), 80, 0, Theme::PROG_HP); + PlayerInfo::HP)) / static_cast<float>(max), 80, 0, + Theme::PROG_HP, "hpprogressbar.xml"); mHpBar->setColor(Theme::getThemeColor(Theme::HP_BAR), Theme::getThemeColor(Theme::HP_BAR_OUTLINE)); max = PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED); mXpBar = new ProgressBar(this, max ? static_cast<float>(PlayerInfo::getAttribute(PlayerInfo::EXP)) - / static_cast<float>(max): - static_cast<float>(0), 80, 0, Theme::PROG_EXP); + / static_cast<float>(max) : static_cast<float>(0), + 80, 0, Theme::PROG_EXP, "xpprogressbar.xml"); mXpBar->setColor(Theme::getThemeColor(Theme::XP_BAR), Theme::getThemeColor(Theme::XP_BAR_OUTLINE)); @@ -216,7 +217,8 @@ StatusWindow::StatusWindow() : mMpBar = new ProgressBar(this, max ? static_cast<float>( PlayerInfo::getAttribute(PlayerInfo::MAX_MP)) / static_cast<float>(max) : static_cast<float>(0), - 80, 0, useMagic ? Theme::PROG_MP : Theme::PROG_NO_MP); + 80, 0, useMagic ? Theme::PROG_MP : Theme::PROG_NO_MP, + useMagic ? "mpprogressbar.xml" : "nompprogressbar.xml"); if (useMagic) { mMpBar->setColor(Theme::getThemeColor(Theme::MP_BAR), @@ -255,7 +257,8 @@ StatusWindow::StatusWindow() : mJobLvlLabel = new Label(this, strprintf(_("Job: %d"), 0)); // TRANSLATORS: status window label mJobLabel = new Label(this, _("Job:")); - mJobBar = new ProgressBar(this, 0.0F, 80, 0, Theme::PROG_JOB); + mJobBar = new ProgressBar(this, 0.0F, 80, 0, Theme::PROG_JOB, + "jobprogressbar.xml"); mJobBar->setColor(Theme::getThemeColor(Theme::JOB_BAR), Theme::getThemeColor(Theme::JOB_BAR_OUTLINE)); diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 003529fbc..e219ab0b7 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -179,7 +179,8 @@ UpdaterWindow::UpdaterWindow(const std::string &restrict updateHost, mCancelButton(new Button(this, _("Cancel"), "cancel", this)), // TRANSLATORS: updater window button mPlayButton(new Button(this, _("Play"), "play", this)), - mProgressBar(new ProgressBar(this, 0.0, 310, 0, Theme::PROG_UPDATE)), + mProgressBar(new ProgressBar(this, 0.0, 310, 0, Theme::PROG_UPDATE, + "updateprogressbar.xml")), mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, "browserbox.xml")), mScrollArea(new ScrollArea(mBrowserBox, true, "update_background.xml")), |