From 3383532752efb716c38ffb72a3b89712c817e388 Mon Sep 17 00:00:00 2001 From: tomangelo2 Date: Wed, 25 Jul 2018 00:44:06 +0200 Subject: [PATCH] Changed font_config to font_loader Apparently linter doesn't like files with `config` in its name --- src/CMakeLists.txt | 4 ++-- src/common/{font_config.cpp => font_loader.cpp} | 14 +++++++------- src/common/{font_config.h => font_loader.h} | 10 +++++----- src/graphics/engine/text.cpp | 12 ++++++------ 4 files changed, 20 insertions(+), 20 deletions(-) rename src/common/{font_config.cpp => font_loader.cpp} (91%) rename src/common/{font_config.h => font_loader.h} (94%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 37d6cb04..60ba3232 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -106,8 +106,8 @@ set(BASE_SOURCES common/error.h common/event.cpp common/event.h - common/font_config.h - common/font_config.cpp + common/font_loader.h + common/font_loader.cpp common/global.h common/image.cpp common/image.h diff --git a/src/common/font_config.cpp b/src/common/font_loader.cpp similarity index 91% rename from src/common/font_config.cpp rename to src/common/font_loader.cpp index 078cb34a..79b9375c 100644 --- a/src/common/font_config.cpp +++ b/src/common/font_loader.cpp @@ -17,7 +17,7 @@ * along with this program. If not, see http://gnu.org/licenses */ -#include "common/font_config.h" +#include "common/font_loader.h" #include "common/logger.h" #include "common/make_unique.h" @@ -64,15 +64,15 @@ const std::map FONT_TYPE = { Gfx::FONT_SATCOM_ITALIC, "FontSatComItalic" }, }; -CFontConfig::CFontConfig() +CFontLoader::CFontLoader() { } -CFontConfig::~CFontConfig() +CFontLoader::~CFontLoader() { } -bool CFontConfig::Init() +bool CFontLoader::Init() { try { @@ -99,17 +99,17 @@ bool CFontConfig::Init() return true; } -std::string CFontConfig::GetFont(Gfx::FontType type) +std::string CFontLoader::GetFont(Gfx::FontType type) { return std::string("/fonts/") + m_propertyTree.get(GetFontType(type), GetDefaultFont(type)); } -std::string CFontConfig::GetDefaultFont(Gfx::FontType type) const +std::string CFontLoader::GetDefaultFont(Gfx::FontType type) const { return DEFAULT_FONT.at(type); } -std::string CFontConfig::GetFontType(Gfx::FontType type) const +std::string CFontLoader::GetFontType(Gfx::FontType type) const { return FONT_TYPE.at(type); } diff --git a/src/common/font_config.h b/src/common/font_loader.h similarity index 94% rename from src/common/font_config.h rename to src/common/font_loader.h index c475ebc5..a68fc0ad 100644 --- a/src/common/font_config.h +++ b/src/common/font_loader.h @@ -18,7 +18,7 @@ */ /** - * \file common/font_config.h + * \file common/font_loader.h * \brief Class for loading fonts from /data/fonts/fonts.ini */ @@ -33,17 +33,17 @@ #include /** -* \class CFontConfig +* \class CFontLoader * * \brief Class for loading config file * */ -class CFontConfig +class CFontLoader { public: - CFontConfig(); - virtual ~CFontConfig(); + CFontLoader(); + virtual ~CFontLoader(); /** Loads fonts.ini * \return return true on success diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index 35166fe7..e9b60934 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -22,7 +22,7 @@ #include "app/app.h" -#include "common/font_config.h" +#include "common/font_loader.h" #include "common/image.h" #include "common/logger.h" #include "common/stringutils.h" @@ -117,8 +117,8 @@ CText::~CText() bool CText::Create() { - CFontConfig fontConfig; - if (!fontConfig.Init()) + CFontLoader fontLoader; + if (!fontLoader.Init()) { GetLogger()->Warn("Error on parsing fonts config file: failed to open file\n"); } @@ -130,9 +130,9 @@ bool CText::Create() for (auto type : {FONT_COMMON, FONT_STUDIO, FONT_SATCOM}) { - m_fonts[static_cast(type)] = MakeUnique(fontConfig.GetFont(type)); - m_fonts[static_cast(type|FONT_BOLD)] = MakeUnique(fontConfig.GetFont(static_cast(type|FONT_BOLD))); - m_fonts[static_cast(type|FONT_ITALIC)] = MakeUnique(fontConfig.GetFont(static_cast(type|FONT_ITALIC))); + m_fonts[static_cast(type)] = MakeUnique(fontLoader.GetFont(type)); + m_fonts[static_cast(type|FONT_BOLD)] = MakeUnique(fontLoader.GetFont(static_cast(type|FONT_BOLD))); + m_fonts[static_cast(type|FONT_ITALIC)] = MakeUnique(fontLoader.GetFont(static_cast(type|FONT_ITALIC))); } for (auto it = m_fonts.begin(); it != m_fonts.end(); ++it)