Diffstat (limited to 'noncore/apps/opie-console/iolayerbase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp index 1e164fe..99b6cc1 100644 --- a/noncore/apps/opie-console/iolayerbase.cpp +++ b/noncore/apps/opie-console/iolayerbase.cpp | |||
@@ -14,49 +14,49 @@ namespace { | |||
14 | }; | 14 | }; |
15 | 15 | ||
16 | enum FlowIds { | 16 | enum FlowIds { |
17 | id_flow_hw, | 17 | id_flow_hw, |
18 | id_flow_sw | 18 | id_flow_sw |
19 | }; | 19 | }; |
20 | 20 | ||
21 | enum SpeedIds { | 21 | enum SpeedIds { |
22 | id_baud_115200, | 22 | id_baud_115200, |
23 | id_baud_57600, | 23 | id_baud_57600, |
24 | id_baud_38400, | 24 | id_baud_38400, |
25 | id_baud_19200, | 25 | id_baud_19200, |
26 | id_baud_9600 | 26 | id_baud_9600 |
27 | }; | 27 | }; |
28 | 28 | ||
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | ||
32 | IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | 32 | IOLayerBase::IOLayerBase( QWidget* par, const char* name ) |
33 | : QWidget( par, name ) | 33 | : QWidget( par, name ) |
34 | { | 34 | { |
35 | m_speedLabel = new QLabel(tr("Speed"), this ); | 35 | m_speedLabel = new QLabel(tr("Speed"), this ); |
36 | m_speedBox = new QComboBox(this ); | 36 | m_speedBox = new QComboBox(this ); |
37 | 37 | ||
38 | m_groupFlow = new QButtonGroup(tr("Flow control") ); | 38 | m_groupFlow = new QButtonGroup(tr("Flow control"),this ); |
39 | m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); | 39 | m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); |
40 | m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); | 40 | m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); |
41 | 41 | ||
42 | m_groupParity = new QButtonGroup(tr("Parity"), this ); | 42 | m_groupParity = new QButtonGroup(tr("Parity"), this ); |
43 | m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); | 43 | m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); |
44 | m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); | 44 | m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); |
45 | 45 | ||
46 | m_lroot = new QVBoxLayout(this ); | 46 | m_lroot = new QVBoxLayout(this ); |
47 | m_lroot->add(m_speedLabel ); | 47 | m_lroot->add(m_speedLabel ); |
48 | m_lroot->add(m_speedBox ); | 48 | m_lroot->add(m_speedBox ); |
49 | m_lroot->setStretchFactor(m_speedLabel, 1); | 49 | m_lroot->setStretchFactor(m_speedLabel, 1); |
50 | m_lroot->setStretchFactor(m_speedBox, 1 ); | 50 | m_lroot->setStretchFactor(m_speedBox, 1 ); |
51 | 51 | ||
52 | m_hbox = new QHBoxLayout(m_groupFlow, 2 ); | 52 | m_hbox = new QHBoxLayout(m_groupFlow, 2 ); |
53 | m_hbox->add(m_flowHw ); | 53 | m_hbox->add(m_flowHw ); |
54 | m_hbox->add(m_flowSw ); | 54 | m_hbox->add(m_flowSw ); |
55 | m_lroot->add(m_groupFlow ); | 55 | m_lroot->add(m_groupFlow ); |
56 | m_lroot->setStretchFactor(m_groupFlow, 2 ); | 56 | m_lroot->setStretchFactor(m_groupFlow, 2 ); |
57 | 57 | ||
58 | m_hboxPar = new QHBoxLayout( m_groupParity, 2 ); | 58 | m_hboxPar = new QHBoxLayout( m_groupParity, 2 ); |
59 | m_hboxPar->add(m_parityOdd ); | 59 | m_hboxPar->add(m_parityOdd ); |
60 | m_hboxPar->add(m_parityEven ); | 60 | m_hboxPar->add(m_parityEven ); |
61 | m_lroot->add(m_groupParity ); | 61 | m_lroot->add(m_groupParity ); |
62 | m_lroot->setStretchFactor(m_groupParity, 2 ); | 62 | m_lroot->setStretchFactor(m_groupParity, 2 ); |
@@ -92,32 +92,58 @@ void IOLayerBase::setParity( Parity par ) { | |||
92 | } | 92 | } |
93 | } | 93 | } |
94 | void IOLayerBase::setSpeed( Speed sp ) { | 94 | void IOLayerBase::setSpeed( Speed sp ) { |
95 | int index; | 95 | int index; |
96 | switch( sp ) { | 96 | switch( sp ) { |
97 | case Baud_115200: | 97 | case Baud_115200: |
98 | index = id_baud_115200; | 98 | index = id_baud_115200; |
99 | break; | 99 | break; |
100 | case Baud_57600: | 100 | case Baud_57600: |
101 | index = id_baud_57600; | 101 | index = id_baud_57600; |
102 | break; | 102 | break; |
103 | case Baud_38400: | 103 | case Baud_38400: |
104 | index = id_baud_38400; | 104 | index = id_baud_38400; |
105 | break; | 105 | break; |
106 | case Baud_19200: | 106 | case Baud_19200: |
107 | index = id_baud_19200; | 107 | index = id_baud_19200; |
108 | break; | 108 | break; |
109 | case Baud_9600: | 109 | case Baud_9600: |
110 | index = id_baud_9600; | 110 | index = id_baud_9600; |
111 | break; | 111 | break; |
112 | } | 112 | } |
113 | m_speedBox->setCurrentItem(index ); | 113 | m_speedBox->setCurrentItem(index ); |
114 | } | 114 | } |
115 | IOLayerBase::Flow IOLayerBase::flow()const { | 115 | IOLayerBase::Flow IOLayerBase::flow()const { |
116 | return Hardware; | 116 | if (m_flowHw->isChecked() ) { |
117 | qWarning("Hardware flow"); | ||
118 | return Hardware; | ||
119 | }else { | ||
120 | qWarning("Software"); | ||
121 | return Software; | ||
122 | } | ||
117 | } | 123 | } |
118 | IOLayerBase::Parity IOLayerBase::parity()const { | 124 | IOLayerBase::Parity IOLayerBase::parity()const { |
119 | return Odd; | 125 | if (m_parityOdd->isChecked() ) |
126 | return Odd; | ||
127 | else | ||
128 | return Even; | ||
129 | |||
120 | } | 130 | } |
121 | IOLayerBase::Speed IOLayerBase::speed()const{ | 131 | IOLayerBase::Speed IOLayerBase::speed()const{ |
122 | return Baud_9600; | 132 | switch( m_speedBox->currentItem() ) { |
133 | case id_baud_115200: | ||
134 | return Baud_115200; | ||
135 | break; | ||
136 | case id_baud_57600: | ||
137 | return Baud_57600; | ||
138 | break; | ||
139 | case id_baud_38400: | ||
140 | return Baud_38400; | ||
141 | break; | ||
142 | case id_baud_19200: | ||
143 | return Baud_19200; | ||
144 | break; | ||
145 | case id_baud_9600: | ||
146 | return Baud_9600; | ||
147 | break; | ||
148 | } | ||
123 | } | 149 | } |