Use KConfigXT in DimInactive Effect
REVIEW: 106422
This commit is contained in:
parent
062f5ff66b
commit
b8630d19ec
7 changed files with 105 additions and 115 deletions
|
@ -6,6 +6,8 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
|
|||
diminactive/diminactive.cpp
|
||||
)
|
||||
|
||||
kde4_add_kcfg_files(kwin4_effect_builtins_sources diminactive/diminactiveconfig.kcfgc)
|
||||
|
||||
# .desktop files
|
||||
install( FILES
|
||||
diminactive/diminactive.desktop
|
||||
|
@ -20,6 +22,8 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources
|
|||
diminactive/diminactive_config.ui
|
||||
)
|
||||
|
||||
kde4_add_kcfg_files(kwin4_effect_builtins_config_sources diminactive/diminactiveconfig.kcfgc)
|
||||
|
||||
# .desktop files
|
||||
install( FILES
|
||||
diminactive/diminactive_config.desktop
|
||||
|
|
|
@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*********************************************************************/
|
||||
|
||||
#include "diminactive.h"
|
||||
// KConfigSkeleton
|
||||
#include "diminactiveconfig.h"
|
||||
|
||||
#include <kconfiggroup.h>
|
||||
|
||||
|
@ -41,12 +43,12 @@ DimInactiveEffect::DimInactiveEffect()
|
|||
|
||||
void DimInactiveEffect::reconfigure(ReconfigureFlags)
|
||||
{
|
||||
KConfigGroup conf = EffectsHandler::effectConfig("DimInactive");
|
||||
dim_panels = conf.readEntry("DimPanels", false);
|
||||
dim_desktop = conf.readEntry("DimDesktop", false);
|
||||
dim_keepabove = conf.readEntry("DimKeepAbove", false);
|
||||
dim_by_group = conf.readEntry("DimByGroup", true);
|
||||
dim_strength = conf.readEntry("Strength", 25);
|
||||
DimInactiveConfig::self()->readConfig();
|
||||
dim_panels = DimInactiveConfig::dimPanels();
|
||||
dim_desktop = DimInactiveConfig::dimDesktop();
|
||||
dim_keepabove = DimInactiveConfig::dimKeepAbove();
|
||||
dim_by_group = DimInactiveConfig::dimByGroup();
|
||||
dim_strength = DimInactiveConfig::strength();
|
||||
}
|
||||
|
||||
void DimInactiveEffect::prePaintScreen(ScreenPrePaintData& data, int time)
|
||||
|
|
24
effects/diminactive/diminactive.kcfg
Normal file
24
effects/diminactive/diminactive.kcfg
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?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-DimInactive">
|
||||
<entry name="Strength" type="Int">
|
||||
<default>25</default>
|
||||
</entry>
|
||||
<entry name="DimPanels" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="DimDesktop" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="DimKeepAbove" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="DimByGroup" type="Bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
|
@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*********************************************************************/
|
||||
|
||||
#include "diminactive_config.h"
|
||||
// KConfigSkeleton
|
||||
#include "diminactiveconfig.h"
|
||||
|
||||
#include <kwineffects.h>
|
||||
|
||||
|
@ -50,63 +52,17 @@ DimInactiveEffectConfig::DimInactiveEffectConfig(QWidget* parent, const QVariant
|
|||
|
||||
layout->addWidget(m_ui);
|
||||
|
||||
connect(m_ui->spinStrength, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->checkPanel, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||
connect(m_ui->checkDesktop, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||
connect(m_ui->checkKeepAbove, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||
connect(m_ui->checkGroup, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||
addConfig(DimInactiveConfig::self(), m_ui);
|
||||
|
||||
load();
|
||||
}
|
||||
|
||||
void DimInactiveEffectConfig::load()
|
||||
{
|
||||
KCModule::load();
|
||||
|
||||
KConfigGroup conf = EffectsHandler::effectConfig("DimInactive");
|
||||
|
||||
int strength = conf.readEntry("Strength", 25);
|
||||
bool panel = conf.readEntry("DimPanels", false);
|
||||
bool desktop = conf.readEntry("DimDesktop", false);
|
||||
bool keepabove = conf.readEntry("DimKeepAbove", false);
|
||||
bool group = conf.readEntry("DimByGroup", true);
|
||||
m_ui->spinStrength->setValue(strength);
|
||||
m_ui->checkPanel->setChecked(panel);
|
||||
m_ui->checkDesktop->setChecked(desktop);
|
||||
m_ui->checkKeepAbove->setChecked(keepabove);
|
||||
m_ui->checkGroup->setChecked(group);
|
||||
|
||||
emit changed(false);
|
||||
}
|
||||
|
||||
void DimInactiveEffectConfig::save()
|
||||
{
|
||||
KConfigGroup conf = EffectsHandler::effectConfig("DimInactive");
|
||||
|
||||
conf.writeEntry("Strength", m_ui->spinStrength->value());
|
||||
conf.writeEntry("DimPanels", m_ui->checkPanel->isChecked());
|
||||
conf.writeEntry("DimDesktop", m_ui->checkDesktop->isChecked());
|
||||
conf.writeEntry("DimKeepAbove", m_ui->checkKeepAbove->isChecked());
|
||||
conf.writeEntry("DimByGroup", m_ui->checkGroup->isChecked());
|
||||
|
||||
conf.sync();
|
||||
|
||||
KCModule::save();
|
||||
emit changed(false);
|
||||
EffectsHandler::sendReloadMessage("diminactive");
|
||||
}
|
||||
|
||||
void DimInactiveEffectConfig::defaults()
|
||||
{
|
||||
m_ui->spinStrength->setValue(25);
|
||||
m_ui->checkPanel->setChecked(false);
|
||||
m_ui->checkDesktop->setChecked(false);
|
||||
m_ui->checkKeepAbove->setChecked(false);
|
||||
m_ui->checkGroup->setChecked(true);
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#include "diminactive_config.moc"
|
||||
|
|
|
@ -42,8 +42,6 @@ public:
|
|||
explicit DimInactiveEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
|
||||
|
||||
virtual void save();
|
||||
virtual void load();
|
||||
virtual void defaults();
|
||||
|
||||
private:
|
||||
DimInactiveEffectConfigForm* m_ui;
|
||||
|
|
|
@ -1,94 +1,95 @@
|
|||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>KWin::DimInactiveEffectConfigForm</class>
|
||||
<widget class="QWidget" name="KWin::DimInactiveEffectConfigForm" >
|
||||
<property name="geometry" >
|
||||
<widget class="QWidget" name="KWin::DimInactiveEffectConfigForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>249</width>
|
||||
<height>120</height>
|
||||
<width>298</width>
|
||||
<height>161</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="1" column="0" colspan="3" >
|
||||
<widget class="QCheckBox" name="checkPanel" >
|
||||
<property name="text" >
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="kcfg_DimPanels">
|
||||
<property name="text">
|
||||
<string>Apply effect to &panels</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3" >
|
||||
<widget class="QCheckBox" name="checkDesktop" >
|
||||
<property name="text" >
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="kcfg_DimDesktop">
|
||||
<property name="text">
|
||||
<string>Apply effect to the desk&top</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3" >
|
||||
<widget class="QCheckBox" name="checkKeepAbove" >
|
||||
<property name="text" >
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="kcfg_DimKeepAbove">
|
||||
<property name="text">
|
||||
<string>Apply effect to &keep-above windows</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3" >
|
||||
<widget class="QCheckBox" name="checkGroup" >
|
||||
<property name="text" >
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="kcfg_DimGroup">
|
||||
<property name="text">
|
||||
<string>Apply effect to &groups</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>&Strength:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>spinStrength</cstring>
|
||||
<property name="buddy">
|
||||
<cstring>kcfg_Strength</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QSlider" name="sliderStrength" >
|
||||
<property name="minimumSize" >
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="kcfg_sliderStrength">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<property name="value">
|
||||
<number>25</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="KIntSpinBox" name="spinStrength" >
|
||||
<property name="minimum" >
|
||||
<item row="0" column="2">
|
||||
<widget class="KIntSpinBox" name="kcfg_Strength">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<property name="value">
|
||||
<number>25</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3" >
|
||||
<spacer name="verticalSpacer" >
|
||||
<property name="orientation" >
|
||||
<item row="5" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
|
@ -106,43 +107,43 @@
|
|||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>sliderStrength</tabstop>
|
||||
<tabstop>spinStrength</tabstop>
|
||||
<tabstop>checkPanel</tabstop>
|
||||
<tabstop>checkDesktop</tabstop>
|
||||
<tabstop>checkGroup</tabstop>
|
||||
<tabstop>kcfg_sliderStrength</tabstop>
|
||||
<tabstop>kcfg_Strength</tabstop>
|
||||
<tabstop>kcfg_DimPanels</tabstop>
|
||||
<tabstop>kcfg_DimDesktop</tabstop>
|
||||
<tabstop>kcfg_DimGroup</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>spinStrength</sender>
|
||||
<sender>kcfg_Strength</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>sliderStrength</receiver>
|
||||
<receiver>kcfg_sliderStrength</receiver>
|
||||
<slot>setValue(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>193</x>
|
||||
<y>52</y>
|
||||
<hint type="sourcelabel">
|
||||
<x>288</x>
|
||||
<y>29</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>128</x>
|
||||
<y>46</y>
|
||||
<hint type="destinationlabel">
|
||||
<x>195</x>
|
||||
<y>26</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>sliderStrength</sender>
|
||||
<sender>kcfg_sliderStrength</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>spinStrength</receiver>
|
||||
<receiver>kcfg_Strength</receiver>
|
||||
<slot>setValue(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>69</x>
|
||||
<y>45</y>
|
||||
<hint type="sourcelabel">
|
||||
<x>136</x>
|
||||
<y>26</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>200</x>
|
||||
<y>42</y>
|
||||
<hint type="destinationlabel">
|
||||
<x>288</x>
|
||||
<y>29</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
|
5
effects/diminactive/diminactiveconfig.kcfgc
Normal file
5
effects/diminactive/diminactiveconfig.kcfgc
Normal file
|
@ -0,0 +1,5 @@
|
|||
File=diminactive.kcfg
|
||||
ClassName=DimInactiveConfig
|
||||
NameSpace=KWin
|
||||
Singleton=true
|
||||
Mutators=true
|
Loading…
Reference in a new issue