diff options
Diffstat (limited to 'utils/themeeditor/gui')
-rw-r--r-- | utils/themeeditor/gui/findreplacedialog.cpp | 101 | ||||
-rw-r--r-- | utils/themeeditor/gui/findreplacedialog.h | 58 | ||||
-rw-r--r-- | utils/themeeditor/gui/findreplacedialog.ui | 147 | ||||
-rw-r--r-- | utils/themeeditor/gui/skindocument.cpp | 2 |
4 files changed, 308 insertions, 0 deletions
diff --git a/utils/themeeditor/gui/findreplacedialog.cpp b/utils/themeeditor/gui/findreplacedialog.cpp new file mode 100644 index 0000000000..234c6f6886 --- /dev/null +++ b/utils/themeeditor/gui/findreplacedialog.cpp | |||
@@ -0,0 +1,101 @@ | |||
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 "findreplacedialog.h" | ||
23 | #include "ui_findreplacedialog.h" | ||
24 | |||
25 | #include <QTextBlock> | ||
26 | |||
27 | FindReplaceDialog::FindReplaceDialog(QWidget *parent) : | ||
28 | QDialog(parent), | ||
29 | ui(new Ui::FindReplaceDialog), editor(0) | ||
30 | { | ||
31 | ui->setupUi(this); | ||
32 | setupUI(); | ||
33 | } | ||
34 | |||
35 | FindReplaceDialog::~FindReplaceDialog() | ||
36 | { | ||
37 | delete ui; | ||
38 | } | ||
39 | |||
40 | void FindReplaceDialog::changeEvent(QEvent *e) | ||
41 | { | ||
42 | QDialog::changeEvent(e); | ||
43 | switch (e->type()) { | ||
44 | case QEvent::LanguageChange: | ||
45 | ui->retranslateUi(this); | ||
46 | break; | ||
47 | default: | ||
48 | break; | ||
49 | } | ||
50 | } | ||
51 | |||
52 | void FindReplaceDialog::closeEvent(QCloseEvent* event) | ||
53 | { | ||
54 | ui->statusLabel->setText(""); | ||
55 | event->accept(); | ||
56 | } | ||
57 | |||
58 | void FindReplaceDialog::setupUI() | ||
59 | { | ||
60 | QObject::connect(ui->findButton, SIGNAL(pressed()), | ||
61 | this, SLOT(find())); | ||
62 | QObject::connect(ui->replaceButton, SIGNAL(pressed()), | ||
63 | this, SLOT(replace())); | ||
64 | QObject::connect(ui->replaceAllButton, SIGNAL(pressed()), | ||
65 | this, SLOT(replaceAll())); | ||
66 | QObject::connect(ui->closeButton, SIGNAL(pressed()), | ||
67 | this, SLOT(close())); | ||
68 | QObject::connect(ui->findBox, SIGNAL(textChanged(QString)), | ||
69 | this, SLOT(textChanged())); | ||
70 | |||
71 | textChanged(); | ||
72 | } | ||
73 | |||
74 | void FindReplaceDialog::find() | ||
75 | { | ||
76 | |||
77 | if(!editor) | ||
78 | return; | ||
79 | |||
80 | editor->setTextCursor(editor->document()->find(ui->findBox->text())); | ||
81 | |||
82 | } | ||
83 | |||
84 | void FindReplaceDialog::replace() | ||
85 | { | ||
86 | |||
87 | } | ||
88 | |||
89 | void FindReplaceDialog::replaceAll() | ||
90 | { | ||
91 | |||
92 | } | ||
93 | |||
94 | void FindReplaceDialog::textChanged() | ||
95 | { | ||
96 | bool enabled = ui->findBox->text() != ""; | ||
97 | |||
98 | ui->findButton->setEnabled(enabled); | ||
99 | ui->replaceButton->setEnabled(enabled); | ||
100 | ui->replaceAllButton->setEnabled(enabled); | ||
101 | } | ||
diff --git a/utils/themeeditor/gui/findreplacedialog.h b/utils/themeeditor/gui/findreplacedialog.h new file mode 100644 index 0000000000..793094a5fe --- /dev/null +++ b/utils/themeeditor/gui/findreplacedialog.h | |||
@@ -0,0 +1,58 @@ | |||
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 | #ifndef FINDREPLACEDIALOG_H | ||
23 | #define FINDREPLACEDIALOG_H | ||
24 | |||
25 | #include <QDialog> | ||
26 | #include <QPlainTextEdit> | ||
27 | |||
28 | namespace Ui { | ||
29 | class FindReplaceDialog; | ||
30 | } | ||
31 | |||
32 | class FindReplaceDialog : public QDialog { | ||
33 | Q_OBJECT | ||
34 | public: | ||
35 | FindReplaceDialog(QWidget *parent = 0); | ||
36 | virtual ~FindReplaceDialog(); | ||
37 | |||
38 | void setTextEdit(QPlainTextEdit* editor){ this->editor = editor; } | ||
39 | |||
40 | protected: | ||
41 | void changeEvent(QEvent *e); | ||
42 | void closeEvent(QCloseEvent* event); | ||
43 | |||
44 | private slots: | ||
45 | void find(); | ||
46 | void replace(); | ||
47 | void replaceAll(); | ||
48 | void textChanged(); | ||
49 | |||
50 | private: | ||
51 | void setupUI(); | ||
52 | |||
53 | Ui::FindReplaceDialog *ui; | ||
54 | |||
55 | QPlainTextEdit* editor; | ||
56 | }; | ||
57 | |||
58 | #endif // FINDREPLACEDIALOG_H | ||
diff --git a/utils/themeeditor/gui/findreplacedialog.ui b/utils/themeeditor/gui/findreplacedialog.ui new file mode 100644 index 0000000000..1c4510788f --- /dev/null +++ b/utils/themeeditor/gui/findreplacedialog.ui | |||
@@ -0,0 +1,147 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <ui version="4.0"> | ||
3 | <class>FindReplaceDialog</class> | ||
4 | <widget class="QDialog" name="FindReplaceDialog"> | ||
5 | <property name="geometry"> | ||
6 | <rect> | ||
7 | <x>0</x> | ||
8 | <y>0</y> | ||
9 | <width>450</width> | ||
10 | <height>200</height> | ||
11 | </rect> | ||
12 | </property> | ||
13 | <property name="windowTitle"> | ||
14 | <string>Find/Replace</string> | ||
15 | </property> | ||
16 | <property name="windowIcon"> | ||
17 | <iconset resource="../resources.qrc"> | ||
18 | <normaloff>:/resources/windowicon.png</normaloff>:/resources/windowicon.png</iconset> | ||
19 | </property> | ||
20 | <layout class="QHBoxLayout" name="horizontalLayout"> | ||
21 | <item> | ||
22 | <layout class="QVBoxLayout" name="verticalLayout_2"> | ||
23 | <item> | ||
24 | <layout class="QFormLayout" name="formLayout"> | ||
25 | <item row="0" column="0"> | ||
26 | <widget class="QLabel" name="label"> | ||
27 | <property name="text"> | ||
28 | <string>Find:</string> | ||
29 | </property> | ||
30 | <property name="buddy"> | ||
31 | <cstring>findBox</cstring> | ||
32 | </property> | ||
33 | </widget> | ||
34 | </item> | ||
35 | <item row="0" column="1"> | ||
36 | <widget class="QLineEdit" name="findBox"/> | ||
37 | </item> | ||
38 | <item row="1" column="0"> | ||
39 | <widget class="QLabel" name="label_2"> | ||
40 | <property name="text"> | ||
41 | <string>Replace:</string> | ||
42 | </property> | ||
43 | <property name="buddy"> | ||
44 | <cstring>replaceBox</cstring> | ||
45 | </property> | ||
46 | </widget> | ||
47 | </item> | ||
48 | <item row="1" column="1"> | ||
49 | <widget class="QLineEdit" name="replaceBox"/> | ||
50 | </item> | ||
51 | </layout> | ||
52 | </item> | ||
53 | <item> | ||
54 | <layout class="QVBoxLayout" name="verticalLayout"> | ||
55 | <item> | ||
56 | <widget class="QLabel" name="statusLabel"> | ||
57 | <property name="text"> | ||
58 | <string/> | ||
59 | </property> | ||
60 | </widget> | ||
61 | </item> | ||
62 | <item> | ||
63 | <widget class="QCheckBox" name="caseBox"> | ||
64 | <property name="text"> | ||
65 | <string>Match Case</string> | ||
66 | </property> | ||
67 | </widget> | ||
68 | </item> | ||
69 | <item> | ||
70 | <widget class="QCheckBox" name="backwardsBox"> | ||
71 | <property name="text"> | ||
72 | <string>Search Backwards</string> | ||
73 | </property> | ||
74 | </widget> | ||
75 | </item> | ||
76 | <item> | ||
77 | <widget class="QCheckBox" name="wrapBox"> | ||
78 | <property name="text"> | ||
79 | <string>Wrap Around</string> | ||
80 | </property> | ||
81 | </widget> | ||
82 | </item> | ||
83 | </layout> | ||
84 | </item> | ||
85 | </layout> | ||
86 | </item> | ||
87 | <item> | ||
88 | <layout class="QVBoxLayout" name="verticalLayout_3"> | ||
89 | <item> | ||
90 | <widget class="QPushButton" name="findButton"> | ||
91 | <property name="text"> | ||
92 | <string>Find</string> | ||
93 | </property> | ||
94 | <property name="shortcut"> | ||
95 | <string>Ctrl+F</string> | ||
96 | </property> | ||
97 | <property name="default"> | ||
98 | <bool>true</bool> | ||
99 | </property> | ||
100 | </widget> | ||
101 | </item> | ||
102 | <item> | ||
103 | <widget class="QPushButton" name="replaceButton"> | ||
104 | <property name="text"> | ||
105 | <string>Replace</string> | ||
106 | </property> | ||
107 | </widget> | ||
108 | </item> | ||
109 | <item> | ||
110 | <widget class="QPushButton" name="replaceAllButton"> | ||
111 | <property name="text"> | ||
112 | <string>Replace All</string> | ||
113 | </property> | ||
114 | </widget> | ||
115 | </item> | ||
116 | <item> | ||
117 | <widget class="QPushButton" name="closeButton"> | ||
118 | <property name="text"> | ||
119 | <string>Close</string> | ||
120 | </property> | ||
121 | <property name="shortcut"> | ||
122 | <string>Esc</string> | ||
123 | </property> | ||
124 | </widget> | ||
125 | </item> | ||
126 | <item> | ||
127 | <spacer name="verticalSpacer"> | ||
128 | <property name="orientation"> | ||
129 | <enum>Qt::Vertical</enum> | ||
130 | </property> | ||
131 | <property name="sizeHint" stdset="0"> | ||
132 | <size> | ||
133 | <width>20</width> | ||
134 | <height>40</height> | ||
135 | </size> | ||
136 | </property> | ||
137 | </spacer> | ||
138 | </item> | ||
139 | </layout> | ||
140 | </item> | ||
141 | </layout> | ||
142 | </widget> | ||
143 | <resources> | ||
144 | <include location="../resources.qrc"/> | ||
145 | </resources> | ||
146 | <connections/> | ||
147 | </ui> | ||
diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp index 28e5297b48..9a381a9589 100644 --- a/utils/themeeditor/gui/skindocument.cpp +++ b/utils/themeeditor/gui/skindocument.cpp | |||
@@ -29,6 +29,8 @@ | |||
29 | 29 | ||
30 | #include <iostream> | 30 | #include <iostream> |
31 | 31 | ||
32 | #include <QDebug> | ||
33 | |||
32 | SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project, | 34 | SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project, |
33 | DeviceState* device, QWidget *parent) | 35 | DeviceState* device, QWidget *parent) |
34 | :TabContent(parent), statusLabel(statusLabel), | 36 | :TabContent(parent), statusLabel(statusLabel), |