-rw-r--r-- | library/qpeapplication.cpp | 2 | ||||
-rw-r--r-- | library/styleinterface.h | 39 |
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 @@ -1172,129 +1172,129 @@ void QPEApplication::setKeepRunning() \sa setKeepRunning() */ bool QPEApplication::keepRunning() const { return d->keep_running; } /*! \internal */ void QPEApplication::internalSetStyle( const QString &style ) { #if QT_VERSION >= 300 if ( style == "QPE" ) { setStyle( new QPEStyle ); } else { QStyle *s = QStyleFactory::create( style ); if ( s ) setStyle( s ); } #else if ( style == "Windows" ) { setStyle( new QWindowsStyle ); } else if ( style == "QPE" ) { setStyle( new QPEStyle ); } else if ( style == "Light" ) { setStyle( new LightStyle ); } #ifndef QT_NO_STYLE_PLATINUM else if ( style == "Platinum" ) { setStyle( new QPlatinumStyle ); } #endif #ifndef QT_NO_STYLE_MOTIF else if ( style == "Motif" ) { setStyle( new QMotifStyle ); } #endif #ifndef QT_NO_STYLE_MOTIFPLUS else if ( style == "MotifPlus" ) { setStyle( new QMotifPlusStyle ); } #endif else { QStyle *sty = 0; QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; if ( style. find ( ".so" ) > 0 ) path += style; else path = path + "lib" + style. lower ( ) + ".so"; // compatibility static QLibrary *lastlib = 0; static StyleInterface *lastiface = 0; QLibrary *lib = new QLibrary ( path ); StyleInterface *iface = 0; if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) - sty = iface-> create ( ); + sty = iface-> style ( ); if ( sty ) { setStyle ( sty ); if ( lastiface ) lastiface-> release ( ); lastiface = iface; if ( lastlib ) { lastlib-> unload ( ); delete lastlib; } lastlib = lib; } else { if ( iface ) iface-> release ( ); delete lib; setStyle ( new QPEStyle ( )); } } #endif } /*! \internal */ void QPEApplication::prepareForTermination( bool willrestart ) { if ( willrestart ) { // Draw a big wait icon, the image can be altered in later revisions // QWidget *d = QApplication::desktop(); QImage img = Resource::loadImage( "launcher/new_wait" ); QPixmap pix; pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); lblWait->setPixmap( pix ); lblWait->setAlignment( QWidget::AlignCenter ); lblWait->show(); lblWait->showMaximized(); } #ifndef SINGLE_APP { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); } processEvents(); // ensure the message goes out. sleep( 1 ); // You have 1 second to comply. #endif } /*! \internal */ void QPEApplication::shutdown() { // Implement in server's QPEApplication subclass } /*! \internal */ void QPEApplication::restart() { 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 @@ /********************************************************************** ** Copyright (C) 2002 Robert Griebl. All rights reserved. ** ** This file is part of OPIE (http://www.opie.info). ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #ifndef STYLEINTERFACE_H #define STYLEINTERFACE_H #include <qpe/qcom.h> #ifndef QT_NO_COMPONENT -// {6C33B4F9-D529-453A-8FB3-DA42B21872BD} -# ifndef IID_Style -# define IID_Style QUuid( 0x6c33b4f9, 0xd529, 0x453a, 0x8f, 0xb3, 0xda, 0x42, 0xb2, 0x18, 0x72, 0xbd) +// {17AF792C-E461-49A9-9B71-068B9A8DDAE4} +#ifndef IID_Style +#define IID_Style QUuid( 0x17af792c, 0xe461, 0x49a9, 0x9b, 0x71, 0x06, 0x8b, 0x9a, 0x8d, 0xda, 0xe4) #endif -// {9757A252-3FD4-438F-A756-80BE4A9FB8DC} -# ifndef IID_StyleSettings -# define IID_StyleSettings QUuid( 0x9757a252, 0x3fd4, 0x438f, 0xa7, 0x56, 0x80, 0xbe, 0x4a, 0x9f, 0xb8, 0xdc) -# endif +// {6C33B4F9-D529-453A-8FB3-DA42B21872BD} +# ifndef IID_StyleExtended +# define IID_StyleExtended QUuid( 0x6c33b4f9, 0xd529, 0x453a, 0x8f, 0xb3, 0xda, 0x42, 0xb2, 0x18, 0x72, 0xbd) +#endif #endif class QWidget; class QStyle; + +class QStyle; + struct StyleInterface : public QUnknownInterface { //! Return a new style. - virtual QStyle *create ( ) = 0; - - //! Return a (longer) description for the style. - virtual QString description ( ) = 0; - + virtual QStyle *style() = 0; //! Return a short name for the style. - virtual QString name ( ) = 0; - - //! Return the library basename (libliquid.so => liquid) - virtual QCString key ( ) = 0; - - //! QT_VERSION like 1.2.3 == 123 - virtual unsigned int version ( ) = 0; + virtual QString name() const = 0; }; -struct StyleSettingsInterface : public QUnknownInterface +struct StyleExtendedInterface : public StyleInterface { + //! Return a (longer) description for the style. + virtual QString description ( ) = 0; + + //! Does this style support customization + virtual bool hasSettings ( ) const = 0; + //! Return a new settings page. virtual QWidget *create ( QWidget *parent, const char *name = 0 ) = 0; //! Callback for appearance app when OK is clicked (return true when style has to re-applied). virtual bool accept ( ) = 0; //! Callback for appeaeance app when Cancel is clicked. virtual void reject ( ) = 0; }; #endif |