-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,64 +1,66 @@ | |||
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) { |
12 | return new SzTransfer( SzTransfer::SZ, lay ); | 14 | return new SzTransfer( SzTransfer::SZ, lay ); |
13 | } | 15 | } |
14 | FileTransferLayer* newSYTransfer(IOLayer* lay) { | 16 | FileTransferLayer* newSYTransfer(IOLayer* lay) { |
15 | return new SzTransfer( SzTransfer::SY, lay ); | 17 | return new SzTransfer( SzTransfer::SY, lay ); |
16 | } | 18 | } |
17 | FileTransferLayer* newSXTransfer(IOLayer* lay) { | 19 | FileTransferLayer* newSXTransfer(IOLayer* lay) { |
18 | return new SzTransfer( SzTransfer::SX, lay ); | 20 | return new SzTransfer( SzTransfer::SX, lay ); |
19 | } | 21 | } |
20 | 22 | ||
21 | // Layer stuff | 23 | // Layer stuff |
22 | IOLayer* newSerialLayer( const Profile& prof) { | 24 | IOLayer* newSerialLayer( const Profile& prof) { |
23 | return new IOSerial( prof ); | 25 | return new IOSerial( prof ); |
24 | } | 26 | } |
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 |
49 | EmulationLayer* newVT102( Widget* wid ) { | 51 | EmulationLayer* newVT102( Widget* wid ) { |
50 | return new Vt102Emulation( wid ); | 52 | return new Vt102Emulation( wid ); |
51 | } | 53 | } |
52 | 54 | ||
53 | }; | 55 | }; |
54 | 56 | ||
55 | Default::Default( MetaFactory* fact ) { | 57 | Default::Default( MetaFactory* fact ) { |
56 | fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); | 58 | fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); |
57 | fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); | 59 | fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); |
58 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); | 60 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); |
59 | 61 | ||
60 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); | 62 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); |
61 | fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); | 63 | fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); |
62 | fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); | 64 | fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); |
63 | 65 | ||
64 | fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); | 66 | fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); |
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 | |||
@@ -1,145 +1,155 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
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 | 7 | ||
8 | #include "iolayerbase.h" | 8 | #include "iolayerbase.h" |
9 | 9 | ||
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 |
27 | }; | 28 | }; |
28 | 29 | ||
29 | } | 30 | } |
30 | 31 | ||
31 | 32 | ||
32 | IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | 33 | 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 ); |
63 | 66 | ||
64 | // profiles | 67 | // profiles |
65 | m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); | 68 | m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); |
66 | m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); | 69 | m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); |
67 | m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); | 70 | m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); |
68 | m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 ); | 71 | m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 ); |
69 | m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 ); | 72 | m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 ); |
70 | }; | 73 | }; |
71 | IOLayerBase::~IOLayerBase() { | 74 | IOLayerBase::~IOLayerBase() { |
72 | 75 | ||
73 | } | 76 | } |
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; |
92 | } | 99 | } |
93 | } | 100 | } |
94 | void IOLayerBase::setSpeed( Speed sp ) { | 101 | void IOLayerBase::setSpeed( Speed sp ) { |
95 | int index; | 102 | int index; |
96 | switch( sp ) { | 103 | switch( sp ) { |
97 | case Baud_115200: | 104 | case Baud_115200: |
98 | index = id_baud_115200; | 105 | index = id_baud_115200; |
99 | break; | 106 | break; |
100 | case Baud_57600: | 107 | case Baud_57600: |
101 | index = id_baud_57600; | 108 | index = id_baud_57600; |
102 | break; | 109 | break; |
103 | case Baud_38400: | 110 | case Baud_38400: |
104 | index = id_baud_38400; | 111 | index = id_baud_38400; |
105 | break; | 112 | break; |
106 | case Baud_19200: | 113 | case Baud_19200: |
107 | index = id_baud_19200; | 114 | index = id_baud_19200; |
108 | break; | 115 | break; |
109 | case Baud_9600: | 116 | case Baud_9600: |
110 | index = id_baud_9600; | 117 | index = id_baud_9600; |
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 | ||
130 | } | 140 | } |
131 | IOLayerBase::Speed IOLayerBase::speed()const{ | 141 | IOLayerBase::Speed IOLayerBase::speed()const{ |
132 | switch( m_speedBox->currentItem() ) { | 142 | switch( m_speedBox->currentItem() ) { |
133 | case id_baud_115200: | 143 | case id_baud_115200: |
134 | return Baud_115200; | 144 | return Baud_115200; |
135 | break; | 145 | break; |
136 | case id_baud_57600: | 146 | case id_baud_57600: |
137 | return Baud_57600; | 147 | return Baud_57600; |
138 | break; | 148 | break; |
139 | case id_baud_38400: | 149 | case id_baud_38400: |
140 | return Baud_38400; | 150 | return Baud_38400; |
141 | break; | 151 | break; |
142 | case id_baud_19200: | 152 | case id_baud_19200: |
143 | return Baud_19200; | 153 | return Baud_19200; |
144 | break; | 154 | break; |
145 | case id_baud_9600: | 155 | case id_baud_9600: |
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 | |||
@@ -1,47 +1,47 @@ | |||
1 | #ifndef OPIE_IO_LAYER_BASE_H | 1 | #ifndef OPIE_IO_LAYER_BASE_H |
2 | #define OPIE_IO_LAYER_BASE_H | 2 | #define OPIE_IO_LAYER_BASE_H |
3 | 3 | ||
4 | 4 | ||
5 | #include <qwidget.h> | 5 | #include <qwidget.h> |
6 | 6 | ||
7 | class QLabel; | 7 | 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(); |
25 | 25 | ||
26 | void setFlow( Flow flo ); | 26 | void setFlow( Flow flo ); |
27 | void setParity( Parity par ); | 27 | void setParity( Parity par ); |
28 | void setSpeed( Speed speed ); | 28 | void setSpeed( Speed speed ); |
29 | 29 | ||
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 | ||
47 | #endif | 47 | #endif |
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,63 +1,64 @@ | |||
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 \ |
14 | tabwidget.h \ | 14 | tabwidget.h \ |
15 | configdialog.h \ | 15 | configdialog.h \ |
16 | emulation_layer.h \ | 16 | emulation_layer.h \ |
17 | widget.h \ | 17 | widget.h \ |
18 | vt102emulation.h \ | 18 | vt102emulation.h \ |
19 | common.h \ | 19 | common.h \ |
20 | history.h \ | 20 | history.h \ |
21 | screen.h \ | 21 | screen.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 \ |
41 | tabwidget.cpp \ | 42 | tabwidget.cpp \ |
42 | configdialog.cpp \ | 43 | configdialog.cpp \ |
43 | emulation_layer.cpp \ | 44 | emulation_layer.cpp \ |
44 | widget.cpp \ | 45 | widget.cpp \ |
45 | vt102emulation.cpp \ | 46 | vt102emulation.cpp \ |
46 | history.cpp \ | 47 | history.cpp \ |
47 | screen.cpp \ | 48 | screen.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 | |||
@@ -158,42 +158,42 @@ void ProfileEditorDialog::accept() | |||
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | QString ProfileEditorDialog::profName()const | 161 | QString ProfileEditorDialog::profName()const |
162 | { | 162 | { |
163 | return m_name->text(); | 163 | return m_name->text(); |
164 | } | 164 | } |
165 | 165 | ||
166 | QCString ProfileEditorDialog::profType()const | 166 | QCString ProfileEditorDialog::profType()const |
167 | { | 167 | { |
168 | /*QStringList w = m_fact->configWidgets(); | 168 | /*QStringList w = m_fact->configWidgets(); |
169 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) | 169 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
170 | if(device_box->currentText() == m_fact->name((*it))) return (*it); | 170 | if(device_box->currentText() == m_fact->name((*it))) return (*it); |
171 | */ | 171 | */ |
172 | return QCString(); | 172 | return QCString(); |
173 | } | 173 | } |
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; |
191 | m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); | 191 | m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); |
192 | qWarning("past"); | 192 | qWarning("past"); |
193 | 193 | ||
194 | if (m_term) { | 194 | if (m_term) { |
195 | m_term->load(m_prof ); | 195 | m_term->load(m_prof ); |
196 | m_layTerm->addWidget( m_term ); | 196 | m_layTerm->addWidget( m_term ); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | 199 | ||
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 | |||
@@ -173,57 +173,60 @@ QWidget *ProfileEditorPlugin::terminal_widget() | |||
173 | if(fontsize == Profile::Small) size_medium->setChecked(true); | 173 | if(fontsize == Profile::Small) size_medium->setChecked(true); |
174 | if(fontsize == Profile::Medium) size_large->setChecked(true); | 174 | if(fontsize == Profile::Medium) size_large->setChecked(true); |
175 | 175 | ||
176 | if(opt_echo) option_echo->setChecked(true); | 176 | if(opt_echo) option_echo->setChecked(true); |
177 | if(opt_wrap) option_wrap->setChecked(true); | 177 | if(opt_wrap) option_wrap->setChecked(true); |
178 | if(opt_inbound) conv_inbound->setChecked(true); | 178 | if(opt_inbound) conv_inbound->setChecked(true); |
179 | if(opt_outbound) conv_outbound->setChecked(true); | 179 | if(opt_outbound) conv_outbound->setChecked(true); |
180 | 180 | ||
181 | // Signals | 181 | // Signals |
182 | 182 | ||
183 | connect(terminal_box, SIGNAL(activated(int)), SLOT(slotTermTerm(int))); | 183 | connect(terminal_box, SIGNAL(activated(int)), SLOT(slotTermTerm(int))); |
184 | connect(colour_box, SIGNAL(activated(int)), SLOT(slotTermColour(int))); | 184 | connect(colour_box, SIGNAL(activated(int)), SLOT(slotTermColour(int))); |
185 | connect(group_size, SIGNAL(clicked(int)), SLOT(slotTermFont(int))); | 185 | connect(group_size, SIGNAL(clicked(int)), SLOT(slotTermFont(int))); |
186 | 186 | ||
187 | connect(option_echo, SIGNAL(toggled(bool)), SLOT(slotTermEcho(bool))); | 187 | connect(option_echo, SIGNAL(toggled(bool)), SLOT(slotTermEcho(bool))); |
188 | connect(option_wrap, SIGNAL(toggled(bool)), SLOT(slotTermWrap(bool))); | 188 | connect(option_wrap, SIGNAL(toggled(bool)), SLOT(slotTermWrap(bool))); |
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); |
214 | break; | 217 | break; |
215 | case id_parity_even: | 218 | case id_parity_even: |
216 | m_profile->writeEntry("Parity", IOSerial::ParityOdd); | 219 | m_profile->writeEntry("Parity", IOSerial::ParityOdd); |
217 | break; | 220 | break; |
218 | } | 221 | } |
219 | } | 222 | } |
220 | 223 | ||
221 | void ProfileEditorPlugin::slotConnSpeed(int id) | 224 | void ProfileEditorPlugin::slotConnSpeed(int id) |
222 | { | 225 | { |
223 | switch(id) | 226 | switch(id) |
224 | { | 227 | { |
225 | 228 | ||
226 | case id_baud_115200: | 229 | case id_baud_115200: |
227 | m_profile->writeEntry("Speed", 115200); | 230 | m_profile->writeEntry("Speed", 115200); |
228 | break; | 231 | break; |
229 | case id_baud_57600: | 232 | case id_baud_57600: |
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 | |||
@@ -30,96 +30,102 @@ SerialConfigWidget::SerialConfigWidget( const QString& name, | |||
30 | m_device = new QLabel(tr("Device"), this ); | 30 | m_device = new QLabel(tr("Device"), this ); |
31 | m_deviceCmb = new QComboBox(this ); | 31 | m_deviceCmb = new QComboBox(this ); |
32 | m_deviceCmb->setEditable( TRUE ); | 32 | m_deviceCmb->setEditable( TRUE ); |
33 | 33 | ||
34 | m_base = new IOLayerBase(this, "base"); | 34 | m_base = new IOLayerBase(this, "base"); |
35 | 35 | ||
36 | m_lay->addWidget( m_device ); | 36 | m_lay->addWidget( m_device ); |
37 | m_lay->addWidget( m_deviceCmb ); | 37 | m_lay->addWidget( m_deviceCmb ); |
38 | m_lay->addWidget( m_base ); | 38 | m_lay->addWidget( m_base ); |
39 | 39 | ||
40 | m_deviceCmb->insertItem( "/dev/ttyS0" ); | 40 | m_deviceCmb->insertItem( "/dev/ttyS0" ); |
41 | m_deviceCmb->insertItem( "/dev/ttyS1" ); | 41 | m_deviceCmb->insertItem( "/dev/ttyS1" ); |
42 | m_deviceCmb->insertItem( "/dev/ttySA0"); | 42 | m_deviceCmb->insertItem( "/dev/ttySA0"); |
43 | m_deviceCmb->insertItem( "/dev/ttySA1"); | 43 | m_deviceCmb->insertItem( "/dev/ttySA1"); |
44 | 44 | ||
45 | } | 45 | } |
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: |
66 | m_base->setSpeed(IOLayerBase::Baud_115200 ); | 69 | m_base->setSpeed(IOLayerBase::Baud_115200 ); |
67 | break; | 70 | break; |
68 | case 57600: | 71 | case 57600: |
69 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | 72 | m_base->setSpeed( IOLayerBase::Baud_57600 ); |
70 | break; | 73 | break; |
71 | case 38400: | 74 | case 38400: |
72 | m_base->setSpeed(IOLayerBase::Baud_38400 ); | 75 | m_base->setSpeed(IOLayerBase::Baud_38400 ); |
73 | break; | 76 | break; |
74 | case 19200: | 77 | case 19200: |
75 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | 78 | m_base->setSpeed( IOLayerBase::Baud_19200 ); |
76 | break; | 79 | break; |
77 | case 9600: | 80 | case 9600: |
78 | default: | 81 | default: |
79 | m_base->setSpeed(IOLayerBase::Baud_9600 ); | 82 | m_base->setSpeed(IOLayerBase::Baud_9600 ); |
80 | break; | 83 | break; |
81 | } | 84 | } |
82 | 85 | ||
83 | if ( prof.readEntry("Device").isEmpty() ) return; | 86 | if ( prof.readEntry("Device").isEmpty() ) return; |
84 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); | 87 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); |
85 | 88 | ||
86 | } | 89 | } |
87 | /* | 90 | /* |
88 | * save speed, | 91 | * save speed, |
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: |
110 | parity = 1; | 116 | parity = 1; |
111 | break; | 117 | break; |
112 | } | 118 | } |
113 | 119 | ||
114 | switch( m_base->speed() ) { | 120 | switch( m_base->speed() ) { |
115 | case IOLayerBase::Baud_115200: | 121 | case IOLayerBase::Baud_115200: |
116 | speed = 115200; | 122 | speed = 115200; |
117 | break; | 123 | break; |
118 | case IOLayerBase::Baud_57600: | 124 | case IOLayerBase::Baud_57600: |
119 | speed = 57600; | 125 | speed = 57600; |
120 | break; | 126 | break; |
121 | case IOLayerBase::Baud_38400: | 127 | case IOLayerBase::Baud_38400: |
122 | speed = 38400; | 128 | speed = 38400; |
123 | break; | 129 | break; |
124 | case IOLayerBase::Baud_19200: | 130 | case IOLayerBase::Baud_19200: |
125 | speed = 19200; | 131 | speed = 19200; |
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 | |||
@@ -66,65 +66,65 @@ public: | |||
66 | * annoy the user | 66 | * annoy the user |
67 | */ | 67 | */ |
68 | void bell(); | 68 | void bell(); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * @return int m_lines, the lines count | 71 | * @return int m_lines, the lines count |
72 | */ | 72 | */ |
73 | int lines(){ return m_lines; } | 73 | int lines(){ return m_lines; } |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * @return int m_columns, the columns count | 76 | * @return int m_columns, the columns count |
77 | */ | 77 | */ |
78 | int columns(){ return m_columns; } | 78 | int columns(){ return m_columns; } |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * insert current selection (currently this is only the clipboard) | 81 | * insert current selection (currently this is only the clipboard) |
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 ); |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * whenever Mouse selects something | 117 | * whenever Mouse selects something |
118 | * @param int button, the button that us pressed : | 118 | * @param int button, the button that us pressed : |
119 | * 0left Button | 119 | * 0left Button |
120 | * 3Button released | 120 | * 3Button released |
121 | * @param int x, x position | 121 | * @param int x, x position |
122 | * @param int y, y position | 122 | * @param int y, y position |
123 | * | 123 | * |
124 | * // numbering due to layout in old TEWidget | 124 | * // numbering due to layout in old TEWidget |
125 | */ | 125 | */ |
126 | void mousePressed( int button, int x, int y ); | 126 | void mousePressed( int button, int x, int y ); |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * size of image changed | 129 | * size of image changed |
130 | * @param int lines, line count of new size | 130 | * @param int lines, line count of new size |