From b094c15e7c9a652a02928620be09b4ccc420ba61 Mon Sep 17 00:00:00 2001 From: bieber Date: Fri, 4 Jun 2010 06:59:25 +0000 Subject: [PATCH] Theme Editor: Fixed bugs with menu signals, rearranged UI some more git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26540 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/editorwindow.cpp | 42 ++++----- utils/themeeditor/editorwindow.h | 2 +- utils/themeeditor/editorwindow.ui | 183 ++++++++++--------------------------- 3 files changed, 68 insertions(+), 159 deletions(-) diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp index 36242bf8c..c19178a51 100644 --- a/utils/themeeditor/editorwindow.cpp +++ b/utils/themeeditor/editorwindow.cpp @@ -57,49 +57,47 @@ void EditorWindow::setupUI() model->setRootPath(QDir::currentPath()); ui->fileTree->setModel(model); - /* Establishing the parse tree */ - tree = new ParseTreeModel(ui->codeEdit->document()->toPlainText(). - toAscii()); - ui->parseTree->setModel(tree); - - /* Setting up the syntax highlighter */ - highlighter = new SkinHighlighter(QColor(0,255,0), QColor(255,0,0), - QColor(0,0,255), QColor(150,150,150), - ui->codeEdit->document()); - /* Connecting the buttons */ - QObject::connect(ui->codeEdit, SIGNAL(cursorPositionChanged()), - this, SLOT(codeChanged())); QObject::connect(ui->fromTree, SIGNAL(pressed()), this, SLOT(updateCode())); - } void EditorWindow::setupMenus() { - /* When there are menus to setup, they'll be set up here */ + /* Connecting panel show actions */ + QObject::connect(ui->actionFile_Panel, SIGNAL(triggered()), + this, SLOT(showPanel())); + QObject::connect(ui->actionDisplay_Panel, SIGNAL(triggered()), + this, SLOT(showPanel())); + QObject::connect(ui->actionPreview_Panel, SIGNAL(triggered()), + this, SLOT(showPanel())); } void EditorWindow::codeChanged() { - tree->changeTree(ui->codeEdit->document()->toPlainText().toAscii()); ui->parseTree->expandAll(); } -void EditorWindow::closeEvent(QCloseEvent* event) +void EditorWindow::updateCode() { - event->accept(); } -void EditorWindow::updateCode() +void EditorWindow::showPanel() +{ + if(sender() == ui->actionFile_Panel) + ui->fileDock->setVisible(true); + if(sender() == ui->actionPreview_Panel) + ui->skinPreviewDock->setVisible(true); + if(sender() == ui->actionDisplay_Panel) + ui->parseTreeDock->setVisible(true); +} + +void EditorWindow::closeEvent(QCloseEvent* event) { - if(tree) - ui->codeEdit->document()->setPlainText(tree->genCode()); + event->accept(); } EditorWindow::~EditorWindow() { delete ui; - if(tree) - delete tree; } diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h index 27d08521a..8cbfd99ed 100644 --- a/utils/themeeditor/editorwindow.h +++ b/utils/themeeditor/editorwindow.h @@ -43,6 +43,7 @@ protected: private slots: void updateCode(); void codeChanged(); + void showPanel(); private: /* Setup functions */ @@ -51,7 +52,6 @@ private: void setupMenus(); Ui::EditorWindow *ui; - ParseTreeModel* tree; SkinHighlighter* highlighter; }; diff --git a/utils/themeeditor/editorwindow.ui b/utils/themeeditor/editorwindow.ui index f5064a0b4..c7e89a4a0 100644 --- a/utils/themeeditor/editorwindow.ui +++ b/utils/themeeditor/editorwindow.ui @@ -20,9 +20,18 @@ - - - QPlainTextEdit::NoWrap + + + QTabWidget::North + + + -1 + + + true + + + true @@ -41,6 +50,9 @@ &File + + + @@ -58,22 +70,15 @@ + + Skin Preview + 2 - - - Skin Preview - - - skinPreview - - - - @@ -87,48 +92,34 @@ TopToolBarArea - true + false + + Files + 1 - - - Files - - - fileTree - - - - + + Parse Tree + 2 - - - Parse Tree - - - parseTree - - - - @@ -151,10 +142,10 @@ - true + false - true + false Parse &Tree Panel @@ -170,10 +161,10 @@ - true + false - true + false &File Panel @@ -181,15 +172,31 @@ - true + false - true + false &Preview Panel + + + &New Document + + + Ctrl+N + + + + + &Open Document + + + Ctrl+O + + @@ -211,101 +218,5 @@ - - actionDisplay_Panel - toggled(bool) - parseTreeDock - setVisible(bool) - - - -1 - -1 - - - 680 - 129 - - - - - parseTreeDock - visibilityChanged(bool) - actionDisplay_Panel - setChecked(bool) - - - 680 - 129 - - - -1 - -1 - - - - - actionFile_Panel - toggled(bool) - fileDock - setVisible(bool) - - - -1 - -1 - - - 79 - 206 - - - - - fileDock - visibilityChanged(bool) - actionFile_Panel - setChecked(bool) - - - 79 - 206 - - - -1 - -1 - - - - - actionPreview_Panel - toggled(bool) - skinPreviewDock - setVisible(bool) - - - -1 - -1 - - - 680 - 112 - - - - - skinPreviewDock - visibilityChanged(bool) - actionPreview_Panel - setChecked(bool) - - - 680 - 112 - - - -1 - -1 - - - -- 2.11.4.GIT