summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore 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.cpp44
-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, 248 insertions, 41 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
@@ -2,2 +2,4 @@ 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
@@ -20,2 +22,4 @@ Serial IOLayer
Saving and Restoring Profiles
+ConfigDialog Framework
+FilesendingLayer - hash
@@ -23,10 +27,10 @@ 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
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
@@ -4,2 +4,3 @@
#include "terminalwidget.h"
+#include "vt102emulation.h"
@@ -46,2 +47,7 @@ extern "C" {
+ // VT Emulations
+ EmulationLayer* newVT102( Widget* wid ) {
+ return new Vt102Emulation( wid );
+ }
+
};
@@ -63,2 +69,3 @@ Default::Default( MetaFactory* fact ) {
+ fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 );
}
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
@@ -5,2 +5,4 @@
+class Widget;
+
extern "C" {
@@ -19,2 +21,4 @@ extern "C" {
ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* );
+
+ EmulationLayer* newVT102( Widget* );
};
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
@@ -28,3 +28,3 @@
-#include "widget.h"
+#include "widget_layer.h"
#include "screen.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
@@ -629,2 +629,3 @@ KeyTrans* KeyTrans::find(int numb)
{
+ loadAll();
KeyTrans* res = numb2keymap->find(numb);
@@ -635,2 +636,3 @@ KeyTrans* KeyTrans::find(const char* path)
{
+ loadAll();
KeyTrans* res = path2keymap->find(path);
@@ -641,2 +643,3 @@ 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
@@ -7,2 +7,3 @@
+#include "profileeditordialog.h"
#include "configdialog.h"
@@ -10,2 +11,3 @@
#include "metafactory.h"
+#include "profile.h"
#include "profilemanager.h"
@@ -111,3 +113,5 @@ ProfileManager* MainWindow::manager() {
}
-
+TabWidget* MainWindow::tabWidget() {
+ return m_consoleWindow;
+}
void MainWindow::populateProfiles() {
@@ -139,2 +143,8 @@ void MainWindow::slotNew() {
qWarning("New Connection");
+ ProfileEditorDialog dlg(factory() );
+ int ret = dlg.exec();
+
+ if ( ret == QDialog::Accepted ) {
+ create( dlg.profile() );
+ }
}
@@ -154,4 +164,4 @@ void MainWindow::slotTerminate() {
currentSession()->layer()->close();
- delete m_curSession;
- m_curSession = 0l;
+
+ slotClose();
/* FIXME move to the next session */
@@ -172,9 +182,35 @@ void MainWindow::slotConfigure() {
}
-
+/*
+ * 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
@@ -19,3 +19,3 @@ class TabWidget;
class ProfileManager;
-
+class Profile;
class MainWindow : public QMainWindow {
@@ -47,2 +47,3 @@ public:
ProfileManager* manager();
+ TabWidget* tabWidget();
@@ -60,2 +61,3 @@ private:
void populateProfiles();
+ void create( const Profile& );
/**
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
@@ -32,2 +32,8 @@ void MetaFactory::addFileTransferLayer( const QCString& name,
}
+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 {
@@ -64,2 +70,10 @@ QStringList MetaFactory::fileTransferLayers()const {
}
+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;
+}
@@ -103,2 +117,13 @@ ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget
}
+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 {
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
@@ -17,3 +17,5 @@
#include "profiledialogwidget.h"
+#include "emulation_layer.h"
+class Widget;
class MetaFactory {
@@ -23,2 +25,3 @@ public:
typedef FileTransferLayer* (*filelayer)(IOLayer*);
+ typedef EmulationLayer* (*emulationLayer)(Widget* );
@@ -52,2 +55,9 @@ public:
+ /**
+ * adds a Factory for Emulation to the Layer..
+ */
+ void addEmulationLayer ( const QCString& name,
+ const QString& uiString,
+ emulationLayer );
+
/* translated UI Strings */
@@ -55,4 +65,13 @@ public:
QStringList connectionWidgets()const;
+
+ /**
+ * Terminal Configuration widgets
+ */
QStringList terminalWidgets()const;
QStringList fileTransferLayers()const;
+ QStringList emulationLayers()const;
+
+ /**
+ * the generation...
+ */
IOLayer* newIOLayer( const QString&,const Profile& );
@@ -60,2 +79,3 @@ public:
ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* );
+ EmulationLayer* newEmulationLayer(const QString&, Widget* );
@@ -81,2 +101,3 @@ private:
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
@@ -4,2 +4,4 @@
#include <qfile.h>
+#include <qlayout.h>
+#include <qwidgetstack.h>
@@ -7,2 +9,3 @@
+#include "widget.h"
#include "metafactory.h"
@@ -53,13 +56,36 @@ Profile::ValueList ProfileManager::all()const {
}
-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(),
- prof) );
- /*
- * FIXME
- * load emulation
- * load widget?
- * set colors + fonts
- */
+ /* translate the internal name to the external */
+ session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) ,
+ prof) );
+
+ 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;
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
@@ -24,3 +24,3 @@ public:
Profile profile(const QString& name )const;
- Session* fromProfile( const Profile& );
+ Session* fromProfile( const Profile& , QWidget* parent = 0l);
void setProfiles( const Profile::ValueList& );
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
@@ -4,4 +4,7 @@
#include "file_layer.h"
+#include "widget.h"
+#include "emulation_layer.h"
#include "session.h"
+
Session::Session() {
@@ -9,6 +12,10 @@ Session::Session() {
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;
}
@@ -16,3 +23,5 @@ Session::~Session() {
delete m_layer;
+ delete m_emLay;
delete m_widget;
+ /* the widget layer should be deleted by the m_widget */
}
@@ -21,3 +30,3 @@ QString Session::name()const {
}
-QWidget* Session::widget() {
+QWidgetStack* Session::widgetStack() {
return m_widget;
@@ -27,2 +36,26 @@ IOLayer* Session::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){
@@ -30,4 +63,6 @@ void Session::setName( const QString& na){
}
-void Session::setWidget( QWidget* wid ) {
+void Session::setWidgetStack( QWidgetStack* wid ) {
delete m_widget;
+ /* the EmulationLayer was destroyed... */
+ delete m_emLay;
m_widget = wid;
@@ -38 +73,9 @@ void Session::setIOLayer( IOLayer* 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
@@ -3,5 +3,7 @@
-#include <qwidget.h>
+#include <qwidgetstack.h>
class IOLayer;
+class EmulationLayer;
+class Widget;
/**
@@ -19,3 +21,3 @@ public:
Session();
- Session( const QString&, QWidget* widget, IOLayer* );
+ Session( const QString&, QWidgetStack* widget, IOLayer* );
~Session();
@@ -28,5 +30,9 @@ public:
/**
- * return the widget
+ * return the widgetstack
+ * this is used to be semi modal
+ * for FileTransfer
+ *
+ * semi modal == SessionModal
*/
- QWidget* widget();
+ QWidgetStack* widgetStack();
@@ -36,3 +42,21 @@ public:
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* );
@@ -42,4 +66,6 @@ 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
@@ -4,3 +4,3 @@
TabWidget::TabWidget( QWidget* parent, const char* name )
- : OTabWidget( parent, name ) {
+ : QTabWidget( parent, name ) {
connect(this, SIGNAL( currentChanged(QWidget*) ),
@@ -13,5 +13,8 @@ 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 );
}
@@ -19,4 +22,4 @@ void TabWidget::add( Session* ses ) {
void TabWidget::remove( Session* ses ) {
- m_map.remove( ses->widget() );
- removePage( ses->widget() );
+ m_map.remove( ses->widgetStack() );
+ removePage( ses->widgetStack() );
}
@@ -32,2 +35,8 @@ void TabWidget::slotCurChanged( QWidget* wid ) {
}
+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
@@ -4,3 +4,3 @@
#include <qmap.h>
-#include <opie/otabwidget.h>
+#include <qtabwidget.h>
@@ -11,3 +11,3 @@
*/
-class TabWidget : public OTabWidget{
+class TabWidget : public QTabWidget{
Q_OBJECT
@@ -18,2 +18,3 @@ public:
void remove( Session* );
+ void setCurrent( Session* );
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
@@ -624,3 +624,3 @@ void Vt102Emulation::sendString(const char* s)
-void Vt102Emulation::sendString(const QByteArray s)
+void Vt102Emulation::sendString(const QByteArray& 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
@@ -88,3 +88,3 @@ public:
*/
- void sendString(const QByteArray);
+ void sendString(const QByteArray&);