summaryrefslogtreecommitdiffstats
path: root/kwin-styles/cde/config
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit8b2aa1b5301ab60368a03e36df4ff5216726e87d (patch)
tree36163d4ee667c23b5cf232df2f3004cd0a76202a /kwin-styles/cde/config
downloadtdeartwork-8b2aa1b5301ab60368a03e36df4ff5216726e87d.tar.gz
tdeartwork-8b2aa1b5301ab60368a03e36df4ff5216726e87d.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/kdeartwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kwin-styles/cde/config')
-rw-r--r--kwin-styles/cde/config/Makefile.am17
-rw-r--r--kwin-styles/cde/config/config.cpp131
-rw-r--r--kwin-styles/cde/config/config.h51
3 files changed, 199 insertions, 0 deletions
diff --git a/kwin-styles/cde/config/Makefile.am b/kwin-styles/cde/config/Makefile.am
new file mode 100644
index 00000000..c12933e4
--- /dev/null
+++ b/kwin-styles/cde/config/Makefile.am
@@ -0,0 +1,17 @@
+INCLUDES = $(all_includes)
+
+kde_module_LTLIBRARIES = kwin_cde_config.la
+
+kwin_cde_config_la_SOURCES = config.cpp
+kwin_cde_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+kwin_cde_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-styles/cde/config/config.cpp b/kwin-styles/cde/config/config.cpp
new file mode 100644
index 00000000..5c3ac455
--- /dev/null
+++ b/kwin-styles/cde/config/config.cpp
@@ -0,0 +1,131 @@
+// $Id$
+#include "config.h"
+#include <kapplication.h>
+#include <kglobal.h>
+#include <qwhatsthis.h>
+#include <qvbox.h>
+#include <klocale.h>
+
+extern "C" KDE_EXPORT QObject* allocate_config( KConfig* conf, QWidget* parent )
+{
+ return new CdeConfig(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
+ */
+
+CdeConfig::CdeConfig( KConfig* conf, QWidget* parent )
+ : QObject( parent )
+{
+ cdeConfig = new KConfig("kwincderc");
+ KGlobal::locale()->insertCatalogue("kwin_art_clients");
+
+ groupBox = new QVBox( parent );
+
+ bgAlign = new QButtonGroup( 3, Qt::Horizontal, i18n("Text &Alignment"), groupBox );
+ bgAlign->setExclusive( true );
+ QWhatsThis::add( bgAlign, i18n("Use these buttons to set the alignment of the titlebar caption text.") );
+ new QRadioButton( i18n("Left"), bgAlign, "AlignLeft" );
+ QRadioButton *radio2 = new QRadioButton( i18n("Centered"), bgAlign, "AlignHCenter" );
+ radio2->setChecked( true );
+ new QRadioButton( i18n("Right"), bgAlign, "AlignRight" );
+
+ cbColorBorder = new QCheckBox( i18n("Draw window frames using &titlebar colors"), groupBox );
+ 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.") );
+
+// cbTitlebarButton = new QCheckBox( i18n("Titlebar acts like a &pushbutton when clicked"), groupBox );
+// QWhatsThis::add( cbTitlebarButton, i18n("When selected, this option causes the window titlebar to behave "
+// "as if it was a pushbutton when you click it to move the window.") );
+
+ (void) new QLabel( i18n("Tip: If you want the look of the original Motif(tm) Window Manager,\n"
+ "click the \"Buttons\" tab above and remove the help\n"
+ "and close buttons from the titlebar."), groupBox );
+
+ // Load configuration options
+ load( conf );
+
+ // Ensure we track user changes properly
+ connect( cbColorBorder, SIGNAL(clicked()), SLOT(slotSelectionChanged()) );
+// connect( cbTitlebarButton, SIGNAL(clicked()), SLOT(slotSelectionChanged()) );
+ connect( bgAlign, SIGNAL(clicked(int)), SLOT(slotSelectionChanged(int)) );
+
+ // Make the widgets visible in kwindecoration
+ groupBox->show();
+}
+
+
+CdeConfig::~CdeConfig()
+{
+ delete bgAlign;
+ delete groupBox;
+ delete cdeConfig;
+}
+
+
+void CdeConfig::slotSelectionChanged()
+{
+ emit changed();
+}
+
+void CdeConfig::slotSelectionChanged( int )
+{
+ emit changed();
+}
+
+// Loads the configurable options from the kwinrc config file
+// It is passed the open config from kwindecoration to improve efficiency
+void CdeConfig::load( KConfig* /*conf*/ )
+{
+ cdeConfig->setGroup("General");
+
+ QString value = cdeConfig->readEntry( "TextAlignment", "AlignHCenter" );
+ QRadioButton *button = (QRadioButton*)bgAlign->child( (const char *)value.latin1() );
+ if ( button )
+ button->setChecked( true );
+
+ bool coloredFrame = cdeConfig->readBoolEntry( "UseTitleBarBorderColors", true );
+ cbColorBorder->setChecked( coloredFrame );
+
+// bool titlebarButton = cdeConfig->readBoolEntry( "TitlebarButtonMode", true );
+// cbTitlebarButton->setChecked( titlebarButton );
+}
+
+
+// Saves the configurable options to the kwinrc config file
+void CdeConfig::save( KConfig* /*conf*/ )
+{
+ cdeConfig->setGroup("General");
+
+ QRadioButton *button = (QRadioButton*)bgAlign->selected();
+ if ( button )
+ cdeConfig->writeEntry( "TextAlignment", QString(button->name()) );
+
+ cdeConfig->writeEntry( "UseTitleBarBorderColors", cbColorBorder->isChecked() );
+// cdeConfig->writeEntry( "TitlebarButtonMode", cbTitlebarButton->isChecked() );
+
+ // Ensure others trying to read this config get updated
+ cdeConfig->sync();
+}
+
+
+// Sets UI widget defaults which must correspond to style defaults
+void CdeConfig::defaults()
+{
+ QRadioButton *button = (QRadioButton*)bgAlign->child( "AlignHCenter" );
+ if ( button )
+ button->setChecked( true );
+
+ cbColorBorder->setChecked( true );
+// cbTitlebarButton->setChecked( true );
+}
+
+#include "config.moc"
+// vim: ts=4
diff --git a/kwin-styles/cde/config/config.h b/kwin-styles/cde/config/config.h
new file mode 100644
index 00000000..723d7b95
--- /dev/null
+++ b/kwin-styles/cde/config/config.h
@@ -0,0 +1,51 @@
+#ifndef __KDE_CDECONFIG_H
+#define __KDE_CDECONFIG_H
+
+#include <qcheckbox.h>
+#include <qgroupbox.h>
+#include <qbuttongroup.h>
+#include <qlabel.h>
+#include <qradiobutton.h>
+#include <qhbox.h>
+#include <kconfig.h>
+
+class QCheckBox;
+class QGroupBox;
+class QVBox;
+class QLabel;
+class QRadioButton;
+
+class CdeConfig: public QObject
+{
+ Q_OBJECT
+
+ public:
+ CdeConfig( KConfig* conf, QWidget* parent );
+ ~CdeConfig();
+
+ // 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
+ void slotSelectionChanged( int );
+
+ private:
+ KConfig* cdeConfig;
+ QCheckBox* cbColorBorder;
+// QCheckBox* cbTitlebarButton;
+ QHBox* groupBox;
+ QGroupBox* gbSlider;
+ QButtonGroup* bgAlign;
+};
+
+
+#endif
+
+// vim: ts=4