summaryrefslogtreecommitdiff
path: root/noncore/styles/theme/settings
authorsandman <sandman>2002-06-29 23:45:19 (UTC)
committer sandman <sandman>2002-06-29 23:45:19 (UTC)
commit769df90a59d6aa840b8d6568287001e66e263f01 (patch) (unidiff)
tree415c7e4ff70a9b035c31b28971a568bc2827ae34 /noncore/styles/theme/settings
parent0f179c0cc471b659b30dec4762c9c36678063f31 (diff)
downloadopie-769df90a59d6aa840b8d6568287001e66e263f01.zip
opie-769df90a59d6aa840b8d6568287001e66e263f01.tar.gz
opie-769df90a59d6aa840b8d6568287001e66e263f01.tar.bz2
*** empty log message ***
Diffstat (limited to 'noncore/styles/theme/settings') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/theme/settings/main.cpp34
-rw-r--r--noncore/styles/theme/settings/settings.pro24
-rw-r--r--noncore/styles/theme/settings/themeset.cpp124
-rw-r--r--noncore/styles/theme/settings/themeset.h20
4 files changed, 202 insertions, 0 deletions
diff --git a/noncore/styles/theme/settings/main.cpp b/noncore/styles/theme/settings/main.cpp
new file mode 100644
index 0000000..94d40f3
--- a/dev/null
+++ b/noncore/styles/theme/settings/main.cpp
@@ -0,0 +1,34 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "themeset.h"
22
23#include <qpe/qpeapplication.h>
24
25
26int main ( int argc, char** argv )
27{
28 QPEApplication a ( argc, argv );
29
30 ThemeSet dlg;
31 a. showMainWidget ( &dlg );
32
33 return a. exec ( );
34}
diff --git a/noncore/styles/theme/settings/settings.pro b/noncore/styles/theme/settings/settings.pro
new file mode 100644
index 0000000..85d1f7a
--- a/dev/null
+++ b/noncore/styles/theme/settings/settings.pro
@@ -0,0 +1,24 @@
1 TEMPLATE= app
2 CONFIG += qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin
4 HEADERS = themeset.h
5 SOURCES = themeset.cpp main.cpp
6INCLUDEPATH += $(OPIEDIR)/include
7 DEPENDPATH+= ../$(OPIEDIR)/include
8LIBS += -lqpe
9 TARGET = theme-settings
10
11TRANSLATIONS = ../../../../i18n/de/theme-settings.ts \
12 ../../../../i18n/en/theme-settings.ts \
13 ../../../../i18n/es/theme-settings.ts \
14 ../../../../i18n/fr/theme-settings.ts \
15 ../../../../i18n/hu/theme-settings.ts \
16 ../../../../i18n/ja/theme-settings.ts \
17 ../../../../i18n/ko/theme-settings.ts \
18 ../../../../i18n/no/theme-settings.ts \
19 ../../../../i18n/pl/theme-settings.ts \
20 ../../../../i18n/pt/theme-settings.ts \
21 ../../../../i18n/pt_BR/theme-settings.ts \
22 ../../../../i18n/sl/theme-settings.ts \
23 ../../../../i18n/zh_CN/theme-settings.ts \
24 ../../../../i18n/zh_TW/theme-settings.ts
diff --git a/noncore/styles/theme/settings/themeset.cpp b/noncore/styles/theme/settings/themeset.cpp
new file mode 100644
index 0000000..046618e
--- a/dev/null
+++ b/noncore/styles/theme/settings/themeset.cpp
@@ -0,0 +1,124 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21
22
23#include "themeset.h"
24
25#include <qpe/qpeapplication.h>
26#include <qpe/global.h>
27
28#include <qlabel.h>
29#include <qlayout.h>
30#include <qlistview.h>
31#include <qdir.h>
32
33#include <qpe/config.h>
34
35
36class MyConfig : public Config
37{
38public:
39 MyConfig ( const QString &f, Domain d ) : Config ( f, d )
40 { }
41
42 bool hasGroup ( const QString &gname ) const
43 {
44 QMap< QString, ConfigGroup>::ConstIterator it = groups. find ( gname );
45 return ( it != groups.end() );
46 }
47};
48
49class MyItem : public QListViewItem
50{
51public:
52 MyItem ( QListView *lv, const QString &name, const QString &comm, const QString &theme ) : QListViewItem ( lv, name, comm )
53 {
54 m_theme = theme;
55 }
56
57
58 QString m_theme;
59};
60
61
62ThemeSet::ThemeSet ( QWidget* parent, const char *name, WFlags fl )
63 : QDialog ( parent, name, fl )
64{
65 setCaption ( tr( "Theme Style" ) );
66
67 Config config ( "qpe" );
68 config. setGroup ( "Appearance" );
69
70 QString active = config. readEntry ( "Theme", "default" );
71
72 QVBoxLayout *vbox = new QVBoxLayout ( this );
73 vbox-> setSpacing ( 3 );
74 vbox-> setMargin ( 6 );
75
76 vbox-> addWidget ( new QLabel ( tr( "Select the theme to be used" ), this ));
77
78 m_list = new QListView ( this );
79 m_list-> addColumn ( tr( "Name" ));
80 m_list-> addColumn ( tr( "Description" ));
81 m_list-> setSelectionMode ( QListView::Single );
82 m_list-> setAllColumnsShowFocus ( true );
83 vbox-> addWidget ( m_list, 10 );
84
85 QListViewItem *item = new MyItem ( m_list, tr( "[No theme]" ), "", "" );
86 m_list-> setSelected ( item, true );
87
88 QString path = QPEApplication::qpeDir() + "/plugins/styles/themes";
89 QStringList list = QDir ( path, "*.themerc" ). entryList ( );
90
91 for ( QStringList::Iterator it = list. begin(); it != list. end ( ); ++it ) {
92 MyConfig cfg ( path + "/" + *it, Config::File );
93
94 if ( cfg. hasGroup ( "Misc" )) {
95 cfg. setGroup ( "Misc" );
96
97 QString name = cfg. readEntry ( "Name" );
98 QString comm = cfg. readEntry ( "Comment" );
99
100 if ( !name. isEmpty ( )) {
101 QString fname = (*it). left ((*it). length ( ) - 8 );
102
103 item = new MyItem ( m_list, name, comm, fname );
104 if ( active == fname ) {
105 m_list-> setSelected ( item, true );
106 }
107 }
108 }
109 }
110}
111
112void ThemeSet::accept ( )
113{
114 Config config ( "qpe" );
115 config. setGroup ( "Appearance" );
116
117 MyItem *it = (MyItem *) m_list-> selectedItem ( );
118 config. writeEntry ( "Theme", it ? it-> m_theme : QString ( "" ));
119
120 Global::applyStyle ( );
121
122 QDialog::accept ( );
123}
124
diff --git a/noncore/styles/theme/settings/themeset.h b/noncore/styles/theme/settings/themeset.h
new file mode 100644
index 0000000..24804ce
--- a/dev/null
+++ b/noncore/styles/theme/settings/themeset.h
@@ -0,0 +1,20 @@
1#ifndef __OPIE_THEME_SET_H__
2#define __OPIE_THEME_SET_H__
3
4#include <qdialog.h>
5
6class QListView;
7
8class ThemeSet : public QDialog {
9 Q_OBJECT
10
11public:
12 ThemeSet ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
13
14protected:
15 virtual void accept ( );
16
17private:
18 QListView *m_list;
19};
20#endif