diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 4aed2c8219774f5d797760606b8489a92ddc5163 (patch) | |
tree | 3f8c130f7d269626bf6a9447407ef6c35954426a /kwin/clients/default/config | |
download | tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kwin/clients/default/config')
-rw-r--r-- | kwin/clients/default/config/Makefile.am | 16 | ||||
-rw-r--r-- | kwin/clients/default/config/config.cpp | 131 | ||||
-rw-r--r-- | kwin/clients/default/config/config.h | 49 |
3 files changed, 196 insertions, 0 deletions
diff --git a/kwin/clients/default/config/Makefile.am b/kwin/clients/default/config/Makefile.am new file mode 100644 index 000000000..a6e09522a --- /dev/null +++ b/kwin/clients/default/config/Makefile.am @@ -0,0 +1,16 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = kwin_default_config.la + +kwin_default_config_la_SOURCES = config.cpp +kwin_default_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +kwin_default_config_la_LIBADD = $(LIB_KDEUI) + +METASOURCES = AUTO +noinst_HEADERS = config.h + +lnkdir = $(kde_datadir)/kwin/ + +###KMAKE-start (don't edit or delete this block) + +###KMAKE-end diff --git a/kwin/clients/default/config/config.cpp b/kwin/clients/default/config/config.cpp new file mode 100644 index 000000000..2ad494fa9 --- /dev/null +++ b/kwin/clients/default/config/config.cpp @@ -0,0 +1,131 @@ +/* + * + * KDE2 Default configuration widget + * + * Copyright (c) 2001 + * Karol Szwed <gallium@kde.org> + * http://gallium.n3.net/ + */ + +#include "config.h" +#include <kglobal.h> +#include <qwhatsthis.h> +#include <kdialog.h> +#include <klocale.h> +#include <qpixmap.h> +#include <qvbox.h> + +extern "C" +{ + KDE_EXPORT QObject* allocate_config( KConfig* conf, QWidget* parent ) + { + return(new KDEDefaultConfig(conf, parent)); + } +} + +// NOTE: +// 'conf' is a pointer to the kwindecoration modules open kwin config, +// and is by default set to the "Style" group. +// 'parent' is the parent of the QObject, which is a VBox inside the +// Configure tab in kwindecoration + +KDEDefaultConfig::KDEDefaultConfig( KConfig* conf, QWidget* parent ) + : QObject( parent ) +{ + KGlobal::locale()->insertCatalogue("kwin_clients"); + highcolor = QPixmap::defaultDepth() > 8; + gb = new QVBox( parent ); + gb->setSpacing( KDialog::spacingHint() ); + + cbShowStipple = new QCheckBox( i18n("Draw titlebar &stipple effect"), gb ); + QWhatsThis::add( cbShowStipple, + i18n("When selected, active titlebars are drawn " + "with a stipple (dotted) effect; otherwise, they are " + "drawn without the stipple.")); + + cbShowGrabBar = new QCheckBox( i18n("Draw g&rab bar below windows"), gb ); + QWhatsThis::add( cbShowGrabBar, + i18n("When selected, decorations are drawn with a \"grab bar\" " + "below windows; otherwise, no grab bar is drawn.")); + + // Only show the gradient checkbox for highcolor displays + if (highcolor) + { + cbUseGradients = new QCheckBox( i18n("Draw &gradients"), gb ); + QWhatsThis::add( cbUseGradients, + i18n("When selected, decorations are drawn with gradients " + "for high-color displays; otherwise, no gradients are drawn.") ); + } + + // Load configuration options + load( conf ); + + // Ensure we track user changes properly + connect( cbShowStipple, SIGNAL(clicked()), + this, SLOT(slotSelectionChanged()) ); + connect( cbShowGrabBar, SIGNAL(clicked()), + this, SLOT(slotSelectionChanged()) ); + if (highcolor) + connect( cbUseGradients, SIGNAL(clicked()), + this, SLOT(slotSelectionChanged()) ); + + // Make the widgets visible in kwindecoration + gb->show(); +} + + +KDEDefaultConfig::~KDEDefaultConfig() +{ + delete gb; +} + + +void KDEDefaultConfig::slotSelectionChanged() +{ + emit changed(); +} + + +// Loads the configurable options from the kwinrc config file +// It is passed the open config from kwindecoration to improve efficiency +void KDEDefaultConfig::load( KConfig* conf ) +{ + conf->setGroup("KDEDefault"); + bool override = conf->readBoolEntry( "ShowTitleBarStipple", true ); + cbShowStipple->setChecked( override ); + + override = conf->readBoolEntry( "ShowGrabBar", true ); + cbShowGrabBar->setChecked( override ); + + if (highcolor) { + override = conf->readBoolEntry( "UseGradients", true ); + cbUseGradients->setChecked( override ); + } +} + + +// Saves the configurable options to the kwinrc config file +void KDEDefaultConfig::save( KConfig* conf ) +{ + conf->setGroup("KDEDefault"); + conf->writeEntry( "ShowTitleBarStipple", cbShowStipple->isChecked() ); + conf->writeEntry( "ShowGrabBar", cbShowGrabBar->isChecked() ); + + if (highcolor) + conf->writeEntry( "UseGradients", cbUseGradients->isChecked() ); + // No need to conf->sync() - kwindecoration will do it for us +} + + +// Sets UI widget defaults which must correspond to style defaults +void KDEDefaultConfig::defaults() +{ + cbShowStipple->setChecked( true ); + cbShowGrabBar->setChecked( true ); + + if (highcolor) + cbUseGradients->setChecked( true ); +} + +#include "config.moc" +// vim: ts=4 diff --git a/kwin/clients/default/config/config.h b/kwin/clients/default/config/config.h new file mode 100644 index 000000000..248d851df --- /dev/null +++ b/kwin/clients/default/config/config.h @@ -0,0 +1,49 @@ +/* + * + * KDE2 Default configuration widget + * + * Copyright (c) 2001 + * Karol Szwed <gallium@kde.org> + * http://gallium.n3.net/ + */ + +#ifndef _KDE_DEFAULT_CONFIG_H +#define _KDE_DEFAULT_CONFIG_H + +#include <qcheckbox.h> +#include <qgroupbox.h> +#include <kconfig.h> +#include <qhbox.h> +#include <qlabel.h> +#include <qvbox.h> + +class KDEDefaultConfig: public QObject +{ + Q_OBJECT + + public: + KDEDefaultConfig( KConfig* conf, QWidget* parent ); + ~KDEDefaultConfig(); + + // These public signals/slots work similar to KCM modules + signals: + void changed(); + + public slots: + void load( KConfig* conf ); + void save( KConfig* conf ); + void defaults(); + + protected slots: + void slotSelectionChanged(); // Internal use + + private: + QCheckBox* cbShowStipple; + QCheckBox* cbShowGrabBar; + QCheckBox* cbUseGradients; + QVBox* gb; + bool highcolor; +}; + +#endif +// vim: ts=4 |