From fc94a92ad1c082c206114029fad108b983f59767 Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Wed, 9 Jun 2010 21:37:15 +0000 Subject: 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 --- utils/themeeditor/projectmodel.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'utils/themeeditor/projectmodel.cpp') 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 #include #include #include -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(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)); } -- cgit v1.1