summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-15 10:46:40 (UTC)
committer harlekin <harlekin>2002-10-15 10:46:40 (UTC)
commitdaae7a75b0e9ccbf1ea4c699c631ad77825e6301 (patch) (side-by-side diff)
tree94bd75c58f42d8752b62a2281a5175a8e746f9ff
parente09b7ab685d29eba947c3bb021192408acae70be (diff)
downloadopie-daae7a75b0e9ccbf1ea4c699c631ad77825e6301.zip
opie-daae7a75b0e9ccbf1ea4c699c631ad77825e6301.tar.gz
opie-daae7a75b0e9ccbf1ea4c699c631ad77825e6301.tar.bz2
- more menu handling \n - added 2 more color shemes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/TEScreen.h0
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp17
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp23
-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, 69 insertions, 8 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
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 ) {
return font;
}
QColor EmulationHandler::foreColor(int col) {
QColor co;
/* we need to switch it */
switch( col ) {
default:
case Profile::White:
qWarning("Foreground black");
/* color is black */
co = Qt::white;
break;
case Profile::Black:
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;
}
QColor EmulationHandler::backColor(int col ) {
QColor co;
/* we need to switch it */
switch( col ) {
default:
case Profile::White:
qWarning("Background white");
/* color is white */
co = Qt::black;
break;
case Profile::Black:
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
@@ -304,38 +304,43 @@ void MainWindow::slotRunScript() {
types.insert("Script", script);
QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types);
if (!filename.isEmpty()) {
Script script(DocLnk(filename).file());
currentSession()->emulationLayer()->runScript(&script);
}
}
*/
}
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."));
+ 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() {
if ( currentSession() )
currentSession()->layer()->close();
slotClose();
/* FIXME move to the next session */
}
void MainWindow::slotConfigure() {
qWarning("configure");
ConfigDialog conf( manager()->all(), factory() );
conf.showMaximized();
int ret = conf.exec();
@@ -392,77 +397,85 @@ void MainWindow::create( const Profile& prof ) {
if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
{
QMessageBox::warning(this,
QObject::tr("Session failed"),
QObject::tr("Cannot open session: Not all components were found."));
//if(ses) delete ses;
return;
}
m_sessions.append( ses );
tabWidget()->add( ses );
m_curSession = ses;
// 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 );
m_saveScript->setEnabled( true );
m_runScript->setEnabled( true );
m_fullscreen->setEnabled( true );
m_closewindow->setEnabled( true );
}
void MainWindow::slotTransfer()
{
- // if ( currentSession() ) {
+ if ( currentSession() ) {
TransferDialog dlg(this);
dlg.showMaximized();
dlg.exec();
- // }
+ }
}
void MainWindow::slotOpenKeb(bool state) {
if (state) m_keyBar->show();
else m_keyBar->hide();
}
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 );
+ }
}
}
void MainWindow::slotFullscreen() {
if ( m_isFullscreen ) {
( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false );
( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken );
setCentralWidget( m_consoleWindow );
( m_curSession->widgetStack() )->show();
m_fullscreen->setText( tr("Full screen") );
} else {
( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop,
QPoint(0,0), false);
( m_curSession->widgetStack() )->resize(qApp->desktop()->width(), qApp->desktop()->height());
( 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
// ( m_curSession->widgetStack() )->setCornerWidget( cornerButton );
m_fullscreen->setText( tr("Stop full screen") );
}
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
@@ -4,33 +4,35 @@
#include <qmap.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qvaluelist.h>
/**
* A session will be generated from a saved
* profile. A profile contains the iolayername
* a name.
* We can generate a Session from a Profile
* Configuration is contained here too
*/
class Profile {
public:
typedef QValueList<Profile> ValueList;
enum Color { Black = 0,
White,
- Gray };
+ Gray,
+ Green,
+ Orange};
enum Terminal {VT102 = 0, VT100 };
enum Font { Micro = 0, Small, Medium };
Profile();
Profile( const QString& name,
const QCString& iolayerName,
const QCString& termName,
int background,
int foreground,
int terminal);
Profile( const Profile& );
Profile &operator=( const Profile& );
bool operator==( const Profile& prof );
~Profile();
QString name()const;
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() {
}
IOLayer* Session::layer() {
return m_layer;
}
EmulationHandler* Session::emulationHandler() {
return m_emu;
}
/*
WidgetLayer* Session::emulationWidget() {
return m_widLay;
}
*/
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;
delete m_widget;
/* the EmulationLayer was destroyed... */
m_widget = wid;
}
void Session::setIOLayer( IOLayer* lay ) {
delete m_layer;
m_layer = lay;
}
void Session::setEmulationHandler( EmulationHandler* lay ) {
delete m_emu;
m_emu = lay;
}
/*
void Session::setEmulationWidget( WidgetLayer* lay ) {
delete m_widLay;
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
@@ -46,25 +46,28 @@ public:
* connects the data flow from
* the IOLayer to the EmulationLayer
*/
void connect();
/*
* disconnect the dataflow
* this will be done for ft
*/
void disconnect();
void setWidgetStack( QWidgetStack* widget );
void setEmulationHandler( EmulationHandler* lay );
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;
};
#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 @@
#include <qgroupbox.h>
#include <qvbox.h>
#include <qhgroupbox.h>
#include <qlayout.h>
#include "terminalwidget.h"
namespace {
enum TermIds {
id_term_vt100,
id_term_vt102,
id_term_ansi
};
enum ColourIds {
id_term_black,
- id_term_white
+ id_term_white,
+ id_term_green,
+ id_term_orange
};
enum FontIds {
id_size_small,
id_size_medium,
id_size_large
};
};
TerminalWidget::TerminalWidget( const QString& name, QWidget* parent,
const char* na )
: ProfileDialogTerminalWidget( name, parent, na ) {
m_terminal = new QLabel(tr("Terminal Type"), this );
m_terminalBox = new QComboBox(this);
m_colorLabel = new QLabel(tr("Color scheme"), this);
@@ -65,32 +67,34 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent,
m_hbox->add(m_sizeLarge );
m_lroot->add(m_groupSize );
m_colorBox->add( m_colorLabel );
m_colorBox->add( m_colorCmb );
m_lroot->add(m_groupConv );
m_lroot->add(m_groupOptions );
// Fill in some options
m_terminalBox->insertItem( tr("VT 100"), id_term_vt100 );
m_terminalBox->insertItem( tr("VT 102"), id_term_vt102 );
//m_terminalBox->insertItem( tr("ANSI"), id_term_ansi );
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
/*
connect(m_terminalBox, SIGNAL(activated(int) ),
this, SLOT(slotTermTerm(int) ) );
connect(m_colorBox, SIGNAL(activated(int) ),
tis, SLOT(slotTermColor(int) ) );
connect(m_groupSize, SIGNAL(activated(int) ),
this, SLOT(slotTermFont(int) ) );
connect(m_optionEcho, SIGNAL(toggled(bool) ),
this, SLOT(slotTermEcho(bool) ) );
connect(m_optionWrap, SIGNAL(toggled(bool) ),
this, SLOT(slotTermWrap(bool) ) );
connect(m_convInbound, SIGNAL(toggled(bool) ),
this, SLOT(slotTermInbound(bool) ) );
@@ -114,32 +118,38 @@ void TerminalWidget::load( const Profile& prof ) {
m_terminalBox->setCurrentItem(id_term_vt100 );
break;
case Profile::VT102:
m_terminalBox->setCurrentItem(id_term_vt102 );
break;
default:
break;
};
switch( color ) {
case Profile::Black:
m_colorCmb->setCurrentItem(id_term_black );
break;
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;
};
switch( fontsize ) {
case Profile::Micro:
m_sizeSmall->setChecked(true );
break;
case Profile::Small:
m_sizeMedium->setChecked(true );
break;
case Profile::Medium:
m_sizeLarge->setChecked( true );
break;
m_sizeSmall->setChecked(true);
default:
@@ -162,32 +172,38 @@ void TerminalWidget::save( Profile& profile ) {
break;
//case id_term_ansi:
// profile.writeEntry("Terminal", Profile::VT102 );
// break;
default:
break;
};
// color
switch(m_colorCmb->currentItem() ) {
case id_term_black:
profile.writeEntry("Color", Profile::Black );
break;
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;
};
if (m_sizeSmall->isChecked() ) {
profile.writeEntry("Font", Profile::Micro );
}else if (m_sizeMedium->isChecked() ) {
profile.writeEntry("Font", Profile::Small );
}else {
profile.writeEntry("Font", Profile::Medium );
}
profile.writeEntry("Echo", m_optionEcho->isChecked() );
profile.writeEntry("Wrap", m_optionWrap->isChecked() );
profile.writeEntry("Inbound", m_convInbound->isChecked() );
profile.writeEntry("Outbound",m_convOutbound->isChecked() );