diff options
Diffstat (limited to 'utils/themeeditor/editorwindow.cpp')
| -rw-r--r-- | utils/themeeditor/editorwindow.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp index e06f0d8..36242bf 100644 --- a/utils/themeeditor/editorwindow.cpp +++ b/utils/themeeditor/editorwindow.cpp @@ -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() |