diff options
-rw-r--r-- | utils/themeeditor/editorwindow.ui | 9 | ||||
-rw-r--r-- | utils/themeeditor/projectmodel.cpp | 2 | ||||
-rw-r--r-- | utils/themeeditor/projectmodel.h | 2 | ||||
-rw-r--r-- | utils/themeeditor/projectsettings.cpp | 120 | ||||
-rw-r--r-- | utils/themeeditor/projectsettings.h | 71 | ||||
-rw-r--r-- | utils/themeeditor/themeeditor.pro | 6 |
6 files changed, 199 insertions, 11 deletions
diff --git a/utils/themeeditor/editorwindow.ui b/utils/themeeditor/editorwindow.ui index 30d1da087f..a3ea666c78 100644 --- a/utils/themeeditor/editorwindow.ui +++ b/utils/themeeditor/editorwindow.ui | |||
@@ -111,14 +111,7 @@ | |||
111 | <widget class="QWidget" name="dockWidgetContents_2"> | 111 | <widget class="QWidget" name="dockWidgetContents_2"> |
112 | <layout class="QVBoxLayout" name="verticalLayout_4"> | 112 | <layout class="QVBoxLayout" name="verticalLayout_4"> |
113 | <item> | 113 | <item> |
114 | <widget class="QTreeView" name="projectTree"> | 114 | <widget class="QTreeView" name="projectTree"/> |
115 | <attribute name="headerVisible"> | ||
116 | <bool>false</bool> | ||
117 | </attribute> | ||
118 | <attribute name="headerVisible"> | ||
119 | <bool>false</bool> | ||
120 | </attribute> | ||
121 | </widget> | ||
122 | </item> | 115 | </item> |
123 | </layout> | 116 | </layout> |
124 | </widget> | 117 | </widget> |
diff --git a/utils/themeeditor/projectmodel.cpp b/utils/themeeditor/projectmodel.cpp index f745139338..da810d4906 100644 --- a/utils/themeeditor/projectmodel.cpp +++ b/utils/themeeditor/projectmodel.cpp | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include "projectmodel.h" | 23 | #include "projectmodel.h" |
24 | #include "projectfiles.h" | 24 | #include "projectfiles.h" |
25 | #include "projectsettings.h" | ||
25 | #include "editorwindow.h" | 26 | #include "editorwindow.h" |
26 | 27 | ||
27 | #include <QFile> | 28 | #include <QFile> |
@@ -173,6 +174,7 @@ ProjectRoot::ProjectRoot(QString config, ProjectModel* model) | |||
173 | 174 | ||
174 | /* Showing the files */ | 175 | /* Showing the files */ |
175 | children.append(new ProjectFiles(settings, model, this)); | 176 | children.append(new ProjectFiles(settings, model, this)); |
177 | children.append(new ProjectSettings(settings, model, this)); | ||
176 | 178 | ||
177 | } | 179 | } |
178 | 180 | ||
diff --git a/utils/themeeditor/projectmodel.h b/utils/themeeditor/projectmodel.h index f170501a58..c7147fa83f 100644 --- a/utils/themeeditor/projectmodel.h +++ b/utils/themeeditor/projectmodel.h | |||
@@ -32,7 +32,7 @@ class ProjectModel : public QAbstractItemModel | |||
32 | { | 32 | { |
33 | Q_OBJECT | 33 | Q_OBJECT |
34 | public: | 34 | public: |
35 | static const int numColumns = 1; | 35 | static const int numColumns = 2; |
36 | 36 | ||
37 | static QString fileFilter() | 37 | static QString fileFilter() |
38 | { | 38 | { |
diff --git a/utils/themeeditor/projectsettings.cpp b/utils/themeeditor/projectsettings.cpp new file mode 100644 index 0000000000..a477f2bdfc --- /dev/null +++ b/utils/themeeditor/projectsettings.cpp | |||
@@ -0,0 +1,120 @@ | |||
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 "projectsettings.h" | ||
23 | |||
24 | ProjectSettings::ProjectSettings(QHash<QString, QString>& settings, | ||
25 | ProjectModel* model, ProjectNode* parent) | ||
26 | : parentLink(parent) | ||
27 | { | ||
28 | QHash<QString, QString>::iterator i; | ||
29 | for(i = settings.begin(); i != settings.end(); i++) | ||
30 | { | ||
31 | QPair<QString, QString> value(i.key(), i.value()); | ||
32 | children.append(new ProjectSetting(value, model, this)); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | ProjectSettings::~ProjectSettings() | ||
37 | { | ||
38 | for(int i = 0; i < children.count(); i++) | ||
39 | delete children[i]; | ||
40 | } | ||
41 | |||
42 | ProjectNode* ProjectSettings::parent() const | ||
43 | { | ||
44 | return parentLink; | ||
45 | } | ||
46 | |||
47 | ProjectNode* ProjectSettings::child(int row) const | ||
48 | { | ||
49 | if(row >= 0 && row < children.count()) | ||
50 | return children[row]; | ||
51 | |||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | int ProjectSettings::numChildren() const | ||
56 | { | ||
57 | return children.count(); | ||
58 | } | ||
59 | |||
60 | int ProjectSettings::row() const | ||
61 | { | ||
62 | return parentLink->indexOf(const_cast<ProjectSettings*>(this)); | ||
63 | } | ||
64 | |||
65 | QVariant ProjectSettings::data(int column) const | ||
66 | { | ||
67 | if(column == 0) | ||
68 | return QObject::tr("Project Settings"); | ||
69 | else | ||
70 | return QVariant(); | ||
71 | } | ||
72 | |||
73 | Qt::ItemFlags ProjectSettings::flags(int column) const | ||
74 | { | ||
75 | if(column == 0) | ||
76 | return Qt::ItemIsEnabled | Qt::ItemIsSelectable; | ||
77 | else | ||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | void ProjectSettings::activated() | ||
82 | { | ||
83 | |||
84 | } | ||
85 | |||
86 | /* Project File functions */ | ||
87 | ProjectSetting::ProjectSetting(QPair<QString, QString> setting, | ||
88 | ProjectModel* model, ProjectNode* parent) | ||
89 | :parentLink(parent), setting(setting) | ||
90 | { | ||
91 | this->model = model; | ||
92 | } | ||
93 | |||
94 | ProjectSetting::~ProjectSetting() | ||
95 | { | ||
96 | |||
97 | } | ||
98 | |||
99 | QVariant ProjectSetting::data(int column) const | ||
100 | { | ||
101 | if(column == 0) | ||
102 | return setting.first; | ||
103 | else if(column == 1) | ||
104 | return setting.second; | ||
105 | else | ||
106 | return QVariant(); | ||
107 | } | ||
108 | |||
109 | Qt::ItemFlags ProjectSetting::flags(int column) const | ||
110 | { | ||
111 | if(column == 0 || column == 1) | ||
112 | return Qt::ItemIsEnabled | Qt::ItemIsSelectable; | ||
113 | else | ||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | void ProjectSetting::activated() | ||
118 | { | ||
119 | } | ||
120 | |||
diff --git a/utils/themeeditor/projectsettings.h b/utils/themeeditor/projectsettings.h new file mode 100644 index 0000000000..ed785ac02c --- /dev/null +++ b/utils/themeeditor/projectsettings.h | |||
@@ -0,0 +1,71 @@ | |||
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 PROJCETSETTINGS_H | ||
23 | #define PROJECTSETTINGS_H | ||
24 | |||
25 | #include "projectmodel.h" | ||
26 | #include <QHash> | ||
27 | |||
28 | class ProjectSettings : public ProjectNode | ||
29 | { | ||
30 | public: | ||
31 | ProjectSettings(QHash<QString, QString>& settings, ProjectModel* model, | ||
32 | ProjectNode* parent); | ||
33 | virtual ~ProjectSettings(); | ||
34 | |||
35 | virtual ProjectNode* parent() const; | ||
36 | virtual ProjectNode* child(int row) const; | ||
37 | virtual int numChildren() const; | ||
38 | virtual int row() const; | ||
39 | virtual QVariant data(int column) const; | ||
40 | virtual Qt::ItemFlags flags(int column) const; | ||
41 | virtual void activated(); | ||
42 | |||
43 | private: | ||
44 | ProjectNode* parentLink; | ||
45 | |||
46 | }; | ||
47 | |||
48 | /* A class to enumerate a single file */ | ||
49 | class ProjectSetting: public ProjectNode | ||
50 | { | ||
51 | public: | ||
52 | ProjectSetting(QPair<QString, QString> setting, ProjectModel* model, | ||
53 | ProjectNode* parent); | ||
54 | virtual ~ProjectSetting(); | ||
55 | |||
56 | virtual ProjectNode* parent() const{ return parentLink; } | ||
57 | virtual ProjectNode* child(int row) const{ return 0; } | ||
58 | virtual int numChildren() const{ return 0; } | ||
59 | virtual int row() const{ | ||
60 | return parentLink->indexOf(const_cast<ProjectSetting*>(this)); | ||
61 | } | ||
62 | virtual QVariant data(int column) const; | ||
63 | virtual Qt::ItemFlags flags(int column) const; | ||
64 | virtual void activated(); | ||
65 | |||
66 | private: | ||
67 | ProjectNode* parentLink; | ||
68 | QPair<QString, QString> setting; | ||
69 | }; | ||
70 | |||
71 | #endif // PROJECTSETTINGS_H | ||
diff --git a/utils/themeeditor/themeeditor.pro b/utils/themeeditor/themeeditor.pro index d78ea681a6..b86b4debb4 100644 --- a/utils/themeeditor/themeeditor.pro +++ b/utils/themeeditor/themeeditor.pro | |||
@@ -17,7 +17,8 @@ HEADERS += tag_table.h \ | |||
17 | preferencesdialog.h \ | 17 | preferencesdialog.h \ |
18 | codeeditor.h \ | 18 | codeeditor.h \ |
19 | projectmodel.h \ | 19 | projectmodel.h \ |
20 | projectfiles.h | 20 | projectfiles.h \ |
21 | projectsettings.h | ||
21 | SOURCES += tag_table.c \ | 22 | SOURCES += tag_table.c \ |
22 | skin_parser.c \ | 23 | skin_parser.c \ |
23 | skin_scan.c \ | 24 | skin_scan.c \ |
@@ -31,7 +32,8 @@ SOURCES += tag_table.c \ | |||
31 | preferencesdialog.cpp \ | 32 | preferencesdialog.cpp \ |
32 | codeeditor.cpp \ | 33 | codeeditor.cpp \ |
33 | projectmodel.cpp \ | 34 | projectmodel.cpp \ |
34 | projectfiles.cpp | 35 | projectfiles.cpp \ |
36 | projectsettings.cpp | ||
35 | OTHER_FILES += README \ | 37 | OTHER_FILES += README \ |
36 | resources/windowicon.png \ | 38 | resources/windowicon.png \ |
37 | resources/appicon.xcf \ | 39 | resources/appicon.xcf \ |