Changeset View
Changeset View
Standalone View
Standalone View
src/part/FontsCache.h
Show All 10 Lines | 1 | /* This file is part of KGraphViewer. | |||
---|---|---|---|---|---|
11 | General Public License for more details. | 11 | General Public License for more details. | ||
12 | 12 | | |||
13 | You should have received a copy of the GNU General Public License | 13 | You should have received a copy of the GNU General Public License | ||
14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software | ||
15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
16 | 02110-1301, USA | 16 | 02110-1301, USA | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | | ||||
20 | #ifndef KGRAPHVIEWER_FONTSCACHE_H | 19 | #ifndef KGRAPHVIEWER_FONTSCACHE_H | ||
21 | #define KGRAPHVIEWER_FONTSCACHE_H | 20 | #define KGRAPHVIEWER_FONTSCACHE_H | ||
22 | 21 | | |||
23 | #include "Singleton.h" | 22 | #include "Singleton.h" | ||
24 | 23 | | |||
25 | #include <qfont.h> | 24 | #include <qfont.h> | ||
26 | #include <qmap.h> | 25 | #include <qmap.h> | ||
27 | #include <qstring.h> | 26 | #include <qstring.h> | ||
28 | 27 | | |||
29 | /** | 28 | /** | ||
30 | * This is a map of fonts used in KgraphViewer | 29 | * This is a map of fonts used in KgraphViewer | ||
31 | * | 30 | * | ||
32 | * @short A fonts map | 31 | * @short A fonts map | ||
33 | * @author Gaël de Chalendar <kleag@free.fr> | 32 | * @author Gaël de Chalendar <kleag@free.fr> | ||
34 | */ | 33 | */ | ||
35 | class FontsCache : | 34 | class FontsCache : public Singleton<FontsCache>, public QMap<QString, QFont *> | ||
36 | public Singleton<FontsCache>, | | |||
37 | public QMap<QString, QFont*> | | |||
38 | { | 35 | { | ||
39 | friend class Singleton<FontsCache>; | 36 | friend class Singleton<FontsCache>; | ||
40 | 37 | | |||
41 | public: | 38 | public: | ||
42 | ~FontsCache(); | 39 | ~FontsCache(); | ||
43 | 40 | | |||
44 | QFont* cachedFont(const QFont& font); | 41 | QFont *cachedFont(const QFont &font); | ||
45 | QFont* fromName(const QString& font); | 42 | QFont *fromName(const QString &font); | ||
46 | 43 | | |||
47 | private: | 44 | private: | ||
48 | FontsCache() {} | 45 | FontsCache() | ||
46 | { | ||||
47 | } | ||||
49 | 48 | | |||
50 | QMap<QString, QFont*> m_namesToFonts; | 49 | QMap<QString, QFont *> m_namesToFonts; | ||
51 | }; | 50 | }; | ||
52 | 51 | | |||
53 | #endif | 52 | #endif |