summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/iolayerbase.cpp102
-rw-r--r--noncore/apps/opie-console/iolayerbase.h11
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp62
-rw-r--r--noncore/apps/opie-console/serialconfigwidget.cpp53
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
@@ -4,6 +4,7 @@
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
@@ -28,6 +29,19 @@ namespace {
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
@@ -37,35 +51,35 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name )
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
@@ -128,6 +142,41 @@ void IOLayerBase::setSpeed( Speed sp ) {
128 } 142 }
129 m_speedBox->setCurrentItem(index ); 143 m_speedBox->setCurrentItem(index );
130} 144}
145
146void 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
164void 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
131IOLayerBase::Flow IOLayerBase::flow()const { 180IOLayerBase::Flow IOLayerBase::flow()const {
132 if (m_flowHw->isChecked() ) { 181 if (m_flowHw->isChecked() ) {
133 return Hardware; 182 return Hardware;
@@ -167,3 +216,24 @@ IOLayerBase::Speed IOLayerBase::speed()const{
167 break; 216 break;
168 } 217 }
169} 218}
219IOLayerBase::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}
230IOLayerBase::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
@@ -22,25 +22,34 @@ public:
22 Baud_38400, 22 Baud_38400,
23 Baud_19200, 23 Baud_19200,
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);
26 ~IOLayerBase(); 29 ~IOLayerBase();
27 30
28 void setFlow( Flow flo ); 31 void setFlow( Flow flo );
29 void setParity( Parity par ); 32 void setParity( Parity par );
30 void setSpeed( Speed speed ); 33 void setSpeed( Speed speed );
34 void setData( Data data );
35 void setStop( Stop stop );
31 36
32 Flow flow()const; 37 Flow flow()const;
33 Parity parity()const; 38 Parity parity()const;
34 Speed speed()const; 39 Speed speed()const;
40 Data data()const;
41 Stop stop()const;
35private: 42private:
36 QVBoxLayout* m_lroot; 43 QVBoxLayout* m_lroot;
37 QLabel* m_speedLabel; 44 QLabel* m_speedLabel;
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;
41 48
42 QButtonGroup* m_groupParity; 49 QButtonGroup* m_groupParity;
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;
45 QHBoxLayout* m_hboxPar; 54 QHBoxLayout* m_hboxPar;
46}; 55};
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
@@ -34,8 +34,9 @@ ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent,
34 34
35 QLabel* telLabel = new QLabel( this ); 35 QLabel* telLabel = new QLabel( this );
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 );
40 atButton->setText( tr( "AT commands" ) ); 41 atButton->setText( tr( "AT commands" ) );
41 // disabled for now 42 // disabled for now
@@ -46,15 +47,14 @@ ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent,
46 dialButton->setText( tr( "Enter number" ) ); 47 dialButton->setText( tr( "Enter number" ) );
47 connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); 48 connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) );
48 49
49
50 m_base = new IOLayerBase( this, "base" ); 50 m_base = new IOLayerBase( this, "base" );
51 51
52 m_lay->addWidget( m_device ); 52 m_lay->addWidget( m_device );
53 m_lay->addWidget( m_deviceCmb ); 53 m_lay->addWidget( m_deviceCmb );
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
59 m_deviceCmb->insertItem( "/dev/ttyS0" ); 59 m_deviceCmb->insertItem( "/dev/ttyS0" );
60 m_deviceCmb->insertItem( "/dev/ttyS1" ); 60 m_deviceCmb->insertItem( "/dev/ttyS1" );
@@ -71,6 +71,8 @@ void ModemConfigWidget::load( const Profile& prof ) {
71 int rad_flow = prof.readNumEntry( "Flow" ); 71 int rad_flow = prof.readNumEntry( "Flow" );
72 int rad_parity = prof.readNumEntry( "Parity" ); 72 int rad_parity = prof.readNumEntry( "Parity" );
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" );
75 77
76 if ( !number.isEmpty() ) { 78 if ( !number.isEmpty() ) {
@@ -113,6 +115,27 @@ void ModemConfigWidget::load( const Profile& prof ) {
113 break; 115 break;
114 } 116 }
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() ) {
117 return; 140 return;
118 } 141 }
@@ -127,8 +150,8 @@ void ModemConfigWidget::load( const Profile& prof ) {
127 * parity 150 * parity
128 */ 151 */
129void ModemConfigWidget::save( Profile& prof ) { 152void 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() );
133 156
134 157
@@ -174,9 +197,38 @@ void ModemConfigWidget::save( Profile& prof ) {
174 break; 197 break;
175 } 198 }
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 );
178 prof.writeEntry( "Parity", parity ); 228 prof.writeEntry( "Parity", parity );
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() );
181 233
182 234
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
@@ -50,6 +50,8 @@ 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 int dbits = prof.readNumEntry("DataBits");
54 int sbits = prof.readNumEntry("StopBits");
53 55
54 if (rad_flow == 1) { 56 if (rad_flow == 1) {
55 m_base->setFlow( IOLayerBase::Hardware ); 57 m_base->setFlow( IOLayerBase::Hardware );
@@ -86,6 +88,24 @@ void SerialConfigWidget::load( const Profile& prof ) {
86 break; 88 break;
87 } 89 }
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;
90 setCurrent( prof.readEntry("Device"), m_deviceCmb ); 110 setCurrent( prof.readEntry("Device"), m_deviceCmb );
91 111
@@ -96,8 +116,8 @@ void SerialConfigWidget::load( const Profile& prof ) {
96 * parity 116 * parity
97 */ 117 */
98void SerialConfigWidget::save( Profile& prof ) { 118void 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() );
102 122
103 switch( m_base->flow() ) { 123 switch( m_base->flow() ) {
@@ -143,7 +163,36 @@ void SerialConfigWidget::save( Profile& prof ) {
143 break; 163 break;
144 } 164 }
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);
147 prof.writeEntry("Parity", parity); 194 prof.writeEntry("Parity", parity);
148 prof.writeEntry("Speed", speed); 195 prof.writeEntry("Speed", speed);
196 prof.writeEntry("DataBits", data);
197 prof.writeEntry("StopBits", stop);
149} 198}