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
@@ -132,17 +132,17 @@ public: // these are all `Screen' operations
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. */
@@ -161,17 +161,17 @@ public: // these are all `Screen' operations
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();
@@ -194,17 +194,17 @@ private:
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
@@ -233,17 +233,17 @@ private:
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
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
@@ -102,16 +102,25 @@ QColor EmulationHandler::foreColor(int col) {
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 ) {
@@ -120,12 +129,20 @@ QColor EmulationHandler::backColor(int col ) {
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
@@ -309,25 +309,30 @@ void MainWindow::slotRunScript() {
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 */
@@ -400,46 +405,54 @@ void MainWindow::create( const Profile& prof ) {
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 );
@@ -450,17 +463,17 @@ void MainWindow::slotFullscreen() {
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;
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
@@ -12,17 +12,19 @@
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,
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
@@ -40,36 +40,42 @@ EmulationHandler* Session::emulationHandler() {
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}
@@ -83,8 +89,12 @@ void Session::setEmulationHandler( EmulationHandler* lay ) {
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
@@ -54,17 +54,20 @@ public:
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
@@ -14,17 +14,19 @@ namespace {
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};
@@ -73,16 +75,18 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent,
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) ),
@@ -122,16 +126,22 @@ void TerminalWidget::load( const Profile& prof ) {
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;
@@ -170,16 +180,22 @@ void TerminalWidget::save( Profile& profile ) {
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 );