author | harlekin <harlekin> | 2002-10-09 16:33:36 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-09 16:33:36 (UTC) |
commit | 205926ec86ffd582f795b649179291626e504830 (patch) (unidiff) | |
tree | 3a5759b98a1a263ade37dfb35cfd529a7bcafde9 | |
parent | f696c6248824166f3ac025d23ac66b46c93b440c (diff) | |
download | opie-205926ec86ffd582f795b649179291626e504830.zip opie-205926ec86ffd582f795b649179291626e504830.tar.gz opie-205926ec86ffd582f795b649179291626e504830.tar.bz2 |
flow now has mode none too .-), irda config widget and beginning of layer, first sweep, rest later
-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,11 +1,13 @@ | |||
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 | ||
7 | #include "default.h" | 9 | #include "default.h" |
8 | 10 | ||
9 | extern "C" { | 11 | extern "C" { |
10 | // FILE Transfer Stuff | 12 | // FILE Transfer Stuff |
11 | FileTransferLayer* newSZTransfer(IOLayer* lay) { | 13 | FileTransferLayer* newSZTransfer(IOLayer* lay) { |
@@ -25,24 +27,24 @@ extern "C" { | |||
25 | IOLayer* newBTLayer( const Profile& ) { | 27 | IOLayer* newBTLayer( const Profile& ) { |
26 | return 0l; | 28 | return 0l; |
27 | } | 29 | } |
28 | IOLayer* newIrDaLayer( const Profile& ) { | 30 | IOLayer* newIrDaLayer( const Profile& ) { |
29 | return 0l; | 31 | return 0l; |
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) |
44 | ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { | 46 | ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { |
45 | return new TerminalWidget(na, wid,0 ); | 47 | return new TerminalWidget(na, wid,0 ); |
46 | } | 48 | } |
47 | 49 | ||
48 | // VT Emulations | 50 | // VT Emulations |
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 | |||
@@ -10,17 +10,18 @@ | |||
10 | namespace { | 10 | namespace { |
11 | enum ParityIds { | 11 | enum ParityIds { |
12 | id_parity_odd, | 12 | id_parity_odd, |
13 | id_parity_even | 13 | id_parity_even |
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 | id_flow_none, | ||
19 | }; | 20 | }; |
20 | 21 | ||
21 | enum SpeedIds { | 22 | enum SpeedIds { |
22 | id_baud_115200, | 23 | id_baud_115200, |
23 | id_baud_57600, | 24 | id_baud_57600, |
24 | id_baud_38400, | 25 | id_baud_38400, |
25 | id_baud_19200, | 26 | id_baud_19200, |
26 | id_baud_9600 | 27 | id_baud_9600 |
@@ -33,30 +34,32 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | |||
33 | : QWidget( par, name ) | 34 | : QWidget( par, name ) |
34 | { | 35 | { |
35 | m_speedLabel = new QLabel(tr("Speed"), this ); | 36 | m_speedLabel = new QLabel(tr("Speed"), this ); |
36 | m_speedBox = new QComboBox(this ); | 37 | m_speedBox = new QComboBox(this ); |
37 | 38 | ||
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); |
50 | m_lroot->setStretchFactor(m_speedBox, 1 ); | 52 | m_lroot->setStretchFactor(m_speedBox, 1 ); |
51 | 53 | ||
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 | ||
58 | m_hboxPar = new QHBoxLayout( m_groupParity, 2 ); | 61 | m_hboxPar = new QHBoxLayout( m_groupParity, 2 ); |
59 | m_hboxPar->add(m_parityOdd ); | 62 | m_hboxPar->add(m_parityOdd ); |
60 | m_hboxPar->add(m_parityEven ); | 63 | m_hboxPar->add(m_parityEven ); |
61 | m_lroot->add(m_groupParity ); | 64 | m_lroot->add(m_groupParity ); |
62 | m_lroot->setStretchFactor(m_groupParity, 2 ); | 65 | m_lroot->setStretchFactor(m_groupParity, 2 ); |
@@ -74,18 +77,22 @@ IOLayerBase::~IOLayerBase() { | |||
74 | void IOLayerBase::setFlow( Flow flo ) { | 77 | void IOLayerBase::setFlow( Flow flo ) { |
75 | switch ( flo ) { | 78 | switch ( flo ) { |
76 | case Software: | 79 | case Software: |
77 | m_flowSw->setChecked( true ); | 80 | m_flowSw->setChecked( true ); |
78 | break; | 81 | break; |
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: |
87 | m_parityOdd->setChecked( true ); | 94 | m_parityOdd->setChecked( true ); |
88 | break; | 95 | break; |
89 | case Even: | 96 | case Even: |
90 | m_parityEven->setChecked( true ); | 97 | m_parityEven->setChecked( true ); |
91 | break; | 98 | break; |
@@ -111,19 +118,22 @@ void IOLayerBase::setSpeed( Speed sp ) { | |||
111 | break; | 118 | break; |
112 | } | 119 | } |
113 | m_speedBox->setCurrentItem(index ); | 120 | m_speedBox->setCurrentItem(index ); |
114 | } | 121 | } |
115 | IOLayerBase::Flow IOLayerBase::flow()const { | 122 | 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 { |
125 | if (m_parityOdd->isChecked() ) | 135 | if (m_parityOdd->isChecked() ) |
126 | return Odd; | 136 | return Odd; |
127 | else | 137 | else |
128 | return Even; | 138 | return Even; |
129 | 139 | ||
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 | |||
@@ -8,17 +8,17 @@ class QLabel; | |||
8 | class QComboBox; | 8 | class QComboBox; |
9 | class QVBoxLayout; | 9 | class QVBoxLayout; |
10 | class QButtonGroup; | 10 | class QButtonGroup; |
11 | class QRadioButton; | 11 | class QRadioButton; |
12 | class QHBoxLayout; | 12 | 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, |
20 | Baud_38400, | 20 | Baud_38400, |
21 | Baud_19200, | 21 | Baud_19200, |
22 | Baud_9600 }; | 22 | Baud_9600 }; |
23 | IOLayerBase( QWidget* base, const char* name = 0l); | 23 | IOLayerBase( QWidget* base, const char* name = 0l); |
24 | ~IOLayerBase(); | 24 | ~IOLayerBase(); |
@@ -30,17 +30,17 @@ public: | |||
30 | Flow flow()const; | 30 | Flow flow()const; |
31 | Parity parity()const; | 31 | Parity parity()const; |
32 | Speed speed()const; | 32 | Speed speed()const; |
33 | private: | 33 | private: |
34 | QVBoxLayout* m_lroot; | 34 | QVBoxLayout* m_lroot; |
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; |
42 | QHBoxLayout* m_hbox; | 42 | QHBoxLayout* m_hbox; |
43 | QHBoxLayout* m_hboxPar; | 43 | QHBoxLayout* m_hboxPar; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | 46 | ||
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 | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE = app | 1 | 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 \ |
9 | mainwindow.h \ | 9 | mainwindow.h \ |
10 | profile.h \ | 10 | profile.h \ |
11 | profileconfig.h \ | 11 | profileconfig.h \ |
12 | profilemanager.h \ | 12 | profilemanager.h \ |
13 | configwidget.h \ | 13 | configwidget.h \ |
@@ -22,19 +22,20 @@ HEADERS = io_layer.h io_serial.h \ | |||
22 | keytrans.h \ | 22 | keytrans.h \ |
23 | widget_layer.h \ | 23 | widget_layer.h \ |
24 | transferdialog.h \ | 24 | transferdialog.h \ |
25 | profiledialogwidget.h \ | 25 | profiledialogwidget.h \ |
26 | profileeditordialog.h \ | 26 | profileeditordialog.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 \ |
36 | session.cpp \ | 37 | session.cpp \ |
37 | mainwindow.cpp \ | 38 | mainwindow.cpp \ |
38 | profile.cpp \ | 39 | profile.cpp \ |
39 | profileconfig.cpp \ | 40 | profileconfig.cpp \ |
40 | profilemanager.cpp \ | 41 | profilemanager.cpp \ |
@@ -48,16 +49,16 @@ SOURCES = io_layer.cpp io_serial.cpp \ | |||
48 | keytrans.cpp \ | 49 | keytrans.cpp \ |
49 | widget_layer.cpp \ | 50 | widget_layer.cpp \ |
50 | transferdialog.cpp \ | 51 | transferdialog.cpp \ |
51 | profiledialogwidget.cpp \ | 52 | profiledialogwidget.cpp \ |
52 | profileeditordialog.cpp \ | 53 | profileeditordialog.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 |
60 | DEPENDPATH += $(OPIEDIR)/include | 61 | DEPENDPATH += $(OPIEDIR)/include |
61 | LIBS += -lqpe -lopie | 62 | LIBS += -lqpe -lopie |
62 | TARGET = opie-console | 63 | TARGET = opie-console |
63 | 64 | ||
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 | |||
@@ -174,17 +174,17 @@ QCString ProfileEditorDialog::profType()const | |||
174 | /* | 174 | /* |
175 | * we need to switch the widget | 175 | * we need to switch the widget |
176 | */ | 176 | */ |
177 | void ProfileEditorDialog::slotConActivated( const QString& str ) { | 177 | void ProfileEditorDialog::slotConActivated( const QString& str ) { |
178 | delete m_con; | 178 | delete m_con; |
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 | } |
186 | /* | 186 | /* |
187 | * we need to switch the widget | 187 | * we need to switch the widget |
188 | */ | 188 | */ |
189 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { | 189 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { |
190 | delete m_term; | 190 | delete m_term; |
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 | |||
@@ -189,25 +189,28 @@ QWidget *ProfileEditorPlugin::terminal_widget() | |||
189 | connect(conv_inbound, SIGNAL(toggled(bool)), SLOT(slotTermInbound(bool))); | 189 | connect(conv_inbound, SIGNAL(toggled(bool)), SLOT(slotTermInbound(bool))); |
190 | connect(conv_outbound, SIGNAL(toggled(bool)), SLOT(slotTermOutbound(bool))); | 190 | connect(conv_outbound, SIGNAL(toggled(bool)), SLOT(slotTermOutbound(bool))); |
191 | 191 | ||
192 | return root; | 192 | return root; |
193 | } | 193 | } |
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) |
209 | { | 212 | { |
210 | switch(id) | 213 | switch(id) |
211 | { | 214 | { |
212 | case id_parity_odd: | 215 | case id_parity_odd: |
213 | m_profile->writeEntry("Parity", IOSerial::ParityEven); | 216 | m_profile->writeEntry("Parity", IOSerial::ParityEven); |
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 | |||
@@ -46,20 +46,23 @@ SerialConfigWidget::SerialConfigWidget( const QString& name, | |||
46 | SerialConfigWidget::~SerialConfigWidget() { | 46 | SerialConfigWidget::~SerialConfigWidget() { |
47 | 47 | ||
48 | } | 48 | } |
49 | void SerialConfigWidget::load( const Profile& prof ) { | 49 | 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 | 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 ); |
61 | else | 64 | else |
62 | m_base->setParity( IOLayerBase::Odd ); | 65 | m_base->setParity( IOLayerBase::Odd ); |
63 | 66 | ||
64 | switch( speed ) { | 67 | switch( speed ) { |
65 | case 115200: | 68 | case 115200: |
@@ -89,21 +92,24 @@ void SerialConfigWidget::load( const Profile& prof ) { | |||
89 | * flow, | 92 | * flow, |
90 | * parity | 93 | * parity |
91 | */ | 94 | */ |
92 | void SerialConfigWidget::save( Profile& prof ) { | 95 | void SerialConfigWidget::save( Profile& prof ) { |
93 | int flow, parity, speed; | 96 | int flow, parity, speed; |
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 | ||
105 | switch( m_base->parity() ) { | 111 | switch( m_base->parity() ) { |
106 | case IOLayerBase::Odd: | 112 | case IOLayerBase::Odd: |
107 | parity = 2; | 113 | parity = 2; |
108 | break; | 114 | break; |
109 | case IOLayerBase::Even: | 115 | case IOLayerBase::Even: |
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 | |||
@@ -82,33 +82,33 @@ public: | |||
82 | */ | 82 | */ |
83 | void insertSelection(); | 83 | void insertSelection(); |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * insert text | 86 | * insert text |
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 |
94 | */ | 94 | */ |
95 | void setSelection( const QString &text ); | 95 | void setSelection( const QString &text ); |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * paste content of clipboard | 98 | * paste content of clipboard |
99 | */ | 99 | */ |
100 | void pasteClipboard(); | 100 | void pasteClipboard(); |
101 | 101 | ||
102 | 102 | ||
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: |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * key was pressed | 112 | * key was pressed |
113 | */ | 113 | */ |
114 | void keyPressed( QKeyEvent *e ); | 114 | void keyPressed( QKeyEvent *e ); |