diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-07-19 20:22:59 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-07-19 20:22:59 +0200 |
commit | 86eb0c08d233636cd4647649c6542d3cf410e3ab (patch) | |
tree | 9721759b41f0256f15c3786c357448a93215440e /src/gui/theme.cpp | |
parent | 335eec717f6189c01d8217dd2c4f4e74a171d9a5 (diff) | |
parent | 2d584d7e8aaeacbcb1036bae5c8deca9b810fe60 (diff) | |
download | mana-client-86eb0c08d233636cd4647649c6542d3cf410e3ab.tar.gz mana-client-86eb0c08d233636cd4647649c6542d3cf410e3ab.tar.bz2 mana-client-86eb0c08d233636cd4647649c6542d3cf410e3ab.tar.xz mana-client-86eb0c08d233636cd4647649c6542d3cf410e3ab.zip |
Merge branch '1.0'
Conflicts:
src/gui/itempopup.cpp
src/item.cpp
src/monster.cpp
src/net/manaserv/playerhandler.cpp
src/net/tmwa/partyhandler.cpp
src/npc.cpp
src/player.cpp
src/resources/itemdb.cpp
src/resources/monsterdb.cpp
src/resources/monsterinfo.cpp
src/resources/npcdb.cpp
src/resources/spritedef.cpp
Diffstat (limited to 'src/gui/theme.cpp')
-rw-r--r-- | src/gui/theme.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index e46616e0..12de1f91 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -40,11 +40,22 @@ #include <algorithm> -#define GUI_ROOT "graphics/gui/" - +static std::string defaultThemePath; std::string Theme::mThemePath; Theme *Theme::mInstance = 0; +// Set the theme path... +static void initDefaultThemePath() +{ + ResourceManager *resman = ResourceManager::getInstance(); + defaultThemePath = branding.getValue("guiThemePath", ""); + + if (!defaultThemePath.empty() && resman->isDirectory(defaultThemePath)) + return; + else + defaultThemePath = "graphics/gui/"; +} + Skin::Skin(ImageRect skin, Image *close, Image *stickyUp, Image *stickyDown, const std::string &filePath, const std::string &name): @@ -55,8 +66,7 @@ Skin::Skin(ImageRect skin, Image *close, Image *stickyUp, Image *stickyDown, mCloseImage(close), mStickyImageUp(stickyUp), mStickyImageDown(stickyDown) -{ -} +{} Skin::~Skin() { @@ -99,6 +109,8 @@ Theme::Theme(): mMinimumOpacity(-1.0f), mProgressColors(ProgressColors(THEME_PROG_END)) { + initDefaultThemePath(); + config.addListener("guialpha", this); loadColors(); @@ -313,7 +325,7 @@ bool Theme::tryThemePath(std::string themePath) { if (!themePath.empty()) { - themePath = GUI_ROOT + themePath; + themePath = defaultThemePath + themePath; if (PHYSFS_exists(themePath.c_str())) { mThemePath = themePath; @@ -331,7 +343,7 @@ void Theme::prepareThemePath() // Try theme from branding if (!tryThemePath(branding.getValue("theme", ""))) // Use default - mThemePath = GUI_ROOT; + mThemePath = defaultThemePath; instance()->loadColors(mThemePath); } @@ -356,7 +368,7 @@ std::string Theme::resolveThemePath(const std::string &path) return getThemePath() + "/" + path; // Backup - return std::string(GUI_ROOT) + "/" + path; + return std::string(defaultThemePath) + "/" + path; } Image *Theme::getImageFromTheme(const std::string &path) @@ -508,11 +520,11 @@ static int readProgressType(const std::string &type) void Theme::loadColors(std::string file) { - if (file == GUI_ROOT) + if (file == defaultThemePath) return; // No need to reload if (file == "") - file = GUI_ROOT; + file = defaultThemePath; file += "/colors.xml"; |