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

« back to all changes in this revision

Viewing changes to kwin/effects/dashboard/dashboard_config.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 © 2010 Andreas Demmer <ademmer@opensuse.org>
 
3
 *
 
4
 *   This program is free software; you can redistribute it and/or modify
 
5
 *   it under the terms of the GNU General Public License as published by
 
6
 *   the Free Software Foundation; either version 2 of the License, or
 
7
 *   (at your option) any later version.
 
8
 *
 
9
 *   This program is distributed in the hope that it will be useful,
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 *   General Public License for more details.
 
13
 *
 
14
 *   You should have received a copy of the GNU General Public License
 
15
 *   along with this program; see the file COPYING.  if not, write to
 
16
 *   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
 *   Boston, MA 02110-1301, USA.
 
18
 */
 
19
 
 
20
#include "dashboard_config.h"
 
21
#include <kwineffects.h>
 
22
 
 
23
namespace KWin
 
24
{
 
25
 
 
26
KWIN_EFFECT_CONFIG_FACTORY
 
27
 
 
28
DashboardEffectConfig::DashboardEffectConfig(QWidget *parent, const QVariantList &args)
 
29
    : KCModule(EffectFactory::componentData(), parent, args)
 
30
{
 
31
    ui.setupUi(this);
 
32
 
 
33
    connect(ui.brightness, SIGNAL(valueChanged(int)), SLOT(changed()));
 
34
    connect(ui.saturation, SIGNAL(valueChanged(int)), SLOT(changed()));
 
35
    connect(ui.duration, SIGNAL(valueChanged(int)), SLOT(changed()));
 
36
    connect(ui.blur, SIGNAL(stateChanged(int)), SLOT(changed()));
 
37
 
 
38
    load();
 
39
}
 
40
 
 
41
DashboardEffectConfig::~DashboardEffectConfig()
 
42
{
 
43
}
 
44
 
 
45
void DashboardEffectConfig::load()
 
46
{
 
47
    KCModule::load();
 
48
    KConfigGroup config = EffectsHandler::effectConfig("Dashboard");
 
49
 
 
50
    const int brightness = config.readEntry<int>("Brightness", 50);
 
51
    ui.brightness->setValue(brightness);
 
52
 
 
53
    const int saturation = config.readEntry<int>("Saturation", 50);
 
54
    ui.saturation->setValue(saturation);
 
55
 
 
56
    const int duration = config.readEntry("Duration", 500);
 
57
    ui.duration->setValue(duration);
 
58
 
 
59
    bool blur = config.readEntry("Blur", false);
 
60
    ui.blur->setChecked(blur);
 
61
 
 
62
    emit changed(false);
 
63
}
 
64
 
 
65
void DashboardEffectConfig::save()
 
66
{
 
67
    KCModule::save();
 
68
 
 
69
    KConfigGroup config = EffectsHandler::effectConfig("Dashboard");
 
70
 
 
71
    config.writeEntry("Brightness", ui.brightness->value());
 
72
    config.writeEntry("Saturation", ui.saturation->value());
 
73
    config.writeEntry("Duration", ui.duration->value());
 
74
    config.writeEntry("Blur", ui.blur->isChecked());
 
75
 
 
76
    config.sync();
 
77
 
 
78
    emit changed(false);
 
79
    EffectsHandler::sendReloadMessage("dashboard");
 
80
}
 
81
 
 
82
void DashboardEffectConfig::defaults()
 
83
{
 
84
    ui.brightness->setValue(50);
 
85
    ui.saturation->setValue(50);
 
86
    ui.duration->setValue(500);
 
87
    ui.blur->setChecked(false);
 
88
    emit changed(true);
 
89
}
 
90
 
 
91
} // namespace KWin
 
92