Use KConfigXT in MagicLamp effect
Thanks to Andrea Scarpino for providing the patch REVIEW: 106412icc-effect-5.14.5
parent
8ad02b5582
commit
9ac20a382d
|
@ -6,6 +6,8 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
|
|||
magiclamp/magiclamp.cpp
|
||||
)
|
||||
|
||||
kde4_add_kcfg_files(kwin4_effect_builtins_sources magiclamp/magiclampconfig.kcfgc)
|
||||
|
||||
# .desktop files
|
||||
install( FILES
|
||||
magiclamp/magiclamp.desktop
|
||||
|
@ -20,6 +22,8 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources
|
|||
magiclamp/magiclamp_config.ui
|
||||
)
|
||||
|
||||
kde4_add_kcfg_files(kwin4_effect_builtins_config_sources magiclamp/magiclampconfig.kcfgc)
|
||||
|
||||
# .desktop files
|
||||
install( FILES
|
||||
magiclamp/magiclamp_config.desktop
|
||||
|
|
|
@ -21,6 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// based on minimize animation by Rivo Laks <rivolaks@hot.ee>
|
||||
|
||||
#include "magiclamp.h"
|
||||
// KConfigSkeleton
|
||||
#include "magiclampconfig.h"
|
||||
|
||||
#include <kwinconfig.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <QtCore/QTimeLine>
|
||||
|
@ -48,8 +51,10 @@ bool MagicLampEffect::supported()
|
|||
|
||||
void MagicLampEffect::reconfigure(ReconfigureFlags)
|
||||
{
|
||||
MagicLampConfig::self()->readConfig();
|
||||
mAnimationDuration = animationTime(MagicLampConfig::animationDuration() != 0 ? MagicLampConfig::animationDuration() : 250);
|
||||
|
||||
KConfigGroup conf = effects->effectConfig("MagicLamp");
|
||||
mAnimationDuration = animationTime(conf, "AnimationDuration", 250);
|
||||
conf = effects->effectConfig("Shadow");
|
||||
int v = conf.readEntry("Size", 5);
|
||||
v += conf.readEntry("Fuzzyness", 10);
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||
<kcfgfile name="kwinrc"/>
|
||||
<group name="Effect-MagicLamp">
|
||||
<entry name="AnimationDuration" type="Int">
|
||||
<default>0</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
|
@ -18,6 +18,9 @@ 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 "magiclamp_config.h"
|
||||
// KConfigSkeleton
|
||||
#include "magiclampconfig.h"
|
||||
|
||||
#include <kwineffects.h>
|
||||
|
||||
#include <kconfiggroup.h>
|
||||
|
@ -43,39 +46,17 @@ MagicLampEffectConfig::MagicLampEffectConfig(QWidget* parent, const QVariantList
|
|||
|
||||
layout->addWidget(m_ui);
|
||||
|
||||
connect(m_ui->animationDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
addConfig(MagicLampConfig::self(), m_ui);
|
||||
|
||||
load();
|
||||
}
|
||||
|
||||
void MagicLampEffectConfig::load()
|
||||
{
|
||||
KCModule::load();
|
||||
|
||||
KConfigGroup conf = EffectsHandler::effectConfig("MagicLamp");
|
||||
|
||||
int duration = conf.readEntry("AnimationDuration", 0);
|
||||
m_ui->animationDurationSpin->setValue(duration);
|
||||
m_ui->animationDurationSpin->setSuffix(ki18np(" millisecond", " milliseconds"));
|
||||
emit changed(false);
|
||||
}
|
||||
|
||||
void MagicLampEffectConfig::save()
|
||||
{
|
||||
KConfigGroup conf = EffectsHandler::effectConfig("MagicLamp");
|
||||
|
||||
conf.writeEntry("AnimationDuration", m_ui->animationDurationSpin->value());
|
||||
|
||||
conf.sync();
|
||||
|
||||
emit changed(false);
|
||||
KCModule::save();
|
||||
EffectsHandler::sendReloadMessage("magiclamp");
|
||||
}
|
||||
|
||||
void MagicLampEffectConfig::defaults()
|
||||
{
|
||||
m_ui->animationDurationSpin->setValue(0);
|
||||
emit changed(true);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
#include "magiclamp_config.moc"
|
||||
|
|
|
@ -44,8 +44,7 @@ public:
|
|||
|
||||
public slots:
|
||||
virtual void save();
|
||||
virtual void load();
|
||||
virtual void defaults();
|
||||
|
||||
private:
|
||||
MagicLampEffectConfigForm* m_ui;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>KWin::MagicLampEffectConfigForm</class>
|
||||
<widget class="QWidget" name="KWin::MagicLampEffectConfigForm" >
|
||||
<property name="geometry" >
|
||||
<widget class="QWidget" name="KWin::MagicLampEffectConfigForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
|
@ -9,48 +10,44 @@
|
|||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Animation duration:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>animationDurationSpin</cstring>
|
||||
<property name="buddy">
|
||||
<cstring>kcfg_AnimationDuration</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="KIntSpinBox" name="animationDurationSpin" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="kcfg_AnimationDuration">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="specialValueText" >
|
||||
<string comment="Duration of rotation" >Default</string>
|
||||
<property name="specialValueText">
|
||||
<string comment="Duration of rotation">Default</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<property name="suffix">
|
||||
<string>milliseconds</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>5000</number>
|
||||
</property>
|
||||
<property name="singleStep" >
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KIntSpinBox</class>
|
||||
<extends>QSpinBox</extends>
|
||||
<header>knuminput.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
File=magiclamp.kcfg
|
||||
ClassName=MagicLampConfig
|
||||
NameSpace=KWin
|
||||
Singleton=true
|
||||
Mutators=true
|
Loading…
Reference in New Issue