author | josef <josef> | 2002-10-07 11:19:00 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-07 11:19:00 (UTC) |
commit | 4fad0b73ae2940099bbb6f20bb94ed1f29e6d05b (patch) (unidiff) | |
tree | 892db7b819261208d0bc288d88b5d1c4a58ec486 | |
parent | 198ccce69447b515876e68cf7067e70da88cfb70 (diff) | |
download | opie-4fad0b73ae2940099bbb6f20bb94ed1f29e6d05b.zip opie-4fad0b73ae2940099bbb6f20bb94ed1f29e6d05b.tar.gz opie-4fad0b73ae2940099bbb6f20bb94ed1f29e6d05b.tar.bz2 |
- when editing, replace edited profile instead of inserting new one
- now save nearly all settings (not loaded yet)
-rw-r--r-- | noncore/apps/opie-console/configdialog.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 95 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 30 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditorplugins.cpp | 20 |
4 files changed, 117 insertions, 35 deletions
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp index 655d649..ee1ffb4 100644 --- a/noncore/apps/opie-console/configdialog.cpp +++ b/noncore/apps/opie-console/configdialog.cpp | |||
@@ -78,11 +78,14 @@ void ConfigDialog::slotEdit() { | |||
78 | int ret = dlg.exec(); | 78 | int ret = dlg.exec(); |
79 | 79 | ||
80 | if(ret == QDialog::Accepted) | 80 | if(ret == QDialog::Accepted) |
81 | { | 81 | { |
82 | // if(listView->current()) delete lstView->current(); ... | 82 | if(lstView->currentItem()) delete lstView->currentItem(); |
83 | |||
83 | // use dlg.terminal()! | 84 | // use dlg.terminal()! |
84 | new ConfigListItem(lstView, Profile(dlg.prof_name(), dlg.prof_type(), Profile::White, Profile::Black, Profile::VT102)); | 85 | Profile p = dlg.profile(); |
86 | |||
87 | new ConfigListItem(lstView, p); | ||
85 | } | 88 | } |
86 | } | 89 | } |
87 | 90 | ||
88 | 91 | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index fc95e56..5b7f851 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -80,14 +80,14 @@ void ProfileEditorDialog::initUI() | |||
80 | plugin_layout->add(plugin_plugin->widget()); | 80 | plugin_layout->add(plugin_plugin->widget()); |
81 | 81 | ||
82 | // connection tab, general part | 82 | // connection tab, general part |
83 | 83 | ||
84 | speed_box = new QComboBox(tabconn); | 84 | QComboBox *speed_box = new QComboBox(tabconn); |
85 | speed_box->insertItem("115200 baud"); | 85 | speed_box->insertItem("115200 baud", id_baud_115200); |
86 | speed_box->insertItem("57600 baud"); | 86 | speed_box->insertItem("57600 baud", id_baud_57600); |
87 | speed_box->insertItem("38400 baud"); | 87 | speed_box->insertItem("38400 baud", id_baud_38400); |
88 | speed_box->insertItem("19200 baud"); | 88 | speed_box->insertItem("19200 baud", id_baud_19200); |
89 | speed_box->insertItem("9600 baud"); | 89 | speed_box->insertItem("9600 baud", id_baud_9600); |
90 | 90 | ||
91 | QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn); | 91 | QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn); |
92 | QLabel *flow = new QLabel(QObject::tr("Flow control"), tabconn); | 92 | QLabel *flow = new QLabel(QObject::tr("Flow control"), tabconn); |
93 | QLabel *parity = new QLabel(QObject::tr("Parity"), tabconn); | 93 | QLabel *parity = new QLabel(QObject::tr("Parity"), tabconn); |
@@ -95,27 +95,27 @@ void ProfileEditorDialog::initUI() | |||
95 | QButtonGroup *group_flow = new QButtonGroup(tabconn); | 95 | QButtonGroup *group_flow = new QButtonGroup(tabconn); |
96 | group_flow->hide(); | 96 | group_flow->hide(); |
97 | QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn); | 97 | QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn); |
98 | QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn); | 98 | QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn); |
99 | group_flow->insert(flow_hw); | 99 | group_flow->insert(flow_hw, id_flow_hw); |
100 | group_flow->insert(flow_sw); | 100 | group_flow->insert(flow_sw, id_flow_sw); |
101 | 101 | ||
102 | QButtonGroup *group_parity = new QButtonGroup(tabconn); | 102 | QButtonGroup *group_parity = new QButtonGroup(tabconn); |
103 | group_parity->hide(); | 103 | group_parity->hide(); |
104 | QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn); | 104 | QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn); |
105 | QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn); | 105 | QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn); |
106 | group_parity->insert(parity_odd); | 106 | group_parity->insert(parity_odd, id_parity_odd); |
107 | group_parity->insert(parity_even); | 107 | group_parity->insert(parity_even, id_parity_even); |
108 | 108 | ||
109 | flow_sw->setChecked(true); | 109 | flow_sw->setChecked(true); |
110 | parity_odd->setChecked(true); | 110 | parity_odd->setChecked(true); |
111 | 111 | ||
112 | // terminal tab | 112 | // terminal tab |
113 | 113 | ||
114 | terminal_box = new QComboBox(tabterm); | 114 | QComboBox *terminal_box = new QComboBox(tabterm); |
115 | terminal_box->insertItem("VT 100"); | 115 | terminal_box->insertItem("VT 100", id_term_vt100); |
116 | terminal_box->insertItem("VT 220"); | 116 | terminal_box->insertItem("VT 220", id_term_vt220); |
117 | terminal_box->insertItem("ANSI"); | 117 | terminal_box->insertItem("ANSI", id_term_ansi); |
118 | 118 | ||
119 | QLabel *terminal = new QLabel(QObject::tr("Terminal type"), tabterm); | 119 | QLabel *terminal = new QLabel(QObject::tr("Terminal type"), tabterm); |
120 | QLabel *colour = new QLabel(QObject::tr("Colour scheme"), tabterm); | 120 | QLabel *colour = new QLabel(QObject::tr("Colour scheme"), tabterm); |
121 | QLabel *size = new QLabel(QObject::tr("Font size"), tabterm); | 121 | QLabel *size = new QLabel(QObject::tr("Font size"), tabterm); |
@@ -201,8 +201,15 @@ void ProfileEditorDialog::initUI() | |||
201 | // signals | 201 | // signals |
202 | 202 | ||
203 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); | 203 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); |
204 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); | 204 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); |
205 | |||
206 | connect(group_flow, SIGNAL(clicked(int)), SLOT(slotConn(int))); | ||
207 | connect(group_parity, SIGNAL(clicked(int)), SLOT(slotConn(int))); | ||
208 | connect(speed_box, SIGNAL(clicked(int)), SLOT(slotConn(int))); | ||
209 | |||
210 | connect(terminal_box, SIGNAL(clicked(int)), SLOT(slotConn(int))); | ||
211 | connect(group_size, SIGNAL(clicked(int)), SLOT(slotConn(int))); | ||
205 | } | 212 | } |
206 | 213 | ||
207 | ProfileEditorDialog::~ProfileEditorDialog() { | 214 | ProfileEditorDialog::~ProfileEditorDialog() { |
208 | 215 | ||
@@ -231,9 +238,8 @@ void ProfileEditorDialog::accept() | |||
231 | QObject::tr("Invalid profile"), | 238 | QObject::tr("Invalid profile"), |
232 | QObject::tr("Please enter a profile name.")); | 239 | QObject::tr("Please enter a profile name.")); |
233 | return; | 240 | return; |
234 | } | 241 | } |
235 | |||
236 | // Save profile and plugin profile | 242 | // Save profile and plugin profile |
237 | if(plugin_plugin) plugin_plugin->save(); | 243 | if(plugin_plugin) plugin_plugin->save(); |
238 | 244 | ||
239 | // Save general values | 245 | // Save general values |
@@ -260,15 +266,60 @@ QString ProfileEditorDialog::prof_type() | |||
260 | 266 | ||
261 | return QString::null; | 267 | return QString::null; |
262 | } | 268 | } |
263 | 269 | ||
264 | QString ProfileEditorDialog::conn_device() | 270 | void ProfileEditorDialog::slotConn(int id) |
265 | { | 271 | { |
266 | //return frame_device_line->text(); | 272 | switch(id) |
267 | return "/dev/ttyS0"; | 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 | case id_parity_odd: | ||
281 | m_prof.writeEntry("Parity", 2); | ||
282 | break; | ||
283 | case id_parity_even: | ||
284 | m_prof.writeEntry("Parity", 1); | ||
285 | break; | ||
286 | |||
287 | case id_baud_115200: | ||
288 | m_prof.writeEntry("Speed", 115200); | ||
289 | break; | ||
290 | case id_baud_57600: | ||
291 | m_prof.writeEntry("Speed", 57600); | ||
292 | break; | ||
293 | case id_baud_38400: | ||
294 | m_prof.writeEntry("Speed", 38400); | ||
295 | break; | ||
296 | case id_baud_19200: | ||
297 | m_prof.writeEntry("Speed", 19200); | ||
298 | break; | ||
299 | case id_baud_9600: | ||
300 | m_prof.writeEntry("Speed", 9600); | ||
301 | break; | ||
302 | |||
303 | case id_term_vt100: | ||
304 | m_prof.writeEntry("Terminal", 2); | ||
305 | break; | ||
306 | case id_term_vt220: | ||
307 | m_prof.writeEntry("Terminal", 1); | ||
308 | break; | ||
309 | case id_term_ansi: | ||
310 | m_prof.writeEntry("Terminal", 0); | ||
311 | break; | ||
312 | |||
313 | case id_size_small: | ||
314 | m_prof.writeEntry("Font", 0); | ||
315 | break; | ||
316 | case id_size_medium: | ||
317 | m_prof.writeEntry("Font", 1); | ||
318 | break; | ||
319 | case id_size_large: | ||
320 | m_prof.writeEntry("Font", 2); | ||
321 | break; | ||
322 | } | ||
268 | } | 323 | } |
269 | 324 | ||
270 | QString ProfileEditorDialog::term_type() | ||
271 | { | ||
272 | return terminal_box->currentText(); | ||
273 | } | ||
274 | 325 | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index faabda0..0637f44 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h | |||
@@ -25,19 +25,17 @@ public: | |||
25 | 25 | ||
26 | QString prof_name(); | 26 | QString prof_name(); |
27 | QString prof_type(); | 27 | QString prof_type(); |
28 | 28 | ||
29 | QString conn_device(); | ||
30 | |||
31 | QString term_type(); | ||
32 | |||
33 | public slots: | 29 | public slots: |
34 | void accept(); | 30 | void accept(); |
35 | //void slotOk(); | 31 | //void slotOk(); |
36 | void slotCancel(); | 32 | void slotCancel(); |
37 | 33 | ||
38 | void slotDevice(int id); | 34 | void slotDevice(int id); |
39 | 35 | ||
36 | void slotConn(int id); | ||
37 | |||
40 | private: | 38 | private: |
41 | void initUI(); | 39 | void initUI(); |
42 | 40 | ||
43 | MetaFactory* m_fact; | 41 | MetaFactory* m_fact; |
@@ -45,14 +43,32 @@ private: | |||
45 | QTabWidget* m_tab; | 43 | QTabWidget* m_tab; |
46 | QHBoxLayout* m_lay; | 44 | QHBoxLayout* m_lay; |
47 | Profile m_prof; | 45 | Profile m_prof; |
48 | 46 | ||
49 | //QLabel *frame_number; | ||
50 | QLineEdit *name_line; | 47 | QLineEdit *name_line; |
51 | //QLineEdit *frame_device_line, *frame_number_line; | 48 | QComboBox *device_box; |
52 | QComboBox *terminal_box, *speed_box, *device_box; | 49 | |
53 | QWidget *plugin_base; | 50 | QWidget *plugin_base; |
54 | ProfileEditorPlugin *plugin_plugin; | 51 | ProfileEditorPlugin *plugin_plugin; |
55 | QHBoxLayout *plugin_layout; | 52 | QHBoxLayout *plugin_layout; |
53 | |||
54 | enum Ids | ||
55 | { | ||
56 | id_parity_odd, | ||
57 | id_parity_even, | ||
58 | id_flow_hw, | ||
59 | id_flow_sw, | ||
60 | id_baud_115200, | ||
61 | id_baud_57600, | ||
62 | id_baud_38400, | ||
63 | id_baud_19200, | ||
64 | id_baud_9600, | ||
65 | id_term_vt100, | ||
66 | id_term_vt220, | ||
67 | id_term_ansi, | ||
68 | id_size_small, | ||
69 | id_size_medium, | ||
70 | id_size_large | ||
71 | }; | ||
56 | }; | 72 | }; |
57 | 73 | ||
58 | #endif | 74 | #endif |
diff --git a/noncore/apps/opie-console/profileeditorplugins.cpp b/noncore/apps/opie-console/profileeditorplugins.cpp index 54eee3f..a11d6b0 100644 --- a/noncore/apps/opie-console/profileeditorplugins.cpp +++ b/noncore/apps/opie-console/profileeditorplugins.cpp | |||
@@ -40,13 +40,13 @@ class ProfileEditorPluginSerial : public ProfileEditorPlugin | |||
40 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 40 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
41 | 41 | ||
42 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | 42 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); |
43 | 43 | ||
44 | QLineEdit *frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); | 44 | device_line = new QLineEdit("/dev/ttyS0", device_frame); |
45 | 45 | ||
46 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | 46 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); |
47 | vbox_frame->add(frame_device); | 47 | vbox_frame->add(frame_device); |
48 | vbox_frame->add(frame_device_line); | 48 | vbox_frame->add(device_line); |
49 | 49 | ||
50 | m_widget = device_frame; | 50 | m_widget = device_frame; |
51 | } | 51 | } |
52 | 52 | ||
@@ -54,9 +54,15 @@ class ProfileEditorPluginSerial : public ProfileEditorPlugin | |||
54 | } | 54 | } |
55 | 55 | ||
56 | void save() | 56 | void save() |
57 | { | 57 | { |
58 | // special settings | ||
59 | Profile p = m_profile; | ||
60 | p.writeEntry("Device", device_line->text()); | ||
58 | } | 61 | } |
62 | |||
63 | private: | ||
64 | QLineEdit *device_line; | ||
59 | }; | 65 | }; |
60 | 66 | ||
61 | class ProfileEditorPluginIrda : public ProfileEditorPlugin | 67 | class ProfileEditorPluginIrda : public ProfileEditorPlugin |
62 | { | 68 | { |
@@ -79,13 +85,13 @@ class ProfileEditorPluginIrda : public ProfileEditorPlugin | |||
79 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 85 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
80 | 86 | ||
81 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | 87 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); |
82 | 88 | ||
83 | QLineEdit *frame_device_line = new QLineEdit("/dev/ircomm0", device_frame); | 89 | device_line = new QLineEdit("/dev/ircomm0", device_frame); |
84 | 90 | ||
85 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | 91 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); |
86 | vbox_frame->add(frame_device); | 92 | vbox_frame->add(frame_device); |
87 | vbox_frame->add(frame_device_line); | 93 | vbox_frame->add(device_line); |
88 | 94 | ||
89 | m_widget = device_frame; | 95 | m_widget = device_frame; |
90 | } | 96 | } |
91 | 97 | ||
@@ -93,9 +99,15 @@ class ProfileEditorPluginIrda : public ProfileEditorPlugin | |||
93 | } | 99 | } |
94 | 100 | ||
95 | void save() | 101 | void save() |
96 | { | 102 | { |
103 | // special settings | ||
104 | Profile p = m_profile; | ||
105 | p.writeEntry("Device", device_line->text()); | ||
97 | } | 106 | } |
107 | |||
108 | private: | ||
109 | QLineEdit *device_line; | ||
98 | }; | 110 | }; |
99 | 111 | ||
100 | class ProfileEditorPluginModem : public ProfileEditorPlugin | 112 | class ProfileEditorPluginModem : public ProfileEditorPlugin |
101 | { | 113 | { |