Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 101 |
1 files changed, 83 insertions, 18 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 @@ #include <assert.h> #include <qaction.h> #include <qmenubar.h> #include <qlabel.h> #include <qpopupmenu.h> #include <qtoolbar.h> #include <qmessagebox.h> +#include <qpushbutton.h> #include <qpe/resource.h> #include <opie/ofiledialog.h> #include "keytrans.h" #include "profileeditordialog.h" #include "configdialog.h" #include "default.h" #include "metafactory.h" #include "profile.h" #include "profilemanager.h" #include "mainwindow.h" #include "tabwidget.h" #include "transferdialog.h" #include "function_keyboard.h" #include "script.h" + + +static char * menu_xpm[] = { +"12 12 5 1", +" c None", +". c #000000", +"+ c #FFFDAD", +"@ c #FFFF00", +"# c #E5E100", +" ", +" ", +" ......... ", +" .+++++++. ", +" .+@@@@#. ", +" .+@@@#. ", +" .+@@#. ", +" .+@#. ", +" .+#. ", +" .+. ", +" .. ", +" "}; + + MainWindow::MainWindow() { KeyTrans::loadAll(); for (int i = 0; i < KeyTrans::count(); i++ ) { KeyTrans* s = KeyTrans::find(i ); assert( s ); } m_factory = new MetaFactory(); Default def(m_factory); m_sessions.setAutoDelete( TRUE ); m_curSession = 0; m_manager = new ProfileManager( m_factory ); m_manager->load(); @@ -84,37 +108,50 @@ void MainWindow::initUI() { m_disconnect = new QAction(); m_disconnect->setText( tr("Disconnect") ); m_disconnect->addTo( m_console ); connect(m_disconnect, SIGNAL(activated() ), this, SLOT(slotDisconnect() ) ); m_transfer = new QAction(); m_transfer->setText( tr("Transfer file...") ); m_transfer->addTo( m_console ); connect(m_transfer, SIGNAL(activated() ), this, SLOT(slotTransfer() ) ); + + /* + * fullscreen + */ + m_isFullscreen = false; + + m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) + , QString::null, 0, this, 0); + m_fullscreen->addTo( m_console ); + m_fullscreen->addTo( m_icons ); + connect( m_fullscreen, SIGNAL( activated() ), + this, SLOT( slotFullscreen() ) ); + /* * terminate action */ m_terminate = new QAction(); m_terminate->setText( tr("Terminate") ); m_terminate->addTo( m_console ); connect(m_terminate, SIGNAL(activated() ), this, SLOT(slotTerminate() ) ); - a = new QAction(); - a->setText( tr("Close Window") ); - a->addTo( m_console ); - connect(a, SIGNAL(activated() ), + m_closewindow = new QAction(); + m_closewindow->setText( tr("Close Window") ); + m_closewindow->addTo( m_console ); + connect( m_closewindow, SIGNAL(activated() ), this, SLOT(slotClose() ) ); /* * the settings action */ m_setProfiles = new QAction(tr("Configure Profiles"), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0); m_setProfiles->addTo( m_settings ); m_setProfiles->addTo( m_icons ); connect( m_setProfiles, SIGNAL(activated() ), this, SLOT(slotConfigure() ) ); @@ -169,24 +206,26 @@ void MainWindow::initUI() { m_kb = new FunctionKeyboard(m_keyBar); m_connect->setEnabled( false ); m_disconnect->setEnabled( false ); m_terminate->setEnabled( false ); m_transfer->setEnabled( false ); m_recordScript->setEnabled( false ); m_saveScript->setEnabled( false ); m_runScript->setEnabled( false ); + m_fullscreen->setEnabled( false ); + m_closewindow->setEnabled( false ); /* * connect to the menu activation */ connect( m_sessionsPop, SIGNAL(activated( int ) ), this, SLOT(slotProfile( int ) ) ); m_consoleWindow = new TabWidget( this, "blah"); connect(m_consoleWindow, SIGNAL(activated(Session*) ), this, SLOT(slotSessionChanged(Session*) ) ); setCentralWidget( m_consoleWindow ); @@ -316,24 +355,36 @@ void MainWindow::slotConfigure() { * and set the currentSession() */ void MainWindow::slotClose() { qWarning("close"); if (!currentSession() ) return; tabWidget()->remove( currentSession() ); /*it's autodelete */ m_sessions.remove( m_curSession ); m_curSession = m_sessions.first(); tabWidget()->setCurrent( m_curSession ); + + if (!currentSession() ) { + m_connect->setEnabled( false ); + m_disconnect->setEnabled( false ); + m_terminate->setEnabled( false ); + m_transfer->setEnabled( false ); + m_recordScript->setEnabled( false ); + m_saveScript->setEnabled( false ); + m_runScript->setEnabled( false ); + m_fullscreen->setEnabled( false ); + m_closewindow->setEnabled( false ); + } } /* * We will get the name * Then the profile * and then we will make a profile */ void MainWindow::slotProfile( int id) { Profile prof = manager()->profile( m_sessionsPop->text( id) ); create( prof ); } void MainWindow::create( const Profile& prof ) { @@ -343,34 +394,34 @@ void MainWindow::create( const Profile& prof ) { { QMessageBox::warning(this, QObject::tr("Session failed"), QObject::tr("Cannot open session: Not all components were found.")); //if(ses) delete ses; return; } m_sessions.append( ses ); tabWidget()->add( ses ); m_curSession = ses; - // dicide if its a local term ( then no connction and no tranfer) + // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it m_connect->setEnabled( true ); m_disconnect->setEnabled( true ); m_terminate->setEnabled( true ); m_transfer->setEnabled( true ); m_recordScript->setEnabled( true ); m_saveScript->setEnabled( true ); m_runScript->setEnabled( true ); - - + m_fullscreen->setEnabled( true ); + m_closewindow->setEnabled( true ); } void MainWindow::slotTransfer() { // if ( currentSession() ) { TransferDialog dlg(this); dlg.showMaximized(); dlg.exec(); // } } @@ -378,26 +429,40 @@ void MainWindow::slotOpenKeb(bool state) { if (state) m_keyBar->show(); else m_keyBar->hide(); } void MainWindow::slotSessionChanged( Session* ses ) { if ( ses ) { qWarning("changing %s", ses->name().latin1() ); m_curSession = ses; } } -void MainWindow::setOn() { - -/* - m_connect - m_disconnect - m_terminate - m_transfer - m_recordScript - m_saveScript - m_runScript -*/ +void MainWindow::slotFullscreen() { + if ( m_isFullscreen ) { + ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); + ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); + setCentralWidget( m_consoleWindow ); + ( m_curSession->widgetStack() )->show(); + m_fullscreen->setText( tr("Full screen") ); + + } else { + ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); + ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, + QPoint(0,0), false); + ( m_curSession->widgetStack() )->resize(qApp->desktop()->width(), qApp->desktop()->height()); + ( m_curSession->widgetStack() )->setFocus(); + ( m_curSession->widgetStack() )->show(); + + // QPushButton *cornerButton = new QPushButton( this ); + //cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); + //connect( cornerButton, SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); + // need teh scrollbar + // ( m_curSession->widgetStack() )->setCornerWidget( cornerButton ); + m_fullscreen->setText( tr("Stop full screen") ); + } + + m_isFullscreen = !m_isFullscreen; } |