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') diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 0d9d259..1d01c65 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp @@ -10,7 +10,7 @@ #include #include "liquid.h" -#include "liquiddeco.h" +//#include "liquiddeco.h" #include #include #include "effects.h" diff --git a/noncore/styles/liquid/liquid.pro b/noncore/styles/liquid/liquid.pro index ed1c2f1..0e3716f 100644 --- a/noncore/styles/liquid/liquid.pro +++ b/noncore/styles/liquid/liquid.pro @@ -1,13 +1,11 @@ TEMPLATE = lib CONFIG = qt embedded release warn_on SOURCES = liquid.cpp \ - liquiddeco.cpp \ effects.cpp \ liquidset.cpp \ plugin.cpp HEADERS = liquid.h \ - liquiddeco.h \ effects.h \ liquidset.h \ plugin.h diff --git a/noncore/styles/liquid/liquidset.cpp b/noncore/styles/liquid/liquidset.cpp index 4fffe12..ea0b3c9 100644 --- a/noncore/styles/liquid/liquidset.cpp +++ b/noncore/styles/liquid/liquidset.cpp @@ -38,23 +38,6 @@ #include -static void changeButtonColor ( QWidget *btn, const QColor &col ) -{ - QPalette pal = btn-> palette ( ); - - pal. setColor ( QPalette::Normal, QColorGroup::Button, col ); - pal. setColor ( QPalette::Active, QColorGroup::Button, col ); - pal. setColor ( QPalette::Disabled, QColorGroup::Button, col ); - pal. setColor ( QPalette::Inactive, QColorGroup::Button, col ); - pal. setColor ( QPalette::Normal, QColorGroup::Background, col ); - pal. setColor ( QPalette::Active, QColorGroup::Background, col ); - pal. setColor ( QPalette::Disabled, QColorGroup::Background, col ); - pal. setColor ( QPalette::Inactive, QColorGroup::Background, col ); - - btn-> setPalette ( pal ); -} - - LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) { @@ -68,7 +51,6 @@ LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) QColor tcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( ))); int opacity = config. readNumEntry ( "Opacity", 10 ); m_shadow = config. readBoolEntry ( "ShadowText", true ); - m_deco = config. readBoolEntry ( "WinDecoration", true ); int contrast = config. readNumEntry ( "StippleContrast", 5 ); m_flat = config. readBoolEntry ( "FlatToolButtons", false ); @@ -118,12 +100,6 @@ LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) vbox-> addSpacing ( 4 ); - QCheckBox *windeco = new QCheckBox ( tr( "Draw liquid window title bars" ), this ); - windeco-> setChecked ( m_deco ); - vbox-> addWidget ( windeco ); - - vbox-> addSpacing ( 4 ); - QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this ); flattb-> setChecked ( m_flat ); vbox-> addWidget ( flattb ); @@ -146,7 +122,6 @@ LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) connect ( cb, SIGNAL( highlighted ( int ) ), this, SLOT( changeType ( int ) ) ); connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); - connect ( windeco, SIGNAL( toggled ( bool ) ), this, SLOT( changeDeco ( bool ) ) ); connect ( flattb, SIGNAL( toggled ( bool ) ), this, SLOT( changeFlat ( bool ) ) ); } @@ -169,11 +144,6 @@ void LiquidSettings::changeShadow ( bool b ) m_shadow = b; } -void LiquidSettings::changeDeco ( bool b ) -{ - m_deco = b; -} - void LiquidSettings::changeFlat ( bool b ) { m_flat = b; @@ -190,7 +160,6 @@ bool LiquidSettings::writeConfig ( ) config. writeEntry ( "TextColor", m_textbtn-> color ( ). name ( )); config. writeEntry ( "Opacity", m_opacsld-> value ( )); config. writeEntry ( "ShadowText", m_shadow ); - config. writeEntry ( "WinDecoration", m_deco ); config. writeEntry ( "StippleContrast", m_contsld-> value ( )); config. writeEntry ( "FlatToolButtons", m_flat ); config. write ( ); diff --git a/noncore/styles/liquid/liquidset.h b/noncore/styles/liquid/liquidset.h index 8a03447..6d9555a 100644 --- a/noncore/styles/liquid/liquidset.h +++ b/noncore/styles/liquid/liquidset.h @@ -17,7 +17,6 @@ public: public slots: void changeType ( int t ); void changeShadow ( bool b ); - void changeDeco ( bool b ); void changeFlat ( bool b ); virtual bool writeConfig ( ); @@ -25,7 +24,6 @@ public slots: private: int m_type; bool m_shadow; - bool m_deco; bool m_flat; QSlider * m_opacsld; diff --git a/noncore/styles/liquid/plugin.cpp b/noncore/styles/liquid/plugin.cpp index 5f4c8e5..0740420 100644 --- a/noncore/styles/liquid/plugin.cpp +++ b/noncore/styles/liquid/plugin.cpp @@ -1,3 +1,5 @@ +#include + #include "liquid.h" #include "liquidset.h" #include "plugin.h" @@ -6,82 +8,41 @@ LiquidInterface::LiquidInterface ( ) : ref ( 0 ) { + m_widget = 0; } LiquidInterface::~LiquidInterface ( ) { } -QStyle *LiquidInterface::create ( ) +QStyle *LiquidInterface::style ( ) { 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 ( ) +QString LiquidInterface::name ( ) const { - return QCString ( "liquid" ); + return qApp-> translate ( "Styles", "Liquid" ); } -unsigned int LiquidInterface::version ( ) +QString LiquidInterface::description ( ) const { - return 100; // 1.0.0 (\d+.\d.\d) + return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" ); } -QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) +bool LiquidInterface::hasSettings ( ) const { - 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; + return true; } -Q_EXPORT_INTERFACE() -{ - Q_CREATE_INSTANCE( LiquidInterface ) -} - - -LiquidSettingsInterface::LiquidSettingsInterface ( ) : ref ( 0 ) -{ - m_widget = 0; -} - -LiquidSettingsInterface::~LiquidSettingsInterface ( ) -{ -} - -QWidget *LiquidSettingsInterface::create ( QWidget *parent, const char *name ) +QWidget *LiquidInterface::create ( QWidget *parent, const char *name ) { m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); return m_widget; } -bool LiquidSettingsInterface::accept ( ) +bool LiquidInterface::accept ( ) { if ( !m_widget ) return false; @@ -89,18 +50,20 @@ bool LiquidSettingsInterface::accept ( ) return m_widget-> writeConfig ( ); } -void LiquidSettingsInterface::reject ( ) +void LiquidInterface::reject ( ) { } -QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) + +QRESULT LiquidInterface::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,5 +72,13 @@ QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInt return QS_OK; } +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( LiquidInterface ) +} + + + + // Hack for Retail Z experiments extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } diff --git a/noncore/styles/liquid/plugin.h b/noncore/styles/liquid/plugin.h index 759577f..6a9b7ac 100644 --- a/noncore/styles/liquid/plugin.h +++ b/noncore/styles/liquid/plugin.h @@ -5,7 +5,7 @@ class LiquidSettings; -class LiquidInterface : public StyleInterface { +class LiquidInterface : public StyleExtendedInterface { public: LiquidInterface ( ); virtual ~LiquidInterface ( ); @@ -13,31 +13,19 @@ public: QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); Q_REFCOUNT - virtual QStyle *create ( ); + virtual QStyle *style ( ); - virtual QString description ( ); - virtual QString name ( ); - virtual QCString key ( ); - - virtual unsigned int version ( ); - -private: - ulong ref; -}; + virtual QString name ( ) const; -class LiquidSettingsInterface : public StyleSettingsInterface { -public: - LiquidSettingsInterface ( ); - virtual ~LiquidSettingsInterface ( ); + virtual QString description ( ) const; + + virtual bool hasSettings ( ) const; - QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); - Q_REFCOUNT - virtual QWidget *create ( QWidget *parent, const char *name = 0 ); virtual bool accept ( ); virtual void reject ( ); - + private: LiquidSettings *m_widget; ulong ref; diff --git a/noncore/styles/metal/plugin.cpp b/noncore/styles/metal/plugin.cpp index 1db4aac..4c9f64d 100644 --- a/noncore/styles/metal/plugin.cpp +++ b/noncore/styles/metal/plugin.cpp @@ -1,3 +1,5 @@ +#include + #include "metal.h" #include "plugin.h" @@ -10,30 +12,16 @@ MetalInterface::~MetalInterface ( ) { } -QStyle *MetalInterface::create ( ) +QStyle *MetalInterface::style ( ) { return new MetalStyle ( ); } -QString MetalInterface::name ( ) +QString MetalInterface::name ( ) const { - return QObject::tr( "Metal", "name" ); + return qApp-> translate ( "Styles", "Metal" ); } -QString MetalInterface::description ( ) -{ - return QObject::tr( "Metal style", "description" ); -} - -QCString MetalInterface::key ( ) -{ - return QCString ( "metal" ); -} - -unsigned int MetalInterface::version ( ) -{ - return 100; // 1.0.0 (\d+.\d.\d) -} QRESULT MetalInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) { diff --git a/noncore/styles/metal/plugin.h b/noncore/styles/metal/plugin.h index f61c833..545aea9 100644 --- a/noncore/styles/metal/plugin.h +++ b/noncore/styles/metal/plugin.h @@ -12,13 +12,8 @@ public: QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); Q_REFCOUNT - virtual QStyle *create ( ); - - virtual QString description ( ); - virtual QString name ( ); - virtual QCString key ( ); - - virtual unsigned int version ( ); + virtual QStyle *style ( ); + virtual QString name ( ) const; private: ulong ref; 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