Use KConfigXT in WindowGeometry
Thanks to Andrea Scarpino for providing the patch. REVIEW: 106413
This commit is contained in:
parent
9ac20a382d
commit
bd91fb10d7
7 changed files with 40 additions and 24 deletions
|
@ -6,6 +6,8 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
|
||||||
windowgeometry/windowgeometry.cpp
|
windowgeometry/windowgeometry.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
kde4_add_kcfg_files(kwin4_effect_builtins_sources windowgeometry/windowgeometryconfig.kcfgc)
|
||||||
|
|
||||||
# .desktop files
|
# .desktop files
|
||||||
install( FILES
|
install( FILES
|
||||||
windowgeometry/windowgeometry.desktop
|
windowgeometry/windowgeometry.desktop
|
||||||
|
@ -20,6 +22,8 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources
|
||||||
windowgeometry/windowgeometry_config.ui
|
windowgeometry/windowgeometry_config.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
|
kde4_add_kcfg_files(kwin4_effect_builtins_config_sources windowgeometry/windowgeometryconfig.kcfgc)
|
||||||
|
|
||||||
# .desktop files
|
# .desktop files
|
||||||
install( FILES
|
install( FILES
|
||||||
windowgeometry/windowgeometry_config.desktop
|
windowgeometry/windowgeometry_config.desktop
|
||||||
|
|
|
@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
#include "windowgeometry.h"
|
#include "windowgeometry.h"
|
||||||
|
// KConfigSkeleton
|
||||||
|
#include "windowgeometryconfig.h"
|
||||||
|
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <kwinconfig.h>
|
#include <kwinconfig.h>
|
||||||
#include <kconfiggroup.h>
|
#include <kconfiggroup.h>
|
||||||
|
@ -73,9 +76,9 @@ WindowGeometry::~WindowGeometry()
|
||||||
|
|
||||||
void WindowGeometry::reconfigure(ReconfigureFlags)
|
void WindowGeometry::reconfigure(ReconfigureFlags)
|
||||||
{
|
{
|
||||||
KConfigGroup conf = effects->effectConfig("WindowGeometry");
|
WindowGeometryConfiguration::self()->readConfig();
|
||||||
iHandleMoves = conf.readEntry("Move", true);
|
iHandleMoves = WindowGeometryConfiguration::move();
|
||||||
iHandleResizes = conf.readEntry("Resize", true);
|
iHandleResizes = WindowGeometryConfiguration::resize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowGeometry::paintScreen(int mask, QRegion region, ScreenPaintData &data)
|
void WindowGeometry::paintScreen(int mask, QRegion region, ScreenPaintData &data)
|
||||||
|
|
15
effects/windowgeometry/windowgeometry.kcfg
Normal file
15
effects/windowgeometry/windowgeometry.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-WindowGeometry">
|
||||||
|
<entry name="Move" type="Bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="Resize" type="Bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
</kcfg>
|
|
@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
#include "windowgeometry_config.h"
|
#include "windowgeometry_config.h"
|
||||||
|
// KConfigSkeleton
|
||||||
|
#include "windowgeometryconfig.h"
|
||||||
|
|
||||||
#include <kwineffects.h>
|
#include <kwineffects.h>
|
||||||
#include <KActionCollection>
|
#include <KActionCollection>
|
||||||
#include <kaction.h>
|
#include <kaction.h>
|
||||||
|
@ -50,8 +53,9 @@ WindowGeometryConfig::WindowGeometryConfig(QWidget* parent, const QVariantList&
|
||||||
myUi->shortcuts->addCollection(myActionCollection);
|
myUi->shortcuts->addCollection(myActionCollection);
|
||||||
connect(myUi->shortcuts, SIGNAL(keyChange()), this, SLOT(changed()));
|
connect(myUi->shortcuts, SIGNAL(keyChange()), this, SLOT(changed()));
|
||||||
|
|
||||||
connect(myUi->handleMove, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
addConfig(WindowGeometryConfiguration::self(), myUi);
|
||||||
connect(myUi->handleResize, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
|
||||||
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowGeometryConfig::~WindowGeometryConfig()
|
WindowGeometryConfig::~WindowGeometryConfig()
|
||||||
|
@ -60,32 +64,18 @@ WindowGeometryConfig::~WindowGeometryConfig()
|
||||||
myUi->shortcuts->undoChanges();
|
myUi->shortcuts->undoChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowGeometryConfig::load()
|
|
||||||
{
|
|
||||||
KCModule::load();
|
|
||||||
KConfigGroup conf = EffectsHandler::effectConfig("WindowGeometry");
|
|
||||||
myUi->handleMove->setChecked(conf.readEntry("Move", true));
|
|
||||||
myUi->handleResize->setChecked(conf.readEntry("Resize", true));
|
|
||||||
emit changed(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WindowGeometryConfig::save()
|
void WindowGeometryConfig::save()
|
||||||
{
|
{
|
||||||
KConfigGroup conf = EffectsHandler::effectConfig("WindowGeometry");
|
KCModule::save();
|
||||||
conf.writeEntry("Move", myUi->handleMove->isChecked());
|
|
||||||
conf.writeEntry("Resize", myUi->handleResize->isChecked());
|
|
||||||
myUi->shortcuts->save(); // undo() will restore to this state from now on
|
myUi->shortcuts->save(); // undo() will restore to this state from now on
|
||||||
conf.sync();
|
|
||||||
emit changed(false);
|
|
||||||
EffectsHandler::sendReloadMessage("windowgeometry");
|
EffectsHandler::sendReloadMessage("windowgeometry");
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowGeometryConfig::defaults()
|
void WindowGeometryConfig::defaults()
|
||||||
{
|
{
|
||||||
myUi->handleMove->setChecked(true);
|
|
||||||
myUi->handleResize->setChecked(true);
|
|
||||||
myUi->shortcuts->allDefault();
|
myUi->shortcuts->allDefault();
|
||||||
emit changed(true);
|
emit changed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace
|
} //namespace
|
||||||
#include "windowgeometry_config.moc"
|
#include "windowgeometry_config.moc"
|
||||||
|
|
|
@ -45,7 +45,6 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void save();
|
void save();
|
||||||
void load();
|
|
||||||
void defaults();
|
void defaults();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -12,14 +12,14 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="handleMove">
|
<widget class="QCheckBox" name="kcfg_Move">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Display for moving windows</string>
|
<string>Display for moving windows</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="handleResize">
|
<widget class="QCheckBox" name="kcfg_Resize">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Display for resizing windows</string>
|
<string>Display for resizing windows</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
5
effects/windowgeometry/windowgeometryconfig.kcfgc
Normal file
5
effects/windowgeometry/windowgeometryconfig.kcfgc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
File=windowgeometry.kcfg
|
||||||
|
ClassName=WindowGeometryConfiguration
|
||||||
|
NameSpace=KWin
|
||||||
|
Singleton=true
|
||||||
|
Mutators=true
|
Loading…
Reference in a new issue