-rw-r--r-- | noncore/apps/opie-console/btconfigwidget.cpp | 140 | ||||
-rw-r--r-- | noncore/apps/opie-console/btconfigwidget.h | 29 | ||||
-rw-r--r-- | noncore/apps/opie-console/default.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_irda.cpp | 60 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_irda.h | 46 | ||||
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.cpp | 16 | ||||
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/irdaconfigwidget.cpp | 141 | ||||
-rw-r--r-- | noncore/apps/opie-console/irdaconfigwidget.h | 29 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 9 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditorplugins.cpp | 21 | ||||
-rw-r--r-- | noncore/apps/opie-console/serialconfigwidget.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-console/widget_layer.h | 4 |
14 files changed, 498 insertions, 31 deletions
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp new file mode 100644 index 0000000..acc4811 --- a/dev/null +++ b/noncore/apps/opie-console/btconfigwidget.cpp | |||
@@ -0,0 +1,140 @@ | |||
1 | #include <qlabel.h> | ||
2 | #include <qlayout.h> | ||
3 | #include <qcombobox.h> | ||
4 | |||
5 | #include "iolayerbase.h" | ||
6 | #include "btconfigwidget.h" | ||
7 | |||
8 | namespace { | ||
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 | BTConfigWidget::BTConfigWidget( const QString& name, | ||
23 | QWidget* parent, | ||
24 | const char* na ) | ||
25 | : ProfileDialogConnectionWidget( name, parent, na ) { | ||
26 | |||
27 | m_lay = new QVBoxLayout(this ); | ||
28 | m_device = new QLabel(tr("Device"), this ); | ||
29 | m_deviceCmb = new QComboBox(this ); | ||
30 | m_deviceCmb->setEditable( TRUE ); | ||
31 | |||
32 | m_base = new IOLayerBase(this, "base"); | ||
33 | |||
34 | m_lay->addWidget( m_device ); | ||
35 | m_lay->addWidget( m_deviceCmb ); | ||
36 | m_lay->addWidget( m_base ); | ||
37 | |||
38 | m_deviceCmb->insertItem( "/dev/ttyU0" ); | ||
39 | m_deviceCmb->insertItem( "/dev/ttyU1" ); | ||
40 | } | ||
41 | |||
42 | BTConfigWidget::~BTConfigWidget() { | ||
43 | |||
44 | } | ||
45 | void BTConfigWidget::load( const Profile& prof ) { | ||
46 | int rad_flow = prof.readNumEntry("Flow"); | ||
47 | int rad_parity = prof.readNumEntry("Parity"); | ||
48 | int speed = prof.readNumEntry("Speed"); | ||
49 | |||
50 | |||
51 | if (rad_flow == 1) { | ||
52 | m_base->setFlow( IOLayerBase::Hardware ); | ||
53 | } else if (rad_flow == 2) { | ||
54 | m_base->setFlow( IOLayerBase::Software ); | ||
55 | } else if (rad_flow == 0) { | ||
56 | m_base->setFlow( IOLayerBase::None ); | ||
57 | } | ||
58 | |||
59 | if (rad_parity == 1) { | ||
60 | m_base->setParity( IOLayerBase::Even ); | ||
61 | } else { | ||
62 | m_base->setParity( IOLayerBase::Odd ); | ||
63 | } | ||
64 | |||
65 | switch( speed ) { | ||
66 | case 115200: | ||
67 | m_base->setSpeed(IOLayerBase::Baud_115200 ); | ||
68 | break; | ||
69 | case 57600: | ||
70 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | ||
71 | break; | ||
72 | case 38400: | ||
73 | m_base->setSpeed(IOLayerBase::Baud_38400 ); | ||
74 | break; | ||
75 | case 19200: | ||
76 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | ||
77 | break; | ||
78 | case 9600: | ||
79 | default: | ||
80 | m_base->setSpeed(IOLayerBase::Baud_9600 ); | ||
81 | break; | ||
82 | } | ||
83 | |||
84 | if ( prof.readEntry("Device").isEmpty() ) return; | ||
85 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); | ||
86 | |||
87 | } | ||
88 | /* | ||
89 | * save speed, | ||
90 | * flow, | ||
91 | * parity | ||
92 | */ | ||
93 | void BTConfigWidget::save( Profile& prof ) { | ||
94 | int flow, parity, speed; | ||
95 | prof.writeEntry("Device", m_deviceCmb->currentText() ); | ||
96 | |||
97 | |||
98 | switch( m_base->flow() ) { | ||
99 | case IOLayerBase::None: | ||
100 | flow = 0; | ||
101 | break; | ||
102 | case IOLayerBase::Software: | ||
103 | flow = 2; | ||
104 | break; | ||
105 | case IOLayerBase::Hardware: | ||
106 | flow = 1; | ||
107 | break; | ||
108 | } | ||
109 | |||
110 | switch( m_base->parity() ) { | ||
111 | case IOLayerBase::Odd: | ||
112 | parity = 2; | ||
113 | break; | ||
114 | case IOLayerBase::Even: | ||
115 | parity = 1; | ||
116 | break; | ||
117 | } | ||
118 | |||
119 | switch( m_base->speed() ) { | ||
120 | case IOLayerBase::Baud_115200: | ||
121 | speed = 115200; | ||
122 | break; | ||
123 | case IOLayerBase::Baud_57600: | ||
124 | speed = 57600; | ||
125 | break; | ||
126 | case IOLayerBase::Baud_38400: | ||
127 | speed = 38400; | ||
128 | break; | ||
129 | case IOLayerBase::Baud_19200: | ||
130 | speed = 19200; | ||
131 | break; | ||
132 | case IOLayerBase::Baud_9600: | ||
133 | speed = 9600; | ||
134 | break; | ||
135 | } | ||
136 | |||
137 | prof.writeEntry("Flow", flow); | ||
138 | prof.writeEntry("Parity", parity); | ||
139 | prof.writeEntry("Speed", speed); | ||
140 | } | ||
diff --git a/noncore/apps/opie-console/btconfigwidget.h b/noncore/apps/opie-console/btconfigwidget.h new file mode 100644 index 0000000..64190ad --- a/dev/null +++ b/noncore/apps/opie-console/btconfigwidget.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef OPIE_BT_CONFIG_WIDGET_H | ||
2 | #define OPIE_BT_CONFIG_WIDGET_H | ||
3 | |||
4 | #include "profiledialogwidget.h" | ||
5 | |||
6 | class QVBoxLayout; | ||
7 | class QLabel; | ||
8 | class QComboBox; | ||
9 | class IOLayerBase; | ||
10 | class BTConfigWidget : public ProfileDialogConnectionWidget { | ||
11 | |||
12 | Q_OBJECT | ||
13 | |||
14 | public: | ||
15 | BTConfigWidget( const QString& name, QWidget* parent, const char* name = 0l ); | ||
16 | ~BTConfigWidget(); | ||
17 | |||
18 | void load( const Profile& ); | ||
19 | void save( Profile& ); | ||
20 | private: | ||
21 | QVBoxLayout* m_lay; | ||
22 | QLabel* m_device; | ||
23 | QComboBox* m_deviceCmb; | ||
24 | IOLayerBase* m_base; | ||
25 | |||
26 | }; | ||
27 | |||
28 | |||
29 | #endif | ||
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp index da6f3e2..62f02f5 100644 --- a/noncore/apps/opie-console/default.cpp +++ b/noncore/apps/opie-console/default.cpp | |||
@@ -1,6 +1,8 @@ | |||
1 | #include "io_serial.h" | 1 | #include "io_serial.h" |
2 | #include "sz_transfer.h" | 2 | #include "sz_transfer.h" |
3 | #include "serialconfigwidget.h" | 3 | #include "serialconfigwidget.h" |
4 | #include "irdaconfigwidget.h" | ||
5 | #include "btconfigwidget.h" | ||
4 | #include "terminalwidget.h" | 6 | #include "terminalwidget.h" |
5 | #include "vt102emulation.h" | 7 | #include "vt102emulation.h" |
6 | 8 | ||
@@ -30,14 +32,14 @@ extern "C" { | |||
30 | } | 32 | } |
31 | 33 | ||
32 | // Connection Widgets | 34 | // Connection Widgets |
33 | ProfileDialogWidget* newSerialWidget(const QString& str, QWidget* wid) { | 35 | ProfileDialogWidget* newSerialWidget( const QString& str, QWidget* wid ) { |
34 | return new SerialConfigWidget(str, wid ); | 36 | return new SerialConfigWidget( str, wid ); |
35 | } | 37 | } |
36 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid) { | 38 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid ) { |
37 | return newSerialWidget(str, wid); | 39 | return new IrdaConfigWidget( str, wid ); |
38 | } | 40 | } |
39 | ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid) { | 41 | ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid ) { |
40 | return newSerialWidget(str, wid ); | 42 | return new BTConfigWidget(str, wid ); |
41 | } | 43 | } |
42 | 44 | ||
43 | // Terminal Widget(s) | 45 | // Terminal Widget(s) |
diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp new file mode 100644 index 0000000..8e31e82 --- a/dev/null +++ b/noncore/apps/opie-console/io_irda.cpp | |||
@@ -0,0 +1,60 @@ | |||
1 | |||
2 | #include "io_irda.h" | ||
3 | |||
4 | IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { | ||
5 | m_attach = 0; | ||
6 | } | ||
7 | |||
8 | |||
9 | IOIrda::~IOIrda() { | ||
10 | if ( m_attach ) { | ||
11 | delete m_attach; | ||
12 | } | ||
13 | } | ||
14 | |||
15 | |||
16 | void IOIrda::close() { | ||
17 | |||
18 | IOSerial::close(); | ||
19 | // still need error handling | ||
20 | delete m_attach; | ||
21 | } | ||
22 | |||
23 | bool IOIrda::open() { | ||
24 | |||
25 | // irdaattach here | ||
26 | m_attach = new OProcess(); | ||
27 | *m_attach << "irattach /dev/ttyS2 -s"; | ||
28 | |||
29 | connect( m_attach, SIGNAL( processExited( OProcess* ) ), | ||
30 | this, SLOT( slotExited( OProcess* ) ) ); | ||
31 | |||
32 | if ( m_attach->start() ) { | ||
33 | IOSerial::open(); | ||
34 | } else { | ||
35 | qWarning("could not attach to device"); | ||
36 | delete m_attach; | ||
37 | } | ||
38 | } | ||
39 | |||
40 | void IOIrda::reload( const Profile &config ) { | ||
41 | m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); | ||
42 | m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); | ||
43 | m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); | ||
44 | m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); | ||
45 | m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); | ||
46 | m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); | ||
47 | } | ||
48 | |||
49 | |||
50 | QString IOIrda::identifier() const { | ||
51 | return "irda"; | ||
52 | } | ||
53 | |||
54 | QString IOIrda::name() const { | ||
55 | return "Irda IO Layer"; | ||
56 | } | ||
57 | |||
58 | void IOIrda::slotExited(OProcess* proc ){ | ||
59 | close(); | ||
60 | } | ||
diff --git a/noncore/apps/opie-console/io_irda.h b/noncore/apps/opie-console/io_irda.h new file mode 100644 index 0000000..3aee951 --- a/dev/null +++ b/noncore/apps/opie-console/io_irda.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef OPIE_IO_IRDA | ||
2 | #define OPIE_IO_IRDA | ||
3 | |||
4 | #include <opie/oprocess.h> | ||
5 | #include "io_serial.h" | ||
6 | |||
7 | /* Default values to be used if the profile information is incomplete */ | ||
8 | #define IRDA_DEFAULT_DEVICE "/dev/ircomm0" | ||
9 | #define IRDA_DEFAULT_BAUD 9600 | ||
10 | #define IRDA_DEFAULT_PARITY 0 | ||
11 | #define IRDA_DEFAULT_DBITS 8 | ||
12 | #define IRDA_DEFAULT_SBITS 1 | ||
13 | #define IRDA_DEFAULT_FLOW 0 | ||
14 | |||
15 | /* IOSerial implements a RS232 IO Layer */ | ||
16 | |||
17 | class IOIrda : public IOSerial { | ||
18 | |||
19 | Q_OBJECT | ||
20 | |||
21 | public: | ||
22 | |||
23 | IOIrda(const Profile &); | ||
24 | ~IOIrda(); | ||
25 | |||
26 | QString identifier() const; | ||
27 | QString name() const; | ||
28 | |||
29 | signals: | ||
30 | void received(const QByteArray &); | ||
31 | void error(int, const QString &); | ||
32 | |||
33 | public slots: | ||
34 | bool open(); | ||
35 | void close(); | ||
36 | void reload(const Profile &); | ||
37 | |||
38 | private: | ||
39 | OProcess *m_attach; | ||
40 | |||
41 | private slots: | ||
42 | void slotExited(OProcess* proc); | ||
43 | |||
44 | }; | ||
45 | |||
46 | #endif /* OPIE_IO_IRDA */ | ||
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp index 99b6cc1..ec88b49 100644 --- a/noncore/apps/opie-console/iolayerbase.cpp +++ b/noncore/apps/opie-console/iolayerbase.cpp | |||
@@ -15,7 +15,8 @@ namespace { | |||
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 | id_flow_none, | ||
19 | }; | 20 | }; |
20 | 21 | ||
21 | enum SpeedIds { | 22 | enum SpeedIds { |
@@ -38,12 +39,13 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | |||
38 | m_groupFlow = new QButtonGroup(tr("Flow control"),this ); | 39 | m_groupFlow = new QButtonGroup(tr("Flow control"),this ); |
39 | m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); | 40 | m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); |
40 | m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); | 41 | m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); |
42 | m_flowNone = new QRadioButton( tr("None"), m_groupFlow ); | ||
41 | 43 | ||
42 | m_groupParity = new QButtonGroup(tr("Parity"), this ); | 44 | m_groupParity = new QButtonGroup(tr("Parity"), this ); |
43 | m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); | 45 | m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); |
44 | m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); | 46 | m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); |
45 | 47 | ||
46 | m_lroot = new QVBoxLayout(this ); | 48 | m_lroot = new QVBoxLayout( this ); |
47 | m_lroot->add(m_speedLabel ); | 49 | m_lroot->add(m_speedLabel ); |
48 | m_lroot->add(m_speedBox ); | 50 | m_lroot->add(m_speedBox ); |
49 | m_lroot->setStretchFactor(m_speedLabel, 1); | 51 | m_lroot->setStretchFactor(m_speedLabel, 1); |
@@ -52,6 +54,7 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | |||
52 | m_hbox = new QHBoxLayout(m_groupFlow, 2 ); | 54 | m_hbox = new QHBoxLayout(m_groupFlow, 2 ); |
53 | m_hbox->add(m_flowHw ); | 55 | m_hbox->add(m_flowHw ); |
54 | m_hbox->add(m_flowSw ); | 56 | m_hbox->add(m_flowSw ); |
57 | m_hbox->add(m_flowNone ); | ||
55 | m_lroot->add(m_groupFlow ); | 58 | m_lroot->add(m_groupFlow ); |
56 | m_lroot->setStretchFactor(m_groupFlow, 2 ); | 59 | m_lroot->setStretchFactor(m_groupFlow, 2 ); |
57 | 60 | ||
@@ -79,8 +82,12 @@ void IOLayerBase::setFlow( Flow flo ) { | |||
79 | case Hardware: | 82 | case Hardware: |
80 | m_flowHw->setChecked( true ); | 83 | m_flowHw->setChecked( true ); |
81 | break; | 84 | break; |
85 | case None: | ||
86 | m_flowNone->setChecked( true ); | ||
87 | break; | ||
82 | } | 88 | } |
83 | } | 89 | } |
90 | |||
84 | void IOLayerBase::setParity( Parity par ) { | 91 | void IOLayerBase::setParity( Parity par ) { |
85 | switch( par ) { | 92 | switch( par ) { |
86 | case Odd: | 93 | case Odd: |
@@ -116,9 +123,12 @@ IOLayerBase::Flow IOLayerBase::flow()const { | |||
116 | if (m_flowHw->isChecked() ) { | 123 | if (m_flowHw->isChecked() ) { |
117 | qWarning("Hardware flow"); | 124 | qWarning("Hardware flow"); |
118 | return Hardware; | 125 | return Hardware; |
119 | }else { | 126 | }else if( m_flowSw->isChecked() ) { |
120 | qWarning("Software"); | 127 | qWarning("Software"); |
121 | return Software; | 128 | return Software; |
129 | } else { | ||
130 | qWarning("None"); | ||
131 | return None; | ||
122 | } | 132 | } |
123 | } | 133 | } |
124 | IOLayerBase::Parity IOLayerBase::parity()const { | 134 | IOLayerBase::Parity IOLayerBase::parity()const { |
diff --git a/noncore/apps/opie-console/iolayerbase.h b/noncore/apps/opie-console/iolayerbase.h index 151a04b..d14f334 100644 --- a/noncore/apps/opie-console/iolayerbase.h +++ b/noncore/apps/opie-console/iolayerbase.h | |||
@@ -13,7 +13,7 @@ class QHBoxLayout; | |||
13 | class IOLayerBase : public QWidget { | 13 | class IOLayerBase : public QWidget { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | public: | 15 | public: |
16 | enum Flow { Hardware, Software }; | 16 | enum Flow { Hardware, Software, None }; |
17 | enum Parity{ Odd =2 , Even =1 }; | 17 | enum Parity{ Odd =2 , Even =1 }; |
18 | enum Speed{ Baud_115200, | 18 | enum Speed{ Baud_115200, |
19 | Baud_57600, | 19 | Baud_57600, |
@@ -35,7 +35,7 @@ private: | |||
35 | QLabel* m_speedLabel; | 35 | QLabel* m_speedLabel; |
36 | QComboBox* m_speedBox; | 36 | QComboBox* m_speedBox; |
37 | QButtonGroup* m_groupFlow; | 37 | QButtonGroup* m_groupFlow; |
38 | QRadioButton *m_flowHw, *m_flowSw; | 38 | QRadioButton *m_flowHw, *m_flowSw, *m_flowNone; |
39 | 39 | ||
40 | QButtonGroup* m_groupParity; | 40 | QButtonGroup* m_groupParity; |
41 | QRadioButton *m_parityOdd, *m_parityEven; | 41 | QRadioButton *m_parityOdd, *m_parityEven; |
diff --git a/noncore/apps/opie-console/irdaconfigwidget.cpp b/noncore/apps/opie-console/irdaconfigwidget.cpp new file mode 100644 index 0000000..1cc041b --- a/dev/null +++ b/noncore/apps/opie-console/irdaconfigwidget.cpp | |||
@@ -0,0 +1,141 @@ | |||
1 | #include <qlabel.h> | ||
2 | #include <qlayout.h> | ||
3 | #include <qcombobox.h> | ||
4 | |||
5 | #include "iolayerbase.h" | ||
6 | #include "irdaconfigwidget.h" | ||
7 | |||
8 | namespace { | ||
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 | |||
24 | IrdaConfigWidget::IrdaConfigWidget( 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/ircomm0" ); | ||
41 | m_deviceCmb->insertItem( "/dev/ircomm1" ); | ||
42 | } | ||
43 | |||
44 | IrdaConfigWidget::~IrdaConfigWidget() { | ||
45 | |||
46 | } | ||
47 | void IrdaConfigWidget::load( const Profile& prof ) { | ||
48 | int rad_flow = prof.readNumEntry("Flow"); | ||
49 | int rad_parity = prof.readNumEntry("Parity"); | ||
50 | int speed = prof.readNumEntry("Speed"); | ||
51 | |||
52 | if (rad_flow == 1) { | ||
53 | m_base->setFlow( IOLayerBase::Hardware ); | ||
54 | } else if (rad_flow == 2) { | ||
55 | m_base->setFlow( IOLayerBase::Software ); | ||
56 | } else if (rad_flow == 0) { | ||
57 | m_base->setFlow( IOLayerBase::None ); | ||
58 | } | ||
59 | |||
60 | if (rad_parity == 1) { | ||
61 | m_base->setParity( IOLayerBase::Even ); | ||
62 | } else { | ||
63 | m_base->setParity( IOLayerBase::Odd ); | ||
64 | } | ||
65 | |||
66 | switch( speed ) { | ||
67 | case 115200: | ||
68 | m_base->setSpeed(IOLayerBase::Baud_115200 ); | ||
69 | break; | ||
70 | case 57600: | ||
71 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | ||
72 | break; | ||
73 | case 38400: | ||
74 | m_base->setSpeed(IOLayerBase::Baud_38400 ); | ||
75 | break; | ||
76 | case 19200: | ||
77 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | ||
78 | break; | ||
79 | case 9600: | ||
80 | default: | ||
81 | m_base->setSpeed(IOLayerBase::Baud_9600 ); | ||
82 | break; | ||
83 | } | ||
84 | |||
85 | if ( prof.readEntry("Device").isEmpty() ) return; | ||
86 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); | ||
87 | |||
88 | } | ||
89 | /* | ||
90 | * save speed, | ||
91 | * flow, | ||
92 | * parity | ||
93 | */ | ||
94 | void IrdaConfigWidget::save( Profile& prof ) { | ||
95 | int flow, parity, speed; | ||
96 | prof.writeEntry("Device", m_deviceCmb->currentText() ); | ||
97 | |||
98 | switch( m_base->flow() ) { | ||
99 | case IOLayerBase::None: | ||
100 | flow = 0; | ||
101 | break; | ||
102 | case IOLayerBase::Software: | ||
103 | flow = 2; | ||
104 | break; | ||
105 | case IOLayerBase::Hardware: | ||
106 | flow = 1; | ||
107 | break; | ||
108 | } | ||
109 | |||
110 | |||
111 | switch( m_base->parity() ) { | ||
112 | case IOLayerBase::Odd: | ||
113 | parity = 2; | ||
114 | break; | ||
115 | case IOLayerBase::Even: | ||
116 | parity = 1; | ||
117 | break; | ||
118 | } | ||
119 | |||
120 | switch( m_base->speed() ) { | ||
121 | case IOLayerBase::Baud_115200: | ||
122 | speed = 115200; | ||
123 | break; | ||
124 | case IOLayerBase::Baud_57600: | ||
125 | speed = 57600; | ||
126 | break; | ||
127 | case IOLayerBase::Baud_38400: | ||
128 | speed = 38400; | ||
129 | break; | ||
130 | case IOLayerBase::Baud_19200: | ||
131 | speed = 19200; | ||
132 | break; | ||
133 | case IOLayerBase::Baud_9600: | ||
134 | speed = 9600; | ||
135 | break; | ||
136 | } | ||
137 | |||
138 | prof.writeEntry("Flow", flow); | ||
139 | prof.writeEntry("Parity", parity); | ||
140 | prof.writeEntry("Speed", speed); | ||
141 | } | ||
diff --git a/noncore/apps/opie-console/irdaconfigwidget.h b/noncore/apps/opie-console/irdaconfigwidget.h new file mode 100644 index 0000000..56d8089 --- a/dev/null +++ b/noncore/apps/opie-console/irdaconfigwidget.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef OPIE_IRDA_CONFIG_WIDGET_H | ||
2 | #define OPIE_IRDA_CONFIG_WIDGET_H | ||
3 | |||
4 | #include "profiledialogwidget.h" | ||
5 | |||
6 | class QVBoxLayout; | ||
7 | class QLabel; | ||
8 | class QComboBox; | ||
9 | class IOLayerBase; | ||
10 | class IrdaConfigWidget : public ProfileDialogConnectionWidget { | ||
11 | |||
12 | Q_OBJECT | ||
13 | |||
14 | public: | ||
15 | IrdaConfigWidget( const QString& name, QWidget* parent, const char* name = 0l ); | ||
16 | ~IrdaConfigWidget(); | ||
17 | |||
18 | void load( const Profile& ); | ||
19 | void save( Profile& ); | ||
20 | private: | ||
21 | QVBoxLayout* m_lay; | ||
22 | QLabel* m_device; | ||
23 | QComboBox* m_deviceCmb; | ||
24 | IOLayerBase* m_base; | ||
25 | |||
26 | }; | ||
27 | |||
28 | |||
29 | #endif | ||
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index ea6d759..e1e5248 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro | |||
@@ -2,7 +2,7 @@ TEMPLATE = app | |||
2 | #CONFIG = qt warn_on release | 2 | #CONFIG = qt warn_on release |
3 | CONFIG = qt debug | 3 | CONFIG = qt debug |
4 | DESTDIR = $(OPIEDIR)/bin | 4 | DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = io_layer.h io_serial.h \ | 5 | HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h \ |
6 | file_layer.h sz_transfer.h \ | 6 | file_layer.h sz_transfer.h \ |
7 | metafactory.h \ | 7 | metafactory.h \ |
8 | session.h \ | 8 | session.h \ |
@@ -27,9 +27,10 @@ HEADERS = io_layer.h io_serial.h \ | |||
27 | default.h \ | 27 | default.h \ |
28 | terminalwidget.h \ | 28 | terminalwidget.h \ |
29 | iolayerbase.h \ | 29 | iolayerbase.h \ |
30 | serialconfigwidget.h | 30 | serialconfigwidget.h irdaconfigwidget.h btconfigwidget.h \ |
31 | 31 | ||
32 | SOURCES = io_layer.cpp io_serial.cpp \ | 32 | |
33 | SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp \ | ||
33 | file_layer.cpp sz_transfer.cpp \ | 34 | file_layer.cpp sz_transfer.cpp \ |
34 | main.cpp \ | 35 | main.cpp \ |
35 | metafactory.cpp \ | 36 | metafactory.cpp \ |
@@ -53,7 +54,7 @@ SOURCES = io_layer.cpp io_serial.cpp \ | |||
53 | default.cpp \ | 54 | default.cpp \ |
54 | terminalwidget.cpp \ | 55 | terminalwidget.cpp \ |
55 | iolayerbase.cpp \ | 56 | iolayerbase.cpp \ |
56 | serialconfigwidget.cpp | 57 | serialconfigwidget.cpp irdaconfigwidget.cpp btconfigwidget.cpp \ |
57 | 58 | ||
58 | INTERFACES = configurebase.ui editbase.ui | 59 | INTERFACES = configurebase.ui editbase.ui |
59 | INCLUDEPATH += $(OPIEDIR)/include | 60 | INCLUDEPATH += $(OPIEDIR)/include |
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index faf9c39..914fd25 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -179,7 +179,7 @@ void ProfileEditorDialog::slotConActivated( const QString& str ) { | |||
179 | m_con = m_fact->newConnectionPlugin( str, m_tabCon ); | 179 | m_con = m_fact->newConnectionPlugin( str, m_tabCon ); |
180 | 180 | ||
181 | if (m_con ) { | 181 | if (m_con ) { |
182 | m_con->load(m_prof ); | 182 | m_con->load( m_prof ); |
183 | m_layCon->addWidget( m_con ); | 183 | m_layCon->addWidget( m_con ); |
184 | } | 184 | } |
185 | } | 185 | } |
diff --git a/noncore/apps/opie-console/profileeditorplugins.cpp b/noncore/apps/opie-console/profileeditorplugins.cpp index c11c854..937516c 100644 --- a/noncore/apps/opie-console/profileeditorplugins.cpp +++ b/noncore/apps/opie-console/profileeditorplugins.cpp | |||
@@ -194,15 +194,18 @@ QWidget *ProfileEditorPlugin::terminal_widget() | |||
194 | 194 | ||
195 | void ProfileEditorPlugin::slotConnFlow(int id) | 195 | void ProfileEditorPlugin::slotConnFlow(int id) |
196 | { | 196 | { |
197 | switch(id) | 197 | switch(id) |
198 | { | 198 | { |
199 | case id_flow_hw: | 199 | case id_flow_hw: |
200 | m_profile->writeEntry("Flow", IOSerial::FlowHW); | 200 | m_profile->writeEntry("Flow", IOSerial::FlowHW); |
201 | break; | 201 | break; |
202 | case id_flow_sw: | 202 | case id_flow_sw: |
203 | m_profile->writeEntry("Flow", IOSerial::FlowSW); | 203 | m_profile->writeEntry("Flow", IOSerial::FlowSW); |
204 | break; | 204 | break; |
205 | } | 205 | case id_flow_sw: |
206 | m_profile->writeEntry("None", IOSerial::None); | ||
207 | break; | ||
208 | } | ||
206 | } | 209 | } |
207 | 210 | ||
208 | void ProfileEditorPlugin::slotConnParity(int id) | 211 | void ProfileEditorPlugin::slotConnParity(int id) |
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp index a427302..b1ec408 100644 --- a/noncore/apps/opie-console/serialconfigwidget.cpp +++ b/noncore/apps/opie-console/serialconfigwidget.cpp | |||
@@ -51,10 +51,13 @@ void SerialConfigWidget::load( const Profile& prof ) { | |||
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 | 53 | ||
54 | if (rad_flow == 0) | 54 | if (rad_flow == 1) { |
55 | m_base->setFlow( IOLayerBase::Hardware ); | 55 | m_base->setFlow( IOLayerBase::Hardware ); |
56 | else | 56 | } else if (rad_flow == 2) { |
57 | m_base->setFlow( IOLayerBase::Software ); | 57 | m_base->setFlow( IOLayerBase::Software ); |
58 | } else if (rad_flow == 0) { | ||
59 | m_base->setFlow( IOLayerBase::None ); | ||
60 | } | ||
58 | 61 | ||
59 | if (rad_parity == 1) | 62 | if (rad_parity == 1) |
60 | m_base->setParity( IOLayerBase::Even ); | 63 | m_base->setParity( IOLayerBase::Even ); |
@@ -94,11 +97,14 @@ void SerialConfigWidget::save( Profile& prof ) { | |||
94 | prof.writeEntry("Device", m_deviceCmb->currentText() ); | 97 | prof.writeEntry("Device", m_deviceCmb->currentText() ); |
95 | 98 | ||
96 | switch( m_base->flow() ) { | 99 | switch( m_base->flow() ) { |
100 | case IOLayerBase::None: | ||
101 | flow = 0; | ||
102 | break; | ||
97 | case IOLayerBase::Software: | 103 | case IOLayerBase::Software: |
98 | flow = 1; | 104 | flow = 2; |
99 | break; | 105 | break; |
100 | case IOLayerBase::Hardware: | 106 | case IOLayerBase::Hardware: |
101 | flow = 0; | 107 | flow = 1; |
102 | break; | 108 | break; |
103 | } | 109 | } |
104 | 110 | ||
diff --git a/noncore/apps/opie-console/widget_layer.h b/noncore/apps/opie-console/widget_layer.h index c91a957..6e2e61e 100644 --- a/noncore/apps/opie-console/widget_layer.h +++ b/noncore/apps/opie-console/widget_layer.h | |||
@@ -87,7 +87,7 @@ public: | |||
87 | * @param QString text, the text to be inserted | 87 | * @param QString text, the text to be inserted |
88 | */ | 88 | */ |
89 | void insertText( QString text ); | 89 | void insertText( QString text ); |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * set selection (clipboard) to text | 92 | * set selection (clipboard) to text |
93 | * @param const QString &text, the text to be selected | 93 | * @param const QString &text, the text to be selected |
@@ -103,7 +103,7 @@ public: | |||
103 | /** | 103 | /** |
104 | * reload configuration | 104 | * reload configuration |
105 | */ | 105 | */ |
106 | virtual void reloadConfig(); | 106 | virtual void reloadConfig() = 0; |
107 | 107 | ||
108 | 108 | ||
109 | signals: | 109 | signals: |