From daae7a75b0e9ccbf1ea4c699c631ad77825e6301 Mon Sep 17 00:00:00 2001 From: harlekin Date: Tue, 15 Oct 2002 10:46:40 +0000 Subject: - more menu handling \n - added 2 more color shemes --- (limited to 'noncore/apps') 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 @@ -137,7 +137,7 @@ public: // these are all `Screen' operations void resizeImage(int new_lines, int new_columns); // ca* getCookedImage(); - + /*! return the number of lines. */ int getLines() { return lines; } /*! return the number of columns. */ @@ -166,7 +166,7 @@ private: // helper void clearImage(int loca, int loce, char c); void moveImage(int dst, int loca, int loce); - + void scrollUp(int from, int i); void scrollDown(int from, int i); @@ -199,7 +199,7 @@ private: int histCursor; // display position relative to start of the history buffer HistoryScroll hist; - + // cursor location int cuX; @@ -238,7 +238,7 @@ private: // // save cursor, rendition & states ------------ - // + // // cursor location 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 @@ -107,6 +107,15 @@ QColor EmulationHandler::foreColor(int col) { qWarning("Foreground white"); co = Qt::black; break; + case Profile::Green: + qWarning("Foreground green"); + co = Qt::green; + break; + case Profile::Orange: + qWarning("Foreground orange"); + // FIXME needs better color here + co = Qt::darkYellow; + break; } return co; @@ -125,6 +134,14 @@ QColor EmulationHandler::backColor(int col ) { qWarning("Background black"); co = Qt::white; break; + case Profile::Green: + qWarning("Background black"); + co = Qt::black; + break; + case Profile::Orange: + qWarning("Background black"); + co = Qt::black; + break; } return co; 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 @@ -314,15 +314,20 @@ void MainWindow::slotRunScript() { void MainWindow::slotConnect() { if ( currentSession() ) { bool ret = currentSession()->layer()->open(); - if(!ret) QMessageBox::warning(currentSession()->widgetStack(), - QObject::tr("Failed"), - QObject::tr("Connecting failed for this session.")); - } + if(!ret) QMessageBox::warning(currentSession()->widgetStack(), + QObject::tr("Failed"), + QObject::tr("Connecting failed for this session.")); + m_connect->setEnabled( false ); + m_disconnect->setEnabled( true ); + } } void MainWindow::slotDisconnect() { - if ( currentSession() ) + if ( currentSession() ) { currentSession()->layer()->close(); + m_connect->setEnabled( true ); + m_disconnect->setEnabled( false ); + } } void MainWindow::slotTerminate() { @@ -405,7 +410,7 @@ void MainWindow::create( const Profile& prof ) { // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it m_connect->setEnabled( true ); - m_disconnect->setEnabled( true ); + m_disconnect->setEnabled( false ); m_terminate->setEnabled( true ); m_transfer->setEnabled( true ); m_recordScript->setEnabled( true ); @@ -417,11 +422,11 @@ void MainWindow::create( const Profile& prof ) { void MainWindow::slotTransfer() { - // if ( currentSession() ) { + if ( currentSession() ) { TransferDialog dlg(this); dlg.showMaximized(); dlg.exec(); - // } + } } @@ -435,6 +440,14 @@ void MainWindow::slotSessionChanged( Session* ses ) { if ( ses ) { qWarning("changing %s", ses->name().latin1() ); m_curSession = ses; + + if ( m_curSession->isConnected() ) { + m_connect->setEnabled( false ); + m_disconnect->setEnabled( true ); + } else { + m_connect->setEnabled( true ); + m_disconnect->setEnabled( false ); + } } } @@ -455,7 +468,7 @@ void MainWindow::slotFullscreen() { ( m_curSession->widgetStack() )->setFocus(); ( m_curSession->widgetStack() )->show(); - // QPushButton *cornerButton = new QPushButton( this ); + //QPushButton *cornerButton = new QPushButton( ); //cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); //connect( cornerButton, SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); // need teh scrollbar 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 @@ -17,7 +17,9 @@ public: typedef QValueList ValueList; enum Color { Black = 0, White, - Gray }; + Gray, + Green, + Orange}; enum Terminal {VT102 = 0, VT100 }; enum Font { Micro = 0, Small, Medium }; Profile(); 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 @@ -45,26 +45,32 @@ void Session::connect() { if ( !m_layer || !m_emu ) return; + m_connected = true; + qWarning("connection in session"); QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), m_emu, SLOT(recv(const QByteArray&) ) ); QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), m_layer, SLOT(send(const QByteArray&) ) ); - } + void Session::disconnect() { if ( !m_layer || !m_emu ) return; + m_connected = false; + QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), m_emu, SLOT(recv(const QByteArray&) ) ); QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ), m_layer, SLOT(send(const QByteArray&) ) ); } + void Session::setName( const QString& na){ m_name = na; } + void Session::setWidgetStack( QWidgetStack* wid ) { delete m_emu; m_emu = 0l; @@ -88,3 +94,7 @@ void Session::setEmulationWidget( WidgetLayer* lay ) { m_widLay = lay; } */ + +bool Session::isConnected() { + return m_connected; +} 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 @@ -59,11 +59,14 @@ public: void setIOLayer( IOLayer* ); void setName( const QString& ); + bool isConnected(); + private: QString m_name; QWidgetStack* m_widget; IOLayer* m_layer; EmulationHandler* m_emu; + bool m_connected; }; 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 @@ -19,7 +19,9 @@ namespace { enum ColourIds { id_term_black, - id_term_white + id_term_white, + id_term_green, + id_term_orange }; enum FontIds { @@ -78,6 +80,8 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, m_colorCmb->insertItem( tr("black on white"), id_term_black ); m_colorCmb->insertItem( tr("white on black"), id_term_white ); + m_colorCmb->insertItem( tr("green on black"), id_term_green ); + m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); // signals + slots /* @@ -127,6 +131,12 @@ void TerminalWidget::load( const Profile& prof ) { case Profile::White: m_colorCmb->setCurrentItem(id_term_white ); break; + case Profile::Green: + m_colorCmb->setCurrentItem(id_term_green ); + break; + case Profile::Orange: + m_colorCmb->setCurrentItem(id_term_orange ); + break; default: break; }; @@ -175,6 +185,12 @@ void TerminalWidget::save( Profile& profile ) { case id_term_white: profile.writeEntry("Color", Profile::White ); break; + case id_term_green: + profile.writeEntry("Color", Profile::Green ); + break; + case id_term_orange: + profile.writeEntry("Color", Profile::Orange ); + break; default: break; }; -- cgit v0.9.0.2