Removed singletone from FontConfig
Also renamed class so it now matches better with class file name1008-fix
parent
1e614d64d0
commit
94cacdae96
|
@ -44,7 +44,6 @@ class CSoundInterface;
|
||||||
class CInput;
|
class CInput;
|
||||||
class CPathManager;
|
class CPathManager;
|
||||||
class CConfigFile;
|
class CConfigFile;
|
||||||
class CFontConfigFile;
|
|
||||||
class CSystemUtils;
|
class CSystemUtils;
|
||||||
struct SystemTimeStamp;
|
struct SystemTimeStamp;
|
||||||
|
|
||||||
|
|
|
@ -37,17 +37,17 @@
|
||||||
|
|
||||||
namespace bp = boost::property_tree;
|
namespace bp = boost::property_tree;
|
||||||
|
|
||||||
CFontConfigFile::CFontConfigFile()
|
CFontConfig::CFontConfig()
|
||||||
: m_needsSave(false)
|
: m_needsSave(false)
|
||||||
, m_loaded(false)
|
, m_loaded(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CFontConfigFile::~CFontConfigFile()
|
CFontConfig::~CFontConfig()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFontConfigFile::Init()
|
bool CFontConfig::Init()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,7 @@ bool CFontConfigFile::Init()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CFontConfigFile::GetFont(Gfx::FontType type)
|
std::string CFontConfig::GetFont(Gfx::FontType type)
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,17 +33,17 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class CFontConfigFile
|
* \class CFontConfig
|
||||||
*
|
*
|
||||||
* \brief Class for loading config file
|
* \brief Class for loading config file
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CFontConfigFile : public CSingleton<CFontConfigFile>
|
class CFontConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CFontConfigFile();
|
CFontConfig();
|
||||||
virtual ~CFontConfigFile();
|
virtual ~CFontConfig();
|
||||||
|
|
||||||
/** Loads fonts.ini
|
/** Loads fonts.ini
|
||||||
* \return return true on success
|
* \return return true on success
|
||||||
|
@ -60,9 +60,3 @@ private:
|
||||||
bool m_needsSave;
|
bool m_needsSave;
|
||||||
bool m_loaded;
|
bool m_loaded;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Global function to get config file instance
|
|
||||||
inline CFontConfigFile & GetFontConfigFile()
|
|
||||||
{
|
|
||||||
return CFontConfigFile::GetInstance();
|
|
||||||
}
|
|
|
@ -117,8 +117,8 @@ CText::~CText()
|
||||||
|
|
||||||
bool CText::Create()
|
bool CText::Create()
|
||||||
{
|
{
|
||||||
CFontConfigFile fontconfig;
|
CFontConfig fontConfig;
|
||||||
if (!GetFontConfigFile().Init())
|
if (!fontConfig.Init())
|
||||||
{
|
{
|
||||||
GetLogger()->Warn("Error on parsing fonts config file: failed to open file\n");
|
GetLogger()->Warn("Error on parsing fonts config file: failed to open file\n");
|
||||||
}
|
}
|
||||||
|
@ -128,14 +128,14 @@ bool CText::Create()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fonts[FONT_COMMON] = MakeUnique<MultisizeFont>(GetFontConfigFile().GetFont(FONT_COMMON));
|
m_fonts[FONT_COMMON] = MakeUnique<MultisizeFont>(fontConfig.GetFont(FONT_COMMON));
|
||||||
m_fonts[FONT_COMMON_BOLD] = MakeUnique<MultisizeFont>(GetFontConfigFile().GetFont(FONT_COMMON_BOLD));
|
m_fonts[FONT_COMMON_BOLD] = MakeUnique<MultisizeFont>(fontConfig.GetFont(FONT_COMMON_BOLD));
|
||||||
m_fonts[FONT_COMMON_ITALIC] = MakeUnique<MultisizeFont>(GetFontConfigFile().GetFont(FONT_COMMON_ITALIC));
|
m_fonts[FONT_COMMON_ITALIC] = MakeUnique<MultisizeFont>(fontConfig.GetFont(FONT_COMMON_ITALIC));
|
||||||
|
|
||||||
m_fonts[FONT_SATCOM] = MakeUnique<MultisizeFont>(GetFontConfigFile().GetFont(FONT_SATCOM));
|
m_fonts[FONT_SATCOM] = MakeUnique<MultisizeFont>(fontConfig.GetFont(FONT_SATCOM));
|
||||||
|
|
||||||
m_fonts[FONT_STUDIO] = MakeUnique<MultisizeFont>(GetFontConfigFile().GetFont(FONT_STUDIO));
|
m_fonts[FONT_STUDIO] = MakeUnique<MultisizeFont>(fontConfig.GetFont(FONT_STUDIO));
|
||||||
m_fonts[FONT_STUDIO_BOLD] = MakeUnique<MultisizeFont>(GetFontConfigFile().GetFont(FONT_STUDIO_BOLD));
|
m_fonts[FONT_STUDIO_BOLD] = MakeUnique<MultisizeFont>(fontConfig.GetFont(FONT_STUDIO_BOLD));
|
||||||
|
|
||||||
for (auto it = m_fonts.begin(); it != m_fonts.end(); ++it)
|
for (auto it = m_fonts.begin(); it != m_fonts.end(); ++it)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue