-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 13 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 28 | ||||
-rw-r--r-- | noncore/apps/opie-console/profilemanager.cpp | 15 | ||||
-rw-r--r-- | noncore/apps/opie-console/profilemanager.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/settings.ui | 23 |
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 | |||
@@ -5,6 +5,7 @@ | |||
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" |
@@ -14,6 +15,7 @@ MainWindow::MainWindow() { | |||
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(); |
@@ -104,7 +106,7 @@ ProfileManager* MainWindow::manager() { | |||
104 | return m_manager; | 106 | return m_manager; |
105 | } | 107 | } |
106 | void MainWindow::populateProfiles() { | 108 | void 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 ) { |
@@ -147,6 +149,15 @@ void MainWindow::slotTerminate() { | |||
147 | } | 149 | } |
148 | void MainWindow::slotConfigure() { | 150 | void 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 | } |
151 | void MainWindow::slotClose() { | 162 | void MainWindow::slotClose() { |
152 | 163 | ||
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 | |||
@@ -10,7 +10,8 @@ HEADERS = io_layer.h io_serial.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 | ||
14 | SOURCES = io_layer.cpp io_serial.cpp \ | 15 | SOURCES = io_layer.cpp io_serial.cpp \ |
15 | file_layer.cpp main.cpp \ | 16 | file_layer.cpp main.cpp \ |
16 | metafactory.cpp \ | 17 | metafactory.cpp \ |
@@ -19,8 +20,9 @@ SOURCES = io_layer.cpp io_serial.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 \ |
23 | INTERFACES = | 24 | configdialog.cpp |
25 | INTERFACES = configurebase.ui editbase.ui | ||
24 | INCLUDEPATH += $(OPIEDIR)/include | 26 | INCLUDEPATH += $(OPIEDIR)/include |
25 | DEPENDPATH += $(OPIEDIR)/include | 27 | DEPENDPATH += $(OPIEDIR)/include |
26 | LIBS += -lqpe -lopie | 28 | LIBS += -lqpe -lopie |
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 | |||
5 | ProfileEditorDialog::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 | } | ||
12 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | ||
13 | : QDialog(0, 0, TRUE), m_fact( fact ) | ||
14 | { | ||
15 | |||
16 | } | ||
17 | ProfileEditorDialog::~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 | |||
8 | class MetaFactory; | ||
9 | class EditBase; | ||
10 | class QTabWidget; | ||
11 | class QHBoxLayout; | ||
12 | class ProfileEditorDialog : public QDialog { | ||
13 | Q_OBJECT | ||
14 | public: | ||
15 | ProfileEditorDialog(MetaFactory* fact, | ||
16 | const Profile& prof ); | ||
17 | ProfileEditorDialog(MetaFactory* fact ); | ||
18 | Profile profile()const; | ||
19 | private: | ||
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 | |||
@@ -76,5 +76,18 @@ void ProfileManager::save( ) { | |||
76 | conf.writeEntry( it.key(), it.data() ); | 76 | conf.writeEntry( it.key(), it.data() ); |
77 | } | 77 | } |
78 | } | 78 | } |
79 | // FIXME save | 79 | } |
80 | void ProfileManager::setProfiles( const Profile::ValueList& list ) { | ||
81 | m_list = list; | ||
82 | }; | ||
83 | Profile 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 | |||
@@ -21,7 +21,9 @@ public: | |||
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(); |
26 | private: | 28 | private: |
27 | MetaFactory* m_fact; | 29 | MetaFactory* m_fact; |
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> | ||