21 files changed, 412 insertions, 206 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 @@ -1,30 +1,34 @@ 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 + effects.h \ + liquidset.h \ + plugin.h + LIBS += -lqpe 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/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 @@ -1,85 +1,85 @@ /********************************************************************** ** 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 "../liquid.h" +#include "liquid.h" #include <qpe/qpeapplication.h> #include <qpe/global.h> #include <qslider.h> #include <qtoolbutton.h> #include <qbuttongroup.h> #include <qradiobutton.h> #include <qcheckbox.h> #include <qlabel.h> #include <qlayout.h> #include <qpalette.h> #include <qpe/config.h> #include <opie/colorpopupmenu.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 ); } -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" ) ); Config config ( "qpe" ); config. setGroup ( "Liquid-Style" ); m_type = config. readNumEntry ( "Type", TransStippleBg ); m_menucol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); m_textcol = 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 ); QVBoxLayout *vbox = new QVBoxLayout ( this ); vbox-> setSpacing ( 3 ); vbox-> setMargin ( 6 ); QButtonGroup *btngrp = new QButtonGroup ( this ); btngrp-> hide ( ); QRadioButton *rad; rad = new QRadioButton ( tr( "No translucency" ), this ); @@ -101,134 +101,132 @@ LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl ) rad = new QRadioButton ( tr( "Translucent stippled, button color" ), this ); btngrp-> insert ( rad, TransStippleBtn ); vbox-> addWidget ( rad ); rad = new QRadioButton ( tr( "Custom translucency" ), this ); btngrp-> insert ( rad, Custom ); vbox-> addWidget ( rad ); btngrp-> setExclusive ( true ); btngrp-> setButton ( m_type ); 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 QToolButton ( this ); grid-> addWidget ( m_menubtn, 0, 2 ); 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 & ))); changeMenuColor ( m_menucol ); 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 & ))); changeTextColor ( m_textcol ); 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 ); 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 ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( changeType ( int ) ) ); connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); connect ( windeco, SIGNAL( toggled ( bool ) ), this, SLOT( changeDeco ( bool ) ) ); } -void LiquidSet::changeType ( int t ) +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 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" ); config. writeEntry ( "Type", m_type ); config. writeEntry ( "Color", m_menucol. name ( )); config. writeEntry ( "TextColor", m_textcol. name ( )); config. writeEntry ( "Opacity", m_opacsld-> value ( )); config. writeEntry ( "ShadowText", m_shadow ); config. writeEntry ( "WinDecoration", m_deco ); 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 @@ -1,42 +1,41 @@ #ifndef __OPIE_LIQUID_SET_H__ #define __OPIE_LIQUID_SET_H__ #include <qdialog.h> #include <qcolor.h> 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 ); void changeMenuColor ( const QColor &col ); void changeTextColor ( const QColor &col ); void changeShadow ( bool b ); void changeDeco ( bool b ); -protected: - virtual void accept ( ); + virtual bool writeConfig ( ); private: QColor m_menucol; QColor m_textcol; int m_type; bool m_shadow; bool m_deco; QSlider * m_opacsld; QSlider * m_contsld; QLabel * m_menulbl; QLabel * m_textlbl; QLabel * m_opaclbl; QToolButton *m_menubtn; QToolButton *m_textbtn; }; #endif 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,10 +1,10 @@ -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> Architecture: arm Version: $QPE_VERSION-$SUB_VERSION.1 Depends: opie-base ($QPE_VERSION) Description: Liquid style by Mosfet. Mosfet's well known Liquid GUI style from KDE, ported to OPIE. 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 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 @@ -1,25 +1,25 @@ 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 TARGET = metal VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libmetal.ts \ ../../../i18n/en/libmetal.ts \ ../../../i18n/es/libmetal.ts \ ../../../i18n/fr/libmetal.ts \ ../../../i18n/hu/libmetal.ts \ ../../../i18n/ja/libmetal.ts \ ../../../i18n/ko/libmetal.ts \ ../../../i18n/no/libmetal.ts \ ../../../i18n/pl/libmetal.ts \ ../../../i18n/pt/libmetal.ts \ ../../../i18n/pt_BR/libmetal.ts \ ../../../i18n/sl/libmetal.ts \ ../../../i18n/zh_CN/libmetal.ts \ ../../../i18n/zh_TW/libmetal.ts 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 <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 ( ); + +private: + ulong ref; +}; + +#endif diff --git a/noncore/styles/theme/opie-theme.control b/noncore/styles/theme/opie-theme.control index 02739fb..adb4f4b 100644 --- a/noncore/styles/theme/opie-theme.control +++ b/noncore/styles/theme/opie-theme.control @@ -1,11 +1,11 @@ -Files: plugins/styles/libtheme.so* bin/theme-settings apps/Settings/Theme.desktop pics/theme/Theme.png +Files: plugins/styles/libtheme.so* Priority: optional Section: opie/system Maintainer: Robert Griebl <sandman@handhelds.org> Architecture: arm Version: $QPE_VERSION-$SUB_VERSION.1 Depends: opie-base ($QPE_VERSION) Description: Themed style. This style accepts all themes written for KDE 2.2 diff --git a/noncore/styles/theme/plugin.cpp b/noncore/styles/theme/plugin.cpp index b334357..4383693 100644 --- a/noncore/styles/theme/plugin.cpp +++ b/noncore/styles/theme/plugin.cpp @@ -1,19 +1,111 @@ -//#include <klocale.h> #include "othemestyle.h" +#include "themeset.h" +#include "plugin.h" -extern "C" + + +ThemeInterface::ThemeInterface ( ) : ref ( 0 ) { - QStyle * allocate() { - return new OThemeStyle ( "" ); - } - int minor_version() { - return 0; - } - int major_version() { - return 1; - } - const char * description() { - return ( "Theme Style" ); +} + +ThemeInterface::~ThemeInterface ( ) +{ +} + +QStyle *ThemeInterface::create ( ) +{ + 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 ( ) +{ + return 100; // 1.0.0 (\d+.\d.\d) +} + +QRESULT ThemeInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) +{ + 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; +} + +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( ThemeInterface ) +} + + +ThemeSettingsInterface::ThemeSettingsInterface ( ) : ref ( 0 ) +{ + m_widget = 0; +} + +ThemeSettingsInterface::~ThemeSettingsInterface ( ) +{ +} + +QWidget *ThemeSettingsInterface::create ( QWidget *parent, const char *name ) +{ + m_widget = new ThemeSettings ( parent, name ? name : "THEME-SETTINGS" ); + + return m_widget; +} + +bool ThemeSettingsInterface::accept ( ) +{ + if ( !m_widget ) + return false; + + return m_widget-> writeConfig ( ); +} + +void ThemeSettingsInterface::reject ( ) +{ +} + +QRESULT ThemeSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) +{ + *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/theme/plugin.h b/noncore/styles/theme/plugin.h new file mode 100644 index 0000000..d13fc5d --- a/dev/null +++ b/noncore/styles/theme/plugin.h @@ -0,0 +1,46 @@ +#ifndef __OPIE_THEME_PLUGIN_H__ +#define __OPIE_THEME_PLUGIN_H__ + +#include <qpe/styleinterface.h> + +class ThemeSettings; + +class ThemeInterface : public StyleInterface { +public: + ThemeInterface ( ); + virtual ~ThemeInterface ( ); + + 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 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 ( ); + virtual void reject ( ); + +private: + ThemeSettings *m_widget; + ulong ref; +}; + +#endif diff --git a/noncore/styles/theme/settings/main.cpp b/noncore/styles/theme/settings/main.cpp deleted file mode 100644 index 94d40f3..0000000 --- a/noncore/styles/theme/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 "themeset.h" - -#include <qpe/qpeapplication.h> - - -int main ( int argc, char** argv ) -{ - QPEApplication a ( argc, argv ); - - ThemeSet dlg; - a. showMainWidget ( &dlg ); - - return a. exec ( ); -} diff --git a/noncore/styles/theme/settings/settings.pro b/noncore/styles/theme/settings/settings.pro deleted file mode 100644 index 85d1f7a..0000000 --- a/noncore/styles/theme/settings/settings.pro +++ b/dev/null @@ -1,24 +0,0 @@ -TEMPLATE = app -CONFIG += qt warn_on release -DESTDIR = $(OPIEDIR)/bin -HEADERS = themeset.h -SOURCES = themeset.cpp main.cpp -INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += ../$(OPIEDIR)/include -LIBS += -lqpe -TARGET = theme-settings - -TRANSLATIONS = ../../../../i18n/de/theme-settings.ts \ - ../../../../i18n/en/theme-settings.ts \ - ../../../../i18n/es/theme-settings.ts \ - ../../../../i18n/fr/theme-settings.ts \ - ../../../../i18n/hu/theme-settings.ts \ - ../../../../i18n/ja/theme-settings.ts \ - ../../../../i18n/ko/theme-settings.ts \ - ../../../../i18n/no/theme-settings.ts \ - ../../../../i18n/pl/theme-settings.ts \ - ../../../../i18n/pt/theme-settings.ts \ - ../../../../i18n/pt_BR/theme-settings.ts \ - ../../../../i18n/sl/theme-settings.ts \ - ../../../../i18n/zh_CN/theme-settings.ts \ - ../../../../i18n/zh_TW/theme-settings.ts diff --git a/noncore/styles/theme/settings/themeset.h b/noncore/styles/theme/settings/themeset.h deleted file mode 100644 index 24804ce..0000000 --- a/noncore/styles/theme/settings/themeset.h +++ b/dev/null @@ -1,20 +0,0 @@ -#ifndef __OPIE_THEME_SET_H__ -#define __OPIE_THEME_SET_H__ - -#include <qdialog.h> - -class QListView; - -class ThemeSet : public QDialog { - Q_OBJECT - -public: - ThemeSet ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); - -protected: - virtual void accept ( ); - -private: - QListView *m_list; -}; -#endif diff --git a/noncore/styles/theme/theme.pro b/noncore/styles/theme/theme.pro index fdcd20e..49c4103 100644 --- a/noncore/styles/theme/theme.pro +++ b/noncore/styles/theme/theme.pro @@ -1,32 +1,35 @@ TEMPLATE = lib CONFIG = qt embedded debug warn_on SOURCES = ogfxeffect.cpp \ othemestyle.cpp \ othemebase.cpp \ + themeset.cpp \ plugin.cpp HEADERS = ogfxeffect.h \ othemebase.h \ - othemestyle.h + othemestyle.h \ + themeset.h \ + plugin.h LIBS += -lqpe INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/plugins/styles TARGET = theme VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libtheme.ts \ ../../../i18n/en/libtheme.ts \ ../../../i18n/es/libtheme.ts \ ../../../i18n/fr/libtheme.ts \ ../../../i18n/hu/libtheme.ts \ ../../../i18n/ja/libtheme.ts \ ../../../i18n/ko/libtheme.ts \ ../../../i18n/no/libtheme.ts \ ../../../i18n/pl/libtheme.ts \ ../../../i18n/pt/libtheme.ts \ ../../../i18n/pt_BR/libtheme.ts \ ../../../i18n/sl/libtheme.ts \ ../../../i18n/zh_CN/libtheme.ts \ ../../../i18n/zh_TW/libtheme.ts diff --git a/noncore/styles/theme/settings/themeset.cpp b/noncore/styles/theme/themeset.cpp index 046618e..4a4efcb 100644 --- a/noncore/styles/theme/settings/themeset.cpp +++ b/noncore/styles/theme/themeset.cpp @@ -38,87 +38,86 @@ class MyConfig : public Config public: MyConfig ( const QString &f, Domain d ) : Config ( f, d ) { } bool hasGroup ( const QString &gname ) const { QMap< QString, ConfigGroup>::ConstIterator it = groups. find ( gname ); return ( it != groups.end() ); } }; class MyItem : public QListViewItem { public: MyItem ( QListView *lv, const QString &name, const QString &comm, const QString &theme ) : QListViewItem ( lv, name, comm ) { m_theme = theme; } QString m_theme; }; -ThemeSet::ThemeSet ( QWidget* parent, const char *name, WFlags fl ) - : QDialog ( parent, name, fl ) +ThemeSettings::ThemeSettings ( QWidget* parent, const char *name, WFlags fl ) + : QWidget ( parent, name, fl ) { setCaption ( tr( "Theme Style" ) ); Config config ( "qpe" ); config. setGroup ( "Appearance" ); QString active = config. readEntry ( "Theme", "default" ); QVBoxLayout *vbox = new QVBoxLayout ( this ); vbox-> setSpacing ( 3 ); vbox-> setMargin ( 6 ); vbox-> addWidget ( new QLabel ( tr( "Select the theme to be used" ), this )); m_list = new QListView ( this ); m_list-> addColumn ( tr( "Name" )); m_list-> addColumn ( tr( "Description" )); m_list-> setSelectionMode ( QListView::Single ); m_list-> setAllColumnsShowFocus ( true ); vbox-> addWidget ( m_list, 10 ); QListViewItem *item = new MyItem ( m_list, tr( "[No theme]" ), "", "" ); m_list-> setSelected ( item, true ); QString path = QPEApplication::qpeDir() + "/plugins/styles/themes"; QStringList list = QDir ( path, "*.themerc" ). entryList ( ); for ( QStringList::Iterator it = list. begin(); it != list. end ( ); ++it ) { MyConfig cfg ( path + "/" + *it, Config::File ); if ( cfg. hasGroup ( "Misc" )) { cfg. setGroup ( "Misc" ); QString name = cfg. readEntry ( "Name" ); QString comm = cfg. readEntry ( "Comment" ); if ( !name. isEmpty ( )) { QString fname = (*it). left ((*it). length ( ) - 8 ); item = new MyItem ( m_list, name, comm, fname ); if ( active == fname ) { m_list-> setSelected ( item, true ); } } } } } -void ThemeSet::accept ( ) +bool ThemeSettings::writeConfig ( ) { Config config ( "qpe" ); config. setGroup ( "Appearance" ); MyItem *it = (MyItem *) m_list-> selectedItem ( ); config. writeEntry ( "Theme", it ? it-> m_theme : QString ( "" )); + config. write ( ); - Global::applyStyle ( ); - - QDialog::accept ( ); + return true; } diff --git a/noncore/styles/theme/themeset.h b/noncore/styles/theme/themeset.h new file mode 100644 index 0000000..c337cfa --- a/dev/null +++ b/noncore/styles/theme/themeset.h @@ -0,0 +1,20 @@ +#ifndef __OPIE_THEME_SETTINGS_H__ +#define __OPIE_THEME_SETTINGS_H__ + +#include <qdialog.h> + +class QListView; + +class ThemeSettings : public QWidget { + Q_OBJECT + +public: + ThemeSettings ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); + +public: + virtual bool writeConfig ( ); + +private: + QListView *m_list; +}; +#endif |