author | zecke <zecke> | 2004-05-01 21:10:02 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-05-01 21:10:02 (UTC) |
commit | 49227638e76fa71209390a9c42528a02e3803e3d (patch) (side-by-side diff) | |
tree | 3fbbf00962bbb2698e63a196a83fb156443bafd3 | |
parent | 0d4fd8b708eddb609fd3b14ffe7df1cb3a1401f1 (diff) | |
download | opie-49227638e76fa71209390a9c42528a02e3803e3d.zip opie-49227638e76fa71209390a9c42528a02e3803e3d.tar.gz opie-49227638e76fa71209390a9c42528a02e3803e3d.tar.bz2 |
Convert to quicklaunch. Integrate the Sharp ROM fixlet in c'tor and d'tor
of the mainwindow
-rw-r--r-- | noncore/apps/opie-console/fixit.h | 88 | ||||
-rw-r--r-- | noncore/apps/opie-console/main.cpp | 106 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 19 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 4 |
5 files changed, 107 insertions, 111 deletions
diff --git a/noncore/apps/opie-console/fixit.h b/noncore/apps/opie-console/fixit.h new file mode 100644 index 0000000..501914e --- a/dev/null +++ b/noncore/apps/opie-console/fixit.h @@ -0,0 +1,88 @@ +#ifndef FIX_IT_H +#define FIX_IT_H + + +#include <sys/types.h> + +#include <stdio.h> +#include <stdlib.h> +#include <signal.h> +#include <qfile.h> + +/* + * The Zaurus rom + */ +class FixIt { +public: + FixIt(); + ~FixIt(); + void fixIt(); + /* no real interested in implementing it */ + void breakIt() { + + }; + char* m_file; +}; + +FixIt::FixIt() { + /* the new inittab */ + m_file = "#\n# /etc/inittab" +"#" +"" +"# 0 - halt (Do NOT set initdefault to this)" +"# 1 - Single user mode" +"# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)" +"# 3 - Full multiuser mode" +"# 4 - JavaVM(Intent) developer mode" +"# 5 - JavaVM(Intent)" +"# 6 - reboot (Do NOT set initdefault to this)" +"#" +"id:5:initdefault:" +"" +"# Specify things to do when starting" +"si::sysinit:/etc/rc.d/rc.sysinit" +"" +"l0:0:wait:/root/etc/rc.d/rc 0" +"l1:1:wait:/etc/rc.d/rc 1" +"l2:2:wait:/etc/rc.d/rc 2" +"l3:3:wait:/etc/rc.d/rc 3" +"l4:4:wait:/etc/rc.d/rc 4" +"l5:5:wait:/etc/rc.d/rc 5" +"l6:6:wait:/root/etc/rc.d/rc 6" +"" +"# Specify things to do before rebooting" +"um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1" +"sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1" +"" +"# Specify program to run on ttyS0" +"s0:24:respawn:/sbin/getty 9600 ttyS0" +"#pd:5:respawn:/etc/sync/serialctl" +"" +"# Specify program to run on tty1" +"1:2:respawn:/sbin/getty 9600 tty1" +"ln:345:respawn:survive -l 6 /sbin/launch" +"#qt:5:respawn:/sbin/qt" +"" +"# collie sp." +"sy::respawn:/sbin/shsync\n"; + +} +FixIt::~FixIt() { +} +/* + * the retail Zaurus is broken in many ways + * one is that pppd is listening on our port... + * we've to stop it from that and then do kill(SIGHUP,1); + */ +void FixIt::fixIt() { + ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); + QFile file( "/etc/inittab" ); + if ( file.open(IO_WriteOnly | IO_Raw ) ) { + file.writeBlock(m_file,strlen(m_file) ); + } + file.close(); + ::kill( SIGHUP, 1 ); +} + + +#endif diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp index 92921ab..eafc9b2 100644 --- a/noncore/apps/opie-console/main.cpp +++ b/noncore/apps/opie-console/main.cpp @@ -1,110 +1,8 @@ -#include <sys/types.h> - -#include <stdio.h> -#include <stdlib.h> -#include <signal.h> -#include <qfile.h> - -#include <qpe/qpeapplication.h> +#include <opie2/oapplicationfactory.h> #include "mainwindow.h" -// #define FSCKED_DISTRIBUTION 1 -#ifdef FSCKED_DISTRIBUTION -/* - * The Zaurus rom - */ -class FixIt { -public: - FixIt(); - ~FixIt(); - void fixIt(); - /* no real interested in implementing it */ - void breakIt() { - - }; - char* m_file; -}; - -FixIt::FixIt() { - /* the new inittab */ - m_file = "#\n# /etc/inittab" -"#" -"" -"# 0 - halt (Do NOT set initdefault to this)" -"# 1 - Single user mode" -"# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)" -"# 3 - Full multiuser mode" -"# 4 - JavaVM(Intent) developer mode" -"# 5 - JavaVM(Intent)" -"# 6 - reboot (Do NOT set initdefault to this)" -"#" -"id:5:initdefault:" -"" -"# Specify things to do when starting" -"si::sysinit:/etc/rc.d/rc.sysinit" -"" -"l0:0:wait:/root/etc/rc.d/rc 0" -"l1:1:wait:/etc/rc.d/rc 1" -"l2:2:wait:/etc/rc.d/rc 2" -"l3:3:wait:/etc/rc.d/rc 3" -"l4:4:wait:/etc/rc.d/rc 4" -"l5:5:wait:/etc/rc.d/rc 5" -"l6:6:wait:/root/etc/rc.d/rc 6" -"" -"# Specify things to do before rebooting" -"um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1" -"sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1" -"" -"# Specify program to run on ttyS0" -"s0:24:respawn:/sbin/getty 9600 ttyS0" -"#pd:5:respawn:/etc/sync/serialctl" -"" -"# Specify program to run on tty1" -"1:2:respawn:/sbin/getty 9600 tty1" -"ln:345:respawn:survive -l 6 /sbin/launch" -"#qt:5:respawn:/sbin/qt" -"" -"# collie sp." -"sy::respawn:/sbin/shsync\n"; -} -FixIt::~FixIt() { -} -/* - * the retail Zaurus is broken in many ways - * one is that pppd is listening on our port... - * we've to stop it from that and then do kill(SIGHUP,1); - */ -void FixIt::fixIt() { - ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); - QFile file( "/etc/inittab" ); - if ( file.open(IO_WriteOnly | IO_Raw ) ) { - file.writeBlock(m_file,strlen(m_file) ); - } - file.close(); - ::kill( SIGHUP, 1 ); -} -#endif - -int main(int argc, char **argv) { -// too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; - QPEApplication app( argc, argv ); - -#ifdef FSCKED_DISTRIBUTION -// owarn << "fscked" << oendl; - FixIt it; - it.fixIt(); -#endif - MainWindow mw; - mw.setCaption(QObject::tr("Opie Console") ); - app.showMainWidget( &mw ); +OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MainWindow> ); - int ap = app.exec(); -#ifdef FSCKED_DISTRIBUTION - /* should add a signal handler too */ - it.breakIt(); -#endif - return ap; -} diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index b403b4d..b160604 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -1,127 +1,134 @@ #include "TEmulation.h" #include "profileeditordialog.h" #include "configdialog.h" #include "default.h" #include "profilemanager.h" #include "mainwindow.h" #include "tabwidget.h" #include "transferdialog.h" #include "function_keyboard.h" #include "emulation_handler.h" #include "script.h" +#include "fixit.h" /* OPIE */ #include <opie2/odebug.h> #include <opie2/ofiledialog.h> #include <qpe/filemanager.h> using namespace Opie::Core; using namespace Opie::Ui; /* QT */ #include <qaction.h> #include <qmenubar.h> #include <qtoolbar.h> #include <qmessagebox.h> #include <qwhatsthis.h> #include <qfileinfo.h> /* STD */ #include <assert.h> MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { +#ifdef FSCKED_DISTRI + FixIt fix; + fix.fixIt(); +#endif + + setCaption(QObject::tr("Opie Console") ); 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(); m_scriptsData.setAutoDelete(TRUE); initUI(); populateProfiles(); populateScripts(); } void MainWindow::initUI() { setToolBarsMovable( FALSE ); /* tool bar for the menu */ m_tool = new QToolBar( this ); m_tool->setHorizontalStretchable( TRUE ); m_bar = new QMenuBar( m_tool ); m_console = new QPopupMenu( this ); m_scripts = new QPopupMenu( this ); m_sessionsPop= new QPopupMenu( this ); m_scriptsPop = new QPopupMenu( this ); /* add a toolbar for icons */ m_icons = new QToolBar(this); /* * the settings action */ m_setProfiles = new QAction(tr("Configure Profiles"), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0); m_setProfiles->addTo( m_console ); connect( m_setProfiles, SIGNAL(activated() ), this, SLOT(slotConfigure() ) ); m_console->insertSeparator(); /* * new Action for new sessions */ QAction* newCon = new QAction(tr("New Profile"), Resource::loadPixmap( "new" ), QString::null, 0, this, 0); newCon->addTo( m_console ); connect( newCon, SIGNAL(activated() ), this, SLOT(slotNew() ) ); m_console->insertSeparator(); QAction *saveCon = new QAction( tr("Save Profile" ), Resource::loadPixmap( "save" ), QString::null, 0, this, 0 ); saveCon->addTo( m_console ); connect( saveCon, SIGNAL(activated() ), this, SLOT(slotSaveSession() ) ); m_console->insertSeparator(); /* * connect action */ m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), QString::null, 0, this, 0 ); m_connect->addTo( m_console ); connect(m_connect, SIGNAL(activated() ), this, SLOT(slotConnect() ) ); /* * disconnect action */ m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), QString::null, 0, this, 0 ); m_disconnect->addTo( m_console ); connect(m_disconnect, SIGNAL(activated() ), this, SLOT(slotDisconnect() ) ); m_console->insertSeparator(); m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); m_quickLaunch->addTo( m_icons ); connect( m_quickLaunch, SIGNAL( activated() ), this, SLOT( slotQuickLaunch() ) ); QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, 0, this, 0 ); @@ -205,477 +212,481 @@ void MainWindow::initUI() { m_bar->insertItem( tr("Connection"), m_console ); /* the scripts menu */ m_bar->insertItem( tr("Scripts"), m_scripts ); /* and the keyboard */ m_keyBar = new QToolBar(this); addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); m_keyBar->setHorizontalStretchable( TRUE ); m_keyBar->hide(); m_kb = new FunctionKeyboard(m_keyBar); connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool))); a = new QAction(tr("Copy"), Resource::loadPixmap("copy"), QString::null, 0, this, 0 ); //a->addTo( m_icons ); connect( a, SIGNAL(activated() ), this, SLOT(slotCopy() ) ); QAction *paste = new QAction(tr("Paste"), Resource::loadPixmap("paste"), QString::null, 0, this, 0 ); connect( paste, SIGNAL(activated() ), this, SLOT(slotPaste() ) ); newCon->addTo( m_icons ); //m_setProfiles->addTo( m_icons ); paste->addTo( m_icons ); m_openKeys->addTo(m_icons); m_fullscreen->addTo( m_icons ); m_connect->setEnabled( false ); m_disconnect->setEnabled( false ); m_terminate->setEnabled( false ); m_transfer->setEnabled( false ); m_scripts->setItemEnabled(m_runScript_id, false); m_recordScript->setEnabled( false ); m_saveScript->setEnabled( false ); m_fullscreen->setEnabled( false ); m_closewindow->setEnabled( false ); m_wrap->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 ); slotQuickLaunch(); } ProfileManager* MainWindow::manager() { return m_manager; } TabWidget* MainWindow::tabWidget() { return m_consoleWindow; } void MainWindow::populateProfiles() { m_sessionsPop->clear(); Profile::ValueList list = manager()->all(); for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { m_sessionsPop->insertItem( (*it).name() ); } } void MainWindow::populateScripts() { m_scriptsPop->clear(); m_scriptsData.clear(); DocLnkSet files(QPEApplication::documentDir(), "text/plain"); QListIterator<DocLnk> dit(files.children()); for (; dit.current(); ++dit) { if (*dit && (*dit)->name().length()>0) { QFileInfo info((*dit)->file()); if (info.extension(false) == "script") { m_scriptsData.append(new DocLnk(**dit)); m_scriptsPop->insertItem((*dit)->name()); } } } } MainWindow::~MainWindow() { delete m_factory; manager()->save(); +#ifdef FSCKED_DISTRI + FixIt fix; + fix.breakIt(); +#endif } MetaFactory* MainWindow::factory() { return m_factory; } Session* MainWindow::currentSession() { return m_curSession; } QList<Session> MainWindow::sessions() { return m_sessions; } void MainWindow::slotNew() { ProfileEditorDialog dlg(factory() ); dlg.setCaption( tr("New Connection") ); int ret = QPEApplication::execDialog( &dlg ); if ( ret == QDialog::Accepted ) { create( dlg.profile() ); } } void MainWindow::slotRecordScript() { if (currentSession()) { currentSession()->emulationHandler()->startRecording(); m_saveScript->setEnabled(true); m_recordScript->setEnabled(false); } } void MainWindow::slotSaveScript() { if (currentSession() && currentSession()->emulationHandler()->isRecording()) { QMap<QString, QStringList> map; QStringList text; text << "text/plain"; map.insert(tr("Script"), text ); QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); if (!filename.isEmpty()) { QFileInfo info(filename); if (info.extension(FALSE) != "script") filename += ".script"; DocLnk nf; nf.setType("text/plain"); nf.setFile(filename); nf.setName(info.fileName()); FileManager fm; fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); currentSession()->emulationHandler()->clearScript(); m_saveScript->setEnabled(false); m_recordScript->setEnabled(true); populateScripts(); } } } void MainWindow::slotRunScript(int id) { if (currentSession()) { int index = m_scriptsPop->indexOf(id); DocLnk *lnk = m_scriptsData.at(index); QString filePath = lnk->file(); Script script(filePath); currentSession()->emulationHandler()->runScript(&script); } } void MainWindow::slotConnect() { if ( currentSession() ) { bool ret = currentSession()->layer()->open(); if(!ret) QMessageBox::warning(currentSession()->widgetStack(), QObject::tr("Failed"), QObject::tr("Connecting failed for this session.")); else { m_connect->setEnabled( false ); m_disconnect->setEnabled( true ); // if it does not support file transfer, disable the menu entry if ( ( m_curSession->layer() )->supports()[1] == 0 ) { m_transfer->setEnabled( false ); } else { m_transfer->setEnabled( true ); } m_recordScript->setEnabled( true ); m_scripts->setItemEnabled(m_runScript_id, true); } } } void MainWindow::slotDisconnect() { if ( currentSession() ) { currentSession()->layer()->close(); m_connect->setEnabled( true ); m_disconnect->setEnabled( false ); m_transfer->setEnabled( false ); m_recordScript->setEnabled( false); m_saveScript->setEnabled( false ); m_scripts->setItemEnabled(m_runScript_id, false); } } void MainWindow::slotTerminate() { if ( currentSession() ) currentSession()->layer()->close(); slotClose(); /* FIXME move to the next session */ } void MainWindow::slotQuickLaunch() { Profile prof = manager()->profile( "default" ); if ( prof.name() == "default" ) { create( prof ); } else { Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 ); newProf.setAutoConnect( true ); create( newProf ); slotSaveSession(); } } void MainWindow::slotConfigure() { ConfigDialog conf( manager()->all(), factory() ); int ret = QPEApplication::execDialog( &conf ); if ( QDialog::Accepted == ret ) { manager()->setProfiles( conf.list() ); manager()->save(); populateProfiles(); } } /* * we will remove * this window from the tabwidget * remove it from the list * delete it * and set the currentSession() */ void MainWindow::slotClose() { if (!currentSession() ) return; Session* ses = currentSession(); - owarn << "removing! currentSession " << currentSession()->name().latin1() << "" << oendl; + owarn << "removing! currentSession " << currentSession()->name().latin1() << "" << oendl; /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ m_curSession = NULL; tabWidget()->remove( /*currentSession()*/ses ); /*it's autodelete */ m_sessions.remove( ses ); - owarn << "after remove!!" << oendl; + owarn << "after remove!!" << oendl; 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_scripts->setItemEnabled(m_runScript_id, false); m_fullscreen->setEnabled( false ); m_wrap->setEnabled( false ); m_closewindow->setEnabled( false ); } m_kb->loadDefaults(); } /* * 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 ) { if(m_curSession) if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); Session *ses = manager()->fromProfile( prof, tabWidget() ); if((!ses) || (!ses->layer()) || (!ses->widgetStack())) { QMessageBox::warning(this, QObject::tr("Session failed"), QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); //if(ses) delete ses; return; } m_sessions.append( ses ); tabWidget()->add( ses ); tabWidget()->repaint(); m_curSession = ses; // 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( false ); m_terminate->setEnabled( true ); m_fullscreen->setEnabled( true ); m_wrap->setEnabled( true ); m_closewindow->setEnabled( true ); m_transfer->setEnabled( false ); m_recordScript->setEnabled( false ); m_saveScript->setEnabled( false ); m_scripts->setItemEnabled(m_runScript_id, false); // is io_layer wants direct connection, then autoconnect //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { if (prof.autoConnect()) { slotConnect(); } QWidget *w = currentSession()->widget(); if(w) w->setFocus(); if(currentSession()->profile().readNumEntry("Wrap", 80)){ m_isWrapped = true; } else { m_isWrapped = false; } m_kb->load(currentSession()->profile()); } void MainWindow::slotTransfer() { if ( currentSession() ) { Session *mysession = currentSession(); TransferDialog dlg(/*mysession->widgetStack()*/this, this); mysession->setTransferDialog(&dlg); //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); //dlg.showMaximized(); currentSession()->widgetStack()->addWidget(&dlg, -1); dlg.show(); //dlg.exec(); while(dlg.isRunning()) qApp->processEvents(); mysession->setTransferDialog(0l); } } void MainWindow::slotOpenKeb(bool state) { if (state) m_keyBar->show(); else m_keyBar->hide(); } void MainWindow::slotOpenButtons( bool state ) { if ( state ) { m_buttonBar->show(); } else { m_buttonBar->hide(); } } void MainWindow::slotSessionChanged( Session* ses ) { - owarn << "changed!" << oendl; + owarn << "changed!" << oendl; if(m_curSession) if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); if(ses) if(ses->transferDialog()) ses->transferDialog()->show(); if ( ses ) { m_curSession = ses; - odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl; + odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl; if ( m_curSession->layer()->isConnected() ) { m_connect->setEnabled( false ); m_disconnect->setEnabled( true ); m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); m_scripts->setItemEnabled(m_runScript_id, true); } else { m_connect->setEnabled( true ); m_disconnect->setEnabled( false ); m_recordScript->setEnabled( false ); m_saveScript->setEnabled( false ); m_scripts->setItemEnabled(m_runScript_id, false); } if ( ( m_curSession->layer() )->supports()[1] == 0 ) { m_transfer->setEnabled( false ); } else { m_transfer->setEnabled( true ); } QWidget *w = m_curSession->widget(); if(w) w->setFocus(); if(currentSession()->profile().readNumEntry("Wrap", 80)){ m_isWrapped = true; } else { m_isWrapped = false; } m_kb->load(currentSession()->profile()); } } void MainWindow::slotWrap() { if(m_curSession) { EmulationHandler *e = m_curSession->emulationHandler(); if(e) { if(m_isWrapped) { e->setWrap(80); m_isWrapped = false; } else { e->setWrap(0); m_isWrapped = true; } } } } void MainWindow::slotFullscreen() { if ( m_isFullscreen ) { ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); ( m_curSession->emulationHandler() )->cornerButton()->hide(); disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); } else { savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); ( 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(); ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); } m_isFullscreen = !m_isFullscreen; } void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { if ( m_curSession ) { QEvent::Type state; if (pressed) state = QEvent::KeyPress; else state = QEvent::KeyRelease; QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); // is this the best way to do this? cant figure out any other way to work QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); ke.ignore(); diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index 86939c1..b1f175a 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h @@ -1,126 +1,127 @@ #ifndef OPIE_MAIN_WINDOW_H #define OPIE_MAIN_WINDOW_H #include <qmainwindow.h> #include <qlist.h> #include "session.h" /** * this is the MainWindow of the new opie console * it's also the dispatcher between the different * actions supported by the gui */ class QToolBar; class QToolButton; class QMenuBar; class QAction; class MetaFactory; class TabWidget; class ProfileManager; class Profile; class FunctionKeyboard; class FKey; class DocLnk; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); ~MainWindow(); + static QString appName() {return QString::fromLatin1("console"); } /** * our factory to generate IOLayer and so on * */ MetaFactory* factory(); /** * A session contains a QWidget*, * an IOLayer* and some infos for us */ Session* currentSession(); /** * the session list */ QList<Session> sessions(); /** * */ ProfileManager* manager(); TabWidget* tabWidget(); private slots: void slotNew(); void slotConnect(); void slotDisconnect(); void slotTerminate(); void slotConfigure(); void slotClose(); void slotProfile(int); void slotTransfer(); void slotOpenKeb(bool); void slotOpenButtons(bool); void slotRecordScript(); void slotSaveScript(); void slotRunScript(int); void slotFullscreen(); void slotQuickLaunch(); void slotWrap(); void slotSessionChanged( Session* ); void slotKeyReceived(FKey, ushort, ushort, bool); void slotSaveHistory(); /* what could these both slot do? */ void slotCopy(); void slotPaste(); /* save the currentSession() to Profiles */ void slotSaveSession(); private: void initUI(); void populateProfiles(); void populateScripts(); void create( const Profile& ); /** * the current session */ Session* m_curSession; /** * the session list */ QList<Session> m_sessions; QList<DocLnk> m_scriptsData; /** * the metafactory */ MetaFactory* m_factory; ProfileManager* m_manager; TabWidget* m_consoleWindow; QToolBar* m_tool; QToolBar* m_icons; QToolBar* m_keyBar; QToolBar* m_buttonBar; QMenuBar* m_bar; QPopupMenu* m_console; QPopupMenu* m_sessionsPop; QPopupMenu* m_scriptsPop; QPopupMenu* m_scripts; QAction* m_connect; QAction* m_disconnect; QAction* m_quickLaunch; QAction* m_terminate; QAction* m_transfer; QAction* m_setProfiles; QAction* m_openKeys; QAction* m_openButtons; QAction* m_recordScript; QAction* m_saveScript; QAction* m_fullscreen; QAction* m_wrap; diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index 8268b01..baa5a55 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro @@ -1,74 +1,72 @@ -TEMPLATE = app -CONFIG += qt warn_on -DESTDIR = $(OPIEDIR)/bin +CONFIG += qt warn_on quick-app HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ file_layer.h filetransfer.h \ metafactory.h \ session.h \ mainwindow.h \ profile.h \ profileconfig.h \ profilemanager.h \ tabwidget.h \ configdialog.h \ keytrans.h \ transferdialog.h \ profiledialogwidget.h \ profileeditordialog.h \ default.h \ iolayerbase.h \ serialconfigwidget.h irdaconfigwidget.h \ btconfigwidget.h modemconfigwidget.h \ atconfigdialog.h dialdialog.h \ procctl.h \ function_keyboard.h \ receive_layer.h filereceive.h \ script.h \ dialer.h \ terminalwidget.h \ emulation_handler.h TECommon.h \ TEHistory.h TEScreen.h TEWidget.h \ TEmuVt102.h TEmulation.h MyPty.h \ consoleconfigwidget.h SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ file_layer.cpp filetransfer.cpp \ main.cpp \ metafactory.cpp \ session.cpp \ mainwindow.cpp \ profile.cpp \ profileconfig.cpp \ profilemanager.cpp \ tabwidget.cpp \ configdialog.cpp \ keytrans.cpp \ transferdialog.cpp \ profiledialogwidget.cpp \ profileeditordialog.cpp \ iolayerbase.cpp \ serialconfigwidget.cpp irdaconfigwidget.cpp \ btconfigwidget.cpp modemconfigwidget.cpp \ atconfigdialog.cpp dialdialog.cpp \ default.cpp procctl.cpp \ function_keyboard.cpp \ receive_layer.cpp filereceive.cpp \ script.cpp \ dialer.cpp \ terminalwidget.cpp \ emulation_handler.cpp TEHistory.cpp \ TEScreen.cpp TEWidget.cpp \ TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ consoleconfigwidget.cpp INTERFACES = configurebase.ui editbase.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 -lopieui2 -lutil TARGET = console DEFINES += HAVE_OPENPTY include ( $(OPIEDIR)/include.pro ) |