author | harlekin <harlekin> | 2004-04-22 18:58:37 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-04-22 18:58:37 (UTC) |
commit | 5c6499c56cd5c00603634546e6ba8c4d9da9741d (patch) (unidiff) | |
tree | 3ad98bb1a0150b1dd69c79fd58e6e59ce8556e51 | |
parent | 53d6c4b8bfcb119635b26b78dee0ae4be8490b90 (diff) | |
download | opie-5c6499c56cd5c00603634546e6ba8c4d9da9741d.zip opie-5c6499c56cd5c00603634546e6ba8c4d9da9741d.tar.gz opie-5c6499c56cd5c00603634546e6ba8c4d9da9741d.tar.bz2 |
2400 and 4800 baud added, also free font selection
-rw-r--r-- | noncore/apps/opie-console/btconfigwidget.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.cpp | 19 | ||||
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/irdaconfigwidget.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/main.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-console/serialconfigwidget.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/terminalwidget.cpp | 70 | ||||
-rw-r--r-- | noncore/apps/opie-console/terminalwidget.h | 6 |
11 files changed, 128 insertions, 41 deletions
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp index 0ac337f..e1ff18a 100644 --- a/noncore/apps/opie-console/btconfigwidget.cpp +++ b/noncore/apps/opie-console/btconfigwidget.cpp | |||
@@ -86,32 +86,38 @@ void BTConfigWidget::load( const Profile& prof ) { | |||
86 | m_base->setParity( IOLayerBase::NonePar ); | 86 | m_base->setParity( IOLayerBase::NonePar ); |
87 | } | 87 | } |
88 | 88 | ||
89 | switch( speed ) { | 89 | switch( speed ) { |
90 | case 115200: | 90 | case 115200: |
91 | m_base->setSpeed(IOLayerBase::Baud_115200 ); | 91 | m_base->setSpeed(IOLayerBase::Baud_115200 ); |
92 | break; | 92 | break; |
93 | case 57600: | 93 | case 57600: |
94 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | 94 | m_base->setSpeed( IOLayerBase::Baud_57600 ); |
95 | break; | 95 | break; |
96 | case 38400: | 96 | case 38400: |
97 | m_base->setSpeed(IOLayerBase::Baud_38400 ); | 97 | m_base->setSpeed(IOLayerBase::Baud_38400 ); |
98 | break; | 98 | break; |
99 | case 19200: | 99 | case 19200: |
100 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | 100 | m_base->setSpeed( IOLayerBase::Baud_19200 ); |
101 | break; | 101 | break; |
102 | case 4800: | ||
103 | m_base->setSpeed( IOLayerBase::Baud_4800 ); | ||
104 | break; | ||
105 | case 2400: | ||
106 | m_base->setSpeed( IOLayerBase::Baud_2400 ); | ||
107 | break; | ||
102 | case 9600: | 108 | case 9600: |
103 | default: | 109 | default: |
104 | m_base->setSpeed(IOLayerBase::Baud_9600 ); | 110 | m_base->setSpeed(IOLayerBase::Baud_9600 ); |
105 | break; | 111 | break; |
106 | } | 112 | } |
107 | 113 | ||
108 | if ( prof.readEntry("Device").isEmpty() ) return; | 114 | if ( prof.readEntry("Device").isEmpty() ) return; |
109 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); | 115 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); |
110 | 116 | ||
111 | } | 117 | } |
112 | /* | 118 | /* |
113 | * save speed, | 119 | * save speed, |
114 | * flow, | 120 | * flow, |
115 | * parity | 121 | * parity |
116 | */ | 122 | */ |
117 | void BTConfigWidget::save( Profile& prof ) { | 123 | void BTConfigWidget::save( Profile& prof ) { |
@@ -144,32 +150,38 @@ void BTConfigWidget::save( Profile& prof ) { | |||
144 | break; | 150 | break; |
145 | } | 151 | } |
146 | 152 | ||
147 | switch( m_base->speed() ) { | 153 | switch( m_base->speed() ) { |
148 | case IOLayerBase::Baud_115200: | 154 | case IOLayerBase::Baud_115200: |
149 | speed = 115200; | 155 | speed = 115200; |
150 | break; | 156 | break; |
151 | case IOLayerBase::Baud_57600: | 157 | case IOLayerBase::Baud_57600: |
152 | speed = 57600; | 158 | speed = 57600; |
153 | break; | 159 | break; |
154 | case IOLayerBase::Baud_38400: | 160 | case IOLayerBase::Baud_38400: |
155 | speed = 38400; | 161 | speed = 38400; |
156 | break; | 162 | break; |
157 | case IOLayerBase::Baud_19200: | 163 | case IOLayerBase::Baud_19200: |
158 | speed = 19200; | 164 | speed = 19200; |
159 | break; | 165 | break; |
166 | case IOLayerBase::Baud_4800: | ||
167 | speed = 4800; | ||
168 | break; | ||
169 | case IOLayerBase::Baud_2400: | ||
170 | speed = 2400; | ||
171 | break; | ||
160 | default: | 172 | default: |
161 | case IOLayerBase::Baud_9600: | 173 | case IOLayerBase::Baud_9600: |
162 | speed = 9600; | 174 | speed = 9600; |
163 | break; | 175 | break; |
164 | } | 176 | } |
165 | 177 | ||
166 | prof.writeEntry("Flow", flow); | 178 | prof.writeEntry("Flow", flow); |
167 | prof.writeEntry("Parity", parity); | 179 | prof.writeEntry("Parity", parity); |
168 | prof.writeEntry("Speed", speed); | 180 | prof.writeEntry("Speed", speed); |
169 | prof.writeEntry("Mac", m_mac->text() ); | 181 | prof.writeEntry("Mac", m_mac->text() ); |
170 | } | 182 | } |
171 | 183 | ||
172 | void BTConfigWidget::slotMacRadio( bool on ) { | 184 | void BTConfigWidget::slotMacRadio( bool on ) { |
173 | if ( on ) { | 185 | if ( on ) { |
174 | m_devRadio->setChecked( false ); | 186 | m_devRadio->setChecked( false ); |
175 | m_deviceCmb->setEnabled( false ); | 187 | m_deviceCmb->setEnabled( false ); |
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 89b70c6..1a0613f 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp | |||
@@ -28,33 +28,35 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c | |||
28 | load( prof ); | 28 | load( prof ); |
29 | 29 | ||
30 | 30 | ||
31 | 31 | ||
32 | } | 32 | } |
33 | TEmulation* EmulationHandler::emulation() { | 33 | TEmulation* EmulationHandler::emulation() { |
34 | return m_teEmu; | 34 | return m_teEmu; |
35 | } | 35 | } |
36 | EmulationHandler::~EmulationHandler() { | 36 | EmulationHandler::~EmulationHandler() { |
37 | if (isRecording()) | 37 | if (isRecording()) |
38 | clearScript(); | 38 | clearScript(); |
39 | delete m_teEmu; | 39 | delete m_teEmu; |
40 | delete m_teWid; | 40 | delete m_teWid; |
41 | } | 41 | } |
42 | 42 | ||
43 | void EmulationHandler::load( const Profile& prof) { | 43 | void EmulationHandler::load( const Profile& prof) { |
44 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); | 44 | |
45 | // m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); | ||
46 | m_teWid->setVTFont( QFont( prof.readEntry("Font"), prof.readNumEntry( "FontSize" ), QFont::Normal ) ); | ||
45 | int num = prof.readNumEntry("Color"); | 47 | int num = prof.readNumEntry("Color"); |
46 | setColor( foreColor(num), backColor(num) ); | 48 | setColor( foreColor(num), backColor(num) ); |
47 | m_teWid->setBackgroundColor(backColor(num) ); | 49 | m_teWid->setBackgroundColor(backColor(num) ); |
48 | 50 | ||
49 | int term = prof.readNumEntry("Terminal", 0) ; | 51 | int term = prof.readNumEntry("Terminal", 0) ; |
50 | switch(term) { | 52 | switch(term) { |
51 | default: | 53 | default: |
52 | case Profile::VT102: | 54 | case Profile::VT102: |
53 | case Profile::VT100: | 55 | case Profile::VT100: |
54 | m_teEmu->setKeytrans("vt100.keytab"); | 56 | m_teEmu->setKeytrans("vt100.keytab"); |
55 | break; | 57 | break; |
56 | case Profile::Linux: | 58 | case Profile::Linux: |
57 | m_teEmu->setKeytrans("linux.keytab"); | 59 | m_teEmu->setKeytrans("linux.keytab"); |
58 | break; | 60 | break; |
59 | case Profile::XTerm: | 61 | case Profile::XTerm: |
60 | m_teEmu->setKeytrans("default.Keytab"); | 62 | m_teEmu->setKeytrans("default.Keytab"); |
@@ -117,61 +119,61 @@ QFont EmulationHandler::font( int id ) { | |||
117 | font.setFixedPitch(TRUE ); | 119 | font.setFixedPitch(TRUE ); |
118 | return font; | 120 | return font; |
119 | } | 121 | } |
120 | QColor EmulationHandler::foreColor(int col) { | 122 | QColor EmulationHandler::foreColor(int col) { |
121 | QColor co; | 123 | QColor co; |
122 | /* we need to switch it */ | 124 | /* we need to switch it */ |
123 | switch( col ) { | 125 | switch( col ) { |
124 | default: | 126 | default: |
125 | case Profile::White: | 127 | case Profile::White: |
126 | /* color is black */ | 128 | /* color is black */ |
127 | co = Qt::white; | 129 | co = Qt::white; |
128 | break; | 130 | break; |
129 | case Profile::Black: | 131 | case Profile::Black: |
130 | co = Qt::black; | 132 | co = Qt::black; |
131 | break; | 133 | break; |
132 | case Profile::Green: | 134 | case Profile::Green: |
133 | owarn << "Foreground green" << oendl; | 135 | owarn << "Foreground green" << oendl; |
134 | co = Qt::green; | 136 | co = Qt::green; |
135 | break; | 137 | break; |
136 | case Profile::Orange: | 138 | case Profile::Orange: |
137 | owarn << "Foreground orange" << oendl; | 139 | owarn << "Foreground orange" << oendl; |
138 | co.setRgb( 231, 184, 98 ); | 140 | co.setRgb( 231, 184, 98 ); |
139 | break; | 141 | break; |
140 | } | 142 | } |
141 | 143 | ||
142 | return co; | 144 | return co; |
143 | } | 145 | } |
144 | QColor EmulationHandler::backColor(int col ) { | 146 | QColor EmulationHandler::backColor(int col ) { |
145 | QColor co; | 147 | QColor co; |
146 | /* we need to switch it */ | 148 | /* we need to switch it */ |
147 | switch( col ) { | 149 | switch( col ) { |
148 | default: | 150 | default: |
149 | case Profile::White: | 151 | case Profile::White: |
150 | /* color is white */ | 152 | /* color is white */ |
151 | co = Qt::black; | 153 | co = Qt::black; |
152 | break; | 154 | break; |
153 | case Profile::Black: | 155 | case Profile::Black: |
154 | co = Qt::white; | 156 | co = Qt::white; |
155 | break; | 157 | break; |
156 | case Profile::Green: | 158 | case Profile::Green: |
157 | owarn << "Background black" << oendl; | 159 | owarn << "Background black" << oendl; |
158 | co = Qt::black; | 160 | co = Qt::black; |
159 | break; | 161 | break; |
160 | case Profile::Orange: | 162 | case Profile::Orange: |
161 | owarn << "Background black" << oendl; | 163 | owarn << "Background black" << oendl; |
162 | co = Qt::black; | 164 | co = Qt::black; |
163 | break; | 165 | break; |
164 | } | 166 | } |
165 | 167 | ||
166 | return co; | 168 | return co; |
167 | } | 169 | } |
168 | 170 | ||
169 | QPushButton* EmulationHandler::cornerButton() { | 171 | QPushButton* EmulationHandler::cornerButton() { |
170 | return m_teWid->cornerButton(); | 172 | return m_teWid->cornerButton(); |
171 | } | 173 | } |
172 | 174 | ||
173 | 175 | ||
174 | Script *EmulationHandler::script() { | 176 | Script *EmulationHandler::script() { |
175 | return m_script; | 177 | return m_script; |
176 | } | 178 | } |
177 | 179 | ||
diff --git a/noncore/apps/opie-console/io_serial.h b/noncore/apps/opie-console/io_serial.h index 20c1ae1..f8b04e2 100644 --- a/noncore/apps/opie-console/io_serial.h +++ b/noncore/apps/opie-console/io_serial.h | |||
@@ -26,33 +26,33 @@ public: | |||
26 | }; | 26 | }; |
27 | 27 | ||
28 | enum Flow { | 28 | enum Flow { |
29 | FlowHW = 0x01, | 29 | FlowHW = 0x01, |
30 | FlowSW = 0x02 | 30 | FlowSW = 0x02 |
31 | }; | 31 | }; |
32 | 32 | ||
33 | IOSerial(const Profile &); | 33 | IOSerial(const Profile &); |
34 | ~IOSerial(); | 34 | ~IOSerial(); |
35 | 35 | ||
36 | virtual QString identifier() const; | 36 | virtual QString identifier() const; |
37 | virtual QString name() const; | 37 | virtual QString name() const; |
38 | int rawIO() const; | 38 | int rawIO() const; |
39 | void closeRawIO (int fd ); | 39 | void closeRawIO (int fd ); |
40 | virtual QBitArray supports() const; | 40 | virtual QBitArray supports() const; |
41 | virtual bool isConnected(); | 41 | virtual bool isConnected(); |
42 | 42 | ||
43 | /*signals: | 43 | /*signals: |
44 | void received(const QByteArray &); | 44 | void received(const QByteArray &); |
45 | void error(int, const QString &); | 45 | void error(int, const QString &); |
46 | */ | 46 | */ |
47 | public slots: | 47 | public slots: |
48 | virtual void send(const QByteArray &); | 48 | virtual void send(const QByteArray &); |
49 | virtual bool open(); | 49 | virtual bool open(); |
50 | virtual void close(); | 50 | virtual void close(); |
51 | virtual void reload(const Profile &); | 51 | virtual void reload(const Profile &); |
52 | protected: | 52 | protected: |
53 | int baud(int baud) const; | 53 | int baud(int baud) const; |
54 | void internDetach(); | 54 | void internDetach(); |
55 | void internAttach(); | 55 | void internAttach(); |
56 | protected slots: | 56 | protected slots: |
57 | void dataArrived(); | 57 | void dataArrived(); |
58 | void errorOccured(); | 58 | void errorOccured(); |
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp index b434e66..0f64d6a 100644 --- a/noncore/apps/opie-console/iolayerbase.cpp +++ b/noncore/apps/opie-console/iolayerbase.cpp | |||
@@ -11,33 +11,35 @@ namespace { | |||
11 | id_parity_none, | 11 | id_parity_none, |
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 | id_flow_none, |
20 | }; | 20 | }; |
21 | 21 | ||
22 | enum SpeedIds { | 22 | enum SpeedIds { |
23 | id_baud_115200, | 23 | id_baud_115200, |
24 | id_baud_57600, | 24 | id_baud_57600, |
25 | id_baud_38400, | 25 | id_baud_38400, |
26 | id_baud_19200, | 26 | id_baud_19200, |
27 | id_baud_9600 | 27 | id_baud_9600, |
28 | id_baud_4800, | ||
29 | id_baud_2400 | ||
28 | }; | 30 | }; |
29 | 31 | ||
30 | enum DataIds { | 32 | enum DataIds { |
31 | id_data_5, | 33 | id_data_5, |
32 | id_data_6, | 34 | id_data_6, |
33 | id_data_7, | 35 | id_data_7, |
34 | id_data_8 | 36 | id_data_8 |
35 | }; | 37 | }; |
36 | 38 | ||
37 | enum StopIds { | 39 | enum StopIds { |
38 | id_stop_1, | 40 | id_stop_1, |
39 | id_stop_1_5, | 41 | id_stop_1_5, |
40 | id_stop_2 | 42 | id_stop_2 |
41 | }; | 43 | }; |
42 | 44 | ||
43 | } | 45 | } |
@@ -73,33 +75,34 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | |||
73 | 75 | ||
74 | m_lroot = new QVBoxLayout( this ); | 76 | m_lroot = new QVBoxLayout( this ); |
75 | m_lroot->add(m_speedLabel ); | 77 | m_lroot->add(m_speedLabel ); |
76 | m_lroot->add(m_speedBox ); | 78 | m_lroot->add(m_speedBox ); |
77 | m_lroot->add(m_groupFlow ); | 79 | m_lroot->add(m_groupFlow ); |
78 | m_lroot->add(m_groupParity ); | 80 | m_lroot->add(m_groupParity ); |
79 | m_lroot->add( m_groupData ); | 81 | m_lroot->add( m_groupData ); |
80 | m_lroot->add( m_groupStop ); | 82 | m_lroot->add( m_groupStop ); |
81 | m_lroot->addStretch(2); | 83 | m_lroot->addStretch(2); |
82 | 84 | ||
83 | // profiles | 85 | // profiles |
84 | m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); | 86 | m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); |
85 | m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); | 87 | m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); |
86 | m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); | 88 | m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); |
87 | m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 ); | 89 | m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 ); |
88 | m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 ); | 90 | m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 ); |
89 | 91 | m_speedBox->insertItem(tr("4800 baud"), id_baud_4800 ); | |
92 | m_speedBox->insertItem(tr("2400 baud"), id_baud_2400 ); | ||
90 | }; | 93 | }; |
91 | IOLayerBase::~IOLayerBase() { | 94 | IOLayerBase::~IOLayerBase() { |
92 | 95 | ||
93 | } | 96 | } |
94 | void IOLayerBase::setFlow( Flow flo ) { | 97 | void IOLayerBase::setFlow( Flow flo ) { |
95 | switch ( flo ) { | 98 | switch ( flo ) { |
96 | case Software: | 99 | case Software: |
97 | m_flowSw->setChecked( true ); | 100 | m_flowSw->setChecked( true ); |
98 | break; | 101 | break; |
99 | case Hardware: | 102 | case Hardware: |
100 | m_flowHw->setChecked( true ); | 103 | m_flowHw->setChecked( true ); |
101 | break; | 104 | break; |
102 | case None: | 105 | case None: |
103 | m_flowNone->setChecked( true ); | 106 | m_flowNone->setChecked( true ); |
104 | break; | 107 | break; |
105 | } | 108 | } |
@@ -120,32 +123,38 @@ void IOLayerBase::setParity( Parity par ) { | |||
120 | } | 123 | } |
121 | void IOLayerBase::setSpeed( Speed sp ) { | 124 | void IOLayerBase::setSpeed( Speed sp ) { |
122 | int index = -1; | 125 | int index = -1; |
123 | switch( sp ) { | 126 | switch( sp ) { |
124 | case Baud_115200: | 127 | case Baud_115200: |
125 | index = id_baud_115200; | 128 | index = id_baud_115200; |
126 | break; | 129 | break; |
127 | case Baud_57600: | 130 | case Baud_57600: |
128 | index = id_baud_57600; | 131 | index = id_baud_57600; |
129 | break; | 132 | break; |
130 | case Baud_38400: | 133 | case Baud_38400: |
131 | index = id_baud_38400; | 134 | index = id_baud_38400; |
132 | break; | 135 | break; |
133 | case Baud_19200: | 136 | case Baud_19200: |
134 | index = id_baud_19200; | 137 | index = id_baud_19200; |
135 | break; | 138 | break; |
139 | case Baud_4800: | ||
140 | index = id_baud_4800; | ||
141 | break; | ||
142 | case Baud_2400: | ||
143 | index = id_baud_2400; | ||
144 | break; | ||
136 | default: | 145 | default: |
137 | case Baud_9600: | 146 | case Baud_9600: |
138 | index = id_baud_9600; | 147 | index = id_baud_9600; |
139 | break; | 148 | break; |
140 | } | 149 | } |
141 | m_speedBox->setCurrentItem(index ); | 150 | m_speedBox->setCurrentItem(index ); |
142 | } | 151 | } |
143 | 152 | ||
144 | void IOLayerBase::setData( Data data ) { | 153 | void IOLayerBase::setData( Data data ) { |
145 | switch( data ) { | 154 | switch( data ) { |
146 | case Data_Five: | 155 | case Data_Five: |
147 | m_data5->setChecked( true ); | 156 | m_data5->setChecked( true ); |
148 | break; | 157 | break; |
149 | case Data_Six: | 158 | case Data_Six: |
150 | m_data6->setChecked( true ); | 159 | m_data6->setChecked( true ); |
151 | break; | 160 | break; |
@@ -195,32 +204,38 @@ IOLayerBase::Parity IOLayerBase::parity()const { | |||
195 | 204 | ||
196 | } | 205 | } |
197 | IOLayerBase::Speed IOLayerBase::speed()const{ | 206 | IOLayerBase::Speed IOLayerBase::speed()const{ |
198 | switch( m_speedBox->currentItem() ) { | 207 | switch( m_speedBox->currentItem() ) { |
199 | case id_baud_115200: | 208 | case id_baud_115200: |
200 | return Baud_115200; | 209 | return Baud_115200; |
201 | break; | 210 | break; |
202 | case id_baud_57600: | 211 | case id_baud_57600: |
203 | return Baud_57600; | 212 | return Baud_57600; |
204 | break; | 213 | break; |
205 | case id_baud_38400: | 214 | case id_baud_38400: |
206 | return Baud_38400; | 215 | return Baud_38400; |
207 | break; | 216 | break; |
208 | case id_baud_19200: | 217 | case id_baud_19200: |
209 | return Baud_19200; | 218 | return Baud_19200; |
210 | break; | 219 | break; |
220 | case id_baud_4800: | ||
221 | return Baud_4800; | ||
222 | break; | ||
223 | case id_baud_2400: | ||
224 | return Baud_2400; | ||
225 | break; | ||
211 | default: | 226 | default: |
212 | case id_baud_9600: | 227 | case id_baud_9600: |
213 | return Baud_9600; | 228 | return Baud_9600; |
214 | break; | 229 | break; |
215 | } | 230 | } |
216 | } | 231 | } |
217 | IOLayerBase::Data IOLayerBase::data()const { | 232 | IOLayerBase::Data IOLayerBase::data()const { |
218 | if ( m_data5->isChecked() ) { | 233 | if ( m_data5->isChecked() ) { |
219 | return Data_Five; | 234 | return Data_Five; |
220 | } else if ( m_data6->isChecked() ) { | 235 | } else if ( m_data6->isChecked() ) { |
221 | return Data_Six; | 236 | return Data_Six; |
222 | } else if ( m_data7->isChecked() ) { | 237 | } else if ( m_data7->isChecked() ) { |
223 | return Data_Seven; | 238 | return Data_Seven; |
224 | } else { | 239 | } else { |
225 | return Data_Eight; | 240 | return Data_Eight; |
226 | } | 241 | } |
diff --git a/noncore/apps/opie-console/iolayerbase.h b/noncore/apps/opie-console/iolayerbase.h index e1b96df..214a35c 100644 --- a/noncore/apps/opie-console/iolayerbase.h +++ b/noncore/apps/opie-console/iolayerbase.h | |||
@@ -8,33 +8,35 @@ 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 | 14 | ||
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | 16 | ||
17 | public: | 17 | public: |
18 | enum Flow { Hardware, Software, None }; | 18 | enum Flow { Hardware, Software, None }; |
19 | enum Parity{ Odd =2 , Even =1, NonePar =0 }; | 19 | enum Parity{ Odd =2 , Even =1, NonePar =0 }; |
20 | enum Speed{ Baud_115200, | 20 | enum Speed{ Baud_115200, |
21 | Baud_57600, | 21 | Baud_57600, |
22 | Baud_38400, | 22 | Baud_38400, |
23 | Baud_19200, | 23 | Baud_19200, |
24 | Baud_9600 }; | 24 | Baud_9600, |
25 | Baud_4800, | ||
26 | Baud_2400 }; | ||
25 | enum Data { Data_Five =5, Data_Six =6, Data_Seven=7, Data_Eight=8 }; | 27 | enum Data { Data_Five =5, Data_Six =6, Data_Seven=7, Data_Eight=8 }; |
26 | enum Stop { Stop_One =1, Stop_OnePointFive=15, Stop_Two=2 }; | 28 | enum Stop { Stop_One =1, Stop_OnePointFive=15, Stop_Two=2 }; |
27 | 29 | ||
28 | IOLayerBase( QWidget* base, const char* name = 0l); | 30 | IOLayerBase( QWidget* base, const char* name = 0l); |
29 | ~IOLayerBase(); | 31 | ~IOLayerBase(); |
30 | 32 | ||
31 | void setFlow( Flow flo ); | 33 | void setFlow( Flow flo ); |
32 | void setParity( Parity par ); | 34 | void setParity( Parity par ); |
33 | void setSpeed( Speed speed ); | 35 | void setSpeed( Speed speed ); |
34 | void setData( Data data ); | 36 | void setData( Data data ); |
35 | void setStop( Stop stop ); | 37 | void setStop( Stop stop ); |
36 | 38 | ||
37 | Flow flow()const; | 39 | Flow flow()const; |
38 | Parity parity()const; | 40 | Parity parity()const; |
39 | Speed speed()const; | 41 | Speed speed()const; |
40 | Data data()const; | 42 | Data data()const; |
diff --git a/noncore/apps/opie-console/irdaconfigwidget.cpp b/noncore/apps/opie-console/irdaconfigwidget.cpp index 059530d..4ee770d 100644 --- a/noncore/apps/opie-console/irdaconfigwidget.cpp +++ b/noncore/apps/opie-console/irdaconfigwidget.cpp | |||
@@ -65,32 +65,38 @@ void IrdaConfigWidget::load( const Profile& prof ) { | |||
65 | m_base->setParity( IOLayerBase::NonePar ); | 65 | m_base->setParity( IOLayerBase::NonePar ); |
66 | } | 66 | } |
67 | 67 | ||
68 | switch( speed ) { | 68 | switch( speed ) { |
69 | case 115200: | 69 | case 115200: |
70 | m_base->setSpeed(IOLayerBase::Baud_115200 ); | 70 | m_base->setSpeed(IOLayerBase::Baud_115200 ); |
71 | break; | 71 | break; |
72 | case 57600: | 72 | case 57600: |
73 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | 73 | m_base->setSpeed( IOLayerBase::Baud_57600 ); |
74 | break; | 74 | break; |
75 | case 38400: | 75 | case 38400: |
76 | m_base->setSpeed(IOLayerBase::Baud_38400 ); | 76 | m_base->setSpeed(IOLayerBase::Baud_38400 ); |
77 | break; | 77 | break; |
78 | case 19200: | 78 | case 19200: |
79 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | 79 | m_base->setSpeed( IOLayerBase::Baud_19200 ); |
80 | break; | 80 | break; |
81 | case 4800: | ||
82 | m_base->setSpeed( IOLayerBase::Baud_4800 ); | ||
83 | break; | ||
84 | case 2400: | ||
85 | m_base->setSpeed( IOLayerBase::Baud_2400 ); | ||
86 | break; | ||
81 | case 9600: | 87 | case 9600: |
82 | default: | 88 | default: |
83 | m_base->setSpeed(IOLayerBase::Baud_9600 ); | 89 | m_base->setSpeed(IOLayerBase::Baud_9600 ); |
84 | break; | 90 | break; |
85 | } | 91 | } |
86 | 92 | ||
87 | if ( prof.readEntry("Device").isEmpty() ) return; | 93 | if ( prof.readEntry("Device").isEmpty() ) return; |
88 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); | 94 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); |
89 | 95 | ||
90 | } | 96 | } |
91 | /* | 97 | /* |
92 | * save speed, | 98 | * save speed, |
93 | * flow, | 99 | * flow, |
94 | * parity | 100 | * parity |
95 | */ | 101 | */ |
96 | void IrdaConfigWidget::save( Profile& prof ) { | 102 | void IrdaConfigWidget::save( Profile& prof ) { |
@@ -123,26 +129,32 @@ void IrdaConfigWidget::save( Profile& prof ) { | |||
123 | break; | 129 | break; |
124 | } | 130 | } |
125 | 131 | ||
126 | switch( m_base->speed() ) { | 132 | switch( m_base->speed() ) { |
127 | case IOLayerBase::Baud_115200: | 133 | case IOLayerBase::Baud_115200: |
128 | speed = 115200; | 134 | speed = 115200; |
129 | break; | 135 | break; |
130 | case IOLayerBase::Baud_57600: | 136 | case IOLayerBase::Baud_57600: |
131 | speed = 57600; | 137 | speed = 57600; |
132 | break; | 138 | break; |
133 | case IOLayerBase::Baud_38400: | 139 | case IOLayerBase::Baud_38400: |
134 | speed = 38400; | 140 | speed = 38400; |
135 | break; | 141 | break; |
136 | case IOLayerBase::Baud_19200: | 142 | case IOLayerBase::Baud_19200: |
137 | speed = 19200; | 143 | speed = 19200; |
138 | break; | 144 | break; |
145 | case IOLayerBase::Baud_4800: | ||
146 | speed = 4800; | ||
147 | break; | ||
148 | case IOLayerBase::Baud_2400: | ||
149 | speed = 2400; | ||
150 | break; | ||
139 | default: | 151 | default: |
140 | case IOLayerBase::Baud_9600: | 152 | case IOLayerBase::Baud_9600: |
141 | speed = 9600; | 153 | speed = 9600; |
142 | break; | 154 | break; |
143 | } | 155 | } |
144 | 156 | ||
145 | prof.writeEntry("Flow", flow); | 157 | prof.writeEntry("Flow", flow); |
146 | prof.writeEntry("Parity", parity); | 158 | prof.writeEntry("Parity", parity); |
147 | prof.writeEntry("Speed", speed); | 159 | prof.writeEntry("Speed", speed); |
148 | } | 160 | } |
diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp index 1bd4338..f61f44e 100644 --- a/noncore/apps/opie-console/main.cpp +++ b/noncore/apps/opie-console/main.cpp | |||
@@ -1,28 +1,28 @@ | |||
1 | #include <sys/types.h> | 1 | #include <sys/types.h> |
2 | 2 | ||
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <signal.h> | 5 | #include <signal.h> |
6 | 6 | #include <qfile.h> | |
7 | 7 | ||
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | 9 | ||
10 | #include "mainwindow.h" | 10 | #include "mainwindow.h" |
11 | 11 | ||
12 | //#define FSCKED_DISTRIBUTION 1 | 12 | #define FSCKED_DISTRIBUTION 1 |
13 | #ifdef FSCKED_DISTRIBUTION | 13 | #ifdef FSCKED_DISTRIBUTION |
14 | /* | 14 | /* |
15 | * The Zaurus rom | 15 | * The Zaurus rom |
16 | */ | 16 | */ |
17 | class FixIt { | 17 | class FixIt { |
18 | public: | 18 | public: |
19 | FixIt(); | 19 | FixIt(); |
20 | ~FixIt(); | 20 | ~FixIt(); |
21 | void fixIt(); | 21 | void fixIt(); |
22 | /* no real interested in implementing it */ | 22 | /* no real interested in implementing it */ |
23 | void breakIt() { | 23 | void breakIt() { |
24 | 24 | ||
25 | }; | 25 | }; |
26 | char* m_file; | 26 | char* m_file; |
27 | }; | 27 | }; |
28 | 28 | ||
@@ -78,33 +78,33 @@ FixIt::~FixIt() { | |||
78 | void FixIt::fixIt() { | 78 | void FixIt::fixIt() { |
79 | ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); | 79 | ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); |
80 | QFile file( "/etc/inittab" ); | 80 | QFile file( "/etc/inittab" ); |
81 | if ( file.open(IO_WriteOnly | IO_Raw ) ) { | 81 | if ( file.open(IO_WriteOnly | IO_Raw ) ) { |
82 | file.writeBlock(m_file,strlen(m_file) ); | 82 | file.writeBlock(m_file,strlen(m_file) ); |
83 | } | 83 | } |
84 | file.close(); | 84 | file.close(); |
85 | ::kill( SIGHUP, 1 ); | 85 | ::kill( SIGHUP, 1 ); |
86 | } | 86 | } |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | int main(int argc, char **argv) { | 89 | int main(int argc, char **argv) { |
90 | // too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; | 90 | // too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; |
91 | QPEApplication app( argc, argv ); | 91 | QPEApplication app( argc, argv ); |
92 | 92 | ||
93 | #ifdef FSCKED_DISTRIBUTION | 93 | #ifdef FSCKED_DISTRIBUTION |
94 | owarn << "fscked" << oendl; | 94 | // owarn << "fscked" << oendl; |
95 | FixIt it; | 95 | FixIt it; |
96 | it.fixIt(); | 96 | it.fixIt(); |
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | MainWindow mw; | 99 | MainWindow mw; |
100 | mw.setCaption(QObject::tr("Opie Console") ); | 100 | mw.setCaption(QObject::tr("Opie Console") ); |
101 | app.showMainWidget( &mw ); | 101 | app.showMainWidget( &mw ); |
102 | 102 | ||
103 | int ap = app.exec(); | 103 | int ap = app.exec(); |
104 | 104 | ||
105 | #ifdef FSCKED_DISTRIBUTION | 105 | #ifdef FSCKED_DISTRIBUTION |
106 | /* should add a signal handler too */ | 106 | /* should add a signal handler too */ |
107 | it.breakIt(); | 107 | it.breakIt(); |
108 | #endif | 108 | #endif |
109 | return ap; | 109 | return ap; |
110 | } | 110 | } |
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index 9fdaf73..90d0b5b 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp | |||
@@ -97,61 +97,67 @@ void ModemConfigWidget::load( const Profile& prof ) { | |||
97 | m_base->setParity( IOLayerBase::NonePar ); | 97 | m_base->setParity( IOLayerBase::NonePar ); |
98 | } | 98 | } |
99 | 99 | ||
100 | switch( speed ) { | 100 | switch( speed ) { |
101 | case 115200: | 101 | case 115200: |
102 | m_base->setSpeed( IOLayerBase::Baud_115200 ); | 102 | m_base->setSpeed( IOLayerBase::Baud_115200 ); |
103 | break; | 103 | break; |
104 | case 57600: | 104 | case 57600: |
105 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | 105 | m_base->setSpeed( IOLayerBase::Baud_57600 ); |
106 | break; | 106 | break; |
107 | case 38400: | 107 | case 38400: |
108 | m_base->setSpeed( IOLayerBase::Baud_38400 ); | 108 | m_base->setSpeed( IOLayerBase::Baud_38400 ); |
109 | break; | 109 | break; |
110 | case 19200: | 110 | case 19200: |
111 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | 111 | m_base->setSpeed( IOLayerBase::Baud_19200 ); |
112 | break; | 112 | break; |
113 | case 4800: | ||
114 | m_base->setSpeed( IOLayerBase::Baud_4800 ); | ||
115 | break; | ||
116 | case 2400: | ||
117 | m_base->setSpeed( IOLayerBase::Baud_2400 ); | ||
118 | break; | ||
113 | case 9600: | 119 | case 9600: |
114 | default: | 120 | default: |
115 | m_base->setSpeed( IOLayerBase::Baud_9600 ); | 121 | m_base->setSpeed( IOLayerBase::Baud_9600 ); |
116 | break; | 122 | break; |
117 | } | 123 | } |
118 | 124 | ||
119 | 125 | ||
120 | if ( dbits == 5) { | 126 | if ( dbits == 5) { |
121 | m_base->setData( IOLayerBase::Data_Five ); | 127 | m_base->setData( IOLayerBase::Data_Five ); |
122 | } else if (rad_flow == 6) { | 128 | } else if (rad_flow == 6) { |
123 | m_base->setData( IOLayerBase::Data_Six ); | 129 | m_base->setData( IOLayerBase::Data_Six ); |
124 | } else if (rad_flow == 7) { | 130 | } else if (rad_flow == 7) { |
125 | m_base->setData( IOLayerBase::Data_Seven ); | 131 | m_base->setData( IOLayerBase::Data_Seven ); |
126 | } else { | 132 | } else { |
127 | m_base->setData( IOLayerBase::Data_Eight ); | 133 | m_base->setData( IOLayerBase::Data_Eight ); |
128 | } | 134 | } |
129 | 135 | ||
130 | if ( sbits == 2) { | 136 | if ( sbits == 2) { |
131 | m_base->setStop( IOLayerBase::Stop_Two ); | 137 | m_base->setStop( IOLayerBase::Stop_Two ); |
132 | } else if ( sbits == 15 ) { | 138 | } else if ( sbits == 15 ) { |
133 | m_base->setStop( IOLayerBase::Stop_OnePointFive ); | 139 | m_base->setStop( IOLayerBase::Stop_OnePointFive ); |
134 | } else { | 140 | } else { |
135 | m_base->setStop( IOLayerBase::Stop_One ); | 141 | m_base->setStop( IOLayerBase::Stop_One ); |
136 | } | 142 | } |
137 | 143 | ||
138 | 144 | ||
139 | atConf->readConfig( prof ); | 145 | atConf->readConfig( prof ); |
140 | if ( prof.readEntry( "Device" ).isEmpty() ) { | 146 | if ( prof.readEntry( "Device" ).isEmpty() ) { |
141 | owarn << "device empty!" << oendl; | 147 | owarn << "device empty!" << oendl; |
142 | return; | 148 | return; |
143 | } | 149 | } |
144 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); | 150 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); |
145 | 151 | ||
146 | 152 | ||
147 | } | 153 | } |
148 | 154 | ||
149 | /* | 155 | /* |
150 | * save speed, | 156 | * save speed, |
151 | * flow, | 157 | * flow, |
152 | * parity | 158 | * parity |
153 | */ | 159 | */ |
154 | void ModemConfigWidget::save( Profile& prof ) { | 160 | void ModemConfigWidget::save( Profile& prof ) { |
155 | int flow, parity, speed, data, stop; | 161 | int flow, parity, speed, data, stop; |
156 | flow = parity = speed = data = stop = 0; | 162 | flow = parity = speed = data = stop = 0; |
157 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); | 163 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); |
@@ -184,32 +190,38 @@ void ModemConfigWidget::save( Profile& prof ) { | |||
184 | switch( m_base->speed() ) { | 190 | switch( m_base->speed() ) { |
185 | case IOLayerBase::Baud_115200: | 191 | case IOLayerBase::Baud_115200: |
186 | speed = 115200; | 192 | speed = 115200; |
187 | break; | 193 | break; |
188 | case IOLayerBase::Baud_57600: | 194 | case IOLayerBase::Baud_57600: |
189 | speed = 57600; | 195 | speed = 57600; |
190 | break; | 196 | break; |
191 | case IOLayerBase::Baud_38400: | 197 | case IOLayerBase::Baud_38400: |
192 | speed = 38400; | 198 | speed = 38400; |
193 | break; | 199 | break; |
194 | case IOLayerBase::Baud_19200: | 200 | case IOLayerBase::Baud_19200: |
195 | speed = 19200; | 201 | speed = 19200; |
196 | break; | 202 | break; |
197 | case IOLayerBase::Baud_9600: | 203 | case IOLayerBase::Baud_9600: |
198 | speed = 9600; | 204 | speed = 9600; |
199 | break; | 205 | break; |
206 | case IOLayerBase::Baud_4800: | ||
207 | speed = 4800; | ||
208 | break; | ||
209 | case IOLayerBase::Baud_2400: | ||
210 | speed = 2400; | ||
211 | break; | ||
200 | } | 212 | } |
201 | 213 | ||
202 | switch( m_base->data() ) { | 214 | switch( m_base->data() ) { |
203 | case IOLayerBase::Data_Five: | 215 | case IOLayerBase::Data_Five: |
204 | data = 5; | 216 | data = 5; |
205 | break; | 217 | break; |
206 | case IOLayerBase::Data_Six: | 218 | case IOLayerBase::Data_Six: |
207 | data = 6; | 219 | data = 6; |
208 | break; | 220 | break; |
209 | case IOLayerBase::Data_Seven: | 221 | case IOLayerBase::Data_Seven: |
210 | data = 7; | 222 | data = 7; |
211 | break; | 223 | break; |
212 | case IOLayerBase::Data_Eight: | 224 | case IOLayerBase::Data_Eight: |
213 | data = 8; | 225 | data = 8; |
214 | break; | 226 | break; |
215 | } | 227 | } |
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp index 3edf723..5f3547a 100644 --- a/noncore/apps/opie-console/serialconfigwidget.cpp +++ b/noncore/apps/opie-console/serialconfigwidget.cpp | |||
@@ -69,32 +69,38 @@ void SerialConfigWidget::load( const Profile& prof ) { | |||
69 | m_base->setParity( IOLayerBase::NonePar ); | 69 | m_base->setParity( IOLayerBase::NonePar ); |
70 | } | 70 | } |
71 | 71 | ||
72 | switch( speed ) { | 72 | switch( speed ) { |
73 | case 115200: | 73 | case 115200: |
74 | m_base->setSpeed(IOLayerBase::Baud_115200 ); | 74 | m_base->setSpeed(IOLayerBase::Baud_115200 ); |
75 | break; | 75 | break; |
76 | case 57600: | 76 | case 57600: |
77 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | 77 | m_base->setSpeed( IOLayerBase::Baud_57600 ); |
78 | break; | 78 | break; |
79 | case 38400: | 79 | case 38400: |
80 | m_base->setSpeed(IOLayerBase::Baud_38400 ); | 80 | m_base->setSpeed(IOLayerBase::Baud_38400 ); |
81 | break; | 81 | break; |
82 | case 19200: | 82 | case 19200: |
83 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | 83 | m_base->setSpeed( IOLayerBase::Baud_19200 ); |
84 | break; | 84 | break; |
85 | case 4800: | ||
86 | m_base->setSpeed( IOLayerBase::Baud_4800 ); | ||
87 | break; | ||
88 | case 2400: | ||
89 | m_base->setSpeed( IOLayerBase::Baud_2400 ); | ||
90 | break; | ||
85 | case 9600: | 91 | case 9600: |
86 | default: | 92 | default: |
87 | m_base->setSpeed(IOLayerBase::Baud_9600 ); | 93 | m_base->setSpeed(IOLayerBase::Baud_9600 ); |
88 | break; | 94 | break; |
89 | } | 95 | } |
90 | 96 | ||
91 | if ( dbits == 5) { | 97 | if ( dbits == 5) { |
92 | m_base->setData( IOLayerBase::Data_Five ); | 98 | m_base->setData( IOLayerBase::Data_Five ); |
93 | } else if (rad_flow == 6) { | 99 | } else if (rad_flow == 6) { |
94 | m_base->setData( IOLayerBase::Data_Six ); | 100 | m_base->setData( IOLayerBase::Data_Six ); |
95 | } else if (rad_flow == 7) { | 101 | } else if (rad_flow == 7) { |
96 | m_base->setData( IOLayerBase::Data_Seven ); | 102 | m_base->setData( IOLayerBase::Data_Seven ); |
97 | } else { | 103 | } else { |
98 | m_base->setData( IOLayerBase::Data_Eight ); | 104 | m_base->setData( IOLayerBase::Data_Eight ); |
99 | } | 105 | } |
100 | 106 | ||
@@ -144,32 +150,38 @@ void SerialConfigWidget::save( Profile& prof ) { | |||
144 | break; | 150 | break; |
145 | } | 151 | } |
146 | 152 | ||
147 | switch( m_base->speed() ) { | 153 | switch( m_base->speed() ) { |
148 | case IOLayerBase::Baud_115200: | 154 | case IOLayerBase::Baud_115200: |
149 | speed = 115200; | 155 | speed = 115200; |
150 | break; | 156 | break; |
151 | case IOLayerBase::Baud_57600: | 157 | case IOLayerBase::Baud_57600: |
152 | speed = 57600; | 158 | speed = 57600; |
153 | break; | 159 | break; |
154 | case IOLayerBase::Baud_38400: | 160 | case IOLayerBase::Baud_38400: |
155 | speed = 38400; | 161 | speed = 38400; |
156 | break; | 162 | break; |
157 | case IOLayerBase::Baud_19200: | 163 | case IOLayerBase::Baud_19200: |
158 | speed = 19200; | 164 | speed = 19200; |
159 | break; | 165 | break; |
166 | case IOLayerBase::Baud_4800: | ||
167 | speed = 4800; | ||
168 | break; | ||
169 | case IOLayerBase::Baud_2400: | ||
170 | speed = 2400; | ||
171 | break; | ||
160 | default: | 172 | default: |
161 | case IOLayerBase::Baud_9600: | 173 | case IOLayerBase::Baud_9600: |
162 | speed = 9600; | 174 | speed = 9600; |
163 | break; | 175 | break; |
164 | } | 176 | } |
165 | 177 | ||
166 | switch( m_base->data() ) { | 178 | switch( m_base->data() ) { |
167 | case IOLayerBase::Data_Five: | 179 | case IOLayerBase::Data_Five: |
168 | data = 5; | 180 | data = 5; |
169 | break; | 181 | break; |
170 | case IOLayerBase::Data_Six: | 182 | case IOLayerBase::Data_Six: |
171 | data = 6; | 183 | data = 6; |
172 | break; | 184 | break; |
173 | case IOLayerBase::Data_Seven: | 185 | case IOLayerBase::Data_Seven: |
174 | data = 7; | 186 | data = 7; |
175 | break; | 187 | break; |
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp index 087476b..3e3b8a6 100644 --- a/noncore/apps/opie-console/terminalwidget.cpp +++ b/noncore/apps/opie-console/terminalwidget.cpp | |||
@@ -1,93 +1,99 @@ | |||
1 | #include "terminalwidget.h" | 1 | #include "terminalwidget.h" |
2 | 2 | ||
3 | /* OPIE */ | 3 | /* OPIE */ |
4 | #include <opie2/odebug.h> | 4 | #include <opie2/odebug.h> |
5 | |||
5 | using namespace Opie::Core; | 6 | using namespace Opie::Core; |
6 | 7 | ||
7 | /* QT */ | 8 | /* QT */ |
8 | #include <qlabel.h> | 9 | #include <qlabel.h> |
9 | #include <qcheckbox.h> | 10 | #include <qcheckbox.h> |
10 | #include <qcombobox.h> | 11 | #include <qcombobox.h> |
11 | #include <qradiobutton.h> | 12 | #include <qradiobutton.h> |
12 | #include <qhgroupbox.h> | 13 | #include <qhgroupbox.h> |
13 | #include <qhbuttongroup.h> | 14 | #include <qhbuttongroup.h> |
14 | #include <qlayout.h> | 15 | #include <qlayout.h> |
16 | #include <qhbox.h> | ||
15 | 17 | ||
16 | namespace { | 18 | namespace { |
17 | enum TermIds { | 19 | enum TermIds { |
18 | id_term_vt100 = 0, | 20 | id_term_vt100 = 0, |
19 | id_term_vt102, | 21 | id_term_vt102, |
20 | id_term_linux, | 22 | id_term_linux, |
21 | id_term_xterm | 23 | id_term_xterm |
22 | }; | 24 | }; |
23 | 25 | ||
24 | enum ColourIds { | 26 | enum ColourIds { |
25 | id_term_black, | 27 | id_term_black, |
26 | id_term_white, | 28 | id_term_white, |
27 | id_term_green, | 29 | id_term_green, |
28 | id_term_orange | 30 | id_term_orange |
29 | }; | 31 | }; |
30 | 32 | ||
31 | enum FontIds { | 33 | enum FontIds { |
32 | id_size_small, | 34 | id_size_small, |
33 | id_size_medium, | 35 | id_size_medium, |
34 | id_size_large | 36 | id_size_large |
35 | }; | 37 | }; |
36 | }; | 38 | }; |
37 | 39 | ||
38 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, | 40 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, |
39 | const char* na ) | 41 | const char* na ) |
40 | : ProfileDialogTerminalWidget( name, parent, na ) { | 42 | : ProfileDialogTerminalWidget( name, parent, na ) { |
41 | 43 | ||
42 | m_terminal = new QLabel(tr("Terminal Type"), this ); | 44 | m_terminal = new QLabel(tr("Terminal Type"), this ); |
43 | m_terminalBox = new QComboBox(this); | 45 | m_terminalBox = new QComboBox(this); |
44 | m_colorLabel = new QLabel(tr("Color scheme"), this); | 46 | m_colorLabel = new QLabel(tr("Color scheme"), this); |
45 | m_colorCmb = new QComboBox(this ); | 47 | m_colorCmb = new QComboBox(this ); |
46 | 48 | ||
47 | m_groupSize = new QHButtonGroup(tr("Font size"), this ); | 49 | // m_groupSize = new QHButtonGroup(tr("Font size"), this ); |
48 | m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); | 50 | m_groupSize = new QHBox( this ); |
49 | m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); | 51 | m_fontSelector = new Opie::Ui::OFontSelector( false, m_groupSize ); |
50 | m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); | 52 | |
53 | // m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); | ||
54 | // m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); | ||
55 | // m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); | ||
51 | 56 | ||
52 | m_groupConv = new QHGroupBox( tr("Line-break conversions"), this ); | 57 | m_groupConv = new QHGroupBox( tr("Line-break conversions"), this ); |
53 | m_convInbound = new QCheckBox( tr("Inbound"), m_groupConv ); | 58 | m_convInbound = new QCheckBox( tr("Inbound"), m_groupConv ); |
54 | m_convOutbound = new QCheckBox( tr("Outbound"), m_groupConv ); | 59 | m_convOutbound = new QCheckBox( tr("Outbound"), m_groupConv ); |
55 | 60 | ||
61 | |||
56 | m_groupOptions = new QHGroupBox( tr("Options"), this ); | 62 | m_groupOptions = new QHGroupBox( tr("Options"), this ); |
57 | m_optionEcho = new QCheckBox( tr("Local echo"), m_groupOptions ); | 63 | m_optionEcho = new QCheckBox( tr("Local echo"), m_groupOptions ); |
58 | m_optionWrap = new QCheckBox( tr("Line wrap"), m_groupOptions ); | 64 | m_optionWrap = new QCheckBox( tr("Line wrap"), m_groupOptions ); |
59 | 65 | ||
60 | m_lroot = new QVBoxLayout( this ); | 66 | m_lroot = new QVBoxLayout( this ); |
61 | m_typeBox = new QVBoxLayout( m_lroot ); | 67 | m_typeBox = new QVBoxLayout( m_lroot ); |
62 | m_colorBox = new QVBoxLayout( m_lroot ); | 68 | m_colorBox = new QVBoxLayout( m_lroot ); |
63 | 69 | ||
64 | // Layout | 70 | // Layout |
65 | m_typeBox->add( m_terminal ); | 71 | m_typeBox->add( m_terminal ); |
66 | m_typeBox->add( m_terminalBox ); | 72 | m_typeBox->add( m_terminalBox ); |
67 | m_lroot->add( m_groupSize ); | 73 | m_lroot->add( m_groupSize ); |
68 | 74 | ||
69 | m_colorBox->add( m_colorLabel ); | 75 | m_colorBox->add( m_colorLabel ); |
70 | m_colorBox->add( m_colorCmb ); | 76 | m_colorBox->add( m_colorCmb ); |
71 | 77 | ||
72 | m_lroot->add( m_groupConv ); | 78 | m_lroot->add( m_groupConv ); |
73 | m_lroot->add( m_groupOptions ); | 79 | m_lroot->add( m_groupOptions ); |
74 | m_lroot->addStretch( 0 ); | 80 | m_lroot->addStretch( 0 ); |
75 | 81 | ||
76 | // Fill in some options | 82 | // Fill in some options |
77 | owarn << "Options for terminal box" << oendl; | 83 | owarn << "Options for terminal box" << oendl; |
78 | m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ ); | 84 | m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ ); |
79 | m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */); | 85 | m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */); |
80 | m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux ); | 86 | m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux ); |
81 | m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm ); | 87 | m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm ); |
82 | //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); | 88 | //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); |
83 | 89 | ||
84 | m_colorCmb->insertItem( tr("black on white"), id_term_black ); | 90 | m_colorCmb->insertItem( tr("black on white"), id_term_black ); |
85 | m_colorCmb->insertItem( tr("white on black"), id_term_white ); | 91 | m_colorCmb->insertItem( tr("white on black"), id_term_white ); |
86 | m_colorCmb->insertItem( tr("green on black"), id_term_green ); | 92 | m_colorCmb->insertItem( tr("green on black"), id_term_green ); |
87 | m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); | 93 | m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); |
88 | 94 | ||
89 | // signals + slots | 95 | // signals + slots |
90 | /* | 96 | /* |
91 | connect(m_terminalBox, SIGNAL(activated(int) ), | 97 | connect(m_terminalBox, SIGNAL(activated(int) ), |
92 | this, SLOT(slotTermTerm(int) ) ); | 98 | this, SLOT(slotTermTerm(int) ) ); |
93 | connect(m_colorBox, SIGNAL(activated(int) ), | 99 | connect(m_colorBox, SIGNAL(activated(int) ), |
@@ -97,33 +103,33 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, | |||
97 | 103 | ||
98 | connect(m_optionEcho, SIGNAL(toggled(bool) ), | 104 | connect(m_optionEcho, SIGNAL(toggled(bool) ), |
99 | this, SLOT(slotTermEcho(bool) ) ); | 105 | this, SLOT(slotTermEcho(bool) ) ); |
100 | connect(m_optionWrap, SIGNAL(toggled(bool) ), | 106 | connect(m_optionWrap, SIGNAL(toggled(bool) ), |
101 | this, SLOT(slotTermWrap(bool) ) ); | 107 | this, SLOT(slotTermWrap(bool) ) ); |
102 | connect(m_convInbound, SIGNAL(toggled(bool) ), | 108 | connect(m_convInbound, SIGNAL(toggled(bool) ), |
103 | this, SLOT(slotTermInbound(bool) ) ); | 109 | this, SLOT(slotTermInbound(bool) ) ); |
104 | connect(m_convOutbound, SIGNAL(toggled(bool) ), | 110 | connect(m_convOutbound, SIGNAL(toggled(bool) ), |
105 | this, SLOT(slotTermOutbound(bool) ) ); | 111 | this, SLOT(slotTermOutbound(bool) ) ); |
106 | */ | 112 | */ |
107 | } | 113 | } |
108 | TerminalWidget::~TerminalWidget() { | 114 | TerminalWidget::~TerminalWidget() { |
109 | } | 115 | } |
110 | void TerminalWidget::load( const Profile& prof ) { | 116 | void TerminalWidget::load( const Profile& prof ) { |
111 | int term = prof.readNumEntry("Terminal"); | 117 | int term = prof.readNumEntry("Terminal"); |
112 | int color = prof.readNumEntry("Color"); | 118 | int color = prof.readNumEntry("Color"); |
113 | int fontsize = prof.readNumEntry("Font"); | 119 | // int fontsize = prof.readNumEntry("Font"); |
114 | int opt_echo = prof.readNumEntry("Echo"); | 120 | int opt_echo = prof.readNumEntry("Echo"); |
115 | int opt_wrap = prof.readNumEntry("Wrap"); | 121 | int opt_wrap = prof.readNumEntry("Wrap"); |
116 | int opt_inbound = prof.readNumEntry("Inbound"); | 122 | int opt_inbound = prof.readNumEntry("Inbound"); |
117 | int opt_outbound = prof.readNumEntry("Outbound"); | 123 | int opt_outbound = prof.readNumEntry("Outbound"); |
118 | 124 | ||
119 | switch( term ) { | 125 | switch( term ) { |
120 | case Profile::VT100: | 126 | case Profile::VT100: |
121 | m_terminalBox->setCurrentItem(id_term_vt100 ); | 127 | m_terminalBox->setCurrentItem(id_term_vt100 ); |
122 | break; | 128 | break; |
123 | case Profile::VT102: | 129 | case Profile::VT102: |
124 | m_terminalBox->setCurrentItem(id_term_vt102 ); | 130 | m_terminalBox->setCurrentItem(id_term_vt102 ); |
125 | break; | 131 | break; |
126 | case Profile::Linux: | 132 | case Profile::Linux: |
127 | m_terminalBox->setCurrentItem(id_term_linux ); | 133 | m_terminalBox->setCurrentItem(id_term_linux ); |
128 | break; | 134 | break; |
129 | case Profile::XTerm: | 135 | case Profile::XTerm: |
@@ -138,46 +144,49 @@ void TerminalWidget::load( const Profile& prof ) { | |||
138 | case Profile::Black: | 144 | case Profile::Black: |
139 | m_colorCmb->setCurrentItem(id_term_black ); | 145 | m_colorCmb->setCurrentItem(id_term_black ); |
140 | break; | 146 | break; |
141 | case Profile::White: | 147 | case Profile::White: |
142 | m_colorCmb->setCurrentItem(id_term_white ); | 148 | m_colorCmb->setCurrentItem(id_term_white ); |
143 | break; | 149 | break; |
144 | case Profile::Green: | 150 | case Profile::Green: |
145 | m_colorCmb->setCurrentItem(id_term_green ); | 151 | m_colorCmb->setCurrentItem(id_term_green ); |
146 | break; | 152 | break; |
147 | case Profile::Orange: | 153 | case Profile::Orange: |
148 | m_colorCmb->setCurrentItem(id_term_orange ); | 154 | m_colorCmb->setCurrentItem(id_term_orange ); |
149 | break; | 155 | break; |
150 | default: | 156 | default: |
151 | break; | 157 | break; |
152 | }; | 158 | }; |
153 | 159 | ||
154 | switch( fontsize ) { | 160 | |
155 | case Profile::Micro: | 161 | m_fontSelector->setSelectedFont( prof.readEntry( "Font"), prof.readEntry( "FontStyle"), prof.readNumEntry( "FontSize" ), prof.readEntry( "FontCharset") ); |
156 | m_sizeSmall->setChecked(true ); | 162 | |
157 | break; | 163 | // switch( fontsize ) { |
158 | case Profile::Small: | 164 | // case Profile::Micro: |
159 | m_sizeMedium->setChecked(true ); | 165 | // m_sizeSmall->setChecked(true ); |
160 | break; | 166 | // break; |
161 | case Profile::Medium: | 167 | // case Profile::Small: |
162 | m_sizeLarge->setChecked( true ); | 168 | // m_sizeMedium->setChecked(true ); |
163 | break; | 169 | // break; |
164 | default: | 170 | // case Profile::Medium: |
165 | m_sizeMedium->setChecked(true ); | 171 | // m_sizeLarge->setChecked( true ); |
166 | break; | 172 | // break; |
167 | }; | 173 | // default: |
174 | // m_sizeMedium->setChecked(true ); | ||
175 | // break; | ||
176 | // }; | ||
168 | 177 | ||
169 | if (opt_echo) m_optionEcho->setChecked( true ); | 178 | if (opt_echo) m_optionEcho->setChecked( true ); |
170 | if (opt_wrap) m_optionWrap->setChecked( true ); | 179 | if (opt_wrap) m_optionWrap->setChecked( true ); |
171 | if (opt_inbound) m_convInbound->setChecked( true ); | 180 | if (opt_inbound) m_convInbound->setChecked( true ); |
172 | if (opt_outbound) m_convOutbound->setChecked( true ); | 181 | if (opt_outbound) m_convOutbound->setChecked( true ); |
173 | 182 | ||
174 | } | 183 | } |
175 | void TerminalWidget::save( Profile& profile ) { | 184 | void TerminalWidget::save( Profile& profile ) { |
176 | switch(m_terminalBox->currentItem() ) { | 185 | switch(m_terminalBox->currentItem() ) { |
177 | case id_term_vt100: | 186 | case id_term_vt100: |
178 | profile.writeEntry("Terminal", Profile::VT100 ); | 187 | profile.writeEntry("Terminal", Profile::VT100 ); |
179 | break; | 188 | break; |
180 | case id_term_vt102: | 189 | case id_term_vt102: |
181 | profile.writeEntry("Terminal", Profile::VT102 ); | 190 | profile.writeEntry("Terminal", Profile::VT102 ); |
182 | break; | 191 | break; |
183 | case id_term_linux: | 192 | case id_term_linux: |
@@ -198,29 +207,36 @@ void TerminalWidget::save( Profile& profile ) { | |||
198 | case id_term_black: | 207 | case id_term_black: |
199 | profile.writeEntry("Color", Profile::Black ); | 208 | profile.writeEntry("Color", Profile::Black ); |
200 | break; | 209 | break; |
201 | case id_term_white: | 210 | case id_term_white: |
202 | profile.writeEntry("Color", Profile::White ); | 211 | profile.writeEntry("Color", Profile::White ); |
203 | break; | 212 | break; |
204 | case id_term_green: | 213 | case id_term_green: |
205 | profile.writeEntry("Color", Profile::Green ); | 214 | profile.writeEntry("Color", Profile::Green ); |
206 | break; | 215 | break; |
207 | case id_term_orange: | 216 | case id_term_orange: |
208 | profile.writeEntry("Color", Profile::Orange ); | 217 | profile.writeEntry("Color", Profile::Orange ); |
209 | break; | 218 | break; |
210 | default: | 219 | default: |
211 | break; | 220 | break; |
212 | }; | 221 | }; |
213 | 222 | ||
214 | if (m_sizeSmall->isChecked() ) { | 223 | |
215 | profile.writeEntry("Font", Profile::Micro ); | 224 | profile.writeEntry( "FontSize", m_fontSelector->fontSize() ); |
216 | }else if (m_sizeMedium->isChecked() ) { | 225 | profile.writeEntry( "FontStyle", m_fontSelector->fontStyle() ); |
217 | profile.writeEntry("Font", Profile::Small ); | 226 | profile.writeEntry( "FontCharset", m_fontSelector->fontCharSet() ); |
218 | }else { | 227 | profile.writeEntry( "Font", m_fontSelector->fontFamily() ); |
219 | profile.writeEntry("Font", Profile::Medium ); | 228 | |
220 | } | 229 | |
230 | // if (m_sizeSmall->isChecked() ) { | ||
231 | // profile.writeEntry("Font", Profile::Micro ); | ||
232 | // }else if (m_sizeMedium->isChecked() ) { | ||
233 | // profile.writeEntry("Font", Profile::Small ); | ||
234 | // }else { | ||
235 | // profile.writeEntry("Font", Profile::Medium ); | ||
236 | // } | ||
221 | 237 | ||
222 | profile.writeEntry("Echo", m_optionEcho->isChecked() ); | 238 | profile.writeEntry("Echo", m_optionEcho->isChecked() ); |
223 | profile.writeEntry("Wrap", m_optionWrap->isChecked() ); | 239 | profile.writeEntry("Wrap", m_optionWrap->isChecked() ); |
224 | profile.writeEntry("Inbound", m_convInbound->isChecked() ); | 240 | profile.writeEntry("Inbound", m_convInbound->isChecked() ); |
225 | profile.writeEntry("Outbound",m_convOutbound->isChecked() ); | 241 | profile.writeEntry("Outbound",m_convOutbound->isChecked() ); |
226 | } | 242 | } |
diff --git a/noncore/apps/opie-console/terminalwidget.h b/noncore/apps/opie-console/terminalwidget.h index 217fea7..2bd38d6 100644 --- a/noncore/apps/opie-console/terminalwidget.h +++ b/noncore/apps/opie-console/terminalwidget.h | |||
@@ -1,48 +1,52 @@ | |||
1 | #ifndef OPIE_TERMINAL_WIDGET_H | 1 | #ifndef OPIE_TERMINAL_WIDGET_H |
2 | #define OPIE_TERMINAL_WIDGET_H | 2 | #define OPIE_TERMINAL_WIDGET_H |
3 | 3 | ||
4 | #include "profiledialogwidget.h" | 4 | #include "profiledialogwidget.h" |
5 | 5 | ||
6 | #include <opie2/ofontselector.h> | ||
7 | |||
6 | class QComboBox; | 8 | class QComboBox; |
7 | class QLabel; | 9 | class QLabel; |
8 | class QVBoxLayout; | 10 | class QVBoxLayout; |
9 | class QHBoxLayout; | 11 | class QHBoxLayout; |
10 | class QButtonGroup; | 12 | class QButtonGroup; |
11 | class QRadioButton; | 13 | class QRadioButton; |
12 | class QCheckBox; | 14 | class QCheckBox; |
13 | class QHGroupBox; | 15 | class QHGroupBox; |
14 | class QHBox; | 16 | class QHBox; |
15 | 17 | ||
18 | |||
16 | class TerminalWidget : public ProfileDialogTerminalWidget { | 19 | class TerminalWidget : public ProfileDialogTerminalWidget { |
17 | 20 | ||
18 | Q_OBJECT | 21 | Q_OBJECT |
19 | 22 | ||
20 | public: | 23 | public: |
21 | TerminalWidget(const QString& name, QWidget* wid, | 24 | TerminalWidget(const QString& name, QWidget* wid, |
22 | const char* na ) ; | 25 | const char* na ) ; |
23 | ~TerminalWidget(); | 26 | ~TerminalWidget(); |
24 | 27 | ||
25 | void load( const Profile& ); | 28 | void load( const Profile& ); |
26 | void save( Profile& ); | 29 | void save( Profile& ); |
27 | 30 | ||
28 | private: | 31 | private: |
29 | QVBoxLayout* m_lroot, *m_typeBox, *m_colorBox; | 32 | QVBoxLayout* m_lroot, *m_typeBox, *m_colorBox; |
30 | 33 | ||
31 | QLabel* m_terminal, *m_colorLabel; | 34 | QLabel* m_terminal, *m_colorLabel; |
32 | 35 | ||
33 | QComboBox* m_terminalBox, *m_colorCmb; | 36 | QComboBox* m_terminalBox, *m_colorCmb; |
34 | 37 | ||
35 | QButtonGroup* m_groupSize; | 38 | QHBox* m_groupSize; |
36 | 39 | ||
37 | QRadioButton* m_sizeSmall, *m_sizeMedium, | 40 | QRadioButton* m_sizeSmall, *m_sizeMedium, |
38 | *m_sizeLarge; | 41 | *m_sizeLarge; |
39 | 42 | ||
40 | QHGroupBox *m_groupConv, *m_groupOptions; | 43 | QHGroupBox *m_groupConv, *m_groupOptions; |
41 | 44 | ||
42 | QCheckBox *m_convInbound, | 45 | QCheckBox *m_convInbound, |
43 | *m_convOutbound, *m_optionEcho, | 46 | *m_convOutbound, *m_optionEcho, |
44 | *m_optionWrap; | 47 | *m_optionWrap; |
45 | 48 | ||
49 | Opie::Ui::OFontSelector *m_fontSelector; | ||
46 | }; | 50 | }; |
47 | 51 | ||
48 | #endif | 52 | #endif |