-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/terminalwidget.cpp | 2 |
2 files changed, 0 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index ce44dab..37eb184 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp | |||
@@ -1,255 +1,252 @@ | |||
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 <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qhbox.h> | 6 | #include <qhbox.h> |
7 | #include <qregexp.h> | 7 | #include <qregexp.h> |
8 | 8 | ||
9 | #include "modemconfigwidget.h" | 9 | #include "modemconfigwidget.h" |
10 | #include "dialdialog.h" | 10 | #include "dialdialog.h" |
11 | 11 | ||
12 | namespace { | 12 | namespace { |
13 | void setCurrent( const QString& str, QComboBox* bo ) { | 13 | void setCurrent( const QString& str, QComboBox* bo ) { |
14 | uint b = bo->count(); | 14 | uint b = bo->count(); |
15 | for (int i = 0; i < bo->count(); i++ ) { | 15 | for (int i = 0; i < bo->count(); i++ ) { |
16 | if ( bo->text(i) == str ) { | 16 | if ( bo->text(i) == str ) { |
17 | bo->setCurrentItem( i ); | 17 | bo->setCurrentItem( i ); |
18 | return; | 18 | return; |
19 | } | 19 | } |
20 | } | 20 | } |
21 | bo->insertItem( str ); | 21 | bo->insertItem( str ); |
22 | bo->setCurrentItem( b ); | 22 | bo->setCurrentItem( b ); |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, | 26 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, |
27 | const char* na ) | 27 | const char* na ) |
28 | : ProfileDialogConnectionWidget( name, parent, na ) { | 28 | : ProfileDialogConnectionWidget( name, parent, na ) { |
29 | 29 | ||
30 | m_lay = new QVBoxLayout( this ); | 30 | m_lay = new QVBoxLayout( this ); |
31 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); | 31 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); |
32 | m_deviceCmb = new QComboBox(this ); | 32 | m_deviceCmb = new QComboBox(this ); |
33 | m_deviceCmb->setEditable( TRUE ); | 33 | m_deviceCmb->setEditable( TRUE ); |
34 | 34 | ||
35 | QLabel* telLabel = new QLabel( this ); | 35 | QLabel* telLabel = new QLabel( this ); |
36 | telLabel->setText( tr( "Enter telefon number here:" ) ); | 36 | telLabel->setText( tr( "Enter telefon number here:" ) ); |
37 | // m_telNumber = new QLineEdit( this ); | ||
38 | QHBox *buttonBox = new QHBox( this ); | 37 | QHBox *buttonBox = new QHBox( this ); |
39 | m_telNumber = new QLineEdit( buttonBox ); | 38 | m_telNumber = new QLineEdit( buttonBox ); |
40 | QPushButton *atButton = new QPushButton( buttonBox ); | 39 | QPushButton *atButton = new QPushButton( buttonBox ); |
41 | atButton->setText( tr( "AT commands" ) ); | 40 | atButton->setText( tr( "AT commands" ) ); |
42 | // disabled for now | ||
43 | atButton->hide(); | ||
44 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); | 41 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); |
45 | 42 | ||
46 | QPushButton *dialButton = new QPushButton( buttonBox ); | 43 | QPushButton *dialButton = new QPushButton( buttonBox ); |
47 | dialButton->setText( tr( "Enter number" ) ); | 44 | dialButton->setText( tr( "Enter number" ) ); |
48 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); | 45 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); |
49 | 46 | ||
50 | m_base = new IOLayerBase( this, "base" ); | 47 | m_base = new IOLayerBase( this, "base" ); |
51 | 48 | ||
52 | m_lay->addWidget( m_device ); | 49 | m_lay->addWidget( m_device ); |
53 | m_lay->addWidget( m_deviceCmb ); | 50 | m_lay->addWidget( m_deviceCmb ); |
54 | m_lay->addWidget( telLabel ); | 51 | m_lay->addWidget( telLabel ); |
55 | m_lay->addWidget( buttonBox ); | 52 | m_lay->addWidget( buttonBox ); |
56 | m_lay->addWidget( m_base ); | 53 | m_lay->addWidget( m_base ); |
57 | m_lay->addStretch( 0 ); | 54 | m_lay->addStretch( 0 ); |
58 | 55 | ||
59 | m_deviceCmb->insertItem( "/dev/ttyS0" ); | 56 | m_deviceCmb->insertItem( "/dev/ttyS0" ); |
60 | m_deviceCmb->insertItem( "/dev/ttyS1" ); | 57 | m_deviceCmb->insertItem( "/dev/ttyS1" ); |
61 | m_deviceCmb->insertItem( "/dev/ttyS2" ); | 58 | m_deviceCmb->insertItem( "/dev/ttyS2" ); |
62 | 59 | ||
63 | atConf = new ATConfigDialog( this, "ATConfig", true ); | 60 | atConf = new ATConfigDialog( this, "ATConfig", true ); |
64 | } | 61 | } |
65 | 62 | ||
66 | ModemConfigWidget::~ModemConfigWidget() { | 63 | ModemConfigWidget::~ModemConfigWidget() { |
67 | 64 | ||
68 | } | 65 | } |
69 | void ModemConfigWidget::load( const Profile& prof ) { | 66 | void ModemConfigWidget::load( const Profile& prof ) { |
70 | 67 | ||
71 | int rad_flow = prof.readNumEntry( "Flow" ); | 68 | int rad_flow = prof.readNumEntry( "Flow" ); |
72 | int rad_parity = prof.readNumEntry( "Parity" ); | 69 | int rad_parity = prof.readNumEntry( "Parity" ); |
73 | int speed = prof.readNumEntry( "Speed" ); | 70 | int speed = prof.readNumEntry( "Speed" ); |
74 | int dbits = prof.readNumEntry("DataBits"); | 71 | int dbits = prof.readNumEntry("DataBits"); |
75 | int sbits = prof.readNumEntry("StopBits"); | 72 | int sbits = prof.readNumEntry("StopBits"); |
76 | QString number = prof.readEntry( "Number" ); | 73 | QString number = prof.readEntry( "Number" ); |
77 | 74 | ||
78 | if ( !number.isEmpty() ) { | 75 | if ( !number.isEmpty() ) { |
79 | m_telNumber->setText( number ); | 76 | m_telNumber->setText( number ); |
80 | } | 77 | } |
81 | 78 | ||
82 | if ( rad_flow == 1 ) { | 79 | if ( rad_flow == 1 ) { |
83 | m_base->setFlow( IOLayerBase::Hardware ); | 80 | m_base->setFlow( IOLayerBase::Hardware ); |
84 | } else if (rad_flow == 2) { | 81 | } else if (rad_flow == 2) { |
85 | m_base->setFlow( IOLayerBase::Software ); | 82 | m_base->setFlow( IOLayerBase::Software ); |
86 | } else if (rad_flow == 0) { | 83 | } else if (rad_flow == 0) { |
87 | m_base->setFlow( IOLayerBase::None ); | 84 | m_base->setFlow( IOLayerBase::None ); |
88 | } | 85 | } |
89 | 86 | ||
90 | 87 | ||
91 | if ( rad_parity == 1 ) { | 88 | if ( rad_parity == 1 ) { |
92 | m_base->setParity( IOLayerBase::Even ); | 89 | m_base->setParity( IOLayerBase::Even ); |
93 | } else if ( rad_parity == 2 ){ | 90 | } else if ( rad_parity == 2 ){ |
94 | m_base->setParity( IOLayerBase::Odd ); | 91 | m_base->setParity( IOLayerBase::Odd ); |
95 | } else { | 92 | } else { |
96 | m_base->setParity( IOLayerBase::NonePar ); | 93 | m_base->setParity( IOLayerBase::NonePar ); |
97 | } | 94 | } |
98 | 95 | ||
99 | switch( speed ) { | 96 | switch( speed ) { |
100 | case 115200: | 97 | case 115200: |
101 | m_base->setSpeed( IOLayerBase::Baud_115200 ); | 98 | m_base->setSpeed( IOLayerBase::Baud_115200 ); |
102 | break; | 99 | break; |
103 | case 57600: | 100 | case 57600: |
104 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | 101 | m_base->setSpeed( IOLayerBase::Baud_57600 ); |
105 | break; | 102 | break; |
106 | case 38400: | 103 | case 38400: |
107 | m_base->setSpeed( IOLayerBase::Baud_38400 ); | 104 | m_base->setSpeed( IOLayerBase::Baud_38400 ); |
108 | break; | 105 | break; |
109 | case 19200: | 106 | case 19200: |
110 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | 107 | m_base->setSpeed( IOLayerBase::Baud_19200 ); |
111 | break; | 108 | break; |
112 | case 9600: | 109 | case 9600: |
113 | default: | 110 | default: |
114 | m_base->setSpeed( IOLayerBase::Baud_9600 ); | 111 | m_base->setSpeed( IOLayerBase::Baud_9600 ); |
115 | break; | 112 | break; |
116 | } | 113 | } |
117 | 114 | ||
118 | 115 | ||
119 | if ( dbits == 5) { | 116 | if ( dbits == 5) { |
120 | m_base->setData( IOLayerBase::Data_Five ); | 117 | m_base->setData( IOLayerBase::Data_Five ); |
121 | } else if (rad_flow == 6) { | 118 | } else if (rad_flow == 6) { |
122 | m_base->setData( IOLayerBase::Data_Six ); | 119 | m_base->setData( IOLayerBase::Data_Six ); |
123 | } else if (rad_flow == 7) { | 120 | } else if (rad_flow == 7) { |
124 | m_base->setData( IOLayerBase::Data_Seven ); | 121 | m_base->setData( IOLayerBase::Data_Seven ); |
125 | } else { | 122 | } else { |
126 | m_base->setData( IOLayerBase::Data_Eight ); | 123 | m_base->setData( IOLayerBase::Data_Eight ); |
127 | } | 124 | } |
128 | 125 | ||
129 | if ( sbits == 2) { | 126 | if ( sbits == 2) { |
130 | m_base->setStop( IOLayerBase::Stop_Two ); | 127 | m_base->setStop( IOLayerBase::Stop_Two ); |
131 | } else if ( sbits == 15 ) { | 128 | } else if ( sbits == 15 ) { |
132 | m_base->setStop( IOLayerBase::Stop_OnePointFive ); | 129 | m_base->setStop( IOLayerBase::Stop_OnePointFive ); |
133 | } else { | 130 | } else { |
134 | m_base->setStop( IOLayerBase::Stop_One ); | 131 | m_base->setStop( IOLayerBase::Stop_One ); |
135 | } | 132 | } |
136 | 133 | ||
137 | 134 | ||
138 | 135 | ||
139 | if ( prof.readEntry( "Device" ).isEmpty() ) { | 136 | if ( prof.readEntry( "Device" ).isEmpty() ) { |
140 | return; | 137 | return; |
141 | } | 138 | } |
142 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); | 139 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); |
143 | 140 | ||
144 | atConf->readConfig( prof ); | 141 | atConf->readConfig( prof ); |
145 | } | 142 | } |
146 | 143 | ||
147 | /* | 144 | /* |
148 | * save speed, | 145 | * save speed, |
149 | * flow, | 146 | * flow, |
150 | * parity | 147 | * parity |
151 | */ | 148 | */ |
152 | void ModemConfigWidget::save( Profile& prof ) { | 149 | void ModemConfigWidget::save( Profile& prof ) { |
153 | int flow, parity, speed, data, stop; | 150 | int flow, parity, speed, data, stop; |
154 | flow = parity = speed = data = stop = 0; | 151 | flow = parity = speed = data = stop = 0; |
155 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); | 152 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); |
156 | 153 | ||
157 | 154 | ||
158 | switch( m_base->flow() ) { | 155 | switch( m_base->flow() ) { |
159 | case IOLayerBase::None: | 156 | case IOLayerBase::None: |
160 | flow = 0; | 157 | flow = 0; |
161 | break; | 158 | break; |
162 | case IOLayerBase::Software: | 159 | case IOLayerBase::Software: |
163 | flow = 2; | 160 | flow = 2; |
164 | break; | 161 | break; |
165 | case IOLayerBase::Hardware: | 162 | case IOLayerBase::Hardware: |
166 | flow = 1; | 163 | flow = 1; |
167 | break; | 164 | break; |
168 | } | 165 | } |
169 | 166 | ||
170 | switch( m_base->parity() ) { | 167 | switch( m_base->parity() ) { |
171 | case IOLayerBase::Odd: | 168 | case IOLayerBase::Odd: |
172 | parity = 2; | 169 | parity = 2; |
173 | break; | 170 | break; |
174 | case IOLayerBase::Even: | 171 | case IOLayerBase::Even: |
175 | parity = 1; | 172 | parity = 1; |
176 | break; | 173 | break; |
177 | case IOLayerBase::NonePar: | 174 | case IOLayerBase::NonePar: |
178 | parity = 0; | 175 | parity = 0; |
179 | break; | 176 | break; |
180 | } | 177 | } |
181 | 178 | ||
182 | switch( m_base->speed() ) { | 179 | switch( m_base->speed() ) { |
183 | case IOLayerBase::Baud_115200: | 180 | case IOLayerBase::Baud_115200: |
184 | speed = 115200; | 181 | speed = 115200; |
185 | break; | 182 | break; |
186 | case IOLayerBase::Baud_57600: | 183 | case IOLayerBase::Baud_57600: |
187 | speed = 57600; | 184 | speed = 57600; |
188 | break; | 185 | break; |
189 | case IOLayerBase::Baud_38400: | 186 | case IOLayerBase::Baud_38400: |
190 | speed = 38400; | 187 | speed = 38400; |
191 | break; | 188 | break; |
192 | case IOLayerBase::Baud_19200: | 189 | case IOLayerBase::Baud_19200: |
193 | speed = 19200; | 190 | speed = 19200; |
194 | break; | 191 | break; |
195 | case IOLayerBase::Baud_9600: | 192 | case IOLayerBase::Baud_9600: |
196 | speed = 9600; | 193 | speed = 9600; |
197 | break; | 194 | break; |
198 | } | 195 | } |
199 | 196 | ||
200 | switch( m_base->data() ) { | 197 | switch( m_base->data() ) { |
201 | case IOLayerBase::Data_Five: | 198 | case IOLayerBase::Data_Five: |
202 | data = 5; | 199 | data = 5; |
203 | break; | 200 | break; |
204 | case IOLayerBase::Data_Six: | 201 | case IOLayerBase::Data_Six: |
205 | data = 6; | 202 | data = 6; |
206 | break; | 203 | break; |
207 | case IOLayerBase::Data_Seven: | 204 | case IOLayerBase::Data_Seven: |
208 | data = 7; | 205 | data = 7; |
209 | break; | 206 | break; |
210 | case IOLayerBase::Data_Eight: | 207 | case IOLayerBase::Data_Eight: |
211 | data = 8; | 208 | data = 8; |
212 | break; | 209 | break; |
213 | } | 210 | } |
214 | 211 | ||
215 | switch( m_base->stop() ) { | 212 | switch( m_base->stop() ) { |
216 | case IOLayerBase::Stop_One: | 213 | case IOLayerBase::Stop_One: |
217 | stop = 1; | 214 | stop = 1; |
218 | break; | 215 | break; |
219 | case IOLayerBase::Stop_OnePointFive: | 216 | case IOLayerBase::Stop_OnePointFive: |
220 | stop = 15; | 217 | stop = 15; |
221 | break; | 218 | break; |
222 | case IOLayerBase::Stop_Two: | 219 | case IOLayerBase::Stop_Two: |
223 | stop = 2; | 220 | stop = 2; |
224 | break; | 221 | break; |
225 | } | 222 | } |
226 | 223 | ||
227 | prof.writeEntry( "Flow", flow ); | 224 | prof.writeEntry( "Flow", flow ); |
228 | prof.writeEntry( "Parity", parity ); | 225 | prof.writeEntry( "Parity", parity ); |
229 | prof.writeEntry( "Speed", speed ); | 226 | prof.writeEntry( "Speed", speed ); |
230 | prof.writeEntry("DataBits", data); | 227 | prof.writeEntry("DataBits", data); |
231 | prof.writeEntry("StopBits", stop); | 228 | prof.writeEntry("StopBits", stop); |
232 | prof.writeEntry( "Number", m_telNumber->text() ); | 229 | prof.writeEntry( "Number", m_telNumber->text() ); |
233 | 230 | ||
234 | 231 | ||
235 | atConf->writeConfig(prof); | 232 | atConf->writeConfig(prof); |
236 | } | 233 | } |
237 | 234 | ||
238 | void ModemConfigWidget::slotAT() { | 235 | void ModemConfigWidget::slotAT() { |
239 | // ATConfigDialog conf( this, "ATConfig", true ); | 236 | // ATConfigDialog conf( this, "ATConfig", true ); |
240 | atConf->showMaximized(); | 237 | atConf->showMaximized(); |
241 | if ( atConf->exec() != QDialog::Accepted ) { | 238 | if ( atConf->exec() != QDialog::Accepted ) { |
242 | // reload old settings | 239 | // reload old settings |
243 | } | 240 | } |
244 | } | 241 | } |
245 | 242 | ||
246 | void ModemConfigWidget::slotDial() { | 243 | void ModemConfigWidget::slotDial() { |
247 | DialDialog dial( this, "DialConfig", true ); | 244 | DialDialog dial( this, "DialConfig", true ); |
248 | if(!m_telNumber->text().isEmpty()) { | 245 | if(!m_telNumber->text().isEmpty()) { |
249 | dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), "")); | 246 | dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), "")); |
250 | } | 247 | } |
251 | dial.showMaximized(); | 248 | dial.showMaximized(); |
252 | if ( dial.exec() == QDialog::Accepted ) { | 249 | if ( dial.exec() == QDialog::Accepted ) { |
253 | m_telNumber->setText( dial.number() ); | 250 | m_telNumber->setText( dial.number() ); |
254 | } | 251 | } |
255 | } | 252 | } |
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp index eb14a3f..a8cee93 100644 --- a/noncore/apps/opie-console/terminalwidget.cpp +++ b/noncore/apps/opie-console/terminalwidget.cpp | |||
@@ -1,227 +1,225 @@ | |||
1 | #include <qbuttongroup.h> | 1 | #include <qbuttongroup.h> |
2 | #include <qlabel.h> | 2 | #include <qlabel.h> |
3 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
4 | #include <qcombobox.h> | 4 | #include <qcombobox.h> |
5 | #include <qradiobutton.h> | 5 | #include <qradiobutton.h> |
6 | #include <qgroupbox.h> | 6 | #include <qgroupbox.h> |
7 | #include <qvbox.h> | 7 | #include <qvbox.h> |
8 | #include <qhgroupbox.h> | 8 | #include <qhgroupbox.h> |
9 | #include <qhbuttongroup.h> | 9 | #include <qhbuttongroup.h> |
10 | #include <qlayout.h> | 10 | #include <qlayout.h> |
11 | #include <qhbox.h> | 11 | #include <qhbox.h> |
12 | 12 | ||
13 | #include "terminalwidget.h" | 13 | #include "terminalwidget.h" |
14 | 14 | ||
15 | namespace { | 15 | namespace { |
16 | enum TermIds { | 16 | enum TermIds { |
17 | id_term_vt100 = 0, | 17 | id_term_vt100 = 0, |
18 | id_term_vt102, | 18 | id_term_vt102, |
19 | id_term_linux, | 19 | id_term_linux, |
20 | id_term_xterm | 20 | id_term_xterm |
21 | }; | 21 | }; |
22 | 22 | ||
23 | enum ColourIds { | 23 | enum ColourIds { |
24 | id_term_black, | 24 | id_term_black, |
25 | id_term_white, | 25 | id_term_white, |
26 | id_term_green, | 26 | id_term_green, |
27 | id_term_orange | 27 | id_term_orange |
28 | }; | 28 | }; |
29 | 29 | ||
30 | enum FontIds { | 30 | enum FontIds { |
31 | id_size_small, | 31 | id_size_small, |
32 | id_size_medium, | 32 | id_size_medium, |
33 | id_size_large | 33 | id_size_large |
34 | }; | 34 | }; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, | 37 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, |
38 | const char* na ) | 38 | const char* na ) |
39 | : ProfileDialogTerminalWidget( name, parent, na ) { | 39 | : ProfileDialogTerminalWidget( name, parent, na ) { |
40 | 40 | ||
41 | m_terminal = new QLabel(tr("Terminal Type"), this ); | 41 | m_terminal = new QLabel(tr("Terminal Type"), this ); |
42 | m_terminalBox = new QComboBox(this); | 42 | m_terminalBox = new QComboBox(this); |
43 | m_colorLabel = new QLabel(tr("Color scheme"), this); | 43 | m_colorLabel = new QLabel(tr("Color scheme"), this); |
44 | m_colorCmb = new QComboBox(this ); | 44 | m_colorCmb = new QComboBox(this ); |
45 | 45 | ||
46 | m_groupSize = new QHButtonGroup(tr("Font size"), this ); | 46 | m_groupSize = new QHButtonGroup(tr("Font size"), this ); |
47 | m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); | 47 | m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); |
48 | m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); | 48 | m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); |
49 | m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); | 49 | m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); |
50 | 50 | ||
51 | m_groupConv = new QHGroupBox(tr("Line-break conversions"), this ); | 51 | m_groupConv = new QHGroupBox(tr("Line-break conversions"), this ); |
52 | m_convInbound = new QCheckBox(tr("Inbound"), m_groupConv ); | 52 | m_convInbound = new QCheckBox(tr("Inbound"), m_groupConv ); |
53 | m_convOutbound = new QCheckBox(tr("Outbound"), m_groupConv ); | 53 | m_convOutbound = new QCheckBox(tr("Outbound"), m_groupConv ); |
54 | m_groupConv->hide(); | ||
55 | 54 | ||
56 | m_groupOptions = new QHGroupBox( tr("Options"), this ); | 55 | m_groupOptions = new QHGroupBox( tr("Options"), this ); |
57 | m_optionEcho = new QCheckBox(tr("Local echo"), m_groupOptions ); | 56 | m_optionEcho = new QCheckBox(tr("Local echo"), m_groupOptions ); |
58 | m_optionWrap = new QCheckBox(tr("Line wrap"), m_groupOptions ); | 57 | m_optionWrap = new QCheckBox(tr("Line wrap"), m_groupOptions ); |
59 | m_groupOptions->hide(); | ||
60 | 58 | ||
61 | m_lroot = new QVBoxLayout( this ); | 59 | m_lroot = new QVBoxLayout( this ); |
62 | m_typeBox = new QVBoxLayout( m_lroot ); | 60 | m_typeBox = new QVBoxLayout( m_lroot ); |
63 | m_colorBox = new QVBoxLayout( m_lroot ); | 61 | m_colorBox = new QVBoxLayout( m_lroot ); |
64 | 62 | ||
65 | // Layout | 63 | // Layout |
66 | m_typeBox->add(m_terminal ); | 64 | m_typeBox->add(m_terminal ); |
67 | m_typeBox->add(m_terminalBox ); | 65 | m_typeBox->add(m_terminalBox ); |
68 | m_lroot->add(m_groupSize ); | 66 | m_lroot->add(m_groupSize ); |
69 | 67 | ||
70 | m_colorBox->add( m_colorLabel ); | 68 | m_colorBox->add( m_colorLabel ); |
71 | m_colorBox->add( m_colorCmb ); | 69 | m_colorBox->add( m_colorCmb ); |
72 | 70 | ||
73 | m_lroot->add(m_groupConv ); | 71 | m_lroot->add(m_groupConv ); |
74 | m_lroot->add(m_groupOptions ); | 72 | m_lroot->add(m_groupOptions ); |
75 | m_lroot->addStretch( 0 ); | 73 | m_lroot->addStretch( 0 ); |
76 | 74 | ||
77 | // Fill in some options | 75 | // Fill in some options |
78 | qWarning("Options for terminal box"); | 76 | qWarning("Options for terminal box"); |
79 | m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ ); | 77 | m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ ); |
80 | m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */); | 78 | m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */); |
81 | m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux ); | 79 | m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux ); |
82 | m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm ); | 80 | m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm ); |
83 | //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); | 81 | //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); |
84 | 82 | ||
85 | m_colorCmb->insertItem( tr("black on white"), id_term_black ); | 83 | m_colorCmb->insertItem( tr("black on white"), id_term_black ); |
86 | m_colorCmb->insertItem( tr("white on black"), id_term_white ); | 84 | m_colorCmb->insertItem( tr("white on black"), id_term_white ); |
87 | m_colorCmb->insertItem( tr("green on black"), id_term_green ); | 85 | m_colorCmb->insertItem( tr("green on black"), id_term_green ); |
88 | m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); | 86 | m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); |
89 | 87 | ||
90 | // signals + slots | 88 | // signals + slots |
91 | /* | 89 | /* |
92 | connect(m_terminalBox, SIGNAL(activated(int) ), | 90 | connect(m_terminalBox, SIGNAL(activated(int) ), |
93 | this, SLOT(slotTermTerm(int) ) ); | 91 | this, SLOT(slotTermTerm(int) ) ); |
94 | connect(m_colorBox, SIGNAL(activated(int) ), | 92 | connect(m_colorBox, SIGNAL(activated(int) ), |
95 | tis, SLOT(slotTermColor(int) ) ); | 93 | tis, SLOT(slotTermColor(int) ) ); |
96 | connect(m_groupSize, SIGNAL(activated(int) ), | 94 | connect(m_groupSize, SIGNAL(activated(int) ), |
97 | this, SLOT(slotTermFont(int) ) ); | 95 | this, SLOT(slotTermFont(int) ) ); |
98 | 96 | ||
99 | connect(m_optionEcho, SIGNAL(toggled(bool) ), | 97 | connect(m_optionEcho, SIGNAL(toggled(bool) ), |
100 | this, SLOT(slotTermEcho(bool) ) ); | 98 | this, SLOT(slotTermEcho(bool) ) ); |
101 | connect(m_optionWrap, SIGNAL(toggled(bool) ), | 99 | connect(m_optionWrap, SIGNAL(toggled(bool) ), |
102 | this, SLOT(slotTermWrap(bool) ) ); | 100 | this, SLOT(slotTermWrap(bool) ) ); |
103 | connect(m_convInbound, SIGNAL(toggled(bool) ), | 101 | connect(m_convInbound, SIGNAL(toggled(bool) ), |
104 | this, SLOT(slotTermInbound(bool) ) ); | 102 | this, SLOT(slotTermInbound(bool) ) ); |
105 | connect(m_convOutbound, SIGNAL(toggled(bool) ), | 103 | connect(m_convOutbound, SIGNAL(toggled(bool) ), |
106 | this, SLOT(slotTermOutbound(bool) ) ); | 104 | this, SLOT(slotTermOutbound(bool) ) ); |
107 | */ | 105 | */ |
108 | } | 106 | } |
109 | TerminalWidget::~TerminalWidget() { | 107 | TerminalWidget::~TerminalWidget() { |
110 | } | 108 | } |
111 | void TerminalWidget::load( const Profile& prof ) { | 109 | void TerminalWidget::load( const Profile& prof ) { |
112 | int term = prof.readNumEntry("Terminal"); | 110 | int term = prof.readNumEntry("Terminal"); |
113 | int color = prof.readNumEntry("Color"); | 111 | int color = prof.readNumEntry("Color"); |
114 | int fontsize = prof.readNumEntry("Font"); | 112 | int fontsize = prof.readNumEntry("Font"); |
115 | int opt_echo = prof.readNumEntry("Echo"); | 113 | int opt_echo = prof.readNumEntry("Echo"); |
116 | int opt_wrap = prof.readNumEntry("Wrap"); | 114 | int opt_wrap = prof.readNumEntry("Wrap"); |
117 | int opt_inbound = prof.readNumEntry("Inbound"); | 115 | int opt_inbound = prof.readNumEntry("Inbound"); |
118 | int opt_outbound = prof.readNumEntry("Outbound"); | 116 | int opt_outbound = prof.readNumEntry("Outbound"); |
119 | 117 | ||
120 | switch( term ) { | 118 | switch( term ) { |
121 | case Profile::VT100: | 119 | case Profile::VT100: |
122 | m_terminalBox->setCurrentItem(id_term_vt100 ); | 120 | m_terminalBox->setCurrentItem(id_term_vt100 ); |
123 | break; | 121 | break; |
124 | case Profile::VT102: | 122 | case Profile::VT102: |
125 | m_terminalBox->setCurrentItem(id_term_vt102 ); | 123 | m_terminalBox->setCurrentItem(id_term_vt102 ); |
126 | break; | 124 | break; |
127 | case Profile::Linux: | 125 | case Profile::Linux: |
128 | m_terminalBox->setCurrentItem(id_term_linux ); | 126 | m_terminalBox->setCurrentItem(id_term_linux ); |
129 | break; | 127 | break; |
130 | case Profile::XTerm: | 128 | case Profile::XTerm: |
131 | m_terminalBox->setCurrentItem(id_term_xterm ); | 129 | m_terminalBox->setCurrentItem(id_term_xterm ); |
132 | break; | 130 | break; |
133 | default: | 131 | default: |
134 | m_terminalBox->setCurrentItem(id_term_vt102 ); | 132 | m_terminalBox->setCurrentItem(id_term_vt102 ); |
135 | break; | 133 | break; |
136 | }; | 134 | }; |
137 | 135 | ||
138 | switch( color ) { | 136 | switch( color ) { |
139 | case Profile::Black: | 137 | case Profile::Black: |
140 | m_colorCmb->setCurrentItem(id_term_black ); | 138 | m_colorCmb->setCurrentItem(id_term_black ); |
141 | break; | 139 | break; |
142 | case Profile::White: | 140 | case Profile::White: |
143 | m_colorCmb->setCurrentItem(id_term_white ); | 141 | m_colorCmb->setCurrentItem(id_term_white ); |
144 | break; | 142 | break; |
145 | case Profile::Green: | 143 | case Profile::Green: |
146 | m_colorCmb->setCurrentItem(id_term_green ); | 144 | m_colorCmb->setCurrentItem(id_term_green ); |
147 | break; | 145 | break; |
148 | case Profile::Orange: | 146 | case Profile::Orange: |
149 | m_colorCmb->setCurrentItem(id_term_orange ); | 147 | m_colorCmb->setCurrentItem(id_term_orange ); |
150 | break; | 148 | break; |
151 | default: | 149 | default: |
152 | break; | 150 | break; |
153 | }; | 151 | }; |
154 | 152 | ||
155 | switch( fontsize ) { | 153 | switch( fontsize ) { |
156 | case Profile::Micro: | 154 | case Profile::Micro: |
157 | m_sizeSmall->setChecked(true ); | 155 | m_sizeSmall->setChecked(true ); |
158 | break; | 156 | break; |
159 | case Profile::Small: | 157 | case Profile::Small: |
160 | m_sizeMedium->setChecked(true ); | 158 | m_sizeMedium->setChecked(true ); |
161 | break; | 159 | break; |
162 | case Profile::Medium: | 160 | case Profile::Medium: |
163 | m_sizeLarge->setChecked( true ); | 161 | m_sizeLarge->setChecked( true ); |
164 | break; | 162 | break; |
165 | default: | 163 | default: |
166 | m_sizeMedium->setChecked(true ); | 164 | m_sizeMedium->setChecked(true ); |
167 | break; | 165 | break; |
168 | }; | 166 | }; |
169 | 167 | ||
170 | if (opt_echo) m_optionEcho->setChecked( true ); | 168 | if (opt_echo) m_optionEcho->setChecked( true ); |
171 | if (opt_wrap) m_optionWrap->setChecked( true ); | 169 | if (opt_wrap) m_optionWrap->setChecked( true ); |
172 | if (opt_inbound) m_convInbound->setChecked( true ); | 170 | if (opt_inbound) m_convInbound->setChecked( true ); |
173 | if (opt_outbound) m_convOutbound->setChecked( true ); | 171 | if (opt_outbound) m_convOutbound->setChecked( true ); |
174 | 172 | ||
175 | } | 173 | } |
176 | void TerminalWidget::save( Profile& profile ) { | 174 | void TerminalWidget::save( Profile& profile ) { |
177 | switch(m_terminalBox->currentItem() ) { | 175 | switch(m_terminalBox->currentItem() ) { |
178 | case id_term_vt100: | 176 | case id_term_vt100: |
179 | profile.writeEntry("Terminal", Profile::VT100 ); | 177 | profile.writeEntry("Terminal", Profile::VT100 ); |
180 | break; | 178 | break; |
181 | case id_term_vt102: | 179 | case id_term_vt102: |
182 | profile.writeEntry("Terminal", Profile::VT102 ); | 180 | profile.writeEntry("Terminal", Profile::VT102 ); |
183 | break; | 181 | break; |
184 | case id_term_linux: | 182 | case id_term_linux: |
185 | profile.writeEntry("Terminal", Profile::Linux ); | 183 | profile.writeEntry("Terminal", Profile::Linux ); |
186 | break; | 184 | break; |
187 | case id_term_xterm: | 185 | case id_term_xterm: |
188 | profile.writeEntry("Terminal", Profile::XTerm ); | 186 | profile.writeEntry("Terminal", Profile::XTerm ); |
189 | break; | 187 | break; |
190 | //case id_term_ansi: | 188 | //case id_term_ansi: |
191 | // profile.writeEntry("Terminal", Profile::VT102 ); | 189 | // profile.writeEntry("Terminal", Profile::VT102 ); |
192 | // break; | 190 | // break; |
193 | default: | 191 | default: |
194 | break; | 192 | break; |
195 | }; | 193 | }; |
196 | 194 | ||
197 | // color | 195 | // color |
198 | switch(m_colorCmb->currentItem() ) { | 196 | switch(m_colorCmb->currentItem() ) { |
199 | case id_term_black: | 197 | case id_term_black: |
200 | profile.writeEntry("Color", Profile::Black ); | 198 | profile.writeEntry("Color", Profile::Black ); |
201 | break; | 199 | break; |
202 | case id_term_white: | 200 | case id_term_white: |
203 | profile.writeEntry("Color", Profile::White ); | 201 | profile.writeEntry("Color", Profile::White ); |
204 | break; | 202 | break; |
205 | case id_term_green: | 203 | case id_term_green: |
206 | profile.writeEntry("Color", Profile::Green ); | 204 | profile.writeEntry("Color", Profile::Green ); |
207 | break; | 205 | break; |
208 | case id_term_orange: | 206 | case id_term_orange: |
209 | profile.writeEntry("Color", Profile::Orange ); | 207 | profile.writeEntry("Color", Profile::Orange ); |
210 | break; | 208 | break; |
211 | default: | 209 | default: |
212 | break; | 210 | break; |
213 | }; | 211 | }; |
214 | 212 | ||
215 | if (m_sizeSmall->isChecked() ) { | 213 | if (m_sizeSmall->isChecked() ) { |
216 | profile.writeEntry("Font", Profile::Micro ); | 214 | profile.writeEntry("Font", Profile::Micro ); |
217 | }else if (m_sizeMedium->isChecked() ) { | 215 | }else if (m_sizeMedium->isChecked() ) { |
218 | profile.writeEntry("Font", Profile::Small ); | 216 | profile.writeEntry("Font", Profile::Small ); |
219 | }else { | 217 | }else { |
220 | profile.writeEntry("Font", Profile::Medium ); | 218 | profile.writeEntry("Font", Profile::Medium ); |
221 | } | 219 | } |
222 | 220 | ||
223 | profile.writeEntry("Echo", m_optionEcho->isChecked() ); | 221 | profile.writeEntry("Echo", m_optionEcho->isChecked() ); |
224 | profile.writeEntry("Wrap", m_optionWrap->isChecked() ); | 222 | profile.writeEntry("Wrap", m_optionWrap->isChecked() ); |
225 | profile.writeEntry("Inbound", m_convInbound->isChecked() ); | 223 | profile.writeEntry("Inbound", m_convInbound->isChecked() ); |
226 | profile.writeEntry("Outbound",m_convOutbound->isChecked() ); | 224 | profile.writeEntry("Outbound",m_convOutbound->isChecked() ); |
227 | } | 225 | } |