diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-07 21:50:33 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-07 21:50:33 -0600 |
commit | 0b6057404f65218182ab27a9483a21065ef61fca (patch) | |
tree | b8b06dfa2deb965bebfbe131a772124e3e693a96 /twin/clients/modernsystem/config | |
parent | 43d99cc2477266cb9072e179137f0e8485370b3d (diff) | |
download | tdebase-0b6057404f65218182ab27a9483a21065ef61fca.tar.gz tdebase-0b6057404f65218182ab27a9483a21065ef61fca.zip |
Rename kwin to twin (Part 2 of 2)
Diffstat (limited to 'twin/clients/modernsystem/config')
-rw-r--r-- | twin/clients/modernsystem/config/CMakeLists.txt | 30 | ||||
-rw-r--r-- | twin/clients/modernsystem/config/Makefile.am | 14 | ||||
-rw-r--r-- | twin/clients/modernsystem/config/config.cpp | 130 | ||||
-rw-r--r-- | twin/clients/modernsystem/config/config.h | 50 |
4 files changed, 224 insertions, 0 deletions
diff --git a/twin/clients/modernsystem/config/CMakeLists.txt b/twin/clients/modernsystem/config/CMakeLists.txt new file mode 100644 index 000000000..8a6d6db43 --- /dev/null +++ b/twin/clients/modernsystem/config/CMakeLists.txt @@ -0,0 +1,30 @@ +################################################# +# +# (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_modernsys_config (module) ############ + +tde_add_kpart( twin_modernsys_config AUTOMOC + SOURCES config.cpp + LINK tdeui-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) + diff --git a/twin/clients/modernsystem/config/Makefile.am b/twin/clients/modernsystem/config/Makefile.am new file mode 100644 index 000000000..aaae38b2a --- /dev/null +++ b/twin/clients/modernsystem/config/Makefile.am @@ -0,0 +1,14 @@ + +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = twin_modernsys_config.la + +twin_modernsys_config_la_SOURCES = config.cpp +twin_modernsys_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +twin_modernsys_config_la_LIBADD = $(LIB_TDEUI) + +METASOURCES = AUTO +noinst_HEADERS = config.h + +lnkdir = $(kde_datadir)/twin/ + diff --git a/twin/clients/modernsystem/config/config.cpp b/twin/clients/modernsystem/config/config.cpp new file mode 100644 index 000000000..136ff3492 --- /dev/null +++ b/twin/clients/modernsystem/config/config.cpp @@ -0,0 +1,130 @@ +// Melchior FRANZ <mfranz@kde.org> -- 2001-04-22 + +#include <kapplication.h> +#include <kconfig.h> +#include <kdialog.h> +#include <klocale.h> +#include <kglobal.h> +#include <tqlayout.h> +#include <tqwhatsthis.h> +#include "config.h" + + +extern "C" +{ + KDE_EXPORT TQObject* allocate_config(KConfig* conf, TQWidget* parent) + { + return(new ModernSysConfig(conf, parent)); + } +} + + +// '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 + +ModernSysConfig::ModernSysConfig(KConfig* conf, TQWidget* parent) : TQObject(parent) +{ + clientrc = new KConfig("twinmodernsysrc"); + KGlobal::locale()->insertCatalogue("twin_clients"); + mainw = new TQWidget(parent); + vbox = new TQVBoxLayout(mainw); + vbox->setSpacing(6); + vbox->setMargin(0); + + handleBox = new TQWidget(mainw); + TQGridLayout* layout = new TQGridLayout(handleBox, 0, KDialog::spacingHint()); + + cbShowHandle = new TQCheckBox(i18n("&Show window resize handle"), handleBox); + TQWhatsThis::add(cbShowHandle, + i18n("When selected, all windows are drawn with a resize " + "handle at the lower right corner. This makes window resizing " + "easier, especially for trackballs and other mouse replacements " + "on laptops.")); + layout->addMultiCellWidget(cbShowHandle, 0, 0, 0, 1); + connect(cbShowHandle, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSelectionChanged())); + + sliderBox = new TQVBox(handleBox); + handleSizeSlider = new TQSlider(0, 4, 1, 0, Qt::Horizontal, sliderBox); + TQWhatsThis::add(handleSizeSlider, + i18n("Here you can change the size of the resize handle.")); + handleSizeSlider->setTickInterval(1); + handleSizeSlider->setTickmarks(TQSlider::Below); + connect(handleSizeSlider, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotSelectionChanged())); + + hbox = new TQHBox(sliderBox); + hbox->setSpacing(6); + + bool rtl = kapp->reverseLayout(); + label1 = new TQLabel(i18n("Small"), hbox); + label1->tqsetAlignment(rtl ? AlignRight : AlignLeft); + label2 = new TQLabel(i18n("Medium"), hbox); + label2->tqsetAlignment(AlignHCenter); + label3 = new TQLabel(i18n("Large"), hbox); + label3->tqsetAlignment(rtl ? AlignLeft : AlignRight); + + vbox->addWidget(handleBox); + vbox->addStretch(1); + +// layout->setColSpacing(0, 30); + layout->addItem(new TQSpacerItem(30, 10, TQSizePolicy::Fixed, TQSizePolicy::Fixed), 1, 0); + layout->addWidget(sliderBox, 1, 1); + + load(conf); + mainw->show(); +} + + +ModernSysConfig::~ModernSysConfig() +{ + delete mainw; + delete clientrc; +} + + +void ModernSysConfig::slotSelectionChanged() +{ + bool i = cbShowHandle->isChecked(); + if (i != hbox->isEnabled()) { + hbox->setEnabled(i); + handleSizeSlider->setEnabled(i); + } + emit changed(); +} + + +void ModernSysConfig::load(KConfig* /*conf*/) +{ + clientrc->setGroup("General"); + bool i = clientrc->readBoolEntry("ShowHandle", true ); + cbShowHandle->setChecked(i); + hbox->setEnabled(i); + handleSizeSlider->setEnabled(i); + handleWidth = clientrc->readUnsignedNumEntry("HandleWidth", 6); + handleSize = clientrc->readUnsignedNumEntry("HandleSize", 30); + handleSizeSlider->setValue(TQMIN((handleWidth - 6) / 2, 4)); + +} + + +void ModernSysConfig::save(KConfig* /*conf*/) +{ + clientrc->setGroup("General"); + clientrc->writeEntry("ShowHandle", cbShowHandle->isChecked()); + clientrc->writeEntry("HandleWidth", 6 + 2 * handleSizeSlider->value()); + clientrc->writeEntry("HandleSize", 30 + 4 * handleSizeSlider->value()); + clientrc->sync(); +} + + +void ModernSysConfig::defaults() +{ + cbShowHandle->setChecked(true); + hbox->setEnabled(true); + handleSizeSlider->setEnabled(true); + handleSizeSlider->setValue(0); +} + +#include "config.moc" diff --git a/twin/clients/modernsystem/config/config.h b/twin/clients/modernsystem/config/config.h new file mode 100644 index 000000000..3a04573cf --- /dev/null +++ b/twin/clients/modernsystem/config/config.h @@ -0,0 +1,50 @@ +#ifndef __KDE_MODSYSTEMCONFIG_H +#define __KDE_MODSYSTEMCONFIG_H + +#include <tqcheckbox.h> +#include <tqgroupbox.h> +#include <tqlayout.h> +#include <tqvbox.h> +#include <tqslider.h> +#include <tqlabel.h> + +class ModernSysConfig : public TQObject +{ + Q_OBJECT + + public: + ModernSysConfig(KConfig* conf, TQWidget* parent); + ~ModernSysConfig(); + + // 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 *clientrc; + TQWidget *mainw; + TQVBoxLayout *vbox; + TQWidget *handleBox; + TQCheckBox *cbShowHandle; + TQVBox *sliderBox; + TQSlider *handleSizeSlider; + TQHBox *hbox; + TQLabel *label1; + TQLabel *label2; + TQLabel *label3; + + unsigned handleWidth; + unsigned handleSize; + +}; + + +#endif |