-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 | |||
@@ -124,95 +124,95 @@ public: // these are all `Screen' operations | |||
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 | ||
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(); |
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 | ||
180 | private: | 180 | private: |
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 | ||
@@ -225,33 +225,33 @@ private: | |||
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 | }; |
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 | |||
@@ -94,38 +94,55 @@ QFont EmulationHandler::font( int id ) { | |||
94 | return font; | 94 | return font; |
95 | } | 95 | } |
96 | QColor EmulationHandler::foreColor(int col) { | 96 | QColor 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 | } |
114 | QColor EmulationHandler::backColor(int col ) { | 123 | QColor 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 | |||
@@ -301,41 +301,46 @@ void MainWindow::slotRunScript() { | |||
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 | ||
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() ) |
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 | ||
336 | void MainWindow::slotConfigure() { | 341 | void 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(); |
@@ -392,77 +397,85 @@ void MainWindow::create( const Profile& prof ) { | |||
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 | ||
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) { |
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 | } |
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() { |
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 | |||
@@ -4,33 +4,35 @@ | |||
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 | 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; |
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 | |||
@@ -32,59 +32,69 @@ QWidgetStack* Session::widgetStack() { | |||
32 | } | 32 | } |
33 | IOLayer* Session::layer() { | 33 | IOLayer* Session::layer() { |
34 | return m_layer; | 34 | return m_layer; |
35 | } | 35 | } |
36 | EmulationHandler* Session::emulationHandler() { | 36 | EmulationHandler* Session::emulationHandler() { |
37 | return m_emu; | 37 | return m_emu; |
38 | } | 38 | } |
39 | /* | 39 | /* |
40 | WidgetLayer* Session::emulationWidget() { | 40 | WidgetLayer* Session::emulationWidget() { |
41 | return m_widLay; | 41 | return m_widLay; |
42 | } | 42 | } |
43 | */ | 43 | */ |
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; |
72 | /* the EmulationLayer was destroyed... */ | 78 | /* the EmulationLayer was destroyed... */ |
73 | 79 | ||
74 | m_widget = wid; | 80 | m_widget = wid; |
75 | } | 81 | } |
76 | void Session::setIOLayer( IOLayer* lay ) { | 82 | void Session::setIOLayer( IOLayer* lay ) { |
77 | delete m_layer; | 83 | delete m_layer; |
78 | m_layer = lay; | 84 | m_layer = lay; |
79 | } | 85 | } |
80 | 86 | ||
81 | void Session::setEmulationHandler( EmulationHandler* lay ) { | 87 | void Session::setEmulationHandler( EmulationHandler* lay ) { |
82 | delete m_emu; | 88 | delete m_emu; |
83 | m_emu = lay; | 89 | m_emu = lay; |
84 | } | 90 | } |
85 | /* | 91 | /* |
86 | void Session::setEmulationWidget( WidgetLayer* lay ) { | 92 | 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 | |||
@@ -46,25 +46,28 @@ public: | |||
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 | |||
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 | |||
@@ -6,33 +6,35 @@ | |||
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_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 | ||
32 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, | 34 | TerminalWidget::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); |
@@ -65,32 +67,34 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, | |||
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) ) ); |
@@ -114,32 +118,38 @@ void TerminalWidget::load( const Profile& prof ) { | |||
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: |
@@ -162,32 +172,38 @@ void TerminalWidget::save( Profile& profile ) { | |||
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() ); |