diff options
Diffstat (limited to 'kwin-styles/smooth-blend/client/config')
4 files changed, 671 insertions, 0 deletions
diff --git a/kwin-styles/smooth-blend/client/config/Makefile.am b/kwin-styles/smooth-blend/client/config/Makefile.am new file mode 100644 index 00000000..618dbca1 --- /dev/null +++ b/kwin-styles/smooth-blend/client/config/Makefile.am @@ -0,0 +1,15 @@ +AUTOMAKE_OPTIONS = foreign + +KDE_CXXFLAGS = -DQT_PLUGIN + +INCLUDES = $(all_includes) + +noinst_HEADERS = smoothblendconfig.h + +kde_module_LTLIBRARIES = kwin_smoothblend_config.la +kwin_smoothblend_config_la_SOURCES = configdialog.ui smoothblendconfig.cc +kwin_smoothblend_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +kwin_smoothblend_config_la_LIBADD = $(LIB_KDEUI) +kwin_smoothblend_config_la_METASOURCES = AUTO + +DISTCLEANFILES = $(kwin_smoothblend_config_la_METASOURCES) diff --git a/kwin-styles/smooth-blend/client/config/configdialog.ui b/kwin-styles/smooth-blend/client/config/configdialog.ui new file mode 100644 index 00000000..f84973dc --- /dev/null +++ b/kwin-styles/smooth-blend/client/config/configdialog.ui @@ -0,0 +1,421 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>ConfigDialog</class> +<widget class="QWidget"> + <property name="name"> + <cstring>ConfigDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>634</width> + <height>371</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="caption"> + <string>Config Dialog</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QGroupBox" row="1" column="0"> + <property name="name"> + <cstring>buttongroup</cstring> + </property> + <property name="title"> + <string>Buttons</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QSpinBox" row="0" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>buttonsize</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="suffix"> + <string> pixels</string> + </property> + <property name="specialValueText"> + <string>1 pixel</string> + </property> + <property name="buttonSymbols"> + <enum>UpDownArrows</enum> + </property> + <property name="maxValue"> + <number>64</number> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="value"> + <number>16</number> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>animatebuttons</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Animate buttons</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>Check this option if you want to use button animations when hovering with the mouse.</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>Button size:</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>menuClose</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Close window when menu double clicked</string> + </property> + <property name="accel"> + <string></string> + </property> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QComboBox" row="2" column="3"> + <item> + <property name="text"> + <string>Intensify</string> + </property> + </item> + <item> + <property name="text"> + <string>Fade</string> + </property> + </item> + <property name="name"> + <cstring>btnComboBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="2" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Animation style:</string> + </property> + </widget> + <spacer row="0" column="4" rowspan="4" colspan="1"> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>180</width> + <height>140</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>titlegroup</cstring> + </property> + <property name="title"> + <string>Title Bar</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="text"> + <string>Text alignment:</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Frame width:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Title height:</string> + </property> + </widget> + <widget class="QSpinBox" row="2" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>titlesize</cstring> + </property> + <property name="suffix"> + <string> pixels</string> + </property> + <property name="maxValue"> + <number>64</number> + </property> + <property name="minValue"> + <number>16</number> + </property> + </widget> + <widget class="QSpinBox" row="3" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>framesize</cstring> + </property> + <property name="suffix"> + <string> pixels</string> + </property> + <property name="specialValueText"> + <string>1 pixel</string> + </property> + <property name="maxValue"> + <number>64</number> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="value"> + <number>4</number> + </property> + </widget> + <widget class="QButtonGroup" row="0" column="1" rowspan="2" colspan="2"> + <property name="name"> + <cstring>titlealign</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>GroupBoxPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <property name="title"> + <string></string> + </property> + <property name="alignment"> + <set>AlignTop</set> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + <property name="whatsThis" stdset="0"> + <string>Use these buttons to set the alignment of the window title</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout14</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>AlignLeft</cstring> + </property> + <property name="text"> + <string>Left</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>AlignHCenter</cstring> + </property> + <property name="text"> + <string>Center</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>AlignRight</cstring> + </property> + <property name="text"> + <string>Right</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + </hbox> + </widget> + </hbox> + </widget> + <spacer row="0" column="3" rowspan="4" colspan="1"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>231</width> + <height>71</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="4" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>roundCorners</cstring> + </property> + <property name="text"> + <string>Round top corners</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>titleshadow</cstring> + </property> + <property name="text"> + <string>Use shadowed text</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>Check this option if you want the titlebar text to have a 3D look with a shadow behind it.</string> + </property> + </widget> + </grid> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>animatebuttons</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>animatebuttons</sender> + <signal>toggled(bool)</signal> + <receiver>btnComboBox</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>AlignLeft</tabstop> + <tabstop>AlignHCenter</tabstop> + <tabstop>AlignRight</tabstop> + <tabstop>titlesize</tabstop> + <tabstop>framesize</tabstop> + <tabstop>titleshadow</tabstop> + <tabstop>roundCorners</tabstop> + <tabstop>buttonsize</tabstop> + <tabstop>animatebuttons</tabstop> + <tabstop>btnComboBox</tabstop> + <tabstop>menuClose</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kwin-styles/smooth-blend/client/config/smoothblendconfig.cc b/kwin-styles/smooth-blend/client/config/smoothblendconfig.cc new file mode 100644 index 00000000..30472143 --- /dev/null +++ b/kwin-styles/smooth-blend/client/config/smoothblendconfig.cc @@ -0,0 +1,180 @@ +////////////////////////////////////////////////////////////////////////////// +// smoothblendconfig.cc +// ------------------- +// Config module for Smooth Blend window decoration +// ------------------- +// Copyright (c) 2005 Ryan Nickell <p0z3r@users.sourceforge.net> +// Please see the header file for copyright and license information. +////////////////////////////////////////////////////////////////////////////// + +#include <kconfig.h> +#include <klocale.h> +#include <kglobal.h> +#include <qbuttongroup.h> +#include <qgroupbox.h> +#include <qradiobutton.h> +#include <qcheckbox.h> +#include <qspinbox.h> +#include <qwhatsthis.h> +#include <qcombobox.h> + +#include "smoothblendconfig.h" +#include "configdialog.h" + +////////////////////////////////////////////////////////////////////////////// +// smoothblendConfig() +// ------------- +// Constructor + +smoothblendConfig::smoothblendConfig(KConfig* config, QWidget* parent) + : QObject(parent), config_(0), dialog_(0) { + // create the configuration object + config_ = new KConfig("kwinsmoothblendrc"); + KGlobal::locale()->insertCatalogue("kwin_smoothblend_config"); + + // create and show the configuration dialog + dialog_ = new ConfigDialog(parent); + dialog_->show(); + + // load the configuration + load(config_); + + // setup the connections for title align + connect(dialog_->titlealign, SIGNAL(clicked(int)),this, SLOT(selectionChanged(int))); + // setup the connections for corner rounding + connect(dialog_->roundCorners, SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + // setup title shadow + connect(dialog_->titleshadow, SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + // setup button actions + connect(dialog_->animatebuttons, SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->btnComboBox, SIGNAL(activated(int)),this,SLOT(selectionChanged(int))); + // setup the connections for spin boxes + connect(dialog_->titlesize, SIGNAL(valueChanged(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->buttonsize, SIGNAL(valueChanged(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->framesize, SIGNAL(valueChanged(int)),this,SLOT(selectionChanged(int))); + // double click the menu + connect(dialog_->menuClose, SIGNAL(stateChanged(int)),this, SLOT(selectionChanged(int))); +} + +////////////////////////////////////////////////////////////////////////////// +// ~smoothblendConfig() +// -------------- +// Destructor + +smoothblendConfig::~smoothblendConfig() { + if (dialog_) + { + delete dialog_; + } + if (config_) + { + delete config_; + } +} + +////////////////////////////////////////////////////////////////////////////// +// selectionChanged() +// ------------------ +// Selection has changed + +void smoothblendConfig::selectionChanged(int) { + + if(dialog_->buttonsize->value() + dialog_->framesize->value() > dialog_->titlesize->value()) + { + dialog_->buttonsize->setValue(dialog_->titlesize->value()- dialog_->framesize->value()); + } + // setting the framesize to less than 2 will lose the top gradient and look flat + if(dialog_->framesize->value() < 2) + { + dialog_->framesize->setValue(2); + } + emit changed(); +} + +////////////////////////////////////////////////////////////////////////////// +// load() +// ------ +// Load configuration data + +void smoothblendConfig::load(KConfig*) { + config_->setGroup("General"); + + QString value = config_->readEntry("TitleAlignment", "AlignHCenter"); + QRadioButton *button = (QRadioButton*)dialog_->titlealign->child(value.latin1()); + if (button) + { + button->setChecked(true); + } + + dialog_->titlesize->setValue( config_->readNumEntry("TitleSize",30 ) ); + dialog_->buttonsize->setValue( config_->readNumEntry("ButtonSize",26 ) ); + dialog_->framesize->setValue( config_->readNumEntry("FrameSize",4 ) ); + + bool cornersFlag = config_->readBoolEntry("RoundCorners", true); + dialog_->roundCorners->setChecked( cornersFlag ); + bool titleshadow = config_->readBoolEntry("TitleShadow", true); + dialog_->titleshadow->setChecked(titleshadow); + bool animatebuttons = config_->readBoolEntry("AnimateButtons", true); + dialog_->animatebuttons->setChecked(animatebuttons); + dialog_->btnComboBox->setCurrentItem(config_->readNumEntry("ButtonComboBox",0)); + bool menuClose = config_->readBoolEntry("CloseOnMenuDoubleClick"); + dialog_->menuClose->setChecked(menuClose); +} + +////////////////////////////////////////////////////////////////////////////// +// save() +// ------ +// Save configuration data + +void smoothblendConfig::save(KConfig*) { + config_->setGroup("General"); + + QRadioButton *button = (QRadioButton*)dialog_->titlealign->selected(); + if (button) + { + config_->writeEntry("TitleAlignment", QString(button->name())); + } + config_->writeEntry("RoundCorners", dialog_->roundCorners->isChecked() ); + config_->writeEntry("TitleSize", dialog_->titlesize->value() ); + config_->writeEntry("ButtonSize", dialog_->buttonsize->value() ); + config_->writeEntry("FrameSize", dialog_->framesize->value() ); + config_->writeEntry("TitleShadow", dialog_->titleshadow->isChecked() ); + config_->writeEntry("AnimateButtons", dialog_->animatebuttons->isChecked() ); + config_->writeEntry("ButtonComboBox", dialog_->btnComboBox->currentItem()); + config_->writeEntry("CloseOnMenuDoubleClick", dialog_->menuClose->isChecked() ); + + config_->sync(); +} + +////////////////////////////////////////////////////////////////////////////// +// defaults() +// ---------- +// Set configuration defaults + +void smoothblendConfig::defaults() { + QRadioButton *button = (QRadioButton*)dialog_->titlealign->child("AlignHCenter"); + if (button) + { + button->setChecked(true); + } + dialog_->roundCorners->setChecked( true ); + dialog_->titlesize->setValue( 30 ); + dialog_->buttonsize->setValue( 26 ); + dialog_->framesize->setValue( 4 ); + dialog_->titleshadow->setChecked( true ); + dialog_->animatebuttons->setChecked( true ); + dialog_->btnComboBox->setCurrentItem( 0 ); + dialog_->menuClose->setChecked( false ); +} + +////////////////////////////////////////////////////////////////////////////// +// Plugin Stuff // +////////////////////////////////////////////////////////////////////////////// + +extern "C" { + QObject* allocate_config(KConfig* config, QWidget* parent) { + return (new smoothblendConfig(config, parent)); + } +} + +#include "smoothblendconfig.moc" diff --git a/kwin-styles/smooth-blend/client/config/smoothblendconfig.h b/kwin-styles/smooth-blend/client/config/smoothblendconfig.h new file mode 100644 index 00000000..3c4d18f7 --- /dev/null +++ b/kwin-styles/smooth-blend/client/config/smoothblendconfig.h @@ -0,0 +1,55 @@ +////////////////////////////////////////////////////////////////////////////// +// smoothblendconfig.h +// ------------------- +// Config module for Smooth Blend window decoration +// ------------------- +// Copyright (c) 2005 Ryan Nickell <p0z3r@users.sourceforge.net> +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301, USA. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef SMOOTHBLENDCONFIG_H +#define SMOOTHBLENDCONFIG_H + +#include <qobject.h> + +class KConfig; +class ConfigDialog; + +class smoothblendConfig : public QObject { + Q_OBJECT +public: + smoothblendConfig(KConfig* config, QWidget* parent); + ~smoothblendConfig(); + +signals: + void changed(); + +public slots: + void load(KConfig*); + void save(KConfig*); + void defaults(); + +protected slots: + void selectionChanged(int); + +private: + KConfig *config_; + ConfigDialog *dialog_; +}; + +#endif // SMOOTHBLENDCONFIG_H |