From 69dce7cc2d55835349a5a21ef2d1569c66b6d9f3 Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Thu, 3 Jun 2010 20:05:55 +0000 Subject: Theme Editor: Mocked up most of the UI, added View menu items for all dockable widgets git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26520 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/editorwindow.cpp | 27 +++- utils/themeeditor/editorwindow.h | 3 + utils/themeeditor/editorwindow.ui | 241 ++++++++++++++++++++++++++++++++--- utils/themeeditor/parsetreemodel.cpp | 5 +- 4 files changed, 256 insertions(+), 20 deletions(-) diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp index e06f0d8937..36242bf8cb 100644 --- a/utils/themeeditor/editorwindow.cpp +++ b/utils/themeeditor/editorwindow.cpp @@ -22,7 +22,8 @@ #include "editorwindow.h" #include "ui_editorwindow.h" -#include +#include +#include EditorWindow::EditorWindow(QWidget *parent) : QMainWindow(parent), @@ -37,10 +38,25 @@ EditorWindow::EditorWindow(QWidget *parent) : void EditorWindow::loadSettings() { /* When there are settings to load, they'll be loaded here */ + /* For now, we'll just set the window to take up most of the screen */ + QDesktopWidget* desktop = QApplication::desktop(); + + QRect availableSpace = desktop->availableGeometry(desktop->primaryScreen()); + QRect buffer(availableSpace.left() + availableSpace.width() / 10, + availableSpace.top() + availableSpace.height() / 10, + availableSpace.width() * 8 / 10, + availableSpace.height() * 8 / 10); + this->setGeometry(buffer); + } void EditorWindow::setupUI() { + /* Displaying some files to test the file tree view */ + QFileSystemModel* model = new QFileSystemModel; + model->setRootPath(QDir::currentPath()); + ui->fileTree->setModel(model); + /* Establishing the parse tree */ tree = new ParseTreeModel(ui->codeEdit->document()->toPlainText(). toAscii()); @@ -70,10 +86,15 @@ void EditorWindow::codeChanged() ui->parseTree->expandAll(); } +void EditorWindow::closeEvent(QCloseEvent* event) +{ + event->accept(); +} + void EditorWindow::updateCode() { - tree->genCode(); - ui->codeEdit->document()->setPlainText(tree->genCode()); + if(tree) + ui->codeEdit->document()->setPlainText(tree->genCode()); } EditorWindow::~EditorWindow() diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h index f37cfcbf29..27d08521ab 100644 --- a/utils/themeeditor/editorwindow.h +++ b/utils/themeeditor/editorwindow.h @@ -37,6 +37,9 @@ public: EditorWindow(QWidget *parent = 0); ~EditorWindow(); +protected: + virtual void closeEvent(QCloseEvent* event); + private slots: void updateCode(); void codeChanged(); diff --git a/utils/themeeditor/editorwindow.ui b/utils/themeeditor/editorwindow.ui index a85ef62155..24bd1b4325 100644 --- a/utils/themeeditor/editorwindow.ui +++ b/utils/themeeditor/editorwindow.ui @@ -6,8 +6,8 @@ 0 0 - 800 - 400 + 628 + 433 @@ -33,7 +33,7 @@ 0 0 - 800 + 628 25 @@ -41,30 +41,102 @@ File + + + + + View + + + + + + - + 2 + + + + + Skin Preview + + + skinPreview + + + + + + + + + + + + toolBar + + + TopToolBarArea + + + true + + + + + 1 + + + + + + + Files + + + fileTree + + + + + + + + + + + + 2 + + - - - - - - - - Update Code - - - - + + + Parse Tree + + + parseTree + + + + + + + + + + Update Code + + @@ -77,6 +149,47 @@ Ctrl+Q + + + true + + + true + + + Parse Tree Panel + + + Ctrl+D + + + + + Preferences + + + + + true + + + true + + + File Panel + + + + + true + + + true + + + Preview Panel + + @@ -96,5 +209,101 @@ + + 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 + + + diff --git a/utils/themeeditor/parsetreemodel.cpp b/utils/themeeditor/parsetreemodel.cpp index 918903bb68..eecdc98334 100644 --- a/utils/themeeditor/parsetreemodel.cpp +++ b/utils/themeeditor/parsetreemodel.cpp @@ -131,7 +131,10 @@ int ParseTreeModel::rowCount(const QModelIndex &parent) const int ParseTreeModel::columnCount(const QModelIndex &parent) const { - return numColumns; + if(parent.isValid()) + return numColumns; + else + return numColumns; } QVariant ParseTreeModel::data(const QModelIndex &index, int role) const -- cgit v1.2.3