author | harlekin <harlekin> | 2002-10-15 10:46:40 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-15 10:46:40 (UTC) |
commit | daae7a75b0e9ccbf1ea4c699c631ad77825e6301 (patch) (unidiff) | |
tree | 94bd75c58f42d8752b62a2281a5175a8e746f9ff /noncore/apps/opie-console | |
parent | e09b7ab685d29eba947c3bb021192408acae70be (diff) | |
download | opie-daae7a75b0e9ccbf1ea4c699c631ad77825e6301.zip opie-daae7a75b0e9ccbf1ea4c699c631ad77825e6301.tar.gz opie-daae7a75b0e9ccbf1ea4c699c631ad77825e6301.tar.bz2 |
- more menu handling \n - added 2 more color shemes
-rw-r--r-- | noncore/apps/opie-console/TEScreen.h | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 17 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 31 | ||||
-rw-r--r-- | noncore/apps/opie-console/profile.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.h | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/terminalwidget.cpp | 18 |
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 | |||
@@ -136,9 +136,9 @@ public: // these are all `Screen' operations | |||
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; } |
@@ -165,9 +165,9 @@ public: // these are all `Screen' operations | |||
165 | private: // helper | 165 | private: // 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(); |
@@ -198,9 +198,9 @@ private: | |||
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; |
@@ -237,9 +237,9 @@ private: | |||
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; |
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 | |||
@@ -106,8 +106,17 @@ QColor EmulationHandler::foreColor(int col) { | |||
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 | } |
@@ -124,8 +133,16 @@ QColor EmulationHandler::backColor(int col ) { | |||
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 | |||
@@ -313,17 +313,22 @@ void MainWindow::slotRunScript() { | |||
313 | 313 | ||
314 | void MainWindow::slotConnect() { | 314 | void 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 | ||
323 | void MainWindow::slotDisconnect() { | 325 | void 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 | ||
328 | void MainWindow::slotTerminate() { | 333 | void MainWindow::slotTerminate() { |
329 | if ( currentSession() ) | 334 | if ( currentSession() ) |
@@ -404,9 +409,9 @@ void MainWindow::create( const Profile& prof ) { | |||
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 ); |
@@ -416,13 +421,13 @@ void MainWindow::create( const Profile& prof ) { | |||
416 | } | 421 | } |
417 | 422 | ||
418 | void MainWindow::slotTransfer() | 423 | void 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 | ||
428 | void MainWindow::slotOpenKeb(bool state) { | 433 | void MainWindow::slotOpenKeb(bool state) { |
@@ -434,8 +439,16 @@ void MainWindow::slotOpenKeb(bool state) { | |||
434 | void MainWindow::slotSessionChanged( Session* ses ) { | 439 | void 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 | ||
441 | void MainWindow::slotFullscreen() { | 454 | void MainWindow::slotFullscreen() { |
@@ -454,9 +467,9 @@ void MainWindow::slotFullscreen() { | |||
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 ); |
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 | |||
@@ -16,9 +16,11 @@ 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 | 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, |
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 | |||
@@ -44,28 +44,34 @@ WidgetLayer* Session::emulationWidget() { | |||
44 | void Session::connect() { | 44 | void 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 | |||
55 | void Session::disconnect() { | 57 | void 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 | |||
65 | void Session::setName( const QString& na){ | 70 | void Session::setName( const QString& na){ |
66 | m_name = na; | 71 | m_name = na; |
67 | } | 72 | } |
73 | |||
68 | void Session::setWidgetStack( QWidgetStack* wid ) { | 74 | void 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; |
@@ -87,4 +93,8 @@ void 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 | |||
98 | bool 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 | |||
@@ -58,13 +58,16 @@ public: | |||
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 | |||
62 | private: | 64 | private: |
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 | |||
@@ -18,9 +18,11 @@ namespace { | |||
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, |
@@ -77,8 +79,10 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, | |||
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) ), |
@@ -126,8 +130,14 @@ void TerminalWidget::load( const Profile& prof ) { | |||
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 | ||
@@ -174,8 +184,14 @@ void TerminalWidget::save( Profile& profile ) { | |||
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 | ||