From b76b6448a2e0e07af4ee61e7d3a4fe11370019f7 Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Wed, 14 Jul 2010 05:06:42 +0000 Subject: [PATCH] Theme Editor: Added Close Project feature git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27412 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/gui/editorwindow.cpp | 31 +++++++++++++++++++++++++- utils/themeeditor/gui/editorwindow.h | 1 + utils/themeeditor/gui/editorwindow.ui | 12 ++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp index b81e41a2f5..247109cc19 100644 --- a/utils/themeeditor/gui/editorwindow.cpp +++ b/utils/themeeditor/gui/editorwindow.cpp @@ -205,6 +205,8 @@ void EditorWindow::setupMenus() QObject::connect(ui->actionClose_Document, SIGNAL(triggered()), this, SLOT(closeCurrent())); + QObject::connect(ui->actionClose_Project, SIGNAL(triggered()), + this, SLOT(closeProject())); QObject::connect(ui->actionSave_Document, SIGNAL(triggered()), this, SLOT(saveCurrent())); @@ -347,6 +349,31 @@ void EditorWindow::closeCurrent() closeTab(ui->editorTabs->currentIndex()); } +void EditorWindow::closeProject() +{ + if(project) + { + project->deleteLater(); + project = 0; + } + + for(int i = 0; i < ui->editorTabs->count(); i++) + { + TabContent* doc = dynamic_cast + (ui->editorTabs->widget(i)); + if(doc->type() == TabContent::Skin) + { + dynamic_cast(doc)->setProject(project); + if(i == ui->editorTabs->currentIndex()) + { + viewer->setScene(dynamic_cast(doc)->scene()); + } + } + } + + ui->actionClose_Project->setEnabled(false); +} + void EditorWindow::saveCurrent() { if(ui->editorTabs->currentIndex() >= 0) @@ -401,7 +428,9 @@ void EditorWindow::openProject() { if(project) - delete project; + project->deleteLater(); + + ui->actionClose_Project->setEnabled(true); project = new ProjectModel(fileName, this); ui->projectTree->setModel(project); diff --git a/utils/themeeditor/gui/editorwindow.h b/utils/themeeditor/gui/editorwindow.h index 6b09b79815..0178f602b2 100644 --- a/utils/themeeditor/gui/editorwindow.h +++ b/utils/themeeditor/gui/editorwindow.h @@ -67,6 +67,7 @@ private slots: void shiftTab(int index); bool closeTab(int index); void closeCurrent(); + void closeProject(); void saveCurrent(); void saveCurrentAs(); void openFile(); diff --git a/utils/themeeditor/gui/editorwindow.ui b/utils/themeeditor/gui/editorwindow.ui index 5ef3261acb..ab8dc61896 100644 --- a/utils/themeeditor/gui/editorwindow.ui +++ b/utils/themeeditor/gui/editorwindow.ui @@ -52,6 +52,7 @@ + @@ -374,6 +375,17 @@ Ctrl+T + + + false + + + Close Pro&ject + + + Ctrl+Shift+W + + projectTree