summaryrefslogtreecommitdiff
path: root/utils/themeeditor/editorwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/editorwindow.cpp')
-rw-r--r--utils/themeeditor/editorwindow.cpp27
1 files changed, 24 insertions, 3 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 @@
22#include "editorwindow.h" 22#include "editorwindow.h"
23#include "ui_editorwindow.h" 23#include "ui_editorwindow.h"
24 24
25#include <iostream> 25#include <QDesktopWidget>
26#include <QFileSystemModel>
26 27
27EditorWindow::EditorWindow(QWidget *parent) : 28EditorWindow::EditorWindow(QWidget *parent) :
28 QMainWindow(parent), 29 QMainWindow(parent),
@@ -37,10 +38,25 @@ EditorWindow::EditorWindow(QWidget *parent) :
37void EditorWindow::loadSettings() 38void EditorWindow::loadSettings()
38{ 39{
39 /* When there are settings to load, they'll be loaded here */ 40 /* When there are settings to load, they'll be loaded here */
41 /* For now, we'll just set the window to take up most of the screen */
42 QDesktopWidget* desktop = QApplication::desktop();
43
44 QRect availableSpace = desktop->availableGeometry(desktop->primaryScreen());
45 QRect buffer(availableSpace.left() + availableSpace.width() / 10,
46 availableSpace.top() + availableSpace.height() / 10,
47 availableSpace.width() * 8 / 10,
48 availableSpace.height() * 8 / 10);
49 this->setGeometry(buffer);
50
40} 51}
41 52
42void EditorWindow::setupUI() 53void EditorWindow::setupUI()
43{ 54{
55 /* Displaying some files to test the file tree view */
56 QFileSystemModel* model = new QFileSystemModel;
57 model->setRootPath(QDir::currentPath());
58 ui->fileTree->setModel(model);
59
44 /* Establishing the parse tree */ 60 /* Establishing the parse tree */
45 tree = new ParseTreeModel(ui->codeEdit->document()->toPlainText(). 61 tree = new ParseTreeModel(ui->codeEdit->document()->toPlainText().
46 toAscii()); 62 toAscii());
@@ -70,10 +86,15 @@ void EditorWindow::codeChanged()
70 ui->parseTree->expandAll(); 86 ui->parseTree->expandAll();
71} 87}
72 88
89void EditorWindow::closeEvent(QCloseEvent* event)
90{
91 event->accept();
92}
93
73void EditorWindow::updateCode() 94void EditorWindow::updateCode()
74{ 95{
75 tree->genCode(); 96 if(tree)
76 ui->codeEdit->document()->setPlainText(tree->genCode()); 97 ui->codeEdit->document()->setPlainText(tree->genCode());
77} 98}
78 99
79EditorWindow::~EditorWindow() 100EditorWindow::~EditorWindow()