Back to index

kdeartwork  4.3.2
phasestyleconfig.cpp
Go to the documentation of this file.
00001 
00002 // phasestyleconfig.cpp
00003 // -------------------
00004 // Config dialog for Phase widget style
00005 // -------------------
00006 // Copyright (c) 2004-2007 David Johnson <david@usermode.org>
00007 // Please see the header file for copyright and license information.
00009 
00010 #include "phasestyleconfig.h"
00011 
00012 #include <QSettings>
00013 #include <QCheckBox>
00014 #include <klocale.h>
00015 #include <kglobal.h>
00016 
00018 // PhaseStyleConfig Class                                                   //
00020 
00022 // PhaseStyleConfig()
00023 // ----------------
00024 // Constructor
00025 
00026 PhaseStyleConfig::PhaseStyleConfig(QWidget* parent) : QWidget(parent)
00027 {
00028     KGlobal::locale()->insertCatalog("kstyle_phase_config");
00029 
00030     setupUi(this);
00031 
00032     QSettings settings("phasestyle");
00033     oldgradients =
00034         settings.value("/gradients", true).toBool();
00035     gradients->setChecked(oldgradients);
00036     oldhighlights =
00037         settings.value("/highlights", true).toBool();
00038     highlights->setChecked(oldhighlights);
00039 
00040     // connections
00041     connect(gradients, SIGNAL(toggled(bool)),
00042             this, SLOT(updateChanged()));
00043     connect(highlights, SIGNAL(toggled(bool)),
00044             this, SLOT(updateChanged()));
00045 }
00046 
00048 // ~PhaseStyleConfig()
00049 // -----------------
00050 // Destructor
00051 
00052 PhaseStyleConfig::~PhaseStyleConfig()
00053 {
00054     KGlobal::locale()->removeCatalog("kstyle_phase_config");
00055 }
00056 
00058 // selectionChanged()
00059 // ------------------
00060 // Selection has changed
00061 
00062 void PhaseStyleConfig::updateChanged()
00063 {
00064     bool update = false;
00065 
00066     if ((gradients->isChecked() != oldgradients) ||
00067         (highlights->isChecked() != oldhighlights)) {
00068         update = true;
00069     }
00070 
00071     emit changed(update);
00072 }
00073 
00075 // save()
00076 // ------
00077 // Save the settings
00078 
00079 void PhaseStyleConfig::save()
00080 {
00081     QSettings settings("phasestyle");
00082     settings.setValue("/gradients", gradients->isChecked());
00083     settings.setValue("/highlights", highlights->isChecked());
00084 }
00085 
00087 // defaults()
00088 // ----------
00089 // Set to the defaults
00090 
00091 void PhaseStyleConfig::defaults()
00092 {
00093     gradients->setChecked(true);
00094     highlights->setChecked(true);
00095 }
00096 
00098 // Plugin Stuff                                                             //
00100 
00101 extern "C"
00102 {
00103     KDE_EXPORT QObject* allocate_kstyle_config(QWidget* parent) {
00104         return(new PhaseStyleConfig(parent));
00105     }
00106 }
00107 
00108 #include "phasestyleconfig.moc"