diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-03-16 14:14:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-03-16 14:14:29 +0300 |
commit | 46087564d4184b28740b0c45c1bac199ab1942ec (patch) | |
tree | 0591b36aba2ae392eb569828930f030850cbc769 /src/gui | |
parent | cf9b1182f06b1336f0d1071c267ea36c990430fa (diff) | |
download | mv-46087564d4184b28740b0c45c1bac199ab1942ec.tar.gz mv-46087564d4184b28740b0c45c1bac199ab1942ec.tar.bz2 mv-46087564d4184b28740b0c45c1bac199ab1942ec.tar.xz mv-46087564d4184b28740b0c45c1bac199ab1942ec.zip |
Improve theme usage.
Removed instance method.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui.cpp | 3 | ||||
-rw-r--r-- | src/gui/theme.cpp | 34 | ||||
-rw-r--r-- | src/gui/theme.h | 20 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/button.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/checkbox.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/desktop.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/dropdown.cpp | 17 | ||||
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/label.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/listbox.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/playerbox.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/popup.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/progressbar.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/radiobutton.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 11 | ||||
-rw-r--r-- | src/gui/widgets/slider.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/tabs/tab.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/textpreview.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 4 | ||||
-rw-r--r-- | src/gui/windowmenu.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/equipmentwindow.cpp | 2 |
23 files changed, 62 insertions, 106 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index deed890ae..b17ae3ba8 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -316,7 +316,8 @@ Gui::~Gui() delete guiInput; guiInput = nullptr; - Theme::deleteInstance(); + delete theme; + theme = nullptr; if (Widget::widgetExists(mTop)) setTop(nullptr); diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 1a504f680..a3603d0e9 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -46,7 +46,7 @@ std::string Theme::mThemePath; std::string Theme::mThemeName; std::string Theme::mScreenDensity; -Theme *Theme::mInstance = nullptr; +Theme *theme = nullptr; // Set the theme path... static void initDefaultThemePath() @@ -245,27 +245,13 @@ Theme::~Theme() delete_all(mProgressColors); } -Theme *Theme::instance() -{ - if (!mInstance) - mInstance = new Theme; - - return mInstance; -} - -void Theme::deleteInstance() -{ - delete mInstance; - mInstance = nullptr; -} - Color Theme::getProgressColor(const int type, const float progress) { int color[3] = {0, 0, 0}; - if (mInstance) + if (theme) { - const DyePalette *const dye = mInstance->mProgressColors[type]; + const DyePalette *const dye = theme->mProgressColors[type]; if (dye) dye->getColor(progress, color); @@ -639,8 +625,8 @@ bool Theme::tryThemePath(const std::string &themeName) { mThemePath = path; mThemeName = themeName; - if (instance()) - instance()->loadColors(""); + if (theme) + theme->loadColors(""); return true; } } @@ -703,7 +689,7 @@ void Theme::prepareThemePath() if (mThemePath.empty()) mThemePath = "graphics/gui"; - instance()->loadColors(mThemePath); + theme->loadColors(mThemePath); logger->log("Selected Theme: " + mThemePath); } @@ -1191,7 +1177,9 @@ void Theme::unloadRect(const ImageRect &rect, const int start, Image *Theme::getImageFromThemeXml(const std::string &name, const std::string &name2) { - Theme *const theme = Theme::instance(); + if (!theme) + return nullptr; + Skin *const skin = theme->load(name, name2, false); if (skin) { @@ -1212,7 +1200,9 @@ ImageSet *Theme::getImageSetFromThemeXml(const std::string &name, const std::string &name2, const int w, const int h) { - Theme *const theme = Theme::instance(); + if (!theme) + return nullptr; + Skin *const skin = theme->load(name, name2, false); if (skin) { diff --git a/src/gui/theme.h b/src/gui/theme.h index 86543ea64..5f902e206 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -40,9 +40,12 @@ class DyePalette; class Image; class ImageSet; +class Theme; const int THEME_PALETTES = 5; +extern Theme *theme; + struct ThemeInfo final { ThemeInfo() : @@ -176,11 +179,11 @@ class Skin final class Theme final : public Palette, public ConfigListener { public: - A_DELETE_COPY(Theme) + Theme(); - static Theme *instance() A_WARN_UNUSED; + ~Theme(); - static void deleteInstance(); + A_DELETE_COPY(Theme) static void prepareThemePath(); @@ -453,15 +456,15 @@ class Theme final : public Palette, public ConfigListener inline static const Color &getThemeColor(const int type, const int alpha = 255) A_WARN_UNUSED - { return mInstance->getColor(type, alpha); } + { return theme->getColor(type, alpha); } static const Color &getThemeCharColor(const signed char c, bool &valid) A_WARN_UNUSED - { return mInstance->getCharColor(c, valid); } + { return theme->getCharColor(c, valid); } static int getThemeIdByChar(const signed char c, bool &valid) A_WARN_UNUSED - { return mInstance->getIdByChar(c, valid); } + { return theme->getIdByChar(c, valid); } static Color getProgressColor(const int type, const float progress) A_WARN_UNUSED; @@ -513,10 +516,6 @@ class Theme final : public Palette, public ConfigListener static ThemeInfo *loadInfo(const std::string &themeName) A_WARN_UNUSED; private: - Theme(); - - ~Theme(); - Skin *readSkin(const std::string &filename0, const bool full) A_WARN_UNUSED; @@ -529,7 +528,6 @@ class Theme final : public Palette, public ConfigListener static std::string mThemePath; static std::string mThemeName; static std::string mScreenDensity; - static Theme *mInstance; static bool tryThemePath(const std::string &themePath) A_WARN_UNUSED; diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 25f821905..010d3d9f3 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -88,7 +88,6 @@ BrowserBox::BrowserBox(const Widget2 *const widget, mBackgroundColor = getThemeColor(Theme::BACKGROUND); - Theme *const theme = Theme::instance(); if (theme) mSkin = theme->load(skin, "browserbox.xml"); if (mInstances == 0) @@ -140,7 +139,6 @@ BrowserBox::~BrowserBox() if (gui) gui->removeDragged(this); - Theme *const theme = Theme::instance(); if (theme) { theme->unload(mSkin); diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 308c75413..8ac4251cf 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -337,13 +337,10 @@ void Button::init() if (mInstances == 0) { - if (Theme::instance()) + if (theme) { for (int mode = 0; mode < BUTTON_COUNT; mode ++) - { - button[mode] = Theme::instance()->load( - data[mode], "button.xml"); - } + button[mode] = theme->load(data[mode], "button.xml"); } updateAlpha(); @@ -359,9 +356,8 @@ Button::~Button() mInstances--; - if (mInstances == 0 && Theme::instance()) + if (mInstances == 0 && theme) { - Theme *const theme = Theme::instance(); for (int mode = 0; mode < BUTTON_COUNT; mode ++) theme->unload(button[mode]); } @@ -420,7 +416,7 @@ void Button::loadImageSet(const std::string &imageName) void Button::updateAlpha() { const float alpha = std::max(client->getGuiAlpha(), - Theme::instance()->getMinimumOpacity()); + theme->getMinimumOpacity()); if (mAlpha != alpha) { diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index f01495bcf..c44c88980 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -106,9 +106,9 @@ CheckBox::CheckBox(const Widget2 *const widget, mForegroundColor2 = getThemeColor(Theme::CHECKBOX_OUTLINE); if (instances == 0) { - if (Theme::instance()) + if (theme) { - mSkin = Theme::instance()->load("checkbox.xml", ""); + mSkin = theme->load("checkbox.xml", ""); updateAlpha(); } } @@ -142,8 +142,8 @@ CheckBox::~CheckBox() if (instances == 0) { - if (Theme::instance()) - Theme::instance()->unload(mSkin); + if (theme) + theme->unload(mSkin); } } @@ -162,7 +162,7 @@ void CheckBox::draw(Graphics *const graphics) void CheckBox::updateAlpha() { const float alpha = std::max(client->getGuiAlpha(), - Theme::instance()->getMinimumOpacity()); + theme->getMinimumOpacity()); if (mAlpha != alpha) { diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 0ff1b17c9..6ae892c81 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -51,7 +51,6 @@ Desktop::Desktop(const Widget2 *const widget) : Wallpaper::loadWallpapers(); - Theme *const theme = Theme::instance(); if (theme) mSkin = theme->load("desktop.xml", ""); @@ -80,8 +79,8 @@ Desktop::~Desktop() mWallpaper->decRef(); mWallpaper = nullptr; } - if (Theme::instance()) - Theme::instance()->unload(mSkin); + if (theme) + theme->unload(mSkin); } void Desktop::postInit() diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index b1a3c4ac1..53f4a623b 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -85,13 +85,12 @@ DropDown::DropDown(const Widget2 *const widget, mPopup->setHeight(100); // Initialize graphics - if (instances == 0) + if (instances == 0 && theme) { // Load the background skin for (int i = 0; i < 2; i ++) { - Skin *const skin = Theme::instance()->load( - dropdownFiles[i], "dropdown.xml"); + Skin *const skin = theme->load(dropdownFiles[i], "dropdown.xml"); if (skin) { if (!i) @@ -111,7 +110,7 @@ DropDown::DropDown(const Widget2 *const widget, } } if (i) - Theme::instance()->unload(skin); + theme->unload(skin); } else { @@ -121,11 +120,8 @@ DropDown::DropDown(const Widget2 *const widget, } // get the border skin - if (Theme::instance()) - { - Theme::instance()->loadRect(skinRect, - "dropdown_background.xml", ""); - } + if (theme) + theme->loadRect(skinRect, "dropdown_background.xml", ""); } instances++; @@ -181,7 +177,6 @@ DropDown::~DropDown() buttons[f][i]->decRef(); } } - Theme *const theme = Theme::instance(); if (theme) { theme->unload(mSkin); @@ -193,7 +188,7 @@ DropDown::~DropDown() void DropDown::updateAlpha() { const float alpha = std::max(client->getGuiAlpha(), - Theme::instance()->getMinimumOpacity()); + theme->getMinimumOpacity()); if (mAlpha != alpha) { diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index fe666e6f7..ecabc226f 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -168,8 +168,7 @@ ItemContainer::ItemContainer(const Widget2 *const widget, mName(), mItemPopup(new ItemPopup), mShowMatrix(nullptr), - mSkin(Theme::instance() ? Theme::instance()->load( - "itemcontainer.xml", "") : nullptr), + mSkin(theme ? theme->load("itemcontainer.xml", "") : nullptr), mEquipedColor(getThemeColor(Theme::ITEM_EQUIPPED)), mEquipedColor2(getThemeColor(Theme::ITEM_EQUIPPED_OUTLINE)), mUnEquipedColor(getThemeColor(Theme::ITEM_NOT_EQUIPPED)), @@ -215,8 +214,8 @@ ItemContainer::~ItemContainer() mProtectedImg = nullptr; } - if (Theme::instance()) - Theme::instance()->unload(mSkin); + if (theme) + theme->unload(mSkin); delete mItemPopup; mItemPopup = nullptr; diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index b500ec7bb..7318fc3d1 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -105,7 +105,6 @@ Label::~Label() mInstances --; if (mInstances == 0) { - Theme *const theme = Theme::instance(); if (theme) theme->unload(mSkin); } @@ -117,7 +116,6 @@ void Label::init() mForegroundColor2 = getThemeColor(Theme::LABEL_OUTLINE); if (mInstances == 0) { - Theme *const theme = Theme::instance(); if (theme) mSkin = theme->load("label.xml", ""); } diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 6f0c192c6..f2a23253e 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -111,7 +111,6 @@ ListBox::ListBox(const Widget2 *const widget, mForegroundColor = getThemeColor(Theme::LISTBOX); mForegroundColor2 = getThemeColor(Theme::LISTBOX_OUTLINE); - Theme *const theme = Theme::instance(); if (theme) mSkin = theme->load(skin, "listbox.xml"); @@ -138,14 +137,14 @@ ListBox::~ListBox() if (gui) gui->removeDragged(this); - if (Theme::instance()) - Theme::instance()->unload(mSkin); + if (theme) + theme->unload(mSkin); } void ListBox::updateAlpha() { const float alpha = std::max(client->getGuiAlpha(), - Theme::instance()->getMinimumOpacity()); + theme->getMinimumOpacity()); if (mAlpha != alpha) mAlpha = alpha; diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 2ba452620..6f68f8689 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -86,7 +86,6 @@ void PlayerBox::init(std::string name, std::string selectedName) setFrameSize(2); addMouseListener(this); - Theme *const theme = Theme::instance(); if (theme) { if (name.empty()) diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 1114b4a5e..a8bcec4ea 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -51,7 +51,6 @@ Popup::Popup(const std::string &name, if (skin == "") skin = "popup.xml"; - Theme *const theme = Theme::instance(); if (theme) { mSkin = theme->load(skin, "popup.xml"); @@ -78,7 +77,6 @@ Popup::~Popup() if (mSkin) { - Theme *const theme = Theme::instance(); if (theme) theme->unload(mSkin); mSkin = nullptr; diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 5bccd61ca..e2ff95228 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -70,7 +70,6 @@ ProgressBar::ProgressBar(const Widget2 *const widget, addWidgetListener(this); setSize(width, height); - Theme *const theme = Theme::instance(); if (theme) { mSkin = theme->load(skin, "progressbar.xml"); @@ -94,7 +93,6 @@ ProgressBar::~ProgressBar() gui->removeDragged(this); mInstances--; - Theme *const theme = Theme::instance(); if (mSkin) { if (theme) @@ -142,7 +140,7 @@ void ProgressBar::logic() void ProgressBar::updateAlpha() { const float alpha = std::max(client->getGuiAlpha(), - Theme::instance()->getMinimumOpacity()); + theme->getMinimumOpacity()); mAlpha = alpha; } diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 411216455..4841ececb 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -110,7 +110,6 @@ RadioButton::RadioButton(const Widget2 *const widget, mForegroundColor2 = getThemeColor(Theme::RADIOBUTTON_OUTLINE); if (instances == 0) { - Theme *const theme = Theme::instance(); if (theme) { mSkin = theme->load("radio.xml", ""); @@ -142,7 +141,6 @@ RadioButton::~RadioButton() if (instances == 0) { - Theme *const theme = Theme::instance(); if (theme) theme->unload(mSkin); } @@ -151,7 +149,7 @@ RadioButton::~RadioButton() void RadioButton::updateAlpha() { const float alpha = std::max(client->getGuiAlpha(), - Theme::instance()->getMinimumOpacity()); + theme->getMinimumOpacity()); if (mAlpha != alpha) { diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 47b8b0985..571297ace 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -195,7 +195,6 @@ void ScrollArea::init(std::string skinName) // +++ here probably need move background from static if (skinName == "") skinName = "scroll_background.xml"; - Theme *const theme = Theme::instance(); if (theme) { theme->loadRect(background, skinName, "scroll_background.xml"); @@ -207,8 +206,9 @@ void ScrollArea::init(std::string skinName) for (int i = 0; i < 2; i ++) { - Skin *const skin = Theme::instance()->load( - buttonFiles[i], "scrollbuttons.xml"); + Skin *skin = nullptr; + if (theme) + skin = theme->load(buttonFiles[i], "scrollbuttons.xml"); if (skin) { const ImageRect &rect = skin->getBorder(); @@ -230,7 +230,8 @@ void ScrollArea::init(std::string skinName) for (int f = UP; f < BUTTONS_DIR; f ++) buttons[f][i] = nullptr; } - Theme::instance()->unload(skin); + if (theme) + theme->unload(skin); } } mScrollbarWidth = mScrollbarSize; @@ -290,7 +291,7 @@ void ScrollArea::logic() void ScrollArea::updateAlpha() { const float alpha = std::max(client->getGuiAlpha(), - Theme::instance()->getMinimumOpacity()); + theme->getMinimumOpacity()); if (alpha != mAlpha) { diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 700d31416..c9ea9e6c2 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -133,7 +133,7 @@ Slider::~Slider() delete mVertexes; mVertexes = nullptr; mInstances--; - if (mInstances == 0 && Theme::instance()) + if (mInstances == 0) { for (int mode = 0; mode < 2; mode ++) Theme::unloadRect(buttons[mode]); @@ -153,7 +153,6 @@ void Slider::init() // Load resources if (mInstances == 0) { - Theme *const theme = Theme::instance(); if (theme) { for (int mode = 0; mode < 2; mode ++) @@ -171,7 +170,7 @@ void Slider::init() void Slider::updateAlpha() { const float alpha = std::max(client->getGuiAlpha(), - Theme::instance()->getMinimumOpacity()); + theme->getMinimumOpacity()); if (alpha != mAlpha) { diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index ede69619e..1e5733a2b 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -123,9 +123,8 @@ Tab::~Tab() gui->removeDragged(this); mInstances--; - if (mInstances == 0 && Theme::instance()) + if (mInstances == 0 && theme) { - Theme *const theme = Theme::instance(); for (int mode = 0; mode < TAB_COUNT; mode ++) theme->unload(tabImg[mode]); } @@ -154,7 +153,6 @@ void Tab::init() if (mInstances == 0) { // Load the skin - Theme *const theme = Theme::instance(); if (theme) { for (int mode = 0; mode < TAB_COUNT; mode ++) @@ -177,7 +175,7 @@ void Tab::init() void Tab::updateAlpha() { const float alpha = std::max(client->getGuiAlpha(), - Theme::instance()->getMinimumOpacity()); + theme->getMinimumOpacity()); if (alpha != mAlpha) { diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 7fe8c1bf3..0a1caa0e5 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -125,7 +125,6 @@ TextField::TextField(const Widget2 *restrict const widget, if (instances == 0) { - Theme *const theme = Theme::instance(); if (theme) { mSkin = theme->loadSkinRect(skin, "textfield.xml", @@ -160,7 +159,6 @@ TextField::~TextField() instances--; if (instances == 0) { - Theme *const theme = Theme::instance(); if (theme) { theme->unload(mSkin); @@ -172,7 +170,7 @@ TextField::~TextField() void TextField::updateAlpha() { const float alpha = std::max(client->getGuiAlpha(), - Theme::instance()->getMinimumOpacity()); + theme->getMinimumOpacity()); if (alpha != mAlpha) { diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 10bd936c6..45e71b800 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -50,7 +50,6 @@ TextPreview::TextPreview(const Widget2 *const widget, { if (instances == 0) { - Theme *const theme = Theme::instance(); if (theme) mSkin = theme->load("textpreview.xml", ""); } @@ -72,7 +71,6 @@ TextPreview::~TextPreview() if (instances == 0) { - Theme *const theme = Theme::instance(); if (theme) theme->unload(mSkin); } diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 5a636013b..dda03a438 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -155,7 +155,6 @@ Window::Window(const std::string &caption, const bool modal, int childPalette = 1; // Loads the skin - Theme *const theme = Theme::instance(); if (theme) { mSkin = theme->load(skin, "window.xml"); @@ -236,7 +235,6 @@ Window::~Window() if (mSkin) { - Theme *const theme = Theme::instance(); if (theme) theme->unload(mSkin); mSkin = nullptr; @@ -1207,7 +1205,7 @@ bool Window::isResizeAllowed(const MouseEvent &event) const int Window::getGuiAlpha() const { const float alpha = std::max(client->getGuiAlpha(), - Theme::instance()->getMinimumOpacity()); + theme->getMinimumOpacity()); return static_cast<int>(alpha * 255.0F); } diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 795f2ad5a..03d4d15a8 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -46,8 +46,7 @@ WindowMenu::WindowMenu(const Widget2 *const widget) : ActionListener(), SelectionListener(), MouseListener(), - mSkin(Theme::instance() ? Theme::instance()->load("windowmenu.xml", "") - : nullptr), + mSkin(theme ? theme->load("windowmenu.xml", "") : nullptr), mPadding(mSkin ? mSkin->getPadding() : 1), mSpacing(mSkin ? mSkin->getOption("spacing", 3) : 3), mTextPopup(new TextPopup), @@ -196,7 +195,6 @@ WindowMenu::~WindowMenu() mButtonTexts.clear(); if (mSkin) { - Theme *const theme = Theme::instance(); if (theme) theme->unload(mSkin); mSkin = nullptr; diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index c45595dff..3799015e5 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -122,7 +122,7 @@ void EquipmentWindow::postInit() mUnequip->setEnabled(false); ImageRect rect; - Theme::instance()->loadRect(rect, "equipment_background.xml", "", 0, 1); + theme->loadRect(rect, "equipment_background.xml", "", 0, 1); mSlotBackground = rect.grid[0]; mSlotHighlightedBackground = rect.grid[1]; add(mPlayerBox); |