diff options
Diffstat (limited to 'utils/themeeditor/models/targetdata.h')
-rw-r--r-- | utils/themeeditor/models/targetdata.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/utils/themeeditor/models/targetdata.h b/utils/themeeditor/models/targetdata.h new file mode 100644 index 0000000000..6178509514 --- /dev/null +++ b/utils/themeeditor/models/targetdata.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Robert Bieber | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef TARGETDATA_H | ||
23 | #define TARGETDATA_H | ||
24 | |||
25 | #include <QFile> | ||
26 | #include <QString> | ||
27 | #include <QHash> | ||
28 | #include <QRect> | ||
29 | |||
30 | class TargetData | ||
31 | { | ||
32 | |||
33 | public: | ||
34 | enum ScreenDepth | ||
35 | { | ||
36 | RGB, | ||
37 | Grey, | ||
38 | Mono, | ||
39 | None | ||
40 | }; | ||
41 | |||
42 | TargetData(QString file = ""); | ||
43 | virtual ~TargetData(); | ||
44 | |||
45 | int count(){ return indices.count(); } | ||
46 | int index(QString id){ return indices.value(id, -1); } | ||
47 | |||
48 | QString id(int index){ return indices.key(index, ""); } | ||
49 | QString name(int index){ return entries[index].name; } | ||
50 | |||
51 | private: | ||
52 | struct Entry | ||
53 | { | ||
54 | Entry(QString name, QRect size, ScreenDepth depth, QRect rSize, | ||
55 | ScreenDepth rDepth, bool fm) | ||
56 | : name(name), size(size), depth(depth), rSize(rSize), | ||
57 | rDepth(rDepth), fm(fm){ } | ||
58 | |||
59 | QString name; | ||
60 | QRect size; | ||
61 | ScreenDepth depth; | ||
62 | QRect rSize; | ||
63 | ScreenDepth rDepth; | ||
64 | bool fm; | ||
65 | }; | ||
66 | |||
67 | static const QString reserved; | ||
68 | |||
69 | QString scanString(QString data, int& index); | ||
70 | int scanInt(QString data, int& index); | ||
71 | ScreenDepth scanDepth(QString data, int& index); | ||
72 | void skipComment(QString data, int& index); | ||
73 | bool require(QChar required, QString data, int& index); | ||
74 | |||
75 | QHash<QString, int> indices; | ||
76 | QList<Entry> entries; | ||
77 | |||
78 | }; | ||
79 | |||
80 | #endif // TARGETDATA_H | ||