author | harlekin <harlekin> | 2002-10-05 22:21:04 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-05 22:21:04 (UTC) |
commit | 48b16b3a3557e70abf90e83b84396258b92b652e (patch) (side-by-side diff) | |
tree | 9dad37a08e79da5705a8297b2bf09a0b2441f3b6 | |
parent | 99425255c4afcd75ee6b2f903487cb958d3acdee (diff) | |
download | opie-48b16b3a3557e70abf90e83b84396258b92b652e.zip opie-48b16b3a3557e70abf90e83b84396258b92b652e.tar.gz opie-48b16b3a3557e70abf90e83b84396258b92b652e.tar.bz2 |
otabwidget instead of qtabwidget
-rw-r--r-- | noncore/apps/opie-console/.cvsignore | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/file_layer.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 21 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/tabwidget.cpp | 22 | ||||
-rw-r--r-- | noncore/apps/opie-console/tabwidget.h | 4 |
7 files changed, 43 insertions, 19 deletions
diff --git a/noncore/apps/opie-console/.cvsignore b/noncore/apps/opie-console/.cvsignore index acc07da..41d9740 100644 --- a/noncore/apps/opie-console/.cvsignore +++ b/noncore/apps/opie-console/.cvsignore @@ -1,3 +1,7 @@ +configurebase.cpp +configurebase.h +editbase.cpp +editbase.h moc*.cpp Makefile Makefile.in diff --git a/noncore/apps/opie-console/file_layer.h b/noncore/apps/opie-console/file_layer.h index 71a0c82..cfa149e 100644 --- a/noncore/apps/opie-console/file_layer.h +++ b/noncore/apps/opie-console/file_layer.h @@ -1,36 +1,38 @@ #ifndef OPIE_FILE_LAYER_H #define OPIE_FILE_LAYER_H #include "io_layer.h" #include <opie/oprocess.h> class QFile; /** * this is the layer for sending files */ class FileTransferLayer : public QObject { + Q_OBJECT + public: /** *the io layer to be used */ FileTransferLayer( IOLayer* ); virtual ~FileTransferLayer(); public slots: /** * send a file over the layer */ virtual void sendFile( const QString& file ) = 0; virtual void sendFile( const QFile& ) = 0; private slots: void SzRecievedStdout(OProcess *, char *, int); void SzRecievedStderr(OProcess *, char *, int); void recievedStdin(QByteArray &); signals: /** * sent the file */ void sent(); diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 88d5823..dce08ca 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -1,78 +1,76 @@ #include <qaction.h> #include <qmenubar.h> #include <qlabel.h> #include <qpopupmenu.h> #include <qtoolbar.h> #include "configdialog.h" #include "metafactory.h" #include "profilemanager.h" #include "mainwindow.h" +#include "tabwidget.h" MainWindow::MainWindow() { m_factory = new MetaFactory(); m_sessions.setAutoDelete( TRUE ); m_curSession = 0; m_manager = new ProfileManager(m_factory); m_manager->load(); initUI(); populateProfiles(); } void MainWindow::initUI() { setToolBarsMovable( FALSE ); m_tool = new QToolBar( this ); m_tool->setHorizontalStretchable( TRUE ); m_bar = new QMenuBar( m_tool ); m_console = new QPopupMenu( this ); m_sessionsPop= new QPopupMenu( this ); m_settings = new QPopupMenu( this ); /* * new Action for new sessions */ QAction* a = new QAction(); a->setText( tr("New Connection") ); a->addTo( m_console ); connect(a, SIGNAL(activated() ), this, SLOT(slotNew() ) ); - - /* * connect action */ m_connect = new QAction(); m_connect->setText( tr("Connect") ); m_connect->addTo( m_console ); connect(m_connect, SIGNAL(activated() ), this, SLOT(slotConnect() ) ); - /* * disconnect action */ m_disconnect = new QAction(); m_disconnect->setText( tr("Disconnect") ); m_disconnect->addTo( m_console ); connect(m_disconnect, SIGNAL(activated() ), this, SLOT(slotDisconnect() ) ); /* * terminate action */ m_terminate = new QAction(); m_terminate->setText( tr("Terminate") ); m_terminate->addTo( m_console ); connect(m_disconnect, SIGNAL(activated() ), this, SLOT(slotTerminate() ) ); a = new QAction(); a->setText( tr("Close Window") ); a->addTo( m_console ); connect(a, SIGNAL(activated() ), this, SLOT(slotClose() ) ); @@ -80,88 +78,99 @@ void MainWindow::initUI() { * the settings action */ m_setProfiles = new QAction(); m_setProfiles->setText( tr("Configure Profiles") ); m_setProfiles->addTo( m_settings ); connect( m_setProfiles, SIGNAL(activated() ), this, SLOT(slotConfigure() ) ); /* insert the submenu */ m_console->insertItem(tr("New from Profile"), m_sessionsPop, -1, 0); /* insert the connection menu */ m_bar->insertItem( tr("Connection"), m_console ); /* the settings menu */ m_bar->insertItem( tr("Settings"), m_settings ); /* * connect to the menu activation */ connect( m_sessionsPop, SIGNAL(activated(int) ), this, SLOT(slotProfile(int) ) ); + m_consoleWindow = new TabWidget( this, "blah"); + setCentralWidget( m_consoleWindow ); + } + ProfileManager* MainWindow::manager() { return m_manager; } + void MainWindow::populateProfiles() { m_sessionsPop->clear(); Profile::ValueList list = manager()->all(); - for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); - ++it ) { + for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { m_sessionsPop->insertItem( (*it).name() ); } } MainWindow::~MainWindow() { delete m_factory; } MetaFactory* MainWindow::factory() { return m_factory; } Session* MainWindow::currentSession() { return m_curSession; } QList<Session> MainWindow::sessions() { return m_sessions; } + void MainWindow::slotNew() { qWarning("New Connection"); } + void MainWindow::slotConnect() { if ( currentSession() ) currentSession()->layer()->open(); } + void MainWindow::slotDisconnect() { if ( currentSession() ) currentSession()->layer()->close(); } + void MainWindow::slotTerminate() { if ( currentSession() ) currentSession()->layer()->close(); delete m_curSession; m_curSession = 0l; /* FIXME move to the next session */ } + void MainWindow::slotConfigure() { qWarning("configure"); - ConfigDialog conf( manager()->all() ); + ConfigDialog conf( manager()->all() ); conf.showMaximized(); int ret = conf.exec(); if ( QDialog::Accepted == ret ) { manager()->setProfiles( conf.list() ); populateProfiles(); } } + void MainWindow::slotClose() { } + void MainWindow::slotProfile(int) { } diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index be4b469..36eb3a7 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h @@ -1,47 +1,48 @@ #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 QMenuBar; class QAction; class MetaFactory; - +class TabWidget; class ProfileManager; + class MainWindow : public QMainWindow { Q_OBJECT public: - MainWindow( ); + MainWindow(); ~MainWindow(); /** * 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(); @@ -52,38 +53,39 @@ private slots: void slotTerminate(); void slotConfigure(); void slotClose(); void slotProfile(int); private: void initUI(); void populateProfiles(); /** * the current session */ Session* m_curSession; /** * the session list */ QList<Session> m_sessions; /** * the metafactory */ MetaFactory* m_factory; ProfileManager* m_manager; + TabWidget* m_consoleWindow; QToolBar* m_tool; QMenuBar* m_bar; QPopupMenu* m_console; QPopupMenu* m_settings; QPopupMenu* m_sessionsPop; QAction* m_connect; QAction* m_disconnect; QAction* m_terminate; QAction* m_setProfiles; }; #endif diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index 0b5df20..7abf385 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro @@ -1,26 +1,27 @@ TEMPLATE = app -CONFIG = qt warn_on release +#CONFIG = qt warn_on release +CONFIG = qt debug DESTDIR = $(OPIEDIR)/bin HEADERS = io_layer.h io_serial.h \ file_layer.h \ metafactory.h \ session.h \ mainwindow.h \ profile.h \ profileconfig.h \ profilemanager.h \ configwidget.h \ tabwidget.h \ configdialog.h \ profileeditordialog.h \ emulation_layer.h \ widget.h \ vt102emulation.h \ common.h \ history.h \ screen.h \ keytrans.h SOURCES = io_layer.cpp io_serial.cpp \ file_layer.cpp main.cpp \ metafactory.cpp \ diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp index 6091aa2..783bf13 100644 --- a/noncore/apps/opie-console/tabwidget.cpp +++ b/noncore/apps/opie-console/tabwidget.cpp @@ -1,28 +1,34 @@ #include "tabwidget.h" TabWidget::TabWidget( QWidget* parent, const char* name ) - : QTabWidget( parent, name ) -{ - connect(this, SIGNAL(currentChanged(QWidget*) ), - this, SLOT(slotCurChanged(QWidget*) ) ); + : OTabWidget( parent, name ) { + connect(this, SIGNAL( currentChanged(QWidget*) ), + this, SLOT( slotCurChanged(QWidget*) ) ); } + TabWidget::~TabWidget() { } + void TabWidget::add( Session* ses ) { if ( !ses->widget() ) return; - addTab( ses->widget(), ses->name() ); + addTab( ses->widget(), "console/konsole", ses->name() ); m_map.insert( ses->widget(), ses ); } + void TabWidget::remove( Session* ses ) { m_map.remove( ses->widget() ); removePage( ses->widget() ); } + void TabWidget::slotCurChanged( QWidget* wid ) { - QMap<QWidget*, Session*>::Iterator it; - it = m_map.find(wid ); - if (it == m_map.end() ) + QMap<QWidget*, Session*>::Iterator it; + it = m_map.find( wid ); + if ( it == m_map.end() ) { return; + } emit activated( it.data() ); } + + diff --git a/noncore/apps/opie-console/tabwidget.h b/noncore/apps/opie-console/tabwidget.h index d5d4be3..a701488 100644 --- a/noncore/apps/opie-console/tabwidget.h +++ b/noncore/apps/opie-console/tabwidget.h @@ -1,28 +1,28 @@ #ifndef OPIE_TAB_WIDGET_H #define OPIE_TAB_WIDGET_H #include <qmap.h> -#include <qtabwidget.h> +#include <opie/otabwidget.h> #include "session.h" /** * This is our central tab widget * we can add sessions here */ -class TabWidget : QTabWidget{ +class TabWidget : public OTabWidget{ Q_OBJECT public: TabWidget(QWidget *parent, const char* name ); ~TabWidget(); void add( Session* ); void remove( Session* ); signals: void activated(Session* ses ); private slots: void slotCurChanged( QWidget* wid ); private: QMap<QWidget*, Session*> m_map; }; #endif |