-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/profile.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/terminalwidget.cpp | 21 |
4 files changed, 15 insertions, 10 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 27bcc09..415259e 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -85,254 +85,255 @@ void MainWindow::initUI() { | |||
85 | * terminate action | 85 | * terminate action |
86 | */ | 86 | */ |
87 | m_terminate = new QAction(); | 87 | m_terminate = new QAction(); |
88 | m_terminate->setText( tr("Terminate") ); | 88 | m_terminate->setText( tr("Terminate") ); |
89 | m_terminate->addTo( m_console ); | 89 | m_terminate->addTo( m_console ); |
90 | connect(m_terminate, SIGNAL(activated() ), | 90 | connect(m_terminate, SIGNAL(activated() ), |
91 | this, SLOT(slotTerminate() ) ); | 91 | this, SLOT(slotTerminate() ) ); |
92 | 92 | ||
93 | a = new QAction(); | 93 | a = new QAction(); |
94 | a->setText( tr("Close Window") ); | 94 | a->setText( tr("Close Window") ); |
95 | a->addTo( m_console ); | 95 | a->addTo( m_console ); |
96 | connect(a, SIGNAL(activated() ), | 96 | connect(a, SIGNAL(activated() ), |
97 | this, SLOT(slotClose() ) ); | 97 | this, SLOT(slotClose() ) ); |
98 | 98 | ||
99 | /* | 99 | /* |
100 | * the settings action | 100 | * the settings action |
101 | */ | 101 | */ |
102 | m_setProfiles = new QAction(tr("Configure Profiles"), | 102 | m_setProfiles = new QAction(tr("Configure Profiles"), |
103 | Resource::loadPixmap( "SettingsIcon" ), | 103 | Resource::loadPixmap( "SettingsIcon" ), |
104 | QString::null, 0, this, 0); | 104 | QString::null, 0, this, 0); |
105 | m_setProfiles->addTo( m_settings ); | 105 | m_setProfiles->addTo( m_settings ); |
106 | m_setProfiles->addTo( m_icons ); | 106 | m_setProfiles->addTo( m_icons ); |
107 | connect( m_setProfiles, SIGNAL(activated() ), | 107 | connect( m_setProfiles, SIGNAL(activated() ), |
108 | this, SLOT(slotConfigure() ) ); | 108 | this, SLOT(slotConfigure() ) ); |
109 | 109 | ||
110 | /* | 110 | /* |
111 | * script actions | 111 | * script actions |
112 | */ | 112 | */ |
113 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 113 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
114 | m_recordScript->addTo(m_scripts); | 114 | m_recordScript->addTo(m_scripts); |
115 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 115 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
116 | 116 | ||
117 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 117 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
118 | m_saveScript->addTo(m_scripts); | 118 | m_saveScript->addTo(m_scripts); |
119 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 119 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
120 | 120 | ||
121 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 121 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
122 | m_runScript->addTo(m_scripts); | 122 | m_runScript->addTo(m_scripts); |
123 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 123 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
124 | 124 | ||
125 | /* | 125 | /* |
126 | * action that open/closes the keyboard | 126 | * action that open/closes the keyboard |
127 | */ | 127 | */ |
128 | m_openKeys = new QAction (tr("Open Keyboard..."), | 128 | m_openKeys = new QAction (tr("Open Keyboard..."), |
129 | Resource::loadPixmap( "down" ), | 129 | Resource::loadPixmap( "down" ), |
130 | QString::null, 0, this, 0); | 130 | QString::null, 0, this, 0); |
131 | 131 | ||
132 | m_openKeys->setToggleAction(true); | 132 | m_openKeys->setToggleAction(true); |
133 | 133 | ||
134 | connect (m_openKeys, SIGNAL(toggled(bool)), | 134 | connect (m_openKeys, SIGNAL(toggled(bool)), |
135 | this, SLOT(slotOpenKeb(bool))); | 135 | this, SLOT(slotOpenKeb(bool))); |
136 | m_openKeys->addTo(m_icons); | 136 | m_openKeys->addTo(m_icons); |
137 | 137 | ||
138 | 138 | ||
139 | /* insert the submenu */ | 139 | /* insert the submenu */ |
140 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 140 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
141 | -1, 0); | 141 | -1, 0); |
142 | 142 | ||
143 | /* insert the connection menu */ | 143 | /* insert the connection menu */ |
144 | m_bar->insertItem( tr("Connection"), m_console ); | 144 | m_bar->insertItem( tr("Connection"), m_console ); |
145 | 145 | ||
146 | /* the scripts menu */ | 146 | /* the scripts menu */ |
147 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 147 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
148 | 148 | ||
149 | /* the settings menu */ | 149 | /* the settings menu */ |
150 | m_bar->insertItem( tr("Settings"), m_settings ); | 150 | m_bar->insertItem( tr("Settings"), m_settings ); |
151 | 151 | ||
152 | /* and the keyboard */ | 152 | /* and the keyboard */ |
153 | m_keyBar = new QToolBar(this); | 153 | m_keyBar = new QToolBar(this); |
154 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 154 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
155 | m_keyBar->setHorizontalStretchable( TRUE ); | 155 | m_keyBar->setHorizontalStretchable( TRUE ); |
156 | m_keyBar->hide(); | 156 | m_keyBar->hide(); |
157 | 157 | ||
158 | m_kb = new FunctionKeyboard(m_keyBar); | 158 | m_kb = new FunctionKeyboard(m_keyBar); |
159 | 159 | ||
160 | /* | 160 | /* |
161 | * connect to the menu activation | 161 | * connect to the menu activation |
162 | */ | 162 | */ |
163 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 163 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
164 | this, SLOT(slotProfile( int ) ) ); | 164 | this, SLOT(slotProfile( int ) ) ); |
165 | 165 | ||
166 | m_consoleWindow = new TabWidget( this, "blah"); | 166 | m_consoleWindow = new TabWidget( this, "blah"); |
167 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 167 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
168 | this, SLOT(slotSessionChanged(Session*) ) ); | 168 | this, SLOT(slotSessionChanged(Session*) ) ); |
169 | setCentralWidget( m_consoleWindow ); | 169 | setCentralWidget( m_consoleWindow ); |
170 | 170 | ||
171 | } | 171 | } |
172 | 172 | ||
173 | ProfileManager* MainWindow::manager() { | 173 | ProfileManager* MainWindow::manager() { |
174 | return m_manager; | 174 | return m_manager; |
175 | } | 175 | } |
176 | TabWidget* MainWindow::tabWidget() { | 176 | TabWidget* MainWindow::tabWidget() { |
177 | return m_consoleWindow; | 177 | return m_consoleWindow; |
178 | } | 178 | } |
179 | void MainWindow::populateProfiles() { | 179 | void MainWindow::populateProfiles() { |
180 | m_sessionsPop->clear(); | 180 | m_sessionsPop->clear(); |
181 | Profile::ValueList list = manager()->all(); | 181 | Profile::ValueList list = manager()->all(); |
182 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 182 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
183 | m_sessionsPop->insertItem( (*it).name() ); | 183 | m_sessionsPop->insertItem( (*it).name() ); |
184 | } | 184 | } |
185 | 185 | ||
186 | } | 186 | } |
187 | MainWindow::~MainWindow() { | 187 | MainWindow::~MainWindow() { |
188 | delete m_factory; | 188 | delete m_factory; |
189 | manager()->save(); | 189 | manager()->save(); |
190 | } | 190 | } |
191 | 191 | ||
192 | MetaFactory* MainWindow::factory() { | 192 | MetaFactory* MainWindow::factory() { |
193 | return m_factory; | 193 | return m_factory; |
194 | } | 194 | } |
195 | 195 | ||
196 | Session* MainWindow::currentSession() { | 196 | Session* MainWindow::currentSession() { |
197 | return m_curSession; | 197 | return m_curSession; |
198 | } | 198 | } |
199 | 199 | ||
200 | QList<Session> MainWindow::sessions() { | 200 | QList<Session> MainWindow::sessions() { |
201 | return m_sessions; | 201 | return m_sessions; |
202 | } | 202 | } |
203 | 203 | ||
204 | void MainWindow::slotNew() { | 204 | void MainWindow::slotNew() { |
205 | qWarning("New Connection"); | 205 | qWarning("New Connection"); |
206 | ProfileEditorDialog dlg(factory() ); | 206 | ProfileEditorDialog dlg(factory() ); |
207 | dlg.showMaximized(); | 207 | dlg.showMaximized(); |
208 | int ret = dlg.exec(); | 208 | int ret = dlg.exec(); |
209 | 209 | ||
210 | if ( ret == QDialog::Accepted ) { | 210 | if ( ret == QDialog::Accepted ) { |
211 | create( dlg.profile() ); | 211 | create( dlg.profile() ); |
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | void MainWindow::slotRecordScript() { | 215 | void MainWindow::slotRecordScript() { |
216 | if (currentSession()) { | 216 | if (currentSession()) { |
217 | currentSession()->emulationLayer()->startRecording(); | 217 | currentSession()->emulationLayer()->startRecording(); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | void MainWindow::slotSaveScript() { | 221 | void MainWindow::slotSaveScript() { |
222 | if (currentSession() && currentSession()->emulationLayer()->isRecording()) { | 222 | if (currentSession() && currentSession()->emulationLayer()->isRecording()) { |
223 | MimeTypes types; | 223 | MimeTypes types; |
224 | QStringList script; | 224 | QStringList script; |
225 | script << "text/plain"; | 225 | script << "text/plain"; |
226 | types.insert("Script", script); | 226 | types.insert("Script", script); |
227 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 227 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
228 | if (!filename.isEmpty()) { | 228 | if (!filename.isEmpty()) { |
229 | currentSession()->emulationLayer()->script()->saveTo(filename); | 229 | currentSession()->emulationLayer()->script()->saveTo(filename); |
230 | currentSession()->emulationLayer()->clearScript(); | 230 | currentSession()->emulationLayer()->clearScript(); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | void MainWindow::slotRunScript() { | 235 | void MainWindow::slotRunScript() { |
236 | if (currentSession()) { | 236 | if (currentSession()) { |
237 | MimeTypes types; | 237 | MimeTypes types; |
238 | QStringList script; | 238 | QStringList script; |
239 | script << "text/plain"; | 239 | script << "text/plain"; |
240 | types.insert("Script", script); | 240 | types.insert("Script", script); |
241 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 241 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
242 | if (!filename.isEmpty()) { | 242 | if (!filename.isEmpty()) { |
243 | Script script(DocLnk(filename).file()); | 243 | Script script(DocLnk(filename).file()); |
244 | currentSession()->emulationLayer()->runScript(&script); | 244 | currentSession()->emulationLayer()->runScript(&script); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | void MainWindow::slotConnect() { | 249 | void MainWindow::slotConnect() { |
250 | if ( currentSession() ) | 250 | if ( currentSession() ) |
251 | currentSession()->layer()->open(); | 251 | currentSession()->layer()->open(); |
252 | } | 252 | } |
253 | 253 | ||
254 | void MainWindow::slotDisconnect() { | 254 | void MainWindow::slotDisconnect() { |
255 | if ( currentSession() ) | 255 | if ( currentSession() ) |
256 | currentSession()->layer()->close(); | 256 | currentSession()->layer()->close(); |
257 | } | 257 | } |
258 | 258 | ||
259 | void MainWindow::slotTerminate() { | 259 | void MainWindow::slotTerminate() { |
260 | if ( currentSession() ) | 260 | if ( currentSession() ) |
261 | currentSession()->layer()->close(); | 261 | currentSession()->layer()->close(); |
262 | 262 | ||
263 | slotClose(); | 263 | slotClose(); |
264 | /* FIXME move to the next session */ | 264 | /* FIXME move to the next session */ |
265 | } | 265 | } |
266 | 266 | ||
267 | void MainWindow::slotConfigure() { | 267 | void MainWindow::slotConfigure() { |
268 | qWarning("configure"); | 268 | qWarning("configure"); |
269 | ConfigDialog conf( manager()->all(), factory() ); | 269 | ConfigDialog conf( manager()->all(), factory() ); |
270 | conf.showMaximized(); | 270 | conf.showMaximized(); |
271 | 271 | ||
272 | int ret = conf.exec(); | 272 | int ret = conf.exec(); |
273 | 273 | ||
274 | if ( QDialog::Accepted == ret ) { | 274 | if ( QDialog::Accepted == ret ) { |
275 | qWarning("conf %d", conf.list().count() ); | 275 | qWarning("conf %d", conf.list().count() ); |
276 | manager()->setProfiles( conf.list() ); | 276 | manager()->setProfiles( conf.list() ); |
277 | manager()->save(); | ||
277 | populateProfiles(); | 278 | populateProfiles(); |
278 | } | 279 | } |
279 | } | 280 | } |
280 | /* | 281 | /* |
281 | * we will remove | 282 | * we will remove |
282 | * this window from the tabwidget | 283 | * this window from the tabwidget |
283 | * remove it from the list | 284 | * remove it from the list |
284 | * delete it | 285 | * delete it |
285 | * and set the currentSession() | 286 | * and set the currentSession() |
286 | */ | 287 | */ |
287 | void MainWindow::slotClose() { | 288 | void MainWindow::slotClose() { |
288 | qWarning("close"); | 289 | qWarning("close"); |
289 | if (!currentSession() ) | 290 | if (!currentSession() ) |
290 | return; | 291 | return; |
291 | 292 | ||
292 | tabWidget()->remove( currentSession() ); | 293 | tabWidget()->remove( currentSession() ); |
293 | /*it's autodelete */ | 294 | /*it's autodelete */ |
294 | m_sessions.remove( m_curSession ); | 295 | m_sessions.remove( m_curSession ); |
295 | m_curSession = m_sessions.first(); | 296 | m_curSession = m_sessions.first(); |
296 | tabWidget()->setCurrent( m_curSession ); | 297 | tabWidget()->setCurrent( m_curSession ); |
297 | } | 298 | } |
298 | 299 | ||
299 | /* | 300 | /* |
300 | * We will get the name | 301 | * We will get the name |
301 | * Then the profile | 302 | * Then the profile |
302 | * and then we will make a profile | 303 | * and then we will make a profile |
303 | */ | 304 | */ |
304 | void MainWindow::slotProfile( int id) { | 305 | void MainWindow::slotProfile( int id) { |
305 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 306 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
306 | create( prof ); | 307 | create( prof ); |
307 | } | 308 | } |
308 | void MainWindow::create( const Profile& prof ) { | 309 | void MainWindow::create( const Profile& prof ) { |
309 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 310 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
310 | 311 | ||
311 | m_sessions.append( ses ); | 312 | m_sessions.append( ses ); |
312 | tabWidget()->add( ses ); | 313 | tabWidget()->add( ses ); |
313 | m_curSession = ses; | 314 | m_curSession = ses; |
314 | 315 | ||
315 | } | 316 | } |
316 | 317 | ||
317 | void MainWindow::slotTransfer() | 318 | void MainWindow::slotTransfer() |
318 | { | 319 | { |
319 | // if ( currentSession() ) { | 320 | // if ( currentSession() ) { |
320 | TransferDialog dlg(this); | 321 | TransferDialog dlg(this); |
321 | dlg.showMaximized(); | 322 | dlg.showMaximized(); |
322 | dlg.exec(); | 323 | dlg.exec(); |
323 | // } | 324 | // } |
324 | } | 325 | } |
325 | 326 | ||
326 | 327 | ||
327 | void MainWindow::slotOpenKeb(bool state) { | 328 | void MainWindow::slotOpenKeb(bool state) { |
328 | 329 | ||
329 | if (state) m_keyBar->show(); | 330 | if (state) m_keyBar->show(); |
330 | else m_keyBar->hide(); | 331 | else m_keyBar->hide(); |
331 | 332 | ||
332 | } | 333 | } |
333 | void MainWindow::slotSessionChanged( Session* ses ) { | 334 | void MainWindow::slotSessionChanged( Session* ses ) { |
334 | if ( ses ) { | 335 | if ( ses ) { |
335 | qWarning("changing %s", ses->name().latin1() ); | 336 | qWarning("changing %s", ses->name().latin1() ); |
336 | m_curSession = ses; | 337 | m_curSession = ses; |
337 | } | 338 | } |
338 | } | 339 | } |
diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h index 78fe6ab..1b71cda 100644 --- a/noncore/apps/opie-console/profile.h +++ b/noncore/apps/opie-console/profile.h | |||
@@ -1,71 +1,71 @@ | |||
1 | #ifndef OPIE_PROFILE_H | 1 | #ifndef OPIE_PROFILE_H |
2 | #define OPIE_PROFILE_H | 2 | #define OPIE_PROFILE_H |
3 | 3 | ||
4 | #include <qmap.h> | 4 | #include <qmap.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | #include <qstringlist.h> | 6 | #include <qstringlist.h> |
7 | #include <qvaluelist.h> | 7 | #include <qvaluelist.h> |
8 | /** | 8 | /** |
9 | * A session will be generated from a saved | 9 | * A session will be generated from a saved |
10 | * profile. A profile contains the iolayername | 10 | * profile. A profile contains the iolayername |
11 | * a name. | 11 | * a name. |
12 | * We can generate a Session from a Profile | 12 | * We can generate a Session from a Profile |
13 | * Configuration is contained here too | 13 | * Configuration is contained here too |
14 | */ | 14 | */ |
15 | class Profile { | 15 | class Profile { |
16 | public: | 16 | public: |
17 | typedef QValueList<Profile> ValueList; | 17 | typedef QValueList<Profile> ValueList; |
18 | enum Color { Black = 0, | 18 | enum Color { Black = 0, |
19 | White, | 19 | White, |
20 | Gray }; | 20 | Gray }; |
21 | enum Terminal {VT102 = 0 }; | 21 | enum Terminal {VT102 = 0, VT100 }; |
22 | enum Font { Micro = 0, Small, Medium }; | 22 | enum Font { Micro = 0, Small, Medium }; |
23 | Profile(); | 23 | Profile(); |
24 | Profile( const QString& name, | 24 | Profile( const QString& name, |
25 | const QCString& iolayerName, | 25 | const QCString& iolayerName, |
26 | const QCString& termName, | 26 | const QCString& termName, |
27 | int background, | 27 | int background, |
28 | int foreground, | 28 | int foreground, |
29 | int terminal); | 29 | int terminal); |
30 | Profile( const Profile& ); | 30 | Profile( const Profile& ); |
31 | Profile &operator=( const Profile& ); | 31 | Profile &operator=( const Profile& ); |
32 | bool operator==( const Profile& prof ); | 32 | bool operator==( const Profile& prof ); |
33 | 33 | ||
34 | ~Profile(); | 34 | ~Profile(); |
35 | QString name()const; | 35 | QString name()const; |
36 | QCString ioLayerName()const; | 36 | QCString ioLayerName()const; |
37 | QCString terminalName()const; | 37 | QCString terminalName()const; |
38 | int foreground()const; | 38 | int foreground()const; |
39 | int background()const; | 39 | int background()const; |
40 | int terminal()const; | 40 | int terminal()const; |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * config stuff | 43 | * config stuff |
44 | */ | 44 | */ |
45 | QMap<QString, QString> conf()const; | 45 | QMap<QString, QString> conf()const; |
46 | void clearConf(); | 46 | void clearConf(); |
47 | void writeEntry( const QString& key, const QString& value ); | 47 | void writeEntry( const QString& key, const QString& value ); |
48 | void writeEntry( const QString& key, int num ); | 48 | void writeEntry( const QString& key, int num ); |
49 | void writeEntry( const QString& key, bool b ); | 49 | void writeEntry( const QString& key, bool b ); |
50 | void writeEntry( const QString& key, const QStringList&, const QChar& ); | 50 | void writeEntry( const QString& key, const QStringList&, const QChar& ); |
51 | QString readEntry( const QString& key, const QString& deflt = QString::null)const; | 51 | QString readEntry( const QString& key, const QString& deflt = QString::null)const; |
52 | int readNumEntry( const QString& key, int = -1 )const; | 52 | int readNumEntry( const QString& key, int = -1 )const; |
53 | bool readBoolEntry( const QString& key, bool = FALSE )const; | 53 | bool readBoolEntry( const QString& key, bool = FALSE )const; |
54 | 54 | ||
55 | void setName( const QString& ); | 55 | void setName( const QString& ); |
56 | void setIOLayer( const QCString& ); | 56 | void setIOLayer( const QCString& ); |
57 | void setTerminalName( const QCString& ); | 57 | void setTerminalName( const QCString& ); |
58 | void setBackground( int back ); | 58 | void setBackground( int back ); |
59 | void setForeground( int fore ); | 59 | void setForeground( int fore ); |
60 | void setTerminal( int term ); | 60 | void setTerminal( int term ); |
61 | void setConf( const QMap<QString, QString>& ); | 61 | void setConf( const QMap<QString, QString>& ); |
62 | private: | 62 | private: |
63 | QMap<QString, QString> m_conf; | 63 | QMap<QString, QString> m_conf; |
64 | QString m_name; | 64 | QString m_name; |
65 | QCString m_ioLayer, m_term; | 65 | QCString m_ioLayer, m_term; |
66 | int m_back; | 66 | int m_back; |
67 | int m_fore; | 67 | int m_fore; |
68 | int m_terminal; | 68 | int m_terminal; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | #endif | 71 | #endif |
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 914fd25..094c871 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -1,199 +1,200 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | #include <qlineedit.h> | 2 | #include <qlineedit.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qmessagebox.h> | 4 | #include <qmessagebox.h> |
5 | #include <qstringlist.h> | 5 | #include <qstringlist.h> |
6 | #include <qcombobox.h> | 6 | #include <qcombobox.h> |
7 | 7 | ||
8 | 8 | ||
9 | #include <opie/otabwidget.h> | 9 | #include <opie/otabwidget.h> |
10 | 10 | ||
11 | #include "profileeditorplugins.h" | 11 | #include "profileeditorplugins.h" |
12 | #include "metafactory.h" | 12 | #include "metafactory.h" |
13 | #include "profileeditordialog.h" | 13 | #include "profileeditordialog.h" |
14 | 14 | ||
15 | namespace { | 15 | namespace { |
16 | void setCurrent( const QString& str, QComboBox* bo ) { | 16 | void setCurrent( const QString& str, QComboBox* bo ) { |
17 | for (uint i = 0; i < bo->count(); i++ ) { | 17 | for (uint i = 0; i < bo->count(); i++ ) { |
18 | if ( bo->text(i) == str ) { | 18 | if ( bo->text(i) == str ) { |
19 | bo->setCurrentItem( i ); | 19 | bo->setCurrentItem( i ); |
20 | } | 20 | } |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
24 | 24 | ||
25 | } | 25 | } |
26 | 26 | ||
27 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | 27 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, |
28 | const Profile& prof ) | 28 | const Profile& prof ) |
29 | : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) | 29 | : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) |
30 | { | 30 | { |
31 | initUI(); | 31 | initUI(); |
32 | 32 | ||
33 | // Apply current profile | 33 | // Apply current profile |
34 | // plugin_plugin->load(profile); | 34 | // plugin_plugin->load(profile); |
35 | // ... (reset profile name line edit etc.) | 35 | // ... (reset profile name line edit etc.) |
36 | } | 36 | } |
37 | 37 | ||
38 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | 38 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) |
39 | : QDialog(0, 0, TRUE), m_fact( fact ) | 39 | : QDialog(0, 0, TRUE), m_fact( fact ) |
40 | { | 40 | { |
41 | // Default profile | 41 | // Default profile |
42 | m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102); | 42 | m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102); |
43 | 43 | ||
44 | initUI(); | 44 | initUI(); |
45 | 45 | ||
46 | // Apply current profile | 46 | // Apply current profile |
47 | // plugin_plugin->load(profile); | 47 | // plugin_plugin->load(profile); |
48 | } | 48 | } |
49 | 49 | ||
50 | Profile ProfileEditorDialog::profile() const | 50 | Profile ProfileEditorDialog::profile() const |
51 | { | 51 | { |
52 | return m_prof; | 52 | return m_prof; |
53 | } | 53 | } |
54 | 54 | ||
55 | void ProfileEditorDialog::initUI() | 55 | void ProfileEditorDialog::initUI() |
56 | { | 56 | { |
57 | m_con = m_term = 0l; | 57 | m_con = m_term = 0l; |
58 | 58 | ||
59 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 59 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
60 | OTabWidget *tabWidget = new OTabWidget( this ); | 60 | OTabWidget *tabWidget = new OTabWidget( this ); |
61 | tabWidget->setTabStyle(OTabWidget::TextTab); | ||
61 | mainLayout->add(tabWidget); | 62 | mainLayout->add(tabWidget); |
62 | 63 | ||
63 | QWidget *tabprof; | 64 | QWidget *tabprof; |
64 | 65 | ||
65 | /* base tabs */ | 66 | /* base tabs */ |
66 | tabprof = new QWidget(this); | 67 | tabprof = new QWidget(this); |
67 | m_tabTerm = new QWidget(this); | 68 | m_tabTerm = new QWidget(this); |
68 | m_tabCon = new QWidget(this); | 69 | m_tabCon = new QWidget(this); |
69 | 70 | ||
70 | /* base layout for tabs */ | 71 | /* base layout for tabs */ |
71 | m_layCon = new QHBoxLayout( m_tabCon , 2 ); | 72 | m_layCon = new QHBoxLayout( m_tabCon , 2 ); |
72 | m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); | 73 | m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); |
73 | 74 | ||
74 | // profile tab | 75 | // profile tab |
75 | 76 | ||
76 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); | 77 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); |
77 | m_name = new QLineEdit(tabprof); | 78 | m_name = new QLineEdit(tabprof); |
78 | QLabel *con = new QLabel(tr("Connection"), tabprof ); | 79 | QLabel *con = new QLabel(tr("Connection"), tabprof ); |
79 | QLabel *term = new QLabel(tr("Terminal"), tabprof ); | 80 | QLabel *term = new QLabel(tr("Terminal"), tabprof ); |
80 | m_conCmb = new QComboBox( tabprof ); | 81 | m_conCmb = new QComboBox( tabprof ); |
81 | m_termCmb = new QComboBox( tabprof ); | 82 | m_termCmb = new QComboBox( tabprof ); |
82 | 83 | ||
83 | // layouting | 84 | // layouting |
84 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); | 85 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); |
85 | vbox3->add(name); | 86 | vbox3->add(name); |
86 | vbox3->add(m_name); | 87 | vbox3->add(m_name); |
87 | vbox3->add(con ); | 88 | vbox3->add(con ); |
88 | vbox3->add(m_conCmb ); | 89 | vbox3->add(m_conCmb ); |
89 | vbox3->add(term ); | 90 | vbox3->add(term ); |
90 | vbox3->add(m_termCmb ); | 91 | vbox3->add(m_termCmb ); |
91 | vbox3->addStretch(1); | 92 | vbox3->addStretch(1); |
92 | 93 | ||
93 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); | 94 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); |
94 | tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); | 95 | tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); |
95 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); | 96 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); |
96 | tabWidget->setCurrentTab( tabprof ); | 97 | tabWidget->setCurrentTab( tabprof ); |
97 | 98 | ||
98 | 99 | ||
99 | // fill the comboboxes | 100 | // fill the comboboxes |
100 | QStringList list = m_fact->connectionWidgets(); | 101 | QStringList list = m_fact->connectionWidgets(); |
101 | QStringList::Iterator it; | 102 | QStringList::Iterator it; |
102 | for (it =list.begin(); it != list.end(); ++it ) { | 103 | for (it =list.begin(); it != list.end(); ++it ) { |
103 | m_conCmb->insertItem( (*it) ); | 104 | m_conCmb->insertItem( (*it) ); |
104 | } | 105 | } |
105 | list = m_fact->terminalWidgets(); | 106 | list = m_fact->terminalWidgets(); |
106 | for (it =list.begin(); it != list.end(); ++it ) { | 107 | for (it =list.begin(); it != list.end(); ++it ) { |
107 | m_termCmb->insertItem( (*it) ); | 108 | m_termCmb->insertItem( (*it) ); |
108 | } | 109 | } |
109 | 110 | ||
110 | // load profile values | 111 | // load profile values |
111 | m_name->setText(m_prof.name()); | 112 | m_name->setText(m_prof.name()); |
112 | slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); | 113 | slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); |
113 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); | 114 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); |
114 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); | 115 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); |
115 | setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); | 116 | setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); |
116 | 117 | ||
117 | qWarning("Layer: %s %s", m_prof.ioLayerName().data(), | 118 | qWarning("Layer: %s %s", m_prof.ioLayerName().data(), |
118 | m_fact->external(m_prof.ioLayerName() ).latin1() ); | 119 | m_fact->external(m_prof.ioLayerName() ).latin1() ); |
119 | qWarning("Term: %s %s", m_prof.terminalName().data(), | 120 | qWarning("Term: %s %s", m_prof.terminalName().data(), |
120 | m_fact->external(m_prof.terminalName() ).latin1() ); | 121 | m_fact->external(m_prof.terminalName() ).latin1() ); |
121 | 122 | ||
122 | // signal and slots | 123 | // signal and slots |
123 | connect(m_conCmb, SIGNAL(activated(const QString& ) ), | 124 | connect(m_conCmb, SIGNAL(activated(const QString& ) ), |
124 | this, SLOT(slotConActivated(const QString&) ) ); | 125 | this, SLOT(slotConActivated(const QString&) ) ); |
125 | connect(m_termCmb, SIGNAL(activated(const QString& ) ), | 126 | connect(m_termCmb, SIGNAL(activated(const QString& ) ), |
126 | this, SLOT(slotTermActivated(const QString& ) ) ); | 127 | this, SLOT(slotTermActivated(const QString& ) ) ); |
127 | 128 | ||
128 | } | 129 | } |
129 | 130 | ||
130 | ProfileEditorDialog::~ProfileEditorDialog() { | 131 | ProfileEditorDialog::~ProfileEditorDialog() { |
131 | 132 | ||
132 | } | 133 | } |
133 | void ProfileEditorDialog::accept() | 134 | void ProfileEditorDialog::accept() |
134 | { | 135 | { |
135 | if(profName().isEmpty()) | 136 | if(profName().isEmpty()) |
136 | { | 137 | { |
137 | QMessageBox::information(this, | 138 | QMessageBox::information(this, |
138 | QObject::tr("Invalid profile"), | 139 | QObject::tr("Invalid profile"), |
139 | QObject::tr("Please enter a profile name.")); | 140 | QObject::tr("Please enter a profile name.")); |
140 | return; | 141 | return; |
141 | } | 142 | } |
142 | // Save profile and plugin profile | 143 | // Save profile and plugin profile |
143 | //if(plugin_plugin) plugin_plugin->save(); | 144 | //if(plugin_plugin) plugin_plugin->save(); |
144 | 145 | ||
145 | // Save general values | 146 | // Save general values |
146 | m_prof.setName(profName()); | 147 | m_prof.setName(profName()); |
147 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); | 148 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); |
148 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); | 149 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); |
149 | qWarning("Term %s %s", m_fact->internal(m_termCmb->currentText() ).data(), | 150 | qWarning("Term %s %s", m_fact->internal(m_termCmb->currentText() ).data(), |
150 | m_termCmb->currentText().latin1() ); | 151 | m_termCmb->currentText().latin1() ); |
151 | 152 | ||
152 | if (m_con ) | 153 | if (m_con ) |
153 | m_con->save( m_prof ); | 154 | m_con->save( m_prof ); |
154 | if (m_term ) | 155 | if (m_term ) |
155 | m_term->save( m_prof ); | 156 | m_term->save( m_prof ); |
156 | 157 | ||
157 | QDialog::accept(); | 158 | QDialog::accept(); |
158 | } | 159 | } |
159 | 160 | ||
160 | 161 | ||
161 | QString ProfileEditorDialog::profName()const | 162 | QString ProfileEditorDialog::profName()const |
162 | { | 163 | { |
163 | return m_name->text(); | 164 | return m_name->text(); |
164 | } | 165 | } |
165 | 166 | ||
166 | QCString ProfileEditorDialog::profType()const | 167 | QCString ProfileEditorDialog::profType()const |
167 | { | 168 | { |
168 | /*QStringList w = m_fact->configWidgets(); | 169 | /*QStringList w = m_fact->configWidgets(); |
169 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) | 170 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
170 | if(device_box->currentText() == m_fact->name((*it))) return (*it); | 171 | if(device_box->currentText() == m_fact->name((*it))) return (*it); |
171 | */ | 172 | */ |
172 | return QCString(); | 173 | return QCString(); |
173 | } | 174 | } |
174 | /* | 175 | /* |
175 | * we need to switch the widget | 176 | * we need to switch the widget |
176 | */ | 177 | */ |
177 | void ProfileEditorDialog::slotConActivated( const QString& str ) { | 178 | void ProfileEditorDialog::slotConActivated( const QString& str ) { |
178 | delete m_con; | 179 | delete m_con; |
179 | m_con = m_fact->newConnectionPlugin( str, m_tabCon ); | 180 | m_con = m_fact->newConnectionPlugin( str, m_tabCon ); |
180 | 181 | ||
181 | if (m_con ) { | 182 | if (m_con ) { |
182 | m_con->load( m_prof ); | 183 | m_con->load( m_prof ); |
183 | m_layCon->addWidget( m_con ); | 184 | m_layCon->addWidget( m_con ); |
184 | } | 185 | } |
185 | } | 186 | } |
186 | /* | 187 | /* |
187 | * we need to switch the widget | 188 | * we need to switch the widget |
188 | */ | 189 | */ |
189 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { | 190 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { |
190 | delete m_term; | 191 | delete m_term; |
191 | m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); | 192 | m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); |
192 | qWarning("past"); | 193 | qWarning("past"); |
193 | 194 | ||
194 | if (m_term) { | 195 | if (m_term) { |
195 | m_term->load(m_prof ); | 196 | m_term->load(m_prof ); |
196 | m_layTerm->addWidget( m_term ); | 197 | m_layTerm->addWidget( m_term ); |
197 | } | 198 | } |
198 | } | 199 | } |
199 | 200 | ||
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp index 80627c4..2d37be2 100644 --- a/noncore/apps/opie-console/terminalwidget.cpp +++ b/noncore/apps/opie-console/terminalwidget.cpp | |||
@@ -1,191 +1,194 @@ | |||
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 <qlayout.h> | 9 | #include <qlayout.h> |
10 | 10 | ||
11 | #include "terminalwidget.h" | 11 | #include "terminalwidget.h" |
12 | 12 | ||
13 | namespace { | 13 | namespace { |
14 | enum TermIds { | 14 | enum TermIds { |
15 | id_term_vt100, | 15 | id_term_vt100, |
16 | id_term_vt220, | 16 | id_term_vt102, |
17 | id_term_ansi | 17 | id_term_ansi |
18 | }; | 18 | }; |
19 | 19 | ||
20 | enum ColourIds { | 20 | enum ColourIds { |
21 | id_term_black, | 21 | id_term_black, |
22 | id_term_white | 22 | id_term_white |
23 | }; | 23 | }; |
24 | 24 | ||
25 | enum FontIds { | 25 | enum FontIds { |
26 | id_size_small, | 26 | id_size_small, |
27 | id_size_medium, | 27 | id_size_medium, |
28 | id_size_large | 28 | id_size_large |
29 | }; | 29 | }; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, | 32 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, |
33 | const char* na ) | 33 | const char* na ) |
34 | : ProfileDialogTerminalWidget( name, parent, na ) { | 34 | : ProfileDialogTerminalWidget( name, parent, na ) { |
35 | 35 | ||
36 | m_terminal = new QLabel(tr("Terminal Type"), this ); | 36 | m_terminal = new QLabel(tr("Terminal Type"), this ); |
37 | m_terminalBox = new QComboBox(this); | 37 | m_terminalBox = new QComboBox(this); |
38 | m_colorLabel = new QLabel(tr("Color scheme"), this); | 38 | m_colorLabel = new QLabel(tr("Color scheme"), this); |
39 | m_colorCmb = new QComboBox(this ); | 39 | m_colorCmb = new QComboBox(this ); |
40 | 40 | ||
41 | m_groupSize = new QButtonGroup(tr("Font size"), this ); | 41 | m_groupSize = new QButtonGroup(tr("Font size"), this ); |
42 | m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); | 42 | m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); |
43 | m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); | 43 | m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); |
44 | m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); | 44 | m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); |
45 | 45 | ||
46 | m_groupConv = new QHGroupBox(tr("Line-break conversions"), this ); | 46 | m_groupConv = new QHGroupBox(tr("Line-break conversions"), this ); |
47 | m_convInbound = new QCheckBox(tr("Inbound"), m_groupConv ); | 47 | m_convInbound = new QCheckBox(tr("Inbound"), m_groupConv ); |
48 | m_convOutbound = new QCheckBox(tr("Outbound"), m_groupConv ); | 48 | m_convOutbound = new QCheckBox(tr("Outbound"), m_groupConv ); |
49 | 49 | ||
50 | m_groupOptions = new QHGroupBox( tr("Options"), this ); | 50 | m_groupOptions = new QHGroupBox( tr("Options"), this ); |
51 | m_optionEcho = new QCheckBox(tr("Local echo"), m_groupOptions ); | 51 | m_optionEcho = new QCheckBox(tr("Local echo"), m_groupOptions ); |
52 | m_optionWrap = new QCheckBox(tr("Line wrap"), m_groupOptions ); | 52 | m_optionWrap = new QCheckBox(tr("Line wrap"), m_groupOptions ); |
53 | 53 | ||
54 | m_lroot = new QVBoxLayout(this, 2 ); | 54 | m_lroot = new QVBoxLayout(this, 2 ); |
55 | m_typeBox = new QVBoxLayout( m_lroot ); | 55 | m_typeBox = new QVBoxLayout( m_lroot ); |
56 | m_hbox = new QHBoxLayout( m_groupSize, 2 ); | 56 | m_hbox = new QHBoxLayout( m_groupSize, 2 ); |
57 | m_colorBox = new QVBoxLayout( m_lroot ); | 57 | m_colorBox = new QVBoxLayout( m_lroot ); |
58 | 58 | ||
59 | // Layout | 59 | // Layout |
60 | m_typeBox->add(m_terminal ); | 60 | m_typeBox->add(m_terminal ); |
61 | m_typeBox->add(m_terminalBox ); | 61 | m_typeBox->add(m_terminalBox ); |
62 | 62 | ||
63 | m_hbox->add(m_sizeSmall ); | 63 | m_hbox->add(m_sizeSmall ); |
64 | m_hbox->add(m_sizeMedium ); | 64 | m_hbox->add(m_sizeMedium ); |
65 | m_hbox->add(m_sizeLarge ); | 65 | m_hbox->add(m_sizeLarge ); |
66 | m_lroot->add(m_groupSize ); | 66 | m_lroot->add(m_groupSize ); |
67 | 67 | ||
68 | m_colorBox->add( m_colorLabel ); | 68 | m_colorBox->add( m_colorLabel ); |
69 | m_colorBox->add( m_colorCmb ); | 69 | m_colorBox->add( m_colorCmb ); |
70 | 70 | ||
71 | m_lroot->add(m_groupConv ); | 71 | m_lroot->add(m_groupConv ); |
72 | m_lroot->add(m_groupOptions ); | 72 | m_lroot->add(m_groupOptions ); |
73 | 73 | ||
74 | // Fill in some options | 74 | // Fill in some options |
75 | m_terminalBox->insertItem( tr("VT 100"), id_term_vt100 ); | 75 | m_terminalBox->insertItem( tr("VT 100"), id_term_vt100 ); |
76 | m_terminalBox->insertItem( tr("VT 220"), id_term_vt220 ); | 76 | m_terminalBox->insertItem( tr("VT 102"), id_term_vt102 ); |
77 | m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); | 77 | //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); |
78 | 78 | ||
79 | m_colorCmb->insertItem( tr("black on white"), id_term_black ); | 79 | m_colorCmb->insertItem( tr("black on white"), id_term_black ); |
80 | m_colorCmb->insertItem( tr("white on black"), id_term_white ); | 80 | m_colorCmb->insertItem( tr("white on black"), id_term_white ); |
81 | 81 | ||
82 | // signals + slots | 82 | // signals + slots |
83 | /* | 83 | /* |
84 | connect(m_terminalBox, SIGNAL(activated(int) ), | 84 | connect(m_terminalBox, SIGNAL(activated(int) ), |
85 | this, SLOT(slotTermTerm(int) ) ); | 85 | this, SLOT(slotTermTerm(int) ) ); |
86 | connect(m_colorBox, SIGNAL(activated(int) ), | 86 | connect(m_colorBox, SIGNAL(activated(int) ), |
87 | tis, SLOT(slotTermColor(int) ) ); | 87 | tis, SLOT(slotTermColor(int) ) ); |
88 | connect(m_groupSize, SIGNAL(activated(int) ), | 88 | connect(m_groupSize, SIGNAL(activated(int) ), |
89 | this, SLOT(slotTermFont(int) ) ); | 89 | this, SLOT(slotTermFont(int) ) ); |
90 | 90 | ||
91 | connect(m_optionEcho, SIGNAL(toggled(bool) ), | 91 | connect(m_optionEcho, SIGNAL(toggled(bool) ), |
92 | this, SLOT(slotTermEcho(bool) ) ); | 92 | this, SLOT(slotTermEcho(bool) ) ); |
93 | connect(m_optionWrap, SIGNAL(toggled(bool) ), | 93 | connect(m_optionWrap, SIGNAL(toggled(bool) ), |
94 | this, SLOT(slotTermWrap(bool) ) ); | 94 | this, SLOT(slotTermWrap(bool) ) ); |
95 | connect(m_convInbound, SIGNAL(toggled(bool) ), | 95 | connect(m_convInbound, SIGNAL(toggled(bool) ), |
96 | this, SLOT(slotTermInbound(bool) ) ); | 96 | this, SLOT(slotTermInbound(bool) ) ); |
97 | connect(m_convOutbound, SIGNAL(toggled(bool) ), | 97 | connect(m_convOutbound, SIGNAL(toggled(bool) ), |
98 | this, SLOT(slotTermOutbound(bool) ) ); | 98 | this, SLOT(slotTermOutbound(bool) ) ); |
99 | */ | 99 | */ |
100 | } | 100 | } |
101 | TerminalWidget::~TerminalWidget() { | 101 | TerminalWidget::~TerminalWidget() { |
102 | } | 102 | } |
103 | void TerminalWidget::load( const Profile& prof ) { | 103 | void TerminalWidget::load( const Profile& prof ) { |
104 | int term = prof.readNumEntry("Terminal"); | 104 | int term = prof.readNumEntry("Terminal"); |
105 | int color = prof.readNumEntry("Color"); | 105 | int color = prof.readNumEntry("Color"); |
106 | int fontsize = prof.readNumEntry("Font"); | 106 | int fontsize = prof.readNumEntry("Font"); |
107 | int opt_echo = prof.readNumEntry("Echo"); | 107 | int opt_echo = prof.readNumEntry("Echo"); |
108 | int opt_wrap = prof.readNumEntry("Wrap"); | 108 | int opt_wrap = prof.readNumEntry("Wrap"); |
109 | int opt_inbound = prof.readNumEntry("Inbound"); | 109 | int opt_inbound = prof.readNumEntry("Inbound"); |
110 | int opt_outbound = prof.readNumEntry("Outbound"); | 110 | int opt_outbound = prof.readNumEntry("Outbound"); |
111 | 111 | ||
112 | switch( term ) { | 112 | switch( term ) { |
113 | case Profile::VT102: | 113 | case Profile::VT100: |
114 | m_terminalBox->setCurrentItem(id_term_vt100 ); | 114 | m_terminalBox->setCurrentItem(id_term_vt100 ); |
115 | break; | 115 | break; |
116 | case Profile::VT102: | ||
117 | m_terminalBox->setCurrentItem(id_term_vt102 ); | ||
118 | break; | ||
116 | default: | 119 | default: |
117 | break; | 120 | break; |
118 | }; | 121 | }; |
119 | 122 | ||
120 | switch( color ) { | 123 | switch( color ) { |
121 | case Profile::Black: | 124 | case Profile::Black: |
122 | m_colorCmb->setCurrentItem(id_term_black ); | 125 | m_colorCmb->setCurrentItem(id_term_black ); |
123 | break; | 126 | break; |
124 | case Profile::White: | 127 | case Profile::White: |
125 | m_colorCmb->setCurrentItem(id_term_white ); | 128 | m_colorCmb->setCurrentItem(id_term_white ); |
126 | break; | 129 | break; |
127 | default: | 130 | default: |
128 | break; | 131 | break; |
129 | }; | 132 | }; |
130 | 133 | ||
131 | switch( fontsize ) { | 134 | switch( fontsize ) { |
132 | case Profile::Micro: | 135 | case Profile::Micro: |
133 | m_sizeSmall->setChecked(true ); | 136 | m_sizeSmall->setChecked(true ); |
134 | break; | 137 | break; |
135 | case Profile::Small: | 138 | case Profile::Small: |
136 | m_sizeMedium->setChecked(true ); | 139 | m_sizeMedium->setChecked(true ); |
137 | break; | 140 | break; |
138 | case Profile::Medium: | 141 | case Profile::Medium: |
139 | m_sizeLarge->setChecked( true ); | 142 | m_sizeLarge->setChecked( true ); |
140 | break; | 143 | break; |
141 | m_sizeSmall->setChecked(true); | 144 | m_sizeSmall->setChecked(true); |
142 | default: | 145 | default: |
143 | break; | 146 | break; |
144 | }; | 147 | }; |
145 | 148 | ||
146 | if (opt_echo) m_optionEcho->setChecked( true ); | 149 | if (opt_echo) m_optionEcho->setChecked( true ); |
147 | if (opt_wrap) m_optionWrap->setChecked( true ); | 150 | if (opt_wrap) m_optionWrap->setChecked( true ); |
148 | if (opt_inbound) m_convInbound->setChecked( true ); | 151 | if (opt_inbound) m_convInbound->setChecked( true ); |
149 | if (opt_outbound) m_convOutbound->setChecked( true ); | 152 | if (opt_outbound) m_convOutbound->setChecked( true ); |
150 | 153 | ||
151 | } | 154 | } |
152 | void TerminalWidget::save( Profile& profile ) { | 155 | void TerminalWidget::save( Profile& profile ) { |
153 | switch(m_terminalBox->currentItem() ) { | 156 | switch(m_terminalBox->currentItem() ) { |
154 | case id_term_vt100: | 157 | case id_term_vt100: |
155 | profile.writeEntry("Terminal", Profile::VT102 ); | 158 | profile.writeEntry("Terminal", Profile::VT100 ); |
156 | break; | ||
157 | case id_term_vt220: | ||
158 | profile.writeEntry("Terminal", Profile::VT102 ); | ||
159 | break; | 159 | break; |
160 | case id_term_ansi: | 160 | case id_term_vt102: |
161 | profile.writeEntry("Terminal", Profile::VT102 ); | 161 | profile.writeEntry("Terminal", Profile::VT102 ); |
162 | break; | 162 | break; |
163 | //case id_term_ansi: | ||
164 | // profile.writeEntry("Terminal", Profile::VT102 ); | ||
165 | // break; | ||
163 | default: | 166 | default: |
164 | break; | 167 | break; |
165 | }; | 168 | }; |
166 | 169 | ||
167 | // color | 170 | // color |
168 | switch(m_colorCmb->currentItem() ) { | 171 | switch(m_colorCmb->currentItem() ) { |
169 | case id_term_black: | 172 | case id_term_black: |
170 | profile.writeEntry("Color", Profile::Black ); | 173 | profile.writeEntry("Color", Profile::Black ); |
171 | break; | 174 | break; |
172 | case id_term_white: | 175 | case id_term_white: |
173 | profile.writeEntry("Color", Profile::White ); | 176 | profile.writeEntry("Color", Profile::White ); |
174 | break; | 177 | break; |
175 | default: | 178 | default: |
176 | break; | 179 | break; |
177 | }; | 180 | }; |
178 | 181 | ||
179 | if (m_sizeSmall->isChecked() ) { | 182 | if (m_sizeSmall->isChecked() ) { |
180 | profile.writeEntry("Font", Profile::Micro ); | 183 | profile.writeEntry("Font", Profile::Micro ); |
181 | }else if (m_sizeMedium->isChecked() ) { | 184 | }else if (m_sizeMedium->isChecked() ) { |
182 | profile.writeEntry("Font", Profile::Small ); | 185 | profile.writeEntry("Font", Profile::Small ); |
183 | }else { | 186 | }else { |
184 | profile.writeEntry("Font", Profile::Medium ); | 187 | profile.writeEntry("Font", Profile::Medium ); |
185 | } | 188 | } |
186 | 189 | ||
187 | profile.writeEntry("Echo", m_optionEcho->isChecked() ); | 190 | profile.writeEntry("Echo", m_optionEcho->isChecked() ); |
188 | profile.writeEntry("Wrap", m_optionWrap->isChecked() ); | 191 | profile.writeEntry("Wrap", m_optionWrap->isChecked() ); |
189 | profile.writeEntry("Inbound", m_convInbound->isChecked() ); | 192 | profile.writeEntry("Inbound", m_convInbound->isChecked() ); |
190 | profile.writeEntry("Outbound",m_convOutbound->isChecked() ); | 193 | profile.writeEntry("Outbound",m_convOutbound->isChecked() ); |
191 | } | 194 | } |