author | zecke <zecke> | 2002-10-08 23:13:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-08 23:13:17 (UTC) |
commit | 8c353ec8b86ee8f82cc25172fb69dd5fee65e848 (patch) (unidiff) | |
tree | a4549bcba962689edb9c40efcb23114cae5fcda2 | |
parent | ca0c224318a50c6618691fb30f39aa1d9b0b8a4f (diff) | |
download | opie-8c353ec8b86ee8f82cc25172fb69dd5fee65e848.zip opie-8c353ec8b86ee8f82cc25172fb69dd5fee65e848.tar.gz opie-8c353ec8b86ee8f82cc25172fb69dd5fee65e848.tar.bz2 |
default I dunno
IOLayerBase the return values for speed()/parity()/flow() added
MainWindow debug code :(
opie-console.pro addition of serialconfigwidget.*
ProfileManager fix removing of Profiles quite rude way of doing it
Configure stuff is done and roughly tested
The migration is done!
TO WAZLAF: you might want to adjust Parity stuff for your needs!
-rw-r--r-- | noncore/apps/opie-console/default.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.cpp | 34 | ||||
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/profilemanager.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/opie-console/serialconfigwidget.cpp | 135 | ||||
-rw-r--r-- | noncore/apps/opie-console/serialconfigwidget.h | 27 |
9 files changed, 212 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp index 4ab4695..d9a0557 100644 --- a/noncore/apps/opie-console/default.cpp +++ b/noncore/apps/opie-console/default.cpp | |||
@@ -1,66 +1,67 @@ | |||
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 "terminalwidget.h" | 4 | #include "terminalwidget.h" |
4 | 5 | ||
5 | #include "default.h" | 6 | #include "default.h" |
6 | 7 | ||
7 | extern "C" { | 8 | extern "C" { |
8 | // FILE Transfer Stuff | 9 | // FILE Transfer Stuff |
9 | FileTransferLayer* newSZTransfer(IOLayer* lay) { | 10 | FileTransferLayer* newSZTransfer(IOLayer* lay) { |
10 | return new SzTransfer( SzTransfer::SZ, lay ); | 11 | return new SzTransfer( SzTransfer::SZ, lay ); |
11 | } | 12 | } |
12 | FileTransferLayer* newSYTransfer(IOLayer* lay) { | 13 | FileTransferLayer* newSYTransfer(IOLayer* lay) { |
13 | return new SzTransfer( SzTransfer::SY, lay ); | 14 | return new SzTransfer( SzTransfer::SY, lay ); |
14 | } | 15 | } |
15 | FileTransferLayer* newSXTransfer(IOLayer* lay) { | 16 | FileTransferLayer* newSXTransfer(IOLayer* lay) { |
16 | return new SzTransfer( SzTransfer::SX, lay ); | 17 | return new SzTransfer( SzTransfer::SX, lay ); |
17 | } | 18 | } |
18 | 19 | ||
19 | // Layer stuff | 20 | // Layer stuff |
20 | IOLayer* newSerialLayer( const Profile& prof) { | 21 | IOLayer* newSerialLayer( const Profile& prof) { |
21 | return new IOSerial( prof ); | 22 | return new IOSerial( prof ); |
22 | } | 23 | } |
23 | IOLayer* newBTLayer( const Profile& ) { | 24 | IOLayer* newBTLayer( const Profile& ) { |
24 | return 0l; | 25 | return 0l; |
25 | } | 26 | } |
26 | IOLayer* newIrDaLayer( const Profile& ) { | 27 | IOLayer* newIrDaLayer( const Profile& ) { |
27 | return 0l; | 28 | return 0l; |
28 | } | 29 | } |
29 | 30 | ||
30 | // Connection Widgets | 31 | // Connection Widgets |
31 | ProfileDialogWidget* newSerialWidget(const QString& str, QWidget* ) { | 32 | ProfileDialogWidget* newSerialWidget(const QString& str, QWidget* wid) { |
32 | return 0l; | 33 | return new SerialConfigWidget(str, wid ); |
33 | } | 34 | } |
34 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid) { | 35 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid) { |
35 | return newSerialWidget(str, wid); | 36 | return newSerialWidget(str, wid); |
36 | } | 37 | } |
37 | ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid) { | 38 | ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid) { |
38 | return newSerialWidget(str, wid ); | 39 | return newSerialWidget(str, wid ); |
39 | } | 40 | } |
40 | 41 | ||
41 | // Terminal Widget(s) | 42 | // Terminal Widget(s) |
42 | ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { | 43 | ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { |
43 | return new TerminalWidget(na, wid,0 ); | 44 | return new TerminalWidget(na, wid,0 ); |
44 | } | 45 | } |
45 | 46 | ||
46 | }; | 47 | }; |
47 | 48 | ||
48 | Default::Default( MetaFactory* fact ) { | 49 | Default::Default( MetaFactory* fact ) { |
49 | fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); | 50 | fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); |
50 | fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); | 51 | fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); |
51 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); | 52 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); |
52 | 53 | ||
53 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); | 54 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); |
54 | fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); | 55 | fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); |
55 | fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); | 56 | fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); |
56 | 57 | ||
57 | fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); | 58 | fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); |
58 | fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); | 59 | fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); |
59 | fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); | 60 | fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); |
60 | 61 | ||
61 | fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); | 62 | fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); |
62 | 63 | ||
63 | } | 64 | } |
64 | Default::~Default() { | 65 | Default::~Default() { |
65 | 66 | ||
66 | } | 67 | } |
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp index 1e164fe..99b6cc1 100644 --- a/noncore/apps/opie-console/iolayerbase.cpp +++ b/noncore/apps/opie-console/iolayerbase.cpp | |||
@@ -1,123 +1,149 @@ | |||
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 | }; | 19 | }; |
20 | 20 | ||
21 | enum SpeedIds { | 21 | enum SpeedIds { |
22 | id_baud_115200, | 22 | id_baud_115200, |
23 | id_baud_57600, | 23 | id_baud_57600, |
24 | id_baud_38400, | 24 | id_baud_38400, |
25 | id_baud_19200, | 25 | id_baud_19200, |
26 | id_baud_9600 | 26 | id_baud_9600 |
27 | }; | 27 | }; |
28 | 28 | ||
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | ||
32 | IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | 32 | IOLayerBase::IOLayerBase( QWidget* par, const char* name ) |
33 | : QWidget( par, name ) | 33 | : QWidget( par, name ) |
34 | { | 34 | { |
35 | m_speedLabel = new QLabel(tr("Speed"), this ); | 35 | m_speedLabel = new QLabel(tr("Speed"), this ); |
36 | m_speedBox = new QComboBox(this ); | 36 | m_speedBox = new QComboBox(this ); |
37 | 37 | ||
38 | m_groupFlow = new QButtonGroup(tr("Flow control") ); | 38 | m_groupFlow = new QButtonGroup(tr("Flow control"),this ); |
39 | m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); | 39 | m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); |
40 | m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); | 40 | m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); |
41 | 41 | ||
42 | m_groupParity = new QButtonGroup(tr("Parity"), this ); | 42 | m_groupParity = new QButtonGroup(tr("Parity"), this ); |
43 | m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); | 43 | m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); |
44 | m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); | 44 | m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); |
45 | 45 | ||
46 | m_lroot = new QVBoxLayout(this ); | 46 | m_lroot = new QVBoxLayout(this ); |
47 | m_lroot->add(m_speedLabel ); | 47 | m_lroot->add(m_speedLabel ); |
48 | m_lroot->add(m_speedBox ); | 48 | m_lroot->add(m_speedBox ); |
49 | m_lroot->setStretchFactor(m_speedLabel, 1); | 49 | m_lroot->setStretchFactor(m_speedLabel, 1); |
50 | m_lroot->setStretchFactor(m_speedBox, 1 ); | 50 | m_lroot->setStretchFactor(m_speedBox, 1 ); |
51 | 51 | ||
52 | m_hbox = new QHBoxLayout(m_groupFlow, 2 ); | 52 | m_hbox = new QHBoxLayout(m_groupFlow, 2 ); |
53 | m_hbox->add(m_flowHw ); | 53 | m_hbox->add(m_flowHw ); |
54 | m_hbox->add(m_flowSw ); | 54 | m_hbox->add(m_flowSw ); |
55 | m_lroot->add(m_groupFlow ); | 55 | m_lroot->add(m_groupFlow ); |
56 | m_lroot->setStretchFactor(m_groupFlow, 2 ); | 56 | m_lroot->setStretchFactor(m_groupFlow, 2 ); |
57 | 57 | ||
58 | m_hboxPar = new QHBoxLayout( m_groupParity, 2 ); | 58 | m_hboxPar = new QHBoxLayout( m_groupParity, 2 ); |
59 | m_hboxPar->add(m_parityOdd ); | 59 | m_hboxPar->add(m_parityOdd ); |
60 | m_hboxPar->add(m_parityEven ); | 60 | m_hboxPar->add(m_parityEven ); |
61 | m_lroot->add(m_groupParity ); | 61 | m_lroot->add(m_groupParity ); |
62 | m_lroot->setStretchFactor(m_groupParity, 2 ); | 62 | m_lroot->setStretchFactor(m_groupParity, 2 ); |
63 | 63 | ||
64 | // profiles | 64 | // profiles |
65 | m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); | 65 | m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); |
66 | m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); | 66 | m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); |
67 | m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); | 67 | m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); |
68 | m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 ); | 68 | m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 ); |
69 | m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 ); | 69 | m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 ); |
70 | }; | 70 | }; |
71 | IOLayerBase::~IOLayerBase() { | 71 | IOLayerBase::~IOLayerBase() { |
72 | 72 | ||
73 | } | 73 | } |
74 | void IOLayerBase::setFlow( Flow flo ) { | 74 | void IOLayerBase::setFlow( Flow flo ) { |
75 | switch ( flo ) { | 75 | switch ( flo ) { |
76 | case Software: | 76 | case Software: |
77 | m_flowSw->setChecked( true ); | 77 | m_flowSw->setChecked( true ); |
78 | break; | 78 | break; |
79 | case Hardware: | 79 | case Hardware: |
80 | m_flowHw->setChecked( true ); | 80 | m_flowHw->setChecked( true ); |
81 | break; | 81 | break; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | void IOLayerBase::setParity( Parity par ) { | 84 | void IOLayerBase::setParity( Parity par ) { |
85 | switch( par ) { | 85 | switch( par ) { |
86 | case Odd: | 86 | case Odd: |
87 | m_parityOdd->setChecked( true ); | 87 | m_parityOdd->setChecked( true ); |
88 | break; | 88 | break; |
89 | case Even: | 89 | case Even: |
90 | m_parityEven->setChecked( true ); | 90 | m_parityEven->setChecked( true ); |
91 | break; | 91 | break; |
92 | } | 92 | } |
93 | } | 93 | } |
94 | void IOLayerBase::setSpeed( Speed sp ) { | 94 | void IOLayerBase::setSpeed( Speed sp ) { |
95 | int index; | 95 | int index; |
96 | switch( sp ) { | 96 | switch( sp ) { |
97 | case Baud_115200: | 97 | case Baud_115200: |
98 | index = id_baud_115200; | 98 | index = id_baud_115200; |
99 | break; | 99 | break; |
100 | case Baud_57600: | 100 | case Baud_57600: |
101 | index = id_baud_57600; | 101 | index = id_baud_57600; |
102 | break; | 102 | break; |
103 | case Baud_38400: | 103 | case Baud_38400: |
104 | index = id_baud_38400; | 104 | index = id_baud_38400; |
105 | break; | 105 | break; |
106 | case Baud_19200: | 106 | case Baud_19200: |
107 | index = id_baud_19200; | 107 | index = id_baud_19200; |
108 | break; | 108 | break; |
109 | case Baud_9600: | 109 | case Baud_9600: |
110 | index = id_baud_9600; | 110 | index = id_baud_9600; |
111 | break; | 111 | break; |
112 | } | 112 | } |
113 | m_speedBox->setCurrentItem(index ); | 113 | m_speedBox->setCurrentItem(index ); |
114 | } | 114 | } |
115 | IOLayerBase::Flow IOLayerBase::flow()const { | 115 | IOLayerBase::Flow IOLayerBase::flow()const { |
116 | return Hardware; | 116 | if (m_flowHw->isChecked() ) { |
117 | qWarning("Hardware flow"); | ||
118 | return Hardware; | ||
119 | }else { | ||
120 | qWarning("Software"); | ||
121 | return Software; | ||
122 | } | ||
117 | } | 123 | } |
118 | IOLayerBase::Parity IOLayerBase::parity()const { | 124 | IOLayerBase::Parity IOLayerBase::parity()const { |
119 | return Odd; | 125 | if (m_parityOdd->isChecked() ) |
126 | return Odd; | ||
127 | else | ||
128 | return Even; | ||
129 | |||
120 | } | 130 | } |
121 | IOLayerBase::Speed IOLayerBase::speed()const{ | 131 | IOLayerBase::Speed IOLayerBase::speed()const{ |
122 | return Baud_9600; | 132 | switch( m_speedBox->currentItem() ) { |
133 | case id_baud_115200: | ||
134 | return Baud_115200; | ||
135 | break; | ||
136 | case id_baud_57600: | ||
137 | return Baud_57600; | ||
138 | break; | ||
139 | case id_baud_38400: | ||
140 | return Baud_38400; | ||
141 | break; | ||
142 | case id_baud_19200: | ||
143 | return Baud_19200; | ||
144 | break; | ||
145 | case id_baud_9600: | ||
146 | return Baud_9600; | ||
147 | break; | ||
148 | } | ||
123 | } | 149 | } |
diff --git a/noncore/apps/opie-console/iolayerbase.h b/noncore/apps/opie-console/iolayerbase.h index 7ef3f4d..151a04b 100644 --- a/noncore/apps/opie-console/iolayerbase.h +++ b/noncore/apps/opie-console/iolayerbase.h | |||
@@ -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 { Software, Hardware }; | 16 | enum Flow { Hardware, Software }; |
17 | enum Parity{ Odd, Even }; | 17 | enum Parity{ Odd =2 , Even =1 }; |
18 | enum Speed{ Baud_115200, | 18 | enum Speed{ Baud_115200, |
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; |
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/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index a414bdb..3531478 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -120,60 +120,61 @@ void MainWindow::populateProfiles() { | |||
120 | } | 120 | } |
121 | MainWindow::~MainWindow() { | 121 | MainWindow::~MainWindow() { |
122 | delete m_factory; | 122 | delete m_factory; |
123 | manager()->save(); | 123 | manager()->save(); |
124 | } | 124 | } |
125 | 125 | ||
126 | MetaFactory* MainWindow::factory() { | 126 | MetaFactory* MainWindow::factory() { |
127 | return m_factory; | 127 | return m_factory; |
128 | } | 128 | } |
129 | 129 | ||
130 | Session* MainWindow::currentSession() { | 130 | Session* MainWindow::currentSession() { |
131 | return m_curSession; | 131 | return m_curSession; |
132 | } | 132 | } |
133 | 133 | ||
134 | QList<Session> MainWindow::sessions() { | 134 | QList<Session> MainWindow::sessions() { |
135 | return m_sessions; | 135 | return m_sessions; |
136 | } | 136 | } |
137 | 137 | ||
138 | void MainWindow::slotNew() { | 138 | void MainWindow::slotNew() { |
139 | qWarning("New Connection"); | 139 | qWarning("New Connection"); |
140 | } | 140 | } |
141 | 141 | ||
142 | void MainWindow::slotConnect() { | 142 | void MainWindow::slotConnect() { |
143 | if ( currentSession() ) | 143 | if ( currentSession() ) |
144 | currentSession()->layer()->open(); | 144 | currentSession()->layer()->open(); |
145 | } | 145 | } |
146 | 146 | ||
147 | void MainWindow::slotDisconnect() { | 147 | void MainWindow::slotDisconnect() { |
148 | if ( currentSession() ) | 148 | if ( currentSession() ) |
149 | currentSession()->layer()->close(); | 149 | currentSession()->layer()->close(); |
150 | } | 150 | } |
151 | 151 | ||
152 | void MainWindow::slotTerminate() { | 152 | void MainWindow::slotTerminate() { |
153 | if ( currentSession() ) | 153 | if ( currentSession() ) |
154 | currentSession()->layer()->close(); | 154 | currentSession()->layer()->close(); |
155 | delete m_curSession; | 155 | delete m_curSession; |
156 | m_curSession = 0l; | 156 | m_curSession = 0l; |
157 | /* FIXME move to the next session */ | 157 | /* FIXME move to the next session */ |
158 | } | 158 | } |
159 | 159 | ||
160 | void MainWindow::slotConfigure() { | 160 | void MainWindow::slotConfigure() { |
161 | qWarning("configure"); | 161 | qWarning("configure"); |
162 | ConfigDialog conf( manager()->all(), factory() ); | 162 | ConfigDialog conf( manager()->all(), factory() ); |
163 | conf.showMaximized(); | 163 | conf.showMaximized(); |
164 | 164 | ||
165 | int ret = conf.exec(); | 165 | int ret = conf.exec(); |
166 | 166 | ||
167 | if ( QDialog::Accepted == ret ) { | 167 | if ( QDialog::Accepted == ret ) { |
168 | qWarning("conf %d", conf.list().count() ); | ||
168 | manager()->setProfiles( conf.list() ); | 169 | manager()->setProfiles( conf.list() ); |
169 | populateProfiles(); | 170 | populateProfiles(); |
170 | } | 171 | } |
171 | } | 172 | } |
172 | 173 | ||
173 | void MainWindow::slotClose() { | 174 | void MainWindow::slotClose() { |
174 | } | 175 | } |
175 | 176 | ||
176 | void MainWindow::slotProfile( int ) { | 177 | void MainWindow::slotProfile( int ) { |
177 | 178 | ||
178 | 179 | ||
179 | } | 180 | } |
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index 9e25e8f..ea6d759 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro | |||
@@ -1,61 +1,63 @@ | |||
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 \ |
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 | 31 | ||
31 | SOURCES = io_layer.cpp io_serial.cpp \ | 32 | SOURCES = io_layer.cpp io_serial.cpp \ |
32 | file_layer.cpp sz_transfer.cpp \ | 33 | file_layer.cpp sz_transfer.cpp \ |
33 | main.cpp \ | 34 | main.cpp \ |
34 | metafactory.cpp \ | 35 | metafactory.cpp \ |
35 | session.cpp \ | 36 | session.cpp \ |
36 | mainwindow.cpp \ | 37 | mainwindow.cpp \ |
37 | profile.cpp \ | 38 | profile.cpp \ |
38 | profileconfig.cpp \ | 39 | profileconfig.cpp \ |
39 | profilemanager.cpp \ | 40 | profilemanager.cpp \ |
40 | tabwidget.cpp \ | 41 | tabwidget.cpp \ |
41 | configdialog.cpp \ | 42 | configdialog.cpp \ |
42 | emulation_layer.cpp \ | 43 | emulation_layer.cpp \ |
43 | widget.cpp \ | 44 | widget.cpp \ |
44 | vt102emulation.cpp \ | 45 | vt102emulation.cpp \ |
45 | history.cpp \ | 46 | history.cpp \ |
46 | screen.cpp \ | 47 | screen.cpp \ |
47 | keytrans.cpp \ | 48 | keytrans.cpp \ |
48 | widget_layer.cpp \ | 49 | widget_layer.cpp \ |
49 | transferdialog.cpp \ | 50 | transferdialog.cpp \ |
50 | profiledialogwidget.cpp \ | 51 | profiledialogwidget.cpp \ |
51 | profileeditordialog.cpp \ | 52 | profileeditordialog.cpp \ |
52 | default.cpp \ | 53 | default.cpp \ |
53 | terminalwidget.cpp \ | 54 | terminalwidget.cpp \ |
54 | iolayerbase.cpp | 55 | iolayerbase.cpp \ |
56 | serialconfigwidget.cpp | ||
55 | 57 | ||
56 | INTERFACES = configurebase.ui editbase.ui | 58 | INTERFACES = configurebase.ui editbase.ui |
57 | INCLUDEPATH += $(OPIEDIR)/include | 59 | INCLUDEPATH += $(OPIEDIR)/include |
58 | DEPENDPATH += $(OPIEDIR)/include | 60 | DEPENDPATH += $(OPIEDIR)/include |
59 | LIBS += -lqpe -lopie | 61 | LIBS += -lqpe -lopie |
60 | TARGET = opie-console | 62 | TARGET = opie-console |
61 | 63 | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index c5c6248..faf9c39 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -133,65 +133,67 @@ ProfileEditorDialog::~ProfileEditorDialog() { | |||
133 | void ProfileEditorDialog::accept() | 133 | void ProfileEditorDialog::accept() |
134 | { | 134 | { |
135 | if(profName().isEmpty()) | 135 | if(profName().isEmpty()) |
136 | { | 136 | { |
137 | QMessageBox::information(this, | 137 | QMessageBox::information(this, |
138 | QObject::tr("Invalid profile"), | 138 | QObject::tr("Invalid profile"), |
139 | QObject::tr("Please enter a profile name.")); | 139 | QObject::tr("Please enter a profile name.")); |
140 | return; | 140 | return; |
141 | } | 141 | } |
142 | // Save profile and plugin profile | 142 | // Save profile and plugin profile |
143 | //if(plugin_plugin) plugin_plugin->save(); | 143 | //if(plugin_plugin) plugin_plugin->save(); |
144 | 144 | ||
145 | // Save general values | 145 | // Save general values |
146 | m_prof.setName(profName()); | 146 | m_prof.setName(profName()); |
147 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); | 147 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); |
148 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); | 148 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); |
149 | qWarning("Term %s %s", m_fact->internal(m_termCmb->currentText() ).data(), | 149 | qWarning("Term %s %s", m_fact->internal(m_termCmb->currentText() ).data(), |
150 | m_termCmb->currentText().latin1() ); | 150 | m_termCmb->currentText().latin1() ); |
151 | 151 | ||
152 | if (m_con ) | 152 | if (m_con ) |
153 | m_con->save( m_prof ); | 153 | m_con->save( m_prof ); |
154 | if (m_term ) | 154 | if (m_term ) |
155 | m_term->save( m_prof ); | 155 | m_term->save( m_prof ); |
156 | 156 | ||
157 | QDialog::accept(); | 157 | QDialog::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_layCon->addWidget( m_con ); | 183 | m_layCon->addWidget( m_con ); |
184 | } | ||
183 | } | 185 | } |
184 | /* | 186 | /* |
185 | * we need to switch the widget | 187 | * we need to switch the widget |
186 | */ | 188 | */ |
187 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { | 189 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { |
188 | delete m_term; | 190 | delete m_term; |
189 | m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); | 191 | m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); |
190 | qWarning("past"); | 192 | qWarning("past"); |
191 | 193 | ||
192 | if (m_term) { | 194 | if (m_term) { |
193 | m_term->load(m_prof ); | 195 | m_term->load(m_prof ); |
194 | m_layTerm->addWidget( m_term ); | 196 | m_layTerm->addWidget( m_term ); |
195 | } | 197 | } |
196 | } | 198 | } |
197 | 199 | ||
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp index 6ad08b5..e66ebcc 100644 --- a/noncore/apps/opie-console/profilemanager.cpp +++ b/noncore/apps/opie-console/profilemanager.cpp | |||
@@ -1,95 +1,100 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | |||
4 | #include <qfile.h> | ||
1 | 5 | ||
2 | #include <qpe/config.h> | 6 | #include <qpe/config.h> |
3 | 7 | ||
4 | #include "metafactory.h" | 8 | #include "metafactory.h" |
5 | #include "profileconfig.h" | 9 | #include "profileconfig.h" |
6 | #include "profilemanager.h" | 10 | #include "profilemanager.h" |
7 | 11 | ||
8 | ProfileManager::ProfileManager( MetaFactory* fact ) | 12 | ProfileManager::ProfileManager( MetaFactory* fact ) |
9 | : m_fact( fact ) | 13 | : m_fact( fact ) |
10 | { | 14 | { |
11 | 15 | ||
12 | } | 16 | } |
13 | ProfileManager::~ProfileManager() { | 17 | ProfileManager::~ProfileManager() { |
14 | 18 | ||
15 | } | 19 | } |
16 | void ProfileManager::load() { | 20 | void ProfileManager::load() { |
17 | m_list.clear(); | 21 | m_list.clear(); |
18 | qWarning("load"); | 22 | qWarning("load"); |
19 | ProfileConfig conf("opie-console-profiles"); | 23 | ProfileConfig conf("opie-console-profiles"); |
20 | QStringList groups = conf.groups(); | 24 | QStringList groups = conf.groups(); |
21 | QStringList::Iterator it; | 25 | QStringList::Iterator it; |
22 | 26 | ||
23 | /* | 27 | /* |
24 | * for each profile | 28 | * for each profile |
25 | */ | 29 | */ |
26 | for ( it = groups.begin(); it != groups.end(); ++it ) { | 30 | for ( it = groups.begin(); it != groups.end(); ++it ) { |
27 | qWarning("group " + (*it) ); | 31 | qWarning("group " + (*it) ); |
28 | conf.setGroup( (*it) ); | 32 | conf.setGroup( (*it) ); |
29 | Profile prof; | 33 | Profile prof; |
30 | prof.setName( conf.readEntry("name") ); | 34 | prof.setName( conf.readEntry("name") ); |
31 | prof.setIOLayer( conf.readEntry("iolayer").utf8() ); | 35 | prof.setIOLayer( conf.readEntry("iolayer").utf8() ); |
32 | prof.setTerminalName( conf.readEntry("term").utf8() ); | 36 | prof.setTerminalName( conf.readEntry("term").utf8() ); |
37 | qWarning(" %s %s", conf.readEntry("iolayer").latin1(), prof.ioLayerName().data() ); | ||
33 | prof.setBackground( conf.readNumEntry("back") ); | 38 | prof.setBackground( conf.readNumEntry("back") ); |
34 | prof.setForeground( conf.readNumEntry("fore") ); | 39 | prof.setForeground( conf.readNumEntry("fore") ); |
35 | prof.setTerminal( conf.readNumEntry("terminal") ); | 40 | prof.setTerminal( conf.readNumEntry("terminal") ); |
36 | prof.setConf( conf.items( (*it) ) ); | 41 | prof.setConf( conf.items( (*it) ) ); |
37 | 42 | ||
38 | /* now add it */ | 43 | /* now add it */ |
39 | m_list.append( prof ); | 44 | m_list.append( prof ); |
40 | } | 45 | } |
41 | 46 | ||
42 | } | 47 | } |
43 | void ProfileManager::clear() { | 48 | void ProfileManager::clear() { |
44 | m_list.clear(); | 49 | m_list.clear(); |
45 | } | 50 | } |
46 | Profile::ValueList ProfileManager::all()const { | 51 | Profile::ValueList ProfileManager::all()const { |
47 | return m_list; | 52 | return m_list; |
48 | } | 53 | } |
49 | Session* ProfileManager::fromProfile( const Profile& prof) { | 54 | Session* ProfileManager::fromProfile( const Profile& prof) { |
50 | Session* session = new Session(); | 55 | Session* session = new Session(); |
51 | session->setName( prof.name() ); | 56 | session->setName( prof.name() ); |
52 | session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(), | 57 | session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(), |
53 | prof) ); | 58 | prof) ); |
54 | /* | 59 | /* |
55 | * FIXME | 60 | * FIXME |
56 | * load emulation | 61 | * load emulation |
57 | * load widget? | 62 | * load widget? |
58 | * set colors + fonts | 63 | * set colors + fonts |
59 | */ | 64 | */ |
60 | return session; | 65 | return session; |
61 | } | 66 | } |
62 | void ProfileManager::save( ) { | 67 | void ProfileManager::save( ) { |
68 | QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) ); | ||
63 | ProfileConfig conf("opie-console-profiles"); | 69 | ProfileConfig conf("opie-console-profiles"); |
64 | conf.clearAll(); | ||
65 | Profile::ValueList::Iterator it; | 70 | Profile::ValueList::Iterator it; |
66 | for (it = m_list.begin(); it != m_list.end(); ++it ) { | 71 | for (it = m_list.begin(); it != m_list.end(); ++it ) { |
67 | conf.setGroup( (*it).name() ); | 72 | conf.setGroup( (*it).name() ); |
68 | conf.writeEntry( "name", (*it).name() ); | 73 | conf.writeEntry( "name", (*it).name() ); |
69 | conf.writeEntry( "ioplayer", QString::fromUtf8( (*it).ioLayerName() ) ); | 74 | conf.writeEntry( "iolayer", QString::fromUtf8( (*it).ioLayerName() ) ); |
70 | conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) ); | 75 | conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) ); |
71 | conf.writeEntry( "back", (*it).background() ); | 76 | conf.writeEntry( "back", (*it).background() ); |
72 | conf.writeEntry( "fore", (*it).foreground() ); | 77 | conf.writeEntry( "fore", (*it).foreground() ); |
73 | conf.writeEntry( "terminal", (*it).terminal() ); | 78 | conf.writeEntry( "terminal", (*it).terminal() ); |
74 | /* now the config stuff */ | 79 | /* now the config stuff */ |
75 | QMap<QString, QString> map = (*it).conf(); | 80 | QMap<QString, QString> map = (*it).conf(); |
76 | QMap<QString, QString>::Iterator it; | 81 | QMap<QString, QString>::Iterator it; |
77 | for ( it = map.begin(); it != map.end(); ++it ) { | 82 | for ( it = map.begin(); it != map.end(); ++it ) { |
78 | conf.writeEntry( it.key(), it.data() ); | 83 | conf.writeEntry( it.key(), it.data() ); |
79 | } | 84 | } |
80 | } | 85 | } |
81 | } | 86 | } |
82 | void ProfileManager::setProfiles( const Profile::ValueList& list ) { | 87 | void ProfileManager::setProfiles( const Profile::ValueList& list ) { |
83 | m_list = list; | 88 | m_list = list; |
84 | }; | 89 | }; |
85 | Profile ProfileManager::profile( const QString& name )const { | 90 | Profile ProfileManager::profile( const QString& name )const { |
86 | Profile prof; | 91 | Profile prof; |
87 | Profile::ValueList::ConstIterator it; | 92 | Profile::ValueList::ConstIterator it; |
88 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 93 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
89 | if ( name == (*it).name() ) { | 94 | if ( name == (*it).name() ) { |
90 | prof = (*it); | 95 | prof = (*it); |
91 | break; | 96 | break; |
92 | } | 97 | } |
93 | } | 98 | } |
94 | return prof; | 99 | return prof; |
95 | } | 100 | } |
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp new file mode 100644 index 0000000..a427302 --- a/dev/null +++ b/noncore/apps/opie-console/serialconfigwidget.cpp | |||
@@ -0,0 +1,135 @@ | |||
1 | #include <qlabel.h> | ||
2 | #include <qlayout.h> | ||
3 | #include <qcombobox.h> | ||
4 | |||
5 | #include "iolayerbase.h" | ||
6 | #include "serialconfigwidget.h" | ||
7 | |||
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 | SerialConfigWidget::SerialConfigWidget( const QString& name, | ||
25 | QWidget* parent, | ||
26 | const char* na ) | ||
27 | : ProfileDialogConnectionWidget( name, parent, na ) { | ||
28 | |||
29 | m_lay = new QVBoxLayout(this ); | ||
30 | m_device = new QLabel(tr("Device"), this ); | ||
31 | m_deviceCmb = new QComboBox(this ); | ||
32 | m_deviceCmb->setEditable( TRUE ); | ||
33 | |||
34 | m_base = new IOLayerBase(this, "base"); | ||
35 | |||
36 | m_lay->addWidget( m_device ); | ||
37 | m_lay->addWidget( m_deviceCmb ); | ||
38 | m_lay->addWidget( m_base ); | ||
39 | |||
40 | m_deviceCmb->insertItem( "/dev/ttyS0" ); | ||
41 | m_deviceCmb->insertItem( "/dev/ttyS1" ); | ||
42 | m_deviceCmb->insertItem( "/dev/ttySA0"); | ||
43 | m_deviceCmb->insertItem( "/dev/ttySA1"); | ||
44 | |||
45 | } | ||
46 | SerialConfigWidget::~SerialConfigWidget() { | ||
47 | |||
48 | } | ||
49 | void SerialConfigWidget::load( const Profile& prof ) { | ||
50 | int rad_flow = prof.readNumEntry("Flow"); | ||
51 | int rad_parity = prof.readNumEntry("Parity"); | ||
52 | int speed = prof.readNumEntry("Speed"); | ||
53 | |||
54 | if (rad_flow == 0) | ||
55 | m_base->setFlow( IOLayerBase::Hardware ); | ||
56 | else | ||
57 | m_base->setFlow( IOLayerBase::Software ); | ||
58 | |||
59 | if (rad_parity == 1) | ||
60 | m_base->setParity( IOLayerBase::Even ); | ||
61 | else | ||
62 | m_base->setParity( IOLayerBase::Odd ); | ||
63 | |||
64 | switch( speed ) { | ||
65 | case 115200: | ||
66 | m_base->setSpeed(IOLayerBase::Baud_115200 ); | ||
67 | break; | ||
68 | case 57600: | ||
69 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | ||
70 | break; | ||
71 | case 38400: | ||
72 | m_base->setSpeed(IOLayerBase::Baud_38400 ); | ||
73 | break; | ||
74 | case 19200: | ||
75 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | ||
76 | break; | ||
77 | case 9600: | ||
78 | default: | ||
79 | m_base->setSpeed(IOLayerBase::Baud_9600 ); | ||
80 | break; | ||
81 | } | ||
82 | |||
83 | if ( prof.readEntry("Device").isEmpty() ) return; | ||
84 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); | ||
85 | |||
86 | } | ||
87 | /* | ||
88 | * save speed, | ||
89 | * flow, | ||
90 | * parity | ||
91 | */ | ||
92 | void SerialConfigWidget::save( Profile& prof ) { | ||
93 | int flow, parity, speed; | ||
94 | prof.writeEntry("Device", m_deviceCmb->currentText() ); | ||
95 | |||
96 | switch( m_base->flow() ) { | ||
97 | case IOLayerBase::Software: | ||
98 | flow = 1; | ||
99 | break; | ||
100 | case IOLayerBase::Hardware: | ||
101 | flow = 0; | ||
102 | break; | ||
103 | } | ||
104 | |||
105 | switch( m_base->parity() ) { | ||
106 | case IOLayerBase::Odd: | ||
107 | parity = 2; | ||
108 | break; | ||
109 | case IOLayerBase::Even: | ||
110 | parity = 1; | ||
111 | break; | ||
112 | } | ||
113 | |||
114 | switch( m_base->speed() ) { | ||
115 | case IOLayerBase::Baud_115200: | ||
116 | speed = 115200; | ||
117 | break; | ||
118 | case IOLayerBase::Baud_57600: | ||
119 | speed = 57600; | ||
120 | break; | ||
121 | case IOLayerBase::Baud_38400: | ||
122 | speed = 38400; | ||
123 | break; | ||
124 | case IOLayerBase::Baud_19200: | ||
125 | speed = 19200; | ||
126 | break; | ||
127 | case IOLayerBase::Baud_9600: | ||
128 | speed = 9600; | ||
129 | break; | ||
130 | } | ||
131 | |||
132 | prof.writeEntry("Flow", flow); | ||
133 | prof.writeEntry("Parity", parity); | ||
134 | prof.writeEntry("Speed", speed); | ||
135 | } | ||
diff --git a/noncore/apps/opie-console/serialconfigwidget.h b/noncore/apps/opie-console/serialconfigwidget.h new file mode 100644 index 0000000..8b5c8aa --- a/dev/null +++ b/noncore/apps/opie-console/serialconfigwidget.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef OPIE_SERIAL_CONFIG_WIDGET_H | ||
2 | #define OPIE_SERIAL_CONFIG_WIDGET_H | ||
3 | |||
4 | #include "profiledialogwidget.h" | ||
5 | |||
6 | class QVBoxLayout; | ||
7 | class QLabel; | ||
8 | class QComboBox; | ||
9 | class IOLayerBase; | ||
10 | class SerialConfigWidget : public ProfileDialogConnectionWidget { | ||
11 | Q_OBJECT | ||
12 | public: | ||
13 | SerialConfigWidget( const QString& name, QWidget* parent, const char* name = 0l ); | ||
14 | ~SerialConfigWidget(); | ||
15 | |||
16 | void load( const Profile& ); | ||
17 | void save( Profile& ); | ||
18 | private: | ||
19 | QVBoxLayout* m_lay; | ||
20 | QLabel* m_device; | ||
21 | QComboBox* m_deviceCmb; | ||
22 | IOLayerBase* m_base; | ||
23 | |||
24 | }; | ||
25 | |||
26 | |||
27 | #endif | ||