summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/profileeditordialog.cpp
authorjosef <josef>2002-10-06 11:38:51 (UTC)
committer josef <josef>2002-10-06 11:38:51 (UTC)
commit0b7136e077b0ec2767722c38ee0939b53a95fe6a (patch) (unidiff)
tree74fe158d876abbcdbeb17fbe0bc217a4df09eac9 /noncore/apps/opie-console/profileeditordialog.cpp
parenta8a476782082bd340690308673983bc7e3238db5 (diff)
downloadopie-0b7136e077b0ec2767722c38ee0939b53a95fe6a.zip
opie-0b7136e077b0ec2767722c38ee0939b53a95fe6a.tar.gz
opie-0b7136e077b0ec2767722c38ee0939b53a95fe6a.tar.bz2
- restructure menu to use metafactory
- this is work in progress
Diffstat (limited to 'noncore/apps/opie-console/profileeditordialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp131
1 files changed, 81 insertions, 50 deletions
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 @@
10#include "qmessagebox.h" 10#include "qmessagebox.h"
11#include "qbuttongroup.h"
12#include "qstringlist.h"
13
14#include "metafactory.h"
15
16static QWidget *factory_serial(QWidget *parent)
17{
18 QFrame *device_frame = new QFrame(parent);
19 device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
20
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
25 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
29 QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2);
30 vbox_frame->add(frame_device);
31 vbox_frame->add(frame_device_line);
32 vbox_frame->add(frame_number);
33 vbox_frame->add(frame_number_line);
34
35 return device_frame;
36}
37
38static QWidget *factory_irda(QWidget *parent)
39{
40 return NULL;
41}
42
43static QWidget *factory_modem(QWidget *parent)
44{
45 return NULL;
46}
11 47
@@ -29,2 +65,8 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
29 65
66 // for the time being: fake factory
67
68 m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial);
69 m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda);
70 m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem);
71
30 // profile tab 72 // profile tab
@@ -32,3 +74,2 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
32 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); 74 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
33 QLabel *device = new QLabel(QObject::tr("Device"), tabprof);
34 75
@@ -36,25 +77,16 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
36 77
37 device_box = new QComboBox(tabprof); 78 // connection tab, fixed part
38 device_box->insertItem(QObject::tr("Serial cable"));
39 device_box->insertItem(QObject::tr("IrDA port"));
40 device_box->insertItem(QObject::tr("Serial via modem"));
41 79
42 QFrame *device_frame = new QFrame(tabprof); 80 QLabel *device = new QLabel(QObject::tr("Device"), tabconn);
43 device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
44 81
45 QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); 82 device_box = new QComboBox(tabconn);
46 frame_number = new QLabel(QObject::tr("Phone number"), device_frame);
47 frame_number->hide();
48 83
49 frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); 84 QStringList w = m_fact->configWidgets();
50 frame_number_line = new QLineEdit(device_frame); 85 for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
51 frame_number_line->hide(); 86 device_box->insertItem(m_fact->name((*it)));
52 87
53 QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); 88 // connection tab, factory part
54 vbox_frame->add(frame_device); 89 QFrame *device_frame = static_cast<QFrame*>(factory_serial(tabconn));
55 vbox_frame->add(frame_device_line);
56 vbox_frame->add(frame_number);
57 vbox_frame->add(frame_number_line);
58 90
59 // connection tab 91 // connection tab, general part
60 92
@@ -67,3 +99,2 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
67 99
68 QLabel *protocol = new QLabel(QObject::tr("Protocol"), tabconn);
69 QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn); 100 QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn);
@@ -72,12 +103,15 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
72 103
73 QComboBox *protocol_box = new QComboBox(tabconn); 104 QButtonGroup *group_flow = new QButtonGroup(tabconn);
74 protocol_box->insertItem(QObject::tr("XModem")); 105 group_flow->hide();
75 protocol_box->insertItem(QObject::tr("YModem"));
76 protocol_box->insertItem(QObject::tr("ZModem"));
77
78 QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn); 106 QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn);
79 QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn); 107 QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn);
108 group_flow->insert(flow_hw);
109 group_flow->insert(flow_sw);
80 110
111 QButtonGroup *group_parity = new QButtonGroup(tabconn);
112 group_parity->hide();
81 QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn); 113 QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn);
82 QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn); 114 QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn);
115 group_parity->insert(parity_odd);
116 group_parity->insert(parity_even);
83 117
@@ -90,3 +124,4 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
90 terminal_box->insertItem("VT 100"); 124 terminal_box->insertItem("VT 100");
91 terminal_box->insertItem("VT 102"); 125 terminal_box->insertItem("VT 220");
126 terminal_box->insertItem("ANSI");
92 127
@@ -102,2 +137,4 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
102 137
138 QButtonGroup *group_size = new QButtonGroup(tabterm);
139 group_size->hide();
103 QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm); 140 QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm);
@@ -105,2 +142,5 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
105 QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm); 142 QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm);
143 group_size->insert(size_small);
144 group_size->insert(size_medium);
145 group_size->insert(size_large);
106 146
@@ -117,9 +157,8 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
117 vbox3->add(name_line); 157 vbox3->add(name_line);
118 vbox3->add(device); 158 vbox3->addStretch(1);
119 vbox3->add(device_box);
120 vbox3->add(device_frame);
121 159
122 QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); 160 QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2);
123 vbox->add(protocol); 161 vbox->add(device);
124 vbox->add(protocol_box); 162 vbox->add(device_box);
163 vbox->add(device_frame);
125 vbox->add(speed); 164 vbox->add(speed);
@@ -130,2 +169,3 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
130 hbox->add(flow_sw); 169 hbox->add(flow_sw);
170 //vbox->add(group_flow);
131 vbox->add(parity); 171 vbox->add(parity);
@@ -134,2 +174,3 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
134 hbox2->add(parity_even); 174 hbox2->add(parity_even);
175 //vbox->add(group_parity);
135 176
@@ -143,2 +184,3 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
143 hbox3->add(size_large); 184 hbox3->add(size_large);
185 //vbox2->add(group_size);
144 vbox2->add(colour); 186 vbox2->add(colour);
@@ -174,20 +216,8 @@ void ProfileEditorDialog::slotDevice(int id)
174{ 216{
175 switch(id) 217 MetaFactory::configWidget c;
176 { 218
177 case 0: 219 //c = m_fact->;
178 frame_device_line->setText("/dev/ttyS0"); 220 c = factory_serial;
179 frame_number->hide(); 221
180 frame_number_line->hide(); 222 QFrame *device_frame = static_cast<QFrame*>(c(NULL));
181 break;
182 case 1:
183 frame_device_line->setText("/dev/ircomm0");
184 frame_number->hide();
185 frame_number_line->hide();
186 break;
187 case 2:
188 frame_device_line->setText("/dev/ttyS0");
189 frame_number->show();
190 frame_number_line->show();
191 break;
192 }
193} 223}
@@ -237,3 +267,4 @@ QString ProfileEditorDialog::conn_device()
237{ 267{
238 return frame_device_line->text(); 268 //return frame_device_line->text();
269 return "serial";
239} 270}