From cb26aecf92f73065915416324c6a33ca8cf83bc8 Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Thu, 10 Jun 2010 07:06:38 +0000 Subject: [PATCH] Theme Editor: Opening an already opened document no longer spawns a new tab git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26736 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/editorwindow.cpp | 14 +++++++++++++- utils/themeeditor/skindocument.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp index 601e4d85e8..d137897763 100644 --- a/utils/themeeditor/editorwindow.cpp +++ b/utils/themeeditor/editorwindow.cpp @@ -42,7 +42,19 @@ EditorWindow::EditorWindow(QWidget *parent) : void EditorWindow::loadTabFromFile(QString fileName) { - /* Adding a new document for each file name */ + /* Checking to see if the file is already open */ + for(int i = 0; i < ui->editorTabs->count(); i++) + { + SkinDocument* current = dynamic_cast + (ui->editorTabs->widget(i)); + if(current->getFile() == fileName) + { + ui->editorTabs->setCurrentIndex(i); + return; + } + } + + /* Adding a new document*/ SkinDocument* doc = new SkinDocument(parseStatus, fileName); addTab(doc); diff --git a/utils/themeeditor/skindocument.h b/utils/themeeditor/skindocument.h index c8f92955f5..e8bd27067f 100644 --- a/utils/themeeditor/skindocument.h +++ b/utils/themeeditor/skindocument.h @@ -52,6 +52,7 @@ public: void connectPrefs(PreferencesDialog* prefs); ParseTreeModel* getModel(){ return model; } + QString getFile(){ return fileName; } QString getTitle(){ return title; } QString getStatus(){ return parseStatus; } void genCode(){ editor->document()->setPlainText(model->genCode()); }