summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/PLANS12
-rw-r--r--noncore/apps/opie-console/default.cpp7
-rw-r--r--noncore/apps/opie-console/default.h4
-rw-r--r--noncore/apps/opie-console/emulation_layer.h2
-rw-r--r--noncore/apps/opie-console/keytrans.cpp3
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp48
-rw-r--r--noncore/apps/opie-console/mainwindow.h4
-rw-r--r--noncore/apps/opie-console/metafactory.cpp25
-rw-r--r--noncore/apps/opie-console/metafactory.h21
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp42
-rw-r--r--noncore/apps/opie-console/profilemanager.h2
-rw-r--r--noncore/apps/opie-console/session.cpp49
-rw-r--r--noncore/apps/opie-console/session.h38
-rw-r--r--noncore/apps/opie-console/tabwidget.cpp21
-rw-r--r--noncore/apps/opie-console/tabwidget.h5
-rw-r--r--noncore/apps/opie-console/vt102emulation.cpp2
-rw-r--r--noncore/apps/opie-console/vt102emulation.h2
17 files changed, 247 insertions, 40 deletions
diff --git a/noncore/apps/opie-console/PLANS b/noncore/apps/opie-console/PLANS
index 8f6b807..0ec45cb 100644
--- a/noncore/apps/opie-console/PLANS
+++ b/noncore/apps/opie-console/PLANS
@@ -1,5 +1,7 @@
can we please get a working serial connection for now? if that works
i can test file transfers and stuff. -hash
+sure. I finished the ConfigDialog and now doing the Profile->Session
+stuff. Then you just need to click Open -zecke
From a UNIX point of view we want to do something like minicom
with a better GUI.
@@ -18,17 +20,19 @@ the future
Framework
Serial IOLayer
Saving and Restoring Profiles
+ConfigDialog Framework
+FilesendingLayer - hash
TASKS in progress:
Profile->Session and MainWidget --- Harlekin
-FilesendingLayer - hash
IOLayer - wazlaf
-Configuration - josef
TE - ibotty
-
-OPEN tasks:
Session->Profile - hash
Scripting - wazlaf
+
+OPEN tasks:
+Irda ConfigWidget
+BT ConfigWidget
Keys - open
IRDA-Layer - open
Bluetooth-Layer - open
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp
index d9a0557..da6f3e2 100644
--- a/noncore/apps/opie-console/default.cpp
+++ b/noncore/apps/opie-console/default.cpp
@@ -2,6 +2,7 @@
#include "sz_transfer.h"
#include "serialconfigwidget.h"
#include "terminalwidget.h"
+#include "vt102emulation.h"
#include "default.h"
@@ -44,6 +45,11 @@ extern "C" {
return new TerminalWidget(na, wid,0 );
}
+ // VT Emulations
+ EmulationLayer* newVT102( Widget* wid ) {
+ return new Vt102Emulation( wid );
+ }
+
};
Default::Default( MetaFactory* fact ) {
@@ -61,6 +67,7 @@ Default::Default( MetaFactory* fact ) {
fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget );
+ fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 );
}
Default::~Default() {
diff --git a/noncore/apps/opie-console/default.h b/noncore/apps/opie-console/default.h
index ed78986..b9af898 100644
--- a/noncore/apps/opie-console/default.h
+++ b/noncore/apps/opie-console/default.h
@@ -3,6 +3,8 @@
#include "metafactory.h"
+class Widget;
+
extern "C" {
FileTransferLayer* newSZTransfer(IOLayer*);
FileTransferLayer* newSYTransfer(IOLayer*);
@@ -17,6 +19,8 @@ extern "C" {
ProfileDialogWidget* newBTWidget (const QString&, QWidget* );
ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* );
+
+ EmulationLayer* newVT102( Widget* );
};
class MetaFactory;
diff --git a/noncore/apps/opie-console/emulation_layer.h b/noncore/apps/opie-console/emulation_layer.h
index 0f54331..5781acc 100644
--- a/noncore/apps/opie-console/emulation_layer.h
+++ b/noncore/apps/opie-console/emulation_layer.h
@@ -26,7 +26,7 @@
#ifndef EMULATION_LAYER_H
#define EMULATION_LAYER_H
-#include "widget.h"
+#include "widget_layer.h"
#include "screen.h"
#include <qtimer.h>
#include <stdio.h>
diff --git a/noncore/apps/opie-console/keytrans.cpp b/noncore/apps/opie-console/keytrans.cpp
index d569ae0..5ea192e 100644
--- a/noncore/apps/opie-console/keytrans.cpp
+++ b/noncore/apps/opie-console/keytrans.cpp
@@ -627,18 +627,21 @@ static QDict<KeyTrans> * path2keymap = 0L;
KeyTrans* KeyTrans::find(int numb)
{
+ loadAll();
KeyTrans* res = numb2keymap->find(numb);
return res ? res : numb2keymap->find(0);
}
KeyTrans* KeyTrans::find(const char* path)
{
+ loadAll();
KeyTrans* res = path2keymap->find(path);
return res ? res : numb2keymap->find(0);
}
int KeyTrans::count()
{
+ loadAll();
return numb2keymap->count();
}
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 3531478..aeb3742 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -5,9 +5,11 @@
#include <qpopupmenu.h>
#include <qtoolbar.h>
+#include "profileeditordialog.h"
#include "configdialog.h"
#include "default.h"
#include "metafactory.h"
+#include "profile.h"
#include "profilemanager.h"
#include "mainwindow.h"
#include "tabwidget.h"
@@ -109,7 +111,9 @@ void MainWindow::initUI() {
ProfileManager* MainWindow::manager() {
return m_manager;
}
-
+TabWidget* MainWindow::tabWidget() {
+ return m_consoleWindow;
+}
void MainWindow::populateProfiles() {
m_sessionsPop->clear();
Profile::ValueList list = manager()->all();
@@ -137,6 +141,12 @@ QList<Session> MainWindow::sessions() {
void MainWindow::slotNew() {
qWarning("New Connection");
+ ProfileEditorDialog dlg(factory() );
+ int ret = dlg.exec();
+
+ if ( ret == QDialog::Accepted ) {
+ create( dlg.profile() );
+ }
}
void MainWindow::slotConnect() {
@@ -152,8 +162,8 @@ void MainWindow::slotDisconnect() {
void MainWindow::slotTerminate() {
if ( currentSession() )
currentSession()->layer()->close();
- delete m_curSession;
- m_curSession = 0l;
+
+ slotClose();
/* FIXME move to the next session */
}
@@ -170,11 +180,37 @@ void MainWindow::slotConfigure() {
populateProfiles();
}
}
-
+/*
+ * we will remove
+ * this window from the tabwidget
+ * remove it from the list
+ * delete it
+ * and set the currentSession()
+ */
void MainWindow::slotClose() {
-}
+ if (!currentSession() )
+ return;
-void MainWindow::slotProfile( int ) {
+ tabWidget()->remove( currentSession() );
+ tabWidget()->setCurrent( m_sessions.first() );
+ m_sessions.remove( m_curSession );
+ delete m_curSession;
+ m_curSession = m_sessions.first();
+}
+/*
+ * We will get the name
+ * Then the profile
+ * and then we will make a profile
+ */
+void MainWindow::slotProfile( int id) {
+ Profile prof = manager()->profile( m_sessionsPop->text( id) );
+ create( prof );
+}
+void MainWindow::create( const Profile& prof ) {
+ Session *ses = manager()->fromProfile( prof, tabWidget() );
+ m_sessions.append( ses );
+ tabWidget()->add( ses );
+ m_curSession = ses;
}
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index 36eb3a7..7ef9c26 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -17,7 +17,7 @@ class QAction;
class MetaFactory;
class TabWidget;
class ProfileManager;
-
+class Profile;
class MainWindow : public QMainWindow {
Q_OBJECT
public:
@@ -45,6 +45,7 @@ public:
*
*/
ProfileManager* manager();
+ TabWidget* tabWidget();
private slots:
void slotNew();
@@ -58,6 +59,7 @@ private slots:
private:
void initUI();
void populateProfiles();
+ void create( const Profile& );
/**
* the current session
*/
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp
index 4501ec2..02a9f9b 100644
--- a/noncore/apps/opie-console/metafactory.cpp
+++ b/noncore/apps/opie-console/metafactory.cpp
@@ -30,6 +30,12 @@ void MetaFactory::addFileTransferLayer( const QCString& name,
m_strings.insert(str, name );
m_fileFact.insert( str, lay );
}
+void MetaFactory::addEmulationLayer( const QCString& name,
+ const QString& str,
+ emulationLayer em) {
+ m_strings.insert(str, name );
+ m_emu.insert( str, em );
+}
QStringList MetaFactory::ioLayers()const {
QStringList list;
QMap<QString, iolayer>::ConstIterator it;
@@ -62,6 +68,14 @@ QStringList MetaFactory::fileTransferLayers()const {
}
return list;
}
+QStringList MetaFactory::emulationLayers()const {
+ QStringList list;
+ QMap<QString, emulationLayer>::ConstIterator it;
+ for ( it = m_emu.begin(); it != m_emu.end(); ++it ) {
+ list << it.key();
+ }
+ return list;
+}
IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) {
IOLayer* lay = 0l;
@@ -101,6 +115,17 @@ ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget
}
return wid;
}
+EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, Widget* wid) {
+ EmulationLayer* lay = 0l;
+
+ QMap<QString, emulationLayer>::Iterator it;
+ it = m_emu.find( str );
+ if ( it != m_emu.end() ) {
+ lay = (*(it.data() ) )(wid);
+ }
+
+ return lay;
+}
QCString MetaFactory::internal( const QString& str )const {
return m_strings[str];
}
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h
index 3f7ddce..71c35a2 100644
--- a/noncore/apps/opie-console/metafactory.h
+++ b/noncore/apps/opie-console/metafactory.h
@@ -15,12 +15,15 @@
#include "file_layer.h"
#include "profile.h"
#include "profiledialogwidget.h"
+#include "emulation_layer.h"
+class Widget;
class MetaFactory {
public:
typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent);
typedef IOLayer* (*iolayer)(const Profile& );
typedef FileTransferLayer* (*filelayer)(IOLayer*);
+ typedef EmulationLayer* (*emulationLayer)(Widget* );
MetaFactory();
~MetaFactory();
@@ -50,14 +53,31 @@ public:
const QString&,
filelayer );
+ /**
+ * adds a Factory for Emulation to the Layer..
+ */
+ void addEmulationLayer ( const QCString& name,
+ const QString& uiString,
+ emulationLayer );
+
/* translated UI Strings */
QStringList ioLayers()const;
QStringList connectionWidgets()const;
+
+ /**
+ * Terminal Configuration widgets
+ */
QStringList terminalWidgets()const;
QStringList fileTransferLayers()const;
+ QStringList emulationLayers()const;
+
+ /**
+ * the generation...
+ */
IOLayer* newIOLayer( const QString&,const Profile& );
ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* );
ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* );
+ EmulationLayer* newEmulationLayer(const QString&, Widget* );
/*
* internal takes the maybe translated
@@ -79,6 +99,7 @@ private:
QMap<QString, configWidget> m_termFact;
QMap<QString, iolayer> m_layerFact;
QMap<QString, filelayer> m_fileFact;
+ QMap<QString, emulationLayer> m_emu;
};
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index e66ebcc..dcf3cbd 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -2,9 +2,12 @@
#include <stdlib.h>
#include <qfile.h>
+#include <qlayout.h>
+#include <qwidgetstack.h>
#include <qpe/config.h>
+#include "widget.h"
#include "metafactory.h"
#include "profileconfig.h"
#include "profilemanager.h"
@@ -51,17 +54,40 @@ void ProfileManager::clear() {
Profile::ValueList ProfileManager::all()const {
return m_list;
}
-Session* ProfileManager::fromProfile( const Profile& prof) {
+/*
+ * Our goal is to create a Session
+ * We will load the the IOLayer and EmulationLayer
+ * from the factory
+ * we will generate a QWidgetStack
+ * add a dummy widget with layout
+ * add "Widget" to the layout
+ * add the dummy to the stack
+ * raise the dummy
+ * call session->connect(=
+ * this way we only need to reparent
+ * in TabWidget
+ */
+Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) {
Session* session = new Session();
session->setName( prof.name() );
- session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(),
+ /* translate the internal name to the external */
+ session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) ,
prof) );
- /*
- * FIXME
- * load emulation
- * load widget?
- * set colors + fonts
- */
+
+ QWidgetStack *stack = new QWidgetStack(parent);
+ session->setWidgetStack( stack );
+ QWidget* dummy = new QWidget(stack );
+ QHBoxLayout* lay = new QHBoxLayout(dummy );
+ stack->addWidget( dummy, 0 );
+ stack->raiseWidget( 0 );
+ Widget* wid = new Widget(dummy );
+ lay->addWidget( wid );
+
+ session->setEmulationWidget( wid );
+ session->setEmulationLayer( m_fact->newEmulationLayer( m_fact->external( prof.terminalName() ),
+ wid ) );
+ session->connect();
+
return session;
}
void ProfileManager::save( ) {
diff --git a/noncore/apps/opie-console/profilemanager.h b/noncore/apps/opie-console/profilemanager.h
index 1387247..33b7095 100644
--- a/noncore/apps/opie-console/profilemanager.h
+++ b/noncore/apps/opie-console/profilemanager.h
@@ -22,7 +22,7 @@ public:
void add( const Profile& prof );
void remove( const Profile& prof );
Profile profile(const QString& name )const;
- Session* fromProfile( const Profile& );
+ Session* fromProfile( const Profile& , QWidget* parent = 0l);
void setProfiles( const Profile::ValueList& );
void save();
private:
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp
index d32b340..42b0583 100644
--- a/noncore/apps/opie-console/session.cpp
+++ b/noncore/apps/opie-console/session.cpp
@@ -2,37 +2,80 @@
#include "io_layer.h"
#include "file_layer.h"
+#include "widget.h"
+#include "emulation_layer.h"
#include "session.h"
+
Session::Session() {
m_widget = 0l;
m_layer = 0l;
+ m_widLay = 0l;
+ m_emLay = 0l;
}
-Session::Session( const QString& na, QWidget* widget, IOLayer* lay)
+Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay)
: m_name( na ), m_widget( widget ), m_layer( lay )
{
+ m_widLay = 0l;
+ m_emLay = 0l;
}
Session::~Session() {
delete m_layer;
+ delete m_emLay;
delete m_widget;
+ /* the widget layer should be deleted by the m_widget */
}
QString Session::name()const {
return m_name;
}
-QWidget* Session::widget() {
+QWidgetStack* Session::widgetStack() {
return m_widget;
}
IOLayer* Session::layer() {
return m_layer;
}
+EmulationLayer* Session::emulationLayer() {
+ return m_emLay;
+}
+Widget* Session::emulationWidget() {
+ return m_widLay;
+}
+void Session::connect() {
+ if ( !m_layer || !m_emLay )
+ return;
+
+ QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ),
+ m_emLay, SLOT(onRcvBlock(const QByteArray&) ) );
+ QObject::connect(m_emLay, SIGNAL(sndBlock(const QByteArray&) ),
+ m_layer, SLOT(send(const QByteArray&) ) );
+}
+void Session::disconnect() {
+ if ( !m_layer || !m_emLay )
+ return;
+
+ QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ),
+ m_emLay, SLOT(onRcvBlock(const QByteArray&) ) );
+ QObject::disconnect(m_emLay, SIGNAL(sndBlock(const QByteArray&) ),
+ m_layer, SLOT(send(const QByteArray&) ) );
+}
void Session::setName( const QString& na){
m_name = na;
}
-void Session::setWidget( QWidget* wid ) {
+void Session::setWidgetStack( QWidgetStack* wid ) {
delete m_widget;
+ /* the EmulationLayer was destroyed... */
+ delete m_emLay;
m_widget = wid;
}
void Session::setIOLayer( IOLayer* lay ) {
delete m_layer;
m_layer = lay;
}
+void Session::setEmulationLayer( EmulationLayer* lay ) {
+ delete m_emLay;
+ m_emLay = lay;
+}
+void Session::setEmulationWidget( Widget* lay ) {
+ delete m_widLay;
+ m_widLay = lay;
+}
diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h
index 44b5fc8..c3673fc 100644
--- a/noncore/apps/opie-console/session.h
+++ b/noncore/apps/opie-console/session.h
@@ -1,9 +1,11 @@
#ifndef OPIE_SESSION_H
#define OPIE_SESSION_H
-#include <qwidget.h>
+#include <qwidgetstack.h>
class IOLayer;
+class EmulationLayer;
+class Widget;
/**
* This is a Session. A session contains
* a QWidget pointer and a IOLayer
@@ -17,7 +19,7 @@ public:
* ownership get's transfered
*/
Session();
- Session( const QString&, QWidget* widget, IOLayer* );
+ Session( const QString&, QWidgetStack* widget, IOLayer* );
~Session();
/**
@@ -26,22 +28,46 @@ public:
QString name()const;
/**
- * return the widget
+ * return the widgetstack
+ * this is used to be semi modal
+ * for FileTransfer
+ *
+ * semi modal == SessionModal
*/
- QWidget* widget();
+ QWidgetStack* widgetStack();
/**
* return the layer
*/
IOLayer* layer();
- void setWidget( QWidget* widget );
+
+ EmulationLayer* emulationLayer();
+ Widget* emulationWidget();
+
+ /*
+ * 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 setEmulationLayer( EmulationLayer* lay );
+ void setEmulationWidget( Widget* lay );
void setIOLayer( IOLayer* );
void setName( const QString& );
private:
QString m_name;
- QWidget* m_widget;
+ QWidgetStack* m_widget;
IOLayer* m_layer;
+ EmulationLayer* m_emLay;
+ Widget* m_widLay;
};
diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp
index 783bf13..cfaef91 100644
--- a/noncore/apps/opie-console/tabwidget.cpp
+++ b/noncore/apps/opie-console/tabwidget.cpp
@@ -2,7 +2,7 @@
#include "tabwidget.h"
TabWidget::TabWidget( QWidget* parent, const char* name )
- : OTabWidget( parent, name ) {
+ : QTabWidget( parent, name ) {
connect(this, SIGNAL( currentChanged(QWidget*) ),
this, SLOT( slotCurChanged(QWidget*) ) );
}
@@ -11,14 +11,17 @@ TabWidget::~TabWidget() {
}
void TabWidget::add( Session* ses ) {
- if ( !ses->widget() ) return;
- addTab( ses->widget(), "console/konsole", ses->name() );
- m_map.insert( ses->widget(), ses );
+ if ( !ses->widgetStack() ) return;
+ qWarning("going to add it");
+ //reparent( ses->widgetStack(), QPoint() );
+ //addTab( ses->widgetStack(), "console/konsole", ses->name() );
+ addTab( ses->widgetStack(), ses->name() );
+ m_map.insert( ses->widgetStack(), ses );
}
void TabWidget::remove( Session* ses ) {
- m_map.remove( ses->widget() );
- removePage( ses->widget() );
+ m_map.remove( ses->widgetStack() );
+ removePage( ses->widgetStack() );
}
void TabWidget::slotCurChanged( QWidget* wid ) {
@@ -30,5 +33,11 @@ void TabWidget::slotCurChanged( QWidget* wid ) {
emit activated( it.data() );
}
+void TabWidget::setCurrent( Session* ses ) {
+ if (!ses )
+ return;
+
+ showPage( ses->widgetStack() );
+}
diff --git a/noncore/apps/opie-console/tabwidget.h b/noncore/apps/opie-console/tabwidget.h
index a701488..42a00ec 100644
--- a/noncore/apps/opie-console/tabwidget.h
+++ b/noncore/apps/opie-console/tabwidget.h
@@ -2,20 +2,21 @@
#define OPIE_TAB_WIDGET_H
#include <qmap.h>
-#include <opie/otabwidget.h>
+#include <qtabwidget.h>
#include "session.h"
/**
* This is our central tab widget
* we can add sessions here
*/
-class TabWidget : public OTabWidget{
+class TabWidget : public QTabWidget{
Q_OBJECT
public:
TabWidget(QWidget *parent, const char* name );
~TabWidget();
void add( Session* );
void remove( Session* );
+ void setCurrent( Session* );
signals:
void activated(Session* ses );
diff --git a/noncore/apps/opie-console/vt102emulation.cpp b/noncore/apps/opie-console/vt102emulation.cpp
index dc977f5..2220f4e 100644
--- a/noncore/apps/opie-console/vt102emulation.cpp
+++ b/noncore/apps/opie-console/vt102emulation.cpp
@@ -622,7 +622,7 @@ void Vt102Emulation::sendString(const char* s)
emit sndBlock( tmp);
}
-void Vt102Emulation::sendString(const QByteArray s)
+void Vt102Emulation::sendString(const QByteArray& s)
{
emit sndBlock( s );
}
diff --git a/noncore/apps/opie-console/vt102emulation.h b/noncore/apps/opie-console/vt102emulation.h
index 018835e..a3d0ae6 100644
--- a/noncore/apps/opie-console/vt102emulation.h
+++ b/noncore/apps/opie-console/vt102emulation.h
@@ -86,7 +86,7 @@ public:
/**
* sends a list of bytes to the IOLayer
*/
- void sendString(const QByteArray);
+ void sendString(const QByteArray&);
/**
* @deprecated use QByteArray instead