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 | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index fd20e99..100fdfc 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -1,15 +1,15 @@ | |||
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 | #include <qlayout.h> |
7 | 7 | ||
8 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | 8 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : |
9 | QFrame(parent), numRows(2), numCols(11), | 9 | QFrame(parent), numRows(2), numCols(11), |
10 | pressedRow(0), pressedCol(0) { | 10 | pressedRow(0), pressedCol(0) { |
11 | 11 | ||
12 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); | 12 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); |
13 | 13 | ||
14 | Config conf("opie-console-keys"); | 14 | Config conf("opie-console-keys"); |
15 | conf.setGroup("keys"); | 15 | conf.setGroup("keys"); |
@@ -20,13 +20,13 @@ FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | |||
20 | QStringList value_list = conf.readListEntry( handle, '|'); | 20 | QStringList value_list = conf.readListEntry( handle, '|'); |
21 | 21 | ||
22 | if (value_list.isEmpty()) continue; | 22 | if (value_list.isEmpty()) continue; |
23 | 23 | ||
24 | keys.insert( | 24 | keys.insert( |
25 | 25 | ||
26 | handle, | 26 | handle, |
27 | 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()) |
28 | ); | 28 | ); |
29 | } | 29 | } |
30 | //qWarning("loaded %d keys", keys.count()); | 30 | //qWarning("loaded %d keys", keys.count()); |
31 | if (keys.isEmpty()) loadDefaults(); | 31 | if (keys.isEmpty()) loadDefaults(); |
32 | 32 | ||
@@ -64,33 +64,33 @@ void FunctionKeyboard::paintEvent(QPaintEvent *e) { | |||
64 | for (uint c = 0; c < numCols; c++) { | 64 | for (uint c = 0; c < numCols; c++) { |
65 | 65 | ||
66 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 66 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
67 | if (keys.contains(handle)) { | 67 | if (keys.contains(handle)) { |
68 | 68 | ||
69 | p.drawText( | 69 | p.drawText( |
70 | c * keyWidth + 1, r * keyHeight + 1, | 70 | c * keyWidth + 1, r * keyHeight + 1, |
71 | keyWidth, keyHeight, | 71 | keyWidth, keyHeight, |
72 | Qt::AlignHCenter | Qt::AlignVCenter, | 72 | Qt::AlignHCenter | Qt::AlignVCenter, |
73 | keys[handle].getL() | 73 | keys[handle].getL() |
74 | ); | 74 | ); |
75 | } | 75 | } |
76 | } | 76 | } |
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | void FunctionKeyboard::paintKey(int row, int col) { | 80 | void FunctionKeyboard::paintKey(int row, int col) { |
81 | 81 | ||
82 | QPainter p(this); | 82 | QPainter p(this); |
83 | 83 | ||
84 | p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), | 84 | p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), |
85 | QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), | 85 | QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), |
86 | (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); | 86 | (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); |
87 | p.drawText( | 87 | p.drawText( |
88 | col * keyWidth + 1, row * keyHeight + 1, | 88 | col * keyWidth + 1, row * keyHeight + 1, |
89 | keyWidth, keyHeight, | 89 | keyWidth, keyHeight, |
90 | Qt::AlignHCenter | Qt::AlignVCenter, | 90 | Qt::AlignHCenter | Qt::AlignVCenter, |
91 | keys["r" + QString::number(row) + "c" + QString::number(col)].getL() | 91 | keys["r" + QString::number(row) + "c" + QString::number(col)].getL() |
92 | ); | 92 | ); |
93 | 93 | ||
94 | } | 94 | } |
95 | 95 | ||
96 | void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { | 96 | void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { |
@@ -135,33 +135,33 @@ QSize FunctionKeyboard::sizeHint() const { | |||
135 | return QSize(width(), keyHeight * numRows + 1); | 135 | return QSize(width(), keyHeight * numRows + 1); |
136 | } | 136 | } |
137 | 137 | ||
138 | void FunctionKeyboard::loadDefaults() { | 138 | void FunctionKeyboard::loadDefaults() { |
139 | 139 | ||
140 | /* what keys should be default? */ | 140 | /* what keys should be default? */ |
141 | keys.insert( "r0c0", FKey ("F1", 4144, 0)); | 141 | keys.insert( "r0c0", FKey ("F1", 4144, 0)); |
142 | keys.insert( "r0c1", FKey ("F2", 4145, 0)); | 142 | keys.insert( "r0c1", FKey ("F2", 4145, 0)); |
143 | keys.insert( "r0c2", FKey ("F3", 4145, 0)); | 143 | keys.insert( "r0c2", FKey ("F3", 4145, 0)); |
144 | keys.insert( "r0c3", FKey ("F4", 4146, 0)); | 144 | keys.insert( "r0c3", FKey ("F4", 4146, 0)); |
145 | keys.insert( "r0c4", FKey ("F5", 4147, 0)); | 145 | keys.insert( "r0c4", FKey ("F5", 4147, 0)); |
146 | keys.insert( "r0c5", FKey ("F6", 4148, 0)); | 146 | keys.insert( "r0c5", FKey ("F6", 4148, 0)); |
147 | keys.insert( "r0c6", FKey ("F7", 4149, 0)); | 147 | keys.insert( "r0c6", FKey ("F7", 4149, 0)); |
148 | keys.insert( "r0c7", FKey ("F8", 4150, 0)); | 148 | keys.insert( "r0c7", FKey ("F8", 4150, 0)); |
149 | keys.insert( "r0c8", FKey ("F9", 4151, 0)); | 149 | keys.insert( "r0c8", FKey ("F9", 4151, 0)); |
150 | keys.insert( "r0c9", FKey ("F10", 4152, 0)); | 150 | keys.insert( "r0c9", FKey ("F10", 4152, 0)); |
151 | keys.insert( "r0c10", FKey ("F11", 4153, 0)); | 151 | keys.insert( "r0c10", FKey ("F11", 4153, 0)); |
152 | 152 | ||
153 | keys.insert( "r1c7", FKey ("Ho", 4112, 0)); | 153 | keys.insert( "r1c7", FKey ("Ho", 4112, 0)); |
154 | keys.insert( "r1c8", FKey ("End", 4113, 0)); | 154 | keys.insert( "r1c8", FKey ("End", 4113, 0)); |
155 | keys.insert( "r1c9", FKey ("PU", 4118, 0)); | 155 | keys.insert( "r1c9", FKey ("PU", 4118, 0)); |
156 | keys.insert( "r1c10", FKey ("PD", 4119, 0)); | 156 | keys.insert( "r1c10", FKey ("PD", 4119, 0)); |
157 | 157 | ||
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) : | 161 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) : |
162 | ProfileDialogKeyWidget(name, parent) { | 162 | ProfileDialogKeyWidget(name, parent) { |
163 | 163 | ||
164 | 164 | ||
165 | FunctionKeyboard *kb = new FunctionKeyboard(this); | 165 | FunctionKeyboard *kb = new FunctionKeyboard(this); |
166 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); | 166 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); |
167 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit"), this); | 167 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit"), this); |
@@ -171,12 +171,12 @@ FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* par | |||
171 | root->addWidget(dimentions); | 171 | root->addWidget(dimentions); |
172 | root->addWidget(editKey); | 172 | root->addWidget(editKey); |
173 | } | 173 | } |
174 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { | 174 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { |
175 | 175 | ||
176 | } | 176 | } |
177 | void FunctionKeyboardConfig::load (const Profile& prof) { | 177 | void FunctionKeyboardConfig::load (const Profile& ) { |
178 | 178 | ||
179 | } | 179 | } |
180 | void FunctionKeyboardConfig::save (Profile& prof) { | 180 | void FunctionKeyboardConfig::save (Profile& ) { |
181 | 181 | ||
182 | } | 182 | } |