summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/common.h2
-rw-r--r--noncore/apps/opie-console/configdialog.cpp10
-rw-r--r--noncore/apps/opie-console/configdialog.h5
-rw-r--r--noncore/apps/opie-console/default.cpp65
-rw-r--r--noncore/apps/opie-console/default.h30
-rw-r--r--noncore/apps/opie-console/io_layer.h2
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp4
-rw-r--r--noncore/apps/opie-console/metafactory.cpp76
-rw-r--r--noncore/apps/opie-console/metafactory.h60
-rw-r--r--noncore/apps/opie-console/opie-console.pro16
-rw-r--r--noncore/apps/opie-console/profile.cpp21
-rw-r--r--noncore/apps/opie-console/profile.h11
-rw-r--r--noncore/apps/opie-console/profiledialogwidget.cpp32
-rw-r--r--noncore/apps/opie-console/profiledialogwidget.h50
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp239
-rw-r--r--noncore/apps/opie-console/profileeditordialog.h25
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.h142
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp6
-rw-r--r--noncore/apps/opie-console/sz_transfer.cpp2
-rw-r--r--noncore/apps/opie-console/sz_transfer.h12
20 files changed, 544 insertions, 266 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
@@ -26,7 +26,7 @@
#include <qcolor.h>
#ifndef BOOL
-typedef int BOOL;
+typedef bool BOOL;
#endif
#ifndef FALSE
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
@@ -29,8 +29,9 @@ Profile ConfigListItem::profile()const {
/* Dialog */
-ConfigDialog::ConfigDialog( const Profile::ValueList& lis, QWidget* parent )
- : ConfigureBase( parent, 0, TRUE )
+ConfigDialog::ConfigDialog( const Profile::ValueList& lis, MetaFactory* fa,
+ QWidget* parent )
+ : ConfigureBase( parent, 0, TRUE ), m_fact( fa )
{
//init();
{
@@ -71,7 +72,7 @@ void ConfigDialog::slotEdit() {
// Load profile
p = ((ConfigListItem*)lstView->currentItem())->profile();
- ProfileEditorDialog dlg(new MetaFactory(), p);
+ ProfileEditorDialog dlg(m_fact, p);
dlg.setCaption("Edit Connection Profile");
dlg.showMaximized();
@@ -90,7 +91,8 @@ void ConfigDialog::slotEdit() {
void ConfigDialog::slotAdd() {
- ProfileEditorDialog dlg(new MetaFactory());
+ qWarning("slotAdd");
+ ProfileEditorDialog dlg(m_fact);
dlg.setCaption("New Connection");
dlg.showMaximized();
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
@@ -6,10 +6,11 @@
#include "configurebase.h"
#include "profile.h"
+class MetaFactory;
class ConfigDialog : public ConfigureBase {
Q_OBJECT
public:
- ConfigDialog( const Profile::ValueList&, QWidget* parent = 0l);
+ ConfigDialog( const Profile::ValueList&, MetaFactory*, QWidget* parent = 0l);
~ConfigDialog();
Profile::ValueList list()const;
@@ -17,6 +18,8 @@ protected slots:
void slotRemove();
void slotEdit();
void slotAdd();
+private:
+ MetaFactory* m_fact;
};
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 @@
+#include "io_serial.h"
+#include "sz_transfer.h"
+
+#include "default.h"
+
+extern "C" {
+ // FILE Transfer Stuff
+ FileTransferLayer* newSZTransfer(IOLayer* lay) {
+ return new SzTransfer( SzTransfer::SZ, lay );
+ }
+ FileTransferLayer* newSYTransfer(IOLayer* lay) {
+ return new SzTransfer( SzTransfer::SY, lay );
+ }
+ FileTransferLayer* newSXTransfer(IOLayer* lay) {
+ return new SzTransfer( SzTransfer::SX, lay );
+ }
+
+ // Layer stuff
+ IOLayer* newSerialLayer( const Profile& prof) {
+ return new IOSerial( prof );
+ }
+ IOLayer* newBTLayer( const Profile& ) {
+ return 0l;
+ }
+ IOLayer* newIrDaLayer( const Profile& ) {
+ return 0l;
+ }
+
+ // Connection Widgets
+ ProfileDialogWidget* newSerialWidget(const QString& str, QWidget* ) {
+ return 0l;
+ }
+ ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid) {
+ return newSerialWidget(str, wid);
+ }
+ ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid) {
+ return newSerialWidget(str, wid );
+ }
+
+ // Terminal Widget(s)
+ ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ) {
+ return 0l;
+ }
+
+};
+
+Default::Default( MetaFactory* fact ) {
+ fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer );
+ fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer );
+ fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer );
+
+ fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer );
+ fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer );
+ fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer );
+
+ fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget );
+ fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget );
+ fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget );
+
+ fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget );
+
+}
+Default::~Default() {
+
+}
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 @@
+#ifndef OPIE_DEFAULT_H
+#define OPIE_DEFAULT_H
+
+#include "metafactory.h"
+
+extern "C" {
+ FileTransferLayer* newSZTransfer(IOLayer*);
+ FileTransferLayer* newSYTransfer(IOLayer*);
+ FileTransferLayer* newSXTransfer(IOLayer*);
+
+ IOLayer* newSerialLayer(const Profile&);
+ IOLayer* newBTLayer(const Profile& );
+ IOLayer* newIrDaLayer(const Profile& );
+
+ ProfileDialogWidget* newSerialWidget(const QString&, QWidget* );
+ ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* );
+ ProfileDialogWidget* newBTWidget (const QString&, QWidget* );
+
+ ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* );
+};
+
+class MetaFactory;
+struct Default {
+public:
+ Default(MetaFactory* );
+ ~Default();
+};
+
+
+#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
@@ -81,7 +81,7 @@ public slots:
/**
* closes and reloads the settings
*/
- virtual void reload( const Config& ) = 0;
+ virtual void reload( const Profile& ) = 0;
};
#endif
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
@@ -6,6 +6,7 @@
#include <qtoolbar.h>
#include "configdialog.h"
+#include "default.h"
#include "metafactory.h"
#include "profilemanager.h"
#include "mainwindow.h"
@@ -13,6 +14,7 @@
MainWindow::MainWindow() {
m_factory = new MetaFactory();
+ Default def(m_factory);
m_sessions.setAutoDelete( TRUE );
m_curSession = 0;
m_manager = new ProfileManager( m_factory );
@@ -156,7 +158,7 @@ void MainWindow::slotTerminate() {
void MainWindow::slotConfigure() {
qWarning("configure");
- ConfigDialog conf( manager()->all() );
+ ConfigDialog conf( manager()->all(), factory() );
conf.showMaximized();
int ret = conf.exec();
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
@@ -6,18 +6,28 @@ MetaFactory::MetaFactory() {
MetaFactory::~MetaFactory() {
}
-void MetaFactory::addConfigWidgetFactory( const QString& str,
- const QString& name,
- configWidget wid) {
- m_namemap.insert ( str, name );
- m_confFact.insert( str, wid );
+void MetaFactory::addConnectionWidgetFactory( const QCString& name,
+ const QString& str,
+ configWidget wid) {
+ m_strings.insert( str, name );
+ m_conFact.insert( str, wid );
}
-void MetaFactory::addIOLayerFactory( const QString& str,
+void MetaFactory::addTerminalWidgetFactory( const QCString& name,
+ const QString& str,
+ configWidget wid ) {
+ m_strings.insert( str, name );
+ m_termFact.insert( str, wid );
+}
+void MetaFactory::addIOLayerFactory( const QCString& name,
+ const QString& str,
iolayer lay) {
+ m_strings.insert( str, name );
m_layerFact.insert( str, lay );
}
-void MetaFactory::addFileTransferLayer( const QString& str,
+void MetaFactory::addFileTransferLayer( const QCString& name,
+ const QString& str,
filelayer lay) {
+ m_strings.insert(str, name );
m_fileFact.insert( str, lay );
}
QStringList MetaFactory::ioLayers()const {
@@ -28,10 +38,18 @@ QStringList MetaFactory::ioLayers()const {
}
return list;
}
-QStringList MetaFactory::configWidgets()const {
+QStringList MetaFactory::connectionWidgets()const {
+ QStringList list;
+ QMap<QString, configWidget>::ConstIterator it;
+ for ( it = m_conFact.begin(); it != m_conFact.end(); ++it ) {
+ list << it.key();
+ }
+ return list;
+}
+QStringList MetaFactory::terminalWidgets()const {
QStringList list;
QMap<QString, configWidget>::ConstIterator it;
- for ( it = m_confFact.begin(); it != m_confFact.end(); ++it ) {
+ for ( it = m_termFact.begin(); it != m_termFact.end(); ++it ) {
list << it.key();
}
return list;
@@ -60,17 +78,37 @@ IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) {
return lay;
}
-ProfileEditorPlugin *MetaFactory::newConfigPlugin ( const QString& str, QWidget *parent, Profile *prof) {
- ProfileEditorPlugin *p = NULL;
- configWidget c;
+ProfileDialogWidget *MetaFactory::newConnectionPlugin ( const QString& str, QWidget *parent) {
+ ProfileDialogWidget* wid = 0l;
- c = m_confFact[str];
- if(c) p = c(parent, prof);
-
- return p;
+ QMap<QString, configWidget>::Iterator it;
+ it = m_conFact.find( str );
+ if ( it != m_conFact.end() ) {
+ wid = (*(it.data() ) )(str,parent);
+ }
+ return wid;
}
+ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget *parent) {
+ if (str.isEmpty() )
+ return 0l;
+ ProfileDialogWidget* wid = 0l;
+ qWarning("new terminalPlugin %s %l", str.latin1(), parent );
-QString MetaFactory::name( const QString& str ) {
- return m_namemap[str];
+ QMap<QString, configWidget>::Iterator it;
+ it = m_termFact.find( str );
+ if ( it != m_conFact.end() ) {
+ wid = (*(it.data() ) )(str,parent);
+ }
+ return wid;
+}
+QCString MetaFactory::internal( const QString& str )const {
+ return m_strings[str];
+}
+QString MetaFactory::external( const QCString& str )const {
+ QMap<QString, QCString>::ConstIterator it;
+ for ( it = m_strings.begin(); it != m_strings.end(); ++it ) {
+ if ( it.data() == str )
+ return it.key();
+ }
+ return QString::null;
}
-
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
@@ -14,37 +14,71 @@
#include "io_layer.h"
#include "file_layer.h"
#include "profile.h"
-#include "profileeditorplugins.h"
+#include "profiledialogwidget.h"
class MetaFactory {
public:
- typedef ProfileEditorPlugin* (*configWidget)(QWidget* parent, Profile* prof);
+ typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent);
typedef IOLayer* (*iolayer)(const Profile& );
typedef FileTransferLayer* (*filelayer)(IOLayer*);
MetaFactory();
~MetaFactory();
- void addConfigWidgetFactory( const QString&,
- const QString&,
- configWidget );
- void addIOLayerFactory(const QString&,
- iolayer );
- void addFileTransferLayer( const QString&,
+ /**
+ * add a ProfileDialogWidget to the factory
+ * name is the name shown to the user
+ */
+ void addConnectionWidgetFactory( const QCString& internalName,
+ const QString& uiString,
+ configWidget );
+ void addTerminalWidgetFactory ( const QCString& internalName,
+ const QString& name,
+ configWidget );
+
+ /**
+ * adds an IOLayer factory
+ */
+ void addIOLayerFactory( const QCString&,
+ const QString&,
+ iolayer );
+
+ /**
+ * adds a FileTransfer Layer
+ */
+ void addFileTransferLayer( const QCString& name,
+ const QString&,
filelayer );
+
+ /* translated UI Strings */
QStringList ioLayers()const;
- QStringList configWidgets()const;
+ QStringList connectionWidgets()const;
+ QStringList terminalWidgets()const;
QStringList fileTransferLayers()const;
IOLayer* newIOLayer( const QString&,const Profile& );
- ProfileEditorPlugin *newConfigPlugin ( const QString&, QWidget*, Profile* );
+ ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* );
+ ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* );
+
+ /*
+ * internal takes the maybe translated
+ * public QString and maps it to the internal
+ * not translatable QCString
+ */
+ QCString internal( const QString& )const;
+
+ /*
+ * external takes the internal name
+ * it returns a translated name
+ */
+ QString external( const QCString& )const;
- QString name( const QString& );
private:
- QMap<QString, configWidget> m_confFact;
+ QMap<QString, QCString> m_strings;
+ QMap<QString, configWidget> m_conFact;
+ QMap<QString, configWidget> m_termFact;
QMap<QString, iolayer> m_layerFact;
QMap<QString, filelayer> m_fileFact;
- QMap<QString, QString> m_namemap;
};
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
@@ -13,8 +13,6 @@ HEADERS = io_layer.h io_serial.h \
configwidget.h \
tabwidget.h \
configdialog.h \
- profileeditordialog.h \
- profileeditorplugins.h \
emulation_layer.h \
widget.h \
vt102emulation.h \
@@ -23,11 +21,14 @@ HEADERS = io_layer.h io_serial.h \
screen.h \
keytrans.h \
widget_layer.h \
- transferdialog.h
+ transferdialog.h \
+ profiledialogwidget.h \
+ profileeditordialog.h \
+ default.h
SOURCES = io_layer.cpp io_serial.cpp \
file_layer.cpp sz_transfer.cpp \
- main.cpp \
+ main.cpp \
metafactory.cpp \
session.cpp \
mainwindow.cpp \
@@ -36,8 +37,6 @@ SOURCES = io_layer.cpp io_serial.cpp \
profilemanager.cpp \
tabwidget.cpp \
configdialog.cpp \
- profileeditordialog.cpp \
- profileeditorplugins.cpp \
emulation_layer.cpp \
widget.cpp \
vt102emulation.cpp \
@@ -45,7 +44,10 @@ SOURCES = io_layer.cpp io_serial.cpp \
screen.cpp \
keytrans.cpp \
widget_layer.cpp \
- transferdialog.cpp
+ transferdialog.cpp \
+ profiledialogwidget.cpp \
+ profileeditordialog.cpp \
+ default.cpp
INTERFACES = configurebase.ui editbase.ui
INCLUDEPATH += $(OPIEDIR)/include
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
@@ -4,14 +4,14 @@ Profile::Profile() {
}
Profile::Profile( const QString& name,
- const QString& iolayerName,
+ const QCString& iolayerName,
+ const QCString& termName,
int background,
int foreground,
int terminal )
- : m_name( name ), m_ioLayer( iolayerName ), m_back( background ),
- m_fore( foreground ), m_terminal( terminal )
-{
-}
+ : m_name( name ), m_ioLayer( iolayerName ), m_term( termName),
+ m_back( background ), m_fore( foreground ), m_terminal( terminal )
+{}
Profile::Profile( const Profile& prof )
{
(*this) = prof;
@@ -28,6 +28,7 @@ Profile &Profile::operator=( const Profile& prof ) {
m_fore = prof.m_fore;
m_terminal = prof.m_terminal;
m_conf = prof.m_conf;
+ m_term = prof.m_term;
return *this;
}
@@ -39,9 +40,12 @@ QMap<QString, QString> Profile::conf()const {
QString Profile::name()const {
return m_name;
}
-QString Profile::ioLayerName()const {
+QCString Profile::ioLayerName()const {
return m_ioLayer;
}
+QCString Profile::terminalName( )const {
+ return m_term;
+}
int Profile::foreground()const {
return m_fore;
}
@@ -54,9 +58,12 @@ int Profile::terminal()const {
void Profile::setName( const QString& str ) {
m_name = str;
}
-void Profile::setIOLayer( const QString& name ) {
+void Profile::setIOLayer( const QCString& name ) {
m_ioLayer = name;
}
+void Profile::setTerminalName( const QCString& str ) {
+ m_term = str;
+}
void Profile::setBackground( int back ) {
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
@@ -22,7 +22,8 @@ public:
enum Font { Micro = 0, Small, Medium };
Profile();
Profile( const QString& name,
- const QString& iolayerName,
+ const QCString& iolayerName,
+ const QCString& termName,
int background,
int foreground,
int terminal);
@@ -32,7 +33,8 @@ public:
~Profile();
QString name()const;
- QString ioLayerName()const;
+ QCString ioLayerName()const;
+ QCString terminalName()const;
int foreground()const;
int background()const;
int terminal()const;
@@ -51,7 +53,8 @@ public:
bool readBoolEntry( const QString& key, bool = FALSE )const;
void setName( const QString& );
- void setIOLayer( const QString& );
+ void setIOLayer( const QCString& );
+ void setTerminalName( const QCString& );
void setBackground( int back );
void setForeground( int fore );
void setTerminal( int term );
@@ -59,7 +62,7 @@ public:
private:
QMap<QString, QString> m_conf;
QString m_name;
- QString m_ioLayer;
+ QCString m_ioLayer, m_term;
int m_back;
int m_fore;
int m_terminal;
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 @@
+#include "profiledialogwidget.h"
+
+ProfileDialogWidget::ProfileDialogWidget( const QString&, QWidget* parent,
+ const char* name )
+ : QWidget( parent, name ) {
+}
+ProfileDialogWidget::~ProfileDialogWidget() {
+}
+
+ProfileDialogTerminalWidget::ProfileDialogTerminalWidget( const QString& na,
+ QWidget* parent,
+ const char* name )
+ : ProfileDialogWidget( na, parent, name )
+{
+}
+ProfileDialogTerminalWidget::~ProfileDialogTerminalWidget() {
+}
+ProfileDialogWidget::Type ProfileDialogTerminalWidget::type()const {
+ return Terminal;
+}
+
+ProfileDialogConnectionWidget::ProfileDialogConnectionWidget( const QString& na,
+ QWidget* parent,
+ const char* name )
+ : ProfileDialogWidget(na, parent, name )
+{
+}
+ProfileDialogConnectionWidget::~ProfileDialogConnectionWidget() {
+}
+ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const {
+ return Connection;
+}
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 @@
+#ifndef OPIE_PROFILE_DIALOG_WIDGET_H
+#define OPIE_PROFILE_DIALOG_WIDGET_H
+
+#include <qwidget.h>
+
+#include "profile.h"
+
+class ProfileDialogWidget : public QWidget {
+ Q_OBJECT
+public:
+ enum Type {
+ Connection,
+ Terminal
+ };
+ ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l);
+ ~ProfileDialogWidget();
+
+ /*
+ * load data from a Profile into
+ * the DialogWidget
+ */
+ virtual void load( const Profile& ) = 0;
+
+ /*
+ * save data into a profile
+ * from the DialogWidget
+ */
+ virtual void save( Profile& ) = 0;
+
+ virtual Type type()const = 0;
+};
+class ProfileDialogTerminalWidget : public ProfileDialogWidget {
+ Q_OBJECT
+public:
+ ProfileDialogTerminalWidget( const QString& name, QWidget* widget,
+ const char* name =0l);
+ ~ProfileDialogTerminalWidget();
+ Type type()const;
+};
+class ProfileDialogConnectionWidget : public ProfileDialogWidget {
+ Q_OBJECT
+public:
+ ProfileDialogConnectionWidget( const QString& name, QWidget* parent,
+ const char* name =0l);
+ ~ProfileDialogConnectionWidget();
+ Type type() const;
+
+};
+
+#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,16 +1,28 @@
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qlabel.h>
+#include <qmessagebox.h>
+#include <qstringlist.h>
+#include <qcombobox.h>
-#include <opie/otabwidget.h>
-#include "profileeditordialog.h"
-#include "qlayout.h"
-#include "qlineedit.h"
-#include "qlabel.h"
-#include "qmessagebox.h"
-#include "qstringlist.h"
-#include "qcombobox.h"
+#include <opie/otabwidget.h>
#include "profileeditorplugins.h"
#include "metafactory.h"
+#include "profileeditordialog.h"
+
+namespace {
+ void setCurrent( const QString& str, QComboBox* bo ) {
+ for (uint i = 0; i < bo->count(); i++ ) {
+ if ( bo->text(i) == str ) {
+ bo->setCurrentItem( i );
+ }
+ }
+ }
+
+
+}
ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
const Profile& prof )
@@ -27,7 +39,7 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
: QDialog(0, 0, TRUE), m_fact( fact )
{
// Default profile
- m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102);
+ m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102);
initUI();
@@ -42,119 +54,85 @@ Profile ProfileEditorDialog::profile() const
void ProfileEditorDialog::initUI()
{
+ m_con = m_term = 0l;
QVBoxLayout *mainLayout = new QVBoxLayout( this );
OTabWidget *tabWidget = new OTabWidget( this );
mainLayout->add(tabWidget);
- QWidget *tabterm, *tabconn, *tabprof;
-
- tabprof = new QWidget(this);
- tabterm = new QWidget(this);
- tabconn = new QWidget(this);
-
- // for the time being: fake factory
-
- m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial);
- m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda);
- m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem);
-
- // profile tab
-
- QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
-
- name_line = new QLineEdit(tabprof);
-
- // connection tab, fixed part
-
- QLabel *device = new QLabel(QObject::tr("Device"), tabconn);
-
- device_box = new QComboBox(tabconn);
-
- QStringList w = m_fact->configWidgets();
- for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
- device_box->insertItem(m_fact->name((*it)));
-
- // connection tab, factory part
- plugin_base = new QWidget(tabconn);
- plugin_layout = new QHBoxLayout(plugin_base, 0);
-
- plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, &m_prof);
- plugin_layout->add(plugin_plugin->widget());
-
- // connection tab, general part
+ QWidget *tabprof;
+
+ /* base tabs */
+ tabprof = new QWidget(this);
+ m_tabTerm = new QWidget(this);
+ m_tabCon = new QWidget(this);
+
+ /* base layout for tabs */
+ m_layCon = new QHBoxLayout( m_tabCon , 2 );
+ m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
+
+ // profile tab
+
+ QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
+ m_name = new QLineEdit(tabprof);
+ QLabel *con = new QLabel(tr("Connection"), tabprof );
+ QLabel *term = new QLabel(tr("Terminal"), tabprof );
+ m_conCmb = new QComboBox( tabprof );
+ m_termCmb = new QComboBox( tabprof );
+
+ // layouting
+ QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
+ vbox3->add(name);
+ vbox3->add(m_name);
+ vbox3->add(con );
+ vbox3->add(m_conCmb );
+ vbox3->add(term );
+ vbox3->add(m_termCmb );
+ vbox3->addStretch(1);
+
+ tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
+ tabWidget->addTab(m_tabCon, "", QObject::tr("Connection"));
+ tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal"));
+ tabWidget->setCurrentTab( tabprof );
+
+
+ // fill the comboboxes
+ QStringList list = m_fact->connectionWidgets();
+ QStringList::Iterator it;
+ for (it =list.begin(); it != list.end(); ++it ) {
+ m_conCmb->insertItem( (*it) );
+ }
+ list = m_fact->terminalWidgets();
+ for (it =list.begin(); it != list.end(); ++it ) {
+ m_termCmb->insertItem( (*it) );
+ }
+
+ // load profile values
+ m_name->setText(m_prof.name());
+ slotConActivated( m_fact->external(m_prof.ioLayerName() ) );
+ slotTermActivated( m_fact->external(m_prof.terminalName() ) );
+ setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb );
+ setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
+
+ qWarning("Layer: %s %s", m_prof.ioLayerName().data(),
+ m_fact->external(m_prof.ioLayerName() ).latin1() );
+ qWarning("Term: %s %s", m_prof.terminalName().data(),
+ m_fact->external(m_prof.terminalName() ).latin1() );
+
+ // signal and slots
+ connect(m_conCmb, SIGNAL(activated(const QString& ) ),
+ this, SLOT(slotConActivated(const QString&) ) );
+ connect(m_termCmb, SIGNAL(activated(const QString& ) ),
+ this, SLOT(slotTermActivated(const QString& ) ) );
- QWidget *conn_widget = plugin_plugin->connection_widget();
- conn_widget->reparent(tabconn, 0, QPoint(), true);
-
- // terminal tab
-
- QWidget *term_widget = plugin_plugin->terminal_widget();
- term_widget->reparent(tabterm, 0, QPoint(), true);
-
- // layouting
-
- QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
- vbox3->add(name);
- vbox3->add(name_line);
- vbox3->addStretch(1);
-
- QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2);
- vbox->add(device);
- vbox->add(device_box);
- vbox->add(plugin_base);
- vbox->add(conn_widget);
- vbox->setStretchFactor(device, 1);
- vbox->setStretchFactor(device_box, 1);
- vbox->setStretchFactor(plugin_base, 1);
- vbox->setStretchFactor(conn_widget, 7);
-
- QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2);
- vbox2->add(term_widget);
-
- tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
- tabWidget->addTab(tabconn, "", QObject::tr("Connection"));
- tabWidget->addTab(tabterm, "", QObject::tr("Terminal"));
- tabWidget->setCurrentTab( tabprof );
-
- // load profile values
- name_line->setText(m_prof.name());
- for(int i = 0; i < device_box->count(); i++)
- {
- device_box->setCurrentItem(i);
- if(prof_type() == m_prof.ioLayerName())
- {
- slotDevice(i);
- break;
- }
- }
-
- // signals
- connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int)));
}
ProfileEditorDialog::~ProfileEditorDialog() {
}
-
-void ProfileEditorDialog::slotDevice(int id)
-{
- delete plugin_plugin;
-
- plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, &m_prof);
- plugin_layout->add(plugin_plugin->widget());
-
- // Reload profile associated to device, including e.g. conn_device()
- // m_prof = plugin_plugin->profile()
- // or, keeping the profile name: m_prof->reload(plugin_plugin->profile())
-
- //plugin_plugin->show();
- plugin_plugin->widget()->show();
-}
-
void ProfileEditorDialog::accept()
{
- if(prof_name().isEmpty())
+ if(profName().isEmpty())
{
QMessageBox::information(this,
QObject::tr("Invalid profile"),
@@ -162,28 +140,51 @@ void ProfileEditorDialog::accept()
return;
}
// Save profile and plugin profile
- if(plugin_plugin) plugin_plugin->save();
+ //if(plugin_plugin) plugin_plugin->save();
// Save general values
- m_prof.setName(prof_name());
- m_prof.setIOLayer(prof_type());
+ m_prof.setName(profName());
+ m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) );
+ m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) );
+ qWarning("Term %s %s", m_fact->internal(m_termCmb->currentText() ).data(),
+ m_termCmb->currentText().latin1() );
QDialog::accept();
}
-QString ProfileEditorDialog::prof_name()
+QString ProfileEditorDialog::profName()const
{
- return name_line->text();
+ return m_name->text();
}
-QString ProfileEditorDialog::prof_type()
+QCString ProfileEditorDialog::profType()const
{
- QStringList w = m_fact->configWidgets();
+ /*QStringList w = m_fact->configWidgets();
for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
if(device_box->currentText() == m_fact->name((*it))) return (*it);
-
- return QString::null;
+ */
+ return QCString();
+}
+/*
+ * we need to switch the widget
+ */
+void ProfileEditorDialog::slotConActivated( const QString& str ) {
+ delete m_con;
+ m_con = m_fact->newConnectionPlugin( str, m_tabCon );
+
+ if (m_con )
+ m_layCon->addWidget( m_con );
+}
+/*
+ * we need to switch the widget
+ */
+void ProfileEditorDialog::slotTermActivated( const QString& str ) {
+ delete m_term;
+ m_term = m_fact->newTerminalPlugin( str, 0l );
+ qWarning("past");
+
+ if (m_term)
+ m_layTerm->addWidget( m_term );
}
-
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
@@ -12,7 +12,7 @@ class QHBoxLayout;
class QLineEdit;
class QComboBox;
class QLabel;
-class ProfileEditorPlugin;
+class ProfileDialogWidget;
class ProfileEditorDialog : public QDialog {
Q_OBJECT
@@ -20,31 +20,32 @@ public:
ProfileEditorDialog(MetaFactory* fact,
const Profile& prof );
ProfileEditorDialog(MetaFactory* fact );
- ~ProfileEditorDialog();
+ ~ProfileEditorDialog();
Profile profile()const;
- QString prof_name();
- QString prof_type();
+
public slots:
void accept();
- void slotDevice(int id);
+private slots:
+ void slotConActivated(const QString& );
+ void slotTermActivated( const QString& );
private:
void initUI();
+ QString profName()const;
+ QCString profType()const;
MetaFactory* m_fact;
- EditBase* m_base;
- QTabWidget* m_tab;
QHBoxLayout* m_lay;
Profile m_prof;
- QLineEdit *name_line;
- QComboBox *device_box;
+ QLineEdit *m_name;
+ QComboBox *m_conCmb, *m_termCmb;
- QWidget *plugin_base;
- ProfileEditorPlugin *plugin_plugin;
- QHBoxLayout *plugin_layout;
+ QWidget *m_tabCon, *m_tabTerm;
+ ProfileDialogWidget* m_con, *m_term;
+ QHBoxLayout *m_layCon, *m_layTerm;
};
#endif
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
@@ -3,82 +3,82 @@
#include "profile.h"
-#include "qobject.h"
+#include <qobject.h>
class QWidget;
class ProfileEditorPlugin : public QObject
{
- Q_OBJECT
- public:
- ProfileEditorPlugin(QWidget *parent, Profile *p);
-
- virtual ~ProfileEditorPlugin();
-
- virtual void save() = 0;
-
- virtual QWidget *widget() = 0;
-
- QWidget *connection_widget();
- QWidget *terminal_widget();
-
- public slots:
- void slotConnFlow(int id);
- void slotConnParity(int id);
- void slotConnSpeed(int id);
- void slotTermTerm(int id);
- void slotTermColour(int id);
- void slotTermFont(int id);
- void slotTermEcho(bool on);
- void slotTermWrap(bool on);
- void slotTermInbound(bool on);
- void slotTermOutbound(bool on);
-
- protected:
- QWidget *m_parent, *m_widget;
- Profile *m_profile;
-
- private:
- enum ParityIds
- {
- id_parity_odd,
- id_parity_even
- };
-
- enum FlowIds
- {
- id_flow_hw,
- id_flow_sw
- };
-
- enum SpeedIds
- {
- id_baud_115200,
- id_baud_57600,
- id_baud_38400,
- id_baud_19200,
- id_baud_9600
- };
-
- enum TermIds
- {
- id_term_vt100,
- id_term_vt220,
- id_term_ansi
- };
-
- enum ColourIds
- {
- id_term_black,
- id_term_white
- };
-
- enum FontIds
- {
- id_size_small,
- id_size_medium,
- id_size_large
- };
+ Q_OBJECT
+public:
+ ProfileEditorPlugin(QWidget *parent);
+
+ virtual ~ProfileEditorPlugin();
+
+ virtual void save() = 0;
+
+ virtual QWidget *widget() = 0;
+
+ QWidget *connection_widget();
+ QWidget *terminal_widget();
+
+public slots:
+ void slotConnFlow(int id);
+ void slotConnParity(int id);
+ void slotConnSpeed(int id);
+ void slotTermTerm(int id);
+ void slotTermColour(int id);
+ void slotTermFont(int id);
+ void slotTermEcho(bool on);
+ void slotTermWrap(bool on);
+ void slotTermInbound(bool on);
+ void slotTermOutbound(bool on);
+
+protected:
+ QWidget *m_parent, *m_widget;
+ Profile *m_profile;
+
+private:
+ enum ParityIds
+ {
+ id_parity_odd,
+ id_parity_even
+ };
+
+ enum FlowIds
+ {
+ id_flow_hw,
+ id_flow_sw
+ };
+
+ enum SpeedIds
+ {
+ id_baud_115200,
+ id_baud_57600,
+ id_baud_38400,
+ id_baud_19200,
+ id_baud_9600
+ };
+
+ enum TermIds
+ {
+ id_term_vt100,
+ id_term_vt220,
+ id_term_ansi
+ };
+
+ enum ColourIds
+ {
+ id_term_black,
+ id_term_white
+ };
+
+ enum FontIds
+ {
+ id_size_small,
+ id_size_medium,
+ id_size_large
+ };
};
//#ifdef __cplusplus
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
@@ -28,7 +28,8 @@ void ProfileManager::load() {
conf.setGroup( (*it) );
Profile prof;
prof.setName( conf.readEntry("name") );
- prof.setIOLayer( conf.readEntry("iolayer") );
+ prof.setIOLayer( conf.readEntry("iolayer").utf8() );
+ prof.setTerminalName( conf.readEntry("term").utf8() );
prof.setBackground( conf.readNumEntry("back") );
prof.setForeground( conf.readNumEntry("fore") );
prof.setTerminal( conf.readNumEntry("terminal") );
@@ -65,7 +66,8 @@ void ProfileManager::save( ) {
for (it = m_list.begin(); it != m_list.end(); ++it ) {
conf.setGroup( (*it).name() );
conf.writeEntry( "name", (*it).name() );
- conf.writeEntry( "ioplayer", (*it).ioLayerName() );
+ conf.writeEntry( "ioplayer", QString::fromUtf8( (*it).ioLayerName() ) );
+ conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) );
conf.writeEntry( "back", (*it).background() );
conf.writeEntry( "fore", (*it).foreground() );
conf.writeEntry( "terminal", (*it).terminal() );
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
@@ -3,7 +3,7 @@
#include <qfile.h>
#include <opie/oprocess.h>
-SzTransfer::SzTransfer(IOLayer *layer) : FileTransferLayer(layer)
+SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t)
{
}
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
@@ -9,16 +9,21 @@ class SzTransfer : public FileTransferLayer {
Q_OBJECT
public:
+ enum Type {
+ SZ=0,
+ SX,
+ SY
+ };
- SzTransfer( IOLayer * );
+ SzTransfer( Type t, IOLayer * );
~SzTransfer();
public slots:
/**
* send a file over the layer
*/
- void sendFile( const QString& file ) = 0;
- void sendFile( const QFile& ) = 0;
+ void sendFile( const QString& file ) ;
+ void sendFile( const QFile& );
private slots:
void SzRecievedStdout(OProcess *, char *, int);
@@ -27,6 +32,7 @@ private slots:
private:
OProcess *proc;
+ Type m_t;
};