summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp13
-rw-r--r--noncore/apps/opie-console/opie-console.pro8
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp20
-rw-r--r--noncore/apps/opie-console/profileeditordialog.h28
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp15
-rw-r--r--noncore/apps/opie-console/profilemanager.h2
-rw-r--r--noncore/apps/opie-console/settings.ui23
7 files changed, 104 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 3c1c8ea..88d5823 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -4,8 +4,9 @@
4#include <qlabel.h> 4#include <qlabel.h>
5#include <qpopupmenu.h> 5#include <qpopupmenu.h>
6#include <qtoolbar.h> 6#include <qtoolbar.h>
7 7
8#include "configdialog.h"
8#include "metafactory.h" 9#include "metafactory.h"
9#include "profilemanager.h" 10#include "profilemanager.h"
10#include "mainwindow.h" 11#include "mainwindow.h"
11 12
@@ -13,8 +14,9 @@ MainWindow::MainWindow() {
13 m_factory = new MetaFactory(); 14 m_factory = new MetaFactory();
14 m_sessions.setAutoDelete( TRUE ); 15 m_sessions.setAutoDelete( TRUE );
15 m_curSession = 0; 16 m_curSession = 0;
16 m_manager = new ProfileManager(m_factory); 17 m_manager = new ProfileManager(m_factory);
18 m_manager->load();
17 19
18 initUI(); 20 initUI();
19 populateProfiles(); 21 populateProfiles();
20} 22}
@@ -103,9 +105,9 @@ void MainWindow::initUI() {
103ProfileManager* MainWindow::manager() { 105ProfileManager* MainWindow::manager() {
104 return m_manager; 106 return m_manager;
105} 107}
106void MainWindow::populateProfiles() { 108void MainWindow::populateProfiles() {
107 manager()->load(); 109 m_sessionsPop->clear();
108 Profile::ValueList list = manager()->all(); 110 Profile::ValueList list = manager()->all();
109 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); 111 for (Profile::ValueList::Iterator it = list.begin(); it != list.end();
110 ++it ) { 112 ++it ) {
111 m_sessionsPop->insertItem( (*it).name() ); 113 m_sessionsPop->insertItem( (*it).name() );
@@ -146,8 +148,17 @@ void MainWindow::slotTerminate() {
146 /* FIXME move to the next session */ 148 /* FIXME move to the next session */
147} 149}
148void MainWindow::slotConfigure() { 150void MainWindow::slotConfigure() {
149 qWarning("configure"); 151 qWarning("configure");
152 ConfigDialog conf( manager()->all() );
153 conf.showMaximized();
154
155 int ret = conf.exec();
156
157 if ( QDialog::Accepted == ret ) {
158 manager()->setProfiles( conf.list() );
159 populateProfiles();
160 }
150} 161}
151void MainWindow::slotClose() { 162void MainWindow::slotClose() {
152 163
153} 164}
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index e045a48..9e44ab0 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -9,19 +9,21 @@ HEADERS = io_layer.h io_serial.h \
9 profile.h \ 9 profile.h \
10 profileconfig.h \ 10 profileconfig.h \
11 profilemanager.h \ 11 profilemanager.h \
12 configwidget.h \ 12 configwidget.h \
13 tabwidget.h 13 tabwidget.h \
14 configdialog.h
14SOURCES = io_layer.cpp io_serial.cpp \ 15SOURCES = io_layer.cpp io_serial.cpp \
15 file_layer.cpp main.cpp \ 16 file_layer.cpp main.cpp \
16 metafactory.cpp \ 17 metafactory.cpp \
17 session.cpp \ 18 session.cpp \
18 mainwindow.cpp \ 19 mainwindow.cpp \
19 profile.cpp \ 20 profile.cpp \
20 profileconfig.cpp \ 21 profileconfig.cpp \
21 profilemanager.cpp \ 22 profilemanager.cpp \
22 tabwidget.cpp 23 tabwidget.cpp \
23INTERFACES = 24 configdialog.cpp
25INTERFACES = configurebase.ui editbase.ui
24INCLUDEPATH += $(OPIEDIR)/include 26INCLUDEPATH += $(OPIEDIR)/include
25DEPENDPATH += $(OPIEDIR)/include 27DEPENDPATH += $(OPIEDIR)/include
26LIBS += -lqpe -lopie 28LIBS += -lqpe -lopie
27TARGET = opie-console 29TARGET = opie-console
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
new file mode 100644
index 0000000..a4246e1
--- a/dev/null
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -0,0 +1,20 @@
1
2#include "profileeditordialog.h"
3
4
5ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
6 const Profile& prof )
7 : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof )
8{
9 initUI();
10 /* now set the widgets */
11}
12ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
13 : QDialog(0, 0, TRUE), m_fact( fact )
14{
15
16}
17ProfileEditorDialog::~ProfileEditorDialog() {
18
19}
20
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h
new file mode 100644
index 0000000..5ccc691
--- a/dev/null
+++ b/noncore/apps/opie-console/profileeditordialog.h
@@ -0,0 +1,28 @@
1#ifndef PROFILE_EDITOR_DIALOG
2#define PROFILE_EDITOR_DIALOG
3
4#include <qdialog.h>
5
6#include "profile.h"
7
8class MetaFactory;
9class EditBase;
10class QTabWidget;
11class QHBoxLayout;
12class ProfileEditorDialog : public QDialog {
13 Q_OBJECT
14public:
15 ProfileEditorDialog(MetaFactory* fact,
16 const Profile& prof );
17 ProfileEditorDialog(MetaFactory* fact );
18 Profile profile()const;
19private:
20 void initUI();
21 MetaFactory* m_fact;
22 EditBase* m_base;
23 QTabWidget* m_tab;
24 QHBoxLayout* m_lay;
25 Profile m_prof;
26};
27
28#endif
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index 24256a5..72a5117 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -75,6 +75,19 @@ void ProfileManager::save( ) {
75 for ( it = map.begin(); it != map.end(); ++it ) { 75 for ( it = map.begin(); it != map.end(); ++it ) {
76 conf.writeEntry( it.key(), it.data() ); 76 conf.writeEntry( it.key(), it.data() );
77 } 77 }
78 } 78 }
79 // FIXME save 79}
80void ProfileManager::setProfiles( const Profile::ValueList& list ) {
81 m_list = list;
82};
83Profile ProfileManager::profile( const QString& name )const {
84 Profile prof;
85 Profile::ValueList::ConstIterator it;
86 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
87 if ( name == (*it).name() ) {
88 prof = (*it);
89 break;
90 }
91 }
92 return prof;
80} 93}
diff --git a/noncore/apps/opie-console/profilemanager.h b/noncore/apps/opie-console/profilemanager.h
index d4d0fd0..1387247 100644
--- a/noncore/apps/opie-console/profilemanager.h
+++ b/noncore/apps/opie-console/profilemanager.h
@@ -20,9 +20,11 @@ public:
20 * also replaces the item 20 * also replaces the item
21 */ 21 */
22 void add( const Profile& prof ); 22 void add( const Profile& prof );
23 void remove( const Profile& prof ); 23 void remove( const Profile& prof );
24 Profile profile(const QString& name )const;
24 Session* fromProfile( const Profile& ); 25 Session* fromProfile( const Profile& );
26 void setProfiles( const Profile::ValueList& );
25 void save(); 27 void save();
26private: 28private:
27 MetaFactory* m_fact; 29 MetaFactory* m_fact;
28 Profile::ValueList m_list; 30 Profile::ValueList m_list;
diff --git a/noncore/apps/opie-console/settings.ui b/noncore/apps/opie-console/settings.ui
new file mode 100644
index 0000000..6944dd0
--- a/dev/null
+++ b/noncore/apps/opie-console/settings.ui
@@ -0,0 +1,23 @@
1<!DOCTYPE UI><UI>
2<class>Settings</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>Settings</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>596</width>
15 <height>480</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Settings</string>
21 </property>
22</widget>
23</UI>