summaryrefslogtreecommitdiff
path: root/noncore/styles/theme
Unidiff
Diffstat (limited to 'noncore/styles/theme') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/theme/opie-theme.control2
-rw-r--r--noncore/styles/theme/plugin.cpp118
-rw-r--r--noncore/styles/theme/plugin.h46
-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.h20
-rw-r--r--noncore/styles/theme/theme.pro5
-rw-r--r--noncore/styles/theme/themeset.cpp (renamed from noncore/styles/theme/settings/themeset.cpp)11
-rw-r--r--noncore/styles/theme/themeset.h20
9 files changed, 181 insertions, 99 deletions
diff --git a/noncore/styles/theme/opie-theme.control b/noncore/styles/theme/opie-theme.control
index 02739fb..adb4f4b 100644
--- a/noncore/styles/theme/opie-theme.control
+++ b/noncore/styles/theme/opie-theme.control
@@ -1,11 +1,11 @@
1Files: plugins/styles/libtheme.so* bin/theme-settings apps/Settings/Theme.desktop pics/theme/Theme.png 1Files: plugins/styles/libtheme.so*
2Priority: optional 2Priority: optional
3Section: opie/system 3Section: opie/system
4Maintainer: Robert Griebl <sandman@handhelds.org> 4Maintainer: Robert Griebl <sandman@handhelds.org>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION.1 6Version: $QPE_VERSION-$SUB_VERSION.1
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION)
8Description: Themed style. 8Description: Themed style.
9 This style accepts all themes written 9 This style accepts all themes written
10for KDE 2.2 10for KDE 2.2
11 11
diff --git a/noncore/styles/theme/plugin.cpp b/noncore/styles/theme/plugin.cpp
index b334357..4383693 100644
--- a/noncore/styles/theme/plugin.cpp
+++ b/noncore/styles/theme/plugin.cpp
@@ -1,19 +1,111 @@
1//#include <klocale.h>
2#include "othemestyle.h" 1#include "othemestyle.h"
2#include "themeset.h"
3#include "plugin.h"
3 4
4extern "C" 5
6
7ThemeInterface::ThemeInterface ( ) : ref ( 0 )
5{ 8{
6 QStyle * allocate() { 9}
7 return new OThemeStyle ( "" ); 10
8 } 11ThemeInterface::~ThemeInterface ( )
9 int minor_version() { 12{
10 return 0; 13}
11 } 14
12 int major_version() { 15QStyle *ThemeInterface::create ( )
13 return 1; 16{
14 } 17 return new OThemeStyle ( "" );
15 const char * description() { 18}
16 return ( "Theme Style" ); 19
20QString ThemeInterface::name ( )
21{
22 return QObject::tr( "Themed style", "name" );
23}
24
25QString ThemeInterface::description ( )
26{
27 return QObject::tr( "KDE2 theme compatible style engine", "description" );
28}
29
30QCString ThemeInterface::key ( )
31{
32 return QCString ( "theme" );
33}
34
35unsigned int ThemeInterface::version ( )
36{
37 return 100; // 1.0.0 (\d+.\d.\d)
38}
39
40QRESULT ThemeInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
41{
42 static ThemeSettingsInterface *setiface = 0;
43
44 *iface = 0;
45
46 if ( uuid == IID_QUnknown )
47 *iface = this;
48 else if ( uuid == IID_Style )
49 *iface = this;
50 else if ( uuid == IID_StyleSettings ) {
51 if ( !setiface )
52 setiface = new ThemeSettingsInterface ( );
53 *iface = setiface;
17 } 54 }
55
56 if ( *iface )
57 (*iface)-> addRef ( );
58
59 return QS_OK;
60}
61
62Q_EXPORT_INTERFACE()
63{
64 Q_CREATE_INSTANCE( ThemeInterface )
65}
66
67
68ThemeSettingsInterface::ThemeSettingsInterface ( ) : ref ( 0 )
69{
70 m_widget = 0;
71}
72
73ThemeSettingsInterface::~ThemeSettingsInterface ( )
74{
75}
76
77QWidget *ThemeSettingsInterface::create ( QWidget *parent, const char *name )
78{
79 m_widget = new ThemeSettings ( parent, name ? name : "THEME-SETTINGS" );
80
81 return m_widget;
82}
83
84bool ThemeSettingsInterface::accept ( )
85{
86 if ( !m_widget )
87 return false;
88
89 return m_widget-> writeConfig ( );
90}
91
92void ThemeSettingsInterface::reject ( )
93{
94}
95
96QRESULT ThemeSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
97{
98 *iface = 0;
99
100
101 if ( uuid == IID_QUnknown )
102 *iface = this;
103 else if ( uuid == IID_StyleSettings )
104 *iface = this;
105
106 if ( *iface )
107 (*iface)-> addRef ( );
108
109 return QS_OK;
18} 110}
19 111
diff --git a/noncore/styles/theme/plugin.h b/noncore/styles/theme/plugin.h
new file mode 100644
index 0000000..d13fc5d
--- a/dev/null
+++ b/noncore/styles/theme/plugin.h
@@ -0,0 +1,46 @@
1#ifndef __OPIE_THEME_PLUGIN_H__
2#define __OPIE_THEME_PLUGIN_H__
3
4#include <qpe/styleinterface.h>
5
6class ThemeSettings;
7
8class ThemeInterface : public StyleInterface {
9public:
10 ThemeInterface ( );
11 virtual ~ThemeInterface ( );
12
13 QRESULT queryInterface ( const QUuid &, QUnknownInterface ** );
14 Q_REFCOUNT
15
16 virtual QStyle *create ( );
17
18 virtual QString description ( );
19 virtual QString name ( );
20 virtual QCString key ( );
21
22 virtual unsigned int version ( );
23
24private:
25 ulong ref;
26};
27
28class ThemeSettingsInterface : public StyleSettingsInterface {
29public:
30 ThemeSettingsInterface ( );
31 virtual ~ThemeSettingsInterface ( );
32
33 QRESULT queryInterface ( const QUuid &, QUnknownInterface ** );
34 Q_REFCOUNT
35
36 virtual QWidget *create ( QWidget *parent, const char *name = 0 );
37
38 virtual bool accept ( );
39 virtual void reject ( );
40
41private:
42 ThemeSettings *m_widget;
43 ulong ref;
44};
45
46#endif
diff --git a/noncore/styles/theme/settings/main.cpp b/noncore/styles/theme/settings/main.cpp
deleted file mode 100644
index 94d40f3..0000000
--- a/noncore/styles/theme/settings/main.cpp
+++ b/dev/null
@@ -1,34 +0,0 @@
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
deleted file mode 100644
index 85d1f7a..0000000
--- a/noncore/styles/theme/settings/settings.pro
+++ b/dev/null
@@ -1,24 +0,0 @@
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.h b/noncore/styles/theme/settings/themeset.h
deleted file mode 100644
index 24804ce..0000000
--- a/noncore/styles/theme/settings/themeset.h
+++ b/dev/null
@@ -1,20 +0,0 @@
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
diff --git a/noncore/styles/theme/theme.pro b/noncore/styles/theme/theme.pro
index fdcd20e..49c4103 100644
--- a/noncore/styles/theme/theme.pro
+++ b/noncore/styles/theme/theme.pro
@@ -1,32 +1,35 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG = qt embedded debug warn_on 2CONFIG = qt embedded debug warn_on
3SOURCES = ogfxeffect.cpp \ 3SOURCES = ogfxeffect.cpp \
4 othemestyle.cpp \ 4 othemestyle.cpp \
5 othemebase.cpp \ 5 othemebase.cpp \
6 themeset.cpp \
6 plugin.cpp 7 plugin.cpp
7 8
8HEADERS = ogfxeffect.h \ 9HEADERS = ogfxeffect.h \
9 othemebase.h \ 10 othemebase.h \
10 othemestyle.h 11 othemestyle.h \
12 themeset.h \
13 plugin.h
11 14
12 15
13LIBS += -lqpe 16LIBS += -lqpe
14INCLUDEPATH += $(OPIEDIR)/include 17INCLUDEPATH += $(OPIEDIR)/include
15DESTDIR = $(OPIEDIR)/plugins/styles 18DESTDIR = $(OPIEDIR)/plugins/styles
16TARGET = theme 19TARGET = theme
17VERSION = 1.0.0 20VERSION = 1.0.0
18 21
19TRANSLATIONS = ../../../i18n/de/libtheme.ts \ 22TRANSLATIONS = ../../../i18n/de/libtheme.ts \
20 ../../../i18n/en/libtheme.ts \ 23 ../../../i18n/en/libtheme.ts \
21 ../../../i18n/es/libtheme.ts \ 24 ../../../i18n/es/libtheme.ts \
22 ../../../i18n/fr/libtheme.ts \ 25 ../../../i18n/fr/libtheme.ts \
23 ../../../i18n/hu/libtheme.ts \ 26 ../../../i18n/hu/libtheme.ts \
24 ../../../i18n/ja/libtheme.ts \ 27 ../../../i18n/ja/libtheme.ts \
25 ../../../i18n/ko/libtheme.ts \ 28 ../../../i18n/ko/libtheme.ts \
26 ../../../i18n/no/libtheme.ts \ 29 ../../../i18n/no/libtheme.ts \
27 ../../../i18n/pl/libtheme.ts \ 30 ../../../i18n/pl/libtheme.ts \
28 ../../../i18n/pt/libtheme.ts \ 31 ../../../i18n/pt/libtheme.ts \
29 ../../../i18n/pt_BR/libtheme.ts \ 32 ../../../i18n/pt_BR/libtheme.ts \
30 ../../../i18n/sl/libtheme.ts \ 33 ../../../i18n/sl/libtheme.ts \
31 ../../../i18n/zh_CN/libtheme.ts \ 34 ../../../i18n/zh_CN/libtheme.ts \
32 ../../../i18n/zh_TW/libtheme.ts 35 ../../../i18n/zh_TW/libtheme.ts
diff --git a/noncore/styles/theme/settings/themeset.cpp b/noncore/styles/theme/themeset.cpp
index 046618e..4a4efcb 100644
--- a/noncore/styles/theme/settings/themeset.cpp
+++ b/noncore/styles/theme/themeset.cpp
@@ -30,95 +30,94 @@
30#include <qlistview.h> 30#include <qlistview.h>
31#include <qdir.h> 31#include <qdir.h>
32 32
33#include <qpe/config.h> 33#include <qpe/config.h>
34 34
35 35
36class MyConfig : public Config 36class MyConfig : public Config
37{ 37{
38public: 38public:
39 MyConfig ( const QString &f, Domain d ) : Config ( f, d ) 39 MyConfig ( const QString &f, Domain d ) : Config ( f, d )
40 { } 40 { }
41 41
42 bool hasGroup ( const QString &gname ) const 42 bool hasGroup ( const QString &gname ) const
43 { 43 {
44 QMap< QString, ConfigGroup>::ConstIterator it = groups. find ( gname ); 44 QMap< QString, ConfigGroup>::ConstIterator it = groups. find ( gname );
45 return ( it != groups.end() ); 45 return ( it != groups.end() );
46 } 46 }
47}; 47};
48 48
49class MyItem : public QListViewItem 49class MyItem : public QListViewItem
50{ 50{
51public: 51public:
52 MyItem ( QListView *lv, const QString &name, const QString &comm, const QString &theme ) : QListViewItem ( lv, name, comm ) 52 MyItem ( QListView *lv, const QString &name, const QString &comm, const QString &theme ) : QListViewItem ( lv, name, comm )
53 { 53 {
54 m_theme = theme; 54 m_theme = theme;
55 } 55 }
56 56
57 57
58 QString m_theme; 58 QString m_theme;
59}; 59};
60 60
61 61
62ThemeSet::ThemeSet ( QWidget* parent, const char *name, WFlags fl ) 62ThemeSettings::ThemeSettings ( QWidget* parent, const char *name, WFlags fl )
63 : QDialog ( parent, name, fl ) 63 : QWidget ( parent, name, fl )
64{ 64{
65 setCaption ( tr( "Theme Style" ) ); 65 setCaption ( tr( "Theme Style" ) );
66 66
67 Config config ( "qpe" ); 67 Config config ( "qpe" );
68 config. setGroup ( "Appearance" ); 68 config. setGroup ( "Appearance" );
69 69
70 QString active = config. readEntry ( "Theme", "default" ); 70 QString active = config. readEntry ( "Theme", "default" );
71 71
72 QVBoxLayout *vbox = new QVBoxLayout ( this ); 72 QVBoxLayout *vbox = new QVBoxLayout ( this );
73 vbox-> setSpacing ( 3 ); 73 vbox-> setSpacing ( 3 );
74 vbox-> setMargin ( 6 ); 74 vbox-> setMargin ( 6 );
75 75
76 vbox-> addWidget ( new QLabel ( tr( "Select the theme to be used" ), this )); 76 vbox-> addWidget ( new QLabel ( tr( "Select the theme to be used" ), this ));
77 77
78 m_list = new QListView ( this ); 78 m_list = new QListView ( this );
79 m_list-> addColumn ( tr( "Name" )); 79 m_list-> addColumn ( tr( "Name" ));
80 m_list-> addColumn ( tr( "Description" )); 80 m_list-> addColumn ( tr( "Description" ));
81 m_list-> setSelectionMode ( QListView::Single ); 81 m_list-> setSelectionMode ( QListView::Single );
82 m_list-> setAllColumnsShowFocus ( true ); 82 m_list-> setAllColumnsShowFocus ( true );
83 vbox-> addWidget ( m_list, 10 ); 83 vbox-> addWidget ( m_list, 10 );
84 84
85 QListViewItem *item = new MyItem ( m_list, tr( "[No theme]" ), "", "" ); 85 QListViewItem *item = new MyItem ( m_list, tr( "[No theme]" ), "", "" );
86 m_list-> setSelected ( item, true ); 86 m_list-> setSelected ( item, true );
87 87
88 QString path = QPEApplication::qpeDir() + "/plugins/styles/themes"; 88 QString path = QPEApplication::qpeDir() + "/plugins/styles/themes";
89 QStringList list = QDir ( path, "*.themerc" ). entryList ( ); 89 QStringList list = QDir ( path, "*.themerc" ). entryList ( );
90 90
91 for ( QStringList::Iterator it = list. begin(); it != list. end ( ); ++it ) { 91 for ( QStringList::Iterator it = list. begin(); it != list. end ( ); ++it ) {
92 MyConfig cfg ( path + "/" + *it, Config::File ); 92 MyConfig cfg ( path + "/" + *it, Config::File );
93 93
94 if ( cfg. hasGroup ( "Misc" )) { 94 if ( cfg. hasGroup ( "Misc" )) {
95 cfg. setGroup ( "Misc" ); 95 cfg. setGroup ( "Misc" );
96 96
97 QString name = cfg. readEntry ( "Name" ); 97 QString name = cfg. readEntry ( "Name" );
98 QString comm = cfg. readEntry ( "Comment" ); 98 QString comm = cfg. readEntry ( "Comment" );
99 99
100 if ( !name. isEmpty ( )) { 100 if ( !name. isEmpty ( )) {
101 QString fname = (*it). left ((*it). length ( ) - 8 ); 101 QString fname = (*it). left ((*it). length ( ) - 8 );
102 102
103 item = new MyItem ( m_list, name, comm, fname ); 103 item = new MyItem ( m_list, name, comm, fname );
104 if ( active == fname ) { 104 if ( active == fname ) {
105 m_list-> setSelected ( item, true ); 105 m_list-> setSelected ( item, true );
106 } 106 }
107 } 107 }
108 } 108 }
109 } 109 }
110} 110}
111 111
112void ThemeSet::accept ( ) 112bool ThemeSettings::writeConfig ( )
113{ 113{
114 Config config ( "qpe" ); 114 Config config ( "qpe" );
115 config. setGroup ( "Appearance" ); 115 config. setGroup ( "Appearance" );
116 116
117 MyItem *it = (MyItem *) m_list-> selectedItem ( ); 117 MyItem *it = (MyItem *) m_list-> selectedItem ( );
118 config. writeEntry ( "Theme", it ? it-> m_theme : QString ( "" )); 118 config. writeEntry ( "Theme", it ? it-> m_theme : QString ( "" ));
119 config. write ( );
119 120
120 Global::applyStyle ( ); 121 return true;
121
122 QDialog::accept ( );
123} 122}
124 123
diff --git a/noncore/styles/theme/themeset.h b/noncore/styles/theme/themeset.h
new file mode 100644
index 0000000..c337cfa
--- a/dev/null
+++ b/noncore/styles/theme/themeset.h
@@ -0,0 +1,20 @@
1#ifndef __OPIE_THEME_SETTINGS_H__
2#define __OPIE_THEME_SETTINGS_H__
3
4#include <qdialog.h>
5
6class QListView;
7
8class ThemeSettings : public QWidget {
9 Q_OBJECT
10
11public:
12 ThemeSettings ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
13
14public:
15 virtual bool writeConfig ( );
16
17private:
18 QListView *m_list;
19};
20#endif