-rw-r--r-- | noncore/apps/opie-console/PLANS | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/default.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/default.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_layer.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/keytrans.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 48 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 25 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 21 | ||||
-rw-r--r-- | noncore/apps/opie-console/profilemanager.cpp | 44 | ||||
-rw-r--r-- | noncore/apps/opie-console/profilemanager.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.cpp | 49 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.h | 38 | ||||
-rw-r--r-- | noncore/apps/opie-console/tabwidget.cpp | 21 | ||||
-rw-r--r-- | noncore/apps/opie-console/tabwidget.h | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/vt102emulation.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/vt102emulation.h | 2 |
17 files changed, 248 insertions, 41 deletions
diff --git a/noncore/apps/opie-console/PLANS b/noncore/apps/opie-console/PLANS index 8f6b807..0ec45cb 100644 --- a/noncore/apps/opie-console/PLANS +++ b/noncore/apps/opie-console/PLANS | |||
@@ -1,34 +1,38 @@ | |||
1 | can we please get a working serial connection for now? if that works | 1 | can we please get a working serial connection for now? if that works |
2 | i can test file transfers and stuff. -hash | 2 | i can test file transfers and stuff. -hash |
3 | sure. I finished the ConfigDialog and now doing the Profile->Session | ||
4 | stuff. Then you just need to click Open -zecke | ||
3 | 5 | ||
4 | From a UNIX point of view we want to do something like minicom | 6 | From a UNIX point of view we want to do something like minicom |
5 | with a better GUI. | 7 | with a better GUI. |
6 | It should feature some terminal emulation vt100/102, ansi, | 8 | It should feature some terminal emulation vt100/102, ansi, |
7 | filetransfer via {x,y,z}modem, and some sort of session management. | 9 | filetransfer via {x,y,z}modem, and some sort of session management. |
8 | Besides this requirement we would like to be able to execute 'scripts' | 10 | Besides this requirement we would like to be able to execute 'scripts' |
9 | in a session. | 11 | in a session. |
10 | A script would just write to the TEmulation and then be sent via | 12 | A script would just write to the TEmulation and then be sent via |
11 | an IOlayer. | 13 | an IOlayer. |
12 | Then we would like to send keys? Do we want that? | 14 | Then we would like to send keys? Do we want that? |
13 | 15 | ||
14 | We want a modular architecture which might support plugins in | 16 | We want a modular architecture which might support plugins in |
15 | the future | 17 | the future |
16 | 18 | ||
17 | (Almost) DONE: | 19 | (Almost) DONE: |
18 | Framework | 20 | Framework |
19 | Serial IOLayer | 21 | Serial IOLayer |
20 | Saving and Restoring Profiles | 22 | Saving and Restoring Profiles |
23 | ConfigDialog Framework | ||
24 | FilesendingLayer - hash | ||
21 | 25 | ||
22 | TASKS in progress: | 26 | TASKS in progress: |
23 | Profile->Session and MainWidget --- Harlekin | 27 | Profile->Session and MainWidget --- Harlekin |
24 | FilesendingLayer - hash | ||
25 | IOLayer - wazlaf | 28 | IOLayer - wazlaf |
26 | Configuration - josef | ||
27 | TE - ibotty | 29 | TE - ibotty |
28 | |||
29 | OPEN tasks: | ||
30 | Session->Profile - hash | 30 | Session->Profile - hash |
31 | Scripting - wazlaf | 31 | Scripting - wazlaf |
32 | |||
33 | OPEN tasks: | ||
34 | Irda ConfigWidget | ||
35 | BT ConfigWidget | ||
32 | Keys - open | 36 | Keys - open |
33 | IRDA-Layer - open | 37 | IRDA-Layer - open |
34 | Bluetooth-Layer - open | 38 | Bluetooth-Layer - open |
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp index d9a0557..da6f3e2 100644 --- a/noncore/apps/opie-console/default.cpp +++ b/noncore/apps/opie-console/default.cpp | |||
@@ -1,16 +1,17 @@ | |||
1 | #include "io_serial.h" | 1 | #include "io_serial.h" |
2 | #include "sz_transfer.h" | 2 | #include "sz_transfer.h" |
3 | #include "serialconfigwidget.h" | 3 | #include "serialconfigwidget.h" |
4 | #include "terminalwidget.h" | 4 | #include "terminalwidget.h" |
5 | #include "vt102emulation.h" | ||
5 | 6 | ||
6 | #include "default.h" | 7 | #include "default.h" |
7 | 8 | ||
8 | extern "C" { | 9 | extern "C" { |
9 | // FILE Transfer Stuff | 10 | // FILE Transfer Stuff |
10 | FileTransferLayer* newSZTransfer(IOLayer* lay) { | 11 | FileTransferLayer* newSZTransfer(IOLayer* lay) { |
11 | return new SzTransfer( SzTransfer::SZ, lay ); | 12 | return new SzTransfer( SzTransfer::SZ, lay ); |
12 | } | 13 | } |
13 | FileTransferLayer* newSYTransfer(IOLayer* lay) { | 14 | FileTransferLayer* newSYTransfer(IOLayer* lay) { |
14 | return new SzTransfer( SzTransfer::SY, lay ); | 15 | return new SzTransfer( SzTransfer::SY, lay ); |
15 | } | 16 | } |
16 | FileTransferLayer* newSXTransfer(IOLayer* lay) { | 17 | FileTransferLayer* newSXTransfer(IOLayer* lay) { |
@@ -35,33 +36,39 @@ extern "C" { | |||
35 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid) { | 36 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid) { |
36 | return newSerialWidget(str, wid); | 37 | return newSerialWidget(str, wid); |
37 | } | 38 | } |
38 | ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid) { | 39 | ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid) { |
39 | return newSerialWidget(str, wid ); | 40 | return newSerialWidget(str, wid ); |
40 | } | 41 | } |
41 | 42 | ||
42 | // Terminal Widget(s) | 43 | // Terminal Widget(s) |
43 | ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { | 44 | ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { |
44 | return new TerminalWidget(na, wid,0 ); | 45 | return new TerminalWidget(na, wid,0 ); |
45 | } | 46 | } |
46 | 47 | ||
48 | // VT Emulations | ||
49 | EmulationLayer* newVT102( Widget* wid ) { | ||
50 | return new Vt102Emulation( wid ); | ||
51 | } | ||
52 | |||
47 | }; | 53 | }; |
48 | 54 | ||
49 | Default::Default( MetaFactory* fact ) { | 55 | Default::Default( MetaFactory* fact ) { |
50 | fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); | 56 | fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); |
51 | fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); | 57 | fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); |
52 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); | 58 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); |
53 | 59 | ||
54 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); | 60 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); |
55 | fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); | 61 | fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); |
56 | fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); | 62 | fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); |
57 | 63 | ||
58 | fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); | 64 | fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); |
59 | fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); | 65 | fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); |
60 | fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); | 66 | fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); |
61 | 67 | ||
62 | fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); | 68 | fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); |
63 | 69 | ||
70 | fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 ); | ||
64 | } | 71 | } |
65 | Default::~Default() { | 72 | Default::~Default() { |
66 | 73 | ||
67 | } | 74 | } |
diff --git a/noncore/apps/opie-console/default.h b/noncore/apps/opie-console/default.h index ed78986..b9af898 100644 --- a/noncore/apps/opie-console/default.h +++ b/noncore/apps/opie-console/default.h | |||
@@ -1,30 +1,34 @@ | |||
1 | #ifndef OPIE_DEFAULT_H | 1 | #ifndef OPIE_DEFAULT_H |
2 | #define OPIE_DEFAULT_H | 2 | #define OPIE_DEFAULT_H |
3 | 3 | ||
4 | #include "metafactory.h" | 4 | #include "metafactory.h" |
5 | 5 | ||
6 | class Widget; | ||
7 | |||
6 | extern "C" { | 8 | extern "C" { |
7 | FileTransferLayer* newSZTransfer(IOLayer*); | 9 | FileTransferLayer* newSZTransfer(IOLayer*); |
8 | FileTransferLayer* newSYTransfer(IOLayer*); | 10 | FileTransferLayer* newSYTransfer(IOLayer*); |
9 | FileTransferLayer* newSXTransfer(IOLayer*); | 11 | FileTransferLayer* newSXTransfer(IOLayer*); |
10 | 12 | ||
11 | IOLayer* newSerialLayer(const Profile&); | 13 | IOLayer* newSerialLayer(const Profile&); |
12 | IOLayer* newBTLayer(const Profile& ); | 14 | IOLayer* newBTLayer(const Profile& ); |
13 | IOLayer* newIrDaLayer(const Profile& ); | 15 | IOLayer* newIrDaLayer(const Profile& ); |
14 | 16 | ||
15 | ProfileDialogWidget* newSerialWidget(const QString&, QWidget* ); | 17 | ProfileDialogWidget* newSerialWidget(const QString&, QWidget* ); |
16 | ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* ); | 18 | ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* ); |
17 | ProfileDialogWidget* newBTWidget (const QString&, QWidget* ); | 19 | ProfileDialogWidget* newBTWidget (const QString&, QWidget* ); |
18 | 20 | ||
19 | ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ); | 21 | ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ); |
22 | |||
23 | EmulationLayer* newVT102( Widget* ); | ||
20 | }; | 24 | }; |
21 | 25 | ||
22 | class MetaFactory; | 26 | class MetaFactory; |
23 | struct Default { | 27 | struct Default { |
24 | public: | 28 | public: |
25 | Default(MetaFactory* ); | 29 | Default(MetaFactory* ); |
26 | ~Default(); | 30 | ~Default(); |
27 | }; | 31 | }; |
28 | 32 | ||
29 | 33 | ||
30 | #endif | 34 | #endif |
diff --git a/noncore/apps/opie-console/emulation_layer.h b/noncore/apps/opie-console/emulation_layer.h index 0f54331..5781acc 100644 --- a/noncore/apps/opie-console/emulation_layer.h +++ b/noncore/apps/opie-console/emulation_layer.h | |||
@@ -17,25 +17,25 @@ | |||
17 | /* -------------------------------------------------------------------------- */ | 17 | /* -------------------------------------------------------------------------- */ |
18 | /* -------------------------------------------------------------------------- */ | 18 | /* -------------------------------------------------------------------------- */ |
19 | /* */ | 19 | /* */ |
20 | /* made to a layer between io_layer and widget */ | 20 | /* made to a layer between io_layer and widget */ |
21 | /* */ | 21 | /* */ |
22 | /* Copyright (C) 2002 by opie developers <opie@handhelds.org> */ | 22 | /* Copyright (C) 2002 by opie developers <opie@handhelds.org> */ |
23 | /* */ | 23 | /* */ |
24 | /* -------------------------------------------------------------------------- */ | 24 | /* -------------------------------------------------------------------------- */ |
25 | 25 | ||
26 | #ifndef EMULATION_LAYER_H | 26 | #ifndef EMULATION_LAYER_H |
27 | #define EMULATION_LAYER_H | 27 | #define EMULATION_LAYER_H |
28 | 28 | ||
29 | #include "widget.h" | 29 | #include "widget_layer.h" |
30 | #include "screen.h" | 30 | #include "screen.h" |
31 | #include <qtimer.h> | 31 | #include <qtimer.h> |
32 | #include <stdio.h> | 32 | #include <stdio.h> |
33 | #include <qtextcodec.h> | 33 | #include <qtextcodec.h> |
34 | #include "keytrans.h" | 34 | #include "keytrans.h" |
35 | 35 | ||
36 | class EmulationLayer : public QObject | 36 | class EmulationLayer : public QObject |
37 | { Q_OBJECT | 37 | { Q_OBJECT |
38 | 38 | ||
39 | public: | 39 | public: |
40 | 40 | ||
41 | EmulationLayer(Widget* gui); | 41 | EmulationLayer(Widget* gui); |
diff --git a/noncore/apps/opie-console/keytrans.cpp b/noncore/apps/opie-console/keytrans.cpp index d569ae0..5ea192e 100644 --- a/noncore/apps/opie-console/keytrans.cpp +++ b/noncore/apps/opie-console/keytrans.cpp | |||
@@ -618,36 +618,39 @@ KeyTransSymbols::KeyTransSymbols() | |||
618 | defKeySyms(); | 618 | defKeySyms(); |
619 | } | 619 | } |
620 | 620 | ||
621 | // Global material ----------------------------------------------------------- | 621 | // Global material ----------------------------------------------------------- |
622 | 622 | ||
623 | static int keytab_serial = 0; //FIXME: remove,localize | 623 | static int keytab_serial = 0; //FIXME: remove,localize |
624 | 624 | ||
625 | static QIntDict<KeyTrans> * numb2keymap = 0L; | 625 | static QIntDict<KeyTrans> * numb2keymap = 0L; |
626 | static QDict<KeyTrans> * path2keymap = 0L; | 626 | static QDict<KeyTrans> * path2keymap = 0L; |
627 | 627 | ||
628 | KeyTrans* KeyTrans::find(int numb) | 628 | KeyTrans* KeyTrans::find(int numb) |
629 | { | 629 | { |
630 | loadAll(); | ||
630 | KeyTrans* res = numb2keymap->find(numb); | 631 | KeyTrans* res = numb2keymap->find(numb); |
631 | return res ? res : numb2keymap->find(0); | 632 | return res ? res : numb2keymap->find(0); |
632 | } | 633 | } |
633 | 634 | ||
634 | KeyTrans* KeyTrans::find(const char* path) | 635 | KeyTrans* KeyTrans::find(const char* path) |
635 | { | 636 | { |
637 | loadAll(); | ||
636 | KeyTrans* res = path2keymap->find(path); | 638 | KeyTrans* res = path2keymap->find(path); |
637 | return res ? res : numb2keymap->find(0); | 639 | return res ? res : numb2keymap->find(0); |
638 | } | 640 | } |
639 | 641 | ||
640 | int KeyTrans::count() | 642 | int KeyTrans::count() |
641 | { | 643 | { |
644 | loadAll(); | ||
642 | return numb2keymap->count(); | 645 | return numb2keymap->count(); |
643 | } | 646 | } |
644 | 647 | ||
645 | void KeyTrans::addKeyTrans() | 648 | void KeyTrans::addKeyTrans() |
646 | { | 649 | { |
647 | this->numb = keytab_serial ++; | 650 | this->numb = keytab_serial ++; |
648 | numb2keymap->insert(numb,this); | 651 | numb2keymap->insert(numb,this); |
649 | path2keymap->insert(path,this); | 652 | path2keymap->insert(path,this); |
650 | } | 653 | } |
651 | 654 | ||
652 | void KeyTrans::loadAll() | 655 | void KeyTrans::loadAll() |
653 | { | 656 | { |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 3531478..aeb3742 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,22 +1,24 @@ | |||
1 | 1 | ||
2 | #include <qaction.h> | 2 | #include <qaction.h> |
3 | #include <qmenubar.h> | 3 | #include <qmenubar.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qpopupmenu.h> | 5 | #include <qpopupmenu.h> |
6 | #include <qtoolbar.h> | 6 | #include <qtoolbar.h> |
7 | 7 | ||
8 | #include "profileeditordialog.h" | ||
8 | #include "configdialog.h" | 9 | #include "configdialog.h" |
9 | #include "default.h" | 10 | #include "default.h" |
10 | #include "metafactory.h" | 11 | #include "metafactory.h" |
12 | #include "profile.h" | ||
11 | #include "profilemanager.h" | 13 | #include "profilemanager.h" |
12 | #include "mainwindow.h" | 14 | #include "mainwindow.h" |
13 | #include "tabwidget.h" | 15 | #include "tabwidget.h" |
14 | 16 | ||
15 | MainWindow::MainWindow() { | 17 | MainWindow::MainWindow() { |
16 | m_factory = new MetaFactory(); | 18 | m_factory = new MetaFactory(); |
17 | Default def(m_factory); | 19 | Default def(m_factory); |
18 | m_sessions.setAutoDelete( TRUE ); | 20 | m_sessions.setAutoDelete( TRUE ); |
19 | m_curSession = 0; | 21 | m_curSession = 0; |
20 | m_manager = new ProfileManager( m_factory ); | 22 | m_manager = new ProfileManager( m_factory ); |
21 | m_manager->load(); | 23 | m_manager->load(); |
22 | 24 | ||
@@ -100,25 +102,27 @@ void MainWindow::initUI() { | |||
100 | */ | 102 | */ |
101 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 103 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
102 | this, SLOT(slotProfile( int ) ) ); | 104 | this, SLOT(slotProfile( int ) ) ); |
103 | 105 | ||
104 | m_consoleWindow = new TabWidget( this, "blah"); | 106 | m_consoleWindow = new TabWidget( this, "blah"); |
105 | setCentralWidget( m_consoleWindow ); | 107 | setCentralWidget( m_consoleWindow ); |
106 | 108 | ||
107 | } | 109 | } |
108 | 110 | ||
109 | ProfileManager* MainWindow::manager() { | 111 | ProfileManager* MainWindow::manager() { |
110 | return m_manager; | 112 | return m_manager; |
111 | } | 113 | } |
112 | 114 | TabWidget* MainWindow::tabWidget() { | |
115 | return m_consoleWindow; | ||
116 | } | ||
113 | void MainWindow::populateProfiles() { | 117 | void MainWindow::populateProfiles() { |
114 | m_sessionsPop->clear(); | 118 | m_sessionsPop->clear(); |
115 | Profile::ValueList list = manager()->all(); | 119 | Profile::ValueList list = manager()->all(); |
116 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 120 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
117 | m_sessionsPop->insertItem( (*it).name() ); | 121 | m_sessionsPop->insertItem( (*it).name() ); |
118 | } | 122 | } |
119 | 123 | ||
120 | } | 124 | } |
121 | MainWindow::~MainWindow() { | 125 | MainWindow::~MainWindow() { |
122 | delete m_factory; | 126 | delete m_factory; |
123 | manager()->save(); | 127 | manager()->save(); |
124 | } | 128 | } |
@@ -128,53 +132,85 @@ MetaFactory* MainWindow::factory() { | |||
128 | } | 132 | } |
129 | 133 | ||
130 | Session* MainWindow::currentSession() { | 134 | Session* MainWindow::currentSession() { |
131 | return m_curSession; | 135 | return m_curSession; |
132 | } | 136 | } |
133 | 137 | ||
134 | QList<Session> MainWindow::sessions() { | 138 | QList<Session> MainWindow::sessions() { |
135 | return m_sessions; | 139 | return m_sessions; |
136 | } | 140 | } |
137 | 141 | ||
138 | void MainWindow::slotNew() { | 142 | void MainWindow::slotNew() { |
139 | qWarning("New Connection"); | 143 | qWarning("New Connection"); |
144 | ProfileEditorDialog dlg(factory() ); | ||
145 | int ret = dlg.exec(); | ||
146 | |||
147 | if ( ret == QDialog::Accepted ) { | ||
148 | create( dlg.profile() ); | ||
149 | } | ||
140 | } | 150 | } |
141 | 151 | ||
142 | void MainWindow::slotConnect() { | 152 | void MainWindow::slotConnect() { |
143 | if ( currentSession() ) | 153 | if ( currentSession() ) |
144 | currentSession()->layer()->open(); | 154 | currentSession()->layer()->open(); |
145 | } | 155 | } |
146 | 156 | ||
147 | void MainWindow::slotDisconnect() { | 157 | void MainWindow::slotDisconnect() { |
148 | if ( currentSession() ) | 158 | if ( currentSession() ) |
149 | currentSession()->layer()->close(); | 159 | currentSession()->layer()->close(); |
150 | } | 160 | } |
151 | 161 | ||
152 | void MainWindow::slotTerminate() { | 162 | void MainWindow::slotTerminate() { |
153 | if ( currentSession() ) | 163 | if ( currentSession() ) |
154 | currentSession()->layer()->close(); | 164 | currentSession()->layer()->close(); |
155 | delete m_curSession; | 165 | |
156 | m_curSession = 0l; | 166 | slotClose(); |
157 | /* FIXME move to the next session */ | 167 | /* FIXME move to the next session */ |
158 | } | 168 | } |
159 | 169 | ||
160 | void MainWindow::slotConfigure() { | 170 | void MainWindow::slotConfigure() { |
161 | qWarning("configure"); | 171 | qWarning("configure"); |
162 | ConfigDialog conf( manager()->all(), factory() ); | 172 | ConfigDialog conf( manager()->all(), factory() ); |
163 | conf.showMaximized(); | 173 | conf.showMaximized(); |
164 | 174 | ||
165 | int ret = conf.exec(); | 175 | int ret = conf.exec(); |
166 | 176 | ||
167 | if ( QDialog::Accepted == ret ) { | 177 | if ( QDialog::Accepted == ret ) { |
168 | qWarning("conf %d", conf.list().count() ); | 178 | qWarning("conf %d", conf.list().count() ); |
169 | manager()->setProfiles( conf.list() ); | 179 | manager()->setProfiles( conf.list() ); |
170 | populateProfiles(); | 180 | populateProfiles(); |
171 | } | 181 | } |
172 | } | 182 | } |
173 | 183 | /* | |
184 | * we will remove | ||
185 | * this window from the tabwidget | ||
186 | * remove it from the list | ||
187 | * delete it | ||
188 | * and set the currentSession() | ||
189 | */ | ||
174 | void MainWindow::slotClose() { | 190 | void MainWindow::slotClose() { |
175 | } | 191 | if (!currentSession() ) |
192 | return; | ||
176 | 193 | ||
177 | void MainWindow::slotProfile( int ) { | 194 | tabWidget()->remove( currentSession() ); |
195 | tabWidget()->setCurrent( m_sessions.first() ); | ||
196 | m_sessions.remove( m_curSession ); | ||
197 | delete m_curSession; | ||
198 | m_curSession = m_sessions.first(); | ||
199 | } | ||
178 | 200 | ||
201 | /* | ||
202 | * We will get the name | ||
203 | * Then the profile | ||
204 | * and then we will make a profile | ||
205 | */ | ||
206 | void MainWindow::slotProfile( int id) { | ||
207 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | ||
208 | create( prof ); | ||
209 | } | ||
210 | void MainWindow::create( const Profile& prof ) { | ||
211 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | ||
179 | 212 | ||
213 | m_sessions.append( ses ); | ||
214 | tabWidget()->add( ses ); | ||
215 | m_curSession = ses; | ||
180 | } | 216 | } |
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index 36eb3a7..7ef9c26 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h | |||
@@ -8,25 +8,25 @@ | |||
8 | 8 | ||
9 | /** | 9 | /** |
10 | * this is the MainWindow of the new opie console | 10 | * this is the MainWindow of the new opie console |
11 | * it's also the dispatcher between the different | 11 | * it's also the dispatcher between the different |
12 | * actions supported by the gui | 12 | * actions supported by the gui |
13 | */ | 13 | */ |
14 | class QToolBar; | 14 | class QToolBar; |
15 | class QMenuBar; | 15 | class QMenuBar; |
16 | class QAction; | 16 | class QAction; |
17 | class MetaFactory; | 17 | class MetaFactory; |
18 | class TabWidget; | 18 | class TabWidget; |
19 | class ProfileManager; | 19 | class ProfileManager; |
20 | 20 | class Profile; | |
21 | class MainWindow : public QMainWindow { | 21 | class MainWindow : public QMainWindow { |
22 | Q_OBJECT | 22 | Q_OBJECT |
23 | public: | 23 | public: |
24 | MainWindow(); | 24 | MainWindow(); |
25 | ~MainWindow(); | 25 | ~MainWindow(); |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * our factory to generate IOLayer and so on | 28 | * our factory to generate IOLayer and so on |
29 | * | 29 | * |
30 | */ | 30 | */ |
31 | MetaFactory* factory(); | 31 | MetaFactory* factory(); |
32 | 32 | ||
@@ -36,37 +36,39 @@ public: | |||
36 | */ | 36 | */ |
37 | Session* currentSession(); | 37 | Session* currentSession(); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * the session list | 40 | * the session list |
41 | */ | 41 | */ |
42 | QList<Session> sessions(); | 42 | QList<Session> sessions(); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * | 45 | * |
46 | */ | 46 | */ |
47 | ProfileManager* manager(); | 47 | ProfileManager* manager(); |
48 | TabWidget* tabWidget(); | ||
48 | 49 | ||
49 | private slots: | 50 | private slots: |
50 | void slotNew(); | 51 | void slotNew(); |
51 | void slotConnect(); | 52 | void slotConnect(); |
52 | void slotDisconnect(); | 53 | void slotDisconnect(); |
53 | void slotTerminate(); | 54 | void slotTerminate(); |
54 | void slotConfigure(); | 55 | void slotConfigure(); |
55 | void slotClose(); | 56 | void slotClose(); |
56 | void slotProfile(int); | 57 | void slotProfile(int); |
57 | 58 | ||
58 | private: | 59 | private: |
59 | void initUI(); | 60 | void initUI(); |
60 | void populateProfiles(); | 61 | void populateProfiles(); |
62 | void create( const Profile& ); | ||
61 | /** | 63 | /** |
62 | * the current session | 64 | * the current session |
63 | */ | 65 | */ |
64 | Session* m_curSession; | 66 | Session* m_curSession; |
65 | 67 | ||
66 | /** | 68 | /** |
67 | * the session list | 69 | * the session list |
68 | */ | 70 | */ |
69 | QList<Session> m_sessions; | 71 | QList<Session> m_sessions; |
70 | 72 | ||
71 | /** | 73 | /** |
72 | * the metafactory | 74 | * the metafactory |
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index 4501ec2..02a9f9b 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp | |||
@@ -21,24 +21,30 @@ void MetaFactory::addTerminalWidgetFactory( const QCString& name, | |||
21 | void MetaFactory::addIOLayerFactory( const QCString& name, | 21 | void MetaFactory::addIOLayerFactory( const QCString& name, |
22 | const QString& str, | 22 | const QString& str, |
23 | iolayer lay) { | 23 | iolayer lay) { |
24 | m_strings.insert( str, name ); | 24 | m_strings.insert( str, name ); |
25 | m_layerFact.insert( str, lay ); | 25 | m_layerFact.insert( str, lay ); |
26 | } | 26 | } |
27 | void MetaFactory::addFileTransferLayer( const QCString& name, | 27 | void MetaFactory::addFileTransferLayer( const QCString& name, |
28 | const QString& str, | 28 | const QString& str, |
29 | filelayer lay) { | 29 | filelayer lay) { |
30 | m_strings.insert(str, name ); | 30 | m_strings.insert(str, name ); |
31 | m_fileFact.insert( str, lay ); | 31 | m_fileFact.insert( str, lay ); |
32 | } | 32 | } |
33 | void MetaFactory::addEmulationLayer( const QCString& name, | ||
34 | const QString& str, | ||
35 | emulationLayer em) { | ||
36 | m_strings.insert(str, name ); | ||
37 | m_emu.insert( str, em ); | ||
38 | } | ||
33 | QStringList MetaFactory::ioLayers()const { | 39 | QStringList MetaFactory::ioLayers()const { |
34 | QStringList list; | 40 | QStringList list; |
35 | QMap<QString, iolayer>::ConstIterator it; | 41 | QMap<QString, iolayer>::ConstIterator it; |
36 | for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { | 42 | for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { |
37 | list << it.key(); | 43 | list << it.key(); |
38 | } | 44 | } |
39 | return list; | 45 | return list; |
40 | } | 46 | } |
41 | QStringList MetaFactory::connectionWidgets()const { | 47 | QStringList MetaFactory::connectionWidgets()const { |
42 | QStringList list; | 48 | QStringList list; |
43 | QMap<QString, configWidget>::ConstIterator it; | 49 | QMap<QString, configWidget>::ConstIterator it; |
44 | for ( it = m_conFact.begin(); it != m_conFact.end(); ++it ) { | 50 | for ( it = m_conFact.begin(); it != m_conFact.end(); ++it ) { |
@@ -53,24 +59,32 @@ QStringList MetaFactory::terminalWidgets()const { | |||
53 | list << it.key(); | 59 | list << it.key(); |
54 | } | 60 | } |
55 | return list; | 61 | return list; |
56 | } | 62 | } |
57 | QStringList MetaFactory::fileTransferLayers()const { | 63 | QStringList MetaFactory::fileTransferLayers()const { |
58 | QStringList list; | 64 | QStringList list; |
59 | QMap<QString, filelayer>::ConstIterator it; | 65 | QMap<QString, filelayer>::ConstIterator it; |
60 | for ( it = m_fileFact.begin(); it != m_fileFact.end(); ++it ) { | 66 | for ( it = m_fileFact.begin(); it != m_fileFact.end(); ++it ) { |
61 | list << it.key(); | 67 | list << it.key(); |
62 | } | 68 | } |
63 | return list; | 69 | return list; |
64 | } | 70 | } |
71 | QStringList MetaFactory::emulationLayers()const { | ||
72 | QStringList list; | ||
73 | QMap<QString, emulationLayer>::ConstIterator it; | ||
74 | for ( it = m_emu.begin(); it != m_emu.end(); ++it ) { | ||
75 | list << it.key(); | ||
76 | } | ||
77 | return list; | ||
78 | } | ||
65 | 79 | ||
66 | IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { | 80 | IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { |
67 | IOLayer* lay = 0l; | 81 | IOLayer* lay = 0l; |
68 | 82 | ||
69 | QMap<QString, iolayer>::Iterator it; | 83 | QMap<QString, iolayer>::Iterator it; |
70 | it = m_layerFact.find( str ); | 84 | it = m_layerFact.find( str ); |
71 | if ( it != m_layerFact.end() ) { | 85 | if ( it != m_layerFact.end() ) { |
72 | lay = (*(it.data()))(prof); | 86 | lay = (*(it.data()))(prof); |
73 | /* | 87 | /* |
74 | iolayer laye = it.data(); | 88 | iolayer laye = it.data(); |
75 | lay = (*laye )(conf);*/ | 89 | lay = (*laye )(conf);*/ |
76 | } | 90 | } |
@@ -92,23 +106,34 @@ ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget | |||
92 | if (str.isEmpty() ) | 106 | if (str.isEmpty() ) |
93 | return 0l; | 107 | return 0l; |
94 | ProfileDialogWidget* wid = 0l; | 108 | ProfileDialogWidget* wid = 0l; |
95 | qWarning("new terminalPlugin %s %l", str.latin1(), parent ); | 109 | qWarning("new terminalPlugin %s %l", str.latin1(), parent ); |
96 | 110 | ||
97 | QMap<QString, configWidget>::Iterator it; | 111 | QMap<QString, configWidget>::Iterator it; |
98 | it = m_termFact.find( str ); | 112 | it = m_termFact.find( str ); |
99 | if ( it != m_termFact.end() ) { | 113 | if ( it != m_termFact.end() ) { |
100 | wid = (*(it.data() ) )(str,parent); | 114 | wid = (*(it.data() ) )(str,parent); |
101 | } | 115 | } |
102 | return wid; | 116 | return wid; |
103 | } | 117 | } |
118 | EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, Widget* wid) { | ||
119 | EmulationLayer* lay = 0l; | ||
120 | |||
121 | QMap<QString, emulationLayer>::Iterator it; | ||
122 | it = m_emu.find( str ); | ||
123 | if ( it != m_emu.end() ) { | ||
124 | lay = (*(it.data() ) )(wid); | ||
125 | } | ||
126 | |||
127 | return lay; | ||
128 | } | ||
104 | QCString MetaFactory::internal( const QString& str )const { | 129 | QCString MetaFactory::internal( const QString& str )const { |
105 | return m_strings[str]; | 130 | return m_strings[str]; |
106 | } | 131 | } |
107 | QString MetaFactory::external( const QCString& str )const { | 132 | QString MetaFactory::external( const QCString& str )const { |
108 | QMap<QString, QCString>::ConstIterator it; | 133 | QMap<QString, QCString>::ConstIterator it; |
109 | for ( it = m_strings.begin(); it != m_strings.end(); ++it ) { | 134 | for ( it = m_strings.begin(); it != m_strings.end(); ++it ) { |
110 | if ( it.data() == str ) | 135 | if ( it.data() == str ) |
111 | return it.key(); | 136 | return it.key(); |
112 | } | 137 | } |
113 | return QString::null; | 138 | return QString::null; |
114 | } | 139 | } |
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h index 3f7ddce..71c35a2 100644 --- a/noncore/apps/opie-console/metafactory.h +++ b/noncore/apps/opie-console/metafactory.h | |||
@@ -6,30 +6,33 @@ | |||
6 | * and to instantiate these implementations on demand | 6 | * and to instantiate these implementations on demand |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <qwidget.h> | 9 | #include <qwidget.h> |
10 | #include <qmap.h> | 10 | #include <qmap.h> |
11 | 11 | ||
12 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
13 | 13 | ||
14 | #include "io_layer.h" | 14 | #include "io_layer.h" |
15 | #include "file_layer.h" | 15 | #include "file_layer.h" |
16 | #include "profile.h" | 16 | #include "profile.h" |
17 | #include "profiledialogwidget.h" | 17 | #include "profiledialogwidget.h" |
18 | #include "emulation_layer.h" | ||
18 | 19 | ||
20 | class Widget; | ||
19 | class MetaFactory { | 21 | class MetaFactory { |
20 | public: | 22 | public: |
21 | typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent); | 23 | typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent); |
22 | typedef IOLayer* (*iolayer)(const Profile& ); | 24 | typedef IOLayer* (*iolayer)(const Profile& ); |
23 | typedef FileTransferLayer* (*filelayer)(IOLayer*); | 25 | typedef FileTransferLayer* (*filelayer)(IOLayer*); |
26 | typedef EmulationLayer* (*emulationLayer)(Widget* ); | ||
24 | 27 | ||
25 | MetaFactory(); | 28 | MetaFactory(); |
26 | ~MetaFactory(); | 29 | ~MetaFactory(); |
27 | 30 | ||
28 | /** | 31 | /** |
29 | * add a ProfileDialogWidget to the factory | 32 | * add a ProfileDialogWidget to the factory |
30 | * name is the name shown to the user | 33 | * name is the name shown to the user |
31 | */ | 34 | */ |
32 | void addConnectionWidgetFactory( const QCString& internalName, | 35 | void addConnectionWidgetFactory( const QCString& internalName, |
33 | const QString& uiString, | 36 | const QString& uiString, |
34 | configWidget ); | 37 | configWidget ); |
35 | void addTerminalWidgetFactory ( const QCString& internalName, | 38 | void addTerminalWidgetFactory ( const QCString& internalName, |
@@ -41,45 +44,63 @@ public: | |||
41 | */ | 44 | */ |
42 | void addIOLayerFactory( const QCString&, | 45 | void addIOLayerFactory( const QCString&, |
43 | const QString&, | 46 | const QString&, |
44 | iolayer ); | 47 | iolayer ); |
45 | 48 | ||
46 | /** | 49 | /** |
47 | * adds a FileTransfer Layer | 50 | * adds a FileTransfer Layer |
48 | */ | 51 | */ |
49 | void addFileTransferLayer( const QCString& name, | 52 | void addFileTransferLayer( const QCString& name, |
50 | const QString&, | 53 | const QString&, |
51 | filelayer ); | 54 | filelayer ); |
52 | 55 | ||
56 | /** | ||
57 | * adds a Factory for Emulation to the Layer.. | ||
58 | */ | ||
59 | void addEmulationLayer ( const QCString& name, | ||
60 | const QString& uiString, | ||
61 | emulationLayer ); | ||
62 | |||
53 | /* translated UI Strings */ | 63 | /* translated UI Strings */ |
54 | QStringList ioLayers()const; | 64 | QStringList ioLayers()const; |
55 | QStringList connectionWidgets()const; | 65 | QStringList connectionWidgets()const; |
66 | |||
67 | /** | ||
68 | * Terminal Configuration widgets | ||
69 | */ | ||
56 | QStringList terminalWidgets()const; | 70 | QStringList terminalWidgets()const; |
57 | QStringList fileTransferLayers()const; | 71 | QStringList fileTransferLayers()const; |
72 | QStringList emulationLayers()const; | ||
73 | |||
74 | /** | ||
75 | * the generation... | ||
76 | */ | ||
58 | IOLayer* newIOLayer( const QString&,const Profile& ); | 77 | IOLayer* newIOLayer( const QString&,const Profile& ); |
59 | ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* ); | 78 | ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* ); |
60 | ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* ); | 79 | ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* ); |
80 | EmulationLayer* newEmulationLayer(const QString&, Widget* ); | ||
61 | 81 | ||
62 | /* | 82 | /* |
63 | * internal takes the maybe translated | 83 | * internal takes the maybe translated |
64 | * public QString and maps it to the internal | 84 | * public QString and maps it to the internal |
65 | * not translatable QCString | 85 | * not translatable QCString |
66 | */ | 86 | */ |
67 | QCString internal( const QString& )const; | 87 | QCString internal( const QString& )const; |
68 | 88 | ||
69 | /* | 89 | /* |
70 | * external takes the internal name | 90 | * external takes the internal name |
71 | * it returns a translated name | 91 | * it returns a translated name |
72 | */ | 92 | */ |
73 | QString external( const QCString& )const; | 93 | QString external( const QCString& )const; |
74 | 94 | ||
75 | 95 | ||
76 | private: | 96 | private: |
77 | QMap<QString, QCString> m_strings; | 97 | QMap<QString, QCString> m_strings; |
78 | QMap<QString, configWidget> m_conFact; | 98 | QMap<QString, configWidget> m_conFact; |
79 | QMap<QString, configWidget> m_termFact; | 99 | QMap<QString, configWidget> m_termFact; |
80 | QMap<QString, iolayer> m_layerFact; | 100 | QMap<QString, iolayer> m_layerFact; |
81 | QMap<QString, filelayer> m_fileFact; | 101 | QMap<QString, filelayer> m_fileFact; |
102 | QMap<QString, emulationLayer> m_emu; | ||
82 | }; | 103 | }; |
83 | 104 | ||
84 | 105 | ||
85 | #endif | 106 | #endif |
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp index e66ebcc..dcf3cbd 100644 --- a/noncore/apps/opie-console/profilemanager.cpp +++ b/noncore/apps/opie-console/profilemanager.cpp | |||
@@ -1,19 +1,22 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | 3 | ||
4 | #include <qfile.h> | 4 | #include <qfile.h> |
5 | #include <qlayout.h> | ||
6 | #include <qwidgetstack.h> | ||
5 | 7 | ||
6 | #include <qpe/config.h> | 8 | #include <qpe/config.h> |
7 | 9 | ||
10 | #include "widget.h" | ||
8 | #include "metafactory.h" | 11 | #include "metafactory.h" |
9 | #include "profileconfig.h" | 12 | #include "profileconfig.h" |
10 | #include "profilemanager.h" | 13 | #include "profilemanager.h" |
11 | 14 | ||
12 | ProfileManager::ProfileManager( MetaFactory* fact ) | 15 | ProfileManager::ProfileManager( MetaFactory* fact ) |
13 | : m_fact( fact ) | 16 | : m_fact( fact ) |
14 | { | 17 | { |
15 | 18 | ||
16 | } | 19 | } |
17 | ProfileManager::~ProfileManager() { | 20 | ProfileManager::~ProfileManager() { |
18 | 21 | ||
19 | } | 22 | } |
@@ -42,35 +45,58 @@ void ProfileManager::load() { | |||
42 | 45 | ||
43 | /* now add it */ | 46 | /* now add it */ |
44 | m_list.append( prof ); | 47 | m_list.append( prof ); |
45 | } | 48 | } |
46 | 49 | ||
47 | } | 50 | } |
48 | void ProfileManager::clear() { | 51 | void ProfileManager::clear() { |
49 | m_list.clear(); | 52 | m_list.clear(); |
50 | } | 53 | } |
51 | Profile::ValueList ProfileManager::all()const { | 54 | Profile::ValueList ProfileManager::all()const { |
52 | return m_list; | 55 | return m_list; |
53 | } | 56 | } |
54 | Session* ProfileManager::fromProfile( const Profile& prof) { | 57 | /* |
58 | * Our goal is to create a Session | ||
59 | * We will load the the IOLayer and EmulationLayer | ||
60 | * from the factory | ||
61 | * we will generate a QWidgetStack | ||
62 | * add a dummy widget with layout | ||
63 | * add "Widget" to the layout | ||
64 | * add the dummy to the stack | ||
65 | * raise the dummy | ||
66 | * call session->connect(= | ||
67 | * this way we only need to reparent | ||
68 | * in TabWidget | ||
69 | */ | ||
70 | Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) { | ||
55 | Session* session = new Session(); | 71 | Session* session = new Session(); |
56 | session->setName( prof.name() ); | 72 | session->setName( prof.name() ); |
57 | session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(), | 73 | /* translate the internal name to the external */ |
58 | prof) ); | 74 | session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) , |
59 | /* | 75 | prof) ); |
60 | * FIXME | 76 | |
61 | * load emulation | 77 | QWidgetStack *stack = new QWidgetStack(parent); |
62 | * load widget? | 78 | session->setWidgetStack( stack ); |
63 | * set colors + fonts | 79 | QWidget* dummy = new QWidget(stack ); |
64 | */ | 80 | QHBoxLayout* lay = new QHBoxLayout(dummy ); |
81 | stack->addWidget( dummy, 0 ); | ||
82 | stack->raiseWidget( 0 ); | ||
83 | Widget* wid = new Widget(dummy ); | ||
84 | lay->addWidget( wid ); | ||
85 | |||
86 | session->setEmulationWidget( wid ); | ||
87 | session->setEmulationLayer( m_fact->newEmulationLayer( m_fact->external( prof.terminalName() ), | ||
88 | wid ) ); | ||
89 | session->connect(); | ||
90 | |||
65 | return session; | 91 | return session; |
66 | } | 92 | } |
67 | void ProfileManager::save( ) { | 93 | void ProfileManager::save( ) { |
68 | QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) ); | 94 | QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) ); |
69 | ProfileConfig conf("opie-console-profiles"); | 95 | ProfileConfig conf("opie-console-profiles"); |
70 | Profile::ValueList::Iterator it; | 96 | Profile::ValueList::Iterator it; |
71 | for (it = m_list.begin(); it != m_list.end(); ++it ) { | 97 | for (it = m_list.begin(); it != m_list.end(); ++it ) { |
72 | conf.setGroup( (*it).name() ); | 98 | conf.setGroup( (*it).name() ); |
73 | conf.writeEntry( "name", (*it).name() ); | 99 | conf.writeEntry( "name", (*it).name() ); |
74 | conf.writeEntry( "iolayer", QString::fromUtf8( (*it).ioLayerName() ) ); | 100 | conf.writeEntry( "iolayer", QString::fromUtf8( (*it).ioLayerName() ) ); |
75 | conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) ); | 101 | conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) ); |
76 | conf.writeEntry( "back", (*it).background() ); | 102 | conf.writeEntry( "back", (*it).background() ); |
diff --git a/noncore/apps/opie-console/profilemanager.h b/noncore/apps/opie-console/profilemanager.h index 1387247..33b7095 100644 --- a/noncore/apps/opie-console/profilemanager.h +++ b/noncore/apps/opie-console/profilemanager.h | |||
@@ -13,20 +13,20 @@ public: | |||
13 | ProfileManager(MetaFactory*); | 13 | ProfileManager(MetaFactory*); |
14 | ~ProfileManager(); | 14 | ~ProfileManager(); |
15 | 15 | ||
16 | void load(); | 16 | void load(); |
17 | Profile::ValueList all()const; | 17 | Profile::ValueList all()const; |
18 | void clear(); | 18 | void clear(); |
19 | /** | 19 | /** |
20 | * also replaces the item | 20 | * also replaces the item |
21 | */ | 21 | */ |
22 | void add( const Profile& prof ); | 22 | void add( const Profile& prof ); |
23 | void remove( const Profile& prof ); | 23 | void remove( const Profile& prof ); |
24 | Profile profile(const QString& name )const; | 24 | Profile profile(const QString& name )const; |
25 | Session* fromProfile( const Profile& ); | 25 | Session* fromProfile( const Profile& , QWidget* parent = 0l); |
26 | void setProfiles( const Profile::ValueList& ); | 26 | void setProfiles( const Profile::ValueList& ); |
27 | void save(); | 27 | void save(); |
28 | private: | 28 | private: |
29 | MetaFactory* m_fact; | 29 | MetaFactory* m_fact; |
30 | Profile::ValueList m_list; | 30 | Profile::ValueList m_list; |
31 | }; | 31 | }; |
32 | #endif | 32 | #endif |
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp index d32b340..42b0583 100644 --- a/noncore/apps/opie-console/session.cpp +++ b/noncore/apps/opie-console/session.cpp | |||
@@ -1,38 +1,81 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include "io_layer.h" | 3 | #include "io_layer.h" |
4 | #include "file_layer.h" | 4 | #include "file_layer.h" |
5 | #include "widget.h" | ||
6 | #include "emulation_layer.h" | ||
5 | #include "session.h" | 7 | #include "session.h" |
6 | 8 | ||
9 | |||
7 | Session::Session() { | 10 | Session::Session() { |
8 | m_widget = 0l; | 11 | m_widget = 0l; |
9 | m_layer = 0l; | 12 | m_layer = 0l; |
13 | m_widLay = 0l; | ||
14 | m_emLay = 0l; | ||
10 | } | 15 | } |
11 | Session::Session( const QString& na, QWidget* widget, IOLayer* lay) | 16 | Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay) |
12 | : m_name( na ), m_widget( widget ), m_layer( lay ) | 17 | : m_name( na ), m_widget( widget ), m_layer( lay ) |
13 | { | 18 | { |
19 | m_widLay = 0l; | ||
20 | m_emLay = 0l; | ||
14 | } | 21 | } |
15 | Session::~Session() { | 22 | Session::~Session() { |
16 | delete m_layer; | 23 | delete m_layer; |
24 | delete m_emLay; | ||
17 | delete m_widget; | 25 | delete m_widget; |
26 | /* the widget layer should be deleted by the m_widget */ | ||
18 | } | 27 | } |
19 | QString Session::name()const { | 28 | QString Session::name()const { |
20 | return m_name; | 29 | return m_name; |
21 | } | 30 | } |
22 | QWidget* Session::widget() { | 31 | QWidgetStack* Session::widgetStack() { |
23 | return m_widget; | 32 | return m_widget; |
24 | } | 33 | } |
25 | IOLayer* Session::layer() { | 34 | IOLayer* Session::layer() { |
26 | return m_layer; | 35 | return m_layer; |
27 | } | 36 | } |
37 | EmulationLayer* Session::emulationLayer() { | ||
38 | return m_emLay; | ||
39 | } | ||
40 | Widget* Session::emulationWidget() { | ||
41 | return m_widLay; | ||
42 | } | ||
43 | void Session::connect() { | ||
44 | if ( !m_layer || !m_emLay ) | ||
45 | return; | ||
46 | |||
47 | QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), | ||
48 | m_emLay, SLOT(onRcvBlock(const QByteArray&) ) ); | ||
49 | QObject::connect(m_emLay, SIGNAL(sndBlock(const QByteArray&) ), | ||
50 | m_layer, SLOT(send(const QByteArray&) ) ); | ||
51 | } | ||
52 | void Session::disconnect() { | ||
53 | if ( !m_layer || !m_emLay ) | ||
54 | return; | ||
55 | |||
56 | QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), | ||
57 | m_emLay, SLOT(onRcvBlock(const QByteArray&) ) ); | ||
58 | QObject::disconnect(m_emLay, SIGNAL(sndBlock(const QByteArray&) ), | ||
59 | m_layer, SLOT(send(const QByteArray&) ) ); | ||
60 | } | ||
28 | void Session::setName( const QString& na){ | 61 | void Session::setName( const QString& na){ |
29 | m_name = na; | 62 | m_name = na; |
30 | } | 63 | } |
31 | void Session::setWidget( QWidget* wid ) { | 64 | void Session::setWidgetStack( QWidgetStack* wid ) { |
32 | delete m_widget; | 65 | delete m_widget; |
66 | /* the EmulationLayer was destroyed... */ | ||
67 | delete m_emLay; | ||
33 | m_widget = wid; | 68 | m_widget = wid; |
34 | } | 69 | } |
35 | void Session::setIOLayer( IOLayer* lay ) { | 70 | void Session::setIOLayer( IOLayer* lay ) { |
36 | delete m_layer; | 71 | delete m_layer; |
37 | m_layer = lay; | 72 | m_layer = lay; |
38 | } | 73 | } |
74 | void Session::setEmulationLayer( EmulationLayer* lay ) { | ||
75 | delete m_emLay; | ||
76 | m_emLay = lay; | ||
77 | } | ||
78 | void Session::setEmulationWidget( Widget* lay ) { | ||
79 | delete m_widLay; | ||
80 | m_widLay = lay; | ||
81 | } | ||
diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h index 44b5fc8..c3673fc 100644 --- a/noncore/apps/opie-console/session.h +++ b/noncore/apps/opie-console/session.h | |||
@@ -1,48 +1,74 @@ | |||
1 | #ifndef OPIE_SESSION_H | 1 | #ifndef OPIE_SESSION_H |
2 | #define OPIE_SESSION_H | 2 | #define OPIE_SESSION_H |
3 | 3 | ||
4 | #include <qwidget.h> | 4 | #include <qwidgetstack.h> |
5 | 5 | ||
6 | class IOLayer; | 6 | class IOLayer; |
7 | class EmulationLayer; | ||
8 | class Widget; | ||
7 | /** | 9 | /** |
8 | * This is a Session. A session contains | 10 | * This is a Session. A session contains |
9 | * a QWidget pointer and a IOLayer | 11 | * a QWidget pointer and a IOLayer |
10 | * Imagine a session like a collection of what | 12 | * Imagine a session like a collection of what |
11 | * is needed to show your widget in a tab ;) | 13 | * is needed to show your widget in a tab ;) |
12 | */ | 14 | */ |
13 | class Session { | 15 | class Session { |
14 | public: | 16 | public: |
15 | /** | 17 | /** |
16 | * c'tor with widget and layer | 18 | * c'tor with widget and layer |
17 | * ownership get's transfered | 19 | * ownership get's transfered |
18 | */ | 20 | */ |
19 | Session(); | 21 | Session(); |
20 | Session( const QString&, QWidget* widget, IOLayer* ); | 22 | Session( const QString&, QWidgetStack* widget, IOLayer* ); |
21 | ~Session(); | 23 | ~Session(); |
22 | 24 | ||
23 | /** | 25 | /** |
24 | * return the name of the session | 26 | * return the name of the session |
25 | */ | 27 | */ |
26 | QString name()const; | 28 | QString name()const; |
27 | 29 | ||
28 | /** | 30 | /** |
29 | * return the widget | 31 | * return the widgetstack |
32 | * this is used to be semi modal | ||
33 | * for FileTransfer | ||
34 | * | ||
35 | * semi modal == SessionModal | ||
30 | */ | 36 | */ |
31 | QWidget* widget(); | 37 | QWidgetStack* widgetStack(); |
32 | 38 | ||
33 | /** | 39 | /** |
34 | * return the layer | 40 | * return the layer |
35 | */ | 41 | */ |
36 | IOLayer* layer(); | 42 | IOLayer* layer(); |
37 | void setWidget( QWidget* widget ); | 43 | |
44 | EmulationLayer* emulationLayer(); | ||
45 | Widget* emulationWidget(); | ||
46 | |||
47 | /* | ||
48 | * connects the data flow from | ||
49 | * the IOLayer to the EmulationLayer | ||
50 | */ | ||
51 | void connect(); | ||
52 | |||
53 | /* | ||
54 | * disconnect the dataflow | ||
55 | * this will be done for ft | ||
56 | */ | ||
57 | void disconnect(); | ||
58 | |||
59 | void setWidgetStack( QWidgetStack* widget ); | ||
60 | void setEmulationLayer( EmulationLayer* lay ); | ||
61 | void setEmulationWidget( Widget* lay ); | ||
38 | void setIOLayer( IOLayer* ); | 62 | void setIOLayer( IOLayer* ); |
39 | void setName( const QString& ); | 63 | void setName( const QString& ); |
40 | 64 | ||
41 | private: | 65 | private: |
42 | QString m_name; | 66 | QString m_name; |
43 | QWidget* m_widget; | 67 | QWidgetStack* m_widget; |
44 | IOLayer* m_layer; | 68 | IOLayer* m_layer; |
69 | EmulationLayer* m_emLay; | ||
70 | Widget* m_widLay; | ||
45 | 71 | ||
46 | }; | 72 | }; |
47 | 73 | ||
48 | #endif | 74 | #endif |
diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp index 783bf13..cfaef91 100644 --- a/noncore/apps/opie-console/tabwidget.cpp +++ b/noncore/apps/opie-console/tabwidget.cpp | |||
@@ -1,34 +1,43 @@ | |||
1 | 1 | ||
2 | #include "tabwidget.h" | 2 | #include "tabwidget.h" |
3 | 3 | ||
4 | TabWidget::TabWidget( QWidget* parent, const char* name ) | 4 | TabWidget::TabWidget( QWidget* parent, const char* name ) |
5 | : OTabWidget( parent, name ) { | 5 | : QTabWidget( parent, name ) { |
6 | connect(this, SIGNAL( currentChanged(QWidget*) ), | 6 | connect(this, SIGNAL( currentChanged(QWidget*) ), |
7 | this, SLOT( slotCurChanged(QWidget*) ) ); | 7 | this, SLOT( slotCurChanged(QWidget*) ) ); |
8 | } | 8 | } |
9 | 9 | ||
10 | TabWidget::~TabWidget() { | 10 | TabWidget::~TabWidget() { |
11 | } | 11 | } |
12 | 12 | ||
13 | void TabWidget::add( Session* ses ) { | 13 | void TabWidget::add( Session* ses ) { |
14 | if ( !ses->widget() ) return; | 14 | if ( !ses->widgetStack() ) return; |
15 | addTab( ses->widget(), "console/konsole", ses->name() ); | 15 | qWarning("going to add it"); |
16 | m_map.insert( ses->widget(), ses ); | 16 | //reparent( ses->widgetStack(), QPoint() ); |
17 | //addTab( ses->widgetStack(), "console/konsole", ses->name() ); | ||
18 | addTab( ses->widgetStack(), ses->name() ); | ||
19 | m_map.insert( ses->widgetStack(), ses ); | ||
17 | } | 20 | } |
18 | 21 | ||
19 | void TabWidget::remove( Session* ses ) { | 22 | void TabWidget::remove( Session* ses ) { |
20 | m_map.remove( ses->widget() ); | 23 | m_map.remove( ses->widgetStack() ); |
21 | removePage( ses->widget() ); | 24 | removePage( ses->widgetStack() ); |
22 | } | 25 | } |
23 | 26 | ||
24 | void TabWidget::slotCurChanged( QWidget* wid ) { | 27 | void TabWidget::slotCurChanged( QWidget* wid ) { |
25 | QMap<QWidget*, Session*>::Iterator it; | 28 | QMap<QWidget*, Session*>::Iterator it; |
26 | it = m_map.find( wid ); | 29 | it = m_map.find( wid ); |
27 | if ( it == m_map.end() ) { | 30 | if ( it == m_map.end() ) { |
28 | return; | 31 | return; |
29 | } | 32 | } |
30 | 33 | ||
31 | emit activated( it.data() ); | 34 | emit activated( it.data() ); |
32 | } | 35 | } |
36 | void TabWidget::setCurrent( Session* ses ) { | ||
37 | if (!ses ) | ||
38 | return; | ||
39 | |||
40 | showPage( ses->widgetStack() ); | ||
41 | } | ||
33 | 42 | ||
34 | 43 | ||
diff --git a/noncore/apps/opie-console/tabwidget.h b/noncore/apps/opie-console/tabwidget.h index a701488..42a00ec 100644 --- a/noncore/apps/opie-console/tabwidget.h +++ b/noncore/apps/opie-console/tabwidget.h | |||
@@ -1,28 +1,29 @@ | |||
1 | #ifndef OPIE_TAB_WIDGET_H | 1 | #ifndef OPIE_TAB_WIDGET_H |
2 | #define OPIE_TAB_WIDGET_H | 2 | #define OPIE_TAB_WIDGET_H |
3 | 3 | ||
4 | #include <qmap.h> | 4 | #include <qmap.h> |
5 | #include <opie/otabwidget.h> | 5 | #include <qtabwidget.h> |
6 | 6 | ||
7 | #include "session.h" | 7 | #include "session.h" |
8 | /** | 8 | /** |
9 | * This is our central tab widget | 9 | * This is our central tab widget |
10 | * we can add sessions here | 10 | * we can add sessions here |
11 | */ | 11 | */ |
12 | class TabWidget : public OTabWidget{ | 12 | class TabWidget : public QTabWidget{ |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | public: | 14 | public: |
15 | TabWidget(QWidget *parent, const char* name ); | 15 | TabWidget(QWidget *parent, const char* name ); |
16 | ~TabWidget(); | 16 | ~TabWidget(); |
17 | void add( Session* ); | 17 | void add( Session* ); |
18 | void remove( Session* ); | 18 | void remove( Session* ); |
19 | void setCurrent( Session* ); | ||
19 | 20 | ||
20 | signals: | 21 | signals: |
21 | void activated(Session* ses ); | 22 | void activated(Session* ses ); |
22 | private slots: | 23 | private slots: |
23 | void slotCurChanged( QWidget* wid ); | 24 | void slotCurChanged( QWidget* wid ); |
24 | private: | 25 | private: |
25 | QMap<QWidget*, Session*> m_map; | 26 | QMap<QWidget*, Session*> m_map; |
26 | }; | 27 | }; |
27 | 28 | ||
28 | #endif | 29 | #endif |
diff --git a/noncore/apps/opie-console/vt102emulation.cpp b/noncore/apps/opie-console/vt102emulation.cpp index dc977f5..2220f4e 100644 --- a/noncore/apps/opie-console/vt102emulation.cpp +++ b/noncore/apps/opie-console/vt102emulation.cpp | |||
@@ -613,25 +613,25 @@ void Vt102Emulation::tau( int token, int p, int q ) | |||
613 | */ | 613 | */ |
614 | 614 | ||
615 | /*! | 615 | /*! |
616 | */ | 616 | */ |
617 | 617 | ||
618 | void Vt102Emulation::sendString(const char* s) | 618 | void Vt102Emulation::sendString(const char* s) |
619 | { | 619 | { |
620 | QByteArray tmp; | 620 | QByteArray tmp; |
621 | tmp.setRawData( s, strlen( s )); | 621 | tmp.setRawData( s, strlen( s )); |
622 | emit sndBlock( tmp); | 622 | emit sndBlock( tmp); |
623 | } | 623 | } |
624 | 624 | ||
625 | void Vt102Emulation::sendString(const QByteArray s) | 625 | void Vt102Emulation::sendString(const QByteArray& s) |
626 | { | 626 | { |
627 | emit sndBlock( s ); | 627 | emit sndBlock( s ); |
628 | } | 628 | } |
629 | 629 | ||
630 | // Replies ----------------------------------------------------------------- -- | 630 | // Replies ----------------------------------------------------------------- -- |
631 | 631 | ||
632 | // This section copes with replies send as response to an enquiery control code. | 632 | // This section copes with replies send as response to an enquiery control code. |
633 | 633 | ||
634 | /*! | 634 | /*! |
635 | */ | 635 | */ |
636 | 636 | ||
637 | void Vt102Emulation::reportCursorPosition() | 637 | void Vt102Emulation::reportCursorPosition() |
diff --git a/noncore/apps/opie-console/vt102emulation.h b/noncore/apps/opie-console/vt102emulation.h index 018835e..a3d0ae6 100644 --- a/noncore/apps/opie-console/vt102emulation.h +++ b/noncore/apps/opie-console/vt102emulation.h | |||
@@ -77,25 +77,25 @@ signals: | |||
77 | public: | 77 | public: |
78 | 78 | ||
79 | void reset(); | 79 | void reset(); |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * receive a char from IOLayer | 82 | * receive a char from IOLayer |
83 | */ | 83 | */ |
84 | void onRcvChar(int cc); | 84 | void onRcvChar(int cc); |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * sends a list of bytes to the IOLayer | 87 | * sends a list of bytes to the IOLayer |
88 | */ | 88 | */ |
89 | void sendString(const QByteArray); | 89 | void sendString(const QByteArray&); |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * @deprecated use QByteArray instead | 92 | * @deprecated use QByteArray instead |
93 | * see sendString() above | 93 | * see sendString() above |
94 | */ | 94 | */ |
95 | void sendString(const char *); | 95 | void sendString(const char *); |
96 | 96 | ||
97 | public: | 97 | public: |
98 | 98 | ||
99 | BOOL getMode (int m); | 99 | BOOL getMode (int m); |
100 | 100 | ||
101 | void setMode (int m); | 101 | void setMode (int m); |