summaryrefslogtreecommitdiffstats
path: root/kwin/clients/quartz/config
diff options
context:
space:
mode:
Diffstat (limited to 'kwin/clients/quartz/config')
-rw-r--r--kwin/clients/quartz/config/Makefile.am16
-rw-r--r--kwin/clients/quartz/config/config.cpp104
-rw-r--r--kwin/clients/quartz/config/config.h47
3 files changed, 167 insertions, 0 deletions
diff --git a/kwin/clients/quartz/config/Makefile.am b/kwin/clients/quartz/config/Makefile.am
new file mode 100644
index 000000000..eb64880ee
--- /dev/null
+++ b/kwin/clients/quartz/config/Makefile.am
@@ -0,0 +1,16 @@
+INCLUDES = $(all_includes)
+
+kde_module_LTLIBRARIES = kwin_quartz_config.la
+
+kwin_quartz_config_la_SOURCES = config.cpp
+kwin_quartz_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+kwin_quartz_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/quartz/config/config.cpp b/kwin/clients/quartz/config/config.cpp
new file mode 100644
index 000000000..8c7070b9d
--- /dev/null
+++ b/kwin/clients/quartz/config/config.cpp
@@ -0,0 +1,104 @@
+/*
+ *
+ * This file contains the quartz configuration widget
+ *
+ * Copyright (c) 2001
+ * Karol Szwed <[email protected]>
+ * http://gallium.n3.net/
+ */
+
+#include "config.h"
+#include <kglobal.h>
+#include <qwhatsthis.h>
+#include <klocale.h>
+
+
+extern "C"
+{
+ KDE_EXPORT QObject* allocate_config( KConfig* conf, QWidget* parent )
+ {
+ return(new QuartzConfig(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
+ */
+
+QuartzConfig::QuartzConfig( KConfig* conf, QWidget* parent )
+ : QObject( parent )
+{
+ quartzConfig = new KConfig("kwinquartzrc");
+ KGlobal::locale()->insertCatalogue("kwin_clients");
+ gb = new QVBox( parent );
+ cbColorBorder = new QCheckBox(
+ i18n("Draw window frames using &titlebar colors"), gb );
+ QWhatsThis::add( cbColorBorder,
+ i18n("When selected, the window decoration borders "
+ "are drawn using the titlebar colors; otherwise, they are "
+ "drawn using normal border colors instead.") );
+ cbExtraSmall = new QCheckBox( i18n("Quartz &extra slim"), gb );
+ QWhatsThis::add( cbExtraSmall,
+ i18n("Quartz window decorations with extra-small title bar.") );
+ // Load configuration options
+ load( conf );
+
+ // Ensure we track user changes properly
+ connect( cbColorBorder, SIGNAL(clicked()), this, SLOT(slotSelectionChanged()) );
+ connect( cbExtraSmall, SIGNAL(clicked()), this, SLOT(slotSelectionChanged()) );
+
+ // Make the widgets visible in kwindecoration
+ gb->show();
+}
+
+
+QuartzConfig::~QuartzConfig()
+{
+ delete gb;
+ delete quartzConfig;
+}
+
+
+void QuartzConfig::slotSelectionChanged()
+{
+ emit changed();
+}
+
+
+// Loads the configurable options from the kwinrc config file
+// It is passed the open config from kwindecoration to improve efficiency
+void QuartzConfig::load( KConfig* /*conf*/ )
+{
+ quartzConfig->setGroup("General");
+ bool override = quartzConfig->readBoolEntry( "UseTitleBarBorderColors", true );
+ cbColorBorder->setChecked( override );
+ override = quartzConfig->readBoolEntry( "UseQuartzExtraSlim", false );
+ cbExtraSmall->setChecked( override );
+}
+
+
+// Saves the configurable options to the kwinrc config file
+void QuartzConfig::save( KConfig* /*conf*/ )
+{
+ quartzConfig->setGroup("General");
+ quartzConfig->writeEntry( "UseTitleBarBorderColors", cbColorBorder->isChecked() );
+ quartzConfig->writeEntry( "UseQuartzExtraSlim", cbExtraSmall->isChecked() );
+ // Ensure others trying to read this config get updated
+ quartzConfig->sync();
+}
+
+
+// Sets UI widget defaults which must correspond to style defaults
+void QuartzConfig::defaults()
+{
+ cbColorBorder->setChecked( true );
+ cbExtraSmall->setChecked( false );
+}
+
+#include "config.moc"
+// vim: ts=4
diff --git a/kwin/clients/quartz/config/config.h b/kwin/clients/quartz/config/config.h
new file mode 100644
index 000000000..815cc9644
--- /dev/null
+++ b/kwin/clients/quartz/config/config.h
@@ -0,0 +1,47 @@
+/*
+ *
+ * This file contains the quartz configuration widget
+ *
+ * Copyright (c) 2001
+ * Karol Szwed <[email protected]>
+ * http://gallium.n3.net/
+ */
+
+#ifndef __KDE_QUARTZCONFIG_H
+#define __KDE_QUARTZCONFIG_H
+
+#include <qcheckbox.h>
+#include <qvbox.h>
+#include <kconfig.h>
+
+class QuartzConfig: public QObject
+{
+ Q_OBJECT
+
+ public:
+ QuartzConfig( KConfig* conf, QWidget* parent );
+ ~QuartzConfig();
+
+ // 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:
+ KConfig* quartzConfig;
+ QCheckBox* cbColorBorder;
+ QCheckBox* cbExtraSmall;
+ QVBox* gb;
+};
+
+
+#endif
+
+// vim: ts=4