author | zecke <zecke> | 2002-11-07 18:31:52 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-07 18:31:52 (UTC) |
commit | b89e9179db00b777e41bdd0c95885fb76b3f1a88 (patch) (unidiff) | |
tree | 6b0b6e33d5d084849ab8d7b17ba1c03b74d8a0c9 | |
parent | 8baa44cf756fc3767829983941fc64c9547b8cc0 (diff) | |
download | opie-b89e9179db00b777e41bdd0c95885fb76b3f1a88.zip opie-b89e9179db00b777e41bdd0c95885fb76b3f1a88.tar.gz opie-b89e9179db00b777e41bdd0c95885fb76b3f1a88.tar.bz2 |
Renove Emulationhandler from MetaFactory
common.h clashed with TECommon.h
Implement saving of history!
-rw-r--r-- | noncore/apps/opie-console/TEScreen.cpp | 17 | ||||
-rw-r--r-- | noncore/apps/opie-console/TEScreen.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/TEmulation.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/TEmulation.h | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 35 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 25 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 11 |
10 files changed, 64 insertions, 42 deletions
diff --git a/noncore/apps/opie-console/TEScreen.cpp b/noncore/apps/opie-console/TEScreen.cpp index a3d115d..2675d31 100644 --- a/noncore/apps/opie-console/TEScreen.cpp +++ b/noncore/apps/opie-console/TEScreen.cpp | |||
@@ -982,13 +982,13 @@ void TEScreen::setSelExtentXY(const int x, const int y) | |||
982 | sel_BR = l; | 982 | sel_BR = l; |
983 | } | 983 | } |
984 | } | 984 | } |
985 | 985 | ||
986 | QString TEScreen::getSelText(const BOOL preserve_line_breaks) | 986 | QString TEScreen::getSelText(const BOOL preserve_line_breaks) |
987 | { | 987 | { |
988 | if (sel_begin == -1) | 988 | if (sel_begin == -1) |
989 | return QString::null; // Selection got clear while selecting. | 989 | return QString::null; // Selection got clear while selecting. |
990 | 990 | ||
991 | int *m; // buffer to fill. | 991 | int *m; // buffer to fill. |
992 | int s, d; // source index, dest. index. | 992 | int s, d; // source index, dest. index. |
993 | int hist_BR = loc(0, hist.getLines()); | 993 | int hist_BR = loc(0, hist.getLines()); |
994 | int hY = sel_TL / columns; | 994 | int hY = sel_TL / columns; |
@@ -1012,13 +1012,13 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks) | |||
1012 | 1012 | ||
1013 | if ((hY == (sel_BR / columns)) && | 1013 | if ((hY == (sel_BR / columns)) && |
1014 | (eol >= (sel_BR % columns))) | 1014 | (eol >= (sel_BR % columns))) |
1015 | { | 1015 | { |
1016 | eol = sel_BR % columns + 1; | 1016 | eol = sel_BR % columns + 1; |
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | while (hX < eol) | 1019 | while (hX < eol) |
1020 | { | 1020 | { |
1021 | m[d++] = hist.getCell(hY, hX++).c; | 1021 | m[d++] = hist.getCell(hY, hX++).c; |
1022 | s++; | 1022 | s++; |
1023 | } | 1023 | } |
1024 | 1024 | ||
@@ -1109,20 +1109,31 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks) | |||
1109 | QChar* qc = new QChar[d]; | 1109 | QChar* qc = new QChar[d]; |
1110 | 1110 | ||
1111 | for (int i = 0; i < d; i++) | 1111 | for (int i = 0; i < d; i++) |
1112 | { | 1112 | { |
1113 | qc[i] = m[i]; | 1113 | qc[i] = m[i]; |
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | QString res(qc, d); | 1116 | QString res(qc, d); |
1117 | 1117 | ||
1118 | delete m; | 1118 | delete m; |
1119 | delete qc; | 1119 | delete qc; |
1120 | 1120 | ||
1121 | return res; | 1121 | return res; |
1122 | } | 1122 | } |
1123 | QString TEScreen::getHistory() { | ||
1124 | sel_begin = 0; | ||
1125 | sel_BR = sel_begin; | ||
1126 | sel_TL = sel_begin; | ||
1127 | setSelExtentXY(columns-1,lines-1); | ||
1128 | QString tmp=getSelText(true); | ||
1129 | while (tmp.at(tmp.length()-2).unicode()==10 && tmp.at(tmp.length()-1).unicode()==10) | ||
1130 | tmp.truncate(tmp.length()-1); | ||
1131 | |||
1132 | return tmp; | ||
1133 | } | ||
1123 | /* above ... end of line processing for selection -- psilva | 1134 | /* above ... end of line processing for selection -- psilva |
1124 | cases: | 1135 | cases: |
1125 | 1136 | ||
1126 | 1) (eol+1)%columns == 0 --> the whole line is filled. | 1137 | 1) (eol+1)%columns == 0 --> the whole line is filled. |
1127 | If the last char is a space, insert (preserve) space. otherwise | 1138 | If the last char is a space, insert (preserve) space. otherwise |
1128 | leave the text alone, so that words that are broken by linewrap | 1139 | leave the text alone, so that words that are broken by linewrap |
diff --git a/noncore/apps/opie-console/TEScreen.h b/noncore/apps/opie-console/TEScreen.h index 473ce79..a840b44 100644 --- a/noncore/apps/opie-console/TEScreen.h +++ b/noncore/apps/opie-console/TEScreen.h | |||
@@ -159,12 +159,14 @@ public: // these are all `Screen' operations | |||
159 | void setSelExtentXY(const int x, const int y); | 159 | void setSelExtentXY(const int x, const int y); |
160 | void clearSelection(); | 160 | void clearSelection(); |
161 | QString getSelText(const BOOL preserve_line_breaks); | 161 | QString getSelText(const BOOL preserve_line_breaks); |
162 | 162 | ||
163 | void checkSelection(int from, int to); | 163 | void checkSelection(int from, int to); |
164 | 164 | ||
165 | QString getHistory(); | ||
166 | |||
165 | private: // helper | 167 | private: // helper |
166 | 168 | ||
167 | void clearImage(int loca, int loce, char c); | 169 | void clearImage(int loca, int loce, char c); |
168 | void moveImage(int dst, int loca, int loce); | 170 | void moveImage(int dst, int loca, int loce); |
169 | 171 | ||
170 | void scrollUp(int from, int i); | 172 | void scrollUp(int from, int i); |
diff --git a/noncore/apps/opie-console/TEmulation.cpp b/noncore/apps/opie-console/TEmulation.cpp index 7a0c624..3b1b9e1 100644 --- a/noncore/apps/opie-console/TEmulation.cpp +++ b/noncore/apps/opie-console/TEmulation.cpp | |||
@@ -268,13 +268,15 @@ void TEmulation::setSelection(const BOOL preserve_line_breaks) { | |||
268 | 268 | ||
269 | void TEmulation::clearSelection() { | 269 | void TEmulation::clearSelection() { |
270 | if (!connected) return; | 270 | if (!connected) return; |
271 | scr->clearSelection(); | 271 | scr->clearSelection(); |
272 | showBulk(); | 272 | showBulk(); |
273 | } | 273 | } |
274 | 274 | void TEmulation::streamHistory(QTextStream* stream) { | |
275 | *stream << scr->getHistory(); | ||
276 | } | ||
275 | // Refreshing -------------------------------------------------------------- -- | 277 | // Refreshing -------------------------------------------------------------- -- |
276 | 278 | ||
277 | #define BULK_TIMEOUT 20 | 279 | #define BULK_TIMEOUT 20 |
278 | 280 | ||
279 | /*! | 281 | /*! |
280 | called when \n comes in. Evtl. triggers showBulk at endBulk | 282 | called when \n comes in. Evtl. triggers showBulk at endBulk |
diff --git a/noncore/apps/opie-console/TEmulation.h b/noncore/apps/opie-console/TEmulation.h index ec15e7a..d7b3d6d 100644 --- a/noncore/apps/opie-console/TEmulation.h +++ b/noncore/apps/opie-console/TEmulation.h | |||
@@ -21,12 +21,14 @@ | |||
21 | 21 | ||
22 | #include "TEWidget.h" | 22 | #include "TEWidget.h" |
23 | #include "TEScreen.h" | 23 | #include "TEScreen.h" |
24 | #include <qtimer.h> | 24 | #include <qtimer.h> |
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | #include <qtextcodec.h> | 26 | #include <qtextcodec.h> |
27 | #include <qtextstream.h> | ||
28 | |||
27 | #include "keytrans.h" | 29 | #include "keytrans.h" |
28 | 30 | ||
29 | class TEmulation : public QObject | 31 | class TEmulation : public QObject |
30 | { Q_OBJECT | 32 | { Q_OBJECT |
31 | 33 | ||
32 | public: | 34 | public: |
@@ -34,19 +36,20 @@ public: | |||
34 | TEmulation(TEWidget* gui); | 36 | TEmulation(TEWidget* gui); |
35 | ~TEmulation(); | 37 | ~TEmulation(); |
36 | 38 | ||
37 | public: | 39 | public: |
38 | virtual void setHistory(bool on); | 40 | virtual void setHistory(bool on); |
39 | virtual bool history(); | 41 | virtual bool history(); |
42 | virtual void streamHistory( QTextStream* ); | ||
40 | 43 | ||
41 | public slots: // signals incoming from TEWidget | 44 | public slots: // signals incoming from TEWidget |
42 | 45 | ||
43 | virtual void onImageSizeChange(int lines, int columns); | 46 | virtual void onImageSizeChange(int lines, int columns); |
44 | virtual void onHistoryCursorChange(int cursor); | 47 | virtual void onHistoryCursorChange(int cursor); |
45 | virtual void onKeyPress(QKeyEvent*); | 48 | virtual void onKeyPress(QKeyEvent*); |
46 | 49 | ||
47 | virtual void clearSelection(); | 50 | virtual void clearSelection(); |
48 | virtual void onSelectionBegin(const int x, const int y); | 51 | virtual void onSelectionBegin(const int x, const int y); |
49 | virtual void onSelectionExtend(const int x, const int y); | 52 | virtual void onSelectionExtend(const int x, const int y); |
50 | virtual void setSelection(const BOOL preserve_line_breaks); | 53 | virtual void setSelection(const BOOL preserve_line_breaks); |
51 | 54 | ||
52 | public slots: // signals incoming from data source | 55 | public slots: // signals incoming from data source |
@@ -72,12 +75,14 @@ public: | |||
72 | virtual void setConnect(bool r); | 75 | virtual void setConnect(bool r); |
73 | void setColumns(int columns); | 76 | void setColumns(int columns); |
74 | 77 | ||
75 | void setKeytrans(int no); | 78 | void setKeytrans(int no); |
76 | void setKeytrans(const char * no); | 79 | void setKeytrans(const char * no); |
77 | 80 | ||
81 | |||
82 | |||
78 | protected: | 83 | protected: |
79 | 84 | ||
80 | TEWidget* gui; | 85 | TEWidget* gui; |
81 | TEScreen* scr; // referes to one `screen' | 86 | TEScreen* scr; // referes to one `screen' |
82 | TEScreen* screen[2]; // 0 = primary, 1 = alternate | 87 | TEScreen* screen[2]; // 0 = primary, 1 = alternate |
83 | void setScreen(int n); // set `scr' to `screen[n]' | 88 | void setScreen(int n); // set `scr' to `screen[n]' |
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 7924568..235facb 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp | |||
@@ -28,12 +28,15 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c | |||
28 | m_teEmu->setHistory( TRUE ); | 28 | m_teEmu->setHistory( TRUE ); |
29 | load( prof ); | 29 | load( prof ); |
30 | 30 | ||
31 | 31 | ||
32 | 32 | ||
33 | } | 33 | } |
34 | TEmulation* EmulationHandler::emulation() { | ||
35 | return m_teEmu; | ||
36 | } | ||
34 | EmulationHandler::~EmulationHandler() { | 37 | EmulationHandler::~EmulationHandler() { |
35 | if (isRecording()) | 38 | if (isRecording()) |
36 | clearScript(); | 39 | clearScript(); |
37 | delete m_teEmu; | 40 | delete m_teEmu; |
38 | delete m_teWid; | 41 | delete m_teWid; |
39 | } | 42 | } |
diff --git a/noncore/apps/opie-console/emulation_handler.h b/noncore/apps/opie-console/emulation_handler.h index 7bc6f16..1338525 100644 --- a/noncore/apps/opie-console/emulation_handler.h +++ b/noncore/apps/opie-console/emulation_handler.h | |||
@@ -44,12 +44,13 @@ public: | |||
44 | * delete all components | 44 | * delete all components |
45 | */ | 45 | */ |
46 | ~EmulationHandler(); | 46 | ~EmulationHandler(); |
47 | 47 | ||
48 | void load( const Profile& ); | 48 | void load( const Profile& ); |
49 | QWidget* widget(); | 49 | QWidget* widget(); |
50 | TEmulation *emulation(); | ||
50 | void setColor( const QColor& fore, const QColor& back ); | 51 | void setColor( const QColor& fore, const QColor& back ); |
51 | QPushButton* cornerButton(); | 52 | QPushButton* cornerButton(); |
52 | 53 | ||
53 | /* Scripts */ | 54 | /* Scripts */ |
54 | /* Create a new script and record all typed characters */ | 55 | /* Create a new script and record all typed characters */ |
55 | void startRecording(); | 56 | void startRecording(); |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index d221715..01468ca 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -6,20 +6,22 @@ | |||
6 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
7 | #include <qtoolbar.h> | 7 | #include <qtoolbar.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qwhatsthis.h> | 10 | #include <qwhatsthis.h> |
11 | #include <qfileinfo.h> | 11 | #include <qfileinfo.h> |
12 | #include <qtextstream.h> | ||
12 | 13 | ||
13 | #include <qpe/resource.h> | 14 | #include <qpe/resource.h> |
14 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
15 | #include <qpe/filemanager.h> | 16 | #include <qpe/filemanager.h> |
16 | #include <qpe/mimetype.h> | 17 | #include <qpe/mimetype.h> |
17 | 18 | ||
18 | #include <opie/ofiledialog.h> | 19 | #include <opie/ofiledialog.h> |
19 | 20 | ||
21 | #include "TEmulation.h" | ||
20 | #include "keytrans.h" | 22 | #include "keytrans.h" |
21 | #include "profileeditordialog.h" | 23 | #include "profileeditordialog.h" |
22 | #include "configdialog.h" | 24 | #include "configdialog.h" |
23 | #include "default.h" | 25 | #include "default.h" |
24 | #include "metafactory.h" | 26 | #include "metafactory.h" |
25 | #include "profile.h" | 27 | #include "profile.h" |
@@ -238,12 +240,18 @@ void MainWindow::initUI() { | |||
238 | , QString::null, 0, this, 0); | 240 | , QString::null, 0, this, 0); |
239 | m_fullscreen->addTo( m_console ); | 241 | m_fullscreen->addTo( m_console ); |
240 | connect( m_fullscreen, SIGNAL( activated() ), | 242 | connect( m_fullscreen, SIGNAL( activated() ), |
241 | this, SLOT( slotFullscreen() ) ); | 243 | this, SLOT( slotFullscreen() ) ); |
242 | 244 | ||
243 | m_console->insertSeparator(); | 245 | m_console->insertSeparator(); |
246 | |||
247 | QAction *a = new QAction(); | ||
248 | a->setText( tr("Save history") ); | ||
249 | a->addTo( m_console ); | ||
250 | connect(a, SIGNAL(activated() ), | ||
251 | this, SLOT(slotSaveHistory() ) ); | ||
244 | /* | 252 | /* |
245 | * terminate action | 253 | * terminate action |
246 | */ | 254 | */ |
247 | m_terminate = new QAction(); | 255 | m_terminate = new QAction(); |
248 | m_terminate->setText( tr("Terminate") ); | 256 | m_terminate->setText( tr("Terminate") ); |
249 | m_terminate->addTo( m_console ); | 257 | m_terminate->addTo( m_console ); |
@@ -299,13 +307,13 @@ void MainWindow::initUI() { | |||
299 | 307 | ||
300 | m_kb = new FunctionKeyboard(m_keyBar); | 308 | m_kb = new FunctionKeyboard(m_keyBar); |
301 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 309 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), |
302 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); | 310 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); |
303 | 311 | ||
304 | 312 | ||
305 | QAction *a = new QAction(tr("Copy"), | 313 | a = new QAction(tr("Copy"), |
306 | Resource::loadPixmap("copy"), QString::null, | 314 | Resource::loadPixmap("copy"), QString::null, |
307 | 0, this, 0 ); | 315 | 0, this, 0 ); |
308 | //a->addTo( m_icons ); | 316 | //a->addTo( m_icons ); |
309 | connect( a, SIGNAL(activated() ), | 317 | connect( a, SIGNAL(activated() ), |
310 | this, SLOT(slotCopy() ) ); | 318 | this, SLOT(slotCopy() ) ); |
311 | 319 | ||
@@ -765,6 +773,31 @@ void MainWindow::slotSaveSession() { | |||
765 | return; | 773 | return; |
766 | } | 774 | } |
767 | manager()->add( currentSession()->profile() ); | 775 | manager()->add( currentSession()->profile() ); |
768 | manager()->save(); | 776 | manager()->save(); |
769 | populateProfiles(); | 777 | populateProfiles(); |
770 | } | 778 | } |
779 | void MainWindow::slotSaveHistory() { | ||
780 | QMap<QString, QStringList> map; | ||
781 | QStringList text; | ||
782 | text << "text/plain"; | ||
783 | map.insert(tr("History"), text ); | ||
784 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | ||
785 | if (filename.isEmpty() ) return; | ||
786 | |||
787 | QFileInfo info(filename); | ||
788 | |||
789 | DocLnk nf; | ||
790 | nf.setType("text/plain"); | ||
791 | nf.setFile(filename); | ||
792 | nf.setName(info.fileName()); | ||
793 | |||
794 | |||
795 | QFile file(filename); | ||
796 | file.open(IO_WriteOnly ); | ||
797 | QTextStream str(&file ); | ||
798 | if ( currentSession() ) | ||
799 | currentSession()->emulationHandler()->emulation()->streamHistory(&str); | ||
800 | |||
801 | file.close(); | ||
802 | nf.writeLink(); | ||
803 | } | ||
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index 37219c5..0fac38b 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h | |||
@@ -67,12 +67,13 @@ private slots: | |||
67 | void slotSaveScript(); | 67 | void slotSaveScript(); |
68 | void slotRunScript(int); | 68 | void slotRunScript(int); |
69 | void slotFullscreen(); | 69 | void slotFullscreen(); |
70 | void slotWrap(); | 70 | void slotWrap(); |
71 | void slotSessionChanged( Session* ); | 71 | void slotSessionChanged( Session* ); |
72 | void slotKeyReceived(FKey, ushort, ushort, bool); | 72 | void slotKeyReceived(FKey, ushort, ushort, bool); |
73 | void slotSaveHistory(); | ||
73 | 74 | ||
74 | /* what could these both slot do? */ | 75 | /* what could these both slot do? */ |
75 | void slotCopy(); | 76 | void slotCopy(); |
76 | void slotPaste(); | 77 | void slotPaste(); |
77 | 78 | ||
78 | /* save the currentSession() to Profiles */ | 79 | /* save the currentSession() to Profiles */ |
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index 0b43e17..24928e7 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp | |||
@@ -40,18 +40,12 @@ void MetaFactory::addFileTransferLayer( const QCString& name, | |||
40 | void MetaFactory::addReceiveLayer( const QCString& name, | 40 | void MetaFactory::addReceiveLayer( const QCString& name, |
41 | const QString& str, | 41 | const QString& str, |
42 | receivelayer lay) { | 42 | receivelayer lay) { |
43 | m_strings.insert(str, name ); | 43 | m_strings.insert(str, name ); |
44 | m_receiveFact.insert( str, lay ); | 44 | m_receiveFact.insert( str, lay ); |
45 | } | 45 | } |
46 | void MetaFactory::addEmulationLayer( const QCString& name, | ||
47 | const QString& str, | ||
48 | emulationLayer em) { | ||
49 | m_strings.insert(str, name ); | ||
50 | m_emu.insert( str, em ); | ||
51 | } | ||
52 | QStringList MetaFactory::ioLayers()const { | 46 | QStringList MetaFactory::ioLayers()const { |
53 | QStringList list; | 47 | QStringList list; |
54 | QMap<QString, iolayer>::ConstIterator it; | 48 | QMap<QString, iolayer>::ConstIterator it; |
55 | for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { | 49 | for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { |
56 | list << it.key(); | 50 | list << it.key(); |
57 | } | 51 | } |
@@ -86,20 +80,12 @@ QStringList MetaFactory::receiveLayers()const { | |||
86 | QMap<QString, receivelayer>::ConstIterator it; | 80 | QMap<QString, receivelayer>::ConstIterator it; |
87 | for ( it = m_receiveFact.begin(); it != m_receiveFact.end(); ++it ) { | 81 | for ( it = m_receiveFact.begin(); it != m_receiveFact.end(); ++it ) { |
88 | list << it.key(); | 82 | list << it.key(); |
89 | } | 83 | } |
90 | return list; | 84 | return list; |
91 | } | 85 | } |
92 | QStringList MetaFactory::emulationLayers()const { | ||
93 | QStringList list; | ||
94 | QMap<QString, emulationLayer>::ConstIterator it; | ||
95 | for ( it = m_emu.begin(); it != m_emu.end(); ++it ) { | ||
96 | list << it.key(); | ||
97 | } | ||
98 | return list; | ||
99 | } | ||
100 | 86 | ||
101 | IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { | 87 | IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { |
102 | IOLayer* lay = 0l; | 88 | IOLayer* lay = 0l; |
103 | 89 | ||
104 | QMap<QString, iolayer>::Iterator it; | 90 | QMap<QString, iolayer>::Iterator it; |
105 | it = m_layerFact.find( str ); | 91 | it = m_layerFact.find( str ); |
@@ -145,23 +131,12 @@ ProfileDialogWidget *MetaFactory::newKeyboardPlugin( const QString& str, QWidget | |||
145 | it = m_keyFact.find( str ); | 131 | it = m_keyFact.find( str ); |
146 | if ( it != m_keyFact.end() ) { | 132 | if ( it != m_keyFact.end() ) { |
147 | wid = (*(it.data() ) )(str,parent); | 133 | wid = (*(it.data() ) )(str,parent); |
148 | } | 134 | } |
149 | return wid; | 135 | return wid; |
150 | } | 136 | } |
151 | EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* wid) { | ||
152 | EmulationLayer* lay = 0l; | ||
153 | |||
154 | QMap<QString, emulationLayer>::Iterator it; | ||
155 | it = m_emu.find( str ); | ||
156 | if ( it != m_emu.end() ) { | ||
157 | lay = (*(it.data() ) )(wid); | ||
158 | } | ||
159 | |||
160 | return lay; | ||
161 | } | ||
162 | FileTransferLayer* MetaFactory::newFileTransfer(const QString& str, IOLayer* lay ) { | 137 | FileTransferLayer* MetaFactory::newFileTransfer(const QString& str, IOLayer* lay ) { |
163 | FileTransferLayer* file = 0l; | 138 | FileTransferLayer* file = 0l; |
164 | QMap<QString, filelayer>::Iterator it; | 139 | QMap<QString, filelayer>::Iterator it; |
165 | it = m_fileFact.find( str ); | 140 | it = m_fileFact.find( str ); |
166 | if ( it != m_fileFact.end() ) { | 141 | if ( it != m_fileFact.end() ) { |
167 | file = (*(it.data() ) )(lay); | 142 | file = (*(it.data() ) )(lay); |
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h index f89136c..bcc40db 100644 --- a/noncore/apps/opie-console/metafactory.h +++ b/noncore/apps/opie-console/metafactory.h | |||
@@ -13,22 +13,20 @@ | |||
13 | 13 | ||
14 | #include "io_layer.h" | 14 | #include "io_layer.h" |
15 | #include "file_layer.h" | 15 | #include "file_layer.h" |
16 | #include "receive_layer.h" | 16 | #include "receive_layer.h" |
17 | #include "profile.h" | 17 | #include "profile.h" |
18 | #include "profiledialogwidget.h" | 18 | #include "profiledialogwidget.h" |
19 | #include "emulation_layer.h" | ||
20 | 19 | ||
21 | class WidgetLayer; | 20 | class WidgetLayer; |
22 | class MetaFactory { | 21 | class MetaFactory { |
23 | public: | 22 | public: |
24 | typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent); | 23 | typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent); |
25 | typedef IOLayer* (*iolayer)(const Profile& ); | 24 | typedef IOLayer* (*iolayer)(const Profile& ); |
26 | typedef FileTransferLayer* (*filelayer)(IOLayer*); | 25 | typedef FileTransferLayer* (*filelayer)(IOLayer*); |
27 | typedef ReceiveLayer* (*receivelayer)(IOLayer*); | 26 | typedef ReceiveLayer* (*receivelayer)(IOLayer*); |
28 | typedef EmulationLayer* (*emulationLayer)(WidgetLayer* ); | ||
29 | 27 | ||
30 | MetaFactory(); | 28 | MetaFactory(); |
31 | ~MetaFactory(); | 29 | ~MetaFactory(); |
32 | 30 | ||
33 | /** | 31 | /** |
34 | * add a ProfileDialogWidget to the factory | 32 | * add a ProfileDialogWidget to the factory |
@@ -58,39 +56,31 @@ public: | |||
58 | const QString&, | 56 | const QString&, |
59 | filelayer ); | 57 | filelayer ); |
60 | void addReceiveLayer( const QCString& name, | 58 | void addReceiveLayer( const QCString& name, |
61 | const QString&, | 59 | const QString&, |
62 | receivelayer); | 60 | receivelayer); |
63 | 61 | ||
64 | /** | ||
65 | * adds a Factory for Emulation to the Layer.. | ||
66 | */ | ||
67 | void addEmulationLayer ( const QCString& name, | ||
68 | const QString& uiString, | ||
69 | emulationLayer ); | ||
70 | 62 | ||
71 | /* translated UI Strings */ | 63 | /* translated UI Strings */ |
72 | QStringList ioLayers()const; | 64 | QStringList ioLayers()const; |
73 | QStringList connectionWidgets()const; | 65 | QStringList connectionWidgets()const; |
74 | 66 | ||
75 | /** | 67 | /** |
76 | * Terminal Configuration widgets | 68 | * Terminal Configuration widgets |
77 | */ | 69 | */ |
78 | QStringList terminalWidgets()const; | 70 | QStringList terminalWidgets()const; |
79 | QStringList fileTransferLayers()const; | 71 | QStringList fileTransferLayers()const; |
80 | QStringList receiveLayers()const; | 72 | QStringList receiveLayers()const; |
81 | QStringList emulationLayers()const; | ||
82 | 73 | ||
83 | /** | 74 | /** |
84 | * the generation... | 75 | * the generation... |
85 | */ | 76 | */ |
86 | IOLayer* newIOLayer( const QString&,const Profile& ); | 77 | IOLayer* newIOLayer( const QString&,const Profile& ); |
87 | ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* ); | 78 | ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* ); |
88 | ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* ); | 79 | ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* ); |
89 | ProfileDialogWidget* newKeyboardPlugin( const QString&, QWidget* ); | 80 | ProfileDialogWidget* newKeyboardPlugin( const QString&, QWidget* ); |
90 | EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* ); | ||
91 | FileTransferLayer* newFileTransfer(const QString&, IOLayer* ); | 81 | FileTransferLayer* newFileTransfer(const QString&, IOLayer* ); |
92 | ReceiveLayer* newReceive(const QString&, IOLayer* ); | 82 | ReceiveLayer* newReceive(const QString&, IOLayer* ); |
93 | 83 | ||
94 | /* | 84 | /* |
95 | * internal takes the maybe translated | 85 | * internal takes the maybe translated |
96 | * public QString and maps it to the internal | 86 | * public QString and maps it to the internal |
@@ -110,11 +100,10 @@ private: | |||
110 | QMap<QString, configWidget> m_conFact; | 100 | QMap<QString, configWidget> m_conFact; |
111 | QMap<QString, configWidget> m_termFact; | 101 | QMap<QString, configWidget> m_termFact; |
112 | QMap<QString, configWidget> m_keyFact; | 102 | QMap<QString, configWidget> m_keyFact; |
113 | QMap<QString, iolayer> m_layerFact; | 103 | QMap<QString, iolayer> m_layerFact; |
114 | QMap<QString, filelayer> m_fileFact; | 104 | QMap<QString, filelayer> m_fileFact; |
115 | QMap<QString, receivelayer> m_receiveFact; | 105 | QMap<QString, receivelayer> m_receiveFact; |
116 | QMap<QString, emulationLayer> m_emu; | ||
117 | }; | 106 | }; |
118 | 107 | ||
119 | 108 | ||
120 | #endif | 109 | #endif |