Diffstat (limited to 'noncore/apps/opie-console/function_keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.cpp | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index 3da8d61..ce65052 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -54,16 +54,52 @@ FunctionKeyboard::~FunctionKeyboard() {} | |||
54 | 54 | ||
55 | void FunctionKeyboard::changeRows(int r) { | 55 | void FunctionKeyboard::changeRows(int r) { |
56 | 56 | ||
57 | numRows = r; | 57 | numRows = r; |
58 | repaint(false); | 58 | |
59 | // have to do this so the whole thing gets redrawn | ||
60 | hide(); show(); | ||
59 | } | 61 | } |
60 | void FunctionKeyboard::changeCols(int c) { | 62 | void FunctionKeyboard::changeCols(int c) { |
61 | 63 | ||
62 | numCols = c; | 64 | numCols = c; |
63 | keyWidth = (double)width()/numCols; // have to reset this thing too | 65 | keyWidth = (double)width()/numCols; // have to reset this thing too |
64 | repaint(false); | 66 | repaint(false); |
65 | } | 67 | } |
68 | void FunctionKeyboard::load (const Profile& prof) { | ||
69 | |||
70 | keys.clear(); | ||
71 | |||
72 | numRows = prof.readNumEntry("keb_rows", 2); | ||
73 | numCols = prof.readNumEntry("keb_cols", 10); | ||
74 | keyWidth = (double)width()/numCols; // have to reset this thing too | ||
75 | |||
76 | /* load all the keys to the keyboard */ | ||
77 | for (ushort i = 0; i <= numRows - 1; i++) | ||
78 | for (ushort j = 0; j <= numCols - 1; j++) { | ||
79 | |||
80 | QString h = "r" + QString::number(i) + "c" + QString::number(j); | ||
81 | QString values = prof.readEntry("keb_" + h); | ||
82 | |||
83 | if (!values.isEmpty()) { | ||
84 | |||
85 | QStringList l = QStringList::split(QChar('|'), values, TRUE); | ||
86 | keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt()); | ||
87 | |||
88 | // load pixmap if used | ||
89 | if (!l[1].isEmpty()) { | ||
90 | |||
91 | keys[h].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + l[1] ) ); | ||
92 | } | ||
93 | } | ||
94 | } | ||
95 | |||
96 | if (keys.isEmpty()) loadDefaults(); | ||
97 | |||
98 | hide(); | ||
99 | show(); | ||
100 | |||
101 | } | ||
66 | 102 | ||
67 | void FunctionKeyboard::paintEvent(QPaintEvent *e) { | 103 | void FunctionKeyboard::paintEvent(QPaintEvent *e) { |
68 | 104 | ||
69 | QPainter p(this); | 105 | QPainter p(this); |
@@ -272,8 +308,11 @@ FunctionKeyboardConfig::~FunctionKeyboardConfig() { | |||
272 | 308 | ||
273 | } | 309 | } |
274 | void FunctionKeyboardConfig::load (const Profile& prof) { | 310 | void FunctionKeyboardConfig::load (const Profile& prof) { |
275 | 311 | ||
312 | kb->keys.clear(); | ||
313 | kb->loadDefaults(); | ||
314 | |||
276 | m_rowBox->setValue(prof.readNumEntry("keb_rows", 2)); | 315 | m_rowBox->setValue(prof.readNumEntry("keb_rows", 2)); |
277 | m_colBox->setValue(prof.readNumEntry("keb_cols", 10)); | 316 | m_colBox->setValue(prof.readNumEntry("keb_cols", 10)); |
278 | 317 | ||
279 | /* load all the keys to the keyboard */ | 318 | /* load all the keys to the keyboard */ |
@@ -319,10 +358,8 @@ void FunctionKeyboardConfig::save (Profile& prof) { | |||
319 | void FunctionKeyboardConfig::slotChangeRows(int r) { | 358 | void FunctionKeyboardConfig::slotChangeRows(int r) { |
320 | 359 | ||
321 | kb->changeRows(r); | 360 | kb->changeRows(r); |
322 | 361 | ||
323 | // have to do this so the whole thing gets redrawn | ||
324 | kb->hide(); kb->show(); | ||
325 | } | 362 | } |
326 | void FunctionKeyboardConfig::slotChangeCols(int c) { | 363 | void FunctionKeyboardConfig::slotChangeCols(int c) { |
327 | 364 | ||
328 | kb->changeCols(c); | 365 | kb->changeCols(c); |