author | harlekin <harlekin> | 2002-10-17 22:49:55 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-17 22:49:55 (UTC) |
commit | 51dbf76486cb81a7cb34c07483b344c8ea7a8a24 (patch) (unidiff) | |
tree | 422713323f2631e6432cfe3e07e735206446e7fc /noncore/apps/opie-console/mainwindow.cpp | |
parent | 943c09096f11827470b9cd3e311329ac422aaf20 (diff) | |
download | opie-51dbf76486cb81a7cb34c07483b344c8ea7a8a24.zip opie-51dbf76486cb81a7cb34c07483b344c8ea7a8a24.tar.gz opie-51dbf76486cb81a7cb34c07483b344c8ea7a8a24.tar.bz2 |
buttonbar added
Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index f0130e1..b813442 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -19,24 +19,25 @@ | |||
19 | #include "profileeditordialog.h" | 19 | #include "profileeditordialog.h" |
20 | #include "configdialog.h" | 20 | #include "configdialog.h" |
21 | #include "default.h" | 21 | #include "default.h" |
22 | #include "metafactory.h" | 22 | #include "metafactory.h" |
23 | #include "profile.h" | 23 | #include "profile.h" |
24 | #include "profilemanager.h" | 24 | #include "profilemanager.h" |
25 | #include "mainwindow.h" | 25 | #include "mainwindow.h" |
26 | #include "tabwidget.h" | 26 | #include "tabwidget.h" |
27 | #include "transferdialog.h" | 27 | #include "transferdialog.h" |
28 | #include "function_keyboard.h" | 28 | #include "function_keyboard.h" |
29 | #include "emulation_handler.h" | 29 | #include "emulation_handler.h" |
30 | #include "script.h" | 30 | #include "script.h" |
31 | #include "quick_button.h" | ||
31 | 32 | ||
32 | 33 | ||
33 | 34 | ||
34 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 35 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
35 | KeyTrans::loadAll(); | 36 | KeyTrans::loadAll(); |
36 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 37 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
37 | KeyTrans* s = KeyTrans::find(i ); | 38 | KeyTrans* s = KeyTrans::find(i ); |
38 | assert( s ); | 39 | assert( s ); |
39 | } | 40 | } |
40 | m_factory = new MetaFactory(); | 41 | m_factory = new MetaFactory(); |
41 | Default def(m_factory); | 42 | Default def(m_factory); |
42 | m_sessions.setAutoDelete( TRUE ); | 43 | m_sessions.setAutoDelete( TRUE ); |
@@ -163,47 +164,69 @@ void MainWindow::initUI() { | |||
163 | */ | 164 | */ |
164 | m_openKeys = new QAction (tr("Open Keyboard..."), | 165 | m_openKeys = new QAction (tr("Open Keyboard..."), |
165 | Resource::loadPixmap( "down" ), | 166 | Resource::loadPixmap( "down" ), |
166 | QString::null, 0, this, 0); | 167 | QString::null, 0, this, 0); |
167 | 168 | ||
168 | m_openKeys->setToggleAction(true); | 169 | m_openKeys->setToggleAction(true); |
169 | 170 | ||
170 | connect (m_openKeys, SIGNAL(toggled(bool)), | 171 | connect (m_openKeys, SIGNAL(toggled(bool)), |
171 | this, SLOT(slotOpenKeb(bool))); | 172 | this, SLOT(slotOpenKeb(bool))); |
172 | m_openKeys->addTo(m_icons); | 173 | m_openKeys->addTo(m_icons); |
173 | 174 | ||
174 | 175 | ||
176 | /* | ||
177 | * action that open/closes the keyboard | ||
178 | */ | ||
179 | m_openButtons = new QAction ( tr( "Open Buttons..." ), | ||
180 | Resource::loadPixmap( "down" ), | ||
181 | QString::null, 0, this, 0 ); | ||
182 | |||
183 | m_openButtons->setToggleAction( true ); | ||
184 | |||
185 | connect ( m_openButtons, SIGNAL( toggled( bool ) ), | ||
186 | this, SLOT( slotOpenButtons( bool ) ) ); | ||
187 | m_openButtons->addTo( m_icons ); | ||
188 | |||
189 | |||
175 | /* insert the submenu */ | 190 | /* insert the submenu */ |
176 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 191 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
177 | -1, 0); | 192 | -1, 0); |
178 | 193 | ||
179 | /* insert the connection menu */ | 194 | /* insert the connection menu */ |
180 | m_bar->insertItem( tr("Connection"), m_console ); | 195 | m_bar->insertItem( tr("Connection"), m_console ); |
181 | 196 | ||
182 | /* the scripts menu */ | 197 | /* the scripts menu */ |
183 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 198 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
184 | 199 | ||
185 | /* the settings menu */ | 200 | /* the settings menu */ |
186 | // m_bar->insertItem( tr("Settings"), m_settings ); | 201 | // m_bar->insertItem( tr("Settings"), m_settings ); |
187 | 202 | ||
188 | /* and the keyboard */ | 203 | /* and the keyboard */ |
189 | m_keyBar = new QToolBar(this); | 204 | m_keyBar = new QToolBar(this); |
190 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 205 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
191 | m_keyBar->setHorizontalStretchable( TRUE ); | 206 | m_keyBar->setHorizontalStretchable( TRUE ); |
192 | m_keyBar->hide(); | 207 | m_keyBar->hide(); |
193 | 208 | ||
194 | m_kb = new FunctionKeyboard(m_keyBar); | 209 | m_kb = new FunctionKeyboard(m_keyBar); |
195 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), | 210 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), |
196 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); | 211 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); |
197 | 212 | ||
213 | m_buttonBar = new QToolBar( this ); | ||
214 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); | ||
215 | m_buttonBar->setHorizontalStretchable( TRUE ); | ||
216 | m_buttonBar->hide(); | ||
217 | |||
218 | m_qb = new QuickButton( m_buttonBar ); | ||
219 | connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), | ||
220 | this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); | ||
198 | 221 | ||
199 | 222 | ||
200 | m_connect->setEnabled( false ); | 223 | m_connect->setEnabled( false ); |
201 | m_disconnect->setEnabled( false ); | 224 | m_disconnect->setEnabled( false ); |
202 | m_terminate->setEnabled( false ); | 225 | m_terminate->setEnabled( false ); |
203 | m_transfer->setEnabled( false ); | 226 | m_transfer->setEnabled( false ); |
204 | m_recordScript->setEnabled( false ); | 227 | m_recordScript->setEnabled( false ); |
205 | m_saveScript->setEnabled( false ); | 228 | m_saveScript->setEnabled( false ); |
206 | m_runScript->setEnabled( false ); | 229 | m_runScript->setEnabled( false ); |
207 | m_fullscreen->setEnabled( false ); | 230 | m_fullscreen->setEnabled( false ); |
208 | m_closewindow->setEnabled( false ); | 231 | m_closewindow->setEnabled( false ); |
209 | 232 | ||
@@ -422,24 +445,37 @@ void MainWindow::slotTransfer() | |||
422 | dlg.showMaximized(); | 445 | dlg.showMaximized(); |
423 | dlg.exec(); | 446 | dlg.exec(); |
424 | } | 447 | } |
425 | } | 448 | } |
426 | 449 | ||
427 | 450 | ||
428 | void MainWindow::slotOpenKeb(bool state) { | 451 | void MainWindow::slotOpenKeb(bool state) { |
429 | 452 | ||
430 | if (state) m_keyBar->show(); | 453 | if (state) m_keyBar->show(); |
431 | else m_keyBar->hide(); | 454 | else m_keyBar->hide(); |
432 | 455 | ||
433 | } | 456 | } |
457 | |||
458 | |||
459 | void MainWindow::slotOpenButtons( bool state ) { | ||
460 | |||
461 | if ( state ) { | ||
462 | m_buttonBar->show(); | ||
463 | } else { | ||
464 | m_buttonBar->hide(); | ||
465 | } | ||
466 | } | ||
467 | |||
468 | |||
469 | |||
434 | void MainWindow::slotSessionChanged( Session* ses ) { | 470 | void MainWindow::slotSessionChanged( Session* ses ) { |
435 | qWarning("changed!"); | 471 | qWarning("changed!"); |
436 | if ( ses ) { | 472 | if ( ses ) { |
437 | m_curSession = ses; | 473 | m_curSession = ses; |
438 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | 474 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); |
439 | if ( m_curSession->layer()->isConnected() ) { | 475 | if ( m_curSession->layer()->isConnected() ) { |
440 | m_connect->setEnabled( false ); | 476 | m_connect->setEnabled( false ); |
441 | m_disconnect->setEnabled( true ); | 477 | m_disconnect->setEnabled( true ); |
442 | } else { | 478 | } else { |
443 | m_connect->setEnabled( true ); | 479 | m_connect->setEnabled( true ); |
444 | m_disconnect->setEnabled( false ); | 480 | m_disconnect->setEnabled( false ); |
445 | } | 481 | } |