summaryrefslogtreecommitdiff
authorhash <hash>2002-08-19 20:06:41 (UTC)
committer hash <hash>2002-08-19 20:06:41 (UTC)
commit5c057c7040fe0669a159173f07793c7f28c95477 (patch) (unidiff)
tree42d9dcd632c296566a3b973c2f724593c822f57a
parentfc58f8b2dea3629fdd486852b74e425a3da29b52 (diff)
downloadopie-5c057c7040fe0669a159173f07793c7f28c95477.zip
opie-5c057c7040fe0669a159173f07793c7f28c95477.tar.gz
opie-5c057c7040fe0669a159173f07793c7f28c95477.tar.bz2
made all the rest of the color buttons work...
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
@@ -147,31 +147,47 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
147 147
148 QLabel *label; 148 QLabel *label;
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()) {
159 color = QStringList::split(",", "240,240,240"); 161 color = QStringList::split(",", "240,240,240");
160 config.writeEntry("keycolor", color.join(",")); 162 config.writeEntry("keycolor", color.join(","));
161 163
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
165 168
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
176 label = new QLabel("", color_box); // a spacer so the above buttons dont expand 192 label = new QLabel("", color_box); // a spacer so the above buttons dont expand
177 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 193 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
@@ -196,6 +212,8 @@ void ConfigDlg::repeatTog() {
196 emit repeatToggled(repeat_button->isChecked()); 212 emit repeatToggled(repeat_button->isChecked());
197} 213}
198 214
215// ConfigDlg::setMap {{{1
216
199/* 217/*
200 * the index is kinda screwy, because in the config file, index 0 is just the 218 * the index is kinda screwy, because in the config file, index 0 is just the
201 * first element in the QStringList, but here it's the "Current Language" 219 * first element in the QStringList, but here it's the "Current Language"
@@ -203,7 +221,6 @@ void ConfigDlg::repeatTog() {
203 * 221 *
204 */ 222 */
205 223
206// ConfigDlg::setMap {{{1
207void ConfigDlg::setMap(int index) { 224void ConfigDlg::setMap(int index) {
208 225
209 if (index == 0) { 226 if (index == 0) {
@@ -259,8 +276,16 @@ void ConfigDlg::removeMap() {
259 config.writeEntry("maps", custom_maps, QChar('|')); 276 config.writeEntry("maps", custom_maps, QChar('|'));
260} 277}
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
265 Config config ("multikey"); 290 Config config ("multikey");
266 config.setGroup ("colors"); 291 config.setGroup ("colors");
@@ -276,6 +301,63 @@ void ConfigDlg::keyColorButtonClicked() {
276 config.writeEntry("keycolor", color, QChar(',')); 301 config.writeEntry("keycolor", color, QChar(','));
277 config.write(); 302 config.write();
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();
281} 363}
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
@@ -29,7 +29,10 @@ private slots:
29 void removeMap(); 29 void removeMap();
30 30
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
34private: 37private:
35 QCheckBox *pick_button; 38 QCheckBox *pick_button;
@@ -43,7 +46,10 @@ private:
43 QStringList custom_maps; // maps you added with the 'add' button 46 QStringList custom_maps; // maps you added with the 'add' button
44 47
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
48}; 54};
49 55