summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/configdlg.cpp114
-rw-r--r--inputmethods/multikey/configdlg.h10
2 files changed, 106 insertions, 18 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index 566b2b9..89b713e 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -149,10 +149,12 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
149 QStringList color; 149 QStringList color;
150 config.setGroup("colors");
150 151
151 label = new QLabel(tr("Key Color"), color_box); 152 label = new QLabel(tr("Key Color"), color_box);
152 key_color_button = new QPushButton(color_box); 153 keycolor_button = new QPushButton(color_box);
153 connect(key_color_button, SIGNAL(clicked()), SLOT(keyColorButtonClicked())); 154 connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked()));
154 key_color_button->setFlat((bool)1); 155 keycolor_button->setFlat((bool)1);
155
156 config.setGroup("colors");
157 color = config.readListEntry("keycolor", QChar(',')); 156 color = config.readListEntry("keycolor", QChar(','));
157 /*
158 * hopefully not required
159
158 if (color.isEmpty()) { 160 if (color.isEmpty()) {
@@ -162,3 +164,4 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
162 } 164 }
163 key_color_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 165 */
166 keycolor_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
164 167
@@ -166,10 +169,23 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
166 label = new QLabel(tr("Key Pressed Color"), color_box); 169 label = new QLabel(tr("Key Pressed Color"), color_box);
167 QPushButton *button = new QPushButton(color_box); 170 keycolor_pressed_button = new QPushButton(color_box);
168 button->setFlat((bool)1); 171 connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked()));
172 keycolor_pressed_button->setFlat((bool)1);
173 color = config.readListEntry("keycolor_pressed", QChar(','));
174 keycolor_pressed_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
175
169 label = new QLabel(tr("Line Color"), color_box); 176 label = new QLabel(tr("Line Color"), color_box);
170 button = new QPushButton(color_box); 177 keycolor_lines_button = new QPushButton(color_box);
171 button->setFlat((bool)1); 178 connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked()));
179 keycolor_lines_button->setFlat((bool)1);
180 color = config.readListEntry("keycolor_lines", QChar(','));
181 keycolor_lines_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
182
183
172 label = new QLabel(tr("Text Color"), color_box); 184 label = new QLabel(tr("Text Color"), color_box);
173 button = new QPushButton(color_box); 185 textcolor_button = new QPushButton(color_box);
174 button->setFlat((bool)1); 186 connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked()));
187 textcolor_button->setFlat((bool)1);
188 color = config.readListEntry("textcolor", QChar(','));
189 textcolor_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
190
175 191
@@ -198,2 +214,4 @@ void ConfigDlg::repeatTog() {
198 214
215// ConfigDlg::setMap {{{1
216
199/* 217/*
@@ -205,3 +223,2 @@ void ConfigDlg::repeatTog() {
205 223
206// ConfigDlg::setMap {{{1
207void ConfigDlg::setMap(int index) { 224void ConfigDlg::setMap(int index) {
@@ -261,4 +278,12 @@ void ConfigDlg::removeMap() {
261 278
262// ConfigDlg::color {{{1 279/* ConfigDlg::slots for the color buttons {{{1
263void ConfigDlg::keyColorButtonClicked() { 280 *
281 * these four slots are almost the same, except for the names. i was thinking
282 * of making a map with pointers to the buttons and names of the configEntry
283 * so it could be one slot, but then there would be no way of telling which
284 * of the buttons was clicked if they all connect to the same slot.
285 *
286 */
287
288void ConfigDlg::keyColorClicked() {
264 289
@@ -278,3 +303,60 @@ void ConfigDlg::keyColorButtonClicked() {
278 303
279 key_color_button->setBackgroundColor(newcolor); 304 keycolor_button->setBackgroundColor(newcolor);
305 emit reloadKeyboard();
306}
307void ConfigDlg::keyColorPressedClicked() {
308
309 Config config ("multikey");
310 config.setGroup ("colors");
311
312 QStringList color = config.readListEntry("keycolor_pressed", QChar(','));
313
314 QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
315
316 color[0].setNum(newcolor.red());
317 color[1].setNum(newcolor.green());
318 color[2].setNum(newcolor.blue());
319
320 config.writeEntry("keycolor_pressed", color, QChar(','));
321 config.write();
322
323 keycolor_pressed_button->setBackgroundColor(newcolor);
324 emit reloadKeyboard();
325}
326void ConfigDlg::keyColorLinesClicked() {
327
328 Config config ("multikey");
329 config.setGroup ("colors");
330
331 QStringList color = config.readListEntry("keycolor_lines", QChar(','));
332
333 QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
334
335 color[0].setNum(newcolor.red());
336 color[1].setNum(newcolor.green());
337 color[2].setNum(newcolor.blue());
338
339 config.writeEntry("keycolor_lines", color, QChar(','));
340 config.write();
341
342 keycolor_lines_button->setBackgroundColor(newcolor);
343 emit reloadKeyboard();
344}
345void ConfigDlg::textColorClicked() {
346
347 Config config ("multikey");
348 config.setGroup ("colors");
349
350 QStringList color = config.readListEntry("textcolor", QChar(','));
351
352 QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
353
354 color[0].setNum(newcolor.red());
355 color[1].setNum(newcolor.green());
356 color[2].setNum(newcolor.blue());
357
358 config.writeEntry("textcolor", color, QChar(','));
359 config.write();
360
361 textcolor_button->setBackgroundColor(newcolor);
280 emit reloadKeyboard(); 362 emit reloadKeyboard();
diff --git a/inputmethods/multikey/configdlg.h b/inputmethods/multikey/configdlg.h
index a000e60..5d6403f 100644
--- a/inputmethods/multikey/configdlg.h
+++ b/inputmethods/multikey/configdlg.h
@@ -31,3 +31,6 @@ private slots:
31 // all those required slots for the color push buttons 31 // all those required slots for the color push buttons
32 void keyColorButtonClicked(); 32 void keyColorClicked();
33 void keyColorPressedClicked();
34 void keyColorLinesClicked();
35 void textColorClicked();
33 36
@@ -45,3 +48,6 @@ private:
45 /* color buttons */ 48 /* color buttons */
46 QPushButton *key_color_button; 49 QPushButton *keycolor_button;
50 QPushButton *keycolor_pressed_button;
51 QPushButton *keycolor_lines_button;
52 QPushButton *textcolor_button;
47 53