Diffstat (limited to 'noncore/apps/opie-console/profileeditordialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 188 |
1 files changed, 7 insertions, 181 deletions
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 78885e1..d98e589 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -1,18 +1,15 @@ | |||
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" | ||
8 | #include "qcombobox.h" | ||
9 | #include "qcheckbox.h" | ||
10 | #include "qmessagebox.h" | 7 | #include "qmessagebox.h" |
11 | #include "qbuttongroup.h" | ||
12 | #include "qstringlist.h" | 8 | #include "qstringlist.h" |
9 | #include "qcombobox.h" | ||
13 | 10 | ||
14 | #include "profileeditorplugins.h" | 11 | #include "profileeditorplugins.h" |
15 | #include "metafactory.h" | 12 | #include "metafactory.h" |
16 | 13 | ||
17 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | 14 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, |
18 | const Profile& prof ) | 15 | const Profile& prof ) |
@@ -78,117 +75,35 @@ void ProfileEditorDialog::initUI() | |||
78 | 75 | ||
79 | plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, m_prof); | 76 | plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, m_prof); |
80 | plugin_layout->add(plugin_plugin->widget()); | 77 | plugin_layout->add(plugin_plugin->widget()); |
81 | 78 | ||
82 | // connection tab, general part | 79 | // connection tab, general part |
83 | 80 | ||
84 | QComboBox *speed_box = new QComboBox(tabconn); | 81 | QWidget *conn_widget = plugin_plugin->connection_widget(); |
85 | speed_box->insertItem("115200 baud", id_baud_115200); | 82 | conn_widget->reparent(tabconn, 0, QPoint(), true); |
86 | speed_box->insertItem("57600 baud", id_baud_57600); | ||
87 | speed_box->insertItem("38400 baud", id_baud_38400); | ||
88 | speed_box->insertItem("19200 baud", id_baud_19200); | ||
89 | speed_box->insertItem("9600 baud", id_baud_9600); | ||
90 | |||
91 | QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn); | ||
92 | QLabel *flow = new QLabel(QObject::tr("Flow control"), tabconn); | ||
93 | QLabel *parity = new QLabel(QObject::tr("Parity"), tabconn); | ||
94 | |||
95 | QButtonGroup *group_flow = new QButtonGroup(tabconn); | ||
96 | group_flow->hide(); | ||
97 | QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn); | ||
98 | QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn); | ||
99 | group_flow->insert(flow_hw, id_flow_hw); | ||
100 | group_flow->insert(flow_sw, id_flow_sw); | ||
101 | |||
102 | QButtonGroup *group_parity = new QButtonGroup(tabconn); | ||
103 | group_parity->hide(); | ||
104 | QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn); | ||
105 | QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn); | ||
106 | group_parity->insert(parity_odd, id_parity_odd); | ||
107 | group_parity->insert(parity_even, id_parity_even); | ||
108 | |||
109 | flow_sw->setChecked(true); | ||
110 | parity_odd->setChecked(true); | ||
111 | 83 | ||
112 | // terminal tab | 84 | // terminal tab |
113 | 85 | ||
114 | QComboBox *terminal_box = new QComboBox(tabterm); | 86 | QWidget *term_widget = plugin_plugin->terminal_widget(); |
115 | terminal_box->insertItem("VT 100", id_term_vt100); | 87 | term_widget->reparent(tabterm, 0, QPoint(), true); |
116 | terminal_box->insertItem("VT 220", id_term_vt220); | ||
117 | terminal_box->insertItem("ANSI", id_term_ansi); | ||
118 | |||
119 | QLabel *terminal = new QLabel(QObject::tr("Terminal type"), tabterm); | ||
120 | QLabel *colour = new QLabel(QObject::tr("Colour scheme"), tabterm); | ||
121 | QLabel *size = new QLabel(QObject::tr("Font size"), tabterm); | ||
122 | QLabel *options = new QLabel(QObject::tr("Options"), tabterm); | ||
123 | QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), tabterm); | ||
124 | |||
125 | QComboBox *colour_box = new QComboBox(tabterm); | ||
126 | colour_box->insertItem(QObject::tr("black on white")); | ||
127 | colour_box->insertItem(QObject::tr("white on black")); | ||
128 | |||
129 | QButtonGroup *group_size = new QButtonGroup(tabterm); | ||
130 | group_size->hide(); | ||
131 | QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm); | ||
132 | QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), tabterm); | ||
133 | QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm); | ||
134 | group_size->insert(size_small); | ||
135 | group_size->insert(size_medium); | ||
136 | group_size->insert(size_large); | ||
137 | |||
138 | QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), tabterm); | ||
139 | QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), tabterm); | ||
140 | |||
141 | QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), tabterm); | ||
142 | QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), tabterm); | ||
143 | |||
144 | size_small->setChecked(true); | ||
145 | 88 | ||
146 | // layouting | 89 | // layouting |
147 | 90 | ||
148 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); | 91 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); |
149 | vbox3->add(name); | 92 | vbox3->add(name); |
150 | vbox3->add(name_line); | 93 | vbox3->add(name_line); |
151 | vbox3->addStretch(1); | 94 | vbox3->addStretch(1); |
152 | 95 | ||
153 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); | 96 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); |
154 | vbox->add(device); | 97 | vbox->add(device); |
155 | vbox->add(device_box); | 98 | vbox->add(device_box); |
156 | vbox->add(plugin_base); | 99 | vbox->add(plugin_base); |
157 | vbox->add(speed); | 100 | vbox->add(conn_widget); |
158 | vbox->add(speed_box); | ||
159 | vbox->add(flow); | ||
160 | QHBoxLayout *hbox = new QHBoxLayout(vbox, 2); | ||
161 | hbox->add(flow_hw); | ||
162 | hbox->add(flow_sw); | ||
163 | //vbox->add(group_flow); | ||
164 | vbox->add(parity); | ||
165 | QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2); | ||
166 | hbox2->add(parity_odd); | ||
167 | hbox2->add(parity_even); | ||
168 | //vbox->add(group_parity); | ||
169 | 101 | ||
170 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); | 102 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); |
171 | vbox2->add(terminal); | 103 | vbox2->add(term_widget); |
172 | vbox2->add(terminal_box); | ||
173 | vbox2->add(size); | ||
174 | QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2); | ||
175 | hbox3->add(size_small); | ||
176 | hbox3->add(size_medium); | ||
177 | hbox3->add(size_large); | ||
178 | //vbox2->add(group_size); | ||
179 | vbox2->add(colour); | ||
180 | vbox2->add(colour_box); | ||
181 | vbox2->add(conversions); | ||
182 | QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2); | ||
183 | hbox5->add(conv_inbound); | ||
184 | hbox5->add(conv_outbound); | ||
185 | vbox2->add(options); | ||
186 | QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2); | ||
187 | hbox4->add(option_wrap); | ||
188 | hbox4->add(option_echo); | ||
189 | 104 | ||
190 | addTab(tabprof, QObject::tr("Profile")); | 105 | addTab(tabprof, QObject::tr("Profile")); |
191 | addTab(tabconn, QObject::tr("Connection")); | 106 | addTab(tabconn, QObject::tr("Connection")); |
192 | addTab(tabterm, QObject::tr("Terminal")); | 107 | addTab(tabterm, QObject::tr("Terminal")); |
193 | 108 | ||
194 | setOkButton(QObject::tr("OK")); | 109 | setOkButton(QObject::tr("OK")); |
@@ -199,19 +114,12 @@ void ProfileEditorDialog::initUI() | |||
199 | name_line->setText(m_prof.name()); | 114 | name_line->setText(m_prof.name()); |
200 | 115 | ||
201 | // signals | 116 | // signals |
202 | 117 | ||
203 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); | 118 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); |
204 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); | 119 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); |
205 | |||
206 | connect(group_flow, SIGNAL(clicked(int)), SLOT(slotConnFlow(int))); | ||
207 | connect(group_parity, SIGNAL(clicked(int)), SLOT(slotConnParity(int))); | ||
208 | connect(speed_box, SIGNAL(activated(int)), SLOT(slotConnSpeed(int))); | ||
209 | |||
210 | connect(terminal_box, SIGNAL(activated(int)), SLOT(slotTermTerm(int))); | ||
211 | connect(group_size, SIGNAL(clicked(int)), SLOT(slotTermFont(int))); | ||
212 | } | 120 | } |
213 | 121 | ||
214 | ProfileEditorDialog::~ProfileEditorDialog() { | 122 | ProfileEditorDialog::~ProfileEditorDialog() { |
215 | 123 | ||
216 | } | 124 | } |
217 | 125 | ||
@@ -264,89 +172,7 @@ QString ProfileEditorDialog::prof_type() | |||
264 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) | 172 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
265 | if(device_box->currentText() == m_fact->name((*it))) return (*it); | 173 | if(device_box->currentText() == m_fact->name((*it))) return (*it); |
266 | 174 | ||
267 | return QString::null; | 175 | return QString::null; |
268 | } | 176 | } |
269 | 177 | ||
270 | void ProfileEditorDialog::slotConnFlow(int id) | ||
271 | { | ||
272 | switch(id) | ||
273 | { | ||
274 | case id_flow_hw: | ||
275 | m_prof.writeEntry("Flow", 0x01); | ||
276 | break; | ||
277 | case id_flow_sw: | ||
278 | m_prof.writeEntry("Flow", 0x02); | ||
279 | break; | ||
280 | } | ||
281 | } | ||
282 | |||
283 | void ProfileEditorDialog::slotConnParity(int id) | ||
284 | { | ||
285 | switch(id) | ||
286 | { | ||
287 | case id_parity_odd: | ||
288 | m_prof.writeEntry("Parity", 2); | ||
289 | break; | ||
290 | case id_parity_even: | ||
291 | m_prof.writeEntry("Parity", 1); | ||
292 | break; | ||
293 | } | ||
294 | } | ||
295 | |||
296 | void ProfileEditorDialog::slotConnSpeed(int id) | ||
297 | { | ||
298 | switch(id) | ||
299 | { | ||
300 | |||
301 | case id_baud_115200: | ||
302 | m_prof.writeEntry("Speed", 115200); | ||
303 | break; | ||
304 | case id_baud_57600: | ||
305 | m_prof.writeEntry("Speed", 57600); | ||
306 | break; | ||
307 | case id_baud_38400: | ||
308 | m_prof.writeEntry("Speed", 38400); | ||
309 | break; | ||
310 | case id_baud_19200: | ||
311 | m_prof.writeEntry("Speed", 19200); | ||
312 | break; | ||
313 | case id_baud_9600: | ||
314 | m_prof.writeEntry("Speed", 9600); | ||
315 | break; | ||
316 | } | ||
317 | } | ||
318 | |||
319 | void ProfileEditorDialog::slotTermTerm(int id) | ||
320 | { | ||
321 | switch(id) | ||
322 | { | ||
323 | |||
324 | case id_term_vt100: | ||
325 | m_prof.writeEntry("Terminal", 2); | ||
326 | break; | ||
327 | case id_term_vt220: | ||
328 | m_prof.writeEntry("Terminal", 1); | ||
329 | break; | ||
330 | case id_term_ansi: | ||
331 | m_prof.writeEntry("Terminal", 0); | ||
332 | break; | ||
333 | } | ||
334 | } | ||
335 | |||
336 | void ProfileEditorDialog::slotTermFont(int id) | ||
337 | { | ||
338 | switch(id) | ||
339 | { | ||
340 | case id_size_small: | ||
341 | m_prof.writeEntry("Font", 0); | ||
342 | break; | ||
343 | case id_size_medium: | ||
344 | m_prof.writeEntry("Font", 1); | ||
345 | break; | ||
346 | case id_size_large: | ||
347 | m_prof.writeEntry("Font", 2); | ||
348 | break; | ||
349 | } | ||
350 | } | ||
351 | |||
352 | 178 | ||