~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kstyles/keramik/config/keramikconf.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (c) 2003 Maksim Orlovich <maksim.orlovich@kdemail.net>
 
3
 
 
4
Permission is hereby granted, free of charge, to any person obtaining a
 
5
copy of this software and associated documentation files (the "Software"),
 
6
to deal in the Software without restriction, including without limitation
 
7
the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
8
and/or sell copies of the Software, and to permit persons to whom the
 
9
Software is furnished to do so, subject to the following conditions:
 
10
 
 
11
The above copyright notice and this permission notice shall be included in
 
12
all copies or substantial portions of the Software.
 
13
 
 
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
15
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
16
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
17
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
18
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
19
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
20
DEALINGS IN THE SOFTWARE.
 
21
 
 
22
*/
 
23
 
 
24
#include <QCheckBox>
 
25
#include <QtCore/QSettings>
 
26
#include <QVBoxLayout>
 
27
#include <kdialog.h>
 
28
#include <kglobal.h>
 
29
#include <klocale.h>
 
30
 
 
31
#include "keramikconf.h"
 
32
 
 
33
extern "C"
 
34
{
 
35
        KDE_EXPORT QWidget* allocate_kstyle_config(QWidget* parent)
 
36
        {
 
37
                return new KeramikStyleConfig(parent);
 
38
        }
 
39
}
 
40
 
 
41
KeramikStyleConfig::KeramikStyleConfig(QWidget* parent): QWidget(parent)
 
42
{
 
43
        //Should have no margins here, the dialog provides them
 
44
        QVBoxLayout* layout = new QVBoxLayout(this);
 
45
        layout->setMargin(0);
 
46
        layout->setSpacing(0);
 
47
        KGlobal::locale()->insertCatalog("kstyle_keramik_config");
 
48
 
 
49
        //highlightLineEdits = new QCheckBox(i18n("Highlight active lineedits"), this);
 
50
        highlightScrollBar = new QCheckBox(i18n("Highlight scroll bar handles"), this);
 
51
        animateProgressBar = new QCheckBox(i18n("Animate progress bars"), this);
 
52
 
 
53
        //layout->addWidget(highlightLineEdits);
 
54
        layout->addWidget(highlightScrollBar);
 
55
        layout->addWidget(animateProgressBar);
 
56
        layout->addStretch(1);
 
57
 
 
58
        QSettings s;
 
59
        //origHlLineEdit = s.value("/keramik/Settings/highlightLineEdits", false).toBool();
 
60
        //highlightLineEdits->setChecked(origHlLineEdit);
 
61
 
 
62
        origHlScrollbar = s.value("/keramik/Settings/highlightScrollBar", true).toBool();
 
63
        highlightScrollBar->setChecked(origHlScrollbar);
 
64
 
 
65
        origAnimProgressBar = s.value("/keramik/Settings/animateProgressBar", false).toBool();
 
66
        animateProgressBar->setChecked(origAnimProgressBar);
 
67
 
 
68
        //connect(highlightLineEdits, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) );
 
69
        connect(highlightScrollBar, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) );
 
70
        connect(animateProgressBar, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) );
 
71
}
 
72
 
 
73
KeramikStyleConfig::~KeramikStyleConfig()
 
74
{
 
75
        KGlobal::locale()->removeCatalog("kstyle_keramik_config");
 
76
}
 
77
 
 
78
 
 
79
void KeramikStyleConfig::save()
 
80
{
 
81
        QSettings s;
 
82
        //s.setValue("/keramik/Settings/highlightLineEdits", highlightLineEdits->isChecked());
 
83
        s.setValue("/keramik/Settings/highlightScrollBar", highlightScrollBar->isChecked());
 
84
        s.setValue("/keramik/Settings/animateProgressBar", animateProgressBar->isChecked());
 
85
}
 
86
 
 
87
void KeramikStyleConfig::defaults()
 
88
{
 
89
        //highlightLineEdits->setChecked(false);
 
90
        highlightScrollBar->setChecked(true);
 
91
        animateProgressBar->setChecked(false);
 
92
        //updateChanged would be done by setChecked already
 
93
}
 
94
 
 
95
void KeramikStyleConfig::updateChanged()
 
96
{
 
97
        if ( /*(highlightLineEdits->isChecked() == origHlLineEdit)  &&*/
 
98
                 (highlightScrollBar->isChecked() == origHlScrollbar) &&
 
99
                 (animateProgressBar->isChecked() == origAnimProgressBar) )
 
100
                emit changed(false);
 
101
        else
 
102
                emit changed(true);
 
103
}
 
104
 
 
105
#include "keramikconf.moc"