-rw-r--r-- | noncore/apps/opie-console/function_keyboard.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index 5f3b5ec..e7f3c21 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -1,49 +1,49 @@ | |||
1 | #include "function_keyboard.h" | 1 | #include "function_keyboard.h" |
2 | 2 | ||
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qsizepolicy.h> | 5 | #include <qsizepolicy.h> |
6 | #include <qevent.h> | 6 | #include <qevent.h> |
7 | #include <qwindowsystem_qws.h> | 7 | #include <qwindowsystem_qws.h> |
8 | #include <qapplication.h> | 8 | #include <qapplication.h> |
9 | #include <qlayout.h> | 9 | #include <qlayout.h> |
10 | #include <qspinbox.h> | 10 | #include <qspinbox.h> |
11 | #include <qlistbox.h> | 11 | #include <qlistbox.h> |
12 | #include <qlabel.h> | 12 | #include <qlabel.h> |
13 | #include <qcombobox.h> | 13 | #include <qcombobox.h> |
14 | #include <qdir.h> | 14 | #include <qdir.h> |
15 | 15 | ||
16 | #define DEFAULT_ROWS 2 | 16 | #define DEFAULT_ROWS 2 |
17 | #define DEFAULT_COLS 11 | 17 | #define DEFAULT_COLS 12 |
18 | 18 | ||
19 | /* FunctionKeyboard {{{1 */ | 19 | /* FunctionKeyboard {{{1 */ |
20 | 20 | ||
21 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | 21 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : |
22 | QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS), | 22 | QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS), |
23 | pressedRow(0), pressedCol(0) { | 23 | pressedRow(0), pressedCol(0) { |
24 | 24 | ||
25 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); | 25 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * all the saving/loading is now done in a profile. downside is that you cant modify | 28 | * all the saving/loading is now done in a profile. downside is that you cant modify |
29 | * the keyboard for all profiles, but must do it on a profile-basis | 29 | * the keyboard for all profiles, but must do it on a profile-basis |
30 | * | 30 | * |
31 | 31 | ||
32 | Config conf("opie-console-keys"); | 32 | Config conf("opie-console-keys"); |
33 | conf.setGroup("keys"); | 33 | conf.setGroup("keys"); |
34 | for (uint r = 0; r < numRows; r++) | 34 | for (uint r = 0; r < numRows; r++) |
35 | for (uint c = 0; c < numCols; c++) { | 35 | for (uint c = 0; c < numCols; c++) { |
36 | 36 | ||
37 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 37 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
38 | QStringList value_list = conf.readListEntry( handle, '|'); | 38 | QStringList value_list = conf.readListEntry( handle, '|'); |
39 | 39 | ||
40 | if (value_list.isEmpty()) continue; | 40 | if (value_list.isEmpty()) continue; |
41 | 41 | ||
42 | keys.insert( | 42 | keys.insert( |
43 | 43 | ||
44 | handle, | 44 | handle, |
45 | FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) | 45 | FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) |
46 | ); | 46 | ); |
47 | } | 47 | } |
48 | //qWarning("loaded %d keys", keys.count()); | 48 | //qWarning("loaded %d keys", keys.count()); |
49 | */ | 49 | */ |
@@ -211,76 +211,78 @@ void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { | |||
211 | 211 | ||
212 | 212 | ||
213 | void FunctionKeyboard::resizeEvent(QResizeEvent*) { | 213 | void FunctionKeyboard::resizeEvent(QResizeEvent*) { |
214 | 214 | ||
215 | /* set he default font height/width */ | 215 | /* set he default font height/width */ |
216 | QFontMetrics fm=fontMetrics(); | 216 | QFontMetrics fm=fontMetrics(); |
217 | keyHeight = fm.lineSpacing() + 2; | 217 | keyHeight = fm.lineSpacing() + 2; |
218 | keyWidth = (double)width()/numCols; | 218 | keyWidth = (double)width()/numCols; |
219 | 219 | ||
220 | } | 220 | } |
221 | 221 | ||
222 | QSize FunctionKeyboard::sizeHint() const { | 222 | QSize FunctionKeyboard::sizeHint() const { |
223 | 223 | ||
224 | return QSize(width(), keyHeight * numRows + 1); | 224 | return QSize(width(), keyHeight * numRows + 1); |
225 | } | 225 | } |
226 | 226 | ||
227 | void FunctionKeyboard::loadDefaults() { | 227 | void FunctionKeyboard::loadDefaults() { |
228 | 228 | ||
229 | numRows = DEFAULT_ROWS; | 229 | numRows = DEFAULT_ROWS; |
230 | numCols = DEFAULT_COLS; | 230 | numCols = DEFAULT_COLS; |
231 | keyWidth = (double)width()/numCols; // have to reset this thing too | 231 | keyWidth = (double)width()/numCols; // have to reset this thing too |
232 | 232 | ||
233 | keys.insert( "r0c0", FKey ("Enter", "enter", Qt::Key_Enter, 0)); | 233 | keys.insert( "r0c0", FKey ("Enter", "enter", Qt::Key_Enter, 0)); |
234 | keys.insert( "r0c1", FKey ("Space", "space", Qt::Key_Space, Qt::Key_Space)); | 234 | keys.insert( "r0c1", FKey ("Space", "space", Qt::Key_Space, Qt::Key_Space)); |
235 | keys.insert( "r0c2", FKey ("Tab", "tab", Qt::Key_Tab, 0)); | 235 | keys.insert( "r0c2", FKey ("Tab", "tab", Qt::Key_Tab, 0)); |
236 | keys.insert( "r0c3", FKey ("Up", "up", Qt::Key_Up, 0)); | 236 | keys.insert( "r0c3", FKey ("Up", "up", Qt::Key_Up, 0)); |
237 | keys.insert( "r0c4", FKey ("Down", "down", Qt::Key_Down, 0)); | 237 | keys.insert( "r0c4", FKey ("Down", "down", Qt::Key_Down, 0)); |
238 | 238 | ||
239 | keys.insert( "r0c7", FKey ("Ho", 0, 4112, 0)); | 239 | keys.insert( "r0c7", FKey ("Ho", 0, 4112, 0)); |
240 | keys.insert( "r0c8", FKey ("End", 0, 4113, 0)); | 240 | keys.insert( "r0c8", FKey ("End", 0, 4113, 0)); |
241 | keys.insert( "r0c9", FKey ("PU", 0, 4118, 0)); | 241 | keys.insert( "r0c9", FKey ("PU", 0, 4118, 0)); |
242 | keys.insert( "r0c10", FKey ("PD", 0, 4119, 0)); | 242 | keys.insert( "r0c10", FKey ("PD", 0, 4119, 0)); |
243 | keys.insert( "r0c11", FKey ("esc", 0, Qt::Key_Escape, 0xfff)); | ||
243 | 244 | ||
244 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); | 245 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); |
245 | keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); | 246 | keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); |
246 | keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); | 247 | keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); |
247 | keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); | 248 | keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); |
248 | keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); | 249 | keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); |
249 | keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); | 250 | keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); |
250 | keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); | 251 | keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); |
251 | keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); | 252 | keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); |
252 | keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); | 253 | keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); |
253 | keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); | 254 | keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); |
254 | keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); | 255 | keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); |
256 | keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); | ||
255 | 257 | ||
256 | 258 | ||
257 | } | 259 | } |
258 | 260 | ||
259 | /* FunctionKeyboardConfig {{{1 */ | 261 | /* FunctionKeyboardConfig {{{1 */ |
260 | 262 | ||
261 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) | 263 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) |
262 | : ProfileDialogKeyWidget(name, parent, na), | 264 | : ProfileDialogKeyWidget(name, parent, na), |
263 | selectedRow(0), selectedCol(0) | 265 | selectedRow(0), selectedCol(0) |
264 | { | 266 | { |
265 | qWarning("FunctionKeyboardConfig"); | 267 | qWarning("FunctionKeyboardConfig"); |
266 | 268 | ||
267 | 269 | ||
268 | kb = new FunctionKeyboard(this); | 270 | kb = new FunctionKeyboard(this); |
269 | connect (kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 271 | connect (kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), |
270 | this, SLOT(slotKeyPressed(FKey, ushort, ushort, bool))); | 272 | this, SLOT(slotKeyPressed(FKey, ushort, ushort, bool))); |
271 | 273 | ||
272 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); | 274 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); |
273 | QLabel *l = new QLabel("Rows", dimentions); | 275 | QLabel *l = new QLabel("Rows", dimentions); |
274 | m_rowBox = new QSpinBox(1, 15, 1, dimentions); | 276 | m_rowBox = new QSpinBox(1, 15, 1, dimentions); |
275 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); | 277 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); |
276 | l = new QLabel("Columns", dimentions); | 278 | l = new QLabel("Columns", dimentions); |
277 | m_colBox = new QSpinBox(1, 15, 1, dimentions); | 279 | m_colBox = new QSpinBox(1, 15, 1, dimentions); |
278 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); | 280 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); |
279 | 281 | ||
280 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); | 282 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); |
281 | l = new QLabel("Label", editKey); | 283 | l = new QLabel("Label", editKey); |
282 | m_labels = new QComboBox(true, editKey); | 284 | m_labels = new QComboBox(true, editKey); |
283 | m_labels->setInsertionPolicy(QComboBox::AtCurrent); | 285 | m_labels->setInsertionPolicy(QComboBox::AtCurrent); |
284 | m_labels->insertItem(""); | 286 | m_labels->insertItem(""); |
285 | 287 | ||
286 | QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); | 288 | QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); |