-rw-r--r-- | noncore/apps/opie-console/iolayerbase.cpp | 102 | ||||
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.h | 11 | ||||
-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 62 | ||||
-rw-r--r-- | noncore/apps/opie-console/serialconfigwidget.cpp | 53 |
4 files changed, 204 insertions, 24 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 | |||
diff --git a/noncore/apps/opie-console/iolayerbase.h b/noncore/apps/opie-console/iolayerbase.h index 74de46a..e1b96df 100644 --- a/noncore/apps/opie-console/iolayerbase.h +++ b/noncore/apps/opie-console/iolayerbase.h | |||
@@ -24,2 +24,5 @@ public: | |||
24 | Baud_9600 }; | 24 | Baud_9600 }; |
25 | enum Data { Data_Five =5, Data_Six =6, Data_Seven=7, Data_Eight=8 }; | ||
26 | enum Stop { Stop_One =1, Stop_OnePointFive=15, Stop_Two=2 }; | ||
27 | |||
25 | IOLayerBase( QWidget* base, const char* name = 0l); | 28 | IOLayerBase( QWidget* base, const char* name = 0l); |
@@ -30,2 +33,4 @@ public: | |||
30 | void setSpeed( Speed speed ); | 33 | void setSpeed( Speed speed ); |
34 | void setData( Data data ); | ||
35 | void setStop( Stop stop ); | ||
31 | 36 | ||
@@ -34,2 +39,4 @@ public: | |||
34 | Speed speed()const; | 39 | Speed speed()const; |
40 | Data data()const; | ||
41 | Stop stop()const; | ||
35 | private: | 42 | private: |
@@ -38,3 +45,3 @@ private: | |||
38 | QComboBox* m_speedBox; | 45 | QComboBox* m_speedBox; |
39 | QButtonGroup* m_groupFlow; | 46 | QButtonGroup* m_groupFlow, *m_groupData, *m_groupStop ; |
40 | QRadioButton *m_flowHw, *m_flowSw, *m_flowNone; | 47 | QRadioButton *m_flowHw, *m_flowSw, *m_flowNone; |
@@ -43,2 +50,4 @@ private: | |||
43 | QRadioButton *m_parityOdd, *m_parityEven, *m_parityNone; | 50 | QRadioButton *m_parityOdd, *m_parityEven, *m_parityNone; |
51 | QRadioButton *m_data5, *m_data6, *m_data7, *m_data8; | ||
52 | QRadioButton *m_stop1, *m_stop15, *m_stop2; | ||
44 | QHBoxLayout* m_hbox; | 53 | QHBoxLayout* m_hbox; |
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index ec83b9f..ce44dab 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp | |||
@@ -36,4 +36,5 @@ ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, | |||
36 | telLabel->setText( tr( "Enter telefon number here:" ) ); | 36 | telLabel->setText( tr( "Enter telefon number here:" ) ); |
37 | m_telNumber = new QLineEdit( this ); | 37 | // m_telNumber = new QLineEdit( this ); |
38 | QHBox *buttonBox = new QHBox( this ); | 38 | QHBox *buttonBox = new QHBox( this ); |
39 | m_telNumber = new QLineEdit( buttonBox ); | ||
39 | QPushButton *atButton = new QPushButton( buttonBox ); | 40 | QPushButton *atButton = new QPushButton( buttonBox ); |
@@ -48,3 +49,2 @@ ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, | |||
48 | 49 | ||
49 | |||
50 | m_base = new IOLayerBase( this, "base" ); | 50 | m_base = new IOLayerBase( this, "base" ); |
@@ -54,5 +54,5 @@ ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, | |||
54 | m_lay->addWidget( telLabel ); | 54 | m_lay->addWidget( telLabel ); |
55 | m_lay->addWidget( m_telNumber ); | ||
56 | m_lay->addWidget( buttonBox ); | 55 | m_lay->addWidget( buttonBox ); |
57 | m_lay->addWidget( m_base ); | 56 | m_lay->addWidget( m_base ); |
57 | m_lay->addStretch( 0 ); | ||
58 | 58 | ||
@@ -73,2 +73,4 @@ void ModemConfigWidget::load( const Profile& prof ) { | |||
73 | int speed = prof.readNumEntry( "Speed" ); | 73 | int speed = prof.readNumEntry( "Speed" ); |
74 | int dbits = prof.readNumEntry("DataBits"); | ||
75 | int sbits = prof.readNumEntry("StopBits"); | ||
74 | QString number = prof.readEntry( "Number" ); | 76 | QString number = prof.readEntry( "Number" ); |
@@ -115,2 +117,23 @@ void ModemConfigWidget::load( const Profile& prof ) { | |||
115 | 117 | ||
118 | |||
119 | if ( dbits == 5) { | ||
120 | m_base->setData( IOLayerBase::Data_Five ); | ||
121 | } else if (rad_flow == 6) { | ||
122 | m_base->setData( IOLayerBase::Data_Six ); | ||
123 | } else if (rad_flow == 7) { | ||
124 | m_base->setData( IOLayerBase::Data_Seven ); | ||
125 | } else { | ||
126 | m_base->setData( IOLayerBase::Data_Eight ); | ||
127 | } | ||
128 | |||
129 | if ( sbits == 2) { | ||
130 | m_base->setStop( IOLayerBase::Stop_Two ); | ||
131 | } else if ( sbits == 15 ) { | ||
132 | m_base->setStop( IOLayerBase::Stop_OnePointFive ); | ||
133 | } else { | ||
134 | m_base->setStop( IOLayerBase::Stop_One ); | ||
135 | } | ||
136 | |||
137 | |||
138 | |||
116 | if ( prof.readEntry( "Device" ).isEmpty() ) { | 139 | if ( prof.readEntry( "Device" ).isEmpty() ) { |
@@ -129,4 +152,4 @@ void ModemConfigWidget::load( const Profile& prof ) { | |||
129 | void ModemConfigWidget::save( Profile& prof ) { | 152 | void ModemConfigWidget::save( Profile& prof ) { |
130 | int flow, parity, speed; | 153 | int flow, parity, speed, data, stop; |
131 | flow = parity = speed = 0; | 154 | flow = parity = speed = data = stop = 0; |
132 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); | 155 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); |
@@ -176,2 +199,29 @@ void ModemConfigWidget::save( Profile& prof ) { | |||
176 | 199 | ||
200 | switch( m_base->data() ) { | ||
201 | case IOLayerBase::Data_Five: | ||
202 | data = 5; | ||
203 | break; | ||
204 | case IOLayerBase::Data_Six: | ||
205 | data = 6; | ||
206 | break; | ||
207 | case IOLayerBase::Data_Seven: | ||
208 | data = 7; | ||
209 | break; | ||
210 | case IOLayerBase::Data_Eight: | ||
211 | data = 8; | ||
212 | break; | ||
213 | } | ||
214 | |||
215 | switch( m_base->stop() ) { | ||
216 | case IOLayerBase::Stop_One: | ||
217 | stop = 1; | ||
218 | break; | ||
219 | case IOLayerBase::Stop_OnePointFive: | ||
220 | stop = 15; | ||
221 | break; | ||
222 | case IOLayerBase::Stop_Two: | ||
223 | stop = 2; | ||
224 | break; | ||
225 | } | ||
226 | |||
177 | prof.writeEntry( "Flow", flow ); | 227 | prof.writeEntry( "Flow", flow ); |
@@ -179,2 +229,4 @@ void ModemConfigWidget::save( Profile& prof ) { | |||
179 | prof.writeEntry( "Speed", speed ); | 229 | prof.writeEntry( "Speed", speed ); |
230 | prof.writeEntry("DataBits", data); | ||
231 | prof.writeEntry("StopBits", stop); | ||
180 | prof.writeEntry( "Number", m_telNumber->text() ); | 232 | prof.writeEntry( "Number", m_telNumber->text() ); |
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp index 5c6d975..3edf723 100644 --- a/noncore/apps/opie-console/serialconfigwidget.cpp +++ b/noncore/apps/opie-console/serialconfigwidget.cpp | |||
@@ -52,2 +52,4 @@ void SerialConfigWidget::load( const Profile& prof ) { | |||
52 | int speed = prof.readNumEntry("Speed"); | 52 | int speed = prof.readNumEntry("Speed"); |
53 | int dbits = prof.readNumEntry("DataBits"); | ||
54 | int sbits = prof.readNumEntry("StopBits"); | ||
53 | 55 | ||
@@ -88,2 +90,20 @@ void SerialConfigWidget::load( const Profile& prof ) { | |||
88 | 90 | ||
91 | if ( dbits == 5) { | ||
92 | m_base->setData( IOLayerBase::Data_Five ); | ||
93 | } else if (rad_flow == 6) { | ||
94 | m_base->setData( IOLayerBase::Data_Six ); | ||
95 | } else if (rad_flow == 7) { | ||
96 | m_base->setData( IOLayerBase::Data_Seven ); | ||
97 | } else { | ||
98 | m_base->setData( IOLayerBase::Data_Eight ); | ||
99 | } | ||
100 | |||
101 | if ( sbits == 2) { | ||
102 | m_base->setStop( IOLayerBase::Stop_Two ); | ||
103 | } else if ( sbits == 15 ) { | ||
104 | m_base->setStop( IOLayerBase::Stop_OnePointFive ); | ||
105 | } else { | ||
106 | m_base->setStop( IOLayerBase::Stop_One ); | ||
107 | } | ||
108 | |||
89 | if ( prof.readEntry("Device").isEmpty() ) return; | 109 | if ( prof.readEntry("Device").isEmpty() ) return; |
@@ -98,4 +118,4 @@ void SerialConfigWidget::load( const Profile& prof ) { | |||
98 | void SerialConfigWidget::save( Profile& prof ) { | 118 | void SerialConfigWidget::save( Profile& prof ) { |
99 | int flow, parity, speed ; | 119 | int flow, parity, speed, data, stop; |
100 | flow = parity = speed = 0; | 120 | flow = parity = speed = data = stop = 0; |
101 | prof.writeEntry("Device", m_deviceCmb->currentText() ); | 121 | prof.writeEntry("Device", m_deviceCmb->currentText() ); |
@@ -145,2 +165,29 @@ void SerialConfigWidget::save( Profile& prof ) { | |||
145 | 165 | ||
166 | switch( m_base->data() ) { | ||
167 | case IOLayerBase::Data_Five: | ||
168 | data = 5; | ||
169 | break; | ||
170 | case IOLayerBase::Data_Six: | ||
171 | data = 6; | ||
172 | break; | ||
173 | case IOLayerBase::Data_Seven: | ||
174 | data = 7; | ||
175 | break; | ||
176 | case IOLayerBase::Data_Eight: | ||
177 | data = 8; | ||
178 | break; | ||
179 | } | ||
180 | |||
181 | switch( m_base->stop() ) { | ||
182 | case IOLayerBase::Stop_One: | ||
183 | stop = 1; | ||
184 | break; | ||
185 | case IOLayerBase::Stop_OnePointFive: | ||
186 | stop = 15; | ||
187 | break; | ||
188 | case IOLayerBase::Stop_Two: | ||
189 | stop = 2; | ||
190 | break; | ||
191 | } | ||
192 | |||
146 | prof.writeEntry("Flow", flow); | 193 | prof.writeEntry("Flow", flow); |
@@ -148,2 +195,4 @@ void SerialConfigWidget::save( Profile& prof ) { | |||
148 | prof.writeEntry("Speed", speed); | 195 | prof.writeEntry("Speed", speed); |
196 | prof.writeEntry("DataBits", data); | ||
197 | prof.writeEntry("StopBits", stop); | ||
149 | } | 198 | } |