From 3a422983abc7342c9229dccac825d0608fca10f3 Mon Sep 17 00:00:00 2001 From: sandman Date: Sat, 06 Jul 2002 16:42:29 +0000 Subject: Complete renovation of the external style API: - created two QCom interfaces in "styleinterface.h" - moved the liquid/theme settings apps into the plugins - modified the plugin interface for all three styles - extended appearance to fully support the new API (replaces the settings apps) Additional work: - made a workaround in appearance for a Qt Bug -- now a QDialog again (this should really be fixed in Qt, but Z won't work that way) --- (limited to 'noncore/styles/theme/plugin.cpp') 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 @@ -//#include #include "othemestyle.h" +#include "themeset.h" +#include "plugin.h" -extern "C" + + +ThemeInterface::ThemeInterface ( ) : ref ( 0 ) { - QStyle * allocate() { - return new OThemeStyle ( "" ); - } - int minor_version() { - return 0; - } - int major_version() { - return 1; - } - const char * description() { - return ( "Theme Style" ); +} + +ThemeInterface::~ThemeInterface ( ) +{ +} + +QStyle *ThemeInterface::create ( ) +{ + 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 ( ) +{ + return 100; // 1.0.0 (\d+.\d.\d) +} + +QRESULT ThemeInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) +{ + 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; +} + +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( ThemeInterface ) +} + + +ThemeSettingsInterface::ThemeSettingsInterface ( ) : ref ( 0 ) +{ + m_widget = 0; +} + +ThemeSettingsInterface::~ThemeSettingsInterface ( ) +{ +} + +QWidget *ThemeSettingsInterface::create ( QWidget *parent, const char *name ) +{ + m_widget = new ThemeSettings ( parent, name ? name : "THEME-SETTINGS" ); + + return m_widget; +} + +bool ThemeSettingsInterface::accept ( ) +{ + if ( !m_widget ) + return false; + + return m_widget-> writeConfig ( ); +} + +void ThemeSettingsInterface::reject ( ) +{ +} + +QRESULT ThemeSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) +{ + *iface = 0; + + + if ( uuid == IID_QUnknown ) + *iface = this; + else if ( uuid == IID_StyleSettings ) + *iface = this; + + if ( *iface ) + (*iface)-> addRef ( ); + + return QS_OK; } -- cgit v0.9.0.2