summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/io_layer.cpp2
-rw-r--r--noncore/apps/opie-console/io_layer.h5
-rw-r--r--noncore/apps/opie-console/io_serial.cpp21
-rw-r--r--noncore/apps/opie-console/io_serial.h10
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp67
-rw-r--r--noncore/apps/opie-console/mainwindow.h11
-rw-r--r--noncore/apps/opie-console/metafactory.cpp16
-rw-r--r--noncore/apps/opie-console/metafactory.h8
-rw-r--r--noncore/apps/opie-console/opie-console.pro13
-rw-r--r--noncore/apps/opie-console/profile.cpp59
-rw-r--r--noncore/apps/opie-console/profile.h66
-rw-r--r--noncore/apps/opie-console/profileconfig.cpp35
-rw-r--r--noncore/apps/opie-console/profileconfig.h17
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp62
-rw-r--r--noncore/apps/opie-console/profilemanager.h30
-rw-r--r--noncore/apps/opie-console/session.cpp16
-rw-r--r--noncore/apps/opie-console/session.h11
-rw-r--r--noncore/apps/opie-console/tabwidget.cpp28
-rw-r--r--noncore/apps/opie-console/tabwidget.h28
19 files changed, 472 insertions, 33 deletions
diff --git a/noncore/apps/opie-console/io_layer.cpp b/noncore/apps/opie-console/io_layer.cpp
index ca1deb8..563a252 100644
--- a/noncore/apps/opie-console/io_layer.cpp
+++ b/noncore/apps/opie-console/io_layer.cpp
@@ -7,3 +7,3 @@ IOLayer::IOLayer()
7 7
8IOLayer::IOLayer(const Config &) 8IOLayer::IOLayer(const Profile &)
9 : QObject() 9 : QObject()
diff --git a/noncore/apps/opie-console/io_layer.h b/noncore/apps/opie-console/io_layer.h
index 537c851..2f1ceef 100644
--- a/noncore/apps/opie-console/io_layer.h
+++ b/noncore/apps/opie-console/io_layer.h
@@ -6,2 +6,4 @@
6 6
7#include "profile.h"
8
7/** 9/**
@@ -11,3 +13,2 @@
11 */ 13 */
12class Config;
13class IOLayer : public QObject { 14class IOLayer : public QObject {
@@ -34,3 +35,3 @@ public:
34 */ 35 */
35 IOLayer( const Config& ); 36 IOLayer( const Profile& );
36 37
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp
index c9155d1..b495f39 100644
--- a/noncore/apps/opie-console/io_serial.cpp
+++ b/noncore/apps/opie-console/io_serial.cpp
@@ -6,3 +6,3 @@
6 6
7IOSerial::IOSerial(const Config &config) : IOLayer(config) { 7IOSerial::IOSerial(const Profile &config) : IOLayer(config) {
8 m_fd = 0; 8 m_fd = 0;
@@ -48,3 +48,3 @@ bool IOSerial::open() {
48 /* Baud rate */ 48 /* Baud rate */
49 int speed = getBaud(m_baud); 49 int speed = baud(m_baud);
50 if (speed == -1) { 50 if (speed == -1) {
@@ -59,3 +59,3 @@ bool IOSerial::open() {
59 } 59 }
60 60
61 /* Data bits */ 61 /* Data bits */
@@ -66,4 +66,5 @@ bool IOSerial::open() {
66 case 8: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8; break; 66 case 8: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8; break;
67 default: break;
67 } 68 }
68 69
69 /* Raw, no echo mode */ 70 /* Raw, no echo mode */
@@ -80,3 +81,3 @@ bool IOSerial::open() {
80 } 81 }
81 82
82 tty.c_cc[VMIN] = 1; 83 tty.c_cc[VMIN] = 1;
@@ -89,3 +90,3 @@ bool IOSerial::open() {
89 tty.c_iflag &= ~(IXON|IXOFF|IXANY); 90 tty.c_iflag &= ~(IXON|IXOFF|IXANY);
90 91
91 if (m_flow & FlowHW) 92 if (m_flow & FlowHW)
@@ -94,3 +95,3 @@ bool IOSerial::open() {
94 tty.c_cflag &= ~CRTSCTS; 95 tty.c_cflag &= ~CRTSCTS;
95 96
96 /* Parity */ 97 /* Parity */
@@ -101,3 +102,3 @@ bool IOSerial::open() {
101 tty.c_cflag |= (PARENB | PARODD); 102 tty.c_cflag |= (PARENB | PARODD);
102 103
103 /* Set the changes */ 104 /* Set the changes */
@@ -117,3 +118,3 @@ bool IOSerial::open() {
117 118
118void IOSerial::reload(const Config &config) { 119void IOSerial::reload(const Profile &config) {
119 m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE); 120 m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE);
@@ -126,3 +127,3 @@ void IOSerial::reload(const Config &config) {
126 127
127int IOSerial::getBaud(int baud) const { 128int IOSerial::baud(int baud) const {
128 switch (baud) { 129 switch (baud) {
diff --git a/noncore/apps/opie-console/io_serial.h b/noncore/apps/opie-console/io_serial.h
index 1d34411..521dac6 100644
--- a/noncore/apps/opie-console/io_serial.h
+++ b/noncore/apps/opie-console/io_serial.h
@@ -31,6 +31,6 @@ public:
31 }; 31 };
32 32
33 IOSerial(const Config &); 33 IOSerial(const Profile &);
34 ~IOSerial(); 34 ~IOSerial();
35 35
36 QString identifier() const; 36 QString identifier() const;
@@ -44,5 +44,5 @@ public slots:
44 void close(); 44 void close();
45 void reload(const Config &); 45 void reload(const Profile &);
46protected: 46protected:
47 int getBaud(int baud) const; 47 int baud(int baud) const;
48protected slots: 48protected slots:
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index e9b5eda..1ae4a20 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -13,3 +13,3 @@ MainWindow::MainWindow() {
13 m_sessions.setAutoDelete( TRUE ); 13 m_sessions.setAutoDelete( TRUE );
14 m_curSession = -1; 14 m_curSession = 0;
15 15
@@ -25,2 +25,4 @@ void MainWindow::initUI() {
25 m_console = new QPopupMenu( this ); 25 m_console = new QPopupMenu( this );
26 m_sessionsPop= new QPopupMenu( this );
27 m_settings = new QPopupMenu( this );
26 28
@@ -35,5 +37,7 @@ void MainWindow::initUI() {
35 37
36 a = new QAction();
37 a->setText( tr("New from Session") );
38 38
39
40 /*
41 * connect action
42 */
39 m_connect = new QAction(); 43 m_connect = new QAction();
@@ -44,4 +48,40 @@ void MainWindow::initUI() {
44 48
49
50 /*
51 * disconnect action
52 */
53 m_disconnect = new QAction();
54 m_disconnect->setText( tr("Disconnect") );
55 m_disconnect->addTo( m_console );
56 connect(m_disconnect, SIGNAL(activated() ),
57 this, SLOT(slotDisconnect() ) );
58
59 /*
60 * terminate action
61 */
62 m_terminate = new QAction();
63 m_terminate->setText( tr("Terminate") );
64 m_terminate->addTo( m_console );
65 connect(m_disconnect, SIGNAL(activated() ),
66 this, SLOT(slotTerminate() ) );
67
68 /*
69 * the settings action
70 */
71 m_setProfiles = new QAction();
72 m_setProfiles->setText( tr("Configure Profiles") );
73 m_setProfiles->addTo( m_settings );
74 connect( m_setProfiles, SIGNAL(activated() ),
75 this, SLOT(slotConfigure() ) );
76
77 /* insert the submenu */
78 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
79 -1, 0);
80
81 /* insert the connection menu */
45 m_bar->insertItem( tr("Connection"), m_console ); 82 m_bar->insertItem( tr("Connection"), m_console );
46 83
84 /* the settings menu */
85 m_bar->insertItem( tr("Settings"), m_settings );
86
47} 87}
@@ -62 +102,22 @@ QList<Session> MainWindow::sessions() {
62} 102}
103void MainWindow::slotNew() {
104 qWarning("New Connection");
105}
106void MainWindow::slotConnect() {
107 if ( currentSession() )
108 currentSession()->layer()->open();
109}
110void MainWindow::slotDisconnect() {
111 if ( currentSession() )
112 currentSession()->layer()->close();
113}
114void MainWindow::slotTerminate() {
115 if ( currentSession() )
116 currentSession()->layer()->close();
117 delete m_curSession;
118 m_curSession = 0l;
119 /* FIXME move to the next session */
120}
121void MainWindow::slotConfigure() {
122 qWarning("configure");
123}
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index db3a653..b6a8419 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -40,5 +40,10 @@ public:
40 QList<Session> sessions(); 40 QList<Session> sessions();
41protected slots: 41
42private slots:
42 void slotNew(); 43 void slotNew();
43 void slotConnect(); 44 void slotConnect();
45 void slotDisconnect();
46 void slotTerminate();
47 void slotConfigure();
48
44private: 49private:
@@ -64,3 +69,3 @@ private:
64 QPopupMenu* m_settings; 69 QPopupMenu* m_settings;
65 QPopupMenu* m_newsession; 70 QPopupMenu* m_sessionsPop;
66 QAction* m_connect; 71 QAction* m_connect;
@@ -68,3 +73,3 @@ private:
68 QAction* m_terminate; 73 QAction* m_terminate;
69 QAction* m_set; 74 QAction* m_setProfiles;
70 75
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp
index bef6ec7..754f34c 100644
--- a/noncore/apps/opie-console/metafactory.cpp
+++ b/noncore/apps/opie-console/metafactory.cpp
@@ -1,2 +1,2 @@
1 1#include <qpe/config.h>
2#include "metafactory.h" 2#include "metafactory.h"
@@ -44 +44,15 @@ QStringList MetaFactory::fileTransferLayers()const {
44} 44}
45IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) {
46 IOLayer* lay = 0l;
47
48 QMap<QString, iolayer>::Iterator it;
49 it = m_layerFact.find( str );
50 if ( it != m_layerFact.end() ) {
51 lay = (*(it.data()))(prof);
52 /*
53 iolayer laye = it.data();
54 lay = (*laye )(conf);*/
55 }
56
57 return lay;
58}
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h
index aae9391..bdd2ad2 100644
--- a/noncore/apps/opie-console/metafactory.h
+++ b/noncore/apps/opie-console/metafactory.h
@@ -15,3 +15,3 @@
15#include "file_layer.h" 15#include "file_layer.h"
16 16#include "profile.h"
17 17
@@ -20,5 +20,5 @@ public:
20 typedef QWidget* (*configWidget)(QWidget* parent); 20 typedef QWidget* (*configWidget)(QWidget* parent);
21 typedef IOLayer* (*iolayer)(const Config& ); 21 typedef IOLayer* (*iolayer)(const Profile& );
22 typedef FileTransferLayer* (*filelayer)(IOLayer*); 22 typedef FileTransferLayer* (*filelayer)(IOLayer*);
23 23
24 MetaFactory(); 24 MetaFactory();
@@ -35,2 +35,4 @@ public:
35 QStringList fileTransferLayers()const; 35 QStringList fileTransferLayers()const;
36 IOLayer* newIOLayer( const QString&,const Profile& );
37
36private: 38private:
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index 4a1180f..e045a48 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -7,3 +7,8 @@ HEADERS = io_layer.h io_serial.h \
7 session.h \ 7 session.h \
8 mainwindow.h 8 mainwindow.h \
9 profile.h \
10 profileconfig.h \
11 profilemanager.h \
12 configwidget.h \
13 tabwidget.h
9SOURCES = io_layer.cpp io_serial.cpp \ 14SOURCES = io_layer.cpp io_serial.cpp \
@@ -12,3 +17,7 @@ SOURCES = io_layer.cpp io_serial.cpp \
12 session.cpp \ 17 session.cpp \
13 mainwindow.cpp 18 mainwindow.cpp \
19 profile.cpp \
20 profileconfig.cpp \
21 profilemanager.cpp \
22 tabwidget.cpp
14INTERFACES = 23INTERFACES =
diff --git a/noncore/apps/opie-console/profile.cpp b/noncore/apps/opie-console/profile.cpp
new file mode 100644
index 0000000..b730218
--- a/dev/null
+++ b/noncore/apps/opie-console/profile.cpp
@@ -0,0 +1,59 @@
1#include "profile.h"
2
3Profile::Profile() {
4
5}
6Profile::Profile( const QString& name,
7 const QString& iolayerName,
8 int background,
9 int foreground,
10 int terminal )
11 : m_name( name ), m_ioLayer( iolayerName ), m_back( background ),
12 m_fore( foreground ), m_terminal( terminal )
13{
14}
15Profile::Profile( const Profile& prof )
16{
17 (*this) = prof;
18}
19Profile &Profile::operator=( const Profile& prof ) {
20 m_name = prof.m_name;
21 m_ioLayer = prof.m_ioLayer;
22 m_back = prof.m_back;
23 m_fore = prof.m_fore;
24 m_terminal = prof.m_terminal;
25
26 return *this;
27}
28Profile::~Profile() {
29}
30QString Profile::name()const {
31 return m_name;
32}
33QString Profile::ioLayerName()const {
34 return m_ioLayer;
35}
36int Profile::foreground()const {
37 return m_fore;
38}
39int Profile::background()const {
40 return m_back;
41}
42int Profile::terminal()const {
43 return m_terminal;
44}
45void Profile::setName( const QString& str ) {
46 m_name = str;
47}
48void Profile::setIOLayer( const QString& name ) {
49 m_ioLayer = name;
50}
51void Profile::setBackground( int back ) {
52 m_back = back;
53}
54void Profile::setForeground( int fore ) {
55 m_fore = fore;
56}
57void Profile::setTerminal( int term ) {
58 m_terminal = term;
59}
diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h
new file mode 100644
index 0000000..8adc0bd
--- a/dev/null
+++ b/noncore/apps/opie-console/profile.h
@@ -0,0 +1,66 @@
1#ifndef OPIE_PROFILE_H
2#define OPIE_PROFILE_H
3
4#include <qmap.h>
5#include <qstring.h>
6#include <qstringlist.h>
7#include <qvaluelist.h>
8/**
9 * A session will be generated from a saved
10 * profile. A profile contains the iolayername
11 * a name.
12 * We can generate a Session from a Profile
13 * No configuration is contained here....
14 */
15class Profile {
16public:
17 typedef QValueList<Profile> ValueList;
18 enum Color { Black = 0,
19 White,
20 Gray };
21 enum Terminal {VT102 = 0 };
22 enum Font { Micro = 0, Small, Medium };
23 Profile();
24 Profile( const QString& name,
25 const QString& iolayerName,
26 int background,
27 int foreground,
28 int terminal);
29 Profile( const Profile& );
30 Profile &operator=( const Profile& );
31
32 ~Profile();
33 QString name()const;
34 QString ioLayerName()const;
35 int foreground()const;
36 int background()const;
37 int terminal()const;
38
39 /*
40 * config stuff
41 */
42 QMap<QString, QString> conf();
43 void clearConf();
44 void writeEntry( const QString& key, const QString& value );
45 void writeEntry( const QString& key, int num );
46 void writeEntry( const QString& key, bool b );
47 void writeEntry( const QString& key, const QStringList&, const QChar& );
48 QString readEntry( const QString& key, const QString& deflt = QString::null)const;
49 int readNumEntry( const QString& key, int = -1 )const;
50 bool readBoolEntry( const QString& key, bool = FALSE )const;
51
52 void setName( const QString& );
53 void setIOLayer( const QString& );
54 void setBackground( int back );
55 void setForeground( int fore );
56 void setTerminal( int term );
57private:
58 QMap<QString, QString> m_conf;
59 QString m_name;
60 QString m_ioLayer;
61 int m_back;
62 int m_fore;
63 int m_terminal;
64};
65
66#endif
diff --git a/noncore/apps/opie-console/profileconfig.cpp b/noncore/apps/opie-console/profileconfig.cpp
new file mode 100644
index 0000000..8b16920
--- a/dev/null
+++ b/noncore/apps/opie-console/profileconfig.cpp
@@ -0,0 +1,35 @@
1
2#include "profileconfig.h"
3
4ProfileConfig::ProfileConfig( const QString& prof )
5 : Config( prof )
6{
7}
8ProfileConfig::~ProfileConfig() {
9
10}
11QStringList ProfileConfig::groups()const {
12 QStringList list;
13 QMap<QString, ConfigGroup>::ConstIterator it;
14 it= Config::groups.begin();
15
16 for (; it != Config::groups.end(); ++it )
17 list << it.key();
18
19
20 return list;
21
22}
23void ProfileConfig::clearAll() {
24 QMap<QString, ConfigGroup>::ConstIterator it;
25 it = Config::groups.begin();
26
27 for ( ; it != Config::groups.end(); ++it )
28 clearGroup( it.key() );
29}
30void ProfileConfig::clearGroup( const QString& str ) {
31 QString cur =git.key();
32 setGroup( str );
33 Config::clearGroup();
34 setGroup( cur );
35}
diff --git a/noncore/apps/opie-console/profileconfig.h b/noncore/apps/opie-console/profileconfig.h
new file mode 100644
index 0000000..e2e149c
--- a/dev/null
+++ b/noncore/apps/opie-console/profileconfig.h
@@ -0,0 +1,17 @@
1
2#ifndef OPIE_PROFILE_CONFIG_H
3#define OPIE_PROFILE_CONFIG_H
4
5#include <qpe/config.h>
6#include <qstringlist.h>
7
8class ProfileConfig : public Config {
9public:
10 ProfileConfig( const QString& prof );
11 ~ProfileConfig();
12 QStringList groups()const;
13 void clearGroup( const QString& );
14 void clearAll();
15
16};
17#endif
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
new file mode 100644
index 0000000..db36686
--- a/dev/null
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -0,0 +1,62 @@
1
2#include <qpe/config.h>
3
4#include "metafactory.h"
5#include "profileconfig.h"
6#include "profilemanager.h"
7
8ProfileManager::ProfileManager( MetaFactory* fact )
9 : m_fact( fact )
10{
11
12}
13ProfileManager::~ProfileManager() {
14
15}
16void ProfileManager::load() {
17 m_list.clear();
18 ProfileConfig conf("opie-console-profiles");
19 QStringList groups = conf.groups();
20 QStringList::Iterator it;
21
22 /*
23 * for each profile
24 */
25 /*
26 * QAsciiDict Parsing FIXME
27 */
28 for ( it = groups.begin(); it != groups.end(); ++it ) {
29 conf.setGroup( (*it) );
30 Profile prof;
31 prof.setName( conf.readEntry("name") );
32 prof.setIOLayer( conf.readEntry("iolayer") );
33 prof.setBackground( conf.readNumEntry("back") );
34 prof.setForeground( conf.readNumEntry("fore") );
35 prof.setTerminal( conf.readNumEntry("terminal") );
36
37 m_list.append( prof );
38 }
39
40}
41Profile::ValueList ProfileManager::all()const {
42 return m_list;
43}
44Session* ProfileManager::fromProfile( const Profile& prof) {
45 Session* session = new Session();
46 session->setName( prof.name() );
47 session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(),
48 prof) );
49 /*
50 * FIXME
51 * load emulation
52 * load widget
53 * set colors + fonts
54 */
55 return session;
56}
57void ProfileManager::save( ) {
58 m_list.clear();
59 ProfileConfig conf("opie-console-profiles");
60 Session* se= 0l;
61 // FIXME save
62}
diff --git a/noncore/apps/opie-console/profilemanager.h b/noncore/apps/opie-console/profilemanager.h
new file mode 100644
index 0000000..d4d0fd0
--- a/dev/null
+++ b/noncore/apps/opie-console/profilemanager.h
@@ -0,0 +1,30 @@
1#ifndef OPIE_PROFILE_MANAGER_H
2#define OPIE_PROFILE_MANAGER_H
3
4#include <qlist.h>
5
6#include "session.h"
7#include "profile.h"
8
9class MetaFactory;
10class ConfigWidget;
11class ProfileManager {
12public:
13 ProfileManager(MetaFactory*);
14 ~ProfileManager();
15
16 void load();
17 Profile::ValueList all()const;
18 void clear();
19 /**
20 * also replaces the item
21 */
22 void add( const Profile& prof );
23 void remove( const Profile& prof );
24 Session* fromProfile( const Profile& );
25 void save();
26private:
27 MetaFactory* m_fact;
28 Profile::ValueList m_list;
29};
30#endif
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp
index 4198fdc..d32b340 100644
--- a/noncore/apps/opie-console/session.cpp
+++ b/noncore/apps/opie-console/session.cpp
@@ -6,4 +6,8 @@
6 6
7Session::Session( QWidget* widget, IOLayer* lay) 7Session::Session() {
8 : m_widget( widget ), m_layer( lay ) 8 m_widget = 0l;
9 m_layer = 0l;
10}
11Session::Session( const QString& na, QWidget* widget, IOLayer* lay)
12 : m_name( na ), m_widget( widget ), m_layer( lay )
9{ 13{
@@ -14,2 +18,5 @@ Session::~Session() {
14} 18}
19QString Session::name()const {
20 return m_name;
21}
15QWidget* Session::widget() { 22QWidget* Session::widget() {
@@ -20,3 +27,7 @@ IOLayer* Session::layer() {
20} 27}
28void Session::setName( const QString& na){
29 m_name = na;
30}
21void Session::setWidget( QWidget* wid ) { 31void Session::setWidget( QWidget* wid ) {
32 delete m_widget;
22 m_widget = wid; 33 m_widget = wid;
@@ -24,2 +35,3 @@ void Session::setWidget( QWidget* wid ) {
24void Session::setIOLayer( IOLayer* lay ) { 35void Session::setIOLayer( IOLayer* lay ) {
36 delete m_layer;
25 m_layer = lay; 37 m_layer = lay;
diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h
index 3978e1b..44b5fc8 100644
--- a/noncore/apps/opie-console/session.h
+++ b/noncore/apps/opie-console/session.h
@@ -18,3 +18,4 @@ public:
18 */ 18 */
19 Session( QWidget* widget, IOLayer* ); 19 Session();
20 Session( const QString&, QWidget* widget, IOLayer* );
20 ~Session(); 21 ~Session();
@@ -22,2 +23,7 @@ public:
22 /** 23 /**
24 * return the name of the session
25 */
26 QString name()const;
27
28 /**
23 * return the widget 29 * return the widget
@@ -32,6 +38,9 @@ public:
32 void setIOLayer( IOLayer* ); 38 void setIOLayer( IOLayer* );
39 void setName( const QString& );
33 40
34private: 41private:
42 QString m_name;
35 QWidget* m_widget; 43 QWidget* m_widget;
36 IOLayer* m_layer; 44 IOLayer* m_layer;
45
37}; 46};
diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp
new file mode 100644
index 0000000..6091aa2
--- a/dev/null
+++ b/noncore/apps/opie-console/tabwidget.cpp
@@ -0,0 +1,28 @@
1
2#include "tabwidget.h"
3
4TabWidget::TabWidget( QWidget* parent, const char* name )
5 : QTabWidget( parent, name )
6{
7 connect(this, SIGNAL(currentChanged(QWidget*) ),
8 this, SLOT(slotCurChanged(QWidget*) ) );
9}
10TabWidget::~TabWidget() {
11}
12void TabWidget::add( Session* ses ) {
13 if ( !ses->widget() ) return;
14 addTab( ses->widget(), ses->name() );
15 m_map.insert( ses->widget(), ses );
16}
17void TabWidget::remove( Session* ses ) {
18 m_map.remove( ses->widget() );
19 removePage( ses->widget() );
20}
21void TabWidget::slotCurChanged( QWidget* wid ) {
22 QMap<QWidget*, Session*>::Iterator it;
23 it = m_map.find(wid );
24 if (it == m_map.end() )
25 return;
26
27 emit activated( it.data() );
28}
diff --git a/noncore/apps/opie-console/tabwidget.h b/noncore/apps/opie-console/tabwidget.h
new file mode 100644
index 0000000..d5d4be3
--- a/dev/null
+++ b/noncore/apps/opie-console/tabwidget.h
@@ -0,0 +1,28 @@
1#ifndef OPIE_TAB_WIDGET_H
2#define OPIE_TAB_WIDGET_H
3
4#include <qmap.h>
5#include <qtabwidget.h>
6
7#include "session.h"
8/**
9 * This is our central tab widget
10 * we can add sessions here
11 */
12class TabWidget : QTabWidget{
13 Q_OBJECT
14public:
15 TabWidget(QWidget *parent, const char* name );
16 ~TabWidget();
17 void add( Session* );
18 void remove( Session* );
19
20signals:
21 void activated(Session* ses );
22private slots:
23 void slotCurChanged( QWidget* wid );
24private:
25 QMap<QWidget*, Session*> m_map;
26};
27
28#endif