MythTV  master
mythfontmanager.h
Go to the documentation of this file.
1 #ifndef MYTHFONTMANAGER_H
2 #define MYTHFONTMANAGER_H
3 
4 #include <utility>
5 
6 // Qt headers
7 #include <QMultiHash>
8 #include <QMutex>
9 #include <QString>
10 
11 // MythTV headers
12 #include "mythuiexp.h"
13 
14 class MythFontReference;
15 using FontPathToReference = QMultiHash<QString, MythFontReference*>;
16 
18 {
19  public:
20  MythFontManager() = default;
21 
22  void LoadFonts(const QString &directory, const QString &registeredFor);
23  void ReleaseFonts(const QString &registeredFor);
24 
26 
27  private:
28  void LoadFonts(const QString &directory, const QString &registeredFor,
29  int *maxDirs);
30  void LoadFontsFromDirectory(const QString &directory,
31  const QString &registeredFor);
32  void LoadFontFile(const QString &fontPath, const QString &registeredFor);
33  bool RegisterFont(const QString &fontPath, const QString &registeredFor,
34  int fontID = -1);
35  bool IsFontFileLoaded(const QString &fontPath);
36 
37  QMutex m_lock;
39 
40 };
41 
43 
45 {
46  public:
47  MythFontReference(QString fontPath, QString registeredFor,
48  const int fontID)
49  : m_fontPath(std::move(fontPath)),
50  m_registeredFor(std::move(registeredFor)),
51  m_fontID(fontID) {}
52 
53  QString GetFontPath(void) const { return m_fontPath; }
54  QString GetRegisteredFor(void) const { return m_registeredFor; }
55  int GetFontID(void) const { return m_fontID; }
56 
57  private:
58  const QString m_fontPath;
59  const QString m_registeredFor;
60  const int m_fontID;
61 };
62 
63 #endif // MYTHFONTMANAGER_H
64 
65 /* vim: set expandtab tabstop=4 shiftwidth=4: */
MythFontReference::MythFontReference
MythFontReference(QString fontPath, QString registeredFor, const int fontID)
Definition: mythfontmanager.h:47
MythFontManager
Definition: mythfontmanager.h:18
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
GetGlobalFontManager
MUI_PUBLIC MythFontManager * GetGlobalFontManager(void)
Definition: mythfontmanager.cpp:273
MythFontManager::m_lock
QMutex m_lock
Definition: mythfontmanager.h:37
MythFontReference::m_registeredFor
const QString m_registeredFor
Definition: mythfontmanager.h:59
MythFontReference::m_fontID
const int m_fontID
Definition: mythfontmanager.h:60
FontPathToReference
QMultiHash< QString, MythFontReference * > FontPathToReference
Definition: mythfontmanager.h:15
MythFontManager::MythFontManager
MythFontManager()=default
MythFontReference::m_fontPath
const QString m_fontPath
Definition: mythfontmanager.h:58
MythFontReference::GetFontPath
QString GetFontPath(void) const
Definition: mythfontmanager.h:53
MythFontManager::m_fontPathToReference
FontPathToReference m_fontPathToReference
Definition: mythfontmanager.h:38
MythFontReference::GetFontID
int GetFontID(void) const
Definition: mythfontmanager.h:55
MythFontReference::GetRegisteredFor
QString GetRegisteredFor(void) const
Definition: mythfontmanager.h:54
mythuiexp.h
MythFontReference
Definition: mythfontmanager.h:45