-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 11 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 52 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 2 |
4 files changed, 52 insertions, 14 deletions
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index 04f1cbe..ea7f739 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp | |||
@@ -1,65 +1,76 @@ | |||
1 | #include <qpe/config.h> | 1 | #include <qpe/config.h> |
2 | #include "metafactory.h" | 2 | #include "metafactory.h" |
3 | 3 | ||
4 | MetaFactory::MetaFactory() { | 4 | MetaFactory::MetaFactory() { |
5 | } | 5 | } |
6 | MetaFactory::~MetaFactory() { | 6 | MetaFactory::~MetaFactory() { |
7 | 7 | ||
8 | } | 8 | } |
9 | void MetaFactory::addConfigWidgetFactory( const QString& str, | 9 | void MetaFactory::addConfigWidgetFactory( const QString& str, |
10 | const QString& name, | 10 | const QString& name, |
11 | configWidget wid) { | 11 | configWidget wid) { |
12 | m_namemap.insert ( str, name ); | 12 | m_namemap.insert ( str, name ); |
13 | m_confFact.insert( str, wid ); | 13 | m_confFact.insert( str, wid ); |
14 | } | 14 | } |
15 | void MetaFactory::addIOLayerFactory( const QString& str, | 15 | void MetaFactory::addIOLayerFactory( const QString& str, |
16 | iolayer lay) { | 16 | iolayer lay) { |
17 | m_layerFact.insert( str, lay ); | 17 | m_layerFact.insert( str, lay ); |
18 | } | 18 | } |
19 | void MetaFactory::addFileTransferLayer( const QString& str, | 19 | void MetaFactory::addFileTransferLayer( const QString& str, |
20 | filelayer lay) { | 20 | filelayer lay) { |
21 | m_fileFact.insert( str, lay ); | 21 | m_fileFact.insert( str, lay ); |
22 | } | 22 | } |
23 | QStringList MetaFactory::ioLayers()const { | 23 | QStringList MetaFactory::ioLayers()const { |
24 | QStringList list; | 24 | QStringList list; |
25 | QMap<QString, iolayer>::ConstIterator it; | 25 | QMap<QString, iolayer>::ConstIterator it; |
26 | for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { | 26 | for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { |
27 | list << it.key(); | 27 | list << it.key(); |
28 | } | 28 | } |
29 | return list; | 29 | return list; |
30 | } | 30 | } |
31 | QStringList MetaFactory::configWidgets()const { | 31 | QStringList MetaFactory::configWidgets()const { |
32 | QStringList list; | 32 | QStringList list; |
33 | QMap<QString, configWidget>::ConstIterator it; | 33 | QMap<QString, configWidget>::ConstIterator it; |
34 | for ( it = m_confFact.begin(); it != m_confFact.end(); ++it ) { | 34 | for ( it = m_confFact.begin(); it != m_confFact.end(); ++it ) { |
35 | list << it.key(); | 35 | list << it.key(); |
36 | } | 36 | } |
37 | return list; | 37 | return list; |
38 | } | 38 | } |
39 | QStringList MetaFactory::fileTransferLayers()const { | 39 | QStringList MetaFactory::fileTransferLayers()const { |
40 | QStringList list; | 40 | QStringList list; |
41 | QMap<QString, filelayer>::ConstIterator it; | 41 | QMap<QString, filelayer>::ConstIterator it; |
42 | for ( it = m_fileFact.begin(); it != m_fileFact.end(); ++it ) { | 42 | for ( it = m_fileFact.begin(); it != m_fileFact.end(); ++it ) { |
43 | list << it.key(); | 43 | list << it.key(); |
44 | } | 44 | } |
45 | return list; | 45 | return list; |
46 | } | 46 | } |
47 | |||
47 | IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { | 48 | IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { |
48 | IOLayer* lay = 0l; | 49 | IOLayer* lay = 0l; |
49 | 50 | ||
50 | QMap<QString, iolayer>::Iterator it; | 51 | QMap<QString, iolayer>::Iterator it; |
51 | it = m_layerFact.find( str ); | 52 | it = m_layerFact.find( str ); |
52 | if ( it != m_layerFact.end() ) { | 53 | if ( it != m_layerFact.end() ) { |
53 | lay = (*(it.data()))(prof); | 54 | lay = (*(it.data()))(prof); |
54 | /* | 55 | /* |
55 | iolayer laye = it.data(); | 56 | iolayer laye = it.data(); |
56 | lay = (*laye )(conf);*/ | 57 | lay = (*laye )(conf);*/ |
57 | } | 58 | } |
58 | 59 | ||
59 | return lay; | 60 | return lay; |
60 | } | 61 | } |
61 | 62 | ||
63 | QWidget *MetaFactory::newConfigWidget ( const QString& str, QWidget* parent) { | ||
64 | QWidget *w = NULL; | ||
65 | configWidget c; | ||
66 | |||
67 | c = m_confFact[str]; | ||
68 | if(c) w = c(parent); | ||
69 | |||
70 | return w; | ||
71 | } | ||
72 | |||
62 | QString MetaFactory::name( const QString& str ) { | 73 | QString MetaFactory::name( const QString& str ) { |
63 | return m_namemap[str]; | 74 | return m_namemap[str]; |
64 | } | 75 | } |
65 | 76 | ||
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h index 7fa53c6..2245231 100644 --- a/noncore/apps/opie-console/metafactory.h +++ b/noncore/apps/opie-console/metafactory.h | |||
@@ -1,49 +1,50 @@ | |||
1 | #ifndef OPIE_META_FACTORY_H | 1 | #ifndef OPIE_META_FACTORY_H |
2 | #define OPIE_META_FACTORY_H | 2 | #define OPIE_META_FACTORY_H |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * The MetaFactory is used to keep track of all IOLayers, FileTransferLayers and ConfigWidgets | 5 | * The MetaFactory is used to keep track of all IOLayers, FileTransferLayers and ConfigWidgets |
6 | * and to instantiate these implementations on demand | 6 | * and to instantiate these implementations on demand |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <qwidget.h> | 9 | #include <qwidget.h> |
10 | #include <qmap.h> | 10 | #include <qmap.h> |
11 | 11 | ||
12 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
13 | 13 | ||
14 | #include "io_layer.h" | 14 | #include "io_layer.h" |
15 | #include "file_layer.h" | 15 | #include "file_layer.h" |
16 | #include "profile.h" | 16 | #include "profile.h" |
17 | 17 | ||
18 | class MetaFactory { | 18 | class MetaFactory { |
19 | public: | 19 | public: |
20 | typedef QWidget* (*configWidget)(QWidget* parent); | 20 | typedef QWidget* (*configWidget)(QWidget* parent); |
21 | typedef IOLayer* (*iolayer)(const Profile& ); | 21 | typedef IOLayer* (*iolayer)(const Profile& ); |
22 | typedef FileTransferLayer* (*filelayer)(IOLayer*); | 22 | typedef FileTransferLayer* (*filelayer)(IOLayer*); |
23 | 23 | ||
24 | MetaFactory(); | 24 | MetaFactory(); |
25 | ~MetaFactory(); | 25 | ~MetaFactory(); |
26 | 26 | ||
27 | void addConfigWidgetFactory( const QString&, | 27 | void addConfigWidgetFactory( const QString&, |
28 | const QString&, | 28 | const QString&, |
29 | configWidget ); | 29 | configWidget ); |
30 | void addIOLayerFactory(const QString&, | 30 | void addIOLayerFactory(const QString&, |
31 | iolayer ); | 31 | iolayer ); |
32 | void addFileTransferLayer( const QString&, | 32 | void addFileTransferLayer( const QString&, |
33 | filelayer ); | 33 | filelayer ); |
34 | QStringList ioLayers()const; | 34 | QStringList ioLayers()const; |
35 | QStringList configWidgets()const; | 35 | QStringList configWidgets()const; |
36 | QStringList fileTransferLayers()const; | 36 | QStringList fileTransferLayers()const; |
37 | IOLayer* newIOLayer( const QString&,const Profile& ); | 37 | IOLayer* newIOLayer( const QString&,const Profile& ); |
38 | QWidget *newConfigWidget ( const QString&, QWidget* ); | ||
38 | 39 | ||
39 | QString name( const QString& ); | 40 | QString name( const QString& ); |
40 | 41 | ||
41 | private: | 42 | private: |
42 | QMap<QString, configWidget> m_confFact; | 43 | QMap<QString, configWidget> m_confFact; |
43 | QMap<QString, iolayer> m_layerFact; | 44 | QMap<QString, iolayer> m_layerFact; |
44 | QMap<QString, filelayer> m_fileFact; | 45 | QMap<QString, filelayer> m_fileFact; |
45 | QMap<QString, QString> m_namemap; | 46 | QMap<QString, QString> m_namemap; |
46 | }; | 47 | }; |
47 | 48 | ||
48 | 49 | ||
49 | #endif | 50 | #endif |
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 859abdd..374844e 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -1,270 +1,294 @@ | |||
1 | 1 | ||
2 | #include "profileeditordialog.h" | 2 | #include "profileeditordialog.h" |
3 | 3 | ||
4 | #include "qlayout.h" | 4 | #include "qlayout.h" |
5 | #include "qlineedit.h" | 5 | #include "qlineedit.h" |
6 | #include "qlabel.h" | 6 | #include "qlabel.h" |
7 | #include "qradiobutton.h" | 7 | #include "qradiobutton.h" |
8 | #include "qcombobox.h" | 8 | #include "qcombobox.h" |
9 | #include "qcheckbox.h" | 9 | #include "qcheckbox.h" |
10 | #include "qmessagebox.h" | 10 | #include "qmessagebox.h" |
11 | #include "qbuttongroup.h" | 11 | #include "qbuttongroup.h" |
12 | #include "qstringlist.h" | 12 | #include "qstringlist.h" |
13 | 13 | ||
14 | #include "metafactory.h" | 14 | #include "metafactory.h" |
15 | 15 | ||
16 | static QWidget *factory_serial(QWidget *parent) | 16 | static QWidget *factory_serial(QWidget *parent) |
17 | { | 17 | { |
18 | QFrame *device_frame = new QFrame(parent); | 18 | QFrame *device_frame = new QFrame(parent); |
19 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 19 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
20 | 20 | ||
21 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | 21 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); |
22 | QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame); | ||
23 | frame_number->hide(); | ||
24 | 22 | ||
25 | QLineEdit *frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); | 23 | QLineEdit *frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); |
26 | QLineEdit *frame_number_line = new QLineEdit(device_frame); | ||
27 | frame_number_line->hide(); | ||
28 | 24 | ||
29 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | 25 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); |
30 | vbox_frame->add(frame_device); | 26 | vbox_frame->add(frame_device); |
31 | vbox_frame->add(frame_device_line); | 27 | vbox_frame->add(frame_device_line); |
32 | vbox_frame->add(frame_number); | ||
33 | vbox_frame->add(frame_number_line); | ||
34 | 28 | ||
35 | return device_frame; | 29 | return device_frame; |
36 | } | 30 | } |
37 | 31 | ||
38 | static QWidget *factory_irda(QWidget *parent) | 32 | static QWidget *factory_irda(QWidget *parent) |
39 | { | 33 | { |
40 | return NULL; | 34 | QFrame *device_frame = new QFrame(parent); |
35 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | ||
36 | |||
37 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | ||
38 | |||
39 | QLineEdit *frame_device_line = new QLineEdit("/dev/ircomm0", device_frame); | ||
40 | |||
41 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | ||
42 | vbox_frame->add(frame_device); | ||
43 | vbox_frame->add(frame_device_line); | ||
44 | |||
45 | return device_frame; | ||
41 | } | 46 | } |
42 | 47 | ||
43 | static QWidget *factory_modem(QWidget *parent) | 48 | static QWidget *factory_modem(QWidget *parent) |
44 | { | 49 | { |
45 | return NULL; | 50 | QFrame *device_frame = new QFrame(parent); |
51 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | ||
52 | |||
53 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | ||
54 | QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame); | ||
55 | |||
56 | QLineEdit *frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); | ||
57 | QLineEdit *frame_number_line = new QLineEdit(device_frame); | ||
58 | |||
59 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | ||
60 | vbox_frame->add(frame_device); | ||
61 | vbox_frame->add(frame_device_line); | ||
62 | vbox_frame->add(frame_number); | ||
63 | vbox_frame->add(frame_number_line); | ||
64 | |||
65 | return device_frame; | ||
46 | } | 66 | } |
47 | 67 | ||
48 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | 68 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, |
49 | const Profile& prof ) | 69 | const Profile& prof ) |
50 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) | 70 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) |
51 | { | 71 | { |
52 | // initUI(); | 72 | // initUI(); |
53 | /* now set the widgets */ | 73 | /* now set the widgets */ |
54 | 74 | ||
55 | } | 75 | } |
56 | 76 | ||
57 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | 77 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) |
58 | : QTabDialog(0, 0, TRUE), m_fact( fact ) | 78 | : QTabDialog(0, 0, TRUE), m_fact( fact ) |
59 | { | 79 | { |
60 | QWidget *tabterm, *tabconn, *tabprof; | 80 | QWidget *tabterm, *tabconn, *tabprof; |
61 | 81 | ||
62 | tabprof = new QWidget(this); | 82 | tabprof = new QWidget(this); |
63 | tabterm = new QWidget(this); | 83 | tabterm = new QWidget(this); |
64 | tabconn = new QWidget(this); | 84 | tabconn = new QWidget(this); |
65 | 85 | ||
66 | // for the time being: fake factory | 86 | // for the time being: fake factory |
67 | 87 | ||
68 | m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); | 88 | m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); |
69 | m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); | 89 | m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); |
70 | m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); | 90 | m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); |
71 | 91 | ||
72 | // profile tab | 92 | // profile tab |
73 | 93 | ||
74 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); | 94 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); |
75 | 95 | ||
76 | name_line = new QLineEdit(tabprof); | 96 | name_line = new QLineEdit(tabprof); |
77 | 97 | ||
78 | // connection tab, fixed part | 98 | // connection tab, fixed part |
79 | 99 | ||
80 | QLabel *device = new QLabel(QObject::tr("Device"), tabconn); | 100 | QLabel *device = new QLabel(QObject::tr("Device"), tabconn); |
81 | 101 | ||
82 | device_box = new QComboBox(tabconn); | 102 | device_box = new QComboBox(tabconn); |
83 | 103 | ||
84 | QStringList w = m_fact->configWidgets(); | 104 | QStringList w = m_fact->configWidgets(); |
85 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) | 105 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
86 | device_box->insertItem(m_fact->name((*it))); | 106 | device_box->insertItem(m_fact->name((*it))); |
87 | 107 | ||
88 | // connection tab, factory part | 108 | // connection tab, factory part |
89 | QFrame *device_frame = static_cast<QFrame*>(factory_serial(tabconn)); | 109 | plugin_base = new QWidget(tabconn); |
110 | plugin_layout = new QHBoxLayout(plugin_base, 0); | ||
111 | |||
112 | plugin_plugin = m_fact->newConfigWidget("serial", plugin_base); | ||
113 | plugin_layout->add(plugin_plugin); | ||
90 | 114 | ||
91 | // connection tab, general part | 115 | // connection tab, general part |
92 | 116 | ||
93 | speed_box = new QComboBox(tabconn); | 117 | speed_box = new QComboBox(tabconn); |
94 | speed_box->insertItem("115200 baud"); | 118 | speed_box->insertItem("115200 baud"); |
95 | speed_box->insertItem("57600 baud"); | 119 | speed_box->insertItem("57600 baud"); |
96 | speed_box->insertItem("38400 baud"); | 120 | speed_box->insertItem("38400 baud"); |
97 | speed_box->insertItem("19200 baud"); | 121 | speed_box->insertItem("19200 baud"); |
98 | speed_box->insertItem("9600 baud"); | 122 | speed_box->insertItem("9600 baud"); |
99 | 123 | ||
100 | QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn); | 124 | QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn); |
101 | QLabel *flow = new QLabel(QObject::tr("Flow control"), tabconn); | 125 | QLabel *flow = new QLabel(QObject::tr("Flow control"), tabconn); |
102 | QLabel *parity = new QLabel(QObject::tr("Parity"), tabconn); | 126 | QLabel *parity = new QLabel(QObject::tr("Parity"), tabconn); |
103 | 127 | ||
104 | QButtonGroup *group_flow = new QButtonGroup(tabconn); | 128 | QButtonGroup *group_flow = new QButtonGroup(tabconn); |
105 | group_flow->hide(); | 129 | group_flow->hide(); |
106 | QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn); | 130 | QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn); |
107 | QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn); | 131 | QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn); |
108 | group_flow->insert(flow_hw); | 132 | group_flow->insert(flow_hw); |
109 | group_flow->insert(flow_sw); | 133 | group_flow->insert(flow_sw); |
110 | 134 | ||
111 | QButtonGroup *group_parity = new QButtonGroup(tabconn); | 135 | QButtonGroup *group_parity = new QButtonGroup(tabconn); |
112 | group_parity->hide(); | 136 | group_parity->hide(); |
113 | QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn); | 137 | QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn); |
114 | QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn); | 138 | QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn); |
115 | group_parity->insert(parity_odd); | 139 | group_parity->insert(parity_odd); |
116 | group_parity->insert(parity_even); | 140 | group_parity->insert(parity_even); |
117 | 141 | ||
118 | flow_sw->setChecked(true); | 142 | flow_sw->setChecked(true); |
119 | parity_odd->setChecked(true); | 143 | parity_odd->setChecked(true); |
120 | 144 | ||
121 | // terminal tab | 145 | // terminal tab |
122 | 146 | ||
123 | terminal_box = new QComboBox(tabterm); | 147 | terminal_box = new QComboBox(tabterm); |
124 | terminal_box->insertItem("VT 100"); | 148 | terminal_box->insertItem("VT 100"); |
125 | terminal_box->insertItem("VT 220"); | 149 | terminal_box->insertItem("VT 220"); |
126 | terminal_box->insertItem("ANSI"); | 150 | terminal_box->insertItem("ANSI"); |
127 | 151 | ||
128 | QLabel *terminal = new QLabel(QObject::tr("Terminal type"), tabterm); | 152 | QLabel *terminal = new QLabel(QObject::tr("Terminal type"), tabterm); |
129 | QLabel *colour = new QLabel(QObject::tr("Colour scheme"), tabterm); | 153 | QLabel *colour = new QLabel(QObject::tr("Colour scheme"), tabterm); |
130 | QLabel *size = new QLabel(QObject::tr("Font size"), tabterm); | 154 | QLabel *size = new QLabel(QObject::tr("Font size"), tabterm); |
131 | QLabel *options = new QLabel(QObject::tr("Options"), tabterm); | 155 | QLabel *options = new QLabel(QObject::tr("Options"), tabterm); |
132 | QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), tabterm); | 156 | QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), tabterm); |
133 | 157 | ||
134 | QComboBox *colour_box = new QComboBox(tabterm); | 158 | QComboBox *colour_box = new QComboBox(tabterm); |
135 | colour_box->insertItem(QObject::tr("black on white")); | 159 | colour_box->insertItem(QObject::tr("black on white")); |
136 | colour_box->insertItem(QObject::tr("white on black")); | 160 | colour_box->insertItem(QObject::tr("white on black")); |
137 | 161 | ||
138 | QButtonGroup *group_size = new QButtonGroup(tabterm); | 162 | QButtonGroup *group_size = new QButtonGroup(tabterm); |
139 | group_size->hide(); | 163 | group_size->hide(); |
140 | QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm); | 164 | QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm); |
141 | QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), tabterm); | 165 | QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), tabterm); |
142 | QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm); | 166 | QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm); |
143 | group_size->insert(size_small); | 167 | group_size->insert(size_small); |
144 | group_size->insert(size_medium); | 168 | group_size->insert(size_medium); |
145 | group_size->insert(size_large); | 169 | group_size->insert(size_large); |
146 | 170 | ||
147 | QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), tabterm); | 171 | QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), tabterm); |
148 | QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), tabterm); | 172 | QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), tabterm); |
149 | 173 | ||
150 | QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), tabterm); | 174 | QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), tabterm); |
151 | QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), tabterm); | 175 | QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), tabterm); |
152 | 176 | ||
153 | // layouting | 177 | // layouting |
154 | 178 | ||
155 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); | 179 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); |
156 | vbox3->add(name); | 180 | vbox3->add(name); |
157 | vbox3->add(name_line); | 181 | vbox3->add(name_line); |
158 | vbox3->addStretch(1); | 182 | vbox3->addStretch(1); |
159 | 183 | ||
160 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); | 184 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); |
161 | vbox->add(device); | 185 | vbox->add(device); |
162 | vbox->add(device_box); | 186 | vbox->add(device_box); |
163 | vbox->add(device_frame); | 187 | vbox->add(plugin_base); |
164 | vbox->add(speed); | 188 | vbox->add(speed); |
165 | vbox->add(speed_box); | 189 | vbox->add(speed_box); |
166 | vbox->add(flow); | 190 | vbox->add(flow); |
167 | QHBoxLayout *hbox = new QHBoxLayout(vbox, 2); | 191 | QHBoxLayout *hbox = new QHBoxLayout(vbox, 2); |
168 | hbox->add(flow_hw); | 192 | hbox->add(flow_hw); |
169 | hbox->add(flow_sw); | 193 | hbox->add(flow_sw); |
170 | //vbox->add(group_flow); | 194 | //vbox->add(group_flow); |
171 | vbox->add(parity); | 195 | vbox->add(parity); |
172 | QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2); | 196 | QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2); |
173 | hbox2->add(parity_odd); | 197 | hbox2->add(parity_odd); |
174 | hbox2->add(parity_even); | 198 | hbox2->add(parity_even); |
175 | //vbox->add(group_parity); | 199 | //vbox->add(group_parity); |
176 | 200 | ||
177 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); | 201 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); |
178 | vbox2->add(terminal); | 202 | vbox2->add(terminal); |
179 | vbox2->add(terminal_box); | 203 | vbox2->add(terminal_box); |
180 | vbox2->add(size); | 204 | vbox2->add(size); |
181 | QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2); | 205 | QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2); |
182 | hbox3->add(size_small); | 206 | hbox3->add(size_small); |
183 | hbox3->add(size_medium); | 207 | hbox3->add(size_medium); |
184 | hbox3->add(size_large); | 208 | hbox3->add(size_large); |
185 | //vbox2->add(group_size); | 209 | //vbox2->add(group_size); |
186 | vbox2->add(colour); | 210 | vbox2->add(colour); |
187 | vbox2->add(colour_box); | 211 | vbox2->add(colour_box); |
188 | vbox2->add(conversions); | 212 | vbox2->add(conversions); |
189 | QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2); | 213 | QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2); |
190 | hbox5->add(conv_inbound); | 214 | hbox5->add(conv_inbound); |
191 | hbox5->add(conv_outbound); | 215 | hbox5->add(conv_outbound); |
192 | vbox2->add(options); | 216 | vbox2->add(options); |
193 | QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2); | 217 | QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2); |
194 | hbox4->add(option_wrap); | 218 | hbox4->add(option_wrap); |
195 | hbox4->add(option_echo); | 219 | hbox4->add(option_echo); |
196 | 220 | ||
197 | addTab(tabprof, QObject::tr("Profile")); | 221 | addTab(tabprof, QObject::tr("Profile")); |
198 | addTab(tabconn, QObject::tr("Connection")); | 222 | addTab(tabconn, QObject::tr("Connection")); |
199 | addTab(tabterm, QObject::tr("Terminal")); | 223 | addTab(tabterm, QObject::tr("Terminal")); |
200 | 224 | ||
201 | setOkButton(QObject::tr("OK")); | 225 | setOkButton(QObject::tr("OK")); |
202 | setCancelButton(QObject::tr("Cancel")); | 226 | setCancelButton(QObject::tr("Cancel")); |
203 | 227 | ||
204 | connect(this, SIGNAL(applyButtonPressed()), SLOT(slotOk())); | 228 | connect(this, SIGNAL(applyButtonPressed()), SLOT(slotOk())); |
205 | connect(this, SIGNAL(defaultButtonPressed()), SLOT(slotOk())); | 229 | connect(this, SIGNAL(defaultButtonPressed()), SLOT(slotOk())); |
206 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); | 230 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); |
207 | 231 | ||
208 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); | 232 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); |
209 | } | 233 | } |
210 | 234 | ||
211 | ProfileEditorDialog::~ProfileEditorDialog() { | 235 | ProfileEditorDialog::~ProfileEditorDialog() { |
212 | 236 | ||
213 | } | 237 | } |
214 | 238 | ||
215 | void ProfileEditorDialog::slotDevice(int id) | 239 | void ProfileEditorDialog::slotDevice(int id) |
216 | { | 240 | { |
217 | MetaFactory::configWidget c; | 241 | delete plugin_plugin; |
218 | 242 | ||
219 | //c = m_fact->; | 243 | plugin_plugin = m_fact->newConfigWidget(prof_type(), plugin_base); |
220 | c = factory_serial; | 244 | plugin_layout->add(plugin_plugin); |
221 | 245 | ||
222 | QFrame *device_frame = static_cast<QFrame*>(c(NULL)); | 246 | plugin_plugin->show(); |
223 | } | 247 | } |
224 | 248 | ||
225 | void ProfileEditorDialog::slotOk() | 249 | void ProfileEditorDialog::slotOk() |
226 | { | 250 | { |
227 | if(prof_name().isEmpty()) | 251 | if(prof_name().isEmpty()) |
228 | { | 252 | { |
229 | QMessageBox::information(this, | 253 | QMessageBox::information(this, |
230 | QObject::tr("Invalid profile"), | 254 | QObject::tr("Invalid profile"), |
231 | QObject::tr("Please enter a profile name.")); | 255 | QObject::tr("Please enter a profile name.")); |
232 | return; | 256 | return; |
233 | } | 257 | } |
234 | 258 | ||
235 | accept(); | 259 | accept(); |
236 | } | 260 | } |
237 | 261 | ||
238 | void ProfileEditorDialog::slotCancel() | 262 | void ProfileEditorDialog::slotCancel() |
239 | { | 263 | { |
240 | reject(); | 264 | reject(); |
241 | } | 265 | } |
242 | 266 | ||
243 | QString ProfileEditorDialog::prof_name() | 267 | QString ProfileEditorDialog::prof_name() |
244 | { | 268 | { |
245 | return name_line->text(); | 269 | return name_line->text(); |
246 | } | 270 | } |
247 | 271 | ||
248 | QString ProfileEditorDialog::prof_type() | 272 | QString ProfileEditorDialog::prof_type() |
249 | { | 273 | { |
250 | switch(device_box->currentItem()) | 274 | switch(device_box->currentItem()) |
251 | { | 275 | { |
252 | case 0: | 276 | case 0: |
253 | return "serial"; | 277 | return "serial"; |
254 | break; | 278 | break; |
255 | case 1: | 279 | case 1: |
256 | return "irda"; | 280 | return "irda"; |
257 | break; | 281 | break; |
258 | case 2: | 282 | case 2: |
259 | return "modem"; | 283 | return "modem"; |
260 | break; | 284 | break; |
261 | } | 285 | } |
262 | 286 | ||
263 | return QString::null; | 287 | return QString::null; |
264 | } | 288 | } |
265 | 289 | ||
266 | QString ProfileEditorDialog::conn_device() | 290 | QString ProfileEditorDialog::conn_device() |
267 | { | 291 | { |
268 | //return frame_device_line->text(); | 292 | //return frame_device_line->text(); |
269 | return "serial"; | 293 | return "serial"; |
270 | } | 294 | } |
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index dfe4490..00f3c99 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h | |||
@@ -7,51 +7,53 @@ | |||
7 | 7 | ||
8 | class MetaFactory; | 8 | class MetaFactory; |
9 | class EditBase; | 9 | class EditBase; |
10 | class QTabWidget; | 10 | class QTabWidget; |
11 | class QHBoxLayout; | 11 | class QHBoxLayout; |
12 | class QLineEdit; | 12 | class QLineEdit; |
13 | class QComboBox; | 13 | class QComboBox; |
14 | class QLabel; | 14 | class QLabel; |
15 | 15 | ||
16 | class ProfileEditorDialog : public QTabDialog { | 16 | class ProfileEditorDialog : public QTabDialog { |
17 | Q_OBJECT | 17 | Q_OBJECT |
18 | public: | 18 | public: |
19 | ProfileEditorDialog(MetaFactory* fact, | 19 | ProfileEditorDialog(MetaFactory* fact, |
20 | const Profile& prof ); | 20 | const Profile& prof ); |
21 | ProfileEditorDialog(MetaFactory* fact ); | 21 | ProfileEditorDialog(MetaFactory* fact ); |
22 | ~ProfileEditorDialog(); | 22 | ~ProfileEditorDialog(); |
23 | Profile profile()const; | 23 | Profile profile()const; |
24 | 24 | ||
25 | QString prof_name(); | 25 | QString prof_name(); |
26 | QString prof_type(); | 26 | QString prof_type(); |
27 | 27 | ||
28 | QString conn_device(); | 28 | QString conn_device(); |
29 | int conn_baud(); | 29 | int conn_baud(); |
30 | int conn_parity(); | 30 | int conn_parity(); |
31 | int conn_databits(); | 31 | int conn_databits(); |
32 | int conn_stopbits(); | 32 | int conn_stopbits(); |
33 | int conn_flow(); | 33 | int conn_flow(); |
34 | 34 | ||
35 | QString term_type(); | 35 | QString term_type(); |
36 | 36 | ||
37 | public slots: | 37 | public slots: |
38 | void slotOk(); | 38 | void slotOk(); |
39 | void slotCancel(); | 39 | void slotCancel(); |
40 | 40 | ||
41 | void slotDevice(int id); | 41 | void slotDevice(int id); |
42 | 42 | ||
43 | private: | 43 | private: |
44 | //void initUI(); | 44 | //void initUI(); |
45 | MetaFactory* m_fact; | 45 | MetaFactory* m_fact; |
46 | EditBase* m_base; | 46 | EditBase* m_base; |
47 | QTabWidget* m_tab; | 47 | QTabWidget* m_tab; |
48 | QHBoxLayout* m_lay; | 48 | QHBoxLayout* m_lay; |
49 | Profile m_prof; | 49 | Profile m_prof; |
50 | 50 | ||
51 | //QLabel *frame_number; | 51 | //QLabel *frame_number; |
52 | QLineEdit *name_line; | 52 | QLineEdit *name_line; |
53 | //QLineEdit *frame_device_line, *frame_number_line; | 53 | //QLineEdit *frame_device_line, *frame_number_line; |
54 | QComboBox *terminal_box, *speed_box, *device_box; | 54 | QComboBox *terminal_box, *speed_box, *device_box; |
55 | QWidget *plugin_base, *plugin_plugin; | ||
56 | QHBoxLayout *plugin_layout; | ||
55 | }; | 57 | }; |
56 | 58 | ||
57 | #endif | 59 | #endif |