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 | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index eb32551..6613183 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -1,64 +1,69 @@ | |||
1 | #include "function_keyboard.h" | 1 | #include "function_keyboard.h" |
2 | 2 | ||
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | using namespace Opie::Core; | ||
6 | |||
7 | /* QT */ | ||
3 | #include <qlayout.h> | 8 | #include <qlayout.h> |
4 | #include <qlistbox.h> | 9 | #include <qlistbox.h> |
5 | #include <qlabel.h> | 10 | #include <qlabel.h> |
6 | #include <qdir.h> | 11 | #include <qdir.h> |
7 | 12 | ||
8 | #define DEFAULT_ROWS 2 | 13 | #define DEFAULT_ROWS 2 |
9 | #define DEFAULT_COLS 12 | 14 | #define DEFAULT_COLS 12 |
10 | 15 | ||
11 | /* FunctionKeyboard {{{1 */ | 16 | /* FunctionKeyboard {{{1 */ |
12 | 17 | ||
13 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | 18 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : |
14 | QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS), | 19 | QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS), |
15 | pressedRow(0), pressedCol(0) { | 20 | pressedRow(0), pressedCol(0) { |
16 | 21 | ||
17 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); | 22 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); |
18 | 23 | ||
19 | /* | 24 | /* |
20 | * all the saving/loading is now done in a profile. downside is that you cant modify | 25 | * all the saving/loading is now done in a profile. downside is that you cant modify |
21 | * the keyboard for all profiles, but must do it on a profile-basis | 26 | * the keyboard for all profiles, but must do it on a profile-basis |
22 | * | 27 | * |
23 | 28 | ||
24 | Config conf("opie-console-keys"); | 29 | Config conf("opie-console-keys"); |
25 | conf.setGroup("keys"); | 30 | conf.setGroup("keys"); |
26 | for (uint r = 0; r < numRows; r++) | 31 | for (uint r = 0; r < numRows; r++) |
27 | for (uint c = 0; c < numCols; c++) { | 32 | for (uint c = 0; c < numCols; c++) { |
28 | 33 | ||
29 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 34 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
30 | QStringList value_list = conf.readListEntry( handle, '|'); | 35 | QStringList value_list = conf.readListEntry( handle, '|'); |
31 | 36 | ||
32 | if (value_list.isEmpty()) continue; | 37 | if (value_list.isEmpty()) continue; |
33 | 38 | ||
34 | keys.insert( | 39 | keys.insert( |
35 | 40 | ||
36 | handle, | 41 | handle, |
37 | FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) | 42 | FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) |
38 | ); | 43 | ); |
39 | } | 44 | } |
40 | //qWarning("loaded %d keys", keys.count()); | 45 | //owarn << "loaded " << keys.count() << " keys" << oendl; |
41 | */ | 46 | */ |
42 | if (keys.isEmpty()) loadDefaults(); | 47 | if (keys.isEmpty()) loadDefaults(); |
43 | 48 | ||
44 | 49 | ||
45 | 50 | ||
46 | } | 51 | } |
47 | 52 | ||
48 | FunctionKeyboard::~FunctionKeyboard() {} | 53 | FunctionKeyboard::~FunctionKeyboard() {} |
49 | 54 | ||
50 | void FunctionKeyboard::changeRows(int r) { | 55 | void FunctionKeyboard::changeRows(int r) { |
51 | 56 | ||
52 | numRows = r; | 57 | numRows = r; |
53 | 58 | ||
54 | // have to do this so the whole thing gets redrawn | 59 | // have to do this so the whole thing gets redrawn |
55 | hide(); show(); | 60 | hide(); show(); |
56 | } | 61 | } |
57 | void FunctionKeyboard::changeCols(int c) { | 62 | void FunctionKeyboard::changeCols(int c) { |
58 | 63 | ||
59 | numCols = c; | 64 | numCols = c; |
60 | keyWidth = (double)width()/numCols; // have to reset this thing too | 65 | keyWidth = (double)width()/numCols; // have to reset this thing too |
61 | repaint(false); | 66 | repaint(false); |
62 | } | 67 | } |
63 | void FunctionKeyboard::load (const Profile& prof) { | 68 | void FunctionKeyboard::load (const Profile& prof) { |
64 | 69 | ||
@@ -235,49 +240,49 @@ void FunctionKeyboard::loadDefaults() { | |||
235 | keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff)); | 240 | keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff)); |
236 | 241 | ||
237 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); | 242 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); |
238 | keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); | 243 | keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); |
239 | keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); | 244 | keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); |
240 | keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); | 245 | keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); |
241 | keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); | 246 | keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); |
242 | keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); | 247 | keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); |
243 | keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); | 248 | keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); |
244 | keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); | 249 | keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); |
245 | keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); | 250 | keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); |
246 | keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); | 251 | keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); |
247 | keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); | 252 | keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); |
248 | keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); | 253 | keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); |
249 | 254 | ||
250 | 255 | ||
251 | } | 256 | } |
252 | 257 | ||
253 | /* FunctionKeyboardConfig {{{1 */ | 258 | /* FunctionKeyboardConfig {{{1 */ |
254 | 259 | ||
255 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) | 260 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) |
256 | : ProfileDialogKeyWidget(name, parent, na), | 261 | : ProfileDialogKeyWidget(name, parent, na), |
257 | selectedRow(0), selectedCol(0) | 262 | selectedRow(0), selectedCol(0) |
258 | { | 263 | { |
259 | qWarning("FunctionKeyboardConfig"); | 264 | owarn << "FunctionKeyboardConfig" << oendl; |
260 | 265 | ||
261 | 266 | ||
262 | kb = new FunctionKeyboard(this); | 267 | kb = new FunctionKeyboard(this); |
263 | connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), | 268 | connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), |
264 | this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool))); | 269 | this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool))); |
265 | 270 | ||
266 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this); | 271 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this); |
267 | QLabel *l = new QLabel("Rows", dimentions); | 272 | QLabel *l = new QLabel("Rows", dimentions); |
268 | m_rowBox = new QSpinBox(1, 15, 1, dimentions); | 273 | m_rowBox = new QSpinBox(1, 15, 1, dimentions); |
269 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); | 274 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); |
270 | l = new QLabel("Columns", dimentions); | 275 | l = new QLabel("Columns", dimentions); |
271 | m_colBox = new QSpinBox(1, 15, 1, dimentions); | 276 | m_colBox = new QSpinBox(1, 15, 1, dimentions); |
272 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); | 277 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); |
273 | 278 | ||
274 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); | 279 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); |
275 | l = new QLabel("Label", editKey); | 280 | l = new QLabel("Label", editKey); |
276 | m_labels = new QComboBox(true, editKey); | 281 | m_labels = new QComboBox(true, editKey); |
277 | m_labels->setInsertionPolicy(QComboBox::AtCurrent); | 282 | m_labels->setInsertionPolicy(QComboBox::AtCurrent); |
278 | m_labels->insertItem(""); | 283 | m_labels->insertItem(""); |
279 | 284 | ||
280 | QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); | 285 | QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); |
281 | 286 | ||
282 | for (uint i = 0; i < files.count(); i++) { | 287 | for (uint i = 0; i < files.count(); i++) { |
283 | 288 | ||