-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 131 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 5 |
4 files changed, 95 insertions, 52 deletions
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index 754f34c..04f1cbe 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp @@ -9,3 +9,5 @@ MetaFactory::~MetaFactory() { void MetaFactory::addConfigWidgetFactory( const QString& str, + const QString& name, configWidget wid) { + m_namemap.insert ( str, name ); m_confFact.insert( str, wid ); @@ -58 +60,6 @@ IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { } + +QString MetaFactory::name( const QString& str ) { + return m_namemap[str]; +} + diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h index bdd2ad2..7fa53c6 100644 --- a/noncore/apps/opie-console/metafactory.h +++ b/noncore/apps/opie-console/metafactory.h @@ -27,2 +27,3 @@ public: void addConfigWidgetFactory( const QString&, + const QString&, configWidget ); @@ -37,2 +38,4 @@ public: + QString name( const QString& ); + private: @@ -41,2 +44,3 @@ private: QMap<QString, filelayer> m_fileFact; + QMap<QString, QString> m_namemap; }; diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 849439d..859abdd 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp @@ -10,2 +10,38 @@ #include "qmessagebox.h" +#include "qbuttongroup.h" +#include "qstringlist.h" + +#include "metafactory.h" + +static QWidget *factory_serial(QWidget *parent) +{ + QFrame *device_frame = new QFrame(parent); + device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); + + QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); + QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame); + frame_number->hide(); + + QLineEdit *frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); + QLineEdit *frame_number_line = new QLineEdit(device_frame); + frame_number_line->hide(); + + QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); + vbox_frame->add(frame_device); + vbox_frame->add(frame_device_line); + vbox_frame->add(frame_number); + vbox_frame->add(frame_number_line); + + return device_frame; +} + +static QWidget *factory_irda(QWidget *parent) +{ + return NULL; +} + +static QWidget *factory_modem(QWidget *parent) +{ + return NULL; +} @@ -29,2 +65,8 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) + // 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 @@ -32,3 +74,2 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); - QLabel *device = new QLabel(QObject::tr("Device"), tabprof); @@ -36,25 +77,16 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) - device_box = new QComboBox(tabprof); - device_box->insertItem(QObject::tr("Serial cable")); - device_box->insertItem(QObject::tr("IrDA port")); - device_box->insertItem(QObject::tr("Serial via modem")); + // connection tab, fixed part - QFrame *device_frame = new QFrame(tabprof); - device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); + QLabel *device = new QLabel(QObject::tr("Device"), tabconn); - QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); - frame_number = new QLabel(QObject::tr("Phone number"), device_frame); - frame_number->hide(); + device_box = new QComboBox(tabconn); - frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); - frame_number_line = new QLineEdit(device_frame); - frame_number_line->hide(); + QStringList w = m_fact->configWidgets(); + for(QStringList::Iterator it = w.begin(); it != w.end(); it++) + device_box->insertItem(m_fact->name((*it))); - QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); - vbox_frame->add(frame_device); - vbox_frame->add(frame_device_line); - vbox_frame->add(frame_number); - vbox_frame->add(frame_number_line); + // connection tab, factory part + QFrame *device_frame = static_cast<QFrame*>(factory_serial(tabconn)); - // connection tab + // connection tab, general part @@ -67,3 +99,2 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) - QLabel *protocol = new QLabel(QObject::tr("Protocol"), tabconn); QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn); @@ -72,12 +103,15 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) - QComboBox *protocol_box = new QComboBox(tabconn); - protocol_box->insertItem(QObject::tr("XModem")); - protocol_box->insertItem(QObject::tr("YModem")); - protocol_box->insertItem(QObject::tr("ZModem")); - + QButtonGroup *group_flow = new QButtonGroup(tabconn); + group_flow->hide(); QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn); QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn); + group_flow->insert(flow_hw); + group_flow->insert(flow_sw); + QButtonGroup *group_parity = new QButtonGroup(tabconn); + group_parity->hide(); QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn); QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn); + group_parity->insert(parity_odd); + group_parity->insert(parity_even); @@ -90,3 +124,4 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) terminal_box->insertItem("VT 100"); - terminal_box->insertItem("VT 102"); + terminal_box->insertItem("VT 220"); + terminal_box->insertItem("ANSI"); @@ -102,2 +137,4 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) + QButtonGroup *group_size = new QButtonGroup(tabterm); + group_size->hide(); QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm); @@ -105,2 +142,5 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm); + group_size->insert(size_small); + group_size->insert(size_medium); + group_size->insert(size_large); @@ -117,9 +157,8 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) vbox3->add(name_line); - vbox3->add(device); - vbox3->add(device_box); - vbox3->add(device_frame); + vbox3->addStretch(1); QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); - vbox->add(protocol); - vbox->add(protocol_box); + vbox->add(device); + vbox->add(device_box); + vbox->add(device_frame); vbox->add(speed); @@ -130,2 +169,3 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) hbox->add(flow_sw); + //vbox->add(group_flow); vbox->add(parity); @@ -134,2 +174,3 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) hbox2->add(parity_even); + //vbox->add(group_parity); @@ -143,2 +184,3 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) hbox3->add(size_large); + //vbox2->add(group_size); vbox2->add(colour); @@ -174,20 +216,8 @@ void ProfileEditorDialog::slotDevice(int id) { - switch(id) - { - case 0: - frame_device_line->setText("/dev/ttyS0"); - frame_number->hide(); - frame_number_line->hide(); - break; - case 1: - frame_device_line->setText("/dev/ircomm0"); - frame_number->hide(); - frame_number_line->hide(); - break; - case 2: - frame_device_line->setText("/dev/ttyS0"); - frame_number->show(); - frame_number_line->show(); - break; - } + MetaFactory::configWidget c; + + //c = m_fact->; + c = factory_serial; + + QFrame *device_frame = static_cast<QFrame*>(c(NULL)); } @@ -237,3 +267,4 @@ QString ProfileEditorDialog::conn_device() { - return frame_device_line->text(); + //return frame_device_line->text(); + return "serial"; } diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index f81354c..dfe4490 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h @@ -50,4 +50,5 @@ private: - QLabel *frame_number; - QLineEdit *name_line, *frame_device_line, *frame_number_line; + //QLabel *frame_number; + QLineEdit *name_line; + //QLineEdit *frame_device_line, *frame_number_line; QComboBox *terminal_box, *speed_box, *device_box; |