-rw-r--r-- | noncore/apps/opie-console/function_keyboard.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.h | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 42 |
3 files changed, 30 insertions, 26 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index 0abe0d9..389618c 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -38,97 +38,97 @@ FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | |||
38 | FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) | 38 | FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) |
39 | ); | 39 | ); |
40 | } | 40 | } |
41 | */ | 41 | */ |
42 | if (keys.isEmpty()) loadDefaults(); | 42 | if (keys.isEmpty()) loadDefaults(); |
43 | 43 | ||
44 | 44 | ||
45 | 45 | ||
46 | } | 46 | } |
47 | 47 | ||
48 | FunctionKeyboard::~FunctionKeyboard() {} | 48 | FunctionKeyboard::~FunctionKeyboard() {} |
49 | 49 | ||
50 | void FunctionKeyboard::changeRows(int r) { | 50 | void FunctionKeyboard::changeRows(int r) { |
51 | 51 | ||
52 | numRows = r; | 52 | numRows = r; |
53 | 53 | ||
54 | // have to do this so the whole thing gets redrawn | 54 | // have to do this so the whole thing gets redrawn |
55 | hide(); show(); | 55 | hide(); show(); |
56 | } | 56 | } |
57 | void FunctionKeyboard::changeCols(int c) { | 57 | void FunctionKeyboard::changeCols(int c) { |
58 | 58 | ||
59 | numCols = c; | 59 | numCols = c; |
60 | keyWidth = (double)width()/numCols; // have to reset this thing too | 60 | keyWidth = (double)width()/numCols; // have to reset this thing too |
61 | repaint(false); | 61 | repaint(false); |
62 | } | 62 | } |
63 | void FunctionKeyboard::load (const Profile& prof) { | 63 | void FunctionKeyboard::load (const Profile& prof) { |
64 | 64 | ||
65 | keys.clear(); | 65 | keys.clear(); |
66 | 66 | ||
67 | numRows = prof.readNumEntry("keb_rows", 2); | 67 | numRows = prof.readNumEntry("keb_rows", 2); |
68 | numCols = prof.readNumEntry("keb_cols", 10); | 68 | numCols = prof.readNumEntry("keb_cols", 10); |
69 | keyWidth = (double)width()/numCols; // have to reset this thing too | 69 | keyWidth = (double)width()/numCols; // have to reset this thing too |
70 | 70 | ||
71 | /* load all the keys to the keyboard */ | 71 | /* load all the keys to the keyboard */ |
72 | for (ushort i = 0; i <= numRows - 1; i++) | 72 | for (ushort i = 0; i <= numRows - 1; i++) |
73 | for (ushort j = 0; j <= numCols - 1; j++) { | 73 | for (ushort j = 0; j <= numCols - 1; j++) { |
74 | 74 | ||
75 | QString h = "r" + QString::number(i) + "c" + QString::number(j); | 75 | QString h = "r" + QString::number(i) + "c" + QString::number(j); |
76 | QString values = prof.readEntry("keb_" + h); | 76 | QString values = prof.readEntry("keb_" + h); |
77 | 77 | ||
78 | if (!values.isEmpty()) { | 78 | if (!values.isEmpty()) { |
79 | 79 | ||
80 | QStringList l = QStringList::split(QChar('|'), values, TRUE); | 80 | QStringList l = QStringList::split(QChar('|'), values, TRUE); |
81 | keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt()); | 81 | keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt()); |
82 | 82 | ||
83 | // load pixmap if used | 83 | // load pixmap if used |
84 | if (!l[1].isEmpty()) { | 84 | if (!l[1].isEmpty()) { |
85 | 85 | ||
86 | keys[h].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + l[1] ) ); | 86 | keys[h].pix = new QPixmap( Opie::Core::OResource::loadPixmap( "console/keys/" + l[1] ) ); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | if (keys.isEmpty()) loadDefaults(); | 91 | if (keys.isEmpty()) loadDefaults(); |
92 | 92 | ||
93 | hide(); | 93 | hide(); |
94 | show(); | 94 | show(); |
95 | 95 | ||
96 | } | 96 | } |
97 | 97 | ||
98 | void FunctionKeyboard::paintEvent(QPaintEvent *e) { | 98 | void FunctionKeyboard::paintEvent(QPaintEvent *e) { |
99 | 99 | ||
100 | QPainter p(this); | 100 | QPainter p(this); |
101 | p.setClipRect(e->rect()); | 101 | p.setClipRect(e->rect()); |
102 | p.fillRect(0, 0, width(), height(), QColor(255,255,255)); | 102 | p.fillRect(0, 0, width(), height(), QColor(255,255,255)); |
103 | 103 | ||
104 | p.setPen(QColor(0,0,0)); | 104 | p.setPen(QColor(0,0,0)); |
105 | 105 | ||
106 | /* those decimals do count! becomes short if use plain int */ | 106 | /* those decimals do count! becomes short if use plain int */ |
107 | for (double i = 0; i <= width(); i += keyWidth) { | 107 | for (double i = 0; i <= width(); i += keyWidth) { |
108 | 108 | ||
109 | p.drawLine((int)i, 0, (int)i, height()); | 109 | p.drawLine((int)i, 0, (int)i, height()); |
110 | } | 110 | } |
111 | 111 | ||
112 | // sometimes the last line doesnt get drawn | 112 | // sometimes the last line doesnt get drawn |
113 | p.drawLine(width() -1, 0, width() -1, height()); | 113 | p.drawLine(width() -1, 0, width() -1, height()); |
114 | 114 | ||
115 | for (int i = 0; i <= height(); i += keyHeight) { | 115 | for (int i = 0; i <= height(); i += keyHeight) { |
116 | 116 | ||
117 | p.drawLine(0, i, width(), i); | 117 | p.drawLine(0, i, width(), i); |
118 | } | 118 | } |
119 | 119 | ||
120 | for (uint r = 0; r < numRows; r++) { | 120 | for (uint r = 0; r < numRows; r++) { |
121 | for (uint c = 0; c < numCols; c++) { | 121 | for (uint c = 0; c < numCols; c++) { |
122 | 122 | ||
123 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 123 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
124 | if (keys.contains(handle)) { | 124 | if (keys.contains(handle)) { |
125 | 125 | ||
126 | if (keys[handle].pixFile.isEmpty()) | 126 | if (keys[handle].pixFile.isEmpty()) |
127 | p.drawText( c * keyWidth + 1, r * keyHeight + 1, | 127 | p.drawText( c * keyWidth + 1, r * keyHeight + 1, |
128 | keyWidth, keyHeight, | 128 | keyWidth, keyHeight, |
129 | Qt::AlignHCenter | Qt::AlignVCenter, | 129 | Qt::AlignHCenter | Qt::AlignVCenter, |
130 | keys[handle].label | 130 | keys[handle].label |
131 | ); | 131 | ); |
132 | else { | 132 | else { |
133 | 133 | ||
134 | ushort centerX = (ushort)(c *keyWidth) + (ushort)(keyWidth - keys[handle].pix->width()) / 2; | 134 | ushort centerX = (ushort)(c *keyWidth) + (ushort)(keyWidth - keys[handle].pix->width()) / 2; |
@@ -232,192 +232,191 @@ void FunctionKeyboard::loadDefaults() { | |||
232 | keys.insert( "r0c8", FKey ("End", 0, 4113, 0)); | 232 | keys.insert( "r0c8", FKey ("End", 0, 4113, 0)); |
233 | keys.insert( "r0c9", FKey ("Pu", 0, 4118, 0)); | 233 | keys.insert( "r0c9", FKey ("Pu", 0, 4118, 0)); |
234 | keys.insert( "r0c10", FKey ("Pd", 0, 4119, 0)); | 234 | keys.insert( "r0c10", FKey ("Pd", 0, 4119, 0)); |
235 | keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff)); | 235 | keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff)); |
236 | 236 | ||
237 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); | 237 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); |
238 | keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); | 238 | keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); |
239 | keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); | 239 | keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); |
240 | keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); | 240 | keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); |
241 | keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); | 241 | keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); |
242 | keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); | 242 | keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); |
243 | keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); | 243 | keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); |
244 | keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); | 244 | keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); |
245 | keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); | 245 | keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); |
246 | keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); | 246 | keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); |
247 | keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); | 247 | keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); |
248 | keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); | 248 | keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); |
249 | 249 | ||
250 | 250 | ||
251 | } | 251 | } |
252 | 252 | ||
253 | /* FunctionKeyboardConfig {{{1 */ | 253 | /* FunctionKeyboardConfig {{{1 */ |
254 | 254 | ||
255 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) | 255 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) |
256 | : ProfileDialogKeyWidget(name, parent, na), | 256 | : ProfileDialogKeyWidget(name, parent, na), |
257 | selectedRow(0), selectedCol(0) | 257 | selectedRow(0), selectedCol(0) |
258 | { | 258 | { |
259 | kb = new FunctionKeyboard(this); | 259 | kb = new FunctionKeyboard(this); |
260 | connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), | 260 | connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), |
261 | this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool))); | 261 | this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool))); |
262 | 262 | ||
263 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this); | 263 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this); |
264 | QLabel *l = new QLabel(tr("Rows"), dimentions); | 264 | QLabel *l = new QLabel(tr("Rows"), dimentions); |
265 | m_rowBox = new QSpinBox(1, 15, 1, dimentions); | 265 | m_rowBox = new QSpinBox(1, 15, 1, dimentions); |
266 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); | 266 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); |
267 | l = new QLabel(tr("Columns"), dimentions); | 267 | l = new QLabel(tr("Columns"), dimentions); |
268 | m_colBox = new QSpinBox(1, 15, 1, dimentions); | 268 | m_colBox = new QSpinBox(1, 15, 1, dimentions); |
269 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); | 269 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); |
270 | 270 | ||
271 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); | 271 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); |
272 | l = new QLabel(tr("Label"), editKey); | 272 | l = new QLabel(tr("Label"), editKey); |
273 | m_labels = new QComboBox(true, editKey); | 273 | m_labels = new QComboBox(true, editKey); |
274 | m_labels->setInsertionPolicy(QComboBox::AtCurrent); | 274 | m_labels->setInsertionPolicy(QComboBox::AtCurrent); |
275 | m_labels->insertItem(""); | 275 | m_labels->insertItem(""); |
276 | 276 | ||
277 | QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); | 277 | QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); |
278 | 278 | ||
279 | for (uint i = 0; i < files.count(); i++) { | 279 | for (uint i = 0; i < files.count(); i++) { |
280 | 280 | m_labels->insertItem( Opie::Core::OResource::loadPixmap("console/keys/" + files[i]), files[i]); | |
281 | m_labels->insertItem( Resource::loadPixmap("console/keys/" + files[i]), files[i]); | ||
282 | } | 281 | } |
283 | connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int))); | 282 | connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int))); |
284 | connect (m_labels, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeLabelText(const QString&))); | 283 | connect (m_labels, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeLabelText(const QString&))); |
285 | 284 | ||
286 | l = new QLabel(tr("Q Keycode", "Qt Key Code for the OnScreen Keyboard"), editKey); | 285 | l = new QLabel(tr("Q Keycode", "Qt Key Code for the OnScreen Keyboard"), editKey); |
287 | m_qvalues = new QComboBox(true, editKey); | 286 | m_qvalues = new QComboBox(true, editKey); |
288 | m_qvalues->setInsertionPolicy(QComboBox::AtTop); | 287 | m_qvalues->setInsertionPolicy(QComboBox::AtTop); |
289 | m_qvalues->setDuplicatesEnabled(false); | 288 | m_qvalues->setDuplicatesEnabled(false); |
290 | m_qvalues->insertItem(""); | 289 | m_qvalues->insertItem(""); |
291 | connect (m_qvalues, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeQCode(const QString&))); | 290 | connect (m_qvalues, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeQCode(const QString&))); |
292 | 291 | ||
293 | l = new QLabel(tr("Unicode Value", "The Unicode value of the key"), editKey); | 292 | l = new QLabel(tr("Unicode Value", "The Unicode value of the key"), editKey); |
294 | m_uniValues = new QComboBox(true, editKey); | 293 | m_uniValues = new QComboBox(true, editKey); |
295 | m_uniValues->setInsertionPolicy(QComboBox::AtTop); | 294 | m_uniValues->setInsertionPolicy(QComboBox::AtTop); |
296 | m_uniValues->setDuplicatesEnabled(false); | 295 | m_uniValues->setDuplicatesEnabled(false); |
297 | m_uniValues->insertItem(""); | 296 | m_uniValues->insertItem(""); |
298 | connect (m_uniValues, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeUnicode(const QString&))); | 297 | connect (m_uniValues, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeUnicode(const QString&))); |
299 | 298 | ||
300 | QVBoxLayout *root = new QVBoxLayout(this, 2); | 299 | QVBoxLayout *root = new QVBoxLayout(this, 2); |
301 | root->addWidget(kb); | 300 | root->addWidget(kb); |
302 | root->addWidget(dimentions); | 301 | root->addWidget(dimentions); |
303 | root->addWidget(editKey); | 302 | root->addWidget(editKey); |
304 | } | 303 | } |
305 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { | 304 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { |
306 | 305 | ||
307 | } | 306 | } |
308 | void FunctionKeyboardConfig::load (const Profile& prof) { | 307 | void FunctionKeyboardConfig::load (const Profile& prof) { |
309 | 308 | ||
310 | kb->keys.clear(); | 309 | kb->keys.clear(); |
311 | kb->loadDefaults(); | 310 | kb->loadDefaults(); |
312 | 311 | ||
313 | m_rowBox->setValue(prof.readNumEntry("keb_rows", 2)); | 312 | m_rowBox->setValue(prof.readNumEntry("keb_rows", 2)); |
314 | m_colBox->setValue(prof.readNumEntry("keb_cols", 10)); | 313 | m_colBox->setValue(prof.readNumEntry("keb_cols", 10)); |
315 | 314 | ||
316 | /* load all the keys to the keyboard */ | 315 | /* load all the keys to the keyboard */ |
317 | for (int i = 0; i <= m_rowBox->value() -1; i++) | 316 | for (int i = 0; i <= m_rowBox->value() -1; i++) |
318 | for (int j = 0; j <= m_colBox->value() -1; j++) { | 317 | for (int j = 0; j <= m_colBox->value() -1; j++) { |
319 | 318 | ||
320 | QString h = "r" + QString::number(i) + "c" + QString::number(j); | 319 | QString h = "r" + QString::number(i) + "c" + QString::number(j); |
321 | QString values = prof.readEntry("keb_" + h); | 320 | QString values = prof.readEntry("keb_" + h); |
322 | 321 | ||
323 | if (!values.isEmpty()) { | 322 | if (!values.isEmpty()) { |
324 | 323 | ||
325 | QStringList l = QStringList::split(QChar('|'), values, TRUE); | 324 | QStringList l = QStringList::split(QChar('|'), values, TRUE); |
326 | kb->keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt()); | 325 | kb->keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt()); |
327 | 326 | ||
328 | // load pixmap if used | 327 | // load pixmap if used |
329 | if (!l[1].isEmpty()) { | 328 | if (!l[1].isEmpty()) { |
330 | 329 | ||
331 | kb->keys[h].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + l[1] ) ); | 330 | kb->keys[h].pix = new QPixmap( Opie::Core::OResource::loadPixmap( "console/keys/" + l[1] ) ); |
332 | } | 331 | } |
333 | } | 332 | } |
334 | } | 333 | } |
335 | 334 | ||
336 | } | 335 | } |
337 | void FunctionKeyboardConfig::save (Profile& prof) { | 336 | void FunctionKeyboardConfig::save (Profile& prof) { |
338 | 337 | ||
339 | prof.writeEntry("keb_rows", m_rowBox->value()); | 338 | prof.writeEntry("keb_rows", m_rowBox->value()); |
340 | prof.writeEntry("keb_cols", m_colBox->value()); | 339 | prof.writeEntry("keb_cols", m_colBox->value()); |
341 | 340 | ||
342 | QMap<QString, FKey>::Iterator it; | 341 | QMap<QString, FKey>::Iterator it; |
343 | for ( it = kb->keys.begin(); it != kb->keys.end(); it++) { | 342 | for ( it = kb->keys.begin(); it != kb->keys.end(); it++) { |
344 | 343 | ||
345 | FKey k = it.data(); | 344 | FKey k = it.data(); |
346 | QString entry = k.label + "|" | 345 | QString entry = k.label + "|" |
347 | + k.pixFile + "|" | 346 | + k.pixFile + "|" |
348 | + QString::number(k.qcode) + "|" | 347 | + QString::number(k.qcode) + "|" |
349 | + QString::number(k.unicode); | 348 | + QString::number(k.unicode); |
350 | 349 | ||
351 | prof.writeEntry("keb_" + it.key(), entry); | 350 | prof.writeEntry("keb_" + it.key(), entry); |
352 | 351 | ||
353 | } | 352 | } |
354 | 353 | ||
355 | } | 354 | } |
356 | void FunctionKeyboardConfig::slotChangeRows(int r) { | 355 | void FunctionKeyboardConfig::slotChangeRows(int r) { |
357 | 356 | ||
358 | kb->changeRows(r); | 357 | kb->changeRows(r); |
359 | 358 | ||
360 | } | 359 | } |
361 | void FunctionKeyboardConfig::slotChangeCols(int c) { | 360 | void FunctionKeyboardConfig::slotChangeCols(int c) { |
362 | 361 | ||
363 | kb->changeCols(c); | 362 | kb->changeCols(c); |
364 | } | 363 | } |
365 | void FunctionKeyboardConfig::slotKeyPressed(FKey k, ushort r, ushort c, bool pressed) { | 364 | void FunctionKeyboardConfig::slotKeyPressed(FKey k, ushort r, ushort c, bool pressed) { |
366 | 365 | ||
367 | if (!pressed) return; | 366 | if (!pressed) return; |
368 | 367 | ||
369 | selectedHandle = "r" + QString::number(r) + | 368 | selectedHandle = "r" + QString::number(r) + |
370 | "c" + QString::number(c); | 369 | "c" + QString::number(c); |
371 | selectedRow = r; | 370 | selectedRow = r; |
372 | selectedCol = c; | 371 | selectedCol = c; |
373 | 372 | ||
374 | if (k.pixFile.isEmpty()) { | 373 | if (k.pixFile.isEmpty()) { |
375 | 374 | ||
376 | m_labels->setEditable(true); | 375 | m_labels->setEditable(true); |
377 | m_labels->setCurrentItem(0); | 376 | m_labels->setCurrentItem(0); |
378 | m_labels->changeItem(k.label, 0); | 377 | m_labels->changeItem(k.label, 0); |
379 | 378 | ||
380 | } else { | 379 | } else { |
381 | 380 | ||
382 | // any better way to select the pixmap? | 381 | // any better way to select the pixmap? |
383 | m_labels->setCurrentItem((m_labels->listBox())->index((m_labels->listBox())->findItem(kb->keys[selectedHandle].pixFile))); | 382 | m_labels->setCurrentItem((m_labels->listBox())->index((m_labels->listBox())->findItem(kb->keys[selectedHandle].pixFile))); |
384 | m_labels->setEditable(false); | 383 | m_labels->setEditable(false); |
385 | } | 384 | } |
386 | m_qvalues->changeItem(QString::number(k.qcode), 0); | 385 | m_qvalues->changeItem(QString::number(k.qcode), 0); |
387 | m_uniValues->changeItem(QString::number(k.unicode), 0); | 386 | m_uniValues->changeItem(QString::number(k.unicode), 0); |
388 | } | 387 | } |
389 | void FunctionKeyboardConfig::slotChangeIcon(int index) { | 388 | void FunctionKeyboardConfig::slotChangeIcon(int index) { |
390 | 389 | ||
391 | if (index == 0) { | 390 | if (index == 0) { |
392 | 391 | ||
393 | // is text | 392 | // is text |
394 | m_labels->setEditable(true); | 393 | m_labels->setEditable(true); |
395 | // why tf does the text get erased unless i do this? | 394 | // why tf does the text get erased unless i do this? |
396 | m_labels->changeItem(m_labels->text(0), 0); | 395 | m_labels->changeItem(m_labels->text(0), 0); |
397 | 396 | ||
398 | kb->keys[selectedHandle].pixFile = ""; | 397 | kb->keys[selectedHandle].pixFile = ""; |
399 | delete kb->keys[selectedHandle].pix; | 398 | delete kb->keys[selectedHandle].pix; |
400 | 399 | ||
401 | } else { | 400 | } else { |
402 | 401 | ||
403 | // is a pixmap | 402 | // is a pixmap |
404 | m_labels->setEditable(false); | 403 | m_labels->setEditable(false); |
405 | kb->keys[selectedHandle].pixFile = m_labels->currentText(); | 404 | kb->keys[selectedHandle].pixFile = m_labels->currentText(); |
406 | kb->keys[selectedHandle].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + m_labels->currentText() ) ); | 405 | kb->keys[selectedHandle].pix = new QPixmap( Opie::Core::OResource::loadPixmap( "console/keys/" + m_labels->currentText() ) ); |
407 | } | 406 | } |
408 | kb->paintKey(selectedRow, selectedCol); | 407 | kb->paintKey(selectedRow, selectedCol); |
409 | } | 408 | } |
410 | void FunctionKeyboardConfig::slotChangeLabelText(const QString &label) { | 409 | void FunctionKeyboardConfig::slotChangeLabelText(const QString &label) { |
411 | 410 | ||
412 | kb->keys[selectedHandle].label = label; | 411 | kb->keys[selectedHandle].label = label; |
413 | 412 | ||
414 | kb->paintKey(selectedRow, selectedCol); | 413 | kb->paintKey(selectedRow, selectedCol); |
415 | } | 414 | } |
416 | void FunctionKeyboardConfig::slotChangeQCode(const QString& qcode) { | 415 | void FunctionKeyboardConfig::slotChangeQCode(const QString& qcode) { |
417 | 416 | ||
418 | kb->keys[selectedHandle].qcode = qcode.toUInt(); | 417 | kb->keys[selectedHandle].qcode = qcode.toUInt(); |
419 | } | 418 | } |
420 | void FunctionKeyboardConfig::slotChangeUnicode(const QString& uni) { | 419 | void FunctionKeyboardConfig::slotChangeUnicode(const QString& uni) { |
421 | 420 | ||
422 | kb->keys[selectedHandle].unicode = uni.toUInt(); | 421 | kb->keys[selectedHandle].unicode = uni.toUInt(); |
423 | } | 422 | } |
diff --git a/noncore/apps/opie-console/function_keyboard.h b/noncore/apps/opie-console/function_keyboard.h index a60ff4b..b7e211c 100644 --- a/noncore/apps/opie-console/function_keyboard.h +++ b/noncore/apps/opie-console/function_keyboard.h | |||
@@ -1,73 +1,74 @@ | |||
1 | #ifndef OPIE_FUNCTION_KEYBOARD_H | 1 | #ifndef OPIE_FUNCTION_KEYBOARD_H |
2 | #define OPIE_FUNCTION_KEYBOARD_H | 2 | #define OPIE_FUNCTION_KEYBOARD_H |
3 | 3 | ||
4 | #include <opie2/oresource.h> | ||
5 | |||
4 | #include <qpe/config.h> | 6 | #include <qpe/config.h> |
5 | #include <qpe/resource.h> | ||
6 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
7 | #include <qframe.h> | 8 | #include <qframe.h> |
8 | #include <qpainter.h> | 9 | #include <qpainter.h> |
9 | #include <qvbox.h> | 10 | #include <qvbox.h> |
10 | #include <qgroupbox.h> | 11 | #include <qgroupbox.h> |
11 | #include <qmap.h> | 12 | #include <qmap.h> |
12 | #include <qspinbox.h> | 13 | #include <qspinbox.h> |
13 | #include <qcombobox.h> | 14 | #include <qcombobox.h> |
14 | #include "profiledialogwidget.h" | 15 | #include "profiledialogwidget.h" |
15 | 16 | ||
16 | 17 | ||
17 | struct FKey { | 18 | struct FKey { |
18 | 19 | ||
19 | FKey(): qcode(0), unicode(0) {}; | 20 | FKey(): qcode(0), unicode(0) {}; |
20 | FKey(const QString &l, const QString &f, ushort q, ushort u): | 21 | FKey(const QString &l, const QString &f, ushort q, ushort u): |
21 | label(l), pixFile(f), qcode(q), unicode(u) { | 22 | label(l), pixFile(f), qcode(q), unicode(u) { |
22 | 23 | ||
23 | if (!f.isEmpty()) { | 24 | if (!f.isEmpty()) { |
24 | 25 | ||
25 | pix = new QPixmap ( Resource::loadPixmap("console/keys/" + f ) ); | 26 | pix = new QPixmap ( Opie::Core::OResource::loadPixmap("console/keys/" + f ) ); |
26 | } | 27 | } |
27 | }; | 28 | }; |
28 | 29 | ||
29 | QString label; | 30 | QString label; |
30 | QPixmap *pix; | 31 | QPixmap *pix; |
31 | QString pixFile; | 32 | QString pixFile; |
32 | ushort qcode; | 33 | ushort qcode; |
33 | ushort unicode; | 34 | ushort unicode; |
34 | }; | 35 | }; |
35 | 36 | ||
36 | class FunctionKeyboard : public QFrame { | 37 | class FunctionKeyboard : public QFrame { |
37 | Q_OBJECT | 38 | Q_OBJECT |
38 | 39 | ||
39 | public: | 40 | public: |
40 | FunctionKeyboard(QWidget *parent = 0); | 41 | FunctionKeyboard(QWidget *parent = 0); |
41 | ~FunctionKeyboard(); | 42 | ~FunctionKeyboard(); |
42 | 43 | ||
43 | friend class FunctionKeyboardConfig; | 44 | friend class FunctionKeyboardConfig; |
44 | 45 | ||
45 | void changeRows(int); | 46 | void changeRows(int); |
46 | void changeCols(int); | 47 | void changeCols(int); |
47 | 48 | ||
48 | void load(const Profile &); | 49 | void load(const Profile &); |
49 | void loadDefaults(); | 50 | void loadDefaults(); |
50 | 51 | ||
51 | void paintEvent(QPaintEvent *); | 52 | void paintEvent(QPaintEvent *); |
52 | void paintKey(uint, uint); | 53 | void paintKey(uint, uint); |
53 | void mousePressEvent(QMouseEvent*); | 54 | void mousePressEvent(QMouseEvent*); |
54 | void mouseReleaseEvent(QMouseEvent*); | 55 | void mouseReleaseEvent(QMouseEvent*); |
55 | void resizeEvent(QResizeEvent*); | 56 | void resizeEvent(QResizeEvent*); |
56 | QSize sizeHint() const; | 57 | QSize sizeHint() const; |
57 | 58 | ||
58 | signals: | 59 | signals: |
59 | 60 | ||
60 | void keyPressed(FKey, ushort, ushort, bool); | 61 | void keyPressed(FKey, ushort, ushort, bool); |
61 | 62 | ||
62 | 63 | ||
63 | private: | 64 | private: |
64 | 65 | ||
65 | // thie key for the map is the row/col | 66 | // thie key for the map is the row/col |
66 | QMap<QString, FKey> keys; | 67 | QMap<QString, FKey> keys; |
67 | 68 | ||
68 | uint numRows; | 69 | uint numRows; |
69 | int test; | 70 | int test; |
70 | uint numCols; | 71 | uint numCols; |
71 | uint keyHeight; | 72 | uint keyHeight; |
72 | double keyWidth; // decimal point matters! | 73 | double keyWidth; // decimal point matters! |
73 | 74 | ||
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index eaa78c8..45a662c 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,302 +1,306 @@ | |||
1 | #include "TEmulation.h" | 1 | #include "TEmulation.h" |
2 | #include "profileeditordialog.h" | 2 | #include "profileeditordialog.h" |
3 | #include "configdialog.h" | 3 | #include "configdialog.h" |
4 | #include "default.h" | 4 | #include "default.h" |
5 | #include "profilemanager.h" | 5 | #include "profilemanager.h" |
6 | #include "mainwindow.h" | 6 | #include "mainwindow.h" |
7 | #include "tabwidget.h" | 7 | #include "tabwidget.h" |
8 | #include "transferdialog.h" | 8 | #include "transferdialog.h" |
9 | #include "function_keyboard.h" | 9 | #include "function_keyboard.h" |
10 | #include "emulation_handler.h" | 10 | #include "emulation_handler.h" |
11 | #include "script.h" | 11 | #include "script.h" |
12 | #include "fixit.h" | 12 | #include "fixit.h" |
13 | 13 | ||
14 | /* OPIE */ | 14 | /* OPIE */ |
15 | #include <opie2/ofiledialog.h> | 15 | #include <opie2/ofiledialog.h> |
16 | #include <opie2/oresource.h> | ||
16 | #include <qpe/filemanager.h> | 17 | #include <qpe/filemanager.h> |
17 | using namespace Opie::Ui; | 18 | using namespace Opie::Ui; |
18 | 19 | ||
19 | /* QT */ | 20 | /* QT */ |
20 | #include <qaction.h> | 21 | #include <qaction.h> |
21 | #include <qmenubar.h> | 22 | #include <qmenubar.h> |
22 | #include <qtoolbar.h> | 23 | #include <qtoolbar.h> |
23 | #include <qmessagebox.h> | 24 | #include <qmessagebox.h> |
24 | #include <qwhatsthis.h> | 25 | #include <qwhatsthis.h> |
25 | #include <qfileinfo.h> | 26 | #include <qfileinfo.h> |
26 | 27 | ||
27 | /* STD */ | 28 | /* STD */ |
28 | #include <assert.h> | 29 | #include <assert.h> |
29 | 30 | ||
30 | #include <opie2/oconfig.h> | 31 | #include <opie2/oconfig.h> |
31 | 32 | ||
32 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 33 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
33 | 34 | ||
34 | #ifdef FSCKED_DISTRI | 35 | #ifdef FSCKED_DISTRI |
35 | FixIt fix; | 36 | FixIt fix; |
36 | fix.fixIt(); | 37 | fix.fixIt(); |
37 | #endif | 38 | #endif |
38 | 39 | ||
39 | setCaption(QObject::tr("Opie Console") ); | 40 | setCaption(QObject::tr("Opie Console") ); |
40 | KeyTrans::loadAll(); | 41 | KeyTrans::loadAll(); |
41 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 42 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
42 | KeyTrans* s = KeyTrans::find(i ); | 43 | KeyTrans* s = KeyTrans::find(i ); |
43 | assert( s ); | 44 | assert( s ); |
44 | } | 45 | } |
45 | m_factory = new MetaFactory(); | 46 | m_factory = new MetaFactory(); |
46 | Default def(m_factory); | 47 | Default def(m_factory); |
47 | m_sessions.setAutoDelete( TRUE ); | 48 | m_sessions.setAutoDelete( TRUE ); |
48 | m_curSession = 0; | 49 | m_curSession = 0; |
49 | m_manager = new ProfileManager( m_factory ); | 50 | m_manager = new ProfileManager( m_factory ); |
50 | m_manager->load(); | 51 | m_manager->load(); |
51 | m_scriptsData.setAutoDelete(TRUE); | 52 | m_scriptsData.setAutoDelete(TRUE); |
52 | 53 | ||
53 | initUI(); | 54 | initUI(); |
54 | populateProfiles(); | 55 | populateProfiles(); |
55 | populateScripts(); | 56 | populateScripts(); |
56 | } | 57 | } |
57 | 58 | ||
58 | void MainWindow::initUI() { | 59 | void MainWindow::initUI() { |
59 | 60 | ||
60 | setToolBarsMovable( FALSE ); | 61 | setToolBarsMovable( FALSE ); |
61 | 62 | ||
62 | /* tool bar for the menu */ | 63 | /* tool bar for the menu */ |
63 | m_tool = new QToolBar( this ); | 64 | m_tool = new QToolBar( this ); |
64 | m_tool->setHorizontalStretchable( TRUE ); | 65 | m_tool->setHorizontalStretchable( TRUE ); |
65 | 66 | ||
66 | m_bar = new QMenuBar( m_tool ); | 67 | m_bar = new QMenuBar( m_tool ); |
67 | m_console = new QPopupMenu( this ); | 68 | m_console = new QPopupMenu( this ); |
68 | m_scripts = new QPopupMenu( this ); | 69 | m_scripts = new QPopupMenu( this ); |
69 | m_sessionsPop= new QPopupMenu( this ); | 70 | m_sessionsPop= new QPopupMenu( this ); |
70 | m_scriptsPop = new QPopupMenu( this ); | 71 | m_scriptsPop = new QPopupMenu( this ); |
71 | 72 | ||
72 | /* add a toolbar for icons */ | 73 | /* add a toolbar for icons */ |
73 | m_icons = new QToolBar(this); | 74 | m_icons = new QToolBar(this); |
74 | 75 | ||
75 | /* | 76 | /* |
76 | * the settings action | 77 | * the settings action |
77 | */ | 78 | */ |
78 | m_setProfiles = new QAction(tr("Configure Profiles"), | 79 | m_setProfiles = new QAction(tr("Configure Profiles"), |
79 | Resource::loadPixmap( "SettingsIcon" ), | 80 | Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), |
80 | QString::null, 0, this, 0); | 81 | QString::null, 0, this, 0); |
81 | m_setProfiles->addTo( m_console ); | 82 | m_setProfiles->addTo( m_console ); |
82 | connect( m_setProfiles, SIGNAL(activated() ), | 83 | connect( m_setProfiles, SIGNAL(activated() ), |
83 | this, SLOT(slotConfigure() ) ); | 84 | this, SLOT(slotConfigure() ) ); |
84 | 85 | ||
85 | m_console->insertSeparator(); | 86 | m_console->insertSeparator(); |
86 | /* | 87 | /* |
87 | * new Action for new sessions | 88 | * new Action for new sessions |
88 | */ | 89 | */ |
89 | QAction* newCon = new QAction(tr("New Profile"), | 90 | QAction* newCon = new QAction(tr("New Profile"), |
90 | Resource::loadPixmap( "new" ), | 91 | Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), |
91 | QString::null, 0, this, 0); | 92 | QString::null, 0, this, 0); |
92 | newCon->addTo( m_console ); | 93 | newCon->addTo( m_console ); |
93 | connect( newCon, SIGNAL(activated() ), | 94 | connect( newCon, SIGNAL(activated() ), |
94 | this, SLOT(slotNew() ) ); | 95 | this, SLOT(slotNew() ) ); |
95 | 96 | ||
96 | m_console->insertSeparator(); | 97 | m_console->insertSeparator(); |
97 | 98 | ||
98 | QAction *saveCon = new QAction( tr("Save Profile" ), | 99 | QAction *saveCon = new QAction( tr("Save Profile" ), |
99 | Resource::loadPixmap( "save" ), QString::null, | 100 | Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ), QString::null, |
100 | 0, this, 0 ); | 101 | 0, this, 0 ); |
101 | saveCon->addTo( m_console ); | 102 | saveCon->addTo( m_console ); |
102 | connect( saveCon, SIGNAL(activated() ), | 103 | connect( saveCon, SIGNAL(activated() ), |
103 | this, SLOT(slotSaveSession() ) ); | 104 | this, SLOT(slotSaveSession() ) ); |
104 | m_console->insertSeparator(); | 105 | m_console->insertSeparator(); |
105 | 106 | ||
106 | /* | 107 | /* |
107 | * connect action | 108 | * connect action |
108 | */ | 109 | */ |
109 | m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), | 110 | m_connect = new QAction( tr("Connect"), Opie::Core::OResource::loadPixmap("console/connected", |
110 | QString::null, 0, this, 0 ); | 111 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); |
111 | m_connect->addTo( m_console ); | 112 | m_connect->addTo( m_console ); |
112 | connect(m_connect, SIGNAL(activated() ), | 113 | connect(m_connect, SIGNAL(activated() ), |
113 | this, SLOT(slotConnect() ) ); | 114 | this, SLOT(slotConnect() ) ); |
114 | 115 | ||
115 | /* | 116 | /* |
116 | * disconnect action | 117 | * disconnect action |
117 | */ | 118 | */ |
118 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), | 119 | m_disconnect = new QAction( tr("Disconnect"), Opie::Core::OResource::loadPixmap("console/notconnected", |
119 | QString::null, 0, this, 0 ); | 120 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); |
120 | m_disconnect->addTo( m_console ); | 121 | m_disconnect->addTo( m_console ); |
121 | connect(m_disconnect, SIGNAL(activated() ), | 122 | connect(m_disconnect, SIGNAL(activated() ), |
122 | this, SLOT(slotDisconnect() ) ); | 123 | this, SLOT(slotDisconnect() ) ); |
123 | 124 | ||
124 | m_console->insertSeparator(); | 125 | m_console->insertSeparator(); |
125 | 126 | ||
126 | #ifndef EAST | 127 | #ifndef EAST |
127 | m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); | 128 | m_quickLaunch = new QAction( tr("QuickLaunch"), |
129 | Opie::Core::OResource::loadPixmap("console/konsole_mini", Opie::Core::OResource::SmallIcon ), | ||
130 | QString::null, 0, this, 0 ); | ||
128 | m_quickLaunch->addTo( m_icons ); | 131 | m_quickLaunch->addTo( m_icons ); |
129 | connect( m_quickLaunch, SIGNAL( activated() ), | 132 | connect( m_quickLaunch, SIGNAL( activated() ), |
130 | this, SLOT( slotQuickLaunch() ) ); | 133 | this, SLOT( slotQuickLaunch() ) ); |
131 | #endif | 134 | #endif |
132 | 135 | ||
133 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); | 136 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); |
134 | 137 | ||
135 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, | 138 | m_transfer = new QAction( tr("Transfer file..."), Opie::Core::OResource::loadPixmap("pass", Opie::Core::OResource::SmallIcon ), |
136 | 0, this, 0 ); | 139 | QString::null, 0, this, 0 ); |
137 | m_transfer->addTo( m_console ); | 140 | m_transfer->addTo( m_console ); |
138 | connect(m_transfer, SIGNAL(activated() ), | 141 | connect(m_transfer, SIGNAL(activated() ), |
139 | this, SLOT(slotTransfer() ) ); | 142 | this, SLOT(slotTransfer() ) ); |
140 | 143 | ||
141 | 144 | ||
142 | 145 | ||
143 | /* | 146 | /* |
144 | * immediate change of line wrap policy | 147 | * immediate change of line wrap policy |
145 | */ | 148 | */ |
146 | m_isWrapped = true; | 149 | m_isWrapped = true; |
147 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0, true ); | 150 | m_wrap = new QAction( tr("Line wrap"), Opie::Core::OResource::loadPixmap( "linewrap", Opie::Core::OResource::SmallIcon ), |
151 | QString::null, 0, this, 0, true ); | ||
148 | m_wrap->addTo( m_console ); | 152 | m_wrap->addTo( m_console ); |
149 | m_wrap->setOn( true ); | 153 | m_wrap->setOn( true ); |
150 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); | 154 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); |
151 | 155 | ||
152 | /* | 156 | /* |
153 | * fullscreen | 157 | * fullscreen |
154 | */ | 158 | */ |
155 | m_isFullscreen = false; | 159 | m_isFullscreen = false; |
156 | 160 | ||
157 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 161 | m_fullscreen = new QAction( tr("Full screen"), Opie::Core::OResource::loadPixmap( "fullscreen", |
158 | , QString::null, 0, this, 0 ); | 162 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); |
159 | m_fullscreen->addTo( m_console ); | 163 | m_fullscreen->addTo( m_console ); |
160 | connect( m_fullscreen, SIGNAL( activated() ), | 164 | connect( m_fullscreen, SIGNAL( activated() ), |
161 | this, SLOT( slotFullscreen() ) ); | 165 | this, SLOT( slotFullscreen() ) ); |
162 | 166 | ||
163 | m_console->insertSeparator(); | 167 | m_console->insertSeparator(); |
164 | 168 | ||
165 | m_recordLog = new QAction(); | 169 | m_recordLog = new QAction(); |
166 | m_recordLog->setText( tr("Start log") ); | 170 | m_recordLog->setText( tr("Start log") ); |
167 | m_recordLog->addTo( m_console ); | 171 | m_recordLog->addTo( m_console ); |
168 | connect(m_recordLog, SIGNAL(activated() ), | 172 | connect(m_recordLog, SIGNAL(activated() ), |
169 | this, SLOT( slotSaveLog() ) ); | 173 | this, SLOT( slotSaveLog() ) ); |
170 | m_recordingLog = false; | 174 | m_recordingLog = false; |
171 | 175 | ||
172 | QAction *a = new QAction(); | 176 | QAction *a = new QAction(); |
173 | a->setText( tr("Save history") ); | 177 | a->setText( tr("Save history") ); |
174 | a->addTo( m_console ); | 178 | a->addTo( m_console ); |
175 | connect(a, SIGNAL(activated() ), | 179 | connect(a, SIGNAL(activated() ), |
176 | this, SLOT(slotSaveHistory() ) ); | 180 | this, SLOT(slotSaveHistory() ) ); |
177 | /* | 181 | /* |
178 | * terminate action | 182 | * terminate action |
179 | */ | 183 | */ |
180 | m_terminate = new QAction(); | 184 | m_terminate = new QAction(); |
181 | m_terminate->setText( tr("Terminate") ); | 185 | m_terminate->setText( tr("Terminate") ); |
182 | m_terminate->addTo( m_console ); | 186 | m_terminate->addTo( m_console ); |
183 | connect(m_terminate, SIGNAL(activated() ), | 187 | connect(m_terminate, SIGNAL(activated() ), |
184 | this, SLOT(slotTerminate() ) ); | 188 | this, SLOT(slotTerminate() ) ); |
185 | 189 | ||
186 | m_closewindow = new QAction(); | 190 | m_closewindow = new QAction(); |
187 | m_closewindow->setText( tr("Close Window") ); | 191 | m_closewindow->setText( tr("Close Window") ); |
188 | m_closewindow->addTo( m_console ); | 192 | m_closewindow->addTo( m_console ); |
189 | connect( m_closewindow, SIGNAL(activated() ), | 193 | connect( m_closewindow, SIGNAL(activated() ), |
190 | this, SLOT(slotClose() ) ); | 194 | this, SLOT(slotClose() ) ); |
191 | 195 | ||
192 | 196 | ||
193 | /* | 197 | /* |
194 | * script actions | 198 | * script actions |
195 | */ | 199 | */ |
196 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); | 200 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); |
197 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); | 201 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); |
198 | 202 | ||
199 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 203 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
200 | m_recordScript->addTo(m_scripts); | 204 | m_recordScript->addTo(m_scripts); |
201 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 205 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
202 | 206 | ||
203 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 207 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
204 | m_saveScript->addTo(m_scripts); | 208 | m_saveScript->addTo(m_scripts); |
205 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 209 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
206 | 210 | ||
207 | 211 | ||
208 | 212 | ||
209 | 213 | ||
210 | /* | 214 | /* |
211 | * action that open/closes the keyboard | 215 | * action that open/closes the keyboard |
212 | */ | 216 | */ |
213 | m_openKeys = new QAction (tr("Open Keyboard..."), | 217 | m_openKeys = new QAction (tr("Open Keyboard..."), |
214 | Resource::loadPixmap( "console/keys/keyboard_icon" ), | 218 | Opie::Core::OResource::loadPixmap( "console/keys/keyboard_icon", Opie::Core::OResource::SmallIcon ), |
215 | QString::null, 0, this, 0); | 219 | QString::null, 0, this, 0); |
216 | m_openKeys->setToggleAction(true); | 220 | m_openKeys->setToggleAction(true); |
217 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); | 221 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); |
218 | 222 | ||
219 | /* insert the submenu */ | 223 | /* insert the submenu */ |
220 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 224 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
221 | -1, 0); | 225 | -1, 0); |
222 | 226 | ||
223 | /* insert the connection menu */ | 227 | /* insert the connection menu */ |
224 | m_bar->insertItem( tr("Connection"), m_console ); | 228 | m_bar->insertItem( tr("Connection"), m_console ); |
225 | 229 | ||
226 | /* the scripts menu */ | 230 | /* the scripts menu */ |
227 | #ifdef EAST | 231 | #ifdef EAST |
228 | Opie::Core::OConfig cfg("opie-console"); | 232 | Opie::Core::OConfig cfg("opie-console"); |
229 | cfg.setGroup("10east"); | 233 | cfg.setGroup("10east"); |
230 | if( !cfg.readEntry("scripthide",0) ) { | 234 | if( !cfg.readEntry("scripthide",0) ) { |
231 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 235 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
232 | } | 236 | } |
233 | #endif | 237 | #endif |
234 | 238 | ||
235 | /* and the keyboard */ | 239 | /* and the keyboard */ |
236 | m_keyBar = new QToolBar(this); | 240 | m_keyBar = new QToolBar(this); |
237 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 241 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
238 | m_keyBar->setHorizontalStretchable( TRUE ); | 242 | m_keyBar->setHorizontalStretchable( TRUE ); |
239 | m_keyBar->hide(); | 243 | m_keyBar->hide(); |
240 | 244 | ||
241 | m_kb = new FunctionKeyboard(m_keyBar); | 245 | m_kb = new FunctionKeyboard(m_keyBar); |
242 | connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), | 246 | connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), |
243 | this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool))); | 247 | this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool))); |
244 | 248 | ||
245 | 249 | ||
246 | a = new QAction(tr("Copy"), | 250 | a = new QAction(tr("Copy"), |
247 | Resource::loadPixmap("copy"), QString::null, | 251 | Opie::Core::OResource::loadPixmap("copy", Opie::Core::OResource::SmallIcon ), QString::null, |
248 | 0, this, 0 ); | 252 | 0, this, 0 ); |
249 | //a->addTo( m_icons ); | 253 | //a->addTo( m_icons ); |
250 | connect( a, SIGNAL(activated() ), | 254 | connect( a, SIGNAL(activated() ), |
251 | this, SLOT(slotCopy() ) ); | 255 | this, SLOT(slotCopy() ) ); |
252 | 256 | ||
253 | QAction *paste = new QAction(tr("Paste"), | 257 | QAction *paste = new QAction(tr("Paste"), |
254 | Resource::loadPixmap("paste"), QString::null, | 258 | Opie::Core::OResource::loadPixmap("paste", Opie::Core::OResource::SmallIcon ), QString::null, |
255 | 0, this, 0 ); | 259 | 0, this, 0 ); |
256 | connect( paste, SIGNAL(activated() ), | 260 | connect( paste, SIGNAL(activated() ), |
257 | this, SLOT(slotPaste() ) ); | 261 | this, SLOT(slotPaste() ) ); |
258 | 262 | ||
259 | 263 | ||
260 | newCon->addTo( m_icons ); | 264 | newCon->addTo( m_icons ); |
261 | //m_setProfiles->addTo( m_icons ); | 265 | //m_setProfiles->addTo( m_icons ); |
262 | paste->addTo( m_icons ); | 266 | paste->addTo( m_icons ); |
263 | m_openKeys->addTo(m_icons); | 267 | m_openKeys->addTo(m_icons); |
264 | m_fullscreen->addTo( m_icons ); | 268 | m_fullscreen->addTo( m_icons ); |
265 | 269 | ||
266 | m_connect->setEnabled( false ); | 270 | m_connect->setEnabled( false ); |
267 | m_disconnect->setEnabled( false ); | 271 | m_disconnect->setEnabled( false ); |
268 | m_terminate->setEnabled( false ); | 272 | m_terminate->setEnabled( false ); |
269 | m_transfer->setEnabled( false ); | 273 | m_transfer->setEnabled( false ); |
270 | m_scripts->setItemEnabled(m_runScript_id, false); | 274 | m_scripts->setItemEnabled(m_runScript_id, false); |
271 | m_recordScript->setEnabled( false ); | 275 | m_recordScript->setEnabled( false ); |
272 | m_saveScript->setEnabled( false ); | 276 | m_saveScript->setEnabled( false ); |
273 | m_fullscreen->setEnabled( false ); | 277 | m_fullscreen->setEnabled( false ); |
274 | m_closewindow->setEnabled( false ); | 278 | m_closewindow->setEnabled( false ); |
275 | m_wrap->setEnabled( false ); | 279 | m_wrap->setEnabled( false ); |
276 | 280 | ||
277 | /* | 281 | /* |
278 | * connect to the menu activation | 282 | * connect to the menu activation |
279 | */ | 283 | */ |
280 | connect( m_sessionsPop, SIGNAL(activated(int) ), | 284 | connect( m_sessionsPop, SIGNAL(activated(int) ), |
281 | this, SLOT(slotProfile(int) ) ); | 285 | this, SLOT(slotProfile(int) ) ); |
282 | 286 | ||
283 | m_consoleWindow = new TabWidget( this, "blah"); | 287 | m_consoleWindow = new TabWidget( this, "blah"); |
284 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 288 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
285 | this, SLOT(slotSessionChanged(Session*) ) ); | 289 | this, SLOT(slotSessionChanged(Session*) ) ); |
286 | setCentralWidget( m_consoleWindow ); | 290 | setCentralWidget( m_consoleWindow ); |
287 | 291 | ||
288 | slotQuickLaunch(); | 292 | slotQuickLaunch(); |
289 | } | 293 | } |
290 | 294 | ||
291 | ProfileManager* MainWindow::manager() { | 295 | ProfileManager* MainWindow::manager() { |
292 | return m_manager; | 296 | return m_manager; |
293 | } | 297 | } |
294 | TabWidget* MainWindow::tabWidget() { | 298 | TabWidget* MainWindow::tabWidget() { |
295 | return m_consoleWindow; | 299 | return m_consoleWindow; |
296 | } | 300 | } |
297 | void MainWindow::populateProfiles() { | 301 | void MainWindow::populateProfiles() { |
298 | m_sessionsPop->clear(); | 302 | m_sessionsPop->clear(); |
299 | Profile::ValueList list = manager()->all(); | 303 | Profile::ValueList list = manager()->all(); |
300 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 304 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
301 | m_sessionsPop->insertItem( (*it).name() ); | 305 | m_sessionsPop->insertItem( (*it).name() ); |
302 | } | 306 | } |