summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/profilemanager.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/profilemanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp44
1 files changed, 35 insertions, 9 deletions
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;