2010-07-23 19:52:20 +00:00
|
|
|
/*
|
|
|
|
* Copyright © 2010 Andreas Demmer <ademmer@opensuse.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. if not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dashboard_config.h"
|
|
|
|
#include <kwineffects.h>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
KWIN_EFFECT_CONFIG_FACTORY
|
|
|
|
|
|
|
|
DashboardEffectConfig::DashboardEffectConfig(QWidget *parent, const QVariantList &args)
|
|
|
|
: KCModule(EffectFactory::componentData(), parent, args)
|
|
|
|
{
|
|
|
|
ui.setupUi(this);
|
|
|
|
|
2011-03-17 18:02:52 +00:00
|
|
|
connect(ui.brightness, SIGNAL(valueChanged(int)), SLOT(changed()));
|
|
|
|
connect(ui.saturation, SIGNAL(valueChanged(int)), SLOT(changed()));
|
|
|
|
connect(ui.duration, SIGNAL(valueChanged(int)), SLOT(changed()));
|
|
|
|
connect(ui.blur, SIGNAL(stateChanged(int)), SLOT(changed()));
|
2010-07-23 19:52:20 +00:00
|
|
|
|
|
|
|
load();
|
|
|
|
}
|
|
|
|
|
|
|
|
DashboardEffectConfig::~DashboardEffectConfig()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void DashboardEffectConfig::load()
|
|
|
|
{
|
|
|
|
KCModule::load();
|
|
|
|
KConfigGroup config = EffectsHandler::effectConfig("Dashboard");
|
|
|
|
|
2011-03-17 17:56:17 +00:00
|
|
|
const int brightness = config.readEntry<int>("Brightness", 50);
|
|
|
|
ui.brightness->setValue(brightness);
|
2010-07-23 19:52:20 +00:00
|
|
|
|
2011-03-17 17:56:17 +00:00
|
|
|
const int saturation = config.readEntry<int>("Saturation", 50);
|
|
|
|
ui.saturation->setValue(saturation);
|
2010-07-23 19:52:20 +00:00
|
|
|
|
2011-03-17 17:56:17 +00:00
|
|
|
const int duration = config.readEntry("Duration", 500);
|
|
|
|
ui.duration->setValue(duration);
|
2010-10-20 06:33:55 +00:00
|
|
|
|
2010-07-23 19:52:20 +00:00
|
|
|
bool blur = config.readEntry("Blur", false);
|
|
|
|
ui.blur->setChecked(blur);
|
|
|
|
|
|
|
|
emit changed(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DashboardEffectConfig::save()
|
|
|
|
{
|
|
|
|
KCModule::save();
|
|
|
|
|
|
|
|
KConfigGroup config = EffectsHandler::effectConfig("Dashboard");
|
|
|
|
|
|
|
|
config.writeEntry("Brightness", ui.brightness->value());
|
|
|
|
config.writeEntry("Saturation", ui.saturation->value());
|
2010-10-20 06:33:55 +00:00
|
|
|
config.writeEntry("Duration", ui.duration->value());
|
2010-07-23 19:52:20 +00:00
|
|
|
config.writeEntry("Blur", ui.blur->isChecked());
|
|
|
|
|
|
|
|
config.sync();
|
|
|
|
|
|
|
|
emit changed(false);
|
|
|
|
EffectsHandler::sendReloadMessage("dashboard");
|
|
|
|
}
|
|
|
|
|
|
|
|
void DashboardEffectConfig::defaults()
|
|
|
|
{
|
|
|
|
emit changed(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace KWin
|
|
|
|
|