summaryrefslogtreecommitdiff
path: root/utils/themeeditor/projectmodel.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-09 21:37:15 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-09 21:37:15 +0000
commitfc94a92ad1c082c206114029fad108b983f59767 (patch)
treee76059edab819244cf2991db6b631f6daa48d795 /utils/themeeditor/projectmodel.cpp
parent1cc95c541bd7bafe5d33ef0145887cb7ddd8a6d7 (diff)
downloadrockbox-fc94a92ad1c082c206114029fad108b983f59767.zip
rockbox-fc94a92ad1c082c206114029fad108b983f59767.tar.gz
rockbox-fc94a92ad1c082c206114029fad108b983f59767.tar.bz2
rockbox-fc94a92ad1c082c206114029fad108b983f59767.tar.xz
Theme Editor: Enabled loading project files from the project panel
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26732 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/projectmodel.cpp')
-rw-r--r--utils/themeeditor/projectmodel.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/utils/themeeditor/projectmodel.cpp b/utils/themeeditor/projectmodel.cpp
index d3a338e..f745139 100644
--- a/utils/themeeditor/projectmodel.cpp
+++ b/utils/themeeditor/projectmodel.cpp
@@ -22,16 +22,19 @@
#include "projectmodel.h"
#include "projectfiles.h"
+#include "editorwindow.h"
#include <QFile>
#include <QTextStream>
#include <QHash>
#include <QDir>
-ProjectModel::ProjectModel(QString config, QObject *parent) :
- QAbstractItemModel(parent)
+ProjectModel::ProjectModel(QString config, EditorWindow* mainWindow,
+ QObject *parent)
+ : QAbstractItemModel(parent),
+ mainWindow(mainWindow)
{
- root = new ProjectRoot(config);
+ root = new ProjectRoot(config, this);
}
ProjectModel::~ProjectModel()
@@ -120,9 +123,21 @@ bool ProjectModel::setData(const QModelIndex &index, const QVariant &value,
return true;
}
+void ProjectModel::loadFile(QString file)
+{
+ mainWindow->loadTabFromFile(file);
+}
+
+void ProjectModel::activated(const QModelIndex &index)
+{
+ static_cast<ProjectNode*>(index.internalPointer())->activated();
+}
+
/* Constructor and destructor for the root class */
-ProjectRoot::ProjectRoot(QString config)
+ProjectRoot::ProjectRoot(QString config, ProjectModel* model)
{
+ this->model = model;
+
/* Reading the config file */
QFile cfg(config);
cfg.open(QFile::ReadOnly | QFile::Text);
@@ -157,7 +172,7 @@ ProjectRoot::ProjectRoot(QString config)
cfg.close();
/* Showing the files */
- children.append(new ProjectFiles(settings, this));
+ children.append(new ProjectFiles(settings, model, this));
}