diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-01-25 21:13:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-01-25 21:13:17 +0300 |
commit | 64f2b2ad95684d871034a14c5af9a0650660db2b (patch) | |
tree | 61f9555becbf31d74ca7753c76bc84f9b32327b9 | |
parent | 56cea96ce8e45ac690ce755c856bcb70a202009d (diff) | |
download | manaplus-64f2b2ad95684d871034a14c5af9a0650660db2b.tar.gz manaplus-64f2b2ad95684d871034a14c5af9a0650660db2b.tar.bz2 manaplus-64f2b2ad95684d871034a14c5af9a0650660db2b.tar.xz manaplus-64f2b2ad95684d871034a14c5af9a0650660db2b.zip |
Add support for multiple help index files.
-rwxr-xr-x | configure.ac | 1 | ||||
-rw-r--r-- | data/help/CMakeLists.txt | 3 | ||||
-rw-r--r-- | data/help/Makefile.am | 3 | ||||
-rw-r--r-- | data/help/idx/CMakeLists.txt | 5 | ||||
-rw-r--r-- | data/help/idx/Makefile.am | 8 | ||||
-rw-r--r-- | data/help/idx/tags.idx (renamed from data/help/tags.idx) | 0 | ||||
-rw-r--r-- | src/defaults.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/helpwindow.cpp | 24 |
8 files changed, 33 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac index 2394a87e1..4be07f13a 100755 --- a/configure.ac +++ b/configure.ac @@ -493,6 +493,7 @@ data/themes/wood/Makefile data/tmw/tmw.desktop data/tmw/Makefile data/help/Makefile +data/help/idx/Makefile data/help/tips/Makefile data/icons/Makefile data/perserver/Makefile diff --git a/data/help/CMakeLists.txt b/data/help/CMakeLists.txt index 60cf9a458..aae5b480e 100644 --- a/data/help/CMakeLists.txt +++ b/data/help/CMakeLists.txt @@ -14,11 +14,10 @@ SET(FILES searchnotfound.txt skills.txt support.txt - tags.idx team.txt windows.txt ) -ADD_SUBDIRECTORY(tips) +ADD_SUBDIRECTORY(idx tips) INSTALL(FILES ${FILES} DESTINATION ${DATA_DIR}/help) diff --git a/data/help/Makefile.am b/data/help/Makefile.am index b83c4830b..929228dc5 100644 --- a/data/help/Makefile.am +++ b/data/help/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = tips +SUBDIRS = idx tips helpdir = $(pkgdatadir)/data/help @@ -18,7 +18,6 @@ help_DATA = \ searchnotfound.txt \ skills.txt \ support.txt \ - tags.idx \ team.txt \ windows.txt diff --git a/data/help/idx/CMakeLists.txt b/data/help/idx/CMakeLists.txt new file mode 100644 index 000000000..321eb8318 --- /dev/null +++ b/data/help/idx/CMakeLists.txt @@ -0,0 +1,5 @@ +SET(FILES + tags.idx + ) + +INSTALL(FILES ${FILES} DESTINATION ${DATA_DIR}/help/idx) diff --git a/data/help/idx/Makefile.am b/data/help/idx/Makefile.am new file mode 100644 index 000000000..001e68707 --- /dev/null +++ b/data/help/idx/Makefile.am @@ -0,0 +1,8 @@ +idxdir = $(pkgdatadir)/data/help/idx + +idx_DATA = \ + tags.idx + +EXTRA_DIST = \ + $(idx_DATA) \ + CMakeLists.txt diff --git a/data/help/tags.idx b/data/help/idx/tags.idx index 12f3d8477..12f3d8477 100644 --- a/data/help/tags.idx +++ b/data/help/idx/tags.idx diff --git a/src/defaults.cpp b/src/defaults.cpp index 82540150b..2ba787af2 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -452,6 +452,7 @@ DefaultsData* getBrandingDefaults() AddDEF("screenshots", "ManaPlus"); AddDEF("defaultUpdateHost", ""); AddDEF("helpPath", ""); + AddDEF("tagsPath", ""); AddDEF("theme", ""); AddDEF("font", "fonts/dejavusans.ttf"); AddDEF("boldFont", "fonts/dejavusans-bold.ttf"); @@ -499,6 +500,7 @@ DefaultsData* getPathsDefaults() AddDEF("guiIcons", "graphics/guiicons/"); AddDEF("shaders", "graphics/shaders/"); AddDEF("help", "help/"); + AddDEF("tags", "help/idx/"); AddDEF("badges", "graphics/badges/"); AddDEF("simpleVertexShader", "simple_vertex.glsl"); diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 48edaaab4..50e5423ac 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -144,17 +144,23 @@ void HelpWindow::loadFile(std::string file) void HelpWindow::loadTags() { - std::string helpPath = branding.getStringValue("helpPath"); + std::string helpPath = branding.getStringValue("tagsPath"); if (helpPath.empty()) - helpPath = paths.getStringValue("help"); - StringVect lines; - Files::loadTextFile(helpPath.append("tags.idx"), lines); - FOR_EACH (StringVectCIter, it, lines) + helpPath = paths.getStringValue("tags"); + + StringVect filesVect; + Files::getFilesInDir(helpPath, filesVect, ".idx"); + FOR_EACH (StringVectCIter, itVect, filesVect) { - const std::string &str = *it; - const size_t idx = str.find('|'); - if (idx != std::string::npos) - mTagFileMap[str.substr(idx + 1)].insert(str.substr(0, idx)); + StringVect lines; + Files::loadTextFile(*itVect, lines); + FOR_EACH (StringVectCIter, it, lines) + { + const std::string &str = *it; + const size_t idx = str.find('|'); + if (idx != std::string::npos) + mTagFileMap[str.substr(idx + 1)].insert(str.substr(0, idx)); + } } } |