author | zecke <zecke> | 2002-10-09 01:22:42 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-09 01:22:42 (UTC) |
commit | a74bf68065b94efaacb73736c7127ccb74474645 (patch) (unidiff) | |
tree | d85c40d367a4922091cc1780d8e1228d38de22c8 /noncore/apps/opie-console/profilemanager.cpp | |
parent | 8c353ec8b86ee8f82cc25172fb69dd5fee65e848 (diff) | |
download | opie-a74bf68065b94efaacb73736c7127ccb74474645.zip opie-a74bf68065b94efaacb73736c7127ccb74474645.tar.gz opie-a74bf68065b94efaacb73736c7127ccb74474645.tar.bz2 |
PLANS:
move around some stuff to done, open to progress...
Default
add EmulationLayer stuff (vt102)
EmulationLayer tried to use WidgetLayer but this did not work out
KeyTrans make sure to load the Q*Dict first before accessing it!
ibotty please check if this was correct
MainWindow
make generation of Sessions possible
TabWidget
go back to QTabWidget for now... this is much more testedt and I
do not have to debug it. Besides that OTabWidget is a kewl widget
and we will take it as soon as Sessions are tested enough
TabWidget also implement setCurrent for sessions
Vt102 make it compile... const QByteArray != const QByteArray&
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,19 +1,22 @@ | |||
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 | ||
12 | ProfileManager::ProfileManager( MetaFactory* fact ) | 15 | ProfileManager::ProfileManager( MetaFactory* fact ) |
13 | : m_fact( fact ) | 16 | : m_fact( fact ) |
14 | { | 17 | { |
15 | 18 | ||
16 | } | 19 | } |
17 | ProfileManager::~ProfileManager() { | 20 | ProfileManager::~ProfileManager() { |
18 | 21 | ||
19 | } | 22 | } |
@@ -42,35 +45,58 @@ void ProfileManager::load() { | |||
42 | 45 | ||
43 | /* now add it */ | 46 | /* now add it */ |
44 | m_list.append( prof ); | 47 | m_list.append( prof ); |
45 | } | 48 | } |
46 | 49 | ||
47 | } | 50 | } |
48 | void ProfileManager::clear() { | 51 | void ProfileManager::clear() { |
49 | m_list.clear(); | 52 | m_list.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" ) ); |
69 | ProfileConfig conf("opie-console-profiles"); | 95 | ProfileConfig conf("opie-console-profiles"); |
70 | Profile::ValueList::Iterator it; | 96 | Profile::ValueList::Iterator it; |
71 | for (it = m_list.begin(); it != m_list.end(); ++it ) { | 97 | for (it = m_list.begin(); it != m_list.end(); ++it ) { |
72 | conf.setGroup( (*it).name() ); | 98 | conf.setGroup( (*it).name() ); |
73 | conf.writeEntry( "name", (*it).name() ); | 99 | conf.writeEntry( "name", (*it).name() ); |
74 | conf.writeEntry( "iolayer", QString::fromUtf8( (*it).ioLayerName() ) ); | 100 | conf.writeEntry( "iolayer", QString::fromUtf8( (*it).ioLayerName() ) ); |
75 | conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) ); | 101 | conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) ); |
76 | conf.writeEntry( "back", (*it).background() ); | 102 | conf.writeEntry( "back", (*it).background() ); |