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 | |||
@@ -1,12 +1,13 @@ | |||
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 | #include <qbuttongroup.h> | 4 | #include <qbuttongroup.h> |
5 | #include <qhbuttongroup.h> | 5 | #include <qhbuttongroup.h> |
6 | #include <qradiobutton.h> | 6 | #include <qradiobutton.h> |
7 | #include <qhbox.h> | ||
7 | 8 | ||
8 | #include "iolayerbase.h" | 9 | #include "iolayerbase.h" |
9 | 10 | ||
10 | namespace { | 11 | namespace { |
11 | enum ParityIds { | 12 | enum ParityIds { |
12 | id_parity_none, | 13 | id_parity_none, |
@@ -25,50 +26,63 @@ namespace { | |||
25 | id_baud_57600, | 26 | id_baud_57600, |
26 | id_baud_38400, | 27 | id_baud_38400, |
27 | id_baud_19200, | 28 | id_baud_19200, |
28 | id_baud_9600 | 29 | id_baud_9600 |
29 | }; | 30 | }; |
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 | } |
32 | 46 | ||
33 | 47 | ||
34 | IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | 48 | IOLayerBase::IOLayerBase( QWidget* par, const char* name ) |
35 | : QWidget( par, name ) | 49 | : QWidget( par, name ) |
36 | { | 50 | { |
37 | m_speedLabel = new QLabel(tr("Speed"), this ); | 51 | m_speedLabel = new QLabel(tr("Speed"), this ); |
38 | m_speedBox = new QComboBox(this ); | 52 | m_speedBox = new QComboBox(this ); |
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 ); |
42 | m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); | 56 | m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); |
43 | m_flowNone = new QRadioButton( tr("None"), m_groupFlow ); | 57 | m_flowNone = new QRadioButton( tr("None"), m_groupFlow ); |
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 ); |
47 | m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); | 61 | m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); |
48 | m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); | 62 | m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); |
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 ); |
51 | m_lroot->add(m_speedLabel ); | 77 | m_lroot->add(m_speedLabel ); |
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); |
70 | 84 | ||
71 | // profiles | 85 | // profiles |
72 | m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); | 86 | m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); |
73 | m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); | 87 | m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); |
74 | m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); | 88 | m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); |
@@ -125,12 +139,47 @@ void IOLayerBase::setSpeed( Speed sp ) { | |||
125 | case Baud_9600: | 139 | case Baud_9600: |
126 | index = id_baud_9600; | 140 | index = id_baud_9600; |
127 | break; | 141 | break; |
128 | } | 142 | } |
129 | m_speedBox->setCurrentItem(index ); | 143 | m_speedBox->setCurrentItem(index ); |
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 { |
132 | if (m_flowHw->isChecked() ) { | 181 | if (m_flowHw->isChecked() ) { |
133 | return Hardware; | 182 | return Hardware; |
134 | }else if( m_flowSw->isChecked() ) { | 183 | }else if( m_flowSw->isChecked() ) { |
135 | return Software; | 184 | return Software; |
136 | } else { | 185 | } else { |
@@ -164,6 +213,27 @@ IOLayerBase::Speed IOLayerBase::speed()const{ | |||
164 | default: | 213 | default: |
165 | case id_baud_9600: | 214 | case id_baud_9600: |
166 | return Baud_9600; | 215 | return Baud_9600; |
167 | break; | 216 | break; |
168 | } | 217 | } |
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 | |||