summaryrefslogtreecommitdiffstats
path: root/twin/clients/default/config
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-07 21:50:33 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-07 21:50:33 -0600
commit0b6057404f65218182ab27a9483a21065ef61fca (patch)
treeb8b06dfa2deb965bebfbe131a772124e3e693a96 /twin/clients/default/config
parent43d99cc2477266cb9072e179137f0e8485370b3d (diff)
downloadtdebase-0b6057404f65218182ab27a9483a21065ef61fca.tar.gz
tdebase-0b6057404f65218182ab27a9483a21065ef61fca.zip
Rename kwin to twin (Part 2 of 2)
Diffstat (limited to 'twin/clients/default/config')
-rw-r--r--twin/clients/default/config/CMakeLists.txt29
-rw-r--r--twin/clients/default/config/Makefile.am16
-rw-r--r--twin/clients/default/config/config.cpp131
-rw-r--r--twin/clients/default/config/config.h49
4 files changed, 225 insertions, 0 deletions
diff --git a/twin/clients/default/config/CMakeLists.txt b/twin/clients/default/config/CMakeLists.txt
new file mode 100644
index 000000000..5814e011f
--- /dev/null
+++ b/twin/clients/default/config/CMakeLists.txt
@@ -0,0 +1,29 @@
+#################################################
+#
+# (C) 2010-2011 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### twin_default_config (module) ##############
+
+tde_add_kpart( twin_default_config AUTOMOC
+ SOURCES config.cpp
+ LINK tdeui-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}
+)
diff --git a/twin/clients/default/config/Makefile.am b/twin/clients/default/config/Makefile.am
new file mode 100644
index 000000000..3a1df8aa2
--- /dev/null
+++ b/twin/clients/default/config/Makefile.am
@@ -0,0 +1,16 @@
+INCLUDES = $(all_includes)
+
+kde_module_LTLIBRARIES = twin_default_config.la
+
+twin_default_config_la_SOURCES = config.cpp
+twin_default_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+twin_default_config_la_LIBADD = $(LIB_TDEUI)
+
+METASOURCES = AUTO
+noinst_HEADERS = config.h
+
+lnkdir = $(kde_datadir)/twin/
+
+###KMAKE-start (don't edit or delete this block)
+
+###KMAKE-end
diff --git a/twin/clients/default/config/config.cpp b/twin/clients/default/config/config.cpp
new file mode 100644
index 000000000..eac4ef4e4
--- /dev/null
+++ b/twin/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 <tqwhatsthis.h>
+#include <kdialog.h>
+#include <klocale.h>
+#include <tqpixmap.h>
+#include <tqvbox.h>
+
+extern "C"
+{
+ KDE_EXPORT TQObject* allocate_config( KConfig* conf, TQWidget* parent )
+ {
+ return(new KDEDefaultConfig(conf, parent));
+ }
+}
+
+// NOTE:
+// 'conf' is a pointer to the twindecoration modules open twin config,
+// and is by default set to the "Style" group.
+// 'parent' is the parent of the TQObject, which is a VBox inside the
+// Configure tab in twindecoration
+
+KDEDefaultConfig::KDEDefaultConfig( KConfig* conf, TQWidget* parent )
+ : TQObject( parent )
+{
+ KGlobal::locale()->insertCatalogue("twin_clients");
+ highcolor = TQPixmap::defaultDepth() > 8;
+ gb = new TQVBox( parent );
+ gb->setSpacing( KDialog::spacingHint() );
+
+ cbShowStipple = new TQCheckBox( i18n("Draw titlebar &stipple effect"), gb );
+ TQWhatsThis::add( cbShowStipple,
+ i18n("When selected, active titlebars are drawn "
+ "with a stipple (dotted) effect; otherwise, they are "
+ "drawn without the stipple."));
+
+ cbShowGrabBar = new TQCheckBox( i18n("Draw g&rab bar below windows"), gb );
+ TQWhatsThis::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 TQCheckBox( i18n("Draw &gradients"), gb );
+ TQWhatsThis::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, TQT_SIGNAL(clicked()),
+ this, TQT_SLOT(slotSelectionChanged()) );
+ connect( cbShowGrabBar, TQT_SIGNAL(clicked()),
+ this, TQT_SLOT(slotSelectionChanged()) );
+ if (highcolor)
+ connect( cbUseGradients, TQT_SIGNAL(clicked()),
+ this, TQT_SLOT(slotSelectionChanged()) );
+
+ // Make the widgets visible in twindecoration
+ gb->show();
+}
+
+
+KDEDefaultConfig::~KDEDefaultConfig()
+{
+ delete gb;
+}
+
+
+void KDEDefaultConfig::slotSelectionChanged()
+{
+ emit changed();
+}
+
+
+// Loads the configurable options from the twinrc config file
+// It is passed the open config from twindecoration 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 twinrc 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() - twindecoration 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/twin/clients/default/config/config.h b/twin/clients/default/config/config.h
new file mode 100644
index 000000000..733b96141
--- /dev/null
+++ b/twin/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 <tqcheckbox.h>
+#include <tqgroupbox.h>
+#include <kconfig.h>
+#include <tqhbox.h>
+#include <tqlabel.h>
+#include <tqvbox.h>
+
+class KDEDefaultConfig: public TQObject
+{
+ Q_OBJECT
+
+ public:
+ KDEDefaultConfig( KConfig* conf, TQWidget* 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:
+ TQCheckBox* cbShowStipple;
+ TQCheckBox* cbShowGrabBar;
+ TQCheckBox* cbUseGradients;
+ TQVBox* gb;
+ bool highcolor;
+};
+
+#endif
+// vim: ts=4