A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
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
30class TargetData
31{
32
33public:
34 enum ScreenDepth
35 {
36 RGB,
37 Grey,
38 Mono,
39 None
40 };
41
42 TargetData();
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 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; }
56
57private:
58 struct Entry
59 {
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){ }
64
65 QString id;
66 QString name;
67 QRect size;
68 ScreenDepth depth;
69 QRect rSize;
70 ScreenDepth rDepth;
71 bool fm;
72 bool record;
73 };
74
75 static const QString reserved;
76
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);
82
83 QHash<QString, int> indices;
84 QList<Entry> entries;
85
86};
87
88#endif // TARGETDATA_H