Debian Codegraph @

HercStudio/Fonts.cpp

raw symbols SCIP
1 /*
2 * File: Fonts.cpp
3 *
4 * Author: Jacob Dekel
5 * Created on: Aug 10, 2009
6 *
7 * Copyright (c) 2009-2013 Jacob Dekel
8 * $Id$
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 *
23 */
24
25 #include "Fonts.h"
26 #include "HerculesStudio.h"
27
28 #include <QFontDatabase>
29 #include <QStringList>
30
31 Fonts * Fonts::mInstance = NULL;
32
33 Fonts::Fonts()
34 {
35 QFontDatabase db;
36 mFonts = db.families();
37 mFonts.insert(0,"(system default)");
38 for (int i=0; i<mFonts.size(); ++i)
39 {
40 hOutDebug(5, i << ": " << mFonts.at(i).toLocal8Bit().constData() );
41 }
42 }
43
44 Fonts& Fonts::getInstance()
45 {
46 if (mInstance != NULL)
47 return *mInstance;
48 mInstance = new Fonts();
49 return *mInstance;
50 }
51
52 QStringList& Fonts::getList()
53 {
54 return mFonts;
55 }
56
57 QString Fonts::at(int index)
58 {
59 return mFonts.at(index);
60 }
61
62 int Fonts::indexOf(const QString& fontName)
63 {
64 return mFonts.indexOf(fontName);
65 }
66
67 Fonts::~Fonts()
68 {
69 // TODO Auto-generated destructor stub
70 }