summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-14 23:23:55 (UTC)
committer harlekin <harlekin>2002-10-14 23:23:55 (UTC)
commitc7aed90e02d06502dff04043103c5db0883cc011 (patch) (unidiff)
tree1787c9d92e23474d2e69bb1607ecaf565cac2475
parent91adb54066037522a619ce5d072c2e932901fd74 (diff)
downloadopie-c7aed90e02d06502dff04043103c5db0883cc011.zip
opie-c7aed90e02d06502dff04043103c5db0883cc011.tar.gz
opie-c7aed90e02d06502dff04043103c5db0883cc011.tar.bz2
half way fullscreen done
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp101
-rw-r--r--noncore/apps/opie-console/mainwindow.h7
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
@@ -1,40 +1,64 @@
1#include <assert.h> 1#include <assert.h>
2 2
3 3
4 4
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"
17#include "profileeditordialog.h" 18#include "profileeditordialog.h"
18#include "configdialog.h" 19#include "configdialog.h"
19#include "default.h" 20#include "default.h"
20#include "metafactory.h" 21#include "metafactory.h"
21#include "profile.h" 22#include "profile.h"
22#include "profilemanager.h" 23#include "profilemanager.h"
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
32static 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
29MainWindow::MainWindow() { 53MainWindow::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 }
35 m_factory = new MetaFactory(); 59 m_factory = new MetaFactory();
36 Default def(m_factory); 60 Default def(m_factory);
37 m_sessions.setAutoDelete( TRUE ); 61 m_sessions.setAutoDelete( TRUE );
38 m_curSession = 0; 62 m_curSession = 0;
39 m_manager = new ProfileManager( m_factory ); 63 m_manager = new ProfileManager( m_factory );
40 m_manager->load(); 64 m_manager->load();
@@ -84,37 +108,50 @@ void MainWindow::initUI() {
84 m_disconnect = new QAction(); 108 m_disconnect = new QAction();
85 m_disconnect->setText( tr("Disconnect") ); 109 m_disconnect->setText( tr("Disconnect") );
86 m_disconnect->addTo( m_console ); 110 m_disconnect->addTo( m_console );
87 connect(m_disconnect, SIGNAL(activated() ), 111 connect(m_disconnect, SIGNAL(activated() ),
88 this, SLOT(slotDisconnect() ) ); 112 this, SLOT(slotDisconnect() ) );
89 113
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"),
115 Resource::loadPixmap( "SettingsIcon" ), 152 Resource::loadPixmap( "SettingsIcon" ),
116 QString::null, 0, this, 0); 153 QString::null, 0, this, 0);
117 m_setProfiles->addTo( m_settings ); 154 m_setProfiles->addTo( m_settings );
118 m_setProfiles->addTo( m_icons ); 155 m_setProfiles->addTo( m_icons );
119 connect( m_setProfiles, SIGNAL(activated() ), 156 connect( m_setProfiles, SIGNAL(activated() ),
120 this, SLOT(slotConfigure() ) ); 157 this, SLOT(slotConfigure() ) );
@@ -169,24 +206,26 @@ void MainWindow::initUI() {
169 206
170 m_kb = new FunctionKeyboard(m_keyBar); 207 m_kb = new FunctionKeyboard(m_keyBar);
171 208
172 209
173 210
174 m_connect->setEnabled( false ); 211 m_connect->setEnabled( false );
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 ) ) );
187 226
188 m_consoleWindow = new TabWidget( this, "blah"); 227 m_consoleWindow = new TabWidget( this, "blah");
189 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 228 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
190 this, SLOT(slotSessionChanged(Session*) ) ); 229 this, SLOT(slotSessionChanged(Session*) ) );
191 setCentralWidget( m_consoleWindow ); 230 setCentralWidget( m_consoleWindow );
192 231
@@ -316,24 +355,36 @@ void MainWindow::slotConfigure() {
316 * and set the currentSession() 355 * and set the currentSession()
317 */ 356 */
318void MainWindow::slotClose() { 357void MainWindow::slotClose() {
319 qWarning("close"); 358 qWarning("close");
320 if (!currentSession() ) 359 if (!currentSession() )
321 return; 360 return;
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
334 */ 385 */
335void MainWindow::slotProfile( int id) { 386void MainWindow::slotProfile( int id) {
336 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 387 Profile prof = manager()->profile( m_sessionsPop->text( id) );
337 create( prof ); 388 create( prof );
338} 389}
339void MainWindow::create( const Profile& prof ) { 390void MainWindow::create( const Profile& prof ) {
@@ -343,34 +394,34 @@ void MainWindow::create( const Profile& prof ) {
343 { 394 {
344 QMessageBox::warning(this, 395 QMessageBox::warning(this,
345 QObject::tr("Session failed"), 396 QObject::tr("Session failed"),
346 QObject::tr("Cannot open session: Not all components were found.")); 397 QObject::tr("Cannot open session: Not all components were found."));
347 //if(ses) delete ses; 398 //if(ses) delete ses;
348 return; 399 return;
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
367void MainWindow::slotTransfer() 418void MainWindow::slotTransfer()
368{ 419{
369 // if ( currentSession() ) { 420 // if ( currentSession() ) {
370 TransferDialog dlg(this); 421 TransferDialog dlg(this);
371 dlg.showMaximized(); 422 dlg.showMaximized();
372 dlg.exec(); 423 dlg.exec();
373 // } 424 // }
374} 425}
375 426
376 427
@@ -378,26 +429,40 @@ void MainWindow::slotOpenKeb(bool state) {
378 429
379 if (state) m_keyBar->show(); 430 if (state) m_keyBar->show();
380 else m_keyBar->hide(); 431 else m_keyBar->hide();
381 432
382} 433}
383void MainWindow::slotSessionChanged( Session* ses ) { 434void 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
390void MainWindow::setOn() { 441void 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
@@ -48,30 +48,30 @@ public:
48 */ 48 */
49 ProfileManager* manager(); 49 ProfileManager* manager();
50 TabWidget* tabWidget(); 50 TabWidget* tabWidget();
51 51
52private slots: 52private slots:
53 void slotNew(); 53 void slotNew();
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* );
67private: 67private:
68 void initUI(); 68 void initUI();
69 void populateProfiles(); 69 void populateProfiles();
70 void create( const Profile& ); 70 void create( const Profile& );
71 /** 71 /**
72 * the current session 72 * the current session
73 */ 73 */
74 Session* m_curSession; 74 Session* m_curSession;
75 75
76 /** 76 /**
77 * the session list 77 * the session list
@@ -93,18 +93,21 @@ private:
93 QPopupMenu* m_settings; 93 QPopupMenu* m_settings;
94 QPopupMenu* m_sessionsPop; 94 QPopupMenu* m_sessionsPop;
95 QPopupMenu* m_scripts; 95 QPopupMenu* m_scripts;
96 QAction* m_connect; 96 QAction* m_connect;
97 QAction* m_disconnect; 97 QAction* m_disconnect;
98 QAction* m_terminate; 98 QAction* m_terminate;
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