Use KConfigXT in Resize Effect
REVIEW: 106397
This commit is contained in:
parent
968d10c14a
commit
f581e22e38
7 changed files with 35 additions and 35 deletions
|
@ -6,6 +6,8 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
|
|||
resize/resize.cpp
|
||||
)
|
||||
|
||||
kde4_add_kcfg_files(kwin4_effect_builtins_sources resize/resizeconfig.kcfgc)
|
||||
|
||||
# .desktop files
|
||||
install( FILES
|
||||
resize/resize.desktop
|
||||
|
@ -19,6 +21,7 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources
|
|||
resize/resize_config.cpp
|
||||
resize/resize_config.ui
|
||||
)
|
||||
kde4_add_kcfg_files(kwin4_effect_builtins_config_sources resize/resizeconfig.kcfgc)
|
||||
|
||||
# .desktop files
|
||||
install( FILES
|
||||
|
|
|
@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*********************************************************************/
|
||||
|
||||
#include "resize.h"
|
||||
// KConfigSkeleton
|
||||
#include "resizeconfig.h"
|
||||
|
||||
#include <kwinglutils.h>
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
|
@ -27,7 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#endif
|
||||
|
||||
#include <KColorScheme>
|
||||
#include <KDE/KConfigGroup>
|
||||
|
||||
#include <QtGui/QVector2D>
|
||||
|
||||
|
@ -129,11 +130,11 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
|
|||
|
||||
void ResizeEffect::reconfigure(ReconfigureFlags)
|
||||
{
|
||||
KConfigGroup conf = effects->effectConfig("Resize");
|
||||
m_features = 0;
|
||||
if (conf.readEntry("TextureScale", true))
|
||||
ResizeConfig::self()->readConfig();
|
||||
if (ResizeConfig::textureScale())
|
||||
m_features |= TextureScale;
|
||||
if (conf.readEntry("Outline", false))
|
||||
if (ResizeConfig::outline())
|
||||
m_features |= Outline;
|
||||
}
|
||||
|
||||
|
|
15
effects/resize/resize.kcfg
Normal file
15
effects/resize/resize.kcfg
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?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-Resize">
|
||||
<entry name="TextureScale" type="Bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="Outline" type="Bool">
|
||||
<default>false</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 "resize_config.h"
|
||||
// KConfigSkeleton
|
||||
#include "resizeconfig.h"
|
||||
|
||||
#include <kwineffects.h>
|
||||
|
||||
#include <kconfiggroup.h>
|
||||
|
@ -43,42 +46,17 @@ ResizeEffectConfig::ResizeEffectConfig(QWidget* parent, const QVariantList& args
|
|||
|
||||
layout->addWidget(m_ui);
|
||||
|
||||
connect(m_ui->scaleBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->outlineBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
||||
addConfig(ResizeConfig::self(), m_ui);
|
||||
|
||||
load();
|
||||
}
|
||||
|
||||
void ResizeEffectConfig::load()
|
||||
{
|
||||
KCModule::load();
|
||||
|
||||
KConfigGroup conf = EffectsHandler::effectConfig("Resize");
|
||||
m_ui->scaleBox->setChecked(conf.readEntry<bool>("TextureScale", true));
|
||||
m_ui->outlineBox->setChecked(conf.readEntry<bool>("Outline" , false));
|
||||
|
||||
emit changed(false);
|
||||
}
|
||||
|
||||
void ResizeEffectConfig::save()
|
||||
{
|
||||
KConfigGroup conf = EffectsHandler::effectConfig("Resize");
|
||||
conf.writeEntry("TextureScale", m_ui->scaleBox->isChecked());
|
||||
conf.writeEntry("Outline", m_ui->outlineBox->isChecked());
|
||||
|
||||
conf.sync();
|
||||
|
||||
emit changed(false);
|
||||
KCModule::save();
|
||||
EffectsHandler::sendReloadMessage("resize");
|
||||
}
|
||||
|
||||
void ResizeEffectConfig::defaults()
|
||||
{
|
||||
m_ui->scaleBox->setChecked(true);
|
||||
m_ui->outlineBox->setChecked(false);
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#include "resize_config.moc"
|
||||
|
|
|
@ -44,8 +44,6 @@ public:
|
|||
|
||||
public slots:
|
||||
virtual void save();
|
||||
virtual void load();
|
||||
virtual void defaults();
|
||||
|
||||
private:
|
||||
ResizeEffectConfigForm* m_ui;
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="scaleBox">
|
||||
<widget class="QCheckBox" name="kcfg_TextureScale">
|
||||
<property name="text">
|
||||
<string>Scale window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="outlineBox">
|
||||
<widget class="QCheckBox" name="kcfg_Outline">
|
||||
<property name="text">
|
||||
<string>Show outline</string>
|
||||
</property>
|
||||
|
|
5
effects/resize/resizeconfig.kcfgc
Normal file
5
effects/resize/resizeconfig.kcfgc
Normal file
|
@ -0,0 +1,5 @@
|
|||
File=resize.kcfg
|
||||
ClassName=ResizeConfig
|
||||
NameSpace=KWin
|
||||
Singleton=true
|
||||
Mutators=true
|
Loading…
Reference in a new issue