summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/TEScreen.h8
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp17
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp31
-rw-r--r--noncore/apps/opie-console/profile.h4
-rw-r--r--noncore/apps/opie-console/session.cpp12
-rw-r--r--noncore/apps/opie-console/session.h3
-rw-r--r--noncore/apps/opie-console/terminalwidget.cpp18
7 files changed, 77 insertions, 16 deletions
diff --git a/noncore/apps/opie-console/TEScreen.h b/noncore/apps/opie-console/TEScreen.h
index ba47ee5..473ce79 100644
--- a/noncore/apps/opie-console/TEScreen.h
+++ b/noncore/apps/opie-console/TEScreen.h
@@ -108,152 +108,152 @@ public: // these are all `Screen' operations
108 // 108 //
109 // ------------------------------------- 109 // -------------------------------------
110 // 110 //
111 void setRendition (int rendition); 111 void setRendition (int rendition);
112 void resetRendition(int rendition); 112 void resetRendition(int rendition);
113 void setForeColor (int fgcolor); 113 void setForeColor (int fgcolor);
114 void setBackColor (int bgcolor); 114 void setBackColor (int bgcolor);
115 // 115 //
116 void setDefaultRendition(); 116 void setDefaultRendition();
117 void setForeColorToDefault(); 117 void setForeColorToDefault();
118 void setBackColorToDefault(); 118 void setBackColorToDefault();
119 // 119 //
120 // ------------------------------------- 120 // -------------------------------------
121 // 121 //
122 BOOL getMode (int n); 122 BOOL getMode (int n);
123 // 123 //
124 // only for report cursor position 124 // only for report cursor position
125 // 125 //
126 int getCursorX(); 126 int getCursorX();
127 int getCursorY(); 127 int getCursorY();
128 // 128 //
129 // ------------------------------------- 129 // -------------------------------------
130 // 130 //
131 void clear(); 131 void clear();
132 void home(); 132 void home();
133 void reset(); 133 void reset();
134 // 134 //
135 void ShowCharacter(unsigned short c); 135 void ShowCharacter(unsigned short c);
136 // 136 //
137 void resizeImage(int new_lines, int new_columns); 137 void resizeImage(int new_lines, int new_columns);
138 // 138 //
139 ca* getCookedImage(); 139 ca* getCookedImage();
140 140
141 /*! return the number of lines. */ 141 /*! return the number of lines. */
142 int getLines() { return lines; } 142 int getLines() { return lines; }
143 /*! return the number of columns. */ 143 /*! return the number of columns. */
144 int getColumns() { return columns; } 144 int getColumns() { return columns; }
145 145
146 /*! set the position of the history cursor. */ 146 /*! set the position of the history cursor. */
147 void setHistCursor(int cursor); 147 void setHistCursor(int cursor);
148 /*! return the position of the history cursor. */ 148 /*! return the position of the history cursor. */
149 int getHistCursor(); 149 int getHistCursor();
150 150
151 int getHistLines (); 151 int getHistLines ();
152 void setScroll(bool on); 152 void setScroll(bool on);
153 bool hasScroll(); 153 bool hasScroll();
154 154
155 // 155 //
156 // Selection 156 // Selection
157 // 157 //
158 void setSelBeginXY(const int x, const int y); 158 void setSelBeginXY(const int x, const int y);
159 void setSelExtentXY(const int x, const int y); 159 void setSelExtentXY(const int x, const int y);
160 void clearSelection(); 160 void clearSelection();
161 QString getSelText(const BOOL preserve_line_breaks); 161 QString getSelText(const BOOL preserve_line_breaks);
162 162
163 void checkSelection(int from, int to); 163 void checkSelection(int from, int to);
164 164
165private: // helper 165private: // helper
166 166
167 void clearImage(int loca, int loce, char c); 167 void clearImage(int loca, int loce, char c);
168 void moveImage(int dst, int loca, int loce); 168 void moveImage(int dst, int loca, int loce);
169 169
170 void scrollUp(int from, int i); 170 void scrollUp(int from, int i);
171 void scrollDown(int from, int i); 171 void scrollDown(int from, int i);
172 172
173 void addHistLine(); 173 void addHistLine();
174 174
175 void initTabStops(); 175 void initTabStops();
176 176
177 void effectiveRendition(); 177 void effectiveRendition();
178 void reverseRendition(ca* p); 178 void reverseRendition(ca* p);
179 179
180private: 180private:
181 181
182 /* 182 /*
183 The state of the screen is more complex as one would 183 The state of the screen is more complex as one would
184 expect first. The screem does really do part of the 184 expect first. The screem does really do part of the
185 emulation providing state informations in form of modes, 185 emulation providing state informations in form of modes,
186 margins, tabulators, cursor etc. 186 margins, tabulators, cursor etc.
187 187
188 Even more unexpected are variables to save and restore 188 Even more unexpected are variables to save and restore
189 parts of the state. 189 parts of the state.
190 */ 190 */
191 191
192 // screen image ---------------- 192 // screen image ----------------
193 193
194 int lines; 194 int lines;
195 int columns; 195 int columns;
196 ca *image; // [lines][columns] 196 ca *image; // [lines][columns]
197 197
198 // history buffer --------------- 198 // history buffer ---------------
199 199
200 int histCursor; // display position relative to start of the history buffer 200 int histCursor; // display position relative to start of the history buffer
201 HistoryScroll hist; 201 HistoryScroll hist;
202 202
203 // cursor location 203 // cursor location
204 204
205 int cuX; 205 int cuX;
206 int cuY; 206 int cuY;
207 207
208 // cursor color and rendition info 208 // cursor color and rendition info
209 209
210 UINT8 cu_fg; // foreground 210 UINT8 cu_fg; // foreground
211 UINT8 cu_bg; // background 211 UINT8 cu_bg; // background
212 UINT8 cu_re; // rendition 212 UINT8 cu_re; // rendition
213 213
214 // margins ---------------- 214 // margins ----------------
215 215
216 int tmargin; // top margin 216 int tmargin; // top margin
217 int bmargin; // bottom margin 217 int bmargin; // bottom margin
218 218
219 // states ---------------- 219 // states ----------------
220 220
221 ScreenParm currParm; 221 ScreenParm currParm;
222 222
223 // ---------------------------- 223 // ----------------------------
224 224
225 bool* tabstops; 225 bool* tabstops;
226 226
227 // selection ------------------- 227 // selection -------------------
228 228
229 int sel_begin; // The first location selected. 229 int sel_begin; // The first location selected.
230 int sel_TL; // TopLeft Location. 230 int sel_TL; // TopLeft Location.
231 int sel_BR; // Bottom Right Location. 231 int sel_BR; // Bottom Right Location.
232 232
233 // effective colors and rendition ------------ 233 // effective colors and rendition ------------
234 234
235 UINT8 ef_fg; // These are derived from 235 UINT8 ef_fg; // These are derived from
236 UINT8 ef_bg; // the cu_* variables above 236 UINT8 ef_bg; // the cu_* variables above
237 UINT8 ef_re; // to speed up operation 237 UINT8 ef_re; // to speed up operation
238 238
239 // 239 //
240 // save cursor, rendition & states ------------ 240 // save cursor, rendition & states ------------
241 // 241 //
242 242
243 // cursor location 243 // cursor location
244 244
245 int sa_cuX; 245 int sa_cuX;
246 int sa_cuY; 246 int sa_cuY;
247 247
248 // rendition info 248 // rendition info
249 249
250 UINT8 sa_cu_re; 250 UINT8 sa_cu_re;
251 UINT8 sa_cu_fg; 251 UINT8 sa_cu_fg;
252 UINT8 sa_cu_bg; 252 UINT8 sa_cu_bg;
253 253
254 // modes 254 // modes
255 255
256 ScreenParm saveParm; 256 ScreenParm saveParm;
257}; 257};
258 258
259#endif // TESCREEN_H 259#endif // TESCREEN_H
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index 9f34d2c..836a05b 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -78,54 +78,71 @@ QFont EmulationHandler::font( int id ) {
78 default: // fall through 78 default: // fall through
79 case 0: 79 case 0:
80 name = QString::fromLatin1("Micro"); 80 name = QString::fromLatin1("Micro");
81 size = 4; 81 size = 4;
82 break; 82 break;
83 case 1: 83 case 1:
84 name = QString::fromLatin1("Fixed"); 84 name = QString::fromLatin1("Fixed");
85 size = 7; 85 size = 7;
86 break; 86 break;
87 case 2: 87 case 2:
88 name = QString::fromLatin1("Fixed"); 88 name = QString::fromLatin1("Fixed");
89 size = 12; 89 size = 12;
90 break; 90 break;
91 } 91 }
92 QFont font(name, size, QFont::Normal ); 92 QFont font(name, size, QFont::Normal );
93 font.setFixedPitch(TRUE ); 93 font.setFixedPitch(TRUE );
94 return font; 94 return font;
95} 95}
96QColor EmulationHandler::foreColor(int col) { 96QColor EmulationHandler::foreColor(int col) {
97 QColor co; 97 QColor co;
98 /* we need to switch it */ 98 /* we need to switch it */
99 switch( col ) { 99 switch( col ) {
100 default: 100 default:
101 case Profile::White: 101 case Profile::White:
102 qWarning("Foreground black"); 102 qWarning("Foreground black");
103 /* color is black */ 103 /* color is black */
104 co = Qt::white; 104 co = Qt::white;
105 break; 105 break;
106 case Profile::Black: 106 case Profile::Black:
107 qWarning("Foreground white"); 107 qWarning("Foreground white");
108 co = Qt::black; 108 co = Qt::black;
109 break; 109 break;
110 case Profile::Green:
111 qWarning("Foreground green");
112 co = Qt::green;
113 break;
114 case Profile::Orange:
115 qWarning("Foreground orange");
116 // FIXME needs better color here
117 co = Qt::darkYellow;
118 break;
110 } 119 }
111 120
112 return co; 121 return co;
113} 122}
114QColor EmulationHandler::backColor(int col ) { 123QColor EmulationHandler::backColor(int col ) {
115 QColor co; 124 QColor co;
116 /* we need to switch it */ 125 /* we need to switch it */
117 switch( col ) { 126 switch( col ) {
118 default: 127 default:
119 case Profile::White: 128 case Profile::White:
120 qWarning("Background white"); 129 qWarning("Background white");
121 /* color is white */ 130 /* color is white */
122 co = Qt::black; 131 co = Qt::black;
123 break; 132 break;
124 case Profile::Black: 133 case Profile::Black:
125 qWarning("Background black"); 134 qWarning("Background black");
126 co = Qt::white; 135 co = Qt::white;
127 break; 136 break;
137 case Profile::Green:
138 qWarning("Background black");
139 co = Qt::black;
140 break;
141 case Profile::Orange:
142 qWarning("Background black");
143 co = Qt::black;
144 break;
128 } 145 }
129 146
130 return co; 147 return co;
131} 148}
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 6dc9e6e..b770551 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -285,73 +285,78 @@ void MainWindow::slotSaveScript() {
285 MimeTypes types; 285 MimeTypes types;
286 QStringList script; 286 QStringList script;
287 script << "text/plain"; 287 script << "text/plain";
288 types.insert("Script", script); 288 types.insert("Script", script);
289 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); 289 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types);
290 if (!filename.isEmpty()) { 290 if (!filename.isEmpty()) {
291 currentSession()->emulationLayer()->script()->saveTo(filename); 291 currentSession()->emulationLayer()->script()->saveTo(filename);
292 currentSession()->emulationLayer()->clearScript(); 292 currentSession()->emulationLayer()->clearScript();
293 } 293 }
294 } 294 }
295 */ 295 */
296} 296}
297 297
298void MainWindow::slotRunScript() { 298void MainWindow::slotRunScript() {
299/* 299/*
300 if (currentSession()) { 300 if (currentSession()) {
301 MimeTypes types; 301 MimeTypes types;
302 QStringList script; 302 QStringList script;
303 script << "text/plain"; 303 script << "text/plain";
304 types.insert("Script", script); 304 types.insert("Script", script);
305 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); 305 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types);
306 if (!filename.isEmpty()) { 306 if (!filename.isEmpty()) {
307 Script script(DocLnk(filename).file()); 307 Script script(DocLnk(filename).file());
308 currentSession()->emulationLayer()->runScript(&script); 308 currentSession()->emulationLayer()->runScript(&script);
309 } 309 }
310 } 310 }
311 */ 311 */
312} 312}
313 313
314void MainWindow::slotConnect() { 314void MainWindow::slotConnect() {
315 if ( currentSession() ) { 315 if ( currentSession() ) {
316 bool ret = currentSession()->layer()->open(); 316 bool ret = currentSession()->layer()->open();
317 if(!ret) QMessageBox::warning(currentSession()->widgetStack(), 317 if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
318 QObject::tr("Failed"), 318 QObject::tr("Failed"),
319 QObject::tr("Connecting failed for this session.")); 319 QObject::tr("Connecting failed for this session."));
320 } 320 m_connect->setEnabled( false );
321 m_disconnect->setEnabled( true );
322 }
321} 323}
322 324
323void MainWindow::slotDisconnect() { 325void MainWindow::slotDisconnect() {
324 if ( currentSession() ) 326 if ( currentSession() ) {
325 currentSession()->layer()->close(); 327 currentSession()->layer()->close();
328 m_connect->setEnabled( true );
329 m_disconnect->setEnabled( false );
330 }
326} 331}
327 332
328void MainWindow::slotTerminate() { 333void MainWindow::slotTerminate() {
329 if ( currentSession() ) 334 if ( currentSession() )
330 currentSession()->layer()->close(); 335 currentSession()->layer()->close();
331 336
332 slotClose(); 337 slotClose();
333 /* FIXME move to the next session */ 338 /* FIXME move to the next session */
334} 339}
335 340
336void MainWindow::slotConfigure() { 341void MainWindow::slotConfigure() {
337 qWarning("configure"); 342 qWarning("configure");
338 ConfigDialog conf( manager()->all(), factory() ); 343 ConfigDialog conf( manager()->all(), factory() );
339 conf.showMaximized(); 344 conf.showMaximized();
340 345
341 int ret = conf.exec(); 346 int ret = conf.exec();
342 347
343 if ( QDialog::Accepted == ret ) { 348 if ( QDialog::Accepted == ret ) {
344 qWarning("conf %d", conf.list().count() ); 349 qWarning("conf %d", conf.list().count() );
345 manager()->setProfiles( conf.list() ); 350 manager()->setProfiles( conf.list() );
346 manager()->save(); 351 manager()->save();
347 populateProfiles(); 352 populateProfiles();
348 } 353 }
349} 354}
350/* 355/*
351 * we will remove 356 * we will remove
352 * this window from the tabwidget 357 * this window from the tabwidget
353 * remove it from the list 358 * remove it from the list
354 * delete it 359 * delete it
355 * and set the currentSession() 360 * and set the currentSession()
356 */ 361 */
357void MainWindow::slotClose() { 362void MainWindow::slotClose() {
@@ -376,93 +381,101 @@ void MainWindow::slotClose() {
376 m_fullscreen->setEnabled( false ); 381 m_fullscreen->setEnabled( false );
377 m_closewindow->setEnabled( false ); 382 m_closewindow->setEnabled( false );
378 } 383 }
379} 384}
380 385
381/* 386/*
382 * We will get the name 387 * We will get the name
383 * Then the profile 388 * Then the profile
384 * and then we will make a profile 389 * and then we will make a profile
385 */ 390 */
386void MainWindow::slotProfile( int id) { 391void MainWindow::slotProfile( int id) {
387 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 392 Profile prof = manager()->profile( m_sessionsPop->text( id) );
388 create( prof ); 393 create( prof );
389} 394}
390void MainWindow::create( const Profile& prof ) { 395void MainWindow::create( const Profile& prof ) {
391 Session *ses = manager()->fromProfile( prof, tabWidget() ); 396 Session *ses = manager()->fromProfile( prof, tabWidget() );
392 397
393 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 398 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
394 { 399 {
395 QMessageBox::warning(this, 400 QMessageBox::warning(this,
396 QObject::tr("Session failed"), 401 QObject::tr("Session failed"),
397 QObject::tr("Cannot open session: Not all components were found.")); 402 QObject::tr("Cannot open session: Not all components were found."));
398 //if(ses) delete ses; 403 //if(ses) delete ses;
399 return; 404 return;
400 } 405 }
401 406
402 m_sessions.append( ses ); 407 m_sessions.append( ses );
403 tabWidget()->add( ses ); 408 tabWidget()->add( ses );
404 m_curSession = ses; 409 m_curSession = ses;
405 410
406 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it 411 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
407 m_connect->setEnabled( true ); 412 m_connect->setEnabled( true );
408 m_disconnect->setEnabled( true ); 413 m_disconnect->setEnabled( false );
409 m_terminate->setEnabled( true ); 414 m_terminate->setEnabled( true );
410 m_transfer->setEnabled( true ); 415 m_transfer->setEnabled( true );
411 m_recordScript->setEnabled( true ); 416 m_recordScript->setEnabled( true );
412 m_saveScript->setEnabled( true ); 417 m_saveScript->setEnabled( true );
413 m_runScript->setEnabled( true ); 418 m_runScript->setEnabled( true );
414 m_fullscreen->setEnabled( true ); 419 m_fullscreen->setEnabled( true );
415 m_closewindow->setEnabled( true ); 420 m_closewindow->setEnabled( true );
416} 421}
417 422
418void MainWindow::slotTransfer() 423void MainWindow::slotTransfer()
419{ 424{
420 // if ( currentSession() ) { 425 if ( currentSession() ) {
421 TransferDialog dlg(this); 426 TransferDialog dlg(this);
422 dlg.showMaximized(); 427 dlg.showMaximized();
423 dlg.exec(); 428 dlg.exec();
424 // } 429 }
425} 430}
426 431
427 432
428void MainWindow::slotOpenKeb(bool state) { 433void MainWindow::slotOpenKeb(bool state) {
429 434
430 if (state) m_keyBar->show(); 435 if (state) m_keyBar->show();
431 else m_keyBar->hide(); 436 else m_keyBar->hide();
432 437
433} 438}
434void MainWindow::slotSessionChanged( Session* ses ) { 439void MainWindow::slotSessionChanged( Session* ses ) {
435 if ( ses ) { 440 if ( ses ) {
436 qWarning("changing %s", ses->name().latin1() ); 441 qWarning("changing %s", ses->name().latin1() );
437 m_curSession = ses; 442 m_curSession = ses;
443
444 if ( m_curSession->isConnected() ) {
445 m_connect->setEnabled( false );
446 m_disconnect->setEnabled( true );
447 } else {
448 m_connect->setEnabled( true );
449 m_disconnect->setEnabled( false );
450 }
438 } 451 }
439} 452}
440 453
441void MainWindow::slotFullscreen() { 454void MainWindow::slotFullscreen() {
442 455
443 if ( m_isFullscreen ) { 456 if ( m_isFullscreen ) {
444 ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); 457 ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false );
445 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 458 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken );
446 setCentralWidget( m_consoleWindow ); 459 setCentralWidget( m_consoleWindow );
447 ( m_curSession->widgetStack() )->show(); 460 ( m_curSession->widgetStack() )->show();
448 m_fullscreen->setText( tr("Full screen") ); 461 m_fullscreen->setText( tr("Full screen") );
449 462
450 } else { 463 } else {
451 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); 464 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
452 ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, 465 ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop,
453 QPoint(0,0), false); 466 QPoint(0,0), false);
454 ( m_curSession->widgetStack() )->resize(qApp->desktop()->width(), qApp->desktop()->height()); 467 ( m_curSession->widgetStack() )->resize(qApp->desktop()->width(), qApp->desktop()->height());
455 ( m_curSession->widgetStack() )->setFocus(); 468 ( m_curSession->widgetStack() )->setFocus();
456 ( m_curSession->widgetStack() )->show(); 469 ( m_curSession->widgetStack() )->show();
457 470
458 // QPushButton *cornerButton = new QPushButton( this ); 471 //QPushButton *cornerButton = new QPushButton( );
459 //cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); 472 //cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
460 //connect( cornerButton, SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 473 //connect( cornerButton, SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
461 // need teh scrollbar 474 // need teh scrollbar
462 // ( m_curSession->widgetStack() )->setCornerWidget( cornerButton ); 475 // ( m_curSession->widgetStack() )->setCornerWidget( cornerButton );
463 m_fullscreen->setText( tr("Stop full screen") ); 476 m_fullscreen->setText( tr("Stop full screen") );
464 } 477 }
465 478
466 m_isFullscreen = !m_isFullscreen; 479 m_isFullscreen = !m_isFullscreen;
467 480
468} 481}
diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h
index 1b71cda..64eb022 100644
--- a/noncore/apps/opie-console/profile.h
+++ b/noncore/apps/opie-console/profile.h
@@ -1,52 +1,54 @@
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 */
15class Profile { 15class Profile {
16public: 16public:
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 Green,
22 Orange};
21 enum Terminal {VT102 = 0, VT100 }; 23 enum Terminal {VT102 = 0, VT100 };
22 enum Font { Micro = 0, Small, Medium }; 24 enum Font { Micro = 0, Small, Medium };
23 Profile(); 25 Profile();
24 Profile( const QString& name, 26 Profile( const QString& name,
25 const QCString& iolayerName, 27 const QCString& iolayerName,
26 const QCString& termName, 28 const QCString& termName,
27 int background, 29 int background,
28 int foreground, 30 int foreground,
29 int terminal); 31 int terminal);
30 Profile( const Profile& ); 32 Profile( const Profile& );
31 Profile &operator=( const Profile& ); 33 Profile &operator=( const Profile& );
32 bool operator==( const Profile& prof ); 34 bool operator==( const Profile& prof );
33 35
34 ~Profile(); 36 ~Profile();
35 QString name()const; 37 QString name()const;
36 QCString ioLayerName()const; 38 QCString ioLayerName()const;
37 QCString terminalName()const; 39 QCString terminalName()const;
38 int foreground()const; 40 int foreground()const;
39 int background()const; 41 int background()const;
40 int terminal()const; 42 int terminal()const;
41 43
42 /* 44 /*
43 * config stuff 45 * config stuff
44 */ 46 */
45 QMap<QString, QString> conf()const; 47 QMap<QString, QString> conf()const;
46 void clearConf(); 48 void clearConf();
47 void writeEntry( const QString& key, const QString& value ); 49 void writeEntry( const QString& key, const QString& value );
48 void writeEntry( const QString& key, int num ); 50 void writeEntry( const QString& key, int num );
49 void writeEntry( const QString& key, bool b ); 51 void writeEntry( const QString& key, bool b );
50 void writeEntry( const QString& key, const QStringList&, const QChar& ); 52 void writeEntry( const QString& key, const QStringList&, const QChar& );
51 QString readEntry( const QString& key, const QString& deflt = QString::null)const; 53 QString readEntry( const QString& key, const QString& deflt = QString::null)const;
52 int readNumEntry( const QString& key, int = -1 )const; 54 int readNumEntry( const QString& key, int = -1 )const;
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp
index f4fbcf2..d0ace6c 100644
--- a/noncore/apps/opie-console/session.cpp
+++ b/noncore/apps/opie-console/session.cpp
@@ -16,75 +16,85 @@ Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay)
16{ 16{
17// m_widLay = 0l; 17// m_widLay = 0l;
18// m_emLay = 0l; 18// m_emLay = 0l;
19 m_emu = 0l; 19 m_emu = 0l;
20} 20}
21Session::~Session() { 21Session::~Session() {
22 delete m_layer; 22 delete m_layer;
23 delete m_emu; 23 delete m_emu;
24 delete m_widget; 24 delete m_widget;
25 /* the widget layer should be deleted by the m_widget */ 25 /* the widget layer should be deleted by the m_widget */
26} 26}
27QString Session::name()const { 27QString Session::name()const {
28 return m_name; 28 return m_name;
29} 29}
30QWidgetStack* Session::widgetStack() { 30QWidgetStack* Session::widgetStack() {
31 return m_widget; 31 return m_widget;
32} 32}
33IOLayer* Session::layer() { 33IOLayer* Session::layer() {
34 return m_layer; 34 return m_layer;
35} 35}
36EmulationHandler* Session::emulationHandler() { 36EmulationHandler* Session::emulationHandler() {
37 return m_emu; 37 return m_emu;
38} 38}
39/* 39/*
40WidgetLayer* Session::emulationWidget() { 40WidgetLayer* Session::emulationWidget() {
41 return m_widLay; 41 return m_widLay;
42} 42}
43*/ 43*/
44void Session::connect() { 44void Session::connect() {
45 if ( !m_layer || !m_emu ) 45 if ( !m_layer || !m_emu )
46 return; 46 return;
47 47
48 m_connected = true;
49
48 qWarning("connection in session"); 50 qWarning("connection in session");
49 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), 51 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ),
50 m_emu, SLOT(recv(const QByteArray&) ) ); 52 m_emu, SLOT(recv(const QByteArray&) ) );
51 QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), 53 QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ),
52 m_layer, SLOT(send(const QByteArray&) ) ); 54 m_layer, SLOT(send(const QByteArray&) ) );
53
54} 55}
56
55void Session::disconnect() { 57void Session::disconnect() {
56 58
57 if ( !m_layer || !m_emu ) 59 if ( !m_layer || !m_emu )
58 return; 60 return;
59 61
62 m_connected = false;
63
60 QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), 64 QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ),
61 m_emu, SLOT(recv(const QByteArray&) ) ); 65 m_emu, SLOT(recv(const QByteArray&) ) );
62 QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ), 66 QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ),
63 m_layer, SLOT(send(const QByteArray&) ) ); 67 m_layer, SLOT(send(const QByteArray&) ) );
64} 68}
69
65void Session::setName( const QString& na){ 70void Session::setName( const QString& na){
66 m_name = na; 71 m_name = na;
67} 72}
73
68void Session::setWidgetStack( QWidgetStack* wid ) { 74void Session::setWidgetStack( QWidgetStack* wid ) {
69 delete m_emu; 75 delete m_emu;
70 m_emu = 0l; 76 m_emu = 0l;
71 delete m_widget; 77 delete m_widget;
72 /* the EmulationLayer was destroyed... */ 78 /* the EmulationLayer was destroyed... */
73 79
74 m_widget = wid; 80 m_widget = wid;
75} 81}
76void Session::setIOLayer( IOLayer* lay ) { 82void Session::setIOLayer( IOLayer* lay ) {
77 delete m_layer; 83 delete m_layer;
78 m_layer = lay; 84 m_layer = lay;
79} 85}
80 86
81void Session::setEmulationHandler( EmulationHandler* lay ) { 87void Session::setEmulationHandler( EmulationHandler* lay ) {
82 delete m_emu; 88 delete m_emu;
83 m_emu = lay; 89 m_emu = lay;
84} 90}
85/* 91/*
86void Session::setEmulationWidget( WidgetLayer* lay ) { 92void Session::setEmulationWidget( WidgetLayer* lay ) {
87 delete m_widLay; 93 delete m_widLay;
88 m_widLay = lay; 94 m_widLay = lay;
89} 95}
90*/ 96*/
97
98bool Session::isConnected() {
99 return m_connected;
100}
diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h
index c3f3661..a1121d3 100644
--- a/noncore/apps/opie-console/session.h
+++ b/noncore/apps/opie-console/session.h
@@ -30,41 +30,44 @@ public:
30 * return the widgetstack 30 * return the widgetstack
31 * this is used to be semi modal 31 * this is used to be semi modal
32 * for FileTransfer 32 * for FileTransfer
33 * 33 *
34 * semi modal == SessionModal 34 * semi modal == SessionModal
35 */ 35 */
36 QWidgetStack* widgetStack(); 36 QWidgetStack* widgetStack();
37 37
38 /** 38 /**
39 * return the layer 39 * return the layer
40 */ 40 */
41 IOLayer* layer(); 41 IOLayer* layer();
42 42
43 EmulationHandler* emulationHandler(); 43 EmulationHandler* emulationHandler();
44 44
45 /* 45 /*
46 * connects the data flow from 46 * connects the data flow from
47 * the IOLayer to the EmulationLayer 47 * the IOLayer to the EmulationLayer
48 */ 48 */
49 void connect(); 49 void connect();
50 50
51 /* 51 /*
52 * disconnect the dataflow 52 * disconnect the dataflow
53 * this will be done for ft 53 * this will be done for ft
54 */ 54 */
55 void disconnect(); 55 void disconnect();
56 56
57 void setWidgetStack( QWidgetStack* widget ); 57 void setWidgetStack( QWidgetStack* widget );
58 void setEmulationHandler( EmulationHandler* lay ); 58 void setEmulationHandler( EmulationHandler* lay );
59 void setIOLayer( IOLayer* ); 59 void setIOLayer( IOLayer* );
60 void setName( const QString& ); 60 void setName( const QString& );
61 61
62 bool isConnected();
63
62private: 64private:
63 QString m_name; 65 QString m_name;
64 QWidgetStack* m_widget; 66 QWidgetStack* m_widget;
65 IOLayer* m_layer; 67 IOLayer* m_layer;
66 EmulationHandler* m_emu; 68 EmulationHandler* m_emu;
69 bool m_connected;
67 70
68}; 71};
69 72
70#endif 73#endif
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp
index 2d37be2..8badf96 100644
--- a/noncore/apps/opie-console/terminalwidget.cpp
+++ b/noncore/apps/opie-console/terminalwidget.cpp
@@ -1,194 +1,210 @@
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
13namespace { 13namespace {
14 enum TermIds { 14 enum TermIds {
15 id_term_vt100, 15 id_term_vt100,
16 id_term_vt102, 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 id_term_green,
24 id_term_orange
23 }; 25 };
24 26
25 enum FontIds { 27 enum FontIds {
26 id_size_small, 28 id_size_small,
27 id_size_medium, 29 id_size_medium,
28 id_size_large 30 id_size_large
29 }; 31 };
30}; 32};
31 33
32TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, 34TerminalWidget::TerminalWidget( const QString& name, QWidget* parent,
33 const char* na ) 35 const char* na )
34 : ProfileDialogTerminalWidget( name, parent, na ) { 36 : ProfileDialogTerminalWidget( name, parent, na ) {
35 37
36 m_terminal = new QLabel(tr("Terminal Type"), this ); 38 m_terminal = new QLabel(tr("Terminal Type"), this );
37 m_terminalBox = new QComboBox(this); 39 m_terminalBox = new QComboBox(this);
38 m_colorLabel = new QLabel(tr("Color scheme"), this); 40 m_colorLabel = new QLabel(tr("Color scheme"), this);
39 m_colorCmb = new QComboBox(this ); 41 m_colorCmb = new QComboBox(this );
40 42
41 m_groupSize = new QButtonGroup(tr("Font size"), this ); 43 m_groupSize = new QButtonGroup(tr("Font size"), this );
42 m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); 44 m_sizeSmall = new QRadioButton(tr("small"), m_groupSize );
43 m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); 45 m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize );
44 m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); 46 m_sizeLarge = new QRadioButton(tr("large"), m_groupSize );
45 47
46 m_groupConv = new QHGroupBox(tr("Line-break conversions"), this ); 48 m_groupConv = new QHGroupBox(tr("Line-break conversions"), this );
47 m_convInbound = new QCheckBox(tr("Inbound"), m_groupConv ); 49 m_convInbound = new QCheckBox(tr("Inbound"), m_groupConv );
48 m_convOutbound = new QCheckBox(tr("Outbound"), m_groupConv ); 50 m_convOutbound = new QCheckBox(tr("Outbound"), m_groupConv );
49 51
50 m_groupOptions = new QHGroupBox( tr("Options"), this ); 52 m_groupOptions = new QHGroupBox( tr("Options"), this );
51 m_optionEcho = new QCheckBox(tr("Local echo"), m_groupOptions ); 53 m_optionEcho = new QCheckBox(tr("Local echo"), m_groupOptions );
52 m_optionWrap = new QCheckBox(tr("Line wrap"), m_groupOptions ); 54 m_optionWrap = new QCheckBox(tr("Line wrap"), m_groupOptions );
53 55
54 m_lroot = new QVBoxLayout(this, 2 ); 56 m_lroot = new QVBoxLayout(this, 2 );
55 m_typeBox = new QVBoxLayout( m_lroot ); 57 m_typeBox = new QVBoxLayout( m_lroot );
56 m_hbox = new QHBoxLayout( m_groupSize, 2 ); 58 m_hbox = new QHBoxLayout( m_groupSize, 2 );
57 m_colorBox = new QVBoxLayout( m_lroot ); 59 m_colorBox = new QVBoxLayout( m_lroot );
58 60
59 // Layout 61 // Layout
60 m_typeBox->add(m_terminal ); 62 m_typeBox->add(m_terminal );
61 m_typeBox->add(m_terminalBox ); 63 m_typeBox->add(m_terminalBox );
62 64
63 m_hbox->add(m_sizeSmall ); 65 m_hbox->add(m_sizeSmall );
64 m_hbox->add(m_sizeMedium ); 66 m_hbox->add(m_sizeMedium );
65 m_hbox->add(m_sizeLarge ); 67 m_hbox->add(m_sizeLarge );
66 m_lroot->add(m_groupSize ); 68 m_lroot->add(m_groupSize );
67 69
68 m_colorBox->add( m_colorLabel ); 70 m_colorBox->add( m_colorLabel );
69 m_colorBox->add( m_colorCmb ); 71 m_colorBox->add( m_colorCmb );
70 72
71 m_lroot->add(m_groupConv ); 73 m_lroot->add(m_groupConv );
72 m_lroot->add(m_groupOptions ); 74 m_lroot->add(m_groupOptions );
73 75
74 // Fill in some options 76 // Fill in some options
75 m_terminalBox->insertItem( tr("VT 100"), id_term_vt100 ); 77 m_terminalBox->insertItem( tr("VT 100"), id_term_vt100 );
76 m_terminalBox->insertItem( tr("VT 102"), id_term_vt102 ); 78 m_terminalBox->insertItem( tr("VT 102"), id_term_vt102 );
77 //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); 79 //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi );
78 80
79 m_colorCmb->insertItem( tr("black on white"), id_term_black ); 81 m_colorCmb->insertItem( tr("black on white"), id_term_black );
80 m_colorCmb->insertItem( tr("white on black"), id_term_white ); 82 m_colorCmb->insertItem( tr("white on black"), id_term_white );
83 m_colorCmb->insertItem( tr("green on black"), id_term_green );
84 m_colorCmb->insertItem( tr("orange on black"), id_term_orange );
81 85
82 // signals + slots 86 // signals + slots
83 /* 87 /*
84 connect(m_terminalBox, SIGNAL(activated(int) ), 88 connect(m_terminalBox, SIGNAL(activated(int) ),
85 this, SLOT(slotTermTerm(int) ) ); 89 this, SLOT(slotTermTerm(int) ) );
86 connect(m_colorBox, SIGNAL(activated(int) ), 90 connect(m_colorBox, SIGNAL(activated(int) ),
87 tis, SLOT(slotTermColor(int) ) ); 91 tis, SLOT(slotTermColor(int) ) );
88 connect(m_groupSize, SIGNAL(activated(int) ), 92 connect(m_groupSize, SIGNAL(activated(int) ),
89 this, SLOT(slotTermFont(int) ) ); 93 this, SLOT(slotTermFont(int) ) );
90 94
91 connect(m_optionEcho, SIGNAL(toggled(bool) ), 95 connect(m_optionEcho, SIGNAL(toggled(bool) ),
92 this, SLOT(slotTermEcho(bool) ) ); 96 this, SLOT(slotTermEcho(bool) ) );
93 connect(m_optionWrap, SIGNAL(toggled(bool) ), 97 connect(m_optionWrap, SIGNAL(toggled(bool) ),
94 this, SLOT(slotTermWrap(bool) ) ); 98 this, SLOT(slotTermWrap(bool) ) );
95 connect(m_convInbound, SIGNAL(toggled(bool) ), 99 connect(m_convInbound, SIGNAL(toggled(bool) ),
96 this, SLOT(slotTermInbound(bool) ) ); 100 this, SLOT(slotTermInbound(bool) ) );
97 connect(m_convOutbound, SIGNAL(toggled(bool) ), 101 connect(m_convOutbound, SIGNAL(toggled(bool) ),
98 this, SLOT(slotTermOutbound(bool) ) ); 102 this, SLOT(slotTermOutbound(bool) ) );
99*/ 103*/
100} 104}
101TerminalWidget::~TerminalWidget() { 105TerminalWidget::~TerminalWidget() {
102} 106}
103void TerminalWidget::load( const Profile& prof ) { 107void TerminalWidget::load( const Profile& prof ) {
104 int term = prof.readNumEntry("Terminal"); 108 int term = prof.readNumEntry("Terminal");
105 int color = prof.readNumEntry("Color"); 109 int color = prof.readNumEntry("Color");
106 int fontsize = prof.readNumEntry("Font"); 110 int fontsize = prof.readNumEntry("Font");
107 int opt_echo = prof.readNumEntry("Echo"); 111 int opt_echo = prof.readNumEntry("Echo");
108 int opt_wrap = prof.readNumEntry("Wrap"); 112 int opt_wrap = prof.readNumEntry("Wrap");
109 int opt_inbound = prof.readNumEntry("Inbound"); 113 int opt_inbound = prof.readNumEntry("Inbound");
110 int opt_outbound = prof.readNumEntry("Outbound"); 114 int opt_outbound = prof.readNumEntry("Outbound");
111 115
112 switch( term ) { 116 switch( term ) {
113 case Profile::VT100: 117 case Profile::VT100:
114 m_terminalBox->setCurrentItem(id_term_vt100 ); 118 m_terminalBox->setCurrentItem(id_term_vt100 );
115 break; 119 break;
116 case Profile::VT102: 120 case Profile::VT102:
117 m_terminalBox->setCurrentItem(id_term_vt102 ); 121 m_terminalBox->setCurrentItem(id_term_vt102 );
118 break; 122 break;
119 default: 123 default:
120 break; 124 break;
121 }; 125 };
122 126
123 switch( color ) { 127 switch( color ) {
124 case Profile::Black: 128 case Profile::Black:
125 m_colorCmb->setCurrentItem(id_term_black ); 129 m_colorCmb->setCurrentItem(id_term_black );
126 break; 130 break;
127 case Profile::White: 131 case Profile::White:
128 m_colorCmb->setCurrentItem(id_term_white ); 132 m_colorCmb->setCurrentItem(id_term_white );
129 break; 133 break;
134 case Profile::Green:
135 m_colorCmb->setCurrentItem(id_term_green );
136 break;
137 case Profile::Orange:
138 m_colorCmb->setCurrentItem(id_term_orange );
139 break;
130 default: 140 default:
131 break; 141 break;
132 }; 142 };
133 143
134 switch( fontsize ) { 144 switch( fontsize ) {
135 case Profile::Micro: 145 case Profile::Micro:
136 m_sizeSmall->setChecked(true ); 146 m_sizeSmall->setChecked(true );
137 break; 147 break;
138 case Profile::Small: 148 case Profile::Small:
139 m_sizeMedium->setChecked(true ); 149 m_sizeMedium->setChecked(true );
140 break; 150 break;
141 case Profile::Medium: 151 case Profile::Medium:
142 m_sizeLarge->setChecked( true ); 152 m_sizeLarge->setChecked( true );
143 break; 153 break;
144 m_sizeSmall->setChecked(true); 154 m_sizeSmall->setChecked(true);
145 default: 155 default:
146 break; 156 break;
147 }; 157 };
148 158
149 if (opt_echo) m_optionEcho->setChecked( true ); 159 if (opt_echo) m_optionEcho->setChecked( true );
150 if (opt_wrap) m_optionWrap->setChecked( true ); 160 if (opt_wrap) m_optionWrap->setChecked( true );
151 if (opt_inbound) m_convInbound->setChecked( true ); 161 if (opt_inbound) m_convInbound->setChecked( true );
152 if (opt_outbound) m_convOutbound->setChecked( true ); 162 if (opt_outbound) m_convOutbound->setChecked( true );
153 163
154} 164}
155void TerminalWidget::save( Profile& profile ) { 165void TerminalWidget::save( Profile& profile ) {
156 switch(m_terminalBox->currentItem() ) { 166 switch(m_terminalBox->currentItem() ) {
157 case id_term_vt100: 167 case id_term_vt100:
158 profile.writeEntry("Terminal", Profile::VT100 ); 168 profile.writeEntry("Terminal", Profile::VT100 );
159 break; 169 break;
160 case id_term_vt102: 170 case id_term_vt102:
161 profile.writeEntry("Terminal", Profile::VT102 ); 171 profile.writeEntry("Terminal", Profile::VT102 );
162 break; 172 break;
163 //case id_term_ansi: 173 //case id_term_ansi:
164 // profile.writeEntry("Terminal", Profile::VT102 ); 174 // profile.writeEntry("Terminal", Profile::VT102 );
165 // break; 175 // break;
166 default: 176 default:
167 break; 177 break;
168 }; 178 };
169 179
170 // color 180 // color
171 switch(m_colorCmb->currentItem() ) { 181 switch(m_colorCmb->currentItem() ) {
172 case id_term_black: 182 case id_term_black:
173 profile.writeEntry("Color", Profile::Black ); 183 profile.writeEntry("Color", Profile::Black );
174 break; 184 break;
175 case id_term_white: 185 case id_term_white:
176 profile.writeEntry("Color", Profile::White ); 186 profile.writeEntry("Color", Profile::White );
177 break; 187 break;
188 case id_term_green:
189 profile.writeEntry("Color", Profile::Green );
190 break;
191 case id_term_orange:
192 profile.writeEntry("Color", Profile::Orange );
193 break;
178 default: 194 default:
179 break; 195 break;
180 }; 196 };
181 197
182 if (m_sizeSmall->isChecked() ) { 198 if (m_sizeSmall->isChecked() ) {
183 profile.writeEntry("Font", Profile::Micro ); 199 profile.writeEntry("Font", Profile::Micro );
184 }else if (m_sizeMedium->isChecked() ) { 200 }else if (m_sizeMedium->isChecked() ) {
185 profile.writeEntry("Font", Profile::Small ); 201 profile.writeEntry("Font", Profile::Small );
186 }else { 202 }else {
187 profile.writeEntry("Font", Profile::Medium ); 203 profile.writeEntry("Font", Profile::Medium );
188 } 204 }
189 205
190 profile.writeEntry("Echo", m_optionEcho->isChecked() ); 206 profile.writeEntry("Echo", m_optionEcho->isChecked() );
191 profile.writeEntry("Wrap", m_optionWrap->isChecked() ); 207 profile.writeEntry("Wrap", m_optionWrap->isChecked() );
192 profile.writeEntry("Inbound", m_convInbound->isChecked() ); 208 profile.writeEntry("Inbound", m_convInbound->isChecked() );
193 profile.writeEntry("Outbound",m_convOutbound->isChecked() ); 209 profile.writeEntry("Outbound",m_convOutbound->isChecked() );
194} 210}