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 @@ - - - false - - - false - - + 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 @@ #include "projectmodel.h" #include "projectfiles.h" +#include "projectsettings.h" #include "editorwindow.h" #include @@ -173,6 +174,7 @@ ProjectRoot::ProjectRoot(QString config, ProjectModel* model) /* Showing the files */ children.append(new ProjectFiles(settings, model, this)); + children.append(new ProjectSettings(settings, model, this)); } 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 { Q_OBJECT public: - static const int numColumns = 1; + static const int numColumns = 2; static QString fileFilter() { 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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2010 Robert Bieber + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "projectsettings.h" + +ProjectSettings::ProjectSettings(QHash& settings, + ProjectModel* model, ProjectNode* parent) + : parentLink(parent) +{ + QHash::iterator i; + for(i = settings.begin(); i != settings.end(); i++) + { + QPair value(i.key(), i.value()); + children.append(new ProjectSetting(value, model, this)); + } +} + +ProjectSettings::~ProjectSettings() +{ + for(int i = 0; i < children.count(); i++) + delete children[i]; +} + +ProjectNode* ProjectSettings::parent() const +{ + return parentLink; +} + +ProjectNode* ProjectSettings::child(int row) const +{ + if(row >= 0 && row < children.count()) + return children[row]; + + return 0; +} + +int ProjectSettings::numChildren() const +{ + return children.count(); +} + +int ProjectSettings::row() const +{ + return parentLink->indexOf(const_cast(this)); +} + +QVariant ProjectSettings::data(int column) const +{ + if(column == 0) + return QObject::tr("Project Settings"); + else + return QVariant(); +} + +Qt::ItemFlags ProjectSettings::flags(int column) const +{ + if(column == 0) + return Qt::ItemIsEnabled | Qt::ItemIsSelectable; + else + return 0; +} + +void ProjectSettings::activated() +{ + +} + +/* Project File functions */ +ProjectSetting::ProjectSetting(QPair setting, + ProjectModel* model, ProjectNode* parent) + :parentLink(parent), setting(setting) +{ + this->model = model; +} + +ProjectSetting::~ProjectSetting() +{ + +} + +QVariant ProjectSetting::data(int column) const +{ + if(column == 0) + return setting.first; + else if(column == 1) + return setting.second; + else + return QVariant(); +} + +Qt::ItemFlags ProjectSetting::flags(int column) const +{ + if(column == 0 || column == 1) + return Qt::ItemIsEnabled | Qt::ItemIsSelectable; + else + return 0; +} + +void ProjectSetting::activated() +{ +} + 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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2010 Robert Bieber + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef PROJCETSETTINGS_H +#define PROJECTSETTINGS_H + +#include "projectmodel.h" +#include + +class ProjectSettings : public ProjectNode +{ +public: + ProjectSettings(QHash& settings, ProjectModel* model, + ProjectNode* parent); + virtual ~ProjectSettings(); + + virtual ProjectNode* parent() const; + virtual ProjectNode* child(int row) const; + virtual int numChildren() const; + virtual int row() const; + virtual QVariant data(int column) const; + virtual Qt::ItemFlags flags(int column) const; + virtual void activated(); + +private: + ProjectNode* parentLink; + +}; + +/* A class to enumerate a single file */ +class ProjectSetting: public ProjectNode +{ +public: + ProjectSetting(QPair setting, ProjectModel* model, + ProjectNode* parent); + virtual ~ProjectSetting(); + + virtual ProjectNode* parent() const{ return parentLink; } + virtual ProjectNode* child(int row) const{ return 0; } + virtual int numChildren() const{ return 0; } + virtual int row() const{ + return parentLink->indexOf(const_cast(this)); + } + virtual QVariant data(int column) const; + virtual Qt::ItemFlags flags(int column) const; + virtual void activated(); + +private: + ProjectNode* parentLink; + QPair setting; +}; + +#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 \ preferencesdialog.h \ codeeditor.h \ projectmodel.h \ - projectfiles.h + projectfiles.h \ + projectsettings.h SOURCES += tag_table.c \ skin_parser.c \ skin_scan.c \ @@ -31,7 +32,8 @@ SOURCES += tag_table.c \ preferencesdialog.cpp \ codeeditor.cpp \ projectmodel.cpp \ - projectfiles.cpp + projectfiles.cpp \ + projectsettings.cpp OTHER_FILES += README \ resources/windowicon.png \ resources/appicon.xcf \