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/metal') diff --git a/noncore/styles/metal/metal.pro b/noncore/styles/metal/metal.pro index 6e99389..cf15f33 100644 --- a/noncore/styles/metal/metal.pro +++ b/noncore/styles/metal/metal.pro @@ -2,7 +2,7 @@ TEMPLATE = lib CONFIG = qt embedded release warn_on SOURCES = metal.cpp plugin.cpp -HEADERS = metal.h +HEADERS = metal.h plugin.h LIBS += -lqpe INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/plugins/styles diff --git a/noncore/styles/metal/plugin.cpp b/noncore/styles/metal/plugin.cpp index e5bee10..1db4aac 100644 --- a/noncore/styles/metal/plugin.cpp +++ b/noncore/styles/metal/plugin.cpp @@ -1,29 +1,57 @@ #include "metal.h" +#include "plugin.h" -extern "C" { - QStyle* allocate ( ); - int minor_version ( ); - int major_version ( ); - const char *description ( ); +MetalInterface::MetalInterface ( ) : ref ( 0 ) +{ +} + +MetalInterface::~MetalInterface ( ) +{ +} + +QStyle *MetalInterface::create ( ) +{ + return new MetalStyle ( ); +} + +QString MetalInterface::name ( ) +{ + return QObject::tr( "Metal", "name" ); +} + +QString MetalInterface::description ( ) +{ + return QObject::tr( "Metal style", "description" ); } -QStyle* allocate ( ) +QCString MetalInterface::key ( ) { - return new MetalStyle ( ); + return QCString ( "metal" ); } -int minor_version ( ) +unsigned int MetalInterface::version ( ) { - return 0; + return 100; // 1.0.0 (\d+.\d.\d) } -int major_version ( ) +QRESULT MetalInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) { - return 1; + *iface = 0; + + if ( uuid == IID_QUnknown ) + *iface = this; + else if ( uuid == IID_Style ) + *iface = this; + + if ( *iface ) + (*iface)-> addRef ( ); + + return QS_OK; } -const char *description ( ) +Q_EXPORT_INTERFACE() { - return "Metal style plugin"; + Q_CREATE_INSTANCE( MetalInterface ) } + diff --git a/noncore/styles/metal/plugin.h b/noncore/styles/metal/plugin.h new file mode 100644 index 0000000..f61c833 --- a/dev/null +++ b/noncore/styles/metal/plugin.h @@ -0,0 +1,27 @@ +#ifndef __OPIE_METAL_PLUGIN_H__ +#define __OPIE_METAL_PLUGIN_H__ + +#include + + +class MetalInterface : public StyleInterface { +public: + MetalInterface ( ); + virtual ~MetalInterface ( ); + + QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); + Q_REFCOUNT + + virtual QStyle *create ( ); + + virtual QString description ( ); + virtual QString name ( ); + virtual QCString key ( ); + + virtual unsigned int version ( ); + +private: + ulong ref; +}; + +#endif -- cgit v0.9.0.2