1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Robert Bieber 2010-06-03 20:05:55 +00:00
parent 88160b6e27
commit 69dce7cc2d
4 changed files with 256 additions and 20 deletions

View file

@ -22,7 +22,8 @@
#include "editorwindow.h"
#include "ui_editorwindow.h"
#include <iostream>
#include <QDesktopWidget>
#include <QFileSystemModel>
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()