summaryrefslogtreecommitdiff
authorsandman <sandman>2002-10-04 01:22:50 (UTC)
committer sandman <sandman>2002-10-04 01:22:50 (UTC)
commitb7ec6d0674f0f7835da7f114683dcfa74e6bc546 (patch) (unidiff)
treea2dff60b917d943543458f3e47d67f1584fbfb6c
parente2f23d8a5169ffef63dcbbac920f68ef0f113792 (diff)
downloadopie-b7ec6d0674f0f7835da7f114683dcfa74e6bc546.zip
opie-b7ec6d0674f0f7835da7f114683dcfa74e6bc546.tar.gz
opie-b7ec6d0674f0f7835da7f114683dcfa74e6bc546.tar.bz2
changes to make the style interface BC with Qtopia 1.6, while still
supporting our extended features
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp2
-rw-r--r--library/styleinterface.h39
2 files changed, 20 insertions, 21 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index e92b4dd..f65f3ab 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -1212,49 +1212,49 @@ void QPEApplication::internalSetStyle( const QString &style )
1212 } 1212 }
1213#endif 1213#endif
1214#ifndef QT_NO_STYLE_MOTIFPLUS 1214#ifndef QT_NO_STYLE_MOTIFPLUS
1215 else if ( style == "MotifPlus" ) { 1215 else if ( style == "MotifPlus" ) {
1216 setStyle( new QMotifPlusStyle ); 1216 setStyle( new QMotifPlusStyle );
1217 } 1217 }
1218#endif 1218#endif
1219 1219
1220 else { 1220 else {
1221 QStyle *sty = 0; 1221 QStyle *sty = 0;
1222 QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; 1222 QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/";
1223 1223
1224 if ( style. find ( ".so" ) > 0 ) 1224 if ( style. find ( ".so" ) > 0 )
1225 path += style; 1225 path += style;
1226 else 1226 else
1227 path = path + "lib" + style. lower ( ) + ".so"; // compatibility 1227 path = path + "lib" + style. lower ( ) + ".so"; // compatibility
1228 1228
1229 static QLibrary *lastlib = 0; 1229 static QLibrary *lastlib = 0;
1230 static StyleInterface *lastiface = 0; 1230 static StyleInterface *lastiface = 0;
1231 1231
1232 QLibrary *lib = new QLibrary ( path ); 1232 QLibrary *lib = new QLibrary ( path );
1233 StyleInterface *iface = 0; 1233 StyleInterface *iface = 0;
1234 1234
1235 if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) 1235 if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface )
1236 sty = iface-> create ( ); 1236 sty = iface-> style ( );
1237 1237
1238 if ( sty ) { 1238 if ( sty ) {
1239 setStyle ( sty ); 1239 setStyle ( sty );
1240 1240
1241 if ( lastiface ) 1241 if ( lastiface )
1242 lastiface-> release ( ); 1242 lastiface-> release ( );
1243 lastiface = iface; 1243 lastiface = iface;
1244 1244
1245 if ( lastlib ) { 1245 if ( lastlib ) {
1246 lastlib-> unload ( ); 1246 lastlib-> unload ( );
1247 delete lastlib; 1247 delete lastlib;
1248 } 1248 }
1249 lastlib = lib; 1249 lastlib = lib;
1250 } 1250 }
1251 else { 1251 else {
1252 if ( iface ) 1252 if ( iface )
1253 iface-> release ( ); 1253 iface-> release ( );
1254 delete lib; 1254 delete lib;
1255 1255
1256 setStyle ( new QPEStyle ( )); 1256 setStyle ( new QPEStyle ( ));
1257 } 1257 }
1258 } 1258 }
1259#endif 1259#endif
1260} 1260}
diff --git a/library/styleinterface.h b/library/styleinterface.h
index 9fea636..b50f239 100644
--- a/library/styleinterface.h
+++ b/library/styleinterface.h
@@ -1,68 +1,67 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Robert Griebl. All rights reserved. 2** Copyright (C) 2002 Robert Griebl. All rights reserved.
3** 3**
4** This file is part of OPIE (http://www.opie.info). 4** This file is part of OPIE (http://www.opie.info).
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef STYLEINTERFACE_H 16#ifndef STYLEINTERFACE_H
17#define STYLEINTERFACE_H 17#define STYLEINTERFACE_H
18 18
19#include <qpe/qcom.h> 19#include <qpe/qcom.h>
20 20
21#ifndef QT_NO_COMPONENT 21#ifndef QT_NO_COMPONENT
22 22
23// {6C33B4F9-D529-453A-8FB3-DA42B21872BD} 23// {17AF792C-E461-49A9-9B71-068B9A8DDAE4}
24# ifndef IID_Style 24#ifndef IID_Style
25# define IID_Style QUuid( 0x6c33b4f9, 0xd529, 0x453a, 0x8f, 0xb3, 0xda, 0x42, 0xb2, 0x18, 0x72, 0xbd) 25#define IID_Style QUuid( 0x17af792c, 0xe461, 0x49a9, 0x9b, 0x71, 0x06, 0x8b, 0x9a, 0x8d, 0xda, 0xe4)
26#endif 26#endif
27 27
28// {9757A252-3FD4-438F-A756-80BE4A9FB8DC} 28// {6C33B4F9-D529-453A-8FB3-DA42B21872BD}
29# ifndef IID_StyleSettings 29# ifndef IID_StyleExtended
30# define IID_StyleSettings QUuid( 0x9757a252, 0x3fd4, 0x438f, 0xa7, 0x56, 0x80, 0xbe, 0x4a, 0x9f, 0xb8, 0xdc) 30# define IID_StyleExtended QUuid( 0x6c33b4f9, 0xd529, 0x453a, 0x8f, 0xb3, 0xda, 0x42, 0xb2, 0x18, 0x72, 0xbd)
31# endif 31#endif
32 32
33#endif 33#endif
34 34
35class QWidget; 35class QWidget;
36class QStyle; 36class QStyle;
37 37
38
39class QStyle;
40
38struct StyleInterface : public QUnknownInterface 41struct StyleInterface : public QUnknownInterface
39{ 42{
40 //! Return a new style. 43 //! Return a new style.
41 virtual QStyle *create ( ) = 0; 44 virtual QStyle *style() = 0;
42
43 //! Return a (longer) description for the style.
44 virtual QString description ( ) = 0;
45
46 //! Return a short name for the style. 45 //! Return a short name for the style.
47 virtual QString name ( ) = 0; 46 virtual QString name() const = 0;
48
49 //! Return the library basename (libliquid.so => liquid)
50 virtual QCString key ( ) = 0;
51
52 //! QT_VERSION like 1.2.3 == 123
53 virtual unsigned int version ( ) = 0;
54}; 47};
55 48
56struct StyleSettingsInterface : public QUnknownInterface 49struct StyleExtendedInterface : public StyleInterface
57{ 50{
51 //! Return a (longer) description for the style.
52 virtual QString description ( ) = 0;
53
54 //! Does this style support customization
55 virtual bool hasSettings ( ) const = 0;
56
58 //! Return a new settings page. 57 //! Return a new settings page.
59 virtual QWidget *create ( QWidget *parent, const char *name = 0 ) = 0; 58 virtual QWidget *create ( QWidget *parent, const char *name = 0 ) = 0;
60 59
61 //! Callback for appearance app when OK is clicked (return true when style has to re-applied). 60 //! Callback for appearance app when OK is clicked (return true when style has to re-applied).
62 virtual bool accept ( ) = 0; 61 virtual bool accept ( ) = 0;
63 62
64 //! Callback for appeaeance app when Cancel is clicked. 63 //! Callback for appeaeance app when Cancel is clicked.
65 virtual void reject ( ) = 0; 64 virtual void reject ( ) = 0;
66}; 65};
67 66
68#endif 67#endif