author | sandman <sandman> | 2002-07-06 16:42:29 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-07-06 16:42:29 (UTC) |
commit | 3a422983abc7342c9229dccac825d0608fca10f3 (patch) (side-by-side diff) | |
tree | fd0d71eab4df0b286b78efe24184525ae4c819a3 /noncore/styles/liquid | |
parent | 8beb5fcdbca8110dc586a7e620bf8eae892087fb (diff) | |
download | opie-3a422983abc7342c9229dccac825d0608fca10f3.zip opie-3a422983abc7342c9229dccac825d0608fca10f3.tar.gz opie-3a422983abc7342c9229dccac825d0608fca10f3.tar.bz2 |
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)
-rw-r--r-- | noncore/styles/liquid/liquid.pro | 6 | ||||
-rw-r--r-- | noncore/styles/liquid/liquidset.cpp (renamed from noncore/styles/liquid/settings/liquidset.cpp) | 26 | ||||
-rw-r--r-- | noncore/styles/liquid/liquidset.h (renamed from noncore/styles/liquid/settings/liquidset.h) | 7 | ||||
-rw-r--r-- | noncore/styles/liquid/opie-liquid.control | 2 | ||||
-rw-r--r-- | noncore/styles/liquid/plugin.cpp | 108 | ||||
-rw-r--r-- | noncore/styles/liquid/plugin.h | 46 | ||||
-rw-r--r-- | noncore/styles/liquid/settings/.cvsignore | 2 | ||||
-rw-r--r-- | noncore/styles/liquid/settings/main.cpp | 34 | ||||
-rw-r--r-- | noncore/styles/liquid/settings/settings.pro | 24 |
9 files changed, 162 insertions, 93 deletions
diff --git a/noncore/styles/liquid/liquid.pro b/noncore/styles/liquid/liquid.pro index 23dce09..a07eaf2 100644 --- a/noncore/styles/liquid/liquid.pro +++ b/noncore/styles/liquid/liquid.pro @@ -3,11 +3,15 @@ CONFIG = qt embedded release warn_on SOURCES = liquid.cpp \ liquiddeco.cpp \ effects.cpp \ + liquidset.cpp \ plugin.cpp HEADERS = liquid.h \ liquiddeco.h \ - effects.h + effects.h \ + liquidset.h \ + plugin.h + LIBS += -lqpe INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/plugins/styles diff --git a/noncore/styles/liquid/settings/liquidset.cpp b/noncore/styles/liquid/liquidset.cpp index 1479ac0..5ae19ba 100644 --- a/noncore/styles/liquid/settings/liquidset.cpp +++ b/noncore/styles/liquid/liquidset.cpp @@ -21,7 +21,7 @@ #include "liquidset.h" -#include "../liquid.h" +#include "liquid.h" #include <qpe/qpeapplication.h> #include <qpe/global.h> @@ -57,8 +57,8 @@ static void changeButtonColor ( QWidget *btn, const QColor &col ) } -LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl ) - : QDialog ( parent, name, fl ) +LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) + : QWidget ( parent, name, fl ) { setCaption ( tr( "Liquid Style" ) ); @@ -122,7 +122,7 @@ LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl ) QPopupMenu *popup; - popup = new ColorPopupMenu ( m_menucol, this ); + popup = new ColorPopupMenu ( m_menucol, 0 ); m_menubtn-> setPopup ( popup ); m_menubtn-> setPopupDelay ( 0 ); connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeMenuColor ( const QColor & ))); @@ -131,7 +131,7 @@ LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl ) m_textbtn = new QToolButton ( this ); grid-> addWidget ( m_textbtn, 0, 5 ); - popup = new ColorPopupMenu ( m_textcol, this ); + popup = new ColorPopupMenu ( m_textcol, 0 ); m_textbtn-> setPopup ( popup ); m_textbtn-> setPopupDelay ( 0 ); connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeTextColor ( const QColor & ))); @@ -176,7 +176,7 @@ LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl ) connect ( windeco, SIGNAL( toggled ( bool ) ), this, SLOT( changeDeco ( bool ) ) ); } -void LiquidSet::changeType ( int t ) +void LiquidSettings::changeType ( int t ) { bool custom = ( t == Custom ); @@ -190,30 +190,30 @@ void LiquidSet::changeType ( int t ) m_type = t; } -void LiquidSet::changeMenuColor ( const QColor &col ) +void LiquidSettings::changeMenuColor ( const QColor &col ) { changeButtonColor ( m_menubtn, col ); m_menucol = col; } -void LiquidSet::changeTextColor ( const QColor &col ) +void LiquidSettings::changeTextColor ( const QColor &col ) { changeButtonColor ( m_textbtn, col ); m_textcol = col; } -void LiquidSet::changeShadow ( bool b ) +void LiquidSettings::changeShadow ( bool b ) { m_shadow = b; } -void LiquidSet::changeDeco ( bool b ) +void LiquidSettings::changeDeco ( bool b ) { m_deco = b; } -void LiquidSet::accept ( ) +bool LiquidSettings::writeConfig ( ) { Config config ( "qpe" ); config. setGroup ( "Liquid-Style" ); @@ -227,8 +227,6 @@ void LiquidSet::accept ( ) config. writeEntry ( "StippleContrast", m_contsld-> value ( )); config. write ( ); - Global::applyStyle ( ); - - QDialog::accept ( ); + return true; } diff --git a/noncore/styles/liquid/settings/liquidset.h b/noncore/styles/liquid/liquidset.h index a0f590a..7843513 100644 --- a/noncore/styles/liquid/settings/liquidset.h +++ b/noncore/styles/liquid/liquidset.h @@ -8,11 +8,11 @@ class QLabel; class QToolButton; class QSlider; -class LiquidSet : public QDialog { +class LiquidSettings : public QWidget { Q_OBJECT public: - LiquidSet ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); + LiquidSettings ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); public slots: void changeType ( int t ); @@ -21,8 +21,7 @@ public slots: void changeShadow ( bool b ); void changeDeco ( bool b ); -protected: - virtual void accept ( ); + virtual bool writeConfig ( ); private: QColor m_menucol; diff --git a/noncore/styles/liquid/opie-liquid.control b/noncore/styles/liquid/opie-liquid.control index 6311dee..7b6ae71 100644 --- a/noncore/styles/liquid/opie-liquid.control +++ b/noncore/styles/liquid/opie-liquid.control @@ -1,4 +1,4 @@ -Files: plugins/styles/libliquid.so* bin/liquid-settings apps/Settings/Liquid.desktop pics/liquid/Liquid.png +Files: plugins/styles/libliquid.so* Priority: optional Section: opie/system Maintainer: Robert Griebl <sandman@handhelds.org> 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; } + diff --git a/noncore/styles/liquid/plugin.h b/noncore/styles/liquid/plugin.h new file mode 100644 index 0000000..759577f --- a/dev/null +++ b/noncore/styles/liquid/plugin.h @@ -0,0 +1,46 @@ +#ifndef __OPIE_LIQUID_PLUGIN_H__ +#define __OPIE_LIQUID_PLUGIN_H__ + +#include <qpe/styleinterface.h> + +class LiquidSettings; + +class LiquidInterface : public StyleInterface { +public: + LiquidInterface ( ); + virtual ~LiquidInterface ( ); + + 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; +}; + +class LiquidSettingsInterface : public StyleSettingsInterface { +public: + LiquidSettingsInterface ( ); + virtual ~LiquidSettingsInterface ( ); + + 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; +}; + +#endif diff --git a/noncore/styles/liquid/settings/.cvsignore b/noncore/styles/liquid/settings/.cvsignore deleted file mode 100644 index c13418b..0000000 --- a/noncore/styles/liquid/settings/.cvsignore +++ b/dev/null @@ -1,2 +0,0 @@ -Makefile* -moc_* diff --git a/noncore/styles/liquid/settings/main.cpp b/noncore/styles/liquid/settings/main.cpp deleted file mode 100644 index fd69007..0000000 --- a/noncore/styles/liquid/settings/main.cpp +++ b/dev/null @@ -1,34 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** 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 <qpe/qpeapplication.h> - - -int main ( int argc, char** argv ) -{ - QPEApplication a ( argc, argv ); - - LiquidSet dlg; - a. showMainWidget ( &dlg ); - - return a. exec ( ); -} diff --git a/noncore/styles/liquid/settings/settings.pro b/noncore/styles/liquid/settings/settings.pro deleted file mode 100644 index bfda7a4..0000000 --- a/noncore/styles/liquid/settings/settings.pro +++ b/dev/null @@ -1,24 +0,0 @@ -TEMPLATE = app -CONFIG += qt warn_on release -DESTDIR = $(OPIEDIR)/bin -HEADERS = liquidset.h -SOURCES = liquidset.cpp main.cpp -INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += ../$(OPIEDIR)/include -LIBS += -lqpe -lopie -TARGET = liquid-settings - -TRANSLATIONS = ../../../../i18n/de/liquid-settings.ts \ - ../../../../i18n/en/liquid-settings.ts \ - ../../../../i18n/es/liquid-settings.ts \ - ../../../../i18n/fr/liquid-settings.ts \ - ../../../../i18n/hu/liquid-settings.ts \ - ../../../../i18n/ja/liquid-settings.ts \ - ../../../../i18n/ko/liquid-settings.ts \ - ../../../../i18n/no/liquid-settings.ts \ - ../../../../i18n/pl/liquid-settings.ts \ - ../../../../i18n/pt/liquid-settings.ts \ - ../../../../i18n/pt_BR/liquid-settings.ts \ - ../../../../i18n/sl/liquid-settings.ts \ - ../../../../i18n/zh_CN/liquid-settings.ts \ - ../../../../i18n/zh_TW/liquid-settings.ts |