diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-28 20:31:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-28 20:31:09 +0300 |
commit | bb87f2911b63eaf80e49d689bf52ecf2042ae098 (patch) | |
tree | 0778087134ec3c5a2370d417bcadb64a1dc6a9bc /src/gui | |
parent | 4415cb66734e67dfcdf8924d354107d27fb70fee (diff) | |
download | plus-bb87f2911b63eaf80e49d689bf52ecf2042ae098.tar.gz plus-bb87f2911b63eaf80e49d689bf52ecf2042ae098.tar.bz2 plus-bb87f2911b63eaf80e49d689bf52ecf2042ae098.tar.xz plus-bb87f2911b63eaf80e49d689bf52ecf2042ae098.zip |
Move from resourcemanager functions related to files into other files.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/fonts/font.cpp | 3 | ||||
-rw-r--r-- | src/gui/theme.cpp | 8 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/windows/helpwindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/windows/minimap.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/updaterwindow.cpp | 8 |
6 files changed, 19 insertions, 11 deletions
diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp index 72a047e57..68127232d 100644 --- a/src/gui/fonts/font.cpp +++ b/src/gui/fonts/font.cpp @@ -76,6 +76,7 @@ #include "resources/imagehelper.h" #include "resources/resourcemanager.h" +#include "utils/files.h" #include "utils/paths.h" #include "utils/sdlcheckutils.h" #include "utils/stringutils.h" @@ -162,7 +163,7 @@ TTF_Font *Font::openFont(const char *const name, const int size) // return nullptr; // return TTF_OpenFontIndexRW(rw, 1, size, 0); // #else - return TTF_OpenFontIndex(ResourceManager::getPath(name).c_str(), + return TTF_OpenFontIndex(Files::getPath(name).c_str(), size, 0); // #endif } diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 4708a48d0..1d2c1d2b2 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -52,14 +52,18 @@ Theme *theme = nullptr; // Set the theme path... static void initDefaultThemePath() { - const ResourceManager *const resman = ResourceManager::getInstance(); defaultThemePath = branding.getStringValue("guiThemePath"); logger->log("defaultThemePath: " + defaultThemePath); - if (!defaultThemePath.empty() && resman->isDirectory(defaultThemePath)) + if (!defaultThemePath.empty() && PhysFs::isDirectory( + defaultThemePath.c_str())) + { return; + } else + { defaultThemePath = "themes/"; + } } Theme::Theme() : diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 0ec192a89..fb7219ed9 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -73,6 +73,7 @@ #include "utils/copynpaste.h" #include "utils/delete2.h" +#include "utils/files.h" #include "utils/gettext.h" #include "resources/resourcemanager.h" @@ -219,7 +220,7 @@ void ChatWindow::postInit() void ChatWindow::loadCommandsFile(const std::string &name) { StringVect list; - ResourceManager::loadTextFile(name, list); + Files::loadTextFile(name, list); StringVectCIter it = list.begin(); const StringVectCIter it_end = list.end(); diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 934e01359..e10900908 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -38,6 +38,7 @@ #include "resources/resourcemanager.h" #include "utils/gettext.h" +#include "utils/files.h" #include "utils/paths.h" #include "utils/process.h" @@ -153,7 +154,7 @@ void HelpWindow::loadTags() if (helpPath.empty()) helpPath = paths.getStringValue("help"); StringVect lines; - ResourceManager::loadTextFile(helpPath.append("tags.idx"), lines); + Files::loadTextFile(helpPath.append("tags.idx"), lines); FOR_EACH (StringVectCIter, it, lines) { const std::string &str = *it; diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 3607d9584..5df1b60ce 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -44,6 +44,7 @@ #include "utils/delete2.h" #include "utils/gettext.h" +#include "utils/physfstools.h" #include "utils/sdlcheckutils.h" #include "debug.h" @@ -169,14 +170,14 @@ void Minimap::setMap(const Map *const map) std::string minimapName = map->getProperty("minimap"); - if (minimapName.empty() && resman->exists(tempname)) + if (minimapName.empty() && PhysFs::exists(tempname.c_str())) minimapName = tempname; if (minimapName.empty()) { tempname = std::string("graphics/minimaps/").append( map->getFilename()).append(".png"); - if (resman->exists(tempname)) + if (PhysFs::exists(tempname.c_str())) minimapName = tempname; } diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 45c18b21b..49b2e986f 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -46,6 +46,8 @@ #include "resources/db/moddb.h" #include "utils/delete2.h" +#include "utils/files.h" +#include "utils/physfstools.h" #include "utils/gettext.h" #include "utils/mkdir.h" #include "utils/paths.h" @@ -1020,8 +1022,7 @@ bool UpdaterWindow::validateFile(const std::string &filePath, unsigned long UpdaterWindow::getFileHash(const std::string &filePath) { int size = 0; - char *const buf = static_cast<char*>(ResourceManager::loadFile( - filePath, size)); + char *const buf = static_cast<char*>(PhysFs::loadFile(filePath, size)); if (!buf) return 0; return Net::Download::adlerBuffer(buf, size); @@ -1042,8 +1043,7 @@ void UpdaterWindow::loadFile(std::string file) trim(file); StringVect lines; - const ResourceManager *const resman = ResourceManager::getInstance(); - resman->loadTextFileLocal(mUpdatesDir + "/local/help/news.txt", lines); + Files::loadTextFileLocal(mUpdatesDir + "/local/help/news.txt", lines); for (size_t i = 0, sz = lines.size(); i < sz; ++i) mBrowserBox->addRow(lines[i]); |