author | zecke <zecke> | 2002-10-08 16:37:37 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-08 16:37:37 (UTC) |
commit | 76fb8a57bf9fbae3a7073c8b0be1216f34adf99c (patch) (unidiff) | |
tree | 3f486d66ce474039b1a0fc4ade770e6e8a7c32b3 /noncore/apps/opie-console | |
parent | faeb94a4000dc539577af465107b5d10903f92d6 (diff) | |
download | opie-76fb8a57bf9fbae3a7073c8b0be1216f34adf99c.zip opie-76fb8a57bf9fbae3a7073c8b0be1216f34adf99c.tar.gz opie-76fb8a57bf9fbae3a7073c8b0be1216f34adf99c.tar.bz2 |
SzModem:
Make it compile remove = 0 from sendFile
Add a Type to Sz
so it could cover SX,SY too
MetaFactory:
take QCString name
QString uiString
so Carsten will be able to translate
and users can switch Language without losing profiles
Default
It's aware of all Default/BuiltIn Plugins and adds them to the factory
Common
typedef bool BOOL TT is not using bool because it wasn't available at that time
they use uint : 1...
maybe we should change UINT_8 to Q_UINT8...
MainWindow:
give the factory to the config widget
use Default
IOLayer
reload should take Profile not Config
ConfigDialog:
make use of Factory and do not do new MetaFactory.. i should
make the c'tor private and add MainWindow as friend
ProfileEditorDialog:
Huge clean ups to the architecture. I still need to convert
the widgets.
Use the factory right
20 files changed, 452 insertions, 174 deletions
diff --git a/noncore/apps/opie-console/common.h b/noncore/apps/opie-console/common.h index ac0e2cf..979c2bd 100644 --- a/noncore/apps/opie-console/common.h +++ b/noncore/apps/opie-console/common.h | |||
@@ -27,5 +27,5 @@ | |||
27 | 27 | ||
28 | #ifndef BOOL | 28 | #ifndef BOOL |
29 | typedef int BOOL; | 29 | typedef bool BOOL; |
30 | #endif | 30 | #endif |
31 | 31 | ||
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp index ee1ffb4..50512b6 100644 --- a/noncore/apps/opie-console/configdialog.cpp +++ b/noncore/apps/opie-console/configdialog.cpp | |||
@@ -30,6 +30,7 @@ Profile ConfigListItem::profile()const { | |||
30 | /* Dialog */ | 30 | /* Dialog */ |
31 | 31 | ||
32 | ConfigDialog::ConfigDialog( const Profile::ValueList& lis, QWidget* parent ) | 32 | ConfigDialog::ConfigDialog( const Profile::ValueList& lis, MetaFactory* fa, |
33 | : ConfigureBase( parent, 0, TRUE ) | 33 | QWidget* parent ) |
34 | : ConfigureBase( parent, 0, TRUE ), m_fact( fa ) | ||
34 | { | 35 | { |
35 | //init(); | 36 | //init(); |
@@ -72,5 +73,5 @@ void ConfigDialog::slotEdit() { | |||
72 | p = ((ConfigListItem*)lstView->currentItem())->profile(); | 73 | p = ((ConfigListItem*)lstView->currentItem())->profile(); |
73 | 74 | ||
74 | ProfileEditorDialog dlg(new MetaFactory(), p); | 75 | ProfileEditorDialog dlg(m_fact, p); |
75 | 76 | ||
76 | dlg.setCaption("Edit Connection Profile"); | 77 | dlg.setCaption("Edit Connection Profile"); |
@@ -91,5 +92,6 @@ void ConfigDialog::slotEdit() { | |||
91 | 92 | ||
92 | void ConfigDialog::slotAdd() { | 93 | void ConfigDialog::slotAdd() { |
93 | ProfileEditorDialog dlg(new MetaFactory()); | 94 | qWarning("slotAdd"); |
95 | ProfileEditorDialog dlg(m_fact); | ||
94 | 96 | ||
95 | dlg.setCaption("New Connection"); | 97 | dlg.setCaption("New Connection"); |
diff --git a/noncore/apps/opie-console/configdialog.h b/noncore/apps/opie-console/configdialog.h index a0c40d0..b81a004 100644 --- a/noncore/apps/opie-console/configdialog.h +++ b/noncore/apps/opie-console/configdialog.h | |||
@@ -7,8 +7,9 @@ | |||
7 | #include "profile.h" | 7 | #include "profile.h" |
8 | 8 | ||
9 | class MetaFactory; | ||
9 | class ConfigDialog : public ConfigureBase { | 10 | class ConfigDialog : public ConfigureBase { |
10 | Q_OBJECT | 11 | Q_OBJECT |
11 | public: | 12 | public: |
12 | ConfigDialog( const Profile::ValueList&, QWidget* parent = 0l); | 13 | ConfigDialog( const Profile::ValueList&, MetaFactory*, QWidget* parent = 0l); |
13 | ~ConfigDialog(); | 14 | ~ConfigDialog(); |
14 | 15 | ||
@@ -18,4 +19,6 @@ protected slots: | |||
18 | void slotEdit(); | 19 | void slotEdit(); |
19 | void slotAdd(); | 20 | void slotAdd(); |
21 | private: | ||
22 | MetaFactory* m_fact; | ||
20 | 23 | ||
21 | }; | 24 | }; |
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp new file mode 100644 index 0000000..78495d2 --- a/dev/null +++ b/noncore/apps/opie-console/default.cpp | |||
@@ -0,0 +1,65 @@ | |||
1 | #include "io_serial.h" | ||
2 | #include "sz_transfer.h" | ||
3 | |||
4 | #include "default.h" | ||
5 | |||
6 | extern "C" { | ||
7 | // FILE Transfer Stuff | ||
8 | FileTransferLayer* newSZTransfer(IOLayer* lay) { | ||
9 | return new SzTransfer( SzTransfer::SZ, lay ); | ||
10 | } | ||
11 | FileTransferLayer* newSYTransfer(IOLayer* lay) { | ||
12 | return new SzTransfer( SzTransfer::SY, lay ); | ||
13 | } | ||
14 | FileTransferLayer* newSXTransfer(IOLayer* lay) { | ||
15 | return new SzTransfer( SzTransfer::SX, lay ); | ||
16 | } | ||
17 | |||
18 | // Layer stuff | ||
19 | IOLayer* newSerialLayer( const Profile& prof) { | ||
20 | return new IOSerial( prof ); | ||
21 | } | ||
22 | IOLayer* newBTLayer( const Profile& ) { | ||
23 | return 0l; | ||
24 | } | ||
25 | IOLayer* newIrDaLayer( const Profile& ) { | ||
26 | return 0l; | ||
27 | } | ||
28 | |||
29 | // Connection Widgets | ||
30 | ProfileDialogWidget* newSerialWidget(const QString& str, QWidget* ) { | ||
31 | return 0l; | ||
32 | } | ||
33 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid) { | ||
34 | return newSerialWidget(str, wid); | ||
35 | } | ||
36 | ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid) { | ||
37 | return newSerialWidget(str, wid ); | ||
38 | } | ||
39 | |||
40 | // Terminal Widget(s) | ||
41 | ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ) { | ||
42 | return 0l; | ||
43 | } | ||
44 | |||
45 | }; | ||
46 | |||
47 | Default::Default( MetaFactory* fact ) { | ||
48 | fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); | ||
49 | fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); | ||
50 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); | ||
51 | |||
52 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); | ||
53 | fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); | ||
54 | fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); | ||
55 | |||
56 | fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); | ||
57 | fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); | ||
58 | fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); | ||
59 | |||
60 | fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); | ||
61 | |||
62 | } | ||
63 | Default::~Default() { | ||
64 | |||
65 | } | ||
diff --git a/noncore/apps/opie-console/default.h b/noncore/apps/opie-console/default.h new file mode 100644 index 0000000..ed78986 --- a/dev/null +++ b/noncore/apps/opie-console/default.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef OPIE_DEFAULT_H | ||
2 | #define OPIE_DEFAULT_H | ||
3 | |||
4 | #include "metafactory.h" | ||
5 | |||
6 | extern "C" { | ||
7 | FileTransferLayer* newSZTransfer(IOLayer*); | ||
8 | FileTransferLayer* newSYTransfer(IOLayer*); | ||
9 | FileTransferLayer* newSXTransfer(IOLayer*); | ||
10 | |||
11 | IOLayer* newSerialLayer(const Profile&); | ||
12 | IOLayer* newBTLayer(const Profile& ); | ||
13 | IOLayer* newIrDaLayer(const Profile& ); | ||
14 | |||
15 | ProfileDialogWidget* newSerialWidget(const QString&, QWidget* ); | ||
16 | ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* ); | ||
17 | ProfileDialogWidget* newBTWidget (const QString&, QWidget* ); | ||
18 | |||
19 | ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ); | ||
20 | }; | ||
21 | |||
22 | class MetaFactory; | ||
23 | struct Default { | ||
24 | public: | ||
25 | Default(MetaFactory* ); | ||
26 | ~Default(); | ||
27 | }; | ||
28 | |||
29 | |||
30 | #endif | ||
diff --git a/noncore/apps/opie-console/io_layer.h b/noncore/apps/opie-console/io_layer.h index 2f1ceef..b891b2b 100644 --- a/noncore/apps/opie-console/io_layer.h +++ b/noncore/apps/opie-console/io_layer.h | |||
@@ -82,5 +82,5 @@ public slots: | |||
82 | * closes and reloads the settings | 82 | * closes and reloads the settings |
83 | */ | 83 | */ |
84 | virtual void reload( const Config& ) = 0; | 84 | virtual void reload( const Profile& ) = 0; |
85 | }; | 85 | }; |
86 | 86 | ||
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 31f1138..647a331 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -7,4 +7,5 @@ | |||
7 | 7 | ||
8 | #include "configdialog.h" | 8 | #include "configdialog.h" |
9 | #include "default.h" | ||
9 | #include "metafactory.h" | 10 | #include "metafactory.h" |
10 | #include "profilemanager.h" | 11 | #include "profilemanager.h" |
@@ -14,4 +15,5 @@ | |||
14 | MainWindow::MainWindow() { | 15 | MainWindow::MainWindow() { |
15 | m_factory = new MetaFactory(); | 16 | m_factory = new MetaFactory(); |
17 | Default def(m_factory); | ||
16 | m_sessions.setAutoDelete( TRUE ); | 18 | m_sessions.setAutoDelete( TRUE ); |
17 | m_curSession = 0; | 19 | m_curSession = 0; |
@@ -157,5 +159,5 @@ void MainWindow::slotTerminate() { | |||
157 | void MainWindow::slotConfigure() { | 159 | void MainWindow::slotConfigure() { |
158 | qWarning("configure"); | 160 | qWarning("configure"); |
159 | ConfigDialog conf( manager()->all() ); | 161 | ConfigDialog conf( manager()->all(), factory() ); |
160 | conf.showMaximized(); | 162 | conf.showMaximized(); |
161 | 163 | ||
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index b69d6da..077b418 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp | |||
@@ -7,16 +7,26 @@ MetaFactory::~MetaFactory() { | |||
7 | 7 | ||
8 | } | 8 | } |
9 | void MetaFactory::addConfigWidgetFactory( const QString& str, | 9 | void MetaFactory::addConnectionWidgetFactory( const QCString& name, |
10 | const QString& name, | 10 | const QString& str, |
11 | configWidget wid) { | 11 | configWidget wid) { |
12 | m_namemap.insert ( str, name ); | 12 | m_strings.insert( str, name ); |
13 | m_confFact.insert( str, wid ); | 13 | m_conFact.insert( str, wid ); |
14 | } | 14 | } |
15 | void MetaFactory::addIOLayerFactory( const QString& str, | 15 | void MetaFactory::addTerminalWidgetFactory( const QCString& name, |
16 | const QString& str, | ||
17 | configWidget wid ) { | ||
18 | m_strings.insert( str, name ); | ||
19 | m_termFact.insert( str, wid ); | ||
20 | } | ||
21 | void MetaFactory::addIOLayerFactory( const QCString& name, | ||
22 | const QString& str, | ||
16 | iolayer lay) { | 23 | iolayer lay) { |
24 | m_strings.insert( str, name ); | ||
17 | m_layerFact.insert( str, lay ); | 25 | m_layerFact.insert( str, lay ); |
18 | } | 26 | } |
19 | void MetaFactory::addFileTransferLayer( const QString& str, | 27 | void MetaFactory::addFileTransferLayer( const QCString& name, |
28 | const QString& str, | ||
20 | filelayer lay) { | 29 | filelayer lay) { |
30 | m_strings.insert(str, name ); | ||
21 | m_fileFact.insert( str, lay ); | 31 | m_fileFact.insert( str, lay ); |
22 | } | 32 | } |
@@ -29,8 +39,16 @@ QStringList MetaFactory::ioLayers()const { | |||
29 | return list; | 39 | return list; |
30 | } | 40 | } |
31 | QStringList MetaFactory::configWidgets()const { | 41 | QStringList MetaFactory::connectionWidgets()const { |
42 | QStringList list; | ||
43 | QMap<QString, configWidget>::ConstIterator it; | ||
44 | for ( it = m_conFact.begin(); it != m_conFact.end(); ++it ) { | ||
45 | list << it.key(); | ||
46 | } | ||
47 | return list; | ||
48 | } | ||
49 | QStringList MetaFactory::terminalWidgets()const { | ||
32 | QStringList list; | 50 | QStringList list; |
33 | QMap<QString, configWidget>::ConstIterator it; | 51 | QMap<QString, configWidget>::ConstIterator it; |
34 | for ( it = m_confFact.begin(); it != m_confFact.end(); ++it ) { | 52 | for ( it = m_termFact.begin(); it != m_termFact.end(); ++it ) { |
35 | list << it.key(); | 53 | list << it.key(); |
36 | } | 54 | } |
@@ -61,16 +79,36 @@ IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { | |||
61 | } | 79 | } |
62 | 80 | ||
63 | ProfileEditorPlugin *MetaFactory::newConfigPlugin ( const QString& str, QWidget *parent, Profile *prof) { | 81 | ProfileDialogWidget *MetaFactory::newConnectionPlugin ( const QString& str, QWidget *parent) { |
64 | ProfileEditorPlugin *p = NULL; | 82 | ProfileDialogWidget* wid = 0l; |
65 | configWidget c; | ||
66 | 83 | ||
67 | c = m_confFact[str]; | 84 | QMap<QString, configWidget>::Iterator it; |
68 | if(c) p = c(parent, prof); | 85 | it = m_conFact.find( str ); |
69 | 86 | if ( it != m_conFact.end() ) { | |
70 | return p; | 87 | wid = (*(it.data() ) )(str,parent); |
71 | } | 88 | } |
72 | 89 | return wid; | |
73 | QString MetaFactory::name( const QString& str ) { | ||
74 | return m_namemap[str]; | ||
75 | } | 90 | } |
91 | ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget *parent) { | ||
92 | if (str.isEmpty() ) | ||
93 | return 0l; | ||
94 | ProfileDialogWidget* wid = 0l; | ||
95 | qWarning("new terminalPlugin %s %l", str.latin1(), parent ); | ||
76 | 96 | ||
97 | QMap<QString, configWidget>::Iterator it; | ||
98 | it = m_termFact.find( str ); | ||
99 | if ( it != m_conFact.end() ) { | ||
100 | wid = (*(it.data() ) )(str,parent); | ||
101 | } | ||
102 | return wid; | ||
103 | } | ||
104 | QCString MetaFactory::internal( const QString& str )const { | ||
105 | return m_strings[str]; | ||
106 | } | ||
107 | QString MetaFactory::external( const QCString& str )const { | ||
108 | QMap<QString, QCString>::ConstIterator it; | ||
109 | for ( it = m_strings.begin(); it != m_strings.end(); ++it ) { | ||
110 | if ( it.data() == str ) | ||
111 | return it.key(); | ||
112 | } | ||
113 | return QString::null; | ||
114 | } | ||
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h index 216de03..3f7ddce 100644 --- a/noncore/apps/opie-console/metafactory.h +++ b/noncore/apps/opie-console/metafactory.h | |||
@@ -15,9 +15,9 @@ | |||
15 | #include "file_layer.h" | 15 | #include "file_layer.h" |
16 | #include "profile.h" | 16 | #include "profile.h" |
17 | #include "profileeditorplugins.h" | 17 | #include "profiledialogwidget.h" |
18 | 18 | ||
19 | class MetaFactory { | 19 | class MetaFactory { |
20 | public: | 20 | public: |
21 | typedef ProfileEditorPlugin* (*configWidget)(QWidget* parent, Profile* prof); | 21 | typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent); |
22 | typedef IOLayer* (*iolayer)(const Profile& ); | 22 | typedef IOLayer* (*iolayer)(const Profile& ); |
23 | typedef FileTransferLayer* (*filelayer)(IOLayer*); | 23 | typedef FileTransferLayer* (*filelayer)(IOLayer*); |
@@ -26,24 +26,58 @@ public: | |||
26 | ~MetaFactory(); | 26 | ~MetaFactory(); |
27 | 27 | ||
28 | void addConfigWidgetFactory( const QString&, | 28 | /** |
29 | const QString&, | 29 | * add a ProfileDialogWidget to the factory |
30 | * name is the name shown to the user | ||
31 | */ | ||
32 | void addConnectionWidgetFactory( const QCString& internalName, | ||
33 | const QString& uiString, | ||
30 | configWidget ); | 34 | configWidget ); |
31 | void addIOLayerFactory(const QString&, | 35 | void addTerminalWidgetFactory ( const QCString& internalName, |
36 | const QString& name, | ||
37 | configWidget ); | ||
38 | |||
39 | /** | ||
40 | * adds an IOLayer factory | ||
41 | */ | ||
42 | void addIOLayerFactory( const QCString&, | ||
43 | const QString&, | ||
32 | iolayer ); | 44 | iolayer ); |
33 | void addFileTransferLayer( const QString&, | 45 | |
46 | /** | ||
47 | * adds a FileTransfer Layer | ||
48 | */ | ||
49 | void addFileTransferLayer( const QCString& name, | ||
50 | const QString&, | ||
34 | filelayer ); | 51 | filelayer ); |
52 | |||
53 | /* translated UI Strings */ | ||
35 | QStringList ioLayers()const; | 54 | QStringList ioLayers()const; |
36 | QStringList configWidgets()const; | 55 | QStringList connectionWidgets()const; |
56 | QStringList terminalWidgets()const; | ||
37 | QStringList fileTransferLayers()const; | 57 | QStringList fileTransferLayers()const; |
38 | IOLayer* newIOLayer( const QString&,const Profile& ); | 58 | IOLayer* newIOLayer( const QString&,const Profile& ); |
39 | ProfileEditorPlugin *newConfigPlugin ( const QString&, QWidget*, Profile* ); | 59 | ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* ); |
60 | ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* ); | ||
61 | |||
62 | /* | ||
63 | * internal takes the maybe translated | ||
64 | * public QString and maps it to the internal | ||
65 | * not translatable QCString | ||
66 | */ | ||
67 | QCString internal( const QString& )const; | ||
68 | |||
69 | /* | ||
70 | * external takes the internal name | ||
71 | * it returns a translated name | ||
72 | */ | ||
73 | QString external( const QCString& )const; | ||
40 | 74 | ||
41 | QString name( const QString& ); | ||
42 | 75 | ||
43 | private: | 76 | private: |
44 | QMap<QString, configWidget> m_confFact; | 77 | QMap<QString, QCString> m_strings; |
78 | QMap<QString, configWidget> m_conFact; | ||
79 | QMap<QString, configWidget> m_termFact; | ||
45 | QMap<QString, iolayer> m_layerFact; | 80 | QMap<QString, iolayer> m_layerFact; |
46 | QMap<QString, filelayer> m_fileFact; | 81 | QMap<QString, filelayer> m_fileFact; |
47 | QMap<QString, QString> m_namemap; | ||
48 | }; | 82 | }; |
49 | 83 | ||
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index 768e453..984072a 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro | |||
@@ -14,6 +14,4 @@ HEADERS = io_layer.h io_serial.h \ | |||
14 | tabwidget.h \ | 14 | tabwidget.h \ |
15 | configdialog.h \ | 15 | configdialog.h \ |
16 | profileeditordialog.h \ | ||
17 | profileeditorplugins.h \ | ||
18 | emulation_layer.h \ | 16 | emulation_layer.h \ |
19 | widget.h \ | 17 | widget.h \ |
@@ -24,5 +22,8 @@ HEADERS = io_layer.h io_serial.h \ | |||
24 | keytrans.h \ | 22 | keytrans.h \ |
25 | widget_layer.h \ | 23 | widget_layer.h \ |
26 | transferdialog.h | 24 | transferdialog.h \ |
25 | profiledialogwidget.h \ | ||
26 | profileeditordialog.h \ | ||
27 | default.h | ||
27 | 28 | ||
28 | SOURCES = io_layer.cpp io_serial.cpp \ | 29 | SOURCES = io_layer.cpp io_serial.cpp \ |
@@ -37,6 +38,4 @@ SOURCES = io_layer.cpp io_serial.cpp \ | |||
37 | tabwidget.cpp \ | 38 | tabwidget.cpp \ |
38 | configdialog.cpp \ | 39 | configdialog.cpp \ |
39 | profileeditordialog.cpp \ | ||
40 | profileeditorplugins.cpp \ | ||
41 | emulation_layer.cpp \ | 40 | emulation_layer.cpp \ |
42 | widget.cpp \ | 41 | widget.cpp \ |
@@ -46,5 +45,8 @@ SOURCES = io_layer.cpp io_serial.cpp \ | |||
46 | keytrans.cpp \ | 45 | keytrans.cpp \ |
47 | widget_layer.cpp \ | 46 | widget_layer.cpp \ |
48 | transferdialog.cpp | 47 | transferdialog.cpp \ |
48 | profiledialogwidget.cpp \ | ||
49 | profileeditordialog.cpp \ | ||
50 | default.cpp | ||
49 | 51 | ||
50 | INTERFACES = configurebase.ui editbase.ui | 52 | INTERFACES = configurebase.ui editbase.ui |
diff --git a/noncore/apps/opie-console/profile.cpp b/noncore/apps/opie-console/profile.cpp index c8f5eb0..1a94619 100644 --- a/noncore/apps/opie-console/profile.cpp +++ b/noncore/apps/opie-console/profile.cpp | |||
@@ -5,12 +5,12 @@ Profile::Profile() { | |||
5 | } | 5 | } |
6 | Profile::Profile( const QString& name, | 6 | Profile::Profile( const QString& name, |
7 | const QString& iolayerName, | 7 | const QCString& iolayerName, |
8 | const QCString& termName, | ||
8 | int background, | 9 | int background, |
9 | int foreground, | 10 | int foreground, |
10 | int terminal ) | 11 | int terminal ) |
11 | : m_name( name ), m_ioLayer( iolayerName ), m_back( background ), | 12 | : m_name( name ), m_ioLayer( iolayerName ), m_term( termName), |
12 | m_fore( foreground ), m_terminal( terminal ) | 13 | m_back( background ), m_fore( foreground ), m_terminal( terminal ) |
13 | { | 14 | {} |
14 | } | ||
15 | Profile::Profile( const Profile& prof ) | 15 | Profile::Profile( const Profile& prof ) |
16 | { | 16 | { |
@@ -29,4 +29,5 @@ Profile &Profile::operator=( const Profile& prof ) { | |||
29 | m_terminal = prof.m_terminal; | 29 | m_terminal = prof.m_terminal; |
30 | m_conf = prof.m_conf; | 30 | m_conf = prof.m_conf; |
31 | m_term = prof.m_term; | ||
31 | 32 | ||
32 | return *this; | 33 | return *this; |
@@ -40,7 +41,10 @@ QString Profile::name()const { | |||
40 | return m_name; | 41 | return m_name; |
41 | } | 42 | } |
42 | QString Profile::ioLayerName()const { | 43 | QCString Profile::ioLayerName()const { |
43 | return m_ioLayer; | 44 | return m_ioLayer; |
44 | } | 45 | } |
46 | QCString Profile::terminalName( )const { | ||
47 | return m_term; | ||
48 | } | ||
45 | int Profile::foreground()const { | 49 | int Profile::foreground()const { |
46 | return m_fore; | 50 | return m_fore; |
@@ -55,7 +59,10 @@ void Profile::setName( const QString& str ) { | |||
55 | m_name = str; | 59 | m_name = str; |
56 | } | 60 | } |
57 | void Profile::setIOLayer( const QString& name ) { | 61 | void Profile::setIOLayer( const QCString& name ) { |
58 | m_ioLayer = name; | 62 | m_ioLayer = name; |
59 | } | 63 | } |
64 | void Profile::setTerminalName( const QCString& str ) { | ||
65 | m_term = str; | ||
66 | } | ||
60 | void Profile::setBackground( int back ) { | 67 | void Profile::setBackground( int back ) { |
61 | m_back = back; | 68 | m_back = back; |
diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h index 5652ac5..78fe6ab 100644 --- a/noncore/apps/opie-console/profile.h +++ b/noncore/apps/opie-console/profile.h | |||
@@ -23,5 +23,6 @@ public: | |||
23 | Profile(); | 23 | Profile(); |
24 | Profile( const QString& name, | 24 | Profile( const QString& name, |
25 | const QString& iolayerName, | 25 | const QCString& iolayerName, |
26 | const QCString& termName, | ||
26 | int background, | 27 | int background, |
27 | int foreground, | 28 | int foreground, |
@@ -33,5 +34,6 @@ public: | |||
33 | ~Profile(); | 34 | ~Profile(); |
34 | QString name()const; | 35 | QString name()const; |
35 | QString ioLayerName()const; | 36 | QCString ioLayerName()const; |
37 | QCString terminalName()const; | ||
36 | int foreground()const; | 38 | int foreground()const; |
37 | int background()const; | 39 | int background()const; |
@@ -52,5 +54,6 @@ public: | |||
52 | 54 | ||
53 | void setName( const QString& ); | 55 | void setName( const QString& ); |
54 | void setIOLayer( const QString& ); | 56 | void setIOLayer( const QCString& ); |
57 | void setTerminalName( const QCString& ); | ||
55 | void setBackground( int back ); | 58 | void setBackground( int back ); |
56 | void setForeground( int fore ); | 59 | void setForeground( int fore ); |
@@ -60,5 +63,5 @@ private: | |||
60 | QMap<QString, QString> m_conf; | 63 | QMap<QString, QString> m_conf; |
61 | QString m_name; | 64 | QString m_name; |
62 | QString m_ioLayer; | 65 | QCString m_ioLayer, m_term; |
63 | int m_back; | 66 | int m_back; |
64 | int m_fore; | 67 | int m_fore; |
diff --git a/noncore/apps/opie-console/profiledialogwidget.cpp b/noncore/apps/opie-console/profiledialogwidget.cpp new file mode 100644 index 0000000..24d59bf --- a/dev/null +++ b/noncore/apps/opie-console/profiledialogwidget.cpp | |||
@@ -0,0 +1,32 @@ | |||
1 | #include "profiledialogwidget.h" | ||
2 | |||
3 | ProfileDialogWidget::ProfileDialogWidget( const QString&, QWidget* parent, | ||
4 | const char* name ) | ||
5 | : QWidget( parent, name ) { | ||
6 | } | ||
7 | ProfileDialogWidget::~ProfileDialogWidget() { | ||
8 | } | ||
9 | |||
10 | ProfileDialogTerminalWidget::ProfileDialogTerminalWidget( const QString& na, | ||
11 | QWidget* parent, | ||
12 | const char* name ) | ||
13 | : ProfileDialogWidget( na, parent, name ) | ||
14 | { | ||
15 | } | ||
16 | ProfileDialogTerminalWidget::~ProfileDialogTerminalWidget() { | ||
17 | } | ||
18 | ProfileDialogWidget::Type ProfileDialogTerminalWidget::type()const { | ||
19 | return Terminal; | ||
20 | } | ||
21 | |||
22 | ProfileDialogConnectionWidget::ProfileDialogConnectionWidget( const QString& na, | ||
23 | QWidget* parent, | ||
24 | const char* name ) | ||
25 | : ProfileDialogWidget(na, parent, name ) | ||
26 | { | ||
27 | } | ||
28 | ProfileDialogConnectionWidget::~ProfileDialogConnectionWidget() { | ||
29 | } | ||
30 | ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const { | ||
31 | return Connection; | ||
32 | } | ||
diff --git a/noncore/apps/opie-console/profiledialogwidget.h b/noncore/apps/opie-console/profiledialogwidget.h new file mode 100644 index 0000000..5d279e6 --- a/dev/null +++ b/noncore/apps/opie-console/profiledialogwidget.h | |||
@@ -0,0 +1,50 @@ | |||
1 | #ifndef OPIE_PROFILE_DIALOG_WIDGET_H | ||
2 | #define OPIE_PROFILE_DIALOG_WIDGET_H | ||
3 | |||
4 | #include <qwidget.h> | ||
5 | |||
6 | #include "profile.h" | ||
7 | |||
8 | class ProfileDialogWidget : public QWidget { | ||
9 | Q_OBJECT | ||
10 | public: | ||
11 | enum Type { | ||
12 | Connection, | ||
13 | Terminal | ||
14 | }; | ||
15 | ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l); | ||
16 | ~ProfileDialogWidget(); | ||
17 | |||
18 | /* | ||
19 | * load data from a Profile into | ||
20 | * the DialogWidget | ||
21 | */ | ||
22 | virtual void load( const Profile& ) = 0; | ||
23 | |||
24 | /* | ||
25 | * save data into a profile | ||
26 | * from the DialogWidget | ||
27 | */ | ||
28 | virtual void save( Profile& ) = 0; | ||
29 | |||
30 | virtual Type type()const = 0; | ||
31 | }; | ||
32 | class ProfileDialogTerminalWidget : public ProfileDialogWidget { | ||
33 | Q_OBJECT | ||
34 | public: | ||
35 | ProfileDialogTerminalWidget( const QString& name, QWidget* widget, | ||
36 | const char* name =0l); | ||
37 | ~ProfileDialogTerminalWidget(); | ||
38 | Type type()const; | ||
39 | }; | ||
40 | class ProfileDialogConnectionWidget : public ProfileDialogWidget { | ||
41 | Q_OBJECT | ||
42 | public: | ||
43 | ProfileDialogConnectionWidget( const QString& name, QWidget* parent, | ||
44 | const char* name =0l); | ||
45 | ~ProfileDialogConnectionWidget(); | ||
46 | Type type() const; | ||
47 | |||
48 | }; | ||
49 | |||
50 | #endif | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 3843943..061b1c2 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -1,15 +1,27 @@ | |||
1 | #include <qlayout.h> | ||
2 | #include <qlineedit.h> | ||
3 | #include <qlabel.h> | ||
4 | #include <qmessagebox.h> | ||
5 | #include <qstringlist.h> | ||
6 | #include <qcombobox.h> | ||
1 | 7 | ||
2 | #include <opie/otabwidget.h> | ||
3 | #include "profileeditordialog.h" | ||
4 | 8 | ||
5 | #include "qlayout.h" | 9 | #include <opie/otabwidget.h> |
6 | #include "qlineedit.h" | ||
7 | #include "qlabel.h" | ||
8 | #include "qmessagebox.h" | ||
9 | #include "qstringlist.h" | ||
10 | #include "qcombobox.h" | ||
11 | 10 | ||
12 | #include "profileeditorplugins.h" | 11 | #include "profileeditorplugins.h" |
13 | #include "metafactory.h" | 12 | #include "metafactory.h" |
13 | #include "profileeditordialog.h" | ||
14 | |||
15 | namespace { | ||
16 | void setCurrent( const QString& str, QComboBox* bo ) { | ||
17 | for (uint i = 0; i < bo->count(); i++ ) { | ||
18 | if ( bo->text(i) == str ) { | ||
19 | bo->setCurrentItem( i ); | ||
20 | } | ||
21 | } | ||
22 | } | ||
23 | |||
24 | |||
25 | } | ||
14 | 26 | ||
15 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | 27 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, |
@@ -28,5 +40,5 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | |||
28 | { | 40 | { |
29 | // Default profile | 41 | // Default profile |
30 | m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102); | 42 | m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102); |
31 | 43 | ||
32 | initUI(); | 44 | initUI(); |
@@ -43,4 +55,5 @@ Profile ProfileEditorDialog::profile() const | |||
43 | void ProfileEditorDialog::initUI() | 55 | void ProfileEditorDialog::initUI() |
44 | { | 56 | { |
57 | m_con = m_term = 0l; | ||
45 | 58 | ||
46 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 59 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
@@ -48,112 +61,77 @@ void ProfileEditorDialog::initUI() | |||
48 | mainLayout->add(tabWidget); | 61 | mainLayout->add(tabWidget); |
49 | 62 | ||
50 | QWidget *tabterm, *tabconn, *tabprof; | 63 | QWidget *tabprof; |
51 | 64 | ||
65 | /* base tabs */ | ||
52 | tabprof = new QWidget(this); | 66 | tabprof = new QWidget(this); |
53 | tabterm = new QWidget(this); | 67 | m_tabTerm = new QWidget(this); |
54 | tabconn = new QWidget(this); | 68 | m_tabCon = new QWidget(this); |
55 | 69 | ||
56 | // for the time being: fake factory | 70 | /* base layout for tabs */ |
57 | 71 | m_layCon = new QHBoxLayout( m_tabCon , 2 ); | |
58 | m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); | 72 | m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); |
59 | m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); | ||
60 | m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); | ||
61 | 73 | ||
62 | // profile tab | 74 | // profile tab |
63 | 75 | ||
64 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); | 76 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); |
65 | 77 | m_name = new QLineEdit(tabprof); | |
66 | name_line = new QLineEdit(tabprof); | 78 | QLabel *con = new QLabel(tr("Connection"), tabprof ); |
67 | 79 | QLabel *term = new QLabel(tr("Terminal"), tabprof ); | |
68 | // connection tab, fixed part | 80 | m_conCmb = new QComboBox( tabprof ); |
69 | 81 | m_termCmb = new QComboBox( tabprof ); | |
70 | QLabel *device = new QLabel(QObject::tr("Device"), tabconn); | ||
71 | |||
72 | device_box = new QComboBox(tabconn); | ||
73 | |||
74 | QStringList w = m_fact->configWidgets(); | ||
75 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) | ||
76 | device_box->insertItem(m_fact->name((*it))); | ||
77 | |||
78 | // connection tab, factory part | ||
79 | plugin_base = new QWidget(tabconn); | ||
80 | plugin_layout = new QHBoxLayout(plugin_base, 0); | ||
81 | |||
82 | plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, &m_prof); | ||
83 | plugin_layout->add(plugin_plugin->widget()); | ||
84 | |||
85 | // connection tab, general part | ||
86 | |||
87 | QWidget *conn_widget = plugin_plugin->connection_widget(); | ||
88 | conn_widget->reparent(tabconn, 0, QPoint(), true); | ||
89 | |||
90 | // terminal tab | ||
91 | |||
92 | QWidget *term_widget = plugin_plugin->terminal_widget(); | ||
93 | term_widget->reparent(tabterm, 0, QPoint(), true); | ||
94 | 82 | ||
95 | // layouting | 83 | // layouting |
96 | |||
97 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); | 84 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); |
98 | vbox3->add(name); | 85 | vbox3->add(name); |
99 | vbox3->add(name_line); | 86 | vbox3->add(m_name); |
87 | vbox3->add(con ); | ||
88 | vbox3->add(m_conCmb ); | ||
89 | vbox3->add(term ); | ||
90 | vbox3->add(m_termCmb ); | ||
100 | vbox3->addStretch(1); | 91 | vbox3->addStretch(1); |
101 | 92 | ||
102 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); | ||
103 | vbox->add(device); | ||
104 | vbox->add(device_box); | ||
105 | vbox->add(plugin_base); | ||
106 | vbox->add(conn_widget); | ||
107 | vbox->setStretchFactor(device, 1); | ||
108 | vbox->setStretchFactor(device_box, 1); | ||
109 | vbox->setStretchFactor(plugin_base, 1); | ||
110 | vbox->setStretchFactor(conn_widget, 7); | ||
111 | |||
112 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); | ||
113 | vbox2->add(term_widget); | ||
114 | |||
115 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); | 93 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); |
116 | tabWidget->addTab(tabconn, "", QObject::tr("Connection")); | 94 | tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); |
117 | tabWidget->addTab(tabterm, "", QObject::tr("Terminal")); | 95 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); |
118 | tabWidget->setCurrentTab( tabprof ); | 96 | tabWidget->setCurrentTab( tabprof ); |
119 | 97 | ||
120 | // load profile values | ||
121 | name_line->setText(m_prof.name()); | ||
122 | for(int i = 0; i < device_box->count(); i++) | ||
123 | { | ||
124 | device_box->setCurrentItem(i); | ||
125 | if(prof_type() == m_prof.ioLayerName()) | ||
126 | { | ||
127 | slotDevice(i); | ||
128 | break; | ||
129 | } | ||
130 | } | ||
131 | 98 | ||
132 | // signals | 99 | // fill the comboboxes |
133 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); | 100 | QStringList list = m_fact->connectionWidgets(); |
101 | QStringList::Iterator it; | ||
102 | for (it =list.begin(); it != list.end(); ++it ) { | ||
103 | m_conCmb->insertItem( (*it) ); | ||
134 | } | 104 | } |
135 | 105 | list = m_fact->terminalWidgets(); | |
136 | ProfileEditorDialog::~ProfileEditorDialog() { | 106 | for (it =list.begin(); it != list.end(); ++it ) { |
137 | 107 | m_termCmb->insertItem( (*it) ); | |
138 | } | 108 | } |
139 | 109 | ||
140 | void ProfileEditorDialog::slotDevice(int id) | 110 | // load profile values |
141 | { | 111 | m_name->setText(m_prof.name()); |
142 | delete plugin_plugin; | 112 | slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); |
113 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); | ||
114 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); | ||
115 | setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); | ||
116 | |||
117 | qWarning("Layer: %s %s", m_prof.ioLayerName().data(), | ||
118 | m_fact->external(m_prof.ioLayerName() ).latin1() ); | ||
119 | qWarning("Term: %s %s", m_prof.terminalName().data(), | ||
120 | m_fact->external(m_prof.terminalName() ).latin1() ); | ||
121 | |||
122 | // signal and slots | ||
123 | connect(m_conCmb, SIGNAL(activated(const QString& ) ), | ||
124 | this, SLOT(slotConActivated(const QString&) ) ); | ||
125 | connect(m_termCmb, SIGNAL(activated(const QString& ) ), | ||
126 | this, SLOT(slotTermActivated(const QString& ) ) ); | ||
143 | 127 | ||
144 | plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, &m_prof); | 128 | } |
145 | plugin_layout->add(plugin_plugin->widget()); | ||
146 | 129 | ||
147 | // Reload profile associated to device, including e.g. conn_device() | 130 | ProfileEditorDialog::~ProfileEditorDialog() { |
148 | // m_prof = plugin_plugin->profile() | ||
149 | // or, keeping the profile name: m_prof->reload(plugin_plugin->profile()) | ||
150 | 131 | ||
151 | //plugin_plugin->show(); | ||
152 | plugin_plugin->widget()->show(); | ||
153 | } | 132 | } |
154 | |||
155 | void ProfileEditorDialog::accept() | 133 | void ProfileEditorDialog::accept() |
156 | { | 134 | { |
157 | if(prof_name().isEmpty()) | 135 | if(profName().isEmpty()) |
158 | { | 136 | { |
159 | QMessageBox::information(this, | 137 | QMessageBox::information(this, |
@@ -163,9 +141,12 @@ void ProfileEditorDialog::accept() | |||
163 | } | 141 | } |
164 | // Save profile and plugin profile | 142 | // Save profile and plugin profile |
165 | if(plugin_plugin) plugin_plugin->save(); | 143 | //if(plugin_plugin) plugin_plugin->save(); |
166 | 144 | ||
167 | // Save general values | 145 | // Save general values |
168 | m_prof.setName(prof_name()); | 146 | m_prof.setName(profName()); |
169 | m_prof.setIOLayer(prof_type()); | 147 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); |
148 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); | ||
149 | qWarning("Term %s %s", m_fact->internal(m_termCmb->currentText() ).data(), | ||
150 | m_termCmb->currentText().latin1() ); | ||
170 | 151 | ||
171 | QDialog::accept(); | 152 | QDialog::accept(); |
@@ -173,17 +154,37 @@ void ProfileEditorDialog::accept() | |||
173 | 154 | ||
174 | 155 | ||
175 | QString ProfileEditorDialog::prof_name() | 156 | QString ProfileEditorDialog::profName()const |
176 | { | 157 | { |
177 | return name_line->text(); | 158 | return m_name->text(); |
178 | } | 159 | } |
179 | 160 | ||
180 | QString ProfileEditorDialog::prof_type() | 161 | QCString ProfileEditorDialog::profType()const |
181 | { | 162 | { |
182 | QStringList w = m_fact->configWidgets(); | 163 | /*QStringList w = m_fact->configWidgets(); |
183 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) | 164 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
184 | if(device_box->currentText() == m_fact->name((*it))) return (*it); | 165 | if(device_box->currentText() == m_fact->name((*it))) return (*it); |
185 | 166 | */ | |
186 | return QString::null; | 167 | return QCString(); |
168 | } | ||
169 | /* | ||
170 | * we need to switch the widget | ||
171 | */ | ||
172 | void ProfileEditorDialog::slotConActivated( const QString& str ) { | ||
173 | delete m_con; | ||
174 | m_con = m_fact->newConnectionPlugin( str, m_tabCon ); | ||
175 | |||
176 | if (m_con ) | ||
177 | m_layCon->addWidget( m_con ); | ||
178 | } | ||
179 | /* | ||
180 | * we need to switch the widget | ||
181 | */ | ||
182 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { | ||
183 | delete m_term; | ||
184 | m_term = m_fact->newTerminalPlugin( str, 0l ); | ||
185 | qWarning("past"); | ||
186 | |||
187 | if (m_term) | ||
188 | m_layTerm->addWidget( m_term ); | ||
187 | } | 189 | } |
188 | |||
189 | 190 | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index 8e830f1..3b67bb3 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h | |||
@@ -13,5 +13,5 @@ class QLineEdit; | |||
13 | class QComboBox; | 13 | class QComboBox; |
14 | class QLabel; | 14 | class QLabel; |
15 | class ProfileEditorPlugin; | 15 | class ProfileDialogWidget; |
16 | 16 | ||
17 | class ProfileEditorDialog : public QDialog { | 17 | class ProfileEditorDialog : public QDialog { |
@@ -24,26 +24,27 @@ public: | |||
24 | Profile profile()const; | 24 | Profile profile()const; |
25 | 25 | ||
26 | QString prof_name(); | 26 | |
27 | QString prof_type(); | ||
28 | 27 | ||
29 | public slots: | 28 | public slots: |
30 | void accept(); | 29 | void accept(); |
31 | void slotDevice(int id); | ||
32 | 30 | ||
31 | private slots: | ||
32 | void slotConActivated(const QString& ); | ||
33 | void slotTermActivated( const QString& ); | ||
33 | private: | 34 | private: |
34 | void initUI(); | 35 | void initUI(); |
36 | QString profName()const; | ||
37 | QCString profType()const; | ||
35 | 38 | ||
36 | MetaFactory* m_fact; | 39 | MetaFactory* m_fact; |
37 | EditBase* m_base; | ||
38 | QTabWidget* m_tab; | ||
39 | QHBoxLayout* m_lay; | 40 | QHBoxLayout* m_lay; |
40 | Profile m_prof; | 41 | Profile m_prof; |
41 | 42 | ||
42 | QLineEdit *name_line; | 43 | QLineEdit *m_name; |
43 | QComboBox *device_box; | 44 | QComboBox *m_conCmb, *m_termCmb; |
44 | 45 | ||
45 | QWidget *plugin_base; | 46 | QWidget *m_tabCon, *m_tabTerm; |
46 | ProfileEditorPlugin *plugin_plugin; | 47 | ProfileDialogWidget* m_con, *m_term; |
47 | QHBoxLayout *plugin_layout; | 48 | QHBoxLayout *m_layCon, *m_layTerm; |
48 | }; | 49 | }; |
49 | 50 | ||
diff --git a/noncore/apps/opie-console/profileeditorplugins.h b/noncore/apps/opie-console/profileeditorplugins.h index 591163a..4ca780e 100644 --- a/noncore/apps/opie-console/profileeditorplugins.h +++ b/noncore/apps/opie-console/profileeditorplugins.h | |||
@@ -4,5 +4,5 @@ | |||
4 | #include "profile.h" | 4 | #include "profile.h" |
5 | 5 | ||
6 | #include "qobject.h" | 6 | #include <qobject.h> |
7 | 7 | ||
8 | class QWidget; | 8 | class QWidget; |
@@ -12,5 +12,5 @@ class ProfileEditorPlugin : public QObject | |||
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | public: | 13 | public: |
14 | ProfileEditorPlugin(QWidget *parent, Profile *p); | 14 | ProfileEditorPlugin(QWidget *parent); |
15 | 15 | ||
16 | virtual ~ProfileEditorPlugin(); | 16 | virtual ~ProfileEditorPlugin(); |
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp index 72a5117..6ad08b5 100644 --- a/noncore/apps/opie-console/profilemanager.cpp +++ b/noncore/apps/opie-console/profilemanager.cpp | |||
@@ -29,5 +29,6 @@ void ProfileManager::load() { | |||
29 | Profile prof; | 29 | Profile prof; |
30 | prof.setName( conf.readEntry("name") ); | 30 | prof.setName( conf.readEntry("name") ); |
31 | prof.setIOLayer( conf.readEntry("iolayer") ); | 31 | prof.setIOLayer( conf.readEntry("iolayer").utf8() ); |
32 | prof.setTerminalName( conf.readEntry("term").utf8() ); | ||
32 | prof.setBackground( conf.readNumEntry("back") ); | 33 | prof.setBackground( conf.readNumEntry("back") ); |
33 | prof.setForeground( conf.readNumEntry("fore") ); | 34 | prof.setForeground( conf.readNumEntry("fore") ); |
@@ -66,5 +67,6 @@ void ProfileManager::save( ) { | |||
66 | conf.setGroup( (*it).name() ); | 67 | conf.setGroup( (*it).name() ); |
67 | conf.writeEntry( "name", (*it).name() ); | 68 | conf.writeEntry( "name", (*it).name() ); |
68 | conf.writeEntry( "ioplayer", (*it).ioLayerName() ); | 69 | conf.writeEntry( "ioplayer", QString::fromUtf8( (*it).ioLayerName() ) ); |
70 | conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) ); | ||
69 | conf.writeEntry( "back", (*it).background() ); | 71 | conf.writeEntry( "back", (*it).background() ); |
70 | conf.writeEntry( "fore", (*it).foreground() ); | 72 | conf.writeEntry( "fore", (*it).foreground() ); |
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp index de321ae..10f3f7a 100644 --- a/noncore/apps/opie-console/sz_transfer.cpp +++ b/noncore/apps/opie-console/sz_transfer.cpp | |||
@@ -4,5 +4,5 @@ | |||
4 | #include <opie/oprocess.h> | 4 | #include <opie/oprocess.h> |
5 | 5 | ||
6 | SzTransfer::SzTransfer(IOLayer *layer) : FileTransferLayer(layer) | 6 | SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) |
7 | { | 7 | { |
8 | } | 8 | } |
diff --git a/noncore/apps/opie-console/sz_transfer.h b/noncore/apps/opie-console/sz_transfer.h index 778d1d3..825680d 100644 --- a/noncore/apps/opie-console/sz_transfer.h +++ b/noncore/apps/opie-console/sz_transfer.h | |||
@@ -10,6 +10,11 @@ class SzTransfer : public FileTransferLayer { | |||
10 | 10 | ||
11 | public: | 11 | public: |
12 | enum Type { | ||
13 | SZ=0, | ||
14 | SX, | ||
15 | SY | ||
16 | }; | ||
12 | 17 | ||
13 | SzTransfer( IOLayer * ); | 18 | SzTransfer( Type t, IOLayer * ); |
14 | ~SzTransfer(); | 19 | ~SzTransfer(); |
15 | 20 | ||
@@ -18,6 +23,6 @@ public slots: | |||
18 | * send a file over the layer | 23 | * send a file over the layer |
19 | */ | 24 | */ |
20 | void sendFile( const QString& file ) = 0; | 25 | void sendFile( const QString& file ) ; |
21 | void sendFile( const QFile& ) = 0; | 26 | void sendFile( const QFile& ); |
22 | 27 | ||
23 | private slots: | 28 | private slots: |
@@ -28,4 +33,5 @@ private slots: | |||
28 | private: | 33 | private: |
29 | OProcess *proc; | 34 | OProcess *proc; |
35 | Type m_t; | ||
30 | 36 | ||
31 | }; | 37 | }; |