diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-08 13:47:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-08 14:39:55 +0300 |
commit | 0975dc4cd9012b098061f0201028896d578649f8 (patch) | |
tree | ccb3991a51ef9de47877a7d2549664d0f0ae4f79 /src | |
parent | 4a823c0ba94c620bd0e51fc61f22c068661946cf (diff) | |
download | plus-0975dc4cd9012b098061f0201028896d578649f8.tar.gz plus-0975dc4cd9012b098061f0201028896d578649f8.tar.bz2 plus-0975dc4cd9012b098061f0201028896d578649f8.tar.xz plus-0975dc4cd9012b098061f0201028896d578649f8.zip |
Remove duplicate variables from some classes.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/colorpage.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/colorpage.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/progressbar.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/progressbar.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.h | 10 | ||||
-rw-r--r-- | src/gui/windows/editdialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/editdialog.h | 1 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 6 |
9 files changed, 14 insertions, 34 deletions
diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp index ee5a37c3c..11dd1f07e 100644 --- a/src/gui/widgets/colorpage.cpp +++ b/src/gui/widgets/colorpage.cpp @@ -29,10 +29,10 @@ ColorPage::ColorPage(const Widget2 *const widget, gcn::ListModel *const listModel, const std::string &skin) : - ListBox(widget, listModel, skin), - mItemPadding(mSkin ? mSkin->getOption("itemPadding") : 1), - mRowHeight(13) + ListBox(widget, listModel, skin) { + mItemPadding = mSkin ? mSkin->getOption("itemPadding") : 1; + mRowHeight = 13; const gcn::Font *const font = getFont(); if (font) mRowHeight = font->getHeight() + 2 * mItemPadding; diff --git a/src/gui/widgets/colorpage.h b/src/gui/widgets/colorpage.h index 06699cbbd..c1c90eddf 100644 --- a/src/gui/widgets/colorpage.h +++ b/src/gui/widgets/colorpage.h @@ -41,10 +41,6 @@ class ColorPage final : public ListBox void resetAction(); void adjustSize() override final; - - private: - int mItemPadding; - unsigned int mRowHeight; }; #endif // GUI_WIDGETS_COLORPAGE_H diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 97c29bd8c..6454cf47a 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -46,10 +46,6 @@ ProgressBar::ProgressBar(const Widget2 *const widget, float progress, mSkin(nullptr), mProgress(progress), mProgressToGo(progress), - mBackgroundColor(Theme::getProgressColor(backColor >= 0 - ? backColor : 0, mProgress)), - mBackgroundColorToGo(mBackgroundColor), - mForegroundColor2(getThemeColor(Theme::PROGRESS_BAR_OUTLINE)), mText(), mVertexes(new ImageCollection), mProgressPalette(backColor), @@ -60,6 +56,11 @@ ProgressBar::ProgressBar(const Widget2 *const widget, float progress, mSmoothColorChange(true), mRedraw(true) { + mBackgroundColor = Theme::getProgressColor(backColor >= 0 + ? backColor : 0, mProgress); + mBackgroundColorToGo = mBackgroundColor; + mForegroundColor2 = getThemeColor(Theme::PROGRESS_BAR_OUTLINE); + // The progress value is directly set at load time: if (mProgress > 1.0F || mProgress < 0.0F) mProgress = 1.0F; diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index 9e503526c..eefabe83a 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -144,9 +144,7 @@ class ProgressBar final : public gcn::Widget, float mProgress; float mProgressToGo; - gcn::Color mBackgroundColor; gcn::Color mBackgroundColorToGo; - gcn::Color mForegroundColor2; std::string mText; ImageCollection *mVertexes; diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 9b368a10c..58f9ec8eb 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -42,20 +42,18 @@ const int ITEM_ICON_SIZE = 32; -float ShopListBox::mAlpha = 1.0; - ShopListBox::ShopListBox(const Widget2 *const widget, gcn::ListModel *const listModel) : ListBox(widget, listModel, "shoplistbox.xml"), mPlayerMoney(0), mShopItems(nullptr), mItemPopup(new ItemPopup), - mRowHeight(getFont()->getHeight()), mBackgroundColor(getThemeColor(Theme::BACKGROUND)), mWarningColor(getThemeColor(Theme::SHOP_WARNING)), mPriceCheck(true), mProtectItems(false) { + mRowHeight = getFont()->getHeight(); mItemPopup->postInit(); mHighlightColor = getThemeColor(Theme::HIGHLIGHT); mForegroundColor = getThemeColor(Theme::LISTBOX); @@ -68,12 +66,12 @@ ShopListBox::ShopListBox(const Widget2 *const widget, mPlayerMoney(0), mShopItems(shopListModel), mItemPopup(new ItemPopup), - mRowHeight(std::max(getFont()->getHeight(), ITEM_ICON_SIZE)), mBackgroundColor(getThemeColor(Theme::BACKGROUND)), mWarningColor(getThemeColor(Theme::SHOP_WARNING)), mPriceCheck(true), mProtectItems(false) { + mRowHeight = std::max(getFont()->getHeight(), ITEM_ICON_SIZE); mItemPopup->postInit(); mHighlightColor = getThemeColor(Theme::HIGHLIGHT); mForegroundColor = getThemeColor(Theme::LISTBOX); diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index 5cbc66158..095d187eb 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -59,12 +59,6 @@ class ShopListBox final : public ListBox void draw(gcn::Graphics *graphics) override final; /** - * Returns the height of a row. - */ - unsigned int getRowHeight() const override final A_WARN_UNUSED - { return mRowHeight; } - - /** * gives information about the current player's money */ void setPlayersMoney(const int money); @@ -100,15 +94,11 @@ class ShopListBox final : public ListBox ItemPopup *mItemPopup; - unsigned int mRowHeight; /**< Row Height */ - gcn::Color mBackgroundColor; gcn::Color mWarningColor; bool mPriceCheck; bool mProtectItems; - - static float mAlpha; }; #endif // GUI_WIDGETS_SHOPLISTBOX_H diff --git a/src/gui/windows/editdialog.cpp b/src/gui/windows/editdialog.cpp index 502b71ecb..5c002212f 100644 --- a/src/gui/windows/editdialog.cpp +++ b/src/gui/windows/editdialog.cpp @@ -35,9 +35,9 @@ EditDialog::EditDialog(const std::string &restrict title, Window(title, modal, parent, "edit.xml"), gcn::ActionListener(), mEventOk(eventOk), - mTextField(new TextField(this)), - mDefaultWidth(width) + mTextField(new TextField(this)) { + mDefaultWidth = width; mTextField->setText(msg); } diff --git a/src/gui/windows/editdialog.h b/src/gui/windows/editdialog.h index 74242ed52..fa4a02bf7 100644 --- a/src/gui/windows/editdialog.h +++ b/src/gui/windows/editdialog.h @@ -66,7 +66,6 @@ class EditDialog final : public Window, public gcn::ActionListener private: std::string mEventOk; TextField *mTextField; - int mDefaultWidth; }; #endif // GUI_WINDOWS_EDITDIALOG_H diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 844bca4ec..ce7c1027a 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -64,14 +64,14 @@ class SkillListBox final : public ListBox ListBox(widget, model, "skilllistbox.xml"), mModel(model), mPopup(new TextPopup), - mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), mTextColor(getThemeColor(Theme::TEXT)), mTextColor2(getThemeColor(Theme::TEXT_OUTLINE)), mTextPadding(mSkin ? mSkin->getOption("textPadding", 34) : 34), mSpacing(mSkin ? mSkin->getOption("spacing", 0) : 0), - mRowHeight(getFont()->getHeight() * 2 + mSpacing + 2 * mPadding), mSkillClicked(false) { + mRowHeight = getFont()->getHeight() * 2 + mSpacing + 2 * mPadding; + mHighlightColor = getThemeColor(Theme::HIGHLIGHT); mPopup->postInit(); if (mRowHeight < 34) @@ -233,12 +233,10 @@ class SkillListBox final : public ListBox private: SkillModel *mModel; TextPopup *mPopup; - gcn::Color mHighlightColor; gcn::Color mTextColor; gcn::Color mTextColor2; int mTextPadding; int mSpacing; - int mRowHeight; bool mSkillClicked; }; |