summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/themeeditor/editorwindow.cpp26
-rw-r--r--utils/themeeditor/editorwindow.h2
-rw-r--r--utils/themeeditor/skindocument.cpp5
-rw-r--r--utils/themeeditor/skindocument.h2
4 files changed, 35 insertions, 0 deletions
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()
78 model->setRootPath(QDir::currentPath()); 78 model->setRootPath(QDir::currentPath());
79 ui->fileTree->setModel(model); 79 ui->fileTree->setModel(model);
80 80
81 /* Connecting the tab bar signals */
82 QObject::connect(ui->editorTabs, SIGNAL(currentChanged(int)),
83 this, SLOT(shiftTab(int)));
84 QObject::connect(ui->editorTabs, SIGNAL(tabCloseRequested(int)),
85 this, SLOT(closeTab(int)));
86
81} 87}
82 88
83void EditorWindow::setupMenus() 89void EditorWindow::setupMenus()
@@ -102,6 +108,26 @@ void EditorWindow::newTab()
102 ui->editorTabs->addTab(doc, doc->getTitle()); 108 ui->editorTabs->addTab(doc, doc->getTitle());
103} 109}
104 110
111void EditorWindow::shiftTab(int index)
112{
113 if(index < 0)
114 ui->parseTree->setModel(0);
115 else
116 ui->parseTree->setModel(dynamic_cast<SkinDocument*>
117 (ui->editorTabs->currentWidget())->getModel());
118}
119
120void EditorWindow::closeTab(int index)
121{
122 SkinDocument* widget = dynamic_cast<SkinDocument*>
123 (ui->editorTabs->widget(index));
124 if(widget->requestClose())
125 {
126 ui->editorTabs->removeTab(index);
127 widget->deleteLater();
128 }
129}
130
105void EditorWindow::showPanel() 131void EditorWindow::showPanel()
106{ 132{
107 if(sender() == ui->actionFile_Panel) 133 if(sender() == ui->actionFile_Panel)
diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h
index 157ee6a30b..1c02bb378d 100644
--- a/utils/themeeditor/editorwindow.h
+++ b/utils/themeeditor/editorwindow.h
@@ -44,6 +44,8 @@ protected:
44private slots: 44private slots:
45 void showPanel(); 45 void showPanel();
46 void newTab(); 46 void newTab();
47 void shiftTab(int index);
48 void closeTab(int index);
47 49
48private: 50private:
49 /* Setup functions */ 51 /* Setup functions */
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index 380f16fa7d..5391f9155d 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -35,6 +35,11 @@ SkinDocument::~SkinDocument()
35 delete model; 35 delete model;
36} 36}
37 37
38bool SkinDocument::requestClose()
39{
40 return true;
41}
42
38void SkinDocument::setupUI() 43void SkinDocument::setupUI()
39{ 44{
40 /* Setting up the text edit */ 45 /* Setting up the text edit */
diff --git a/utils/themeeditor/skindocument.h b/utils/themeeditor/skindocument.h
index 5f25d8e292..e15dd613fd 100644
--- a/utils/themeeditor/skindocument.h
+++ b/utils/themeeditor/skindocument.h
@@ -39,6 +39,8 @@ public:
39 ParseTreeModel* getModel(){ return model; } 39 ParseTreeModel* getModel(){ return model; }
40 QString getTitle(){ return title; } 40 QString getTitle(){ return title; }
41 41
42 bool requestClose();
43
42signals: 44signals:
43 45
44private slots: 46private slots: