diff options
Diffstat (limited to 'styles/phase/config')
-rw-r--r-- | styles/phase/config/Makefile.am | 12 | ||||
-rw-r--r-- | styles/phase/config/phasestyleconfig.cpp | 111 | ||||
-rw-r--r-- | styles/phase/config/phasestyleconfig.h | 56 | ||||
-rw-r--r-- | styles/phase/config/styledialog.ui | 70 |
4 files changed, 249 insertions, 0 deletions
diff --git a/styles/phase/config/Makefile.am b/styles/phase/config/Makefile.am new file mode 100644 index 00000000..725d15a3 --- /dev/null +++ b/styles/phase/config/Makefile.am @@ -0,0 +1,12 @@ +INCLUDES = $(all_includes) + +noinst_HEADERS = phasestyleconfig.h + +kde_module_LTLIBRARIES = kstyle_phase_config.la +kstyle_phase_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +kstyle_phase_config_la_LIBADD = $(LIB_KDEUI) +kstyle_phase_config_la_SOURCES = phasestyleconfig.cpp styledialog.ui +kstyle_phase_config_la_METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/kstyle_phase_config.pot diff --git a/styles/phase/config/phasestyleconfig.cpp b/styles/phase/config/phasestyleconfig.cpp new file mode 100644 index 00000000..8543214c --- /dev/null +++ b/styles/phase/config/phasestyleconfig.cpp @@ -0,0 +1,111 @@ +////////////////////////////////////////////////////////////////////////////// +// phasestyleconfig.cpp +// ------------------- +// Config dialog for Phase widget style +// ------------------- +// Copyright (c) 2004 David Johnson <david@usermode.org> +// Please see the header file for copyright and license information. +////////////////////////////////////////////////////////////////////////////// + +#include <qsettings.h> +#include <qcheckbox.h> +#include <qgroupbox.h> +#include <qwhatsthis.h> +#include <klocale.h> +#include <kglobal.h> + +#include "phasestyleconfig.h" +#include "styledialog.h" + +////////////////////////////////////////////////////////////////////////////// +// PhaseStyleConfig Class // +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +// PhaseStyleConfig() +// ---------------- +// Constructor + +PhaseStyleConfig::PhaseStyleConfig(QWidget* parent) : StyleDialog(parent) +{ + KGlobal::locale()->insertCatalogue("kstyle_phase_config"); + + QSettings settings; + oldgradients = + settings.readBoolEntry("/phasestyle/Settings/gradients", true); + gradients->setChecked(oldgradients); + oldhighlights = + settings.readBoolEntry("/phasestyle/Settings/highlights", true); + highlights->setChecked(oldhighlights); + + // connections + connect(gradients, SIGNAL(toggled(bool)), + this, SLOT(updateChanged())); + connect(highlights, SIGNAL(toggled(bool)), + this, SLOT(updateChanged())); +} + +////////////////////////////////////////////////////////////////////////////// +// ~PhaseStyleConfig() +// ----------------- +// Destructor + +PhaseStyleConfig::~PhaseStyleConfig() +{ + KGlobal::locale()->removeCatalogue("kstyle_phase_config"); +} + +////////////////////////////////////////////////////////////////////////////// +// selectionChanged() +// ------------------ +// Selection has changed + +void PhaseStyleConfig::updateChanged() +{ + bool update = false; + + if ((gradients->isChecked() != oldgradients) || + (highlights->isChecked() != oldhighlights)) { + update = true; + } + + emit changed(update); +} + +////////////////////////////////////////////////////////////////////////////// +// save() +// ------ +// Save the settings + +void PhaseStyleConfig::save() +{ + QSettings settings; + settings.writeEntry("/phasestyle/Settings/gradients", + gradients->isChecked()); + settings.writeEntry("/phasestyle/Settings/highlights", + highlights->isChecked()); +} + +////////////////////////////////////////////////////////////////////////////// +// defaults() +// ---------- +// Set to the defaults + +void PhaseStyleConfig::defaults() +{ + gradients->setChecked(true); + highlights->setChecked(true); +} + +////////////////////////////////////////////////////////////////////////////// +// Plugin Stuff // +////////////////////////////////////////////////////////////////////////////// + +extern "C" +{ + KDE_EXPORT QObject* allocate_kstyle_config(QWidget* parent) { + return(new PhaseStyleConfig(parent)); + } +} + +#include "phasestyleconfig.moc" diff --git a/styles/phase/config/phasestyleconfig.h b/styles/phase/config/phasestyleconfig.h new file mode 100644 index 00000000..8f15531c --- /dev/null +++ b/styles/phase/config/phasestyleconfig.h @@ -0,0 +1,56 @@ +////////////////////////////////////////////////////////////////////////////// +// phasestyleconfig.h +// ------------------- +// Config dialog for Phase widget style +// ------------------- +// Copyright (c) 2004 David Johnson <david@usermode.org> +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +////////////////////////////////////////////////////////////////////////////// + +#ifndef PHASESTYLECONFIG_H +#define PHASESTYLECONFIG_H + +#include "styledialog.h" + +class KConfig; + +class PhaseStyleConfig : public StyleDialog +{ + Q_OBJECT +public: + PhaseStyleConfig(QWidget* parent); + ~PhaseStyleConfig(); + +signals: + void changed(bool); + +public slots: + void save(); + void defaults(); + +protected slots: + void updateChanged(); + +private: + bool oldgradients; + bool oldhighlights; +}; + +#endif // PHASESTYLECONFIG_H diff --git a/styles/phase/config/styledialog.ui b/styles/phase/config/styledialog.ui new file mode 100644 index 00000000..2015003e --- /dev/null +++ b/styles/phase/config/styledialog.ui @@ -0,0 +1,70 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>StyleDialog</class> +<widget class="QWidget"> + <property name="name"> + <cstring>StyleDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>217</width> + <height>103</height> + </rect> + </property> + <property name="caption"> + <string>Style Dialog</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>stylebox</cstring> + </property> + <property name="frameShape"> + <enum>GroupBoxPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="title"> + <string>Style Settings</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>gradients</cstring> + </property> + <property name="text"> + <string>Use &gradients</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This option will draw buttons and several other widgets using a gradient texture</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>highlights</cstring> + </property> + <property name="text"> + <string>Highlight on &mouse hover</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This option will highlight buttons and several other widgets when the mouse cursor is over them</string> + </property> + </widget> + </vbox> + </widget> + </hbox> +</widget> +<tabstops> + <tabstop>gradients</tabstop> + <tabstop>highlights</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> |