diff options
Diffstat (limited to 'twin-styles/smooth-blend/client/config')
5 files changed, 704 insertions, 0 deletions
diff --git a/twin-styles/smooth-blend/client/config/CMakeLists.txt b/twin-styles/smooth-blend/client/config/CMakeLists.txt new file mode 100644 index 00000000..7a38efbb --- /dev/null +++ b/twin-styles/smooth-blend/client/config/CMakeLists.txt @@ -0,0 +1,32 @@ +################################################# +# +# (C) 2011 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_definitions( + -DQT_PLUGIN +) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + +##### twin_smoothblend_config (module) ########## + +tde_add_kpart( twin_smoothblend_config AUTOMOC + SOURCES configdialog.ui smoothblendconfig.cc + LINK tdeui-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/twin-styles/smooth-blend/client/config/Makefile.am b/twin-styles/smooth-blend/client/config/Makefile.am new file mode 100644 index 00000000..ba5cd314 --- /dev/null +++ b/twin-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 = twin_smoothblend_config.la +twin_smoothblend_config_la_SOURCES = configdialog.ui smoothblendconfig.cc +twin_smoothblend_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx +twin_smoothblend_config_la_LIBADD = $(LIB_TDEUI) +twin_smoothblend_config_la_METASOURCES = AUTO + +DISTCLEANFILES = $(twin_smoothblend_config_la_METASOURCES) diff --git a/twin-styles/smooth-blend/client/config/configdialog.ui b/twin-styles/smooth-blend/client/config/configdialog.ui new file mode 100644 index 00000000..09af45f6 --- /dev/null +++ b/twin-styles/smooth-blend/client/config/configdialog.ui @@ -0,0 +1,421 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>ConfigDialog</class> +<widget class="TQWidget"> + <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="TQGroupBox" 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="TQSpinBox" 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="TQCheckBox" 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="TQLabel" 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="TQCheckBox" 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="tqsizeHint"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQComboBox" 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="TQLabel" 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="tqsizeHint"> + <size> + <width>180</width> + <height>140</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="TQGroupBox" 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="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="text"> + <string>Text tqalignment:</string> + </property> + </widget> + <widget class="TQLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Frame width:</string> + </property> + </widget> + <widget class="TQLabel" 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="TQSpinBox" 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="TQSpinBox" 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="TQButtonGroup" 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="tqalignment"> + <set>AlignTop</set> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + <property name="whatsThis" stdset="0"> + <string>Use these buttons to set the tqalignment of the window title</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>tqlayout14</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQRadioButton"> + <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="TQRadioButton"> + <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="TQRadioButton"> + <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="tqsizeHint"> + <size> + <width>231</width> + <height>71</height> + </size> + </property> + </spacer> + <widget class="TQCheckBox" 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="TQCheckBox" 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/twin-styles/smooth-blend/client/config/smoothblendconfig.cc b/twin-styles/smooth-blend/client/config/smoothblendconfig.cc new file mode 100644 index 00000000..f2ec3e68 --- /dev/null +++ b/twin-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 <tqbuttongroup.h> +#include <tqgroupbox.h> +#include <tqradiobutton.h> +#include <tqcheckbox.h> +#include <tqspinbox.h> +#include <tqwhatsthis.h> +#include <tqcombobox.h> + +#include "smoothblendconfig.h" +#include "configdialog.h" + +////////////////////////////////////////////////////////////////////////////// +// smoothblendConfig() +// ------------- +// Constructor + +smoothblendConfig::smoothblendConfig(KConfig* config, TQWidget* parent) + : TQObject(parent), config_(0), dialog_(0) { + // create the configuration object + config_ = new KConfig("twinsmoothblendrc"); + KGlobal::locale()->insertCatalogue("twin_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, TQT_SIGNAL(clicked(int)),this, TQT_SLOT(selectionChanged(int))); + // setup the connections for corner rounding + connect(dialog_->roundCorners, TQT_SIGNAL(stateChanged(int)),this,TQT_SLOT(selectionChanged(int))); + // setup title shadow + connect(dialog_->titleshadow, TQT_SIGNAL(stateChanged(int)),this,TQT_SLOT(selectionChanged(int))); + // setup button actions + connect(dialog_->animatebuttons, TQT_SIGNAL(stateChanged(int)),this,TQT_SLOT(selectionChanged(int))); + connect(dialog_->btnComboBox, TQT_SIGNAL(activated(int)),this,TQT_SLOT(selectionChanged(int))); + // setup the connections for spin boxes + connect(dialog_->titlesize, TQT_SIGNAL(valueChanged(int)),this,TQT_SLOT(selectionChanged(int))); + connect(dialog_->buttonsize, TQT_SIGNAL(valueChanged(int)),this,TQT_SLOT(selectionChanged(int))); + connect(dialog_->framesize, TQT_SIGNAL(valueChanged(int)),this,TQT_SLOT(selectionChanged(int))); + // double click the menu + connect(dialog_->menuClose, TQT_SIGNAL(stateChanged(int)),this, TQT_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"); + + TQString value = config_->readEntry("TitleAlignment", "AlignHCenter"); + TQRadioButton *button = (TQRadioButton*)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"); + + TQRadioButton *button = (TQRadioButton*)dialog_->titlealign->selected(); + if (button) + { + config_->writeEntry("TitleAlignment", TQString(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() { + TQRadioButton *button = (TQRadioButton*)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" { + TQObject* allocate_config(KConfig* config, TQWidget* parent) { + return (new smoothblendConfig(config, parent)); + } +} + +#include "smoothblendconfig.moc" diff --git a/twin-styles/smooth-blend/client/config/smoothblendconfig.h b/twin-styles/smooth-blend/client/config/smoothblendconfig.h new file mode 100644 index 00000000..4f2add87 --- /dev/null +++ b/twin-styles/smooth-blend/client/config/smoothblendconfig.h @@ -0,0 +1,56 @@ +////////////////////////////////////////////////////////////////////////////// +// 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 <tqobject.h> + +class KConfig; +class ConfigDialog; + +class smoothblendConfig : public TQObject { + Q_OBJECT + TQ_OBJECT +public: + smoothblendConfig(KConfig* config, TQWidget* 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 |