From 4a6ccb87f45065bc37f801adb61c3462f870cb92 Mon Sep 17 00:00:00 2001 From: sandman Date: Fri, 04 Oct 2002 01:42:57 +0000 Subject: - ported all OPIE styles to the new Qtopia compatible style interface - some cleanup in liquid (unused code) --- (limited to 'noncore/styles/theme') diff --git a/noncore/styles/theme/plugin.cpp b/noncore/styles/theme/plugin.cpp index 4383693..2560720 100644 --- a/noncore/styles/theme/plugin.cpp +++ b/noncore/styles/theme/plugin.cpp @@ -1,3 +1,5 @@ +#include + #include "othemestyle.h" #include "themeset.h" #include "plugin.h" @@ -6,82 +8,41 @@ ThemeInterface::ThemeInterface ( ) : ref ( 0 ) { + m_widget = 0; } ThemeInterface::~ThemeInterface ( ) { } -QStyle *ThemeInterface::create ( ) +QStyle *ThemeInterface::style ( ) { return new OThemeStyle ( "" ); } -QString ThemeInterface::name ( ) -{ - return QObject::tr( "Themed style", "name" ); -} - -QString ThemeInterface::description ( ) -{ - return QObject::tr( "KDE2 theme compatible style engine", "description" ); -} - -QCString ThemeInterface::key ( ) -{ - return QCString ( "theme" ); -} - -unsigned int ThemeInterface::version ( ) +QString ThemeInterface::name ( ) const { - return 100; // 1.0.0 (\d+.\d.\d) + return qApp-> translate ( "Styles", "Themed style" ); } -QRESULT ThemeInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) +QString ThemeInterface::description ( ) const { - static ThemeSettingsInterface *setiface = 0; - - *iface = 0; - - if ( uuid == IID_QUnknown ) - *iface = this; - else if ( uuid == IID_Style ) - *iface = this; - else if ( uuid == IID_StyleSettings ) { - if ( !setiface ) - setiface = new ThemeSettingsInterface ( ); - *iface = setiface; - } - - if ( *iface ) - (*iface)-> addRef ( ); - - return QS_OK; + return qApp-> translate ( "Styles", "KDE2 theme compatible style engine" ); } -Q_EXPORT_INTERFACE() +bool ThemeInterface::hasSettings ( ) const { - Q_CREATE_INSTANCE( ThemeInterface ) + return true; } - -ThemeSettingsInterface::ThemeSettingsInterface ( ) : ref ( 0 ) -{ - m_widget = 0; -} - -ThemeSettingsInterface::~ThemeSettingsInterface ( ) -{ -} - -QWidget *ThemeSettingsInterface::create ( QWidget *parent, const char *name ) +QWidget *ThemeInterface::create ( QWidget *parent, const char *name ) { m_widget = new ThemeSettings ( parent, name ? name : "THEME-SETTINGS" ); return m_widget; } -bool ThemeSettingsInterface::accept ( ) +bool ThemeInterface::accept ( ) { if ( !m_widget ) return false; @@ -89,18 +50,20 @@ bool ThemeSettingsInterface::accept ( ) return m_widget-> writeConfig ( ); } -void ThemeSettingsInterface::reject ( ) +void ThemeInterface::reject ( ) { } -QRESULT ThemeSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) + +QRESULT ThemeInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; - if ( uuid == IID_QUnknown ) *iface = this; - else if ( uuid == IID_StyleSettings ) + else if ( uuid == IID_Style ) + *iface = this; + else if ( uuid == IID_StyleExtended ) *iface = this; if ( *iface ) @@ -109,3 +72,10 @@ QRESULT ThemeSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInte return QS_OK; } +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( ThemeInterface ) +} + + + diff --git a/noncore/styles/theme/plugin.h b/noncore/styles/theme/plugin.h index d13fc5d..60cae97 100644 --- a/noncore/styles/theme/plugin.h +++ b/noncore/styles/theme/plugin.h @@ -5,7 +5,7 @@ class ThemeSettings; -class ThemeInterface : public StyleInterface { +class ThemeInterface : public StyleExtendedInterface { public: ThemeInterface ( ); virtual ~ThemeInterface ( ); @@ -13,26 +13,13 @@ public: QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); Q_REFCOUNT - virtual QStyle *create ( ); + virtual QStyle *style ( ); + virtual QString name ( ) const; - virtual QString description ( ); - virtual QString name ( ); - virtual QCString key ( ); + virtual QString description ( ) const; - virtual unsigned int version ( ); + virtual bool hasSettings ( ) const; -private: - ulong ref; -}; - -class ThemeSettingsInterface : public StyleSettingsInterface { -public: - ThemeSettingsInterface ( ); - virtual ~ThemeSettingsInterface ( ); - - QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); - Q_REFCOUNT - virtual QWidget *create ( QWidget *parent, const char *name = 0 ); virtual bool accept ( ); -- cgit v0.9.0.2