diff options
Diffstat (limited to 'utils/themeeditor/skindocument.cpp')
-rw-r--r-- | utils/themeeditor/skindocument.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp new file mode 100644 index 0000000000..380f16fa7d --- /dev/null +++ b/utils/themeeditor/skindocument.cpp | |||
@@ -0,0 +1,63 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Robert Bieber | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "skindocument.h" | ||
23 | |||
24 | SkinDocument::SkinDocument(QWidget *parent) : | ||
25 | QWidget(parent) | ||
26 | { | ||
27 | setupUI(); | ||
28 | |||
29 | title = "Untitled"; | ||
30 | } | ||
31 | |||
32 | SkinDocument::~SkinDocument() | ||
33 | { | ||
34 | delete highlighter; | ||
35 | delete model; | ||
36 | } | ||
37 | |||
38 | void SkinDocument::setupUI() | ||
39 | { | ||
40 | /* Setting up the text edit */ | ||
41 | layout = new QHBoxLayout; | ||
42 | editor = new QPlainTextEdit(this); | ||
43 | layout->addWidget(editor); | ||
44 | |||
45 | setLayout(layout); | ||
46 | |||
47 | /* Attaching the syntax highlighter */ | ||
48 | highlighter = new SkinHighlighter(QColor(0,180,0), QColor(255,0,0), | ||
49 | QColor(0,0,255), QColor(120,120,120), | ||
50 | editor->document()); | ||
51 | |||
52 | /* Setting up the model */ | ||
53 | model = new ParseTreeModel(""); | ||
54 | |||
55 | /* Connecting the editor's signal */ | ||
56 | QObject::connect(editor, SIGNAL(textChanged()), | ||
57 | this, SLOT(codeChanged())); | ||
58 | } | ||
59 | |||
60 | void SkinDocument::codeChanged() | ||
61 | { | ||
62 | model->changeTree(editor->document()->toPlainText().toAscii()); | ||
63 | } | ||