Initial maemo platform support
[maemo-rb.git] / utils / themeeditor / models / targetdata.h
blob89bb78bdc37d5e4a9de56b6842a75527c2f78f18
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 Robert Bieber
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef TARGETDATA_H
23 #define TARGETDATA_H
25 #include <QFile>
26 #include <QString>
27 #include <QHash>
28 #include <QRect>
30 class TargetData
33 public:
34 enum ScreenDepth
36 RGB,
37 Grey,
38 Mono,
39 None
42 TargetData();
43 virtual ~TargetData();
45 int count(){ return indices.count(); }
46 int index(QString id){ return indices.value(id, -1); }
48 QString id(int index){ return indices.key(index, ""); }
49 QString name(int index){ return entries[index].name; }
50 QRect screenSize(int index){ return entries[index].size; }
51 QRect remoteSize(int index){ return entries[index].rSize; }
52 ScreenDepth screenDepth(int index){ return entries[index].depth; }
53 ScreenDepth remoteDepth(int index){ return entries[index].rDepth; }
54 bool fm(int index){ return entries[index].fm; }
55 bool canRecord(int index){ return entries[index].record; }
57 private:
58 struct Entry
60 Entry(QString id, QString name, QRect size, ScreenDepth depth,
61 QRect rSize, ScreenDepth rDepth, bool fm, bool record)
62 : id(id), name(name), size(size), depth(depth), rSize(rSize),
63 rDepth(rDepth), fm(fm), record(record){ }
65 QString id;
66 QString name;
67 QRect size;
68 ScreenDepth depth;
69 QRect rSize;
70 ScreenDepth rDepth;
71 bool fm;
72 bool record;
75 static const QString reserved;
77 QString scanString(QString data, int& index);
78 int scanInt(QString data, int& index);
79 ScreenDepth scanDepth(QString data, int& index);
80 void skipComment(QString data, int& index);
81 bool require(QChar required, QString data, int& index);
83 QHash<QString, int> indices;
84 QList<Entry> entries;
88 #endif // TARGETDATA_H