From d41a6810533f5508a18ce7e02cb34b8c37e371cc Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Sat, 5 Jun 2010 07:38:29 +0000 Subject: Theme Editor: Enabled tag closing git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26566 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/editorwindow.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'utils/themeeditor/editorwindow.cpp') diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp index 4268788772..a2fc11afdf 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 + (ui->editorTabs->currentWidget())->getModel()); +} + +void EditorWindow::closeTab(int index) +{ + SkinDocument* widget = dynamic_cast + (ui->editorTabs->widget(index)); + if(widget->requestClose()) + { + ui->editorTabs->removeTab(index); + widget->deleteLater(); + } +} + void EditorWindow::showPanel() { if(sender() == ui->actionFile_Panel) -- cgit v1.2.3