author | hash <hash> | 2002-08-19 20:06:41 (UTC) |
---|---|---|
committer | hash <hash> | 2002-08-19 20:06:41 (UTC) |
commit | 5c057c7040fe0669a159173f07793c7f28c95477 (patch) (unidiff) | |
tree | 42d9dcd632c296566a3b973c2f724593c822f57a /inputmethods | |
parent | fc58f8b2dea3629fdd486852b74e425a3da29b52 (diff) | |
download | opie-5c057c7040fe0669a159173f07793c7f28c95477.zip opie-5c057c7040fe0669a159173f07793c7f28c95477.tar.gz opie-5c057c7040fe0669a159173f07793c7f28c95477.tar.bz2 |
made all the rest of the color buttons work...
-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 114 | ||||
-rw-r--r-- | inputmethods/multikey/configdlg.h | 10 |
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 | |||
@@ -1,281 +1,363 @@ | |||
1 | /* | 1 | /* |
2 | * TODO | 2 | * TODO |
3 | * make a font selection thing (size too) | 3 | * make a font selection thing (size too) |
4 | * make a cursor thing | 4 | * make a cursor thing |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <iostream.h> | 10 | #include <iostream.h> |
11 | 11 | ||
12 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | #include <qpe/config.h> | 13 | #include <qpe/config.h> |
14 | 14 | ||
15 | #include <qwidget.h> | 15 | #include <qwidget.h> |
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | #include <qtabwidget.h> | 17 | #include <qtabwidget.h> |
18 | #include <qvbox.h> | 18 | #include <qvbox.h> |
19 | #include <qgrid.h> | 19 | #include <qgrid.h> |
20 | #include <qgroupbox.h> | 20 | #include <qgroupbox.h> |
21 | #include <qlabel.h> | 21 | #include <qlabel.h> |
22 | #include <qcheckbox.h> | 22 | #include <qcheckbox.h> |
23 | #include <qsizepolicy.h> | 23 | #include <qsizepolicy.h> |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | #include <qlistbox.h> | 25 | #include <qlistbox.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <opie/ofiledialog.h> | 27 | #include <opie/ofiledialog.h> |
28 | #include <opie/colordialog.h> | 28 | #include <opie/colordialog.h> |
29 | #include <qdir.h> | 29 | #include <qdir.h> |
30 | #include <qfileinfo.h> | 30 | #include <qfileinfo.h> |
31 | #include "configdlg.h" | 31 | #include "configdlg.h" |
32 | #include "keyboard.h" | 32 | #include "keyboard.h" |
33 | 33 | ||
34 | // ConfigDlg::ConfigDlg() {{{1 | 34 | // ConfigDlg::ConfigDlg() {{{1 |
35 | ConfigDlg::ConfigDlg () : QTabWidget () | 35 | ConfigDlg::ConfigDlg () : QTabWidget () |
36 | { | 36 | { |
37 | setCaption( tr("Multikey Configuration") ); | 37 | setCaption( tr("Multikey Configuration") ); |
38 | Config config ("multikey"); | 38 | Config config ("multikey"); |
39 | config.setGroup("keymaps"); | 39 | config.setGroup("keymaps"); |
40 | QString current_map = config.readEntry("current", 0); | 40 | QString current_map = config.readEntry("current", 0); |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * 'general config' tab | 43 | * 'general config' tab |
44 | */ | 44 | */ |
45 | 45 | ||
46 | QVBox *gen_box = new QVBox (this); | 46 | QVBox *gen_box = new QVBox (this); |
47 | gen_box->setMargin(3); | 47 | gen_box->setMargin(3); |
48 | addTab(gen_box, tr("General Settings")); | 48 | addTab(gen_box, tr("General Settings")); |
49 | 49 | ||
50 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); | 50 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); |
51 | 51 | ||
52 | keymaps = new QListBox (map_group); | 52 | keymaps = new QListBox (map_group); |
53 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); | 53 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
54 | 54 | ||
55 | QString cur(tr("Current Language")); | 55 | QString cur(tr("Current Language")); |
56 | keymaps->insertItem(cur); | 56 | keymaps->insertItem(cur); |
57 | keymaps->setSelected(0, true); | 57 | keymaps->setSelected(0, true); |
58 | 58 | ||
59 | QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); | 59 | QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); |
60 | default_maps = map_dir.entryList(); // so i can access it in other places | 60 | default_maps = map_dir.entryList(); // so i can access it in other places |
61 | 61 | ||
62 | for (uint i = 0; i <map_dir.count(); i++) { | 62 | for (uint i = 0; i <map_dir.count(); i++) { |
63 | 63 | ||
64 | keymaps->insertItem(map_dir.absPath() + "/" + map_dir[i]); | 64 | keymaps->insertItem(map_dir.absPath() + "/" + map_dir[i]); |
65 | if (map_dir.absPath() + "/" + map_dir[i] == current_map) { | 65 | if (map_dir.absPath() + "/" + map_dir[i] == current_map) { |
66 | 66 | ||
67 | keymaps->setSelected(i + 1, true); | 67 | keymaps->setSelected(i + 1, true); |
68 | } | 68 | } |
69 | 69 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | custom_maps = config.readListEntry("maps", QChar('|')); | 72 | custom_maps = config.readListEntry("maps", QChar('|')); |
73 | 73 | ||
74 | for (uint i = 0; i < custom_maps.count(); i++) { | 74 | for (uint i = 0; i < custom_maps.count(); i++) { |
75 | 75 | ||
76 | if (map_dir.exists(QFileInfo(custom_maps[i]).fileName(), false) | 76 | if (map_dir.exists(QFileInfo(custom_maps[i]).fileName(), false) |
77 | || !QFile::exists(custom_maps[i])) { | 77 | || !QFile::exists(custom_maps[i])) { |
78 | 78 | ||
79 | custom_maps.remove(custom_maps.at(i)); | 79 | custom_maps.remove(custom_maps.at(i)); |
80 | 80 | ||
81 | // remove it from the list too | 81 | // remove it from the list too |
82 | config.writeEntry("maps", custom_maps.join("|")); | 82 | config.writeEntry("maps", custom_maps.join("|")); |
83 | 83 | ||
84 | 84 | ||
85 | } else { | 85 | } else { |
86 | 86 | ||
87 | keymaps->insertItem(custom_maps[i]); | 87 | keymaps->insertItem(custom_maps[i]); |
88 | if (custom_maps[i] == current_map) { | 88 | if (custom_maps[i] == current_map) { |
89 | 89 | ||
90 | keymaps->setSelected(map_dir.count() + i + 1, true); | 90 | keymaps->setSelected(map_dir.count() + i + 1, true); |
91 | } | 91 | } |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | // have to "+1" because the "current language" listItem... remember? | 95 | // have to "+1" because the "current language" listItem... remember? |
96 | 96 | ||
97 | connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); | 97 | connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); |
98 | 98 | ||
99 | 99 | ||
100 | QGrid *add_remove_grid = new QGrid(2, map_group); | 100 | QGrid *add_remove_grid = new QGrid(2, map_group); |
101 | add_remove_grid->setMargin(3); | 101 | add_remove_grid->setMargin(3); |
102 | add_remove_grid->setSpacing(3); | 102 | add_remove_grid->setSpacing(3); |
103 | 103 | ||
104 | add_button = new QPushButton(tr("Add"), add_remove_grid); | 104 | add_button = new QPushButton(tr("Add"), add_remove_grid); |
105 | add_button->setFlat((bool)1); | 105 | add_button->setFlat((bool)1); |
106 | connect(add_button, SIGNAL(clicked()), SLOT(addMap())); | 106 | connect(add_button, SIGNAL(clicked()), SLOT(addMap())); |
107 | 107 | ||
108 | remove_button = new QPushButton(tr("Remove"), add_remove_grid); | 108 | remove_button = new QPushButton(tr("Remove"), add_remove_grid); |
109 | remove_button->setFlat((bool)1); | 109 | remove_button->setFlat((bool)1); |
110 | if ((int)map_dir.count() >= keymaps->currentItem()) | 110 | if ((int)map_dir.count() >= keymaps->currentItem()) |
111 | remove_button->setDisabled(true); | 111 | remove_button->setDisabled(true); |
112 | connect(remove_button, SIGNAL(clicked()), SLOT(removeMap())); | 112 | connect(remove_button, SIGNAL(clicked()), SLOT(removeMap())); |
113 | 113 | ||
114 | // make a box that will contain the buttons on the bottom | 114 | // make a box that will contain the buttons on the bottom |
115 | QGrid *other_grid = new QGrid(2, gen_box); | 115 | QGrid *other_grid = new QGrid(2, gen_box); |
116 | pick_button = new QCheckBox(tr("Pickboard"), other_grid); | 116 | pick_button = new QCheckBox(tr("Pickboard"), other_grid); |
117 | 117 | ||
118 | config.setGroup ("general"); | 118 | config.setGroup ("general"); |
119 | bool pick_open = config.readBoolEntry ("usePickboard", (bool)0); // default closed | 119 | bool pick_open = config.readBoolEntry ("usePickboard", (bool)0); // default closed |
120 | if (pick_open) { | 120 | if (pick_open) { |
121 | 121 | ||
122 | pick_button->setChecked(true); | 122 | pick_button->setChecked(true); |
123 | } | 123 | } |
124 | 124 | ||
125 | // by connecting it after checking it, the signal isn't emmited | 125 | // by connecting it after checking it, the signal isn't emmited |
126 | connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog())); | 126 | connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog())); |
127 | 127 | ||
128 | repeat_button = new QCheckBox(tr("Key Repeat"), other_grid); | 128 | repeat_button = new QCheckBox(tr("Key Repeat"), other_grid); |
129 | bool repeat_on = config.readBoolEntry ("useRepeat", (bool)1); | 129 | bool repeat_on = config.readBoolEntry ("useRepeat", (bool)1); |
130 | 130 | ||
131 | if (repeat_on) { | 131 | if (repeat_on) { |
132 | 132 | ||
133 | repeat_button->setChecked(true); | 133 | repeat_button->setChecked(true); |
134 | } | 134 | } |
135 | connect (repeat_button, SIGNAL(clicked()), this, SLOT(repeatTog())); | 135 | connect (repeat_button, SIGNAL(clicked()), this, SLOT(repeatTog())); |
136 | 136 | ||
137 | 137 | ||
138 | /* | 138 | /* |
139 | * 'color' tab | 139 | * 'color' tab |
140 | */ | 140 | */ |
141 | 141 | ||
142 | QGrid *color_box = new QGrid(2, this); | 142 | QGrid *color_box = new QGrid(2, this); |
143 | color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); | 143 | color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); |
144 | color_box->setMargin(3); | 144 | color_box->setMargin(3); |
145 | color_box->setSpacing(3); | 145 | color_box->setSpacing(3); |
146 | addTab(color_box, tr("Colors")); | 146 | addTab(color_box, tr("Colors")); |
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)); |
178 | 194 | ||
179 | } | 195 | } |
180 | 196 | ||
181 | void ConfigDlg::pickTog() { | 197 | void ConfigDlg::pickTog() { |
182 | 198 | ||
183 | Config config ("multikey"); | 199 | Config config ("multikey"); |
184 | config.setGroup ("general"); | 200 | config.setGroup ("general"); |
185 | config.writeEntry ("usePickboard", pick_button->isChecked()); // default closed | 201 | config.writeEntry ("usePickboard", pick_button->isChecked()); // default closed |
186 | 202 | ||
187 | emit pickboardToggled(pick_button->isChecked()); | 203 | emit pickboardToggled(pick_button->isChecked()); |
188 | } | 204 | } |
189 | 205 | ||
190 | void ConfigDlg::repeatTog() { | 206 | void ConfigDlg::repeatTog() { |
191 | 207 | ||
192 | Config config ("multikey"); | 208 | Config config ("multikey"); |
193 | config.setGroup ("general"); | 209 | config.setGroup ("general"); |
194 | config.writeEntry ("useRepeat", repeat_button->isChecked()); // default closed | 210 | config.writeEntry ("useRepeat", repeat_button->isChecked()); // default closed |
195 | 211 | ||
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" |
202 | * listItem. therefor you have to minus one to the index before you access it. | 220 | * listItem. therefor you have to minus one to the index before you access it. |
203 | * | 221 | * |
204 | */ | 222 | */ |
205 | 223 | ||
206 | // ConfigDlg::setMap {{{1 | ||
207 | void ConfigDlg::setMap(int index) { | 224 | void ConfigDlg::setMap(int index) { |
208 | 225 | ||
209 | if (index == 0) { | 226 | if (index == 0) { |
210 | 227 | ||
211 | remove_button->setDisabled(true); | 228 | remove_button->setDisabled(true); |
212 | emit setMapToDefault(); | 229 | emit setMapToDefault(); |
213 | } | 230 | } |
214 | else if ((uint)index <= default_maps.count()) { | 231 | else if ((uint)index <= default_maps.count()) { |
215 | 232 | ||
216 | remove_button->setDisabled(true); | 233 | remove_button->setDisabled(true); |
217 | emit setMapToFile(keymaps->text(index)); | 234 | emit setMapToFile(keymaps->text(index)); |
218 | 235 | ||
219 | } else { | 236 | } else { |
220 | 237 | ||
221 | remove_button->setEnabled(true); | 238 | remove_button->setEnabled(true); |
222 | emit setMapToFile(keymaps->text(index)); | 239 | emit setMapToFile(keymaps->text(index)); |
223 | } | 240 | } |
224 | } | 241 | } |
225 | 242 | ||
226 | // ConfigDlg::addMap() {{{1 | 243 | // ConfigDlg::addMap() {{{1 |
227 | void ConfigDlg::addMap() { | 244 | void ConfigDlg::addMap() { |
228 | 245 | ||
229 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); | 246 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); |
230 | Config config ("multikey"); | 247 | Config config ("multikey"); |
231 | config.setGroup("keymaps"); | 248 | config.setGroup("keymaps"); |
232 | QStringList maps = config.readListEntry("maps", QChar('|')); | 249 | QStringList maps = config.readListEntry("maps", QChar('|')); |
233 | maps.append(map); | 250 | maps.append(map); |
234 | keymaps->insertItem(map); | 251 | keymaps->insertItem(map); |
235 | keymaps->setSelected(keymaps->count() - 1, true); | 252 | keymaps->setSelected(keymaps->count() - 1, true); |
236 | 253 | ||
237 | 254 | ||
238 | config.writeEntry("maps", maps, QChar('|')); | 255 | config.writeEntry("maps", maps, QChar('|')); |
239 | config.writeEntry("current", map); | 256 | config.writeEntry("current", map); |
240 | 257 | ||
241 | } | 258 | } |
242 | 259 | ||
243 | // ConfigDlg::removeMap() {{{1 | 260 | // ConfigDlg::removeMap() {{{1 |
244 | void ConfigDlg::removeMap() { | 261 | void ConfigDlg::removeMap() { |
245 | 262 | ||
246 | cout << "removing : " << custom_maps[keymaps->currentItem() - default_maps.count() - 1] << "\n"; | 263 | cout << "removing : " << custom_maps[keymaps->currentItem() - default_maps.count() - 1] << "\n"; |
247 | cout << "currentItem : " << keymaps->currentItem() << "\n"; | 264 | cout << "currentItem : " << keymaps->currentItem() << "\n"; |
248 | 265 | ||
249 | // move selection up one | 266 | // move selection up one |
250 | keymaps->setSelected(keymaps->currentItem() - 1, true); | 267 | keymaps->setSelected(keymaps->currentItem() - 1, true); |
251 | // delete the next selected item cus you just moved it up | 268 | // delete the next selected item cus you just moved it up |
252 | keymaps->removeItem(keymaps->currentItem() + 1); | 269 | keymaps->removeItem(keymaps->currentItem() + 1); |
253 | 270 | ||
254 | custom_maps.remove(custom_maps[keymaps->currentItem() - default_maps.count()]); | 271 | custom_maps.remove(custom_maps[keymaps->currentItem() - default_maps.count()]); |
255 | 272 | ||
256 | // write the changes | 273 | // write the changes |
257 | Config config ("multikey"); | 274 | Config config ("multikey"); |
258 | config.setGroup("keymaps"); | 275 | config.setGroup("keymaps"); |
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 |
263 | void 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 | |||
288 | void ConfigDlg::keyColorClicked() { | ||
264 | 289 | ||
265 | Config config ("multikey"); | 290 | Config config ("multikey"); |
266 | config.setGroup ("colors"); | 291 | config.setGroup ("colors"); |
267 | 292 | ||
268 | QStringList color = config.readListEntry("keycolor", QChar(',')); | 293 | QStringList color = config.readListEntry("keycolor", QChar(',')); |
269 | 294 | ||
270 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); | 295 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); |
271 | 296 | ||
272 | color[0].setNum(newcolor.red()); | 297 | color[0].setNum(newcolor.red()); |
273 | color[1].setNum(newcolor.green()); | 298 | color[1].setNum(newcolor.green()); |
274 | color[2].setNum(newcolor.blue()); | 299 | color[2].setNum(newcolor.blue()); |
275 | 300 | ||
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 | } | ||
307 | void 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 | } | ||
326 | void 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 | } | ||
345 | void 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 | |||
@@ -1,50 +1,56 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <qtabwidget.h> | 2 | #include <qtabwidget.h> |
3 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
4 | #include <qlistbox.h> | 4 | #include <qlistbox.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | 6 | ||
7 | #ifndef CONFIGDLG_H | 7 | #ifndef CONFIGDLG_H |
8 | #define CONFIGDLG_H | 8 | #define CONFIGDLG_H |
9 | 9 | ||
10 | class ConfigDlg : public QTabWidget | 10 | class ConfigDlg : public QTabWidget |
11 | { | 11 | { |
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | 13 | ||
14 | public: | 14 | public: |
15 | ConfigDlg (); | 15 | ConfigDlg (); |
16 | 16 | ||
17 | signals: | 17 | signals: |
18 | void pickboardToggled(bool on_off); | 18 | void pickboardToggled(bool on_off); |
19 | void repeatToggled(bool on_off); | 19 | void repeatToggled(bool on_off); |
20 | void setMapToDefault(); | 20 | void setMapToDefault(); |
21 | void setMapToFile(QString map); | 21 | void setMapToFile(QString map); |
22 | void reloadKeyboard(); | 22 | void reloadKeyboard(); |
23 | 23 | ||
24 | private slots: | 24 | private slots: |
25 | void pickTog(); | 25 | void pickTog(); |
26 | void repeatTog(); | 26 | void repeatTog(); |
27 | void setMap(int index); | 27 | void setMap(int index); |
28 | void addMap(); | 28 | void addMap(); |
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 | ||
34 | private: | 37 | private: |
35 | QCheckBox *pick_button; | 38 | QCheckBox *pick_button; |
36 | QCheckBox *repeat_button; | 39 | QCheckBox *repeat_button; |
37 | QListBox *keymaps; | 40 | QListBox *keymaps; |
38 | QPushButton *add_button; | 41 | QPushButton *add_button; |
39 | QPushButton *remove_button; | 42 | QPushButton *remove_button; |
40 | 43 | ||
41 | 44 | ||
42 | QStringList default_maps; // the maps in your share/multikey/ dir | 45 | QStringList default_maps; // the maps in your share/multikey/ dir |
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 | ||
50 | #endif | 56 | #endif |