summaryrefslogtreecommitdiffstats
path: root/styles/phase/config/phasestyleconfig.cpp
blob: 990b98e337eb5819736fa13cfcb8af0624349971 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//////////////////////////////////////////////////////////////////////////////
// phasestyleconfig.cpp
// -------------------
// Config dialog for Phase widget style
// -------------------
// Copyright (c) 2004 David Johnson <[email protected]>
// Please see the header file for copyright and license information.
//////////////////////////////////////////////////////////////////////////////

#include <tqsettings.h>
#include <tqcheckbox.h>
#include <tqgroupbox.h>
#include <tqwhatsthis.h>
#include <tdelocale.h>
#include <tdeglobal.h>

#include "phasestyleconfig.h"
#include "styledialog.h"

//////////////////////////////////////////////////////////////////////////////
// PhaseStyleConfig Class                                                    //
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
// PhaseStyleConfig()
// ----------------
// Constructor

PhaseStyleConfig::PhaseStyleConfig(TQWidget* parent) : StyleDialog(parent)
{
    TDEGlobal::locale()->insertCatalogue("kstyle_phase_config");

    TQSettings settings;
    oldgradients =
        settings.readBoolEntry("/phasestyle/Settings/gradients", true);
    gradients->setChecked(oldgradients);
    oldhighlights =
        settings.readBoolEntry("/phasestyle/Settings/highlights", true);
    highlights->setChecked(oldhighlights);

    // connections
    connect(gradients, TQT_SIGNAL(toggled(bool)),
            this, TQT_SLOT(updateChanged()));
    connect(highlights, TQT_SIGNAL(toggled(bool)),
            this, TQT_SLOT(updateChanged()));
}

//////////////////////////////////////////////////////////////////////////////
// ~PhaseStyleConfig()
// -----------------
// Destructor

PhaseStyleConfig::~PhaseStyleConfig()
{
    TDEGlobal::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()
{
    TQSettings 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 TQObject* allocate_kstyle_config(TQWidget* parent) {
        return(TQT_TQOBJECT(new PhaseStyleConfig(parent)));
    }
}

#include "phasestyleconfig.moc"