summaryrefslogtreecommitdiff
path: root/utils/themeeditor/projectfiles.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/projectfiles.cpp')
-rw-r--r--utils/themeeditor/projectfiles.cpp133
1 files changed, 0 insertions, 133 deletions
diff --git a/utils/themeeditor/projectfiles.cpp b/utils/themeeditor/projectfiles.cpp
deleted file mode 100644
index f687e23767..0000000000
--- a/utils/themeeditor/projectfiles.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
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#include "projectfiles.h"
23
24ProjectFiles::ProjectFiles(QHash<QString, QString>& settings,
25 ProjectModel* model, ProjectNode* parent)
26 : parentLink(parent)
27{
28 base = settings.value("themebase");
29
30 QList<QString> keys;
31 keys.append("wps");
32 keys.append("rwps");
33 keys.append("sbs");
34 keys.append("rsbs");
35 keys.append("fms");
36 keys.append("rfms");
37
38 for(int i = 0; i < keys.count(); i++)
39 {
40 QString file = settings.value(keys[i], "");
41 if(file != "" && file != "-")
42 {
43 file.replace("/.rockbox/", "");
44 children.append(new ProjectFile(file, model, this));
45 }
46 }
47}
48
49ProjectFiles::~ProjectFiles()
50{
51 for(int i = 0; i < children.count(); i++)
52 delete children[i];
53}
54
55ProjectNode* ProjectFiles::parent() const
56{
57 return parentLink;
58}
59
60ProjectNode* ProjectFiles::child(int row) const
61{
62 if(row >= 0 && row < children.count())
63 return children[row];
64
65 return 0;
66}
67
68int ProjectFiles::numChildren() const
69{
70 return children.count();
71}
72
73int ProjectFiles::row() const
74{
75 return parentLink->indexOf(const_cast<ProjectFiles*>(this));
76}
77
78QVariant ProjectFiles::data(int column) const
79{
80 if(column == 0)
81 return QObject::tr("Project Files");
82 else
83 return QVariant();
84}
85
86Qt::ItemFlags ProjectFiles::flags(int column) const
87{
88 if(column == 0)
89 return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
90 else
91 return 0;
92}
93
94void ProjectFiles::activated()
95{
96
97}
98
99/* Project File functions */
100ProjectFile::ProjectFile(QString file, ProjectModel* model,
101 ProjectNode* parent)
102 :parentLink(parent), file(file)
103{
104 this->model = model;
105}
106
107ProjectFile::~ProjectFile()
108{
109
110}
111
112QVariant ProjectFile::data(int column) const
113{
114 if(column == 0)
115 return file;
116 else
117 return QVariant();
118}
119
120Qt::ItemFlags ProjectFile::flags(int column) const
121{
122 if(column == 0)
123 return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
124 else
125 return 0;
126}
127
128void ProjectFile::activated()
129{
130 QString base = dynamic_cast<ProjectFiles*>(parentLink)->getBase();
131 model->loadFile(base + "/" + file);
132}
133