author | hash <hash> | 2002-10-31 18:23:49 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-31 18:23:49 (UTC) |
commit | 1793c4b5f743c31be9db1fbb0b3fbbe08df7df28 (patch) (unidiff) | |
tree | b6b6b1ea8c06eee27dec73213b05d236d098ebe9 | |
parent | 1004c5930b3dfdb37e4d8ea2e143b4a3d0246f7a (diff) | |
download | opie-1793c4b5f743c31be9db1fbb0b3fbbe08df7df28.zip opie-1793c4b5f743c31be9db1fbb0b3fbbe08df7df28.tar.gz opie-1793c4b5f743c31be9db1fbb0b3fbbe08df7df28.tar.bz2 |
changed label esc to Esc
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index e7f3c21..9e456df 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -145,195 +145,195 @@ void FunctionKeyboard::paintEvent(QPaintEvent *e) { | |||
145 | } | 145 | } |
146 | } | 146 | } |
147 | } | 147 | } |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | void FunctionKeyboard::paintKey(uint row, uint col) { | 151 | void FunctionKeyboard::paintKey(uint row, uint col) { |
152 | 152 | ||
153 | QPainter p(this); | 153 | QPainter p(this); |
154 | 154 | ||
155 | p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), | 155 | p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), |
156 | QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), | 156 | QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), |
157 | (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); | 157 | (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); |
158 | 158 | ||
159 | QString handle ("r" + QString::number(row) + "c" + QString::number(col)); | 159 | QString handle ("r" + QString::number(row) + "c" + QString::number(col)); |
160 | if (keys[handle].pixFile.isEmpty()) | 160 | if (keys[handle].pixFile.isEmpty()) |
161 | p.drawText( | 161 | p.drawText( |
162 | col * keyWidth + 1, row * keyHeight + 1, | 162 | col * keyWidth + 1, row * keyHeight + 1, |
163 | keyWidth, keyHeight, | 163 | keyWidth, keyHeight, |
164 | Qt::AlignHCenter | Qt::AlignVCenter, | 164 | Qt::AlignHCenter | Qt::AlignVCenter, |
165 | keys[handle].label | 165 | keys[handle].label |
166 | ); | 166 | ); |
167 | else { | 167 | else { |
168 | 168 | ||
169 | ushort centerX = (ushort)(col *keyWidth) + (ushort)(keyWidth - keys[handle].pix->width()) / 2; | 169 | ushort centerX = (ushort)(col *keyWidth) + (ushort)(keyWidth - keys[handle].pix->width()) / 2; |
170 | ushort centerY = row * keyHeight + (keyHeight - keys[handle].pix->height()) / 2; | 170 | ushort centerY = row * keyHeight + (keyHeight - keys[handle].pix->height()) / 2; |
171 | p.drawPixmap(centerX, centerY, *keys[handle].pix); | 171 | p.drawPixmap(centerX, centerY, *keys[handle].pix); |
172 | } | 172 | } |
173 | 173 | ||
174 | if (col == numCols - 1) { | 174 | if (col == numCols - 1) { |
175 | 175 | ||
176 | // sometimes it doesnt draw the last line | 176 | // sometimes it doesnt draw the last line |
177 | 177 | ||
178 | p.drawLine((col+1) * keyWidth -1, row * keyHeight, | 178 | p.drawLine((col+1) * keyWidth -1, row * keyHeight, |
179 | (col+1) * keyWidth -1, (row + 1) * keyHeight | 179 | (col+1) * keyWidth -1, (row + 1) * keyHeight |
180 | ); | 180 | ); |
181 | } | 181 | } |
182 | 182 | ||
183 | } | 183 | } |
184 | 184 | ||
185 | void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { | 185 | void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { |
186 | 186 | ||
187 | pressedRow = e->y() / keyHeight; | 187 | pressedRow = e->y() / keyHeight; |
188 | pressedCol = (int) (e->x() / keyWidth); | 188 | pressedCol = (int) (e->x() / keyWidth); |
189 | 189 | ||
190 | paintKey(pressedRow, pressedCol); | 190 | paintKey(pressedRow, pressedCol); |
191 | 191 | ||
192 | // emit that sucker! | 192 | // emit that sucker! |
193 | FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; | 193 | FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; |
194 | emit keyPressed(k, pressedRow, pressedCol, 1); | 194 | emit keyPressed(k, pressedRow, pressedCol, 1); |
195 | 195 | ||
196 | } | 196 | } |
197 | 197 | ||
198 | void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { | 198 | void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { |
199 | 199 | ||
200 | if (pressedRow != -1 && pressedRow != -1) { | 200 | if (pressedRow != -1 && pressedRow != -1) { |
201 | 201 | ||
202 | int row = pressedRow; pressedRow = -1; | 202 | int row = pressedRow; pressedRow = -1; |
203 | int col = pressedCol; pressedCol = -1; | 203 | int col = pressedCol; pressedCol = -1; |
204 | paintKey(row, col); | 204 | paintKey(row, col); |
205 | 205 | ||
206 | FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)]; | 206 | FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)]; |
207 | emit keyPressed(k, row, col, 0); | 207 | emit keyPressed(k, row, col, 0); |
208 | } | 208 | } |
209 | 209 | ||
210 | } | 210 | } |
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 | keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff)); |
244 | 244 | ||
245 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); | 245 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); |
246 | keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); | 246 | keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); |
247 | keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); | 247 | keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); |
248 | keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); | 248 | keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); |
249 | keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); | 249 | keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); |
250 | keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); | 250 | keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); |
251 | keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); | 251 | keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); |
252 | keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); | 252 | keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); |
253 | keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); | 253 | keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); |
254 | keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); | 254 | keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); |
255 | 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)); | 256 | keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); |
257 | 257 | ||
258 | 258 | ||
259 | } | 259 | } |
260 | 260 | ||
261 | /* FunctionKeyboardConfig {{{1 */ | 261 | /* FunctionKeyboardConfig {{{1 */ |
262 | 262 | ||
263 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) | 263 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) |
264 | : ProfileDialogKeyWidget(name, parent, na), | 264 | : ProfileDialogKeyWidget(name, parent, na), |
265 | selectedRow(0), selectedCol(0) | 265 | selectedRow(0), selectedCol(0) |
266 | { | 266 | { |
267 | qWarning("FunctionKeyboardConfig"); | 267 | qWarning("FunctionKeyboardConfig"); |
268 | 268 | ||
269 | 269 | ||
270 | kb = new FunctionKeyboard(this); | 270 | kb = new FunctionKeyboard(this); |
271 | connect (kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 271 | connect (kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), |
272 | this, SLOT(slotKeyPressed(FKey, ushort, ushort, bool))); | 272 | this, SLOT(slotKeyPressed(FKey, ushort, ushort, bool))); |
273 | 273 | ||
274 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); | 274 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); |
275 | QLabel *l = new QLabel("Rows", dimentions); | 275 | QLabel *l = new QLabel("Rows", dimentions); |
276 | m_rowBox = new QSpinBox(1, 15, 1, dimentions); | 276 | m_rowBox = new QSpinBox(1, 15, 1, dimentions); |
277 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); | 277 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); |
278 | l = new QLabel("Columns", dimentions); | 278 | l = new QLabel("Columns", dimentions); |
279 | m_colBox = new QSpinBox(1, 15, 1, dimentions); | 279 | m_colBox = new QSpinBox(1, 15, 1, dimentions); |
280 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); | 280 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); |
281 | 281 | ||
282 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); | 282 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); |
283 | l = new QLabel("Label", editKey); | 283 | l = new QLabel("Label", editKey); |
284 | m_labels = new QComboBox(true, editKey); | 284 | m_labels = new QComboBox(true, editKey); |
285 | m_labels->setInsertionPolicy(QComboBox::AtCurrent); | 285 | m_labels->setInsertionPolicy(QComboBox::AtCurrent); |
286 | m_labels->insertItem(""); | 286 | m_labels->insertItem(""); |
287 | 287 | ||
288 | QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); | 288 | QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); |
289 | 289 | ||
290 | for (uint i = 0; i < files.count(); i++) { | 290 | for (uint i = 0; i < files.count(); i++) { |
291 | 291 | ||
292 | m_labels->insertItem( Resource::loadPixmap("console/keys/" + files[i]), files[i]); | 292 | m_labels->insertItem( Resource::loadPixmap("console/keys/" + files[i]), files[i]); |
293 | } | 293 | } |
294 | connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int))); | 294 | connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int))); |
295 | connect (m_labels, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeLabelText(const QString&))); | 295 | connect (m_labels, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeLabelText(const QString&))); |
296 | 296 | ||
297 | l = new QLabel("Q Keycode", editKey); | 297 | l = new QLabel("Q Keycode", editKey); |
298 | m_qvalues = new QComboBox(true, editKey); | 298 | m_qvalues = new QComboBox(true, editKey); |
299 | m_qvalues->setInsertionPolicy(QComboBox::AtTop); | 299 | m_qvalues->setInsertionPolicy(QComboBox::AtTop); |
300 | m_qvalues->setDuplicatesEnabled(false); | 300 | m_qvalues->setDuplicatesEnabled(false); |
301 | m_qvalues->insertItem(""); | 301 | m_qvalues->insertItem(""); |
302 | connect (m_qvalues, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeQCode(const QString&))); | 302 | connect (m_qvalues, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeQCode(const QString&))); |
303 | 303 | ||
304 | l = new QLabel("Unicode Value", editKey); | 304 | l = new QLabel("Unicode Value", editKey); |
305 | m_uniValues = new QComboBox(true, editKey); | 305 | m_uniValues = new QComboBox(true, editKey); |
306 | m_uniValues->setInsertionPolicy(QComboBox::AtTop); | 306 | m_uniValues->setInsertionPolicy(QComboBox::AtTop); |
307 | m_uniValues->setDuplicatesEnabled(false); | 307 | m_uniValues->setDuplicatesEnabled(false); |
308 | m_uniValues->insertItem(""); | 308 | m_uniValues->insertItem(""); |
309 | connect (m_uniValues, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeUnicode(const QString&))); | 309 | connect (m_uniValues, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeUnicode(const QString&))); |
310 | 310 | ||
311 | QVBoxLayout *root = new QVBoxLayout(this, 2); | 311 | QVBoxLayout *root = new QVBoxLayout(this, 2); |
312 | root->addWidget(kb); | 312 | root->addWidget(kb); |
313 | root->addWidget(dimentions); | 313 | root->addWidget(dimentions); |
314 | root->addWidget(editKey); | 314 | root->addWidget(editKey); |
315 | } | 315 | } |
316 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { | 316 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { |
317 | 317 | ||
318 | } | 318 | } |
319 | void FunctionKeyboardConfig::load (const Profile& prof) { | 319 | void FunctionKeyboardConfig::load (const Profile& prof) { |
320 | 320 | ||
321 | kb->keys.clear(); | 321 | kb->keys.clear(); |
322 | kb->loadDefaults(); | 322 | kb->loadDefaults(); |
323 | 323 | ||
324 | m_rowBox->setValue(prof.readNumEntry("keb_rows", 2)); | 324 | m_rowBox->setValue(prof.readNumEntry("keb_rows", 2)); |
325 | m_colBox->setValue(prof.readNumEntry("keb_cols", 10)); | 325 | m_colBox->setValue(prof.readNumEntry("keb_cols", 10)); |
326 | 326 | ||
327 | /* load all the keys to the keyboard */ | 327 | /* load all the keys to the keyboard */ |
328 | for (int i = 0; i <= m_rowBox->value() -1; i++) | 328 | for (int i = 0; i <= m_rowBox->value() -1; i++) |
329 | for (int j = 0; j <= m_colBox->value() -1; j++) { | 329 | for (int j = 0; j <= m_colBox->value() -1; j++) { |
330 | 330 | ||
331 | QString h = "r" + QString::number(i) + "c" + QString::number(j); | 331 | QString h = "r" + QString::number(i) + "c" + QString::number(j); |
332 | QString values = prof.readEntry("keb_" + h); | 332 | QString values = prof.readEntry("keb_" + h); |
333 | 333 | ||
334 | if (!values.isEmpty()) { | 334 | if (!values.isEmpty()) { |
335 | 335 | ||
336 | QStringList l = QStringList::split(QChar('|'), values, TRUE); | 336 | QStringList l = QStringList::split(QChar('|'), values, TRUE); |
337 | kb->keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt()); | 337 | kb->keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt()); |
338 | 338 | ||
339 | // load pixmap if used | 339 | // load pixmap if used |