summaryrefslogtreecommitdiff
path: root/noncore/apps
authorzecke <zecke>2002-10-08 23:13:17 (UTC)
committer zecke <zecke>2002-10-08 23:13:17 (UTC)
commit8c353ec8b86ee8f82cc25172fb69dd5fee65e848 (patch) (unidiff)
treea4549bcba962689edb9c40efcb23114cae5fcda2 /noncore/apps
parentca0c224318a50c6618691fb30f39aa1d9b0b8a4f (diff)
downloadopie-8c353ec8b86ee8f82cc25172fb69dd5fee65e848.zip
opie-8c353ec8b86ee8f82cc25172fb69dd5fee65e848.tar.gz
opie-8c353ec8b86ee8f82cc25172fb69dd5fee65e848.tar.bz2
default I dunno
IOLayerBase the return values for speed()/parity()/flow() added MainWindow debug code :( opie-console.pro addition of serialconfigwidget.* ProfileManager fix removing of Profiles quite rude way of doing it Configure stuff is done and roughly tested The migration is done! TO WAZLAF: you might want to adjust Parity stuff for your needs!
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/default.cpp5
-rw-r--r--noncore/apps/opie-console/iolayerbase.cpp34
-rw-r--r--noncore/apps/opie-console/iolayerbase.h4
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp1
-rw-r--r--noncore/apps/opie-console/opie-console.pro6
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp4
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp9
-rw-r--r--noncore/apps/opie-console/serialconfigwidget.cpp135
-rw-r--r--noncore/apps/opie-console/serialconfigwidget.h27
9 files changed, 212 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp
index 4ab4695..d9a0557 100644
--- a/noncore/apps/opie-console/default.cpp
+++ b/noncore/apps/opie-console/default.cpp
@@ -2,2 +2,3 @@
2#include "sz_transfer.h" 2#include "sz_transfer.h"
3#include "serialconfigwidget.h"
3#include "terminalwidget.h" 4#include "terminalwidget.h"
@@ -30,4 +31,4 @@ extern "C" {
30 // Connection Widgets 31 // Connection Widgets
31 ProfileDialogWidget* newSerialWidget(const QString& str, QWidget* ) { 32 ProfileDialogWidget* newSerialWidget(const QString& str, QWidget* wid) {
32 return 0l; 33 return new SerialConfigWidget(str, wid );
33 } 34 }
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
@@ -37,3 +37,3 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name )
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 );
@@ -115,9 +115,35 @@ void IOLayerBase::setSpeed( Speed sp ) {
115IOLayerBase::Flow IOLayerBase::flow()const { 115IOLayerBase::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}
118IOLayerBase::Parity IOLayerBase::parity()const { 124IOLayerBase::Parity IOLayerBase::parity()const {
119 return Odd; 125 if (m_parityOdd->isChecked() )
126 return Odd;
127 else
128 return Even;
129
120} 130}
121IOLayerBase::Speed IOLayerBase::speed()const{ 131IOLayerBase::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}
diff --git a/noncore/apps/opie-console/iolayerbase.h b/noncore/apps/opie-console/iolayerbase.h
index 7ef3f4d..151a04b 100644
--- a/noncore/apps/opie-console/iolayerbase.h
+++ b/noncore/apps/opie-console/iolayerbase.h
@@ -15,4 +15,4 @@ class IOLayerBase : public QWidget {
15public: 15public:
16 enum Flow { Software, Hardware }; 16 enum Flow { Hardware, Software };
17 enum Parity{ Odd, Even }; 17 enum Parity{ Odd =2 , Even =1 };
18 enum Speed{ Baud_115200, 18 enum Speed{ Baud_115200,
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index a414bdb..3531478 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -167,2 +167,3 @@ void MainWindow::slotConfigure() {
167 if ( QDialog::Accepted == ret ) { 167 if ( QDialog::Accepted == ret ) {
168 qWarning("conf %d", conf.list().count() );
168 manager()->setProfiles( conf.list() ); 169 manager()->setProfiles( conf.list() );
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index 9e25e8f..ea6d759 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -28,3 +28,4 @@ HEADERS = io_layer.h io_serial.h \
28 terminalwidget.h \ 28 terminalwidget.h \
29 iolayerbase.h 29 iolayerbase.h \
30 serialconfigwidget.h
30 31
@@ -53,3 +54,4 @@ SOURCES = io_layer.cpp io_serial.cpp \
53 terminalwidget.cpp \ 54 terminalwidget.cpp \
54 iolayerbase.cpp 55 iolayerbase.cpp \
56 serialconfigwidget.cpp
55 57
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index c5c6248..faf9c39 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -180,4 +180,6 @@ void ProfileEditorDialog::slotConActivated( const QString& str ) {
180 180
181 if (m_con ) 181 if (m_con ) {
182 m_con->load(m_prof );
182 m_layCon->addWidget( m_con ); 183 m_layCon->addWidget( m_con );
184 }
183} 185}
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index 6ad08b5..e66ebcc 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -1 +1,5 @@
1#include <stdio.h>
2#include <stdlib.h>
3
4#include <qfile.h>
1 5
@@ -32,2 +36,3 @@ void ProfileManager::load() {
32 prof.setTerminalName( conf.readEntry("term").utf8() ); 36 prof.setTerminalName( conf.readEntry("term").utf8() );
37 qWarning(" %s %s", conf.readEntry("iolayer").latin1(), prof.ioLayerName().data() );
33 prof.setBackground( conf.readNumEntry("back") ); 38 prof.setBackground( conf.readNumEntry("back") );
@@ -62,4 +67,4 @@ Session* ProfileManager::fromProfile( const Profile& prof) {
62void ProfileManager::save( ) { 67void ProfileManager::save( ) {
68 QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) );
63 ProfileConfig conf("opie-console-profiles"); 69 ProfileConfig conf("opie-console-profiles");
64 conf.clearAll();
65 Profile::ValueList::Iterator it; 70 Profile::ValueList::Iterator it;
@@ -68,3 +73,3 @@ void ProfileManager::save( ) {
68 conf.writeEntry( "name", (*it).name() ); 73 conf.writeEntry( "name", (*it).name() );
69 conf.writeEntry( "ioplayer", QString::fromUtf8( (*it).ioLayerName() ) ); 74 conf.writeEntry( "iolayer", QString::fromUtf8( (*it).ioLayerName() ) );
70 conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) ); 75 conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) );
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp
new file mode 100644
index 0000000..a427302
--- a/dev/null
+++ b/noncore/apps/opie-console/serialconfigwidget.cpp
@@ -0,0 +1,135 @@
1#include <qlabel.h>
2#include <qlayout.h>
3#include <qcombobox.h>
4
5#include "iolayerbase.h"
6#include "serialconfigwidget.h"
7
8namespace {
9 void setCurrent( const QString& str, QComboBox* bo ) {
10 uint b = bo->count();
11 for (uint i = 0; i < bo->count(); i++ ) {
12 if ( bo->text(i) == str ) {
13 bo->setCurrentItem( i );
14 return;
15 }
16 }
17 bo->insertItem( str );
18 bo->setCurrentItem( b );
19 }
20
21
22}
23
24SerialConfigWidget::SerialConfigWidget( const QString& name,
25 QWidget* parent,
26 const char* na )
27 : ProfileDialogConnectionWidget( name, parent, na ) {
28
29 m_lay = new QVBoxLayout(this );
30 m_device = new QLabel(tr("Device"), this );
31 m_deviceCmb = new QComboBox(this );
32 m_deviceCmb->setEditable( TRUE );
33
34 m_base = new IOLayerBase(this, "base");
35
36 m_lay->addWidget( m_device );
37 m_lay->addWidget( m_deviceCmb );
38 m_lay->addWidget( m_base );
39
40 m_deviceCmb->insertItem( "/dev/ttyS0" );
41 m_deviceCmb->insertItem( "/dev/ttyS1" );
42 m_deviceCmb->insertItem( "/dev/ttySA0");
43 m_deviceCmb->insertItem( "/dev/ttySA1");
44
45}
46SerialConfigWidget::~SerialConfigWidget() {
47
48}
49void SerialConfigWidget::load( const Profile& prof ) {
50 int rad_flow = prof.readNumEntry("Flow");
51 int rad_parity = prof.readNumEntry("Parity");
52 int speed = prof.readNumEntry("Speed");
53
54 if (rad_flow == 0)
55 m_base->setFlow( IOLayerBase::Hardware );
56 else
57 m_base->setFlow( IOLayerBase::Software );
58
59 if (rad_parity == 1)
60 m_base->setParity( IOLayerBase::Even );
61 else
62 m_base->setParity( IOLayerBase::Odd );
63
64 switch( speed ) {
65 case 115200:
66 m_base->setSpeed(IOLayerBase::Baud_115200 );
67 break;
68 case 57600:
69 m_base->setSpeed( IOLayerBase::Baud_57600 );
70 break;
71 case 38400:
72 m_base->setSpeed(IOLayerBase::Baud_38400 );
73 break;
74 case 19200:
75 m_base->setSpeed( IOLayerBase::Baud_19200 );
76 break;
77 case 9600:
78 default:
79 m_base->setSpeed(IOLayerBase::Baud_9600 );
80 break;
81 }
82
83 if ( prof.readEntry("Device").isEmpty() ) return;
84 setCurrent( prof.readEntry("Device"), m_deviceCmb );
85
86}
87/*
88 * save speed,
89 * flow,
90 * parity
91 */
92void SerialConfigWidget::save( Profile& prof ) {
93 int flow, parity, speed;
94 prof.writeEntry("Device", m_deviceCmb->currentText() );
95
96 switch( m_base->flow() ) {
97 case IOLayerBase::Software:
98 flow = 1;
99 break;
100 case IOLayerBase::Hardware:
101 flow = 0;
102 break;
103 }
104
105 switch( m_base->parity() ) {
106 case IOLayerBase::Odd:
107 parity = 2;
108 break;
109 case IOLayerBase::Even:
110 parity = 1;
111 break;
112 }
113
114 switch( m_base->speed() ) {
115 case IOLayerBase::Baud_115200:
116 speed = 115200;
117 break;
118 case IOLayerBase::Baud_57600:
119 speed = 57600;
120 break;
121 case IOLayerBase::Baud_38400:
122 speed = 38400;
123 break;
124 case IOLayerBase::Baud_19200:
125 speed = 19200;
126 break;
127 case IOLayerBase::Baud_9600:
128 speed = 9600;
129 break;
130 }
131
132 prof.writeEntry("Flow", flow);
133 prof.writeEntry("Parity", parity);
134 prof.writeEntry("Speed", speed);
135}
diff --git a/noncore/apps/opie-console/serialconfigwidget.h b/noncore/apps/opie-console/serialconfigwidget.h
new file mode 100644
index 0000000..8b5c8aa
--- a/dev/null
+++ b/noncore/apps/opie-console/serialconfigwidget.h
@@ -0,0 +1,27 @@
1#ifndef OPIE_SERIAL_CONFIG_WIDGET_H
2#define OPIE_SERIAL_CONFIG_WIDGET_H
3
4#include "profiledialogwidget.h"
5
6class QVBoxLayout;
7class QLabel;
8class QComboBox;
9class IOLayerBase;
10class SerialConfigWidget : public ProfileDialogConnectionWidget {
11 Q_OBJECT
12public:
13 SerialConfigWidget( const QString& name, QWidget* parent, const char* name = 0l );
14 ~SerialConfigWidget();
15
16 void load( const Profile& );
17 void save( Profile& );
18private:
19 QVBoxLayout* m_lay;
20 QLabel* m_device;
21 QComboBox* m_deviceCmb;
22 IOLayerBase* m_base;
23
24};
25
26
27#endif