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/liquid/plugin.cpp') diff --git a/noncore/styles/liquid/plugin.cpp b/noncore/styles/liquid/plugin.cpp index d9aa8ef..f149c29 100644 --- a/noncore/styles/liquid/plugin.cpp +++ b/noncore/styles/liquid/plugin.cpp @@ -1,29 +1,111 @@ #include "liquid.h" +#include "liquidset.h" +#include "plugin.h" -extern "C" { - QStyle* allocate ( ); - int minor_version ( ); - int major_version ( ); - const char *description ( ); + +LiquidInterface::LiquidInterface ( ) : ref ( 0 ) +{ +} + +LiquidInterface::~LiquidInterface ( ) +{ +} + +QStyle *LiquidInterface::create ( ) +{ + return new LiquidStyle ( ); +} + +QString LiquidInterface::name ( ) +{ + return QObject::tr( "Liquid", "name" ); +} + +QString LiquidInterface::description ( ) +{ + return QObject::tr( "High Performance Liquid style by Mosfet", "description" ); +} + +QCString LiquidInterface::key ( ) +{ + return QCString ( "liquid" ); +} + +unsigned int LiquidInterface::version ( ) +{ + return 100; // 1.0.0 (\d+.\d.\d) +} + +QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) +{ + static LiquidSettingsInterface *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 LiquidSettingsInterface ( ); + *iface = setiface; + } + + if ( *iface ) + (*iface)-> addRef ( ); + + return QS_OK; +} + +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( LiquidInterface ) } -QStyle* allocate ( ) + +LiquidSettingsInterface::LiquidSettingsInterface ( ) : ref ( 0 ) +{ + m_widget = 0; +} + +LiquidSettingsInterface::~LiquidSettingsInterface ( ) { - return new LiquidStyle ( ); +} + +QWidget *LiquidSettingsInterface::create ( QWidget *parent, const char *name ) +{ + m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); + + return m_widget; } -int minor_version ( ) +bool LiquidSettingsInterface::accept ( ) { - return 0; + if ( !m_widget ) + return false; + + return m_widget-> writeConfig ( ); } -int major_version ( ) +void LiquidSettingsInterface::reject ( ) { - return 1; } -const char *description ( ) +QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) { - return "High Performance Liquid"; + *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