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 | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index 4119ad4..fd20e99 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -1,28 +1,29 @@ | |||
1 | #include "function_keyboard.h" | 1 | #include "function_keyboard.h" |
2 | #include <qsizepolicy.h> | 2 | #include <qsizepolicy.h> |
3 | #include <qevent.h> | 3 | #include <qevent.h> |
4 | #include <qwindowsystem_qws.h> | 4 | #include <qwindowsystem_qws.h> |
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | #include <qlayout.h> | ||
6 | 7 | ||
7 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | 8 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : |
8 | QFrame(parent), numRows(2), numCols(11), | 9 | QFrame(parent), numRows(2), numCols(11), |
9 | pressedRow(0), pressedCol(0) { | 10 | pressedRow(0), pressedCol(0) { |
10 | 11 | ||
11 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); | 12 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); |
12 | 13 | ||
13 | Config conf("opie-console-keys"); | 14 | Config conf("opie-console-keys"); |
14 | conf.setGroup("keys"); | 15 | conf.setGroup("keys"); |
15 | for (int r = 0; r < numRows; r++) | 16 | for (uint r = 0; r < numRows; r++) |
16 | for (int c = 0; c < numCols; c++) { | 17 | for (uint c = 0; c < numCols; c++) { |
17 | 18 | ||
18 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 19 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
19 | QStringList value_list = conf.readListEntry( handle, '|'); | 20 | QStringList value_list = conf.readListEntry( handle, '|'); |
20 | 21 | ||
21 | if (value_list.isEmpty()) continue; | 22 | if (value_list.isEmpty()) continue; |
22 | 23 | ||
23 | keys.insert( | 24 | keys.insert( |
24 | 25 | ||
25 | handle, | 26 | handle, |
26 | FKey (value_list[0], value_list[1].toUShort(), value_list[2].toUShort()) | 27 | FKey (value_list[0], value_list[1].toUShort(), value_list[2].toUShort()) |
27 | ); | 28 | ); |
28 | } | 29 | } |
@@ -50,26 +51,26 @@ void FunctionKeyboard::paintEvent(QPaintEvent *e) { | |||
50 | 51 | ||
51 | p.drawLine((int)i, 0, (int)i, height()); | 52 | p.drawLine((int)i, 0, (int)i, height()); |
52 | } | 53 | } |
53 | 54 | ||
54 | // sometimes the last line doesnt get drawn | 55 | // sometimes the last line doesnt get drawn |
55 | p.drawLine(width() -1, 0, width() -1, height()); | 56 | p.drawLine(width() -1, 0, width() -1, height()); |
56 | 57 | ||
57 | for (int i = 0; i <= height(); i += keyHeight) { | 58 | for (int i = 0; i <= height(); i += keyHeight) { |
58 | 59 | ||
59 | p.drawLine(0, i, width(), i); | 60 | p.drawLine(0, i, width(), i); |
60 | } | 61 | } |
61 | 62 | ||
62 | for (int r = 0; r < numRows; r++) { | 63 | for (uint r = 0; r < numRows; r++) { |
63 | for (int c = 0; c < numCols; c++) { | 64 | for (uint c = 0; c < numCols; c++) { |
64 | 65 | ||
65 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 66 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
66 | if (keys.contains(handle)) { | 67 | if (keys.contains(handle)) { |
67 | 68 | ||
68 | p.drawText( | 69 | p.drawText( |
69 | c * keyWidth + 1, r * keyHeight + 1, | 70 | c * keyWidth + 1, r * keyHeight + 1, |
70 | keyWidth, keyHeight, | 71 | keyWidth, keyHeight, |
71 | Qt::AlignHCenter | Qt::AlignVCenter, | 72 | Qt::AlignHCenter | Qt::AlignVCenter, |
72 | keys[handle].getL() | 73 | keys[handle].getL() |
73 | ); | 74 | ); |
74 | } | 75 | } |
75 | } | 76 | } |
@@ -146,12 +147,36 @@ void FunctionKeyboard::loadDefaults() { | |||
146 | keys.insert( "r0c6", FKey ("F7", 4149, 0)); | 147 | keys.insert( "r0c6", FKey ("F7", 4149, 0)); |
147 | keys.insert( "r0c7", FKey ("F8", 4150, 0)); | 148 | keys.insert( "r0c7", FKey ("F8", 4150, 0)); |
148 | keys.insert( "r0c8", FKey ("F9", 4151, 0)); | 149 | keys.insert( "r0c8", FKey ("F9", 4151, 0)); |
149 | keys.insert( "r0c9", FKey ("F10", 4152, 0)); | 150 | keys.insert( "r0c9", FKey ("F10", 4152, 0)); |
150 | keys.insert( "r0c10", FKey ("F11", 4153, 0)); | 151 | keys.insert( "r0c10", FKey ("F11", 4153, 0)); |
151 | 152 | ||
152 | keys.insert( "r1c7", FKey ("Ho", 4112, 0)); | 153 | keys.insert( "r1c7", FKey ("Ho", 4112, 0)); |
153 | keys.insert( "r1c8", FKey ("End", 4113, 0)); | 154 | keys.insert( "r1c8", FKey ("End", 4113, 0)); |
154 | keys.insert( "r1c9", FKey ("PU", 4118, 0)); | 155 | keys.insert( "r1c9", FKey ("PU", 4118, 0)); |
155 | keys.insert( "r1c10", FKey ("PD", 4119, 0)); | 156 | keys.insert( "r1c10", FKey ("PD", 4119, 0)); |
156 | 157 | ||
157 | } | 158 | } |
159 | |||
160 | |||
161 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) : | ||
162 | ProfileDialogKeyWidget(name, parent) { | ||
163 | |||
164 | |||
165 | FunctionKeyboard *kb = new FunctionKeyboard(this); | ||
166 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); | ||
167 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit"), this); | ||
168 | |||
169 | QVBoxLayout *root = new QVBoxLayout(this, 2); | ||
170 | root->addWidget(kb); | ||
171 | root->addWidget(dimentions); | ||
172 | root->addWidget(editKey); | ||
173 | } | ||
174 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { | ||
175 | |||
176 | } | ||
177 | void FunctionKeyboardConfig::load (const Profile& prof) { | ||
178 | |||
179 | } | ||
180 | void FunctionKeyboardConfig::save (Profile& prof) { | ||
181 | |||
182 | } | ||