2008-04-18 12:01:47 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2008 Cédric Borgese <cedric.borgese@gmail.com>
|
|
|
|
|
|
|
|
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. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#include "wobblywindows_config.h"
|
|
|
|
|
|
|
|
#include <kwineffects.h>
|
|
|
|
|
|
|
|
#include <klocale.h>
|
|
|
|
#include <kdebug.h>
|
|
|
|
#include <KActionCollection>
|
|
|
|
#include <kaction.h>
|
|
|
|
#include <KGlobalAccel>
|
|
|
|
#include <kconfiggroup.h>
|
|
|
|
|
|
|
|
#include <QGridLayout>
|
|
|
|
#ifndef KDE_USE_FINAL
|
|
|
|
KWIN_EFFECT_CONFIG_FACTORY
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
WobblyWindowsEffectConfig::WobblyWindowsEffectConfig(QWidget* parent, const QVariantList& args) :
|
|
|
|
KCModule(EffectFactory::componentData(), parent, args)
|
|
|
|
{
|
|
|
|
m_ui.setupUi(this);
|
|
|
|
|
2008-04-24 21:22:52 +00:00
|
|
|
connect(m_ui.slWobblyness, SIGNAL(valueChanged(int)), this, SLOT(slotSlWobblyness(int)));
|
2008-04-18 12:01:47 +00:00
|
|
|
|
|
|
|
load();
|
|
|
|
}
|
|
|
|
|
|
|
|
WobblyWindowsEffectConfig::~WobblyWindowsEffectConfig()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void WobblyWindowsEffectConfig::load()
|
|
|
|
{
|
|
|
|
KCModule::load();
|
|
|
|
|
|
|
|
KConfigGroup conf = EffectsHandler::effectConfig("Wobbly");
|
2008-04-24 21:22:52 +00:00
|
|
|
bool change = true;
|
2008-04-18 12:01:47 +00:00
|
|
|
|
2008-04-24 21:22:52 +00:00
|
|
|
unsigned int wobblynessLevel = 2;
|
|
|
|
QString settingsMode = conf.readEntry("Settings", "Auto");
|
|
|
|
if (settingsMode != "Custom")
|
2008-04-18 12:01:47 +00:00
|
|
|
{
|
2008-04-24 21:22:52 +00:00
|
|
|
wobblynessLevel = conf.readEntry("WobblynessLevel", 2);
|
|
|
|
change = false;
|
2008-04-18 12:01:47 +00:00
|
|
|
}
|
|
|
|
|
2008-04-24 21:22:52 +00:00
|
|
|
if (wobblynessLevel > 4)
|
2008-04-18 12:01:47 +00:00
|
|
|
{
|
2008-04-24 21:22:52 +00:00
|
|
|
wobblynessLevel = 4;
|
|
|
|
change = true;
|
2008-04-18 12:01:47 +00:00
|
|
|
}
|
|
|
|
|
2008-04-24 21:22:52 +00:00
|
|
|
m_ui.slWobblyness->setSliderPosition(wobblynessLevel);
|
2008-04-18 12:01:47 +00:00
|
|
|
|
2008-04-24 21:22:52 +00:00
|
|
|
emit changed(change);
|
2008-04-18 12:01:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WobblyWindowsEffectConfig::save()
|
|
|
|
{
|
|
|
|
KConfigGroup conf = EffectsHandler::effectConfig("Wobbly");
|
|
|
|
|
2008-04-24 21:22:52 +00:00
|
|
|
conf.writeEntry("Settings", "Auto");
|
|
|
|
conf.writeEntry("WobblynessLevel", m_ui.slWobblyness->value());
|
2008-04-18 12:01:47 +00:00
|
|
|
|
|
|
|
emit changed(false);
|
2008-05-20 21:25:18 +00:00
|
|
|
EffectsHandler::sendReloadMessage("wobblywindows");
|
2008-04-18 12:01:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WobblyWindowsEffectConfig::defaults()
|
|
|
|
{
|
2008-04-24 21:22:52 +00:00
|
|
|
m_ui.slWobblyness->setSliderPosition(2);
|
2008-04-18 12:01:47 +00:00
|
|
|
|
|
|
|
emit changed(true);
|
|
|
|
}
|
|
|
|
|
2008-04-24 21:22:52 +00:00
|
|
|
void WobblyWindowsEffectConfig::slotSlWobblyness(int)
|
2008-04-18 12:01:47 +00:00
|
|
|
{
|
|
|
|
emit changed(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#include "wobblywindows_config.moc"
|