author | harlekin <harlekin> | 2002-10-25 18:48:25 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-25 18:48:25 (UTC) |
commit | 4151cc12a6c37cbec4bb6883204703eec2fb8648 (patch) (unidiff) | |
tree | f7e81dc7de747628225ae4627c7cf3028183441a /noncore/apps/opie-console/iolayerbase.cpp | |
parent | e8c4383915db7ed6f47899945404247b1fd5c3c4 (diff) | |
download | opie-4151cc12a6c37cbec4bb6883204703eec2fb8648.zip opie-4151cc12a6c37cbec4bb6883204703eec2fb8648.tar.gz opie-4151cc12a6c37cbec4bb6883204703eec2fb8648.tar.bz2 |
added data bits and stop bits
Diffstat (limited to 'noncore/apps/opie-console/iolayerbase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.cpp | 102 |
1 files changed, 86 insertions, 16 deletions
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp index 47f9e76..ba7c86e 100644 --- a/noncore/apps/opie-console/iolayerbase.cpp +++ b/noncore/apps/opie-console/iolayerbase.cpp | |||
@@ -6,2 +6,3 @@ | |||
6 | #include <qradiobutton.h> | 6 | #include <qradiobutton.h> |
7 | #include <qhbox.h> | ||
7 | 8 | ||
@@ -30,2 +31,15 @@ namespace { | |||
30 | 31 | ||
32 | enum DataIds { | ||
33 | id_data_5, | ||
34 | id_data_6, | ||
35 | id_data_7, | ||
36 | id_data_8 | ||
37 | }; | ||
38 | |||
39 | enum StopIds { | ||
40 | id_stop_1, | ||
41 | id_stop_1_5, | ||
42 | id_stop_2 | ||
43 | }; | ||
44 | |||
31 | } | 45 | } |
@@ -39,3 +53,3 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | |||
39 | 53 | ||
40 | m_groupFlow = new QButtonGroup(tr("Flow control"),this ); | 54 | m_groupFlow = new QHButtonGroup(tr("Flow control"),this ); |
41 | m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); | 55 | m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); |
@@ -44,3 +58,3 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | |||
44 | 58 | ||
45 | m_groupParity = new QButtonGroup(tr("Parity"), this ); | 59 | m_groupParity = new QHButtonGroup(tr("Parity"), this ); |
46 | m_parityNone = new QRadioButton(tr("None"), m_groupParity ); | 60 | m_parityNone = new QRadioButton(tr("None"), m_groupParity ); |
@@ -49,2 +63,14 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | |||
49 | 63 | ||
64 | m_groupData = new QHButtonGroup(tr("Data Bits"), this); | ||
65 | m_data5 = new QRadioButton(tr("5"), m_groupData ); | ||
66 | m_data6 = new QRadioButton(tr("6"), m_groupData ); | ||
67 | m_data7 = new QRadioButton(tr("7"), m_groupData ); | ||
68 | m_data8 = new QRadioButton(tr("8"), m_groupData ); | ||
69 | |||
70 | m_groupStop = new QHButtonGroup(tr("Stop Bits"), this ); | ||
71 | m_stop1 = new QRadioButton(tr("1"), m_groupStop ); | ||
72 | m_stop15 = new QRadioButton(tr("1.5"), m_groupStop ); | ||
73 | m_stop2 = new QRadioButton(tr("2"), m_groupStop ); | ||
74 | |||
75 | |||
50 | m_lroot = new QVBoxLayout( this ); | 76 | m_lroot = new QVBoxLayout( this ); |
@@ -52,18 +78,6 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | |||
52 | m_lroot->add(m_speedBox ); | 78 | m_lroot->add(m_speedBox ); |
53 | m_lroot->setStretchFactor(m_speedLabel, 1); | ||
54 | m_lroot->setStretchFactor(m_speedBox, 1 ); | ||
55 | |||
56 | m_hbox = new QHBoxLayout(m_groupFlow, 2 ); | ||
57 | m_hbox->add(m_flowHw ); | ||
58 | m_hbox->add(m_flowSw ); | ||
59 | m_hbox->add(m_flowNone ); | ||
60 | m_lroot->add(m_groupFlow ); | 79 | m_lroot->add(m_groupFlow ); |
61 | m_lroot->setStretchFactor(m_groupFlow, 2 ); | ||
62 | |||
63 | m_hboxPar = new QHBoxLayout( m_groupParity, 2 ); | ||
64 | m_hboxPar->add(m_parityOdd ); | ||
65 | m_hboxPar->add(m_parityEven ); | ||
66 | m_hboxPar->add(m_parityNone ); | ||
67 | m_lroot->add(m_groupParity ); | 80 | m_lroot->add(m_groupParity ); |
68 | m_lroot->setStretchFactor(m_groupParity, 2 ); | 81 | m_lroot->add( m_groupData ); |
82 | m_lroot->add( m_groupStop ); | ||
69 | m_lroot->addStretch(2); | 83 | m_lroot->addStretch(2); |
@@ -130,2 +144,37 @@ void IOLayerBase::setSpeed( Speed sp ) { | |||
130 | } | 144 | } |
145 | |||
146 | void IOLayerBase::setData( Data data ) { | ||
147 | switch( data ) { | ||
148 | case Data_Five: | ||
149 | m_data5->setChecked( true ); | ||
150 | break; | ||
151 | case Data_Six: | ||
152 | m_data6->setChecked( true ); | ||
153 | break; | ||
154 | case Data_Seven: | ||
155 | m_data7->setChecked( true ); | ||
156 | break; | ||
157 | default: | ||
158 | m_data8->setChecked( true ); | ||
159 | break; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | |||
164 | void IOLayerBase::setStop( Stop stop ) { | ||
165 | switch( stop ) { | ||
166 | case Stop_Two: | ||
167 | m_stop2->setChecked( true ); | ||
168 | break; | ||
169 | case Stop_OnePointFive: | ||
170 | m_stop15->setChecked( true ); | ||
171 | break; | ||
172 | default: | ||
173 | m_stop1->setChecked( true ); | ||
174 | break; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | |||
179 | |||
131 | IOLayerBase::Flow IOLayerBase::flow()const { | 180 | IOLayerBase::Flow IOLayerBase::flow()const { |
@@ -169 +218,22 @@ IOLayerBase::Speed IOLayerBase::speed()const{ | |||
169 | } | 218 | } |
219 | IOLayerBase::Data IOLayerBase::data()const { | ||
220 | if ( m_data5->isChecked() ) { | ||
221 | return Data_Five; | ||
222 | } else if ( m_data6->isChecked() ) { | ||
223 | return Data_Six; | ||
224 | } else if ( m_data7->isChecked() ) { | ||
225 | return Data_Seven; | ||
226 | } else { | ||
227 | return Data_Eight; | ||
228 | } | ||
229 | } | ||
230 | IOLayerBase::Stop IOLayerBase::stop()const { | ||
231 | if ( m_stop2->isChecked() ) { | ||
232 | return Stop_Two; | ||
233 | } else if ( m_stop15->isChecked() ) { | ||
234 | return Stop_OnePointFive; | ||
235 | } else { | ||
236 | return Stop_One; | ||
237 | } | ||
238 | } | ||
239 | |||