-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,5 +1,7 @@ | |||
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. |
@@ -18,17 +20,19 @@ the future | |||
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 | |||
@@ -2,6 +2,7 @@ | |||
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 | ||
@@ -44,6 +45,11 @@ extern "C" { | |||
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 ) { |
@@ -61,6 +67,7 @@ Default::Default( MetaFactory* fact ) { | |||
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 | ||
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 | |||
@@ -3,6 +3,8 @@ | |||
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*); |
@@ -17,6 +19,8 @@ extern "C" { | |||
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; |
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 | |||
@@ -26,7 +26,7 @@ | |||
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> |
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 | |||
@@ -627,18 +627,21 @@ 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 | ||
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 | |||
@@ -5,9 +5,11 @@ | |||
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" |
@@ -109,7 +111,9 @@ void MainWindow::initUI() { | |||
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(); |
@@ -137,6 +141,12 @@ QList<Session> MainWindow::sessions() { | |||
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() { |
@@ -152,8 +162,8 @@ void MainWindow::slotDisconnect() { | |||
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 | ||
@@ -170,11 +180,37 @@ void MainWindow::slotConfigure() { | |||
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 | |||
@@ -17,7 +17,7 @@ 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: |
@@ -45,6 +45,7 @@ public: | |||
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(); |
@@ -58,6 +59,7 @@ private slots: | |||
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 | */ |
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 | |||
@@ -30,6 +30,12 @@ void MetaFactory::addFileTransferLayer( const QCString& name, | |||
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; |
@@ -62,6 +68,14 @@ QStringList MetaFactory::fileTransferLayers()const { | |||
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; |
@@ -101,6 +115,17 @@ ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget | |||
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 | } |
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 | |||
@@ -15,12 +15,15 @@ | |||
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(); |
@@ -50,14 +53,31 @@ public: | |||
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 |
@@ -79,6 +99,7 @@ private: | |||
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 | ||
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 | |||
@@ -2,9 +2,12 @@ | |||
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" |
@@ -51,17 +54,40 @@ void ProfileManager::clear() { | |||
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( ) { |
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 | |||
@@ -22,7 +22,7 @@ public: | |||
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: |
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 | |||
@@ -2,37 +2,80 @@ | |||
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,9 +1,11 @@ | |||
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 |
@@ -17,7 +19,7 @@ public: | |||
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 | /** |
@@ -26,22 +28,46 @@ public: | |||
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 | ||
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 | |||
@@ -2,7 +2,7 @@ | |||
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 | } |
@@ -11,14 +11,17 @@ 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 ) { |
@@ -30,5 +33,11 @@ void TabWidget::slotCurChanged( QWidget* wid ) { | |||
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 | |||
@@ -2,20 +2,21 @@ | |||
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 ); |
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 | |||
@@ -622,7 +622,7 @@ void Vt102Emulation::sendString(const char* 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 | } |
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 | |||
@@ -86,7 +86,7 @@ public: | |||
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 |