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 /noncore/apps/opie-console/mainwindow.cpp | |
parent | 99425255c4afcd75ee6b2f903487cb958d3acdee (diff) | |
download | opie-48b16b3a3557e70abf90e83b84396258b92b652e.zip opie-48b16b3a3557e70abf90e83b84396258b92b652e.tar.gz opie-48b16b3a3557e70abf90e83b84396258b92b652e.tar.bz2 |
otabwidget instead of qtabwidget
Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
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) { } |