author | ibotty <ibotty> | 2002-10-11 17:43:18 (UTC) |
---|---|---|
committer | ibotty <ibotty> | 2002-10-11 17:43:18 (UTC) |
commit | 01f26248efccbd764e7c82b74372f33a4bbae303 (patch) (side-by-side diff) | |
tree | a13712dabfa9aaeb7d9ad9353e434b8976234836 | |
parent | 00005567e4841af1f0efe090160881b286574493 (diff) | |
download | opie-01f26248efccbd764e7c82b74372f33a4bbae303.zip opie-01f26248efccbd764e7c82b74372f33a4bbae303.tar.gz opie-01f26248efccbd764e7c82b74372f33a4bbae303.tar.bz2 |
changed references to widget into references to widgetLayer or EmulationWidget.
-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/profilemanager.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.h | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/widget.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/widget_layer.h | 3 |
7 files changed, 23 insertions, 19 deletions
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index 02a9f9b..2b672cf 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp @@ -94,46 +94,46 @@ IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { ProfileDialogWidget *MetaFactory::newConnectionPlugin ( const QString& str, QWidget *parent) { ProfileDialogWidget* wid = 0l; QMap<QString, configWidget>::Iterator it; it = m_conFact.find( str ); if ( it != m_conFact.end() ) { wid = (*(it.data() ) )(str,parent); } return wid; } ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget *parent) { if (str.isEmpty() ) return 0l; ProfileDialogWidget* wid = 0l; qWarning("new terminalPlugin %s %l", str.latin1(), parent ); QMap<QString, configWidget>::Iterator it; it = m_termFact.find( str ); if ( it != m_termFact.end() ) { wid = (*(it.data() ) )(str,parent); } return wid; } -EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, Widget* wid) { +EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* 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]; } QString MetaFactory::external( const QCString& str )const { QMap<QString, QCString>::ConstIterator it; for ( it = m_strings.begin(); it != m_strings.end(); ++it ) { if ( it.data() == str ) return it.key(); } return QString::null; } diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h index 71c35a2..d05ece4 100644 --- a/noncore/apps/opie-console/metafactory.h +++ b/noncore/apps/opie-console/metafactory.h @@ -1,50 +1,50 @@ #ifndef OPIE_META_FACTORY_H #define OPIE_META_FACTORY_H /** * The MetaFactory is used to keep track of all IOLayers, FileTransferLayers and ConfigWidgets * and to instantiate these implementations on demand */ #include <qwidget.h> #include <qmap.h> #include <qpe/config.h> #include "io_layer.h" #include "file_layer.h" #include "profile.h" #include "profiledialogwidget.h" #include "emulation_layer.h" -class Widget; +class WidgetLayer; class MetaFactory { public: typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent); typedef IOLayer* (*iolayer)(const Profile& ); typedef FileTransferLayer* (*filelayer)(IOLayer*); - typedef EmulationLayer* (*emulationLayer)(Widget* ); + typedef EmulationLayer* (*emulationLayer)(WidgetLayer* ); MetaFactory(); ~MetaFactory(); /** * add a ProfileDialogWidget to the factory * name is the name shown to the user */ void addConnectionWidgetFactory( const QCString& internalName, const QString& uiString, configWidget ); void addTerminalWidgetFactory ( const QCString& internalName, const QString& name, configWidget ); /** * adds an IOLayer factory */ void addIOLayerFactory( const QCString&, const QString&, iolayer ); /** * adds a FileTransfer Layer @@ -56,49 +56,49 @@ public: /** * 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* ); + EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* ); /* * internal takes the maybe translated * public QString and maps it to the internal * not translatable QCString */ QCString internal( const QString& )const; /* * external takes the internal name * it returns a translated name */ QString external( const QCString& )const; private: QMap<QString, QCString> m_strings; QMap<QString, configWidget> m_conFact; 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 dcf3cbd..78751e7 100644 --- a/noncore/apps/opie-console/profilemanager.cpp +++ b/noncore/apps/opie-console/profilemanager.cpp @@ -1,34 +1,35 @@ #include <stdio.h> #include <stdlib.h> #include <qfile.h> #include <qlayout.h> #include <qwidgetstack.h> #include <qpe/config.h> -#include "widget.h" +#include "widget_layer.h" +#include "emulation_widget.h" #include "metafactory.h" #include "profileconfig.h" #include "profilemanager.h" ProfileManager::ProfileManager( MetaFactory* fact ) : m_fact( fact ) { } ProfileManager::~ProfileManager() { } void ProfileManager::load() { m_list.clear(); qWarning("load"); ProfileConfig conf("opie-console-profiles"); QStringList groups = conf.groups(); QStringList::Iterator it; /* * for each profile */ for ( it = groups.begin(); it != groups.end(); ++it ) { qWarning("group " + (*it) ); @@ -59,49 +60,49 @@ Profile::ValueList ProfileManager::all()const { * 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() ); /* 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 ); + WidgetLayer* wid = new EmulationWidget( prof, 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( ) { QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) ); ProfileConfig conf("opie-console-profiles"); Profile::ValueList::Iterator it; for (it = m_list.begin(); it != m_list.end(); ++it ) { conf.setGroup( (*it).name() ); conf.writeEntry( "name", (*it).name() ); conf.writeEntry( "iolayer", QString::fromUtf8( (*it).ioLayerName() ) ); conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) ); conf.writeEntry( "back", (*it).background() ); conf.writeEntry( "fore", (*it).foreground() ); conf.writeEntry( "terminal", (*it).terminal() ); /* now the config stuff */ QMap<QString, QString> map = (*it).conf(); QMap<QString, QString>::Iterator it; diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp index 42b0583..ff2c3e2 100644 --- a/noncore/apps/opie-console/session.cpp +++ b/noncore/apps/opie-console/session.cpp @@ -1,81 +1,81 @@ #include "io_layer.h" #include "file_layer.h" -#include "widget.h" +#include "widget_layer.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, 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; } QWidgetStack* Session::widgetStack() { return m_widget; } IOLayer* Session::layer() { return m_layer; } EmulationLayer* Session::emulationLayer() { return m_emLay; } -Widget* Session::emulationWidget() { +WidgetLayer* 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::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 ) { +void Session::setEmulationWidget( WidgetLayer* lay ) { delete m_widLay; m_widLay = lay; } diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h index c3673fc..64c2cdb 100644 --- a/noncore/apps/opie-console/session.h +++ b/noncore/apps/opie-console/session.h @@ -1,74 +1,74 @@ #ifndef OPIE_SESSION_H #define OPIE_SESSION_H #include <qwidgetstack.h> class IOLayer; class EmulationLayer; -class Widget; +class WidgetLayer; /** * This is a Session. A session contains * a QWidget pointer and a IOLayer * Imagine a session like a collection of what * is needed to show your widget in a tab ;) */ class Session { public: /** * c'tor with widget and layer * ownership get's transfered */ Session(); Session( const QString&, QWidgetStack* widget, IOLayer* ); ~Session(); /** * return the name of the session */ QString name()const; /** * return the widgetstack * this is used to be semi modal * for FileTransfer * * semi modal == SessionModal */ QWidgetStack* widgetStack(); /** * return the layer */ IOLayer* layer(); EmulationLayer* emulationLayer(); - Widget* emulationWidget(); + WidgetLayer* 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 setEmulationWidget( WidgetLayer* lay ); void setIOLayer( IOLayer* ); void setName( const QString& ); private: QString m_name; QWidgetStack* m_widget; IOLayer* m_layer; EmulationLayer* m_emLay; - Widget* m_widLay; + WidgetLayer* m_widLay; }; #endif diff --git a/noncore/apps/opie-console/widget.cpp b/noncore/apps/opie-console/widget.cpp index b8f2906..d948179 100644 --- a/noncore/apps/opie-console/widget.cpp +++ b/noncore/apps/opie-console/widget.cpp @@ -1,47 +1,48 @@ /* ------------------------------------------------------------------------ */ /* */ /* [TEWidget.C] Terminal Emulation Widget */ /* */ /* ------------------------------------------------------------------------ */ /* */ /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ /* */ /* This file is part of Konsole - an X terminal for KDE */ /* */ /* ------------------------------------------------------------------------ */ /* */ /* Ported Konsole to Qt/Embedded */ /* */ /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ /* */ /* -------------------------------------------------------------------------- */ /* ibot: i changed "currentSession->getEmulation()->sendString()" to "currentSession->layer()->send()" # this is not right! EmulationLayer should send it... + i changed all those to use emulationLayer()->send() instead i had to create a QByteArray before... TODO: alter Widget to use only QByteArray, where applicable. */ /*! \class Widget \brief Visible screen contents This class is responsible to map the `image' of a terminal emulation to the display. All the dependency of the emulation to a specific GUI or toolkit is localized here. Further, this widget has no knowledge about being part of an emulation, it simply work within the terminal emulation framework by exposing size and key events and by being ordered to show a new image. <ul> <li> The internal image has the size of the widget (evtl. rounded up) <li> The external image used in setImage can have any size. <li> (internally) the external image is simply copied to the internal when a setImage happens. During a resizeEvent no painting is done a paintEvent is expected to follow anyway. @@ -1209,83 +1210,84 @@ void Widget::dropEvent(QDropEvent* event) } /* KURL url(p); if (url.isLocalFile()) { dropText += url.path(); // local URL : remove protocol } else { dropText += url.prettyURL(); bPopup = false; // a non-local file, don't popup } */ } if (bPopup) // m_drop->popup(pos() + event->pos()); m_drop->popup(mapToGlobal(event->pos())); else { if (currentSession) { //currentSession->getEmulation()->sendString(dropText.local8Bit()); QByteArray tmp; // ibot: this should be pretty wrong... - currentSession->layer()->send( tmp.setRawData( dropText.local8Bit())); + // now it sends to the right layer + currentSession-> emulationLayer()->send( tmp.setRawData( dropText.local8Bit())); } // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; } } } else if(QTextDrag::decode(event, dropText)) { // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; if (currentSession) { //currentSession->getEmulation()->sendString(dropText.local8Bit()); QByteArray tmp; - currentSession->layer()->send( tmp.setRawData( dropText.local8Bit())); + currentSession->emulationLayer()->send( tmp.setRawData( dropText.local8Bit())); } // Paste it } } #endif void Widget::drop_menu_activated(int item) { #ifndef QT_NO_DRAGANDDROP QByteArray tmp; switch (item) { case 0: // paste //currentSession->getEmulation()->sendString(dropText.local8Bit()); - currentSession->layer()->send( tmp.setRawData( dropText.local8Bit())); + currentSession->emulationLayer()->send( tmp.setRawData( dropText.local8Bit())); // KWM::activate((Window)this->winId()); break; case 1: // cd ... //currentSession->getEmulation()->sendString("cd "); tmp.setRawData( "cd " ); - currentSession->layer()->send( tmp ); + currentSession->emulationLayer()->send( tmp ); struct stat statbuf; if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 ) { if ( !S_ISDIR(statbuf.st_mode) ) { /* KURL url; url.setPath( dropText ); dropText = url.directory( true, false ); // remove filename */ } } dropText.replace(QRegExp(" "), "\\ "); // escape spaces QByteArray tmp2; tmp.setRawDate( dropText.local8Bit() + "\n" ); //currentSession->getEmulation()->sendString(dropText.local8Bit()); //currentSession->getEmulation()->sendString("\n"); - currentSession->layer()->send( tmp ); + currentSession->emulationLayer()->send( tmp ); // KWM::activate((Window)this->winId()); break; } #endif } diff --git a/noncore/apps/opie-console/widget_layer.h b/noncore/apps/opie-console/widget_layer.h index 5bd2ef9..01a4614 100644 --- a/noncore/apps/opie-console/widget_layer.h +++ b/noncore/apps/opie-console/widget_layer.h @@ -81,50 +81,51 @@ public: * insert current selection (currently this is only the clipboard) */ void insertSelection(); /** * insert text * @param QString text, the text to be inserted */ void insertText( QString text ); /** * set selection (clipboard) to text * @param const QString &text, the text to be selected */ void setSelection( const QString &text ); /** * paste content of clipboard */ void pasteClipboard(); /** * reload configuration + * @param const Profile& config, the config to be used (may be the same as in constructor) */ - virtual void reloadConfig() = 0; + virtual void reloadConfig( const Profile& config ) = 0; /** * sets the scrollbar (if implemented by successor of this class) */ virtual void setScroll( int cursor, int slines ); /** * scrolls (if implemented, by successor of this class) * @param int value, how much the widget should scroll up (positive value) or down (negative value) */ virtual void scroll( int value ); signals: /** * key was pressed */ void keyPressed( QKeyEvent *e ); /** * whenever Mouse selects something * @param int button, the button that us pressed : * 0 left Button |