diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui.cpp | 1 | ||||
-rw-r--r-- | src/gui/help.cpp | 6 | ||||
-rw-r--r-- | src/gui/itempopup.cpp | 4 | ||||
-rw-r--r-- | src/gui/theme.cpp | 30 |
4 files changed, 30 insertions, 11 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index e2354386..df2ddadf 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -107,6 +107,7 @@ Gui::Gui(Graphics *graphics): const int fontSize = (int) config.getValue("fontSize", 11); std::string fontFile = branding.getValue("font", "fonts/dejavusans.ttf"); std::string path = resman->getPath(fontFile); + try { mGuiFont = new TrueTypeFont(path, fontSize); diff --git a/src/gui/help.cpp b/src/gui/help.cpp index 9d237f18..f3c6a0af 100644 --- a/src/gui/help.cpp +++ b/src/gui/help.cpp @@ -29,6 +29,7 @@ #include "gui/widgets/scrollarea.h" #include "resources/resourcemanager.h" +#include "configuration.h" #include "utils/gettext.h" @@ -93,8 +94,11 @@ void HelpWindow::loadHelp(const std::string &helpFile) void HelpWindow::loadFile(const std::string &file) { ResourceManager *resman = ResourceManager::getInstance(); + std::string helpPath = branding.getValue("helpPath", ""); + if (helpPath.empty()) + helpPath = paths.getValue("help", "help/"); std::vector<std::string> lines = - resman->loadTextFile("help/" + file + ".txt"); + resman->loadTextFile(helpPath + file + ".txt"); for (unsigned int i = 0; i < lines.size(); ++i) { diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 2618810b..0cde9395 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -102,7 +102,9 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage) if (showImage) { ResourceManager *resman = ResourceManager::getInstance(); - Image *image = resman->getImage("graphics/items/" + item.getImageName()); + Image *image = resman->getImage( + paths.getValue("itemIcons", "graphics/items/") + + item.getImageName()); mIcon->setImage(image); if (image) { 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"; |