author | harlekin <harlekin> | 2002-10-17 17:39:06 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-17 17:39:06 (UTC) |
commit | ec202e5d2956f2cde0f2a6be5c452bd67347e21f (patch) (unidiff) | |
tree | 54d5868f9c71ad953360b911f9c50ff21e070d03 | |
parent | fb44c86f420d9a77d7364ac8b8bbd25b0f6ab09a (diff) | |
download | opie-ec202e5d2956f2cde0f2a6be5c452bd67347e21f.zip opie-ec202e5d2956f2cde0f2a6be5c452bd67347e21f.tar.gz opie-ec202e5d2956f2cde0f2a6be5c452bd67347e21f.tar.bz2 |
only show connection tab in profile config dialog if the current layer has connections - for local console mode
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/serialconfigwidget.cpp | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index b709cf3..5c5c2b3 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -1,193 +1,193 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | #include <qlineedit.h> | 2 | #include <qlineedit.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qmessagebox.h> | 4 | #include <qmessagebox.h> |
5 | #include <qstringlist.h> | 5 | #include <qstringlist.h> |
6 | #include <qcombobox.h> | 6 | #include <qcombobox.h> |
7 | 7 | ||
8 | 8 | ||
9 | #include <opie/otabwidget.h> | ||
10 | |||
11 | #include "profileeditorplugins.h" | 9 | #include "profileeditorplugins.h" |
12 | #include "metafactory.h" | 10 | #include "metafactory.h" |
13 | #include "profileeditordialog.h" | 11 | #include "profileeditordialog.h" |
14 | 12 | ||
15 | namespace { | 13 | namespace { |
16 | void setCurrent( const QString& str, QComboBox* bo ) { | 14 | void setCurrent( const QString& str, QComboBox* bo ) { |
17 | for (uint i = 0; i < bo->count(); i++ ) { | 15 | for (uint i = 0; i < bo->count(); i++ ) { |
18 | if ( bo->text(i) == str ) { | 16 | if ( bo->text(i) == str ) { |
19 | bo->setCurrentItem( i ); | 17 | bo->setCurrentItem( i ); |
20 | } | 18 | } |
21 | } | 19 | } |
22 | } | 20 | } |
23 | 21 | ||
24 | 22 | ||
25 | } | 23 | } |
26 | 24 | ||
27 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | 25 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, |
28 | const Profile& prof ) | 26 | const Profile& prof ) |
29 | : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) | 27 | : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) |
30 | { | 28 | { |
31 | initUI(); | 29 | initUI(); |
32 | 30 | ||
33 | // Apply current profile | 31 | // Apply current profile |
34 | // plugin_plugin->load(profile); | 32 | // plugin_plugin->load(profile); |
35 | // ... (reset profile name line edit etc.) | 33 | // ... (reset profile name line edit etc.) |
36 | } | 34 | } |
37 | 35 | ||
38 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | 36 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) |
39 | : QDialog(0, 0, TRUE), m_fact( fact ) | 37 | : QDialog(0, 0, TRUE), m_fact( fact ) |
40 | { | 38 | { |
41 | // Default profile | 39 | // Default profile |
42 | m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102); | 40 | m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102); |
43 | 41 | ||
44 | initUI(); | 42 | initUI(); |
45 | 43 | ||
46 | // Apply current profile | 44 | // Apply current profile |
47 | // plugin_plugin->load(profile); | 45 | // plugin_plugin->load(profile); |
48 | } | 46 | } |
49 | 47 | ||
50 | Profile ProfileEditorDialog::profile() const | 48 | Profile ProfileEditorDialog::profile() const |
51 | { | 49 | { |
52 | return m_prof; | 50 | return m_prof; |
53 | } | 51 | } |
54 | 52 | ||
55 | void ProfileEditorDialog::initUI() | 53 | void ProfileEditorDialog::initUI() |
56 | { | 54 | { |
57 | m_con = m_term = 0l; | 55 | m_con = m_term = 0l; |
58 | 56 | ||
59 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 57 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
60 | OTabWidget *tabWidget = new OTabWidget( this ); | 58 | tabWidget = new OTabWidget( this ); |
61 | tabWidget->setTabStyle(OTabWidget::TextTab); | 59 | tabWidget->setTabStyle(OTabWidget::TextTab); |
62 | mainLayout->add(tabWidget); | 60 | mainLayout->add(tabWidget); |
63 | 61 | ||
64 | QWidget *tabprof; | 62 | QWidget *tabprof; |
65 | 63 | ||
66 | /* base tabs */ | 64 | /* base tabs */ |
67 | tabprof = new QWidget(this); | 65 | tabprof = new QWidget(this); |
68 | m_tabTerm = new QWidget(this); | 66 | m_tabTerm = new QWidget(this); |
69 | m_tabCon = new QWidget(this); | 67 | m_tabCon = new QWidget(this); |
70 | 68 | ||
71 | /* base layout for tabs */ | 69 | /* base layout for tabs */ |
72 | m_layCon = new QHBoxLayout( m_tabCon , 2 ); | 70 | m_layCon = new QHBoxLayout( m_tabCon , 2 ); |
73 | m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); | 71 | m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); |
74 | 72 | ||
75 | // profile tab | 73 | // profile tab |
76 | 74 | ||
77 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); | 75 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); |
78 | m_name = new QLineEdit(tabprof); | 76 | m_name = new QLineEdit(tabprof); |
79 | QLabel *con = new QLabel(tr("Connection"), tabprof ); | 77 | QLabel *con = new QLabel(tr("Connection"), tabprof ); |
80 | QLabel *term = new QLabel(tr("Terminal"), tabprof ); | 78 | QLabel *term = new QLabel(tr("Terminal"), tabprof ); |
81 | m_conCmb = new QComboBox( tabprof ); | 79 | m_conCmb = new QComboBox( tabprof ); |
82 | m_termCmb = new QComboBox( tabprof ); | 80 | m_termCmb = new QComboBox( tabprof ); |
83 | 81 | ||
84 | // layouting | 82 | // layouting |
85 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); | 83 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); |
86 | vbox3->add(name); | 84 | vbox3->add(name); |
87 | vbox3->add(m_name); | 85 | vbox3->add(m_name); |
88 | vbox3->add(con ); | 86 | vbox3->add(con ); |
89 | vbox3->add(m_conCmb ); | 87 | vbox3->add(m_conCmb ); |
90 | vbox3->add(term ); | 88 | vbox3->add(term ); |
91 | vbox3->add(m_termCmb ); | 89 | vbox3->add(m_termCmb ); |
92 | vbox3->addStretch(1); | 90 | vbox3->addStretch(1); |
93 | 91 | ||
94 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); | 92 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); |
95 | tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); | 93 | tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); |
96 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); | 94 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); |
97 | tabWidget->setCurrentTab( tabprof ); | 95 | tabWidget->setCurrentTab( tabprof ); |
98 | 96 | ||
99 | 97 | ||
100 | // fill the comboboxes | 98 | // fill the comboboxes |
101 | QStringList list = m_fact->connectionWidgets(); | 99 | QStringList list = m_fact->connectionWidgets(); |
102 | QStringList::Iterator it; | 100 | QStringList::Iterator it; |
103 | for (it =list.begin(); it != list.end(); ++it ) { | 101 | for (it =list.begin(); it != list.end(); ++it ) { |
104 | m_conCmb->insertItem( (*it) ); | 102 | m_conCmb->insertItem( (*it) ); |
105 | } | 103 | } |
106 | list = m_fact->terminalWidgets(); | 104 | list = m_fact->terminalWidgets(); |
107 | for (it =list.begin(); it != list.end(); ++it ) { | 105 | for (it =list.begin(); it != list.end(); ++it ) { |
108 | m_termCmb->insertItem( (*it) ); | 106 | m_termCmb->insertItem( (*it) ); |
109 | } | 107 | } |
110 | 108 | ||
111 | // load profile values | 109 | // load profile values |
112 | m_name->setText(m_prof.name()); | 110 | m_name->setText(m_prof.name()); |
113 | slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); | 111 | slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); |
114 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); | 112 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); |
115 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); | 113 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); |
116 | setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); | 114 | setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); |
117 | 115 | ||
118 | 116 | ||
119 | // signal and slots | 117 | // signal and slots |
120 | connect(m_conCmb, SIGNAL(activated(const QString& ) ), | 118 | connect(m_conCmb, SIGNAL(activated(const QString& ) ), |
121 | this, SLOT(slotConActivated(const QString&) ) ); | 119 | this, SLOT(slotConActivated(const QString&) ) ); |
122 | connect(m_termCmb, SIGNAL(activated(const QString& ) ), | 120 | connect(m_termCmb, SIGNAL(activated(const QString& ) ), |
123 | this, SLOT(slotTermActivated(const QString& ) ) ); | 121 | this, SLOT(slotTermActivated(const QString& ) ) ); |
124 | 122 | ||
125 | } | 123 | } |
126 | 124 | ||
127 | ProfileEditorDialog::~ProfileEditorDialog() { | 125 | ProfileEditorDialog::~ProfileEditorDialog() { |
128 | 126 | ||
129 | } | 127 | } |
130 | void ProfileEditorDialog::accept() | 128 | void ProfileEditorDialog::accept() |
131 | { | 129 | { |
132 | if(profName().isEmpty()) | 130 | if(profName().isEmpty()) |
133 | { | 131 | { |
134 | QMessageBox::information(this, | 132 | QMessageBox::information(this, |
135 | QObject::tr("Invalid profile"), | 133 | QObject::tr("Invalid profile"), |
136 | QObject::tr("Please enter a profile name.")); | 134 | QObject::tr("Please enter a profile name.")); |
137 | return; | 135 | return; |
138 | } | 136 | } |
139 | // Save profile and plugin profile | 137 | // Save profile and plugin profile |
140 | //if(plugin_plugin) plugin_plugin->save(); | 138 | //if(plugin_plugin) plugin_plugin->save(); |
141 | 139 | ||
142 | // Save general values | 140 | // Save general values |
143 | m_prof.setName(profName()); | 141 | m_prof.setName(profName()); |
144 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); | 142 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); |
145 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); | 143 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); |
146 | 144 | ||
147 | if (m_con ) | 145 | if (m_con ) |
148 | m_con->save( m_prof ); | 146 | m_con->save( m_prof ); |
149 | if (m_term ) | 147 | if (m_term ) |
150 | m_term->save( m_prof ); | 148 | m_term->save( m_prof ); |
151 | 149 | ||
152 | QDialog::accept(); | 150 | QDialog::accept(); |
153 | } | 151 | } |
154 | 152 | ||
155 | 153 | ||
156 | QString ProfileEditorDialog::profName()const | 154 | QString ProfileEditorDialog::profName()const |
157 | { | 155 | { |
158 | return m_name->text(); | 156 | return m_name->text(); |
159 | } | 157 | } |
160 | 158 | ||
161 | QCString ProfileEditorDialog::profType()const | 159 | QCString ProfileEditorDialog::profType()const |
162 | { | 160 | { |
163 | /*QStringList w = m_fact->configWidgets(); | 161 | /*QStringList w = m_fact->configWidgets(); |
164 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) | 162 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
165 | if(device_box->currentText() == m_fact->name((*it))) return (*it); | 163 | if(device_box->currentText() == m_fact->name((*it))) return (*it); |
166 | */ | 164 | */ |
167 | return QCString(); | 165 | return QCString(); |
168 | } | 166 | } |
169 | /* | 167 | /* |
170 | * we need to switch the widget | 168 | * we need to switch the widget |
171 | */ | 169 | */ |
172 | void ProfileEditorDialog::slotConActivated( const QString& str ) { | 170 | void ProfileEditorDialog::slotConActivated( const QString& str ) { |
173 | delete m_con; | 171 | delete m_con; |
174 | m_con = m_fact->newConnectionPlugin( str, m_tabCon ); | 172 | m_con = m_fact->newConnectionPlugin( str, m_tabCon ); |
175 | 173 | ||
176 | if (m_con ) { | 174 | if ( m_con ) { |
177 | m_con->load( m_prof ); | 175 | m_con->load( m_prof ); |
178 | m_layCon->addWidget( m_con ); | 176 | m_layCon->addWidget( m_con ); |
177 | } else { | ||
178 | tabWidget->removePage( m_tabCon ); | ||
179 | } | 179 | } |
180 | } | 180 | } |
181 | /* | 181 | /* |
182 | * we need to switch the widget | 182 | * we need to switch the widget |
183 | */ | 183 | */ |
184 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { | 184 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { |
185 | delete m_term; | 185 | delete m_term; |
186 | m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); | 186 | m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); |
187 | 187 | ||
188 | if (m_term) { | 188 | if (m_term) { |
189 | m_term->load(m_prof ); | 189 | m_term->load(m_prof ); |
190 | m_layTerm->addWidget( m_term ); | 190 | m_layTerm->addWidget( m_term ); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index 3b67bb3..6fde839 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h | |||
@@ -1,51 +1,53 @@ | |||
1 | #ifndef PROFILE_EDITOR_DIALOG | 1 | #ifndef PROFILE_EDITOR_DIALOG |
2 | #define PROFILE_EDITOR_DIALOG | 2 | #define PROFILE_EDITOR_DIALOG |
3 | 3 | ||
4 | #include <qdialog.h> | 4 | #include <qdialog.h> |
5 | #include <opie/otabwidget.h> | ||
5 | 6 | ||
6 | #include "profile.h" | 7 | #include "profile.h" |
7 | 8 | ||
8 | class MetaFactory; | 9 | class MetaFactory; |
9 | class EditBase; | 10 | class EditBase; |
10 | class QTabWidget; | 11 | class QTabWidget; |
11 | class QHBoxLayout; | 12 | class QHBoxLayout; |
12 | class QLineEdit; | 13 | class QLineEdit; |
13 | class QComboBox; | 14 | class QComboBox; |
14 | class QLabel; | 15 | class QLabel; |
15 | class ProfileDialogWidget; | 16 | class ProfileDialogWidget; |
16 | 17 | ||
17 | class ProfileEditorDialog : public QDialog { | 18 | class ProfileEditorDialog : public QDialog { |
18 | Q_OBJECT | 19 | Q_OBJECT |
19 | public: | 20 | public: |
20 | ProfileEditorDialog(MetaFactory* fact, | 21 | ProfileEditorDialog(MetaFactory* fact, |
21 | const Profile& prof ); | 22 | const Profile& prof ); |
22 | ProfileEditorDialog(MetaFactory* fact ); | 23 | ProfileEditorDialog(MetaFactory* fact ); |
23 | ~ProfileEditorDialog(); | 24 | ~ProfileEditorDialog(); |
24 | Profile profile()const; | 25 | Profile profile()const; |
25 | 26 | ||
26 | 27 | ||
27 | 28 | ||
28 | public slots: | 29 | public slots: |
29 | void accept(); | 30 | void accept(); |
30 | 31 | ||
31 | private slots: | 32 | private slots: |
32 | void slotConActivated(const QString& ); | 33 | void slotConActivated(const QString& ); |
33 | void slotTermActivated( const QString& ); | 34 | void slotTermActivated( const QString& ); |
34 | private: | 35 | private: |
35 | void initUI(); | 36 | void initUI(); |
36 | QString profName()const; | 37 | QString profName()const; |
37 | QCString profType()const; | 38 | QCString profType()const; |
38 | 39 | ||
39 | MetaFactory* m_fact; | 40 | MetaFactory* m_fact; |
40 | QHBoxLayout* m_lay; | 41 | QHBoxLayout* m_lay; |
41 | Profile m_prof; | 42 | Profile m_prof; |
42 | 43 | ||
43 | QLineEdit *m_name; | 44 | QLineEdit *m_name; |
44 | QComboBox *m_conCmb, *m_termCmb; | 45 | QComboBox *m_conCmb, *m_termCmb; |
45 | 46 | ||
46 | QWidget *m_tabCon, *m_tabTerm; | 47 | QWidget *m_tabCon, *m_tabTerm; |
47 | ProfileDialogWidget* m_con, *m_term; | 48 | ProfileDialogWidget* m_con, *m_term; |
48 | QHBoxLayout *m_layCon, *m_layTerm; | 49 | QHBoxLayout *m_layCon, *m_layTerm; |
50 | OTabWidget *tabWidget; | ||
49 | }; | 51 | }; |
50 | 52 | ||
51 | #endif | 53 | #endif |
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp index d216c92..1e97a24 100644 --- a/noncore/apps/opie-console/serialconfigwidget.cpp +++ b/noncore/apps/opie-console/serialconfigwidget.cpp | |||
@@ -1,147 +1,147 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | 4 | ||
5 | #include "iolayerbase.h" | 5 | #include "iolayerbase.h" |
6 | #include "serialconfigwidget.h" | 6 | #include "serialconfigwidget.h" |
7 | 7 | ||
8 | namespace { | 8 | namespace { |
9 | void setCurrent( const QString& str, QComboBox* bo ) { | 9 | void setCurrent( const QString& str, QComboBox* bo ) { |
10 | uint b = bo->count(); | 10 | uint b = bo->count(); |
11 | for (uint i = 0; i < bo->count(); i++ ) { | 11 | for (uint i = 0; i < bo->count(); i++ ) { |
12 | if ( bo->text(i) == str ) { | 12 | if ( bo->text(i) == str ) { |
13 | bo->setCurrentItem( i ); | 13 | bo->setCurrentItem( i ); |
14 | return; | 14 | return; |
15 | } | 15 | } |
16 | } | 16 | } |
17 | bo->insertItem( str ); | 17 | bo->insertItem( str ); |
18 | bo->setCurrentItem( b ); | 18 | bo->setCurrentItem( b ); |
19 | } | 19 | } |
20 | 20 | ||
21 | 21 | ||
22 | } | 22 | } |
23 | 23 | ||
24 | SerialConfigWidget::SerialConfigWidget( const QString& name, | 24 | SerialConfigWidget::SerialConfigWidget( const QString& name, |
25 | QWidget* parent, | 25 | QWidget* parent, |
26 | const char* na ) | 26 | const char* na ) |
27 | : ProfileDialogConnectionWidget( name, parent, na ) { | 27 | : ProfileDialogConnectionWidget( name, parent, na ) { |
28 | 28 | ||
29 | m_lay = new QVBoxLayout(this ); | 29 | m_lay = new QVBoxLayout(this ); |
30 | m_device = new QLabel(tr("Device"), this ); | 30 | m_device = new QLabel(tr("Device"), this ); |
31 | m_deviceCmb = new QComboBox(this ); | 31 | m_deviceCmb = new QComboBox(this ); |
32 | m_deviceCmb->setEditable( TRUE ); | 32 | m_deviceCmb->setEditable( TRUE ); |
33 | 33 | ||
34 | m_base = new IOLayerBase(this, "base"); | 34 | m_base = new IOLayerBase(this, "base"); |
35 | 35 | ||
36 | m_lay->addWidget( m_device ); | 36 | m_lay->addWidget( m_device ); |
37 | m_lay->addWidget( m_deviceCmb ); | 37 | m_lay->addWidget( m_deviceCmb ); |
38 | m_lay->addWidget( m_base ); | 38 | m_lay->addWidget( m_base ); |
39 | 39 | ||
40 | m_deviceCmb->insertItem( "/dev/ttyS0" ); | 40 | m_deviceCmb->insertItem( "/dev/ttyS0" ); |
41 | m_deviceCmb->insertItem( "/dev/ttyS1" ); | 41 | m_deviceCmb->insertItem( "/dev/ttyS1" ); |
42 | m_deviceCmb->insertItem( "/dev/ttySA0"); | 42 | m_deviceCmb->insertItem( "/dev/ttySA0"); |
43 | m_deviceCmb->insertItem( "/dev/ttySA1"); | 43 | m_deviceCmb->insertItem( "/dev/ttySA1"); |
44 | 44 | ||
45 | } | 45 | } |
46 | SerialConfigWidget::~SerialConfigWidget() { | 46 | SerialConfigWidget::~SerialConfigWidget() { |
47 | 47 | ||
48 | } | 48 | } |
49 | void SerialConfigWidget::load( const Profile& prof ) { | 49 | void SerialConfigWidget::load( const Profile& prof ) { |
50 | int rad_flow = prof.readNumEntry("Flow"); | 50 | int rad_flow = prof.readNumEntry("Flow"); |
51 | int rad_parity = prof.readNumEntry("Parity"); | 51 | int rad_parity = prof.readNumEntry("Parity"); |
52 | int speed = prof.readNumEntry("Speed"); | 52 | int speed = prof.readNumEntry("Speed"); |
53 | 53 | ||
54 | if (rad_flow == 1) { | 54 | if (rad_flow == 1) { |
55 | m_base->setFlow( IOLayerBase::Hardware ); | 55 | m_base->setFlow( IOLayerBase::Hardware ); |
56 | } else if (rad_flow == 2) { | 56 | } else if (rad_flow == 2) { |
57 | m_base->setFlow( IOLayerBase::Software ); | 57 | m_base->setFlow( IOLayerBase::Software ); |
58 | } else { | 58 | } else { |
59 | m_base->setFlow( IOLayerBase::None ); | 59 | m_base->setFlow( IOLayerBase::None ); |
60 | } | 60 | } |
61 | 61 | ||
62 | if (rad_parity == 1) { | 62 | if (rad_parity == 1) { |
63 | m_base->setParity( IOLayerBase::Even ); | 63 | m_base->setParity( IOLayerBase::Even ); |
64 | } else if ( rad_parity == 2 ) { | 64 | } else if ( rad_parity == 2 ) { |
65 | m_base->setParity( IOLayerBase::Odd ); | 65 | m_base->setParity( IOLayerBase::Odd ); |
66 | } else { | 66 | } else { |
67 | m_base->setParity( IOLayerBase::NonePar ); | 67 | m_base->setParity( IOLayerBase::NonePar ); |
68 | } | 68 | } |
69 | 69 | ||
70 | switch( speed ) { | 70 | switch( speed ) { |
71 | case 115200: | 71 | case 115200: |
72 | m_base->setSpeed(IOLayerBase::Baud_115200 ); | 72 | m_base->setSpeed(IOLayerBase::Baud_115200 ); |
73 | break; | 73 | break; |
74 | case 57600: | 74 | case 57600: |
75 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | 75 | m_base->setSpeed( IOLayerBase::Baud_57600 ); |
76 | break; | 76 | break; |
77 | case 38400: | 77 | case 38400: |
78 | m_base->setSpeed(IOLayerBase::Baud_38400 ); | 78 | m_base->setSpeed(IOLayerBase::Baud_38400 ); |
79 | break; | 79 | break; |
80 | case 19200: | 80 | case 19200: |
81 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | 81 | m_base->setSpeed( IOLayerBase::Baud_19200 ); |
82 | break; | 82 | break; |
83 | case 9600: | 83 | case 9600: |
84 | default: | 84 | default: |
85 | m_base->setSpeed(IOLayerBase::Baud_9600 ); | 85 | m_base->setSpeed(IOLayerBase::Baud_9600 ); |
86 | break; | 86 | break; |
87 | } | 87 | } |
88 | 88 | ||
89 | if ( prof.readEntry("Device").isEmpty() ) return; | 89 | if ( prof.readEntry("Device").isEmpty() ) return; |
90 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); | 90 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); |
91 | 91 | ||
92 | } | 92 | } |
93 | /* | 93 | /* |
94 | * save speed, | 94 | * save speed, |
95 | * flow, | 95 | * flow, |
96 | * parity | 96 | * parity |
97 | */ | 97 | */ |
98 | void SerialConfigWidget::save( Profile& prof ) { | 98 | void SerialConfigWidget::save( Profile& prof ) { |
99 | int flow, parity, speed; | 99 | int flow, parity, speed; |
100 | prof.writeEntry("Device", m_deviceCmb->currentText() ); | 100 | prof.writeEntry("Device", m_deviceCmb->currentText() ); |
101 | 101 | ||
102 | switch( m_base->flow() ) { | 102 | switch( m_base->flow() ) { |
103 | case IOLayerBase::None: | 103 | case IOLayerBase::None: |
104 | flow = 0; | 104 | flow = 0; |
105 | break; | 105 | break; |
106 | case IOLayerBase::Software: | 106 | case IOLayerBase::Software: |
107 | flow = 2; | 107 | flow = 2; |
108 | break; | 108 | break; |
109 | case IOLayerBase::Hardware: | 109 | case IOLayerBase::Hardware: |
110 | flow = 1; | 110 | flow = 1; |
111 | break; | 111 | break; |
112 | } | 112 | } |
113 | 113 | ||
114 | switch( m_base->parity() ) { | 114 | switch( m_base->parity() ) { |
115 | case IOLayerBase::Odd: | 115 | case IOLayerBase::Odd: |
116 | parity = 2; | 116 | parity = 2; |
117 | break; | 117 | break; |
118 | case IOLayerBase::Even: | 118 | case IOLayerBase::Even: |
119 | parity = 1; | 119 | parity = 1; |
120 | break; | 120 | break; |
121 | case IOLayerBase::NonePar: | 121 | case IOLayerBase::NonePar: |
122 | parity = 0; | 122 | parity = 0; |
123 | break; | 123 | break; |
124 | } | 124 | } |
125 | 125 | ||
126 | switch( m_base->speed() ) { | 126 | switch( m_base->speed() ) { |
127 | case IOLayerBase::Baud_115200: | 127 | case IOLayerBase::Baud_115200: |
128 | speed = 115200; | 128 | speed = 115200; |
129 | break; | 129 | break; |
130 | case IOLayerBase::Baud_57600: | 130 | case IOLayerBase::Baud_57600: |
131 | speed = 57600; | 131 | speed = 57600; |
132 | break; | 132 | break; |
133 | case IOLayerBase::Baud_38400: | 133 | case IOLayerBase::Baud_38400: |
134 | speed = 38400; | 134 | speed = 38400; |
135 | break; | 135 | break; |
136 | case IOLayerBase::Baud_19200: | 136 | case IOLayerBase::Baud_19200: |
137 | speed = 19200; | 137 | speed = 19200; |
138 | break; | 138 | break; |
139 | case IOLayerBase::Baud_9600: | 139 | case IOLayerBase::Baud_9600: |
140 | speed = 9600; | 140 | speed = 9600; |
141 | break; | 141 | break; |
142 | } | 142 | } |
143 | 143 | ||
144 | prof.writeEntry("Flow", flow); | 144 | prof.writeEntry("Flow", flow); |
145 | prof.writeEntry("Parity", parity); | 145 | prof.writeEntry("Parity", parity); |
146 | prof.writeEntry("Speed", speed); | 146 | prof.writeEntry("Speed", speed); |
147 | } | 147 | } |