diff options
| author | Robert Bieber <robby@bieberphoto.com> | 2010-06-05 07:38:29 +0000 |
|---|---|---|
| committer | Robert Bieber <robby@bieberphoto.com> | 2010-06-05 07:38:29 +0000 |
| commit | d41a6810533f5508a18ce7e02cb34b8c37e371cc (patch) | |
| tree | 3c65417a6b022fdfccc822dbeab43846d56e7b32 /utils/themeeditor | |
| parent | 0af886077520658a12a0c0b2d41bc15e5b906239 (diff) | |
| download | rockbox-d41a6810533f5508a18ce7e02cb34b8c37e371cc.zip rockbox-d41a6810533f5508a18ce7e02cb34b8c37e371cc.tar.gz rockbox-d41a6810533f5508a18ce7e02cb34b8c37e371cc.tar.bz2 rockbox-d41a6810533f5508a18ce7e02cb34b8c37e371cc.tar.xz | |
Theme Editor: Enabled tag closing
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26566 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor')
| -rw-r--r-- | utils/themeeditor/editorwindow.cpp | 26 | ||||
| -rw-r--r-- | utils/themeeditor/editorwindow.h | 2 | ||||
| -rw-r--r-- | utils/themeeditor/skindocument.cpp | 5 | ||||
| -rw-r--r-- | utils/themeeditor/skindocument.h | 2 |
4 files changed, 35 insertions, 0 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp index 4268788..a2fc11a 100644 --- a/utils/themeeditor/editorwindow.cpp +++ b/utils/themeeditor/editorwindow.cpp @@ -78,6 +78,12 @@ void EditorWindow::setupUI() model->setRootPath(QDir::currentPath()); ui->fileTree->setModel(model); + /* Connecting the tab bar signals */ + QObject::connect(ui->editorTabs, SIGNAL(currentChanged(int)), + this, SLOT(shiftTab(int))); + QObject::connect(ui->editorTabs, SIGNAL(tabCloseRequested(int)), + this, SLOT(closeTab(int))); + } void EditorWindow::setupMenus() @@ -102,6 +108,26 @@ void EditorWindow::newTab() ui->editorTabs->addTab(doc, doc->getTitle()); } +void EditorWindow::shiftTab(int index) +{ + if(index < 0) + ui->parseTree->setModel(0); + else + ui->parseTree->setModel(dynamic_cast<SkinDocument*> + (ui->editorTabs->currentWidget())->getModel()); +} + +void EditorWindow::closeTab(int index) +{ + SkinDocument* widget = dynamic_cast<SkinDocument*> + (ui->editorTabs->widget(index)); + if(widget->requestClose()) + { + ui->editorTabs->removeTab(index); + widget->deleteLater(); + } +} + void EditorWindow::showPanel() { if(sender() == ui->actionFile_Panel) diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h index 157ee6a..1c02bb3 100644 --- a/utils/themeeditor/editorwindow.h +++ b/utils/themeeditor/editorwindow.h @@ -44,6 +44,8 @@ protected: private slots: void showPanel(); void newTab(); + void shiftTab(int index); + void closeTab(int index); private: /* Setup functions */ diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp index 380f16f..5391f91 100644 --- a/utils/themeeditor/skindocument.cpp +++ b/utils/themeeditor/skindocument.cpp @@ -35,6 +35,11 @@ SkinDocument::~SkinDocument() delete model; } +bool SkinDocument::requestClose() +{ + return true; +} + void SkinDocument::setupUI() { /* Setting up the text edit */ diff --git a/utils/themeeditor/skindocument.h b/utils/themeeditor/skindocument.h index 5f25d8e..e15dd61 100644 --- a/utils/themeeditor/skindocument.h +++ b/utils/themeeditor/skindocument.h @@ -39,6 +39,8 @@ public: ParseTreeModel* getModel(){ return model; } QString getTitle(){ return title; } + bool requestClose(); + signals: private slots: |