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.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp
index ada9ecd137..e06f0d8937 100644
--- a/utils/themeeditor/editorwindow.cpp
+++ b/utils/themeeditor/editorwindow.cpp
@@ -29,33 +29,51 @@ EditorWindow::EditorWindow(QWidget *parent) :
29 ui(new Ui::EditorWindow) 29 ui(new Ui::EditorWindow)
30{ 30{
31 ui->setupUi(this); 31 ui->setupUi(this);
32 loadSettings();
33 setupUI();
34 setupMenus();
35}
32 36
37void EditorWindow::loadSettings()
38{
39 /* When there are settings to load, they'll be loaded here */
40}
41
42void EditorWindow::setupUI()
43{
33 /* Establishing the parse tree */ 44 /* Establishing the parse tree */
34 tree = new ParseTreeModel(ui->code->document()->toPlainText().toAscii()); 45 tree = new ParseTreeModel(ui->codeEdit->document()->toPlainText().
46 toAscii());
35 ui->parseTree->setModel(tree); 47 ui->parseTree->setModel(tree);
36 48
37 /* Setting up the syntax highlighter */ 49 /* Setting up the syntax highlighter */
38 highlighter = new SkinHighlighter(QColor(0,255,0), QColor(255,0,0), 50 highlighter = new SkinHighlighter(QColor(0,255,0), QColor(255,0,0),
39 QColor(0,0,255), QColor(150,150,150), 51 QColor(0,0,255), QColor(150,150,150),
40 ui->code->document()); 52 ui->codeEdit->document());
41 53
42 /* Connecting the buttons */ 54 /* Connecting the buttons */
43 QObject::connect(ui->code, SIGNAL(cursorPositionChanged()), 55 QObject::connect(ui->codeEdit, SIGNAL(cursorPositionChanged()),
44 this, SLOT(updateTree())); 56 this, SLOT(codeChanged()));
45 QObject::connect(ui->fromTree, SIGNAL(pressed()), 57 QObject::connect(ui->fromTree, SIGNAL(pressed()),
46 this, SLOT(updateCode())); 58 this, SLOT(updateCode()));
59
60}
61
62void EditorWindow::setupMenus()
63{
64 /* When there are menus to setup, they'll be set up here */
47} 65}
48 66
49void EditorWindow::updateTree() 67void EditorWindow::codeChanged()
50{ 68{
51 tree->changeTree(ui->code->document()->toPlainText().toAscii()); 69 tree->changeTree(ui->codeEdit->document()->toPlainText().toAscii());
52 ui->parseTree->expandAll(); 70 ui->parseTree->expandAll();
53} 71}
54 72
55void EditorWindow::updateCode() 73void EditorWindow::updateCode()
56{ 74{
57 tree->genCode(); 75 tree->genCode();
58 ui->code->document()->setPlainText(tree->genCode()); 76 ui->codeEdit->document()->setPlainText(tree->genCode());
59} 77}
60 78
61EditorWindow::~EditorWindow() 79EditorWindow::~EditorWindow()