Diffstat (limited to 'noncore/apps/opie-console/profilemanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/profilemanager.cpp | 44 |
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 | |||
@@ -1,11 +1,14 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | 3 | ||
4 | #include <qfile.h> | 4 | #include <qfile.h> |
5 | #include <qlayout.h> | ||
6 | #include <qwidgetstack.h> | ||
5 | 7 | ||
6 | #include <qpe/config.h> | 8 | #include <qpe/config.h> |
7 | 9 | ||
10 | #include "widget.h" | ||
8 | #include "metafactory.h" | 11 | #include "metafactory.h" |
9 | #include "profileconfig.h" | 12 | #include "profileconfig.h" |
10 | #include "profilemanager.h" | 13 | #include "profilemanager.h" |
11 | 14 | ||
@@ -50,19 +53,42 @@ void ProfileManager::clear() { | |||
50 | } | 53 | } |
51 | Profile::ValueList ProfileManager::all()const { | 54 | Profile::ValueList ProfileManager::all()const { |
52 | return m_list; | 55 | return m_list; |
53 | } | 56 | } |
54 | Session* ProfileManager::fromProfile( const Profile& prof) { | 57 | /* |
58 | * Our goal is to create a Session | ||
59 | * We will load the the IOLayer and EmulationLayer | ||
60 | * from the factory | ||
61 | * we will generate a QWidgetStack | ||
62 | * add a dummy widget with layout | ||
63 | * add "Widget" to the layout | ||
64 | * add the dummy to the stack | ||
65 | * raise the dummy | ||
66 | * call session->connect(= | ||
67 | * this way we only need to reparent | ||
68 | * in TabWidget | ||
69 | */ | ||
70 | Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) { | ||
55 | Session* session = new Session(); | 71 | Session* session = new Session(); |
56 | session->setName( prof.name() ); | 72 | session->setName( prof.name() ); |
57 | session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(), | 73 | /* translate the internal name to the external */ |
58 | prof) ); | 74 | session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) , |
59 | /* | 75 | prof) ); |
60 | * FIXME | 76 | |
61 | * load emulation | 77 | QWidgetStack *stack = new QWidgetStack(parent); |
62 | * load widget? | 78 | session->setWidgetStack( stack ); |
63 | * set colors + fonts | 79 | QWidget* dummy = new QWidget(stack ); |
64 | */ | 80 | QHBoxLayout* lay = new QHBoxLayout(dummy ); |
81 | stack->addWidget( dummy, 0 ); | ||
82 | stack->raiseWidget( 0 ); | ||
83 | Widget* wid = new Widget(dummy ); | ||
84 | lay->addWidget( wid ); | ||
85 | |||
86 | session->setEmulationWidget( wid ); | ||
87 | session->setEmulationLayer( m_fact->newEmulationLayer( m_fact->external( prof.terminalName() ), | ||
88 | wid ) ); | ||
89 | session->connect(); | ||
90 | |||
65 | return session; | 91 | return session; |
66 | } | 92 | } |
67 | void ProfileManager::save( ) { | 93 | void ProfileManager::save( ) { |
68 | QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) ); | 94 | QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) ); |