From a83a43e37613667b956752be5f1fff049ca959ce Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 21 Nov 2017 09:32:35 +0400 Subject: [PATCH] Determine when need to use the Cyrillic journal index --- apps/openmw/mwbase/windowmanager.hpp | 3 +++ apps/openmw/mwgui/journalbooks.cpp | 6 ++++-- apps/openmw/mwgui/windowmanagerimp.cpp | 5 +++++ apps/openmw/mwgui/windowmanagerimp.hpp | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp index 416a7ad87..ffcbe0502 100644 --- a/apps/openmw/mwbase/windowmanager.hpp +++ b/apps/openmw/mwbase/windowmanager.hpp @@ -9,6 +9,8 @@ #include "../mwgui/mode.hpp" +#include + namespace Loading { class Listener; @@ -365,6 +367,7 @@ namespace MWBase virtual void writeFog(MWWorld::CellStore* cell) = 0; virtual const MWGui::TextColours& getTextColours() = 0; + virtual ToUTF8::FromType getEncoding() = 0; }; } diff --git a/apps/openmw/mwgui/journalbooks.cpp b/apps/openmw/mwgui/journalbooks.cpp index b4f9147b5..73796c381 100644 --- a/apps/openmw/mwgui/journalbooks.cpp +++ b/apps/openmw/mwgui/journalbooks.cpp @@ -5,6 +5,8 @@ #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" +#include + #include "textcolours.hpp" @@ -218,8 +220,8 @@ book JournalBooks::createQuestBook (const std::string& questName) book JournalBooks::createTopicIndexBook () { - // TODO: determine actual index alphabet - bool isRussian = true; + ToUTF8::FromType encoding = MWBase::Environment::get().getWindowManager()->getEncoding(); + bool isRussian = (encoding == ToUTF8::WINDOWS_1251); BookTypesetter::Ptr typesetter = isRussian ? createCyrillicJournalIndex() : createLatinJournalIndex(); diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 97aedab81..920b8c1ac 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -205,6 +205,7 @@ namespace MWGui , mRestAllowed(true) , mFallbackMap(fallbackMap) , mShowOwned(0) + , mEncoding(encoding) , mVersionDescription(versionDescription) { float uiScale = Settings::Manager::getFloat("scaling factor", "GUI"); @@ -2174,4 +2175,8 @@ namespace MWGui return mTextColours; } + ToUTF8::FromType WindowManager::getEncoding() + { + return mEncoding; + } } diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index f74ba21a3..a1ec7cdb4 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -393,6 +393,7 @@ namespace MWGui void writeFog(MWWorld::CellStore* cell); virtual const MWGui::TextColours& getTextColours(); + virtual ToUTF8::FromType getEncoding(); private: const MWWorld::ESMStore* mStore; @@ -515,6 +516,8 @@ namespace MWGui int mShowOwned; + ToUTF8::FromType mEncoding; + std::string mVersionDescription; MWGui::TextColours mTextColours;