-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 2 | ||||
-rw-r--r-- | noncore/styles/liquid/liquid.pro | 2 | ||||
-rw-r--r-- | noncore/styles/liquid/liquidset.cpp | 31 | ||||
-rw-r--r-- | noncore/styles/liquid/liquidset.h | 2 | ||||
-rw-r--r-- | noncore/styles/liquid/plugin.cpp | 81 | ||||
-rw-r--r-- | noncore/styles/liquid/plugin.h | 22 | ||||
-rw-r--r-- | noncore/styles/metal/plugin.cpp | 22 | ||||
-rw-r--r-- | noncore/styles/metal/plugin.h | 9 | ||||
-rw-r--r-- | noncore/styles/theme/plugin.cpp | 80 | ||||
-rw-r--r-- | noncore/styles/theme/plugin.h | 23 |
10 files changed, 69 insertions, 205 deletions
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 @@ -1,45 +1,45 @@ /*- * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. */ #ifndef INCLUDE_MENUITEM_DEF #define INCLUDE_MENUITEM_DEF #endif #include <qmenudata.h> #include "liquid.h" -#include "liquiddeco.h" +//#include "liquiddeco.h" #include <qapplication.h> #include <qpe/config.h> #include "effects.h" #include <qpalette.h> #include <qbitmap.h> #include <qtabbar.h> #include <qpopupmenu.h> #include <qobjectlist.h> #include <qimage.h> #include <qtimer.h> #include <qpixmapcache.h> #include <qradiobutton.h> #include <qcombobox.h> #include <qdrawutil.h> #include <qwidgetlist.h> #include <qtoolbutton.h> #include <qheader.h> #include <unistd.h> #include <qmenubar.h> #include <stdio.h> #include "htmlmasks.h" #include "embeddata.h" typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 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,34 +1,32 @@ 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 LIBS += -lqpe -lopie INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/plugins/styles TARGET = liquid VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libliquid.ts \ ../../../i18n/en/libliquid.ts \ ../../../i18n/es/libliquid.ts \ ../../../i18n/fr/libliquid.ts \ ../../../i18n/hu/libliquid.ts \ ../../../i18n/ja/libliquid.ts \ ../../../i18n/ko/libliquid.ts \ ../../../i18n/no/libliquid.ts \ ../../../i18n/pl/libliquid.ts \ ../../../i18n/pt/libliquid.ts \ ../../../i18n/pt_BR/libliquid.ts \ ../../../i18n/sl/libliquid.ts \ ../../../i18n/zh_CN/libliquid.ts \ ../../../i18n/zh_TW/libliquid.ts 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 @@ -9,192 +9,161 @@ ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "liquidset.h" #include "liquid.h" #include <qpe/qpeapplication.h> #include <qpe/global.h> #include <qslider.h> #include <qcombobox.h> #include <qradiobutton.h> #include <qcheckbox.h> #include <qlabel.h> #include <qlayout.h> #include <qpe/config.h> #include <opie/ocolorbutton.h> -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 ) { setCaption ( tr( "Liquid Style" ) ); Config config ( "qpe" ); config. setGroup ( "Liquid-Style" ); m_type = config. readNumEntry ( "Type", TransStippleBg ); QColor mcol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); 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 ); QVBoxLayout *vbox = new QVBoxLayout ( this ); vbox-> setSpacing ( 3 ); vbox-> setMargin ( 4 ); QComboBox *cb = new QComboBox ( this ); cb-> insertItem ( tr( "No translucency" ), None ); cb-> insertItem ( tr( "Stippled, background color" ), StippledBg ); cb-> insertItem ( tr( "Stippled, button color" ), StippledBtn ); cb-> insertItem ( tr( "Translucent stippled, background color" ), TransStippleBg ); cb-> insertItem ( tr( "Translucent stippled, button color" ), TransStippleBtn ); cb-> insertItem ( tr( "Custom translucency" ), Custom ); cb-> setCurrentItem ( m_type ); vbox-> addWidget ( cb ); QGridLayout *grid = new QGridLayout ( vbox ); grid-> addColSpacing ( 0, 16 ); grid-> addColSpacing ( 3, 8 ); grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 ); grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 ); grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 ); m_menubtn = new OColorButton ( this ); m_menubtn-> setColor ( mcol ); grid-> addWidget ( m_menubtn, 0, 2 ); m_textbtn = new OColorButton ( this ); m_textbtn-> setColor ( tcol ); grid-> addWidget ( m_textbtn, 0, 5 ); m_opacsld = new QSlider ( Horizontal, this ); m_opacsld-> setRange ( -20, 20 ); m_opacsld-> setValue ( opacity ); m_opacsld-> setTickmarks ( QSlider::Below ); grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); vbox-> addSpacing ( 4 ); QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this ); shadow-> setChecked ( m_shadow ); vbox-> addWidget ( shadow ); 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 ); vbox-> addSpacing ( 4 ); QHBoxLayout *hbox = new QHBoxLayout ( vbox ); hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this )); m_contsld = new QSlider ( Horizontal, this ); m_contsld-> setRange ( 0, 10 ); m_contsld-> setValue ( contrast ); m_contsld-> setTickmarks ( QSlider::Below ); hbox-> addWidget ( m_contsld, 10 ); vbox-> addStretch ( 10 ); changeType ( m_type ); 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 ) ) ); } void LiquidSettings::changeType ( int t ) { bool custom = ( t == Custom ); m_menulbl-> setEnabled ( custom ); m_textlbl-> setEnabled ( custom ); m_opaclbl-> setEnabled ( custom ); m_menubtn-> setEnabled ( custom ); m_textbtn-> setEnabled ( custom ); m_opacsld-> setEnabled ( custom ); m_type = t; } void LiquidSettings::changeShadow ( bool b ) { m_shadow = b; } -void LiquidSettings::changeDeco ( bool b ) -{ - m_deco = b; -} - void LiquidSettings::changeFlat ( bool b ) { m_flat = b; } bool LiquidSettings::writeConfig ( ) { Config config ( "qpe" ); config. setGroup ( "Liquid-Style" ); config. writeEntry ( "Type", m_type ); config. writeEntry ( "Color", m_menubtn-> color ( ). name ( )); 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 ( ); return true; } 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 @@ -1,39 +1,37 @@ #ifndef __OPIE_LIQUID_SET_H__ #define __OPIE_LIQUID_SET_H__ #include <qdialog.h> #include <qcolor.h> class QLabel; class OColorButton; class QSlider; class LiquidSettings : public QWidget { Q_OBJECT public: LiquidSettings ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); public slots: void changeType ( int t ); void changeShadow ( bool b ); - void changeDeco ( bool b ); void changeFlat ( bool b ); virtual bool writeConfig ( ); private: int m_type; bool m_shadow; - bool m_deco; bool m_flat; QSlider * m_opacsld; QSlider * m_contsld; QLabel * m_menulbl; QLabel * m_textlbl; QLabel * m_opaclbl; OColorButton *m_menubtn; OColorButton *m_textbtn; }; #endif 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,113 +1,84 @@ +#include <qapplication.h> + #include "liquid.h" #include "liquidset.h" #include "plugin.h" 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 ( ) -{ - 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() +QString LiquidInterface::name ( ) const { - Q_CREATE_INSTANCE( LiquidInterface ) + return qApp-> translate ( "Styles", "Liquid" ); } - -LiquidSettingsInterface::LiquidSettingsInterface ( ) : ref ( 0 ) +QString LiquidInterface::description ( ) const { - m_widget = 0; + return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" ); } -LiquidSettingsInterface::~LiquidSettingsInterface ( ) +bool LiquidInterface::hasSettings ( ) const { + return true; } -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; 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 ) (*iface)-> addRef ( ); 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 @@ -1,46 +1,34 @@ #ifndef __OPIE_LIQUID_PLUGIN_H__ #define __OPIE_LIQUID_PLUGIN_H__ #include <qpe/styleinterface.h> class LiquidSettings; -class LiquidInterface : public StyleInterface { +class LiquidInterface : public StyleExtendedInterface { public: LiquidInterface ( ); virtual ~LiquidInterface ( ); QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); Q_REFCOUNT - virtual QStyle *create ( ); + virtual QStyle *style ( ); - virtual QString description ( ); - virtual QString name ( ); - virtual QCString key ( ); + virtual QString name ( ) const; - virtual unsigned int version ( ); + virtual QString description ( ) const; -private: - ulong ref; -}; - -class LiquidSettingsInterface : public StyleSettingsInterface { -public: - LiquidSettingsInterface ( ); - virtual ~LiquidSettingsInterface ( ); - - QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); - Q_REFCOUNT + virtual bool hasSettings ( ) const; virtual QWidget *create ( QWidget *parent, const char *name = 0 ); virtual bool accept ( ); virtual void reject ( ); private: LiquidSettings *m_widget; ulong ref; }; #endif 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,57 +1,45 @@ +#include <qapplication.h> + #include "metal.h" #include "plugin.h" MetalInterface::MetalInterface ( ) : ref ( 0 ) { } 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 ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_Style ) *iface = this; if ( *iface ) (*iface)-> addRef ( ); return QS_OK; } Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( MetalInterface ) } 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 @@ -1,27 +1,22 @@ #ifndef __OPIE_METAL_PLUGIN_H__ #define __OPIE_METAL_PLUGIN_H__ #include <qpe/styleinterface.h> 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 ( ); + virtual QStyle *style ( ); + virtual QString name ( ) const; private: ulong ref; }; #endif 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,111 +1,81 @@ +#include <qapplication.h> + #include "othemestyle.h" #include "themeset.h" #include "plugin.h" 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 ( ) +QString ThemeInterface::name ( ) const { - return QCString ( "theme" ); + return qApp-> translate ( "Styles", "Themed style" ); } -unsigned int ThemeInterface::version ( ) +QString ThemeInterface::description ( ) const { - return 100; // 1.0.0 (\d+.\d.\d) + return qApp-> translate ( "Styles", "KDE2 theme compatible style engine" ); } -QRESULT ThemeInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) +bool ThemeInterface::hasSettings ( ) 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 true; } -Q_EXPORT_INTERFACE() -{ - Q_CREATE_INSTANCE( ThemeInterface ) -} - - -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; 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 ) (*iface)-> addRef ( ); 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 @@ -1,46 +1,33 @@ #ifndef __OPIE_THEME_PLUGIN_H__ #define __OPIE_THEME_PLUGIN_H__ #include <qpe/styleinterface.h> class ThemeSettings; -class ThemeInterface : public StyleInterface { +class ThemeInterface : public StyleExtendedInterface { public: ThemeInterface ( ); virtual ~ThemeInterface ( ); 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 ( ); - -private: - ulong ref; -}; - -class ThemeSettingsInterface : public StyleSettingsInterface { -public: - ThemeSettingsInterface ( ); - virtual ~ThemeSettingsInterface ( ); - - QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); - Q_REFCOUNT + virtual bool hasSettings ( ) const; virtual QWidget *create ( QWidget *parent, const char *name = 0 ); virtual bool accept ( ); virtual void reject ( ); private: ThemeSettings *m_widget; ulong ref; }; #endif |