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.cpp42
1 files changed, 20 insertions, 22 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp
index 36242bf8cb..c19178a51a 100644
--- a/utils/themeeditor/editorwindow.cpp
+++ b/utils/themeeditor/editorwindow.cpp
@@ -57,49 +57,47 @@ void EditorWindow::setupUI()
57 model->setRootPath(QDir::currentPath()); 57 model->setRootPath(QDir::currentPath());
58 ui->fileTree->setModel(model); 58 ui->fileTree->setModel(model);
59 59
60 /* Establishing the parse tree */
61 tree = new ParseTreeModel(ui->codeEdit->document()->toPlainText().
62 toAscii());
63 ui->parseTree->setModel(tree);
64
65 /* Setting up the syntax highlighter */
66 highlighter = new SkinHighlighter(QColor(0,255,0), QColor(255,0,0),
67 QColor(0,0,255), QColor(150,150,150),
68 ui->codeEdit->document());
69
70 /* Connecting the buttons */ 60 /* Connecting the buttons */
71 QObject::connect(ui->codeEdit, SIGNAL(cursorPositionChanged()),
72 this, SLOT(codeChanged()));
73 QObject::connect(ui->fromTree, SIGNAL(pressed()), 61 QObject::connect(ui->fromTree, SIGNAL(pressed()),
74 this, SLOT(updateCode())); 62 this, SLOT(updateCode()));
75
76} 63}
77 64
78void EditorWindow::setupMenus() 65void EditorWindow::setupMenus()
79{ 66{
80 /* When there are menus to setup, they'll be set up here */ 67 /* Connecting panel show actions */
68 QObject::connect(ui->actionFile_Panel, SIGNAL(triggered()),
69 this, SLOT(showPanel()));
70 QObject::connect(ui->actionDisplay_Panel, SIGNAL(triggered()),
71 this, SLOT(showPanel()));
72 QObject::connect(ui->actionPreview_Panel, SIGNAL(triggered()),
73 this, SLOT(showPanel()));
81} 74}
82 75
83void EditorWindow::codeChanged() 76void EditorWindow::codeChanged()
84{ 77{
85 tree->changeTree(ui->codeEdit->document()->toPlainText().toAscii());
86 ui->parseTree->expandAll(); 78 ui->parseTree->expandAll();
87} 79}
88 80
89void EditorWindow::closeEvent(QCloseEvent* event) 81void EditorWindow::updateCode()
90{ 82{
91 event->accept();
92} 83}
93 84
94void EditorWindow::updateCode() 85void EditorWindow::showPanel()
86{
87 if(sender() == ui->actionFile_Panel)
88 ui->fileDock->setVisible(true);
89 if(sender() == ui->actionPreview_Panel)
90 ui->skinPreviewDock->setVisible(true);
91 if(sender() == ui->actionDisplay_Panel)
92 ui->parseTreeDock->setVisible(true);
93}
94
95void EditorWindow::closeEvent(QCloseEvent* event)
95{ 96{
96 if(tree) 97 event->accept();
97 ui->codeEdit->document()->setPlainText(tree->genCode());
98} 98}
99 99
100EditorWindow::~EditorWindow() 100EditorWindow::~EditorWindow()
101{ 101{
102 delete ui; 102 delete ui;
103 if(tree)
104 delete tree;
105} 103}