-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 101 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 7 |
2 files changed, 88 insertions, 20 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 89cdf51..6dc9e6e 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -5,12 +5,13 @@ | |||
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | #include <qmenubar.h> | 6 | #include <qmenubar.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qpopupmenu.h> | 8 | #include <qpopupmenu.h> |
9 | #include <qtoolbar.h> | 9 | #include <qtoolbar.h> |
10 | #include <qmessagebox.h> | 10 | #include <qmessagebox.h> |
11 | #include <qpushbutton.h> | ||
11 | 12 | ||
12 | #include <qpe/resource.h> | 13 | #include <qpe/resource.h> |
13 | #include <opie/ofiledialog.h> | 14 | #include <opie/ofiledialog.h> |
14 | 15 | ||
15 | 16 | ||
16 | #include "keytrans.h" | 17 | #include "keytrans.h" |
@@ -23,12 +24,35 @@ | |||
23 | #include "mainwindow.h" | 24 | #include "mainwindow.h" |
24 | #include "tabwidget.h" | 25 | #include "tabwidget.h" |
25 | #include "transferdialog.h" | 26 | #include "transferdialog.h" |
26 | #include "function_keyboard.h" | 27 | #include "function_keyboard.h" |
27 | #include "script.h" | 28 | #include "script.h" |
28 | 29 | ||
30 | |||
31 | |||
32 | static char * menu_xpm[] = { | ||
33 | "12 12 5 1", | ||
34 | " c None", | ||
35 | ".c #000000", | ||
36 | "+c #FFFDAD", | ||
37 | "@c #FFFF00", | ||
38 | "#c #E5E100", | ||
39 | " ", | ||
40 | " ", | ||
41 | " ......... ", | ||
42 | " .+++++++. ", | ||
43 | " .+@@@@#. ", | ||
44 | " .+@@@#. ", | ||
45 | " .+@@#. ", | ||
46 | " .+@#. ", | ||
47 | " .+#. ", | ||
48 | " .+. ", | ||
49 | " .. ", | ||
50 | " "}; | ||
51 | |||
52 | |||
29 | MainWindow::MainWindow() { | 53 | MainWindow::MainWindow() { |
30 | KeyTrans::loadAll(); | 54 | KeyTrans::loadAll(); |
31 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 55 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
32 | KeyTrans* s = KeyTrans::find(i ); | 56 | KeyTrans* s = KeyTrans::find(i ); |
33 | assert( s ); | 57 | assert( s ); |
34 | } | 58 | } |
@@ -90,25 +114,38 @@ void MainWindow::initUI() { | |||
90 | m_transfer = new QAction(); | 114 | m_transfer = new QAction(); |
91 | m_transfer->setText( tr("Transfer file...") ); | 115 | m_transfer->setText( tr("Transfer file...") ); |
92 | m_transfer->addTo( m_console ); | 116 | m_transfer->addTo( m_console ); |
93 | connect(m_transfer, SIGNAL(activated() ), | 117 | connect(m_transfer, SIGNAL(activated() ), |
94 | this, SLOT(slotTransfer() ) ); | 118 | this, SLOT(slotTransfer() ) ); |
95 | 119 | ||
120 | |||
121 | /* | ||
122 | * fullscreen | ||
123 | */ | ||
124 | m_isFullscreen = false; | ||
125 | |||
126 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | ||
127 | , QString::null, 0, this, 0); | ||
128 | m_fullscreen->addTo( m_console ); | ||
129 | m_fullscreen->addTo( m_icons ); | ||
130 | connect( m_fullscreen, SIGNAL( activated() ), | ||
131 | this, SLOT( slotFullscreen() ) ); | ||
132 | |||
96 | /* | 133 | /* |
97 | * terminate action | 134 | * terminate action |
98 | */ | 135 | */ |
99 | m_terminate = new QAction(); | 136 | m_terminate = new QAction(); |
100 | m_terminate->setText( tr("Terminate") ); | 137 | m_terminate->setText( tr("Terminate") ); |
101 | m_terminate->addTo( m_console ); | 138 | m_terminate->addTo( m_console ); |
102 | connect(m_terminate, SIGNAL(activated() ), | 139 | connect(m_terminate, SIGNAL(activated() ), |
103 | this, SLOT(slotTerminate() ) ); | 140 | this, SLOT(slotTerminate() ) ); |
104 | 141 | ||
105 | a = new QAction(); | 142 | m_closewindow = new QAction(); |
106 | a->setText( tr("Close Window") ); | 143 | m_closewindow->setText( tr("Close Window") ); |
107 | a->addTo( m_console ); | 144 | m_closewindow->addTo( m_console ); |
108 | connect(a, SIGNAL(activated() ), | 145 | connect( m_closewindow, SIGNAL(activated() ), |
109 | this, SLOT(slotClose() ) ); | 146 | this, SLOT(slotClose() ) ); |
110 | 147 | ||
111 | /* | 148 | /* |
112 | * the settings action | 149 | * the settings action |
113 | */ | 150 | */ |
114 | m_setProfiles = new QAction(tr("Configure Profiles"), | 151 | m_setProfiles = new QAction(tr("Configure Profiles"), |
@@ -175,12 +212,14 @@ void MainWindow::initUI() { | |||
175 | m_disconnect->setEnabled( false ); | 212 | m_disconnect->setEnabled( false ); |
176 | m_terminate->setEnabled( false ); | 213 | m_terminate->setEnabled( false ); |
177 | m_transfer->setEnabled( false ); | 214 | m_transfer->setEnabled( false ); |
178 | m_recordScript->setEnabled( false ); | 215 | m_recordScript->setEnabled( false ); |
179 | m_saveScript->setEnabled( false ); | 216 | m_saveScript->setEnabled( false ); |
180 | m_runScript->setEnabled( false ); | 217 | m_runScript->setEnabled( false ); |
218 | m_fullscreen->setEnabled( false ); | ||
219 | m_closewindow->setEnabled( false ); | ||
181 | 220 | ||
182 | /* | 221 | /* |
183 | * connect to the menu activation | 222 | * connect to the menu activation |
184 | */ | 223 | */ |
185 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 224 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
186 | this, SLOT(slotProfile( int ) ) ); | 225 | this, SLOT(slotProfile( int ) ) ); |
@@ -322,12 +361,24 @@ void MainWindow::slotClose() { | |||
322 | 361 | ||
323 | tabWidget()->remove( currentSession() ); | 362 | tabWidget()->remove( currentSession() ); |
324 | /*it's autodelete */ | 363 | /*it's autodelete */ |
325 | m_sessions.remove( m_curSession ); | 364 | m_sessions.remove( m_curSession ); |
326 | m_curSession = m_sessions.first(); | 365 | m_curSession = m_sessions.first(); |
327 | tabWidget()->setCurrent( m_curSession ); | 366 | tabWidget()->setCurrent( m_curSession ); |
367 | |||
368 | if (!currentSession() ) { | ||
369 | m_connect->setEnabled( false ); | ||
370 | m_disconnect->setEnabled( false ); | ||
371 | m_terminate->setEnabled( false ); | ||
372 | m_transfer->setEnabled( false ); | ||
373 | m_recordScript->setEnabled( false ); | ||
374 | m_saveScript->setEnabled( false ); | ||
375 | m_runScript->setEnabled( false ); | ||
376 | m_fullscreen->setEnabled( false ); | ||
377 | m_closewindow->setEnabled( false ); | ||
378 | } | ||
328 | } | 379 | } |
329 | 380 | ||
330 | /* | 381 | /* |
331 | * We will get the name | 382 | * We will get the name |
332 | * Then the profile | 383 | * Then the profile |
333 | * and then we will make a profile | 384 | * and then we will make a profile |
@@ -349,22 +400,22 @@ void MainWindow::create( const Profile& prof ) { | |||
349 | } | 400 | } |
350 | 401 | ||
351 | m_sessions.append( ses ); | 402 | m_sessions.append( ses ); |
352 | tabWidget()->add( ses ); | 403 | tabWidget()->add( ses ); |
353 | m_curSession = ses; | 404 | m_curSession = ses; |
354 | 405 | ||
355 | // dicide if its a local term ( then no connction and no tranfer) | 406 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
356 | m_connect->setEnabled( true ); | 407 | m_connect->setEnabled( true ); |
357 | m_disconnect->setEnabled( true ); | 408 | m_disconnect->setEnabled( true ); |
358 | m_terminate->setEnabled( true ); | 409 | m_terminate->setEnabled( true ); |
359 | m_transfer->setEnabled( true ); | 410 | m_transfer->setEnabled( true ); |
360 | m_recordScript->setEnabled( true ); | 411 | m_recordScript->setEnabled( true ); |
361 | m_saveScript->setEnabled( true ); | 412 | m_saveScript->setEnabled( true ); |
362 | m_runScript->setEnabled( true ); | 413 | m_runScript->setEnabled( true ); |
363 | 414 | m_fullscreen->setEnabled( true ); | |
364 | 415 | m_closewindow->setEnabled( true ); | |
365 | } | 416 | } |
366 | 417 | ||
367 | void MainWindow::slotTransfer() | 418 | void MainWindow::slotTransfer() |
368 | { | 419 | { |
369 | // if ( currentSession() ) { | 420 | // if ( currentSession() ) { |
370 | TransferDialog dlg(this); | 421 | TransferDialog dlg(this); |
@@ -384,20 +435,34 @@ void MainWindow::slotSessionChanged( Session* ses ) { | |||
384 | if ( ses ) { | 435 | if ( ses ) { |
385 | qWarning("changing %s", ses->name().latin1() ); | 436 | qWarning("changing %s", ses->name().latin1() ); |
386 | m_curSession = ses; | 437 | m_curSession = ses; |
387 | } | 438 | } |
388 | } | 439 | } |
389 | 440 | ||
390 | void MainWindow::setOn() { | 441 | void MainWindow::slotFullscreen() { |
391 | 442 | ||
392 | /* | 443 | if ( m_isFullscreen ) { |
393 | m_connect | 444 | ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); |
394 | m_disconnect | 445 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
395 | m_terminate | 446 | setCentralWidget( m_consoleWindow ); |
396 | m_transfer | 447 | ( m_curSession->widgetStack() )->show(); |
397 | m_recordScript | 448 | m_fullscreen->setText( tr("Full screen") ); |
398 | m_saveScript | 449 | |
399 | m_runScript | 450 | } else { |
400 | */ | 451 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
452 | ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, | ||
453 | QPoint(0,0), false); | ||
454 | ( m_curSession->widgetStack() )->resize(qApp->desktop()->width(), qApp->desktop()->height()); | ||
455 | ( m_curSession->widgetStack() )->setFocus(); | ||
456 | ( m_curSession->widgetStack() )->show(); | ||
457 | |||
458 | // QPushButton *cornerButton = new QPushButton( this ); | ||
459 | //cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); | ||
460 | //connect( cornerButton, SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | ||
461 | // need teh scrollbar | ||
462 | // ( m_curSession->widgetStack() )->setCornerWidget( cornerButton ); | ||
463 | m_fullscreen->setText( tr("Stop full screen") ); | ||
464 | } | ||
401 | 465 | ||
466 | m_isFullscreen = !m_isFullscreen; | ||
402 | 467 | ||
403 | } | 468 | } |
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index 378870a..e63078a 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h | |||
@@ -54,18 +54,18 @@ private slots: | |||
54 | void slotConnect(); | 54 | void slotConnect(); |
55 | void slotDisconnect(); | 55 | void slotDisconnect(); |
56 | void slotTerminate(); | 56 | void slotTerminate(); |
57 | void slotConfigure(); | 57 | void slotConfigure(); |
58 | void slotClose(); | 58 | void slotClose(); |
59 | void slotProfile(int); | 59 | void slotProfile(int); |
60 | void slotTransfer(); | 60 | void slotTransfer(); |
61 | void slotOpenKeb(bool); | 61 | void slotOpenKeb(bool); |
62 | void slotRecordScript(); | 62 | void slotRecordScript(); |
63 | void slotSaveScript(); | 63 | void slotSaveScript(); |
64 | void slotRunScript(); | 64 | void slotRunScript(); |
65 | void setOn(); | 65 | void slotFullscreen(); |
66 | void slotSessionChanged( Session* ); | 66 | void slotSessionChanged( Session* ); |
67 | private: | 67 | private: |
68 | void initUI(); | 68 | void initUI(); |
69 | void populateProfiles(); | 69 | void populateProfiles(); |
70 | void create( const Profile& ); | 70 | void create( const Profile& ); |
71 | /** | 71 | /** |
@@ -99,12 +99,15 @@ private: | |||
99 | QAction* m_transfer; | 99 | QAction* m_transfer; |
100 | QAction* m_setProfiles; | 100 | QAction* m_setProfiles; |
101 | QAction* m_openKeys; | 101 | QAction* m_openKeys; |
102 | QAction* m_recordScript; | 102 | QAction* m_recordScript; |
103 | QAction* m_saveScript; | 103 | QAction* m_saveScript; |
104 | QAction* m_runScript; | 104 | QAction* m_runScript; |
105 | QAction* m_fullscreen; | ||
106 | QAction* m_closewindow; | ||
105 | 107 | ||
106 | FunctionKeyboard *m_kb; | 108 | FunctionKeyboard *m_kb; |
109 | bool m_isFullscreen; | ||
107 | }; | 110 | }; |
108 | 111 | ||
109 | 112 | ||
110 | #endif | 113 | #endif |