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

« back to all changes in this revision

Viewing changes to kwin/effects/_test/slidetabs/slidetabs_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
 KWin - the KDE window manager
 
3
 This file is part of the KDE project.
 
4
 
 
5
Copyright (C) 2009 Jorge Mata <matamax123@gmail.com>
 
6
 
 
7
This program is free software; you can redistribute it and/or modify
 
8
it under the terms of the GNU General Public License as published by
 
9
the Free Software Foundation; either version 2 of the License, or
 
10
(at your option) any later version.
 
11
 
 
12
This program is distributed in the hope that it will be useful,
 
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
GNU General Public License for more details.
 
16
 
 
17
You should have received a copy of the GNU General Public License
 
18
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
*********************************************************************/
 
20
 
 
21
#include "slidetabs_config.h"
 
22
 
 
23
#include <kwineffects.h>
 
24
 
 
25
#include <klocale.h>
 
26
#include <kconfiggroup.h>
 
27
#include <QWidget>
 
28
#include <QVBoxLayout>
 
29
 
 
30
namespace KWin
 
31
{
 
32
 
 
33
KWIN_EFFECT_CONFIG_FACTORY
 
34
 
 
35
SlideTabsEffectConfigForm::SlideTabsEffectConfigForm(QWidget* parent) : QWidget(parent)
 
36
{
 
37
    setupUi(this);
 
38
}
 
39
 
 
40
SlideTabsEffectConfig::SlideTabsEffectConfig(QWidget* parent, const QVariantList& args)
 
41
    : KCModule(EffectFactory::componentData(), parent, args)
 
42
{
 
43
    m_ui = new SlideTabsEffectConfigForm(this);
 
44
 
 
45
    QVBoxLayout* layout = new QVBoxLayout(this);
 
46
 
 
47
    layout->addWidget(m_ui);
 
48
 
 
49
    connect(m_ui->grouping, SIGNAL(toggled(bool)), this, SLOT(changed()));
 
50
    connect(m_ui->switching, SIGNAL(toggled(bool)), this, SLOT(changed()));
 
51
    connect(m_ui->duration, SIGNAL(valueChanged(int)), this, SLOT(changed()));
 
52
 
 
53
    load();
 
54
}
 
55
 
 
56
void SlideTabsEffectConfig::save()
 
57
{
 
58
    KConfigGroup conf = EffectsHandler::effectConfig("SlideTabs");
 
59
 
 
60
    conf.writeEntry("SlideGrouping", m_ui->grouping->isChecked());
 
61
    conf.writeEntry("SlideSwitching", m_ui->switching->isChecked());
 
62
    conf.writeEntry("SlideDuration", m_ui->duration->value());
 
63
 
 
64
    conf.sync();
 
65
 
 
66
    KCModule::save();
 
67
    emit changed(false);
 
68
    EffectsHandler::sendReloadMessage("slidetabs");
 
69
}
 
70
 
 
71
void SlideTabsEffectConfig::load()
 
72
{
 
73
    KCModule::load();
 
74
    KConfigGroup conf = EffectsHandler::effectConfig("SlideTabs");
 
75
 
 
76
    bool switching = conf.readEntry("SlideSwitching", true);
 
77
    bool grouping = conf.readEntry("SlideGrouping", true);
 
78
    int duration = conf.readEntry("SlideDuration", 500);
 
79
    m_ui->switching->setChecked(switching);
 
80
    m_ui->grouping->setChecked(grouping);
 
81
    m_ui->duration->setValue(duration);
 
82
    emit changed(false);
 
83
}
 
84
 
 
85
void SlideTabsEffectConfig::defaults()
 
86
{
 
87
    m_ui->grouping->setChecked(true);
 
88
    m_ui->switching->setChecked(true);
 
89
    m_ui->duration->setValue(500);
 
90
    emit changed(true);
 
91
}
 
92
 
 
93
}
 
94
 
 
95
#include "slidetabs_config.moc"