Use a new, (too-)much-much-much simpler config dialog.

Maybe it is too simple this time, i'll wait for your feedback on it ;)

svn path=/trunk/KDE/kdebase/workspace/; revision=800803
This commit is contained in:
Cédric Borgese 2008-04-24 21:22:52 +00:00
parent 2f8d2751a1
commit 4c47bfb484
5 changed files with 320 additions and 1217 deletions

View file

@ -39,86 +39,225 @@ License. See the file "COPYING" for the exact licensing terms.
namespace KWin
{
struct ParameterSet
{
qreal stiffness;
qreal drag;
qreal move_factor;
qreal xTesselation;
qreal yTesselation;
WobblyWindowsEffect::GridFilter velocityFilter;
WobblyWindowsEffect::GridFilter accelerationFilter;
qreal minVelocity;
qreal maxVelocity;
qreal stopVelocity;
qreal minAcceleration;
qreal maxAcceleration;
qreal stopAcceleration;
bool moveEffectEnabled;
bool openEffectEnabled;
bool closeEffectEnabled;
};
ParameterSet set_0 =
{
0.1,
0.8,
0.1,
20.0,
20.0,
WobblyWindowsEffect::FourRingLinearMean,
WobblyWindowsEffect::HeightRingLinearMean,
0.0,
1000.0,
1.0,
0.0,
1000.0,
2.0,
true,
false,
false
};
ParameterSet set_1 =
{
0.15,
0.85,
0.1,
20.0,
20.0,
WobblyWindowsEffect::HeightRingLinearMean,
WobblyWindowsEffect::MeanWithMean,
0.0,
1000.0,
1.0,
0.0,
1000.0,
2.0,
true,
false,
false
};
ParameterSet set_2 =
{
0.06,
0.9,
0.1,
20.0,
20.0,
WobblyWindowsEffect::HeightRingLinearMean,
WobblyWindowsEffect::NoFilter,
0.0,
1000.0,
1.0,
0.0,
1000.0,
2.0,
true,
false,
false
};
ParameterSet set_3 =
{
0.03,
0.92,
0.1,
20.0,
20.0,
WobblyWindowsEffect::HeightRingLinearMean,
WobblyWindowsEffect::HeightRingLinearMean,
0.0,
1000.0,
1.0,
0.0,
1000.0,
2.0,
true,
false,
false
};
ParameterSet set_4 =
{
0.03,
0.92,
0.1,
20.0,
20.0,
WobblyWindowsEffect::HeightRingLinearMean,
WobblyWindowsEffect::HeightRingLinearMean,
0.0,
1000.0,
1.0,
0.0,
1000.0,
2.0,
true,
false,
false
};
ParameterSet pset[5] = { set_0, set_1, set_2, set_3, set_4 };
KWIN_EFFECT(wobblywindows, WobblyWindowsEffect)
WobblyWindowsEffect::WobblyWindowsEffect()
{
KConfigGroup conf = effects->effectConfig("Wobbly");
m_stiffness = conf.readEntry("Stiffness", STIFFNESS);
m_drag = conf.readEntry("Drag", DRAG);
m_move_factor = conf.readEntry("MoveFactor", MOVEFACTOR);
m_xTesselation = conf.readEntry("XTesselation", XTESSELATION);
m_yTesselation = conf.readEntry("YTesselation", YTESSELATION);
QString settingsMode = conf.readEntry("Settings", "Auto");
if (settingsMode != "Custom")
{
unsigned int wobblynessLevel = conf.readEntry("WobblynessLevel", 2);
if (wobblynessLevel > 4)
{
kDebug() << "Wrong value for \"WobblynessLevel\" : " << wobblynessLevel;
wobblynessLevel = 4;
}
setParameterSet(pset[wobblynessLevel]);
}
else // Custom method, read all values from config file.
{
m_stiffness = conf.readEntry("Stiffness", STIFFNESS);
m_drag = conf.readEntry("Drag", DRAG);
m_move_factor = conf.readEntry("MoveFactor", MOVEFACTOR);
m_minVelocity = conf.readEntry("MinVelocity", MINVELOCITY);
m_maxVelocity = conf.readEntry("MaxVelocity", MAXVELOCITY);
m_stopVelocity = conf.readEntry("StopVelocity", STOPVELOCITY);
m_minAcceleration = conf.readEntry("MinAcceleration", MINACCELERATION);
m_maxAcceleration = conf.readEntry("MaxAcceleration", MAXACCELERATION);
m_stopAcceleration = conf.readEntry("StopAcceleration", STOPACCELERATION);
m_xTesselation = conf.readEntry("XTesselation", XTESSELATION);
m_yTesselation = conf.readEntry("YTesselation", YTESSELATION);
QString velFilter = conf.readEntry("VelocityFilter", VELOCITYFILTER);
if (velFilter == "NoFilter")
{
m_velocityFilter = NoFilter;
}
else if (velFilter == "FourRingLinearMean")
{
m_velocityFilter = FourRingLinearMean;
}
else if (velFilter == "HeightRingLinearMean")
{
m_velocityFilter = HeightRingLinearMean;
}
else if (velFilter == "MeanWithMean")
{
m_velocityFilter = MeanWithMean;
}
else if (velFilter == "MeanWithMedian")
{
m_velocityFilter = MeanWithMedian;
}
else
{
m_velocityFilter = FourRingLinearMean;
kDebug() << "Unknown config value for VelocityFilter : " << velFilter;
}
m_minVelocity = conf.readEntry("MinVelocity", MINVELOCITY);
m_maxVelocity = conf.readEntry("MaxVelocity", MAXVELOCITY);
m_stopVelocity = conf.readEntry("StopVelocity", STOPVELOCITY);
m_minAcceleration = conf.readEntry("MinAcceleration", MINACCELERATION);
m_maxAcceleration = conf.readEntry("MaxAcceleration", MAXACCELERATION);
m_stopAcceleration = conf.readEntry("StopAcceleration", STOPACCELERATION);
QString velFilter = conf.readEntry("VelocityFilter", VELOCITYFILTER);
if (velFilter == "NoFilter")
{
m_velocityFilter = NoFilter;
}
else if (velFilter == "FourRingLinearMean")
{
m_velocityFilter = FourRingLinearMean;
}
else if (velFilter == "HeightRingLinearMean")
{
m_velocityFilter = HeightRingLinearMean;
}
else if (velFilter == "MeanWithMean")
{
m_velocityFilter = MeanWithMean;
}
else if (velFilter == "MeanWithMedian")
{
m_velocityFilter = MeanWithMedian;
}
else
{
m_velocityFilter = FourRingLinearMean;
kDebug() << "Unknown config value for VelocityFilter : " << velFilter;
}
QString accFilter = conf.readEntry("AccelerationFilter", ACCELERATIONFILTER);
if (accFilter == "NoFilter")
{
m_accelerationFilter = NoFilter;
}
else if (accFilter == "FourRingLinearMean")
{
m_accelerationFilter = FourRingLinearMean;
}
else if (accFilter == "HeightRingLinearMean")
{
m_accelerationFilter = HeightRingLinearMean;
}
else if (accFilter == "MeanWithMean")
{
m_accelerationFilter = MeanWithMean;
}
else if (accFilter == "MeanWithMedian")
{
m_accelerationFilter = MeanWithMedian;
}
else
{
m_accelerationFilter = NoFilter;
kDebug() << "Unknown config value for accelerationFilter : " << accFilter;
}
m_moveEffectEnabled = conf.readEntry("MoveEffect", true);
m_openEffectEnabled = conf.readEntry("OpenEffect", false);
// disable close effect by default for now as it doesn't do what I want.
m_closeEffectEnabled = conf.readEntry("CloseEffect", false);
QString accFilter = conf.readEntry("AccelerationFilter", ACCELERATIONFILTER);
if (accFilter == "NoFilter")
{
m_accelerationFilter = NoFilter;
}
else if (accFilter == "FourRingLinearMean")
{
m_accelerationFilter = FourRingLinearMean;
}
else if (accFilter == "HeightRingLinearMean")
{
m_accelerationFilter = HeightRingLinearMean;
}
else if (accFilter == "MeanWithMean")
{
m_accelerationFilter = MeanWithMean;
}
else if (accFilter == "MeanWithMedian")
{
m_accelerationFilter = MeanWithMedian;
}
else
{
m_accelerationFilter = NoFilter;
kDebug() << "Unknown config value for accelerationFilter : " << accFilter;
}
m_moveEffectEnabled = conf.readEntry("MoveEffect", true);
m_openEffectEnabled = conf.readEntry("OpenEffect", false);
// disable close effect by default for now as it doesn't do what I want.
m_closeEffectEnabled = conf.readEntry("CloseEffect", false);
}
#if defined VERBOSE_MODE
kDebug() << "Parameters :\n" <<
@ -145,6 +284,30 @@ WobblyWindowsEffect::~WobblyWindowsEffect()
}
}
void WobblyWindowsEffect::setParameterSet(ParameterSet& pset)
{
m_stiffness = pset.stiffness;
m_drag = pset.drag;
m_move_factor = pset.move_factor;
m_xTesselation = pset.xTesselation;
m_yTesselation = pset.yTesselation;
m_velocityFilter = pset.velocityFilter ;
m_accelerationFilter = pset.accelerationFilter;
m_minVelocity = pset.minVelocity;
m_maxVelocity = pset.maxVelocity;
m_stopVelocity = pset.stopVelocity;
m_minAcceleration = pset.minAcceleration;
m_maxAcceleration = pset.maxAcceleration;
m_stopAcceleration = pset.stopAcceleration;
m_moveEffectEnabled = pset.moveEffectEnabled;
m_openEffectEnabled = pset.openEffectEnabled;
m_closeEffectEnabled = pset.closeEffectEnabled;
}
void WobblyWindowsEffect::setVelocityThreshold(qreal m_minVelocity)
{
this->m_minVelocity = m_minVelocity;

View file

@ -17,6 +17,8 @@ License. See the file "COPYING" for the exact licensing terms.
namespace KWin
{
struct ParameterSet;
/**
* Effect which wobble windows
**/
@ -62,10 +64,6 @@ class WobblyWindowsEffect : public Effect
qreal y;
};
private:
bool updateWindowWobblyDatas(EffectWindow* w, qreal time);
enum WindowStatus
{
Free,
@ -74,6 +72,10 @@ class WobblyWindowsEffect : public Effect
Closing
};
private:
bool updateWindowWobblyDatas(EffectWindow* w, qreal time);
struct WindowWobblyInfos
{
Pair* origin;
@ -141,6 +143,8 @@ class WobblyWindowsEffect : public Effect
static void heightRingLinearMean(Pair** datas, WindowWobblyInfos& wwi);
static void meanWithMean(Pair** datas, WindowWobblyInfos& wwi);
static void meanWithMedian(Pair** datas, WindowWobblyInfos& wwi);
void setParameterSet(ParameterSet& pset);
};
} // namespace KWin

View file

@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "wobblywindows_config.h"
#include "wobblywindows_constants.h"
#include <kwineffects.h>
@ -43,33 +42,7 @@ KCModule(EffectFactory::componentData(), parent, args)
{
m_ui.setupUi(this);
connect(m_ui.spStiffness, SIGNAL(valueChanged(double)), this, SLOT(slotSpStiffness(double)));
connect(m_ui.slStiffness, SIGNAL(sliderMoved(int)), this, SLOT(slotSlStiffness(int)));
connect(m_ui.spDrag, SIGNAL(valueChanged(double)), this, SLOT(slotSpDrag(double)));
connect(m_ui.slDrag, SIGNAL(sliderMoved(int)), this, SLOT(slotSlDrag(int)));
connect(m_ui.spMovFactor, SIGNAL(valueChanged(double)), this, SLOT(slotSpMovFactor(double)));
connect(m_ui.slMovFactor, SIGNAL(sliderMoved(int)), this, SLOT(slotSlMovFactor(int)));
connect(m_ui.cbGridFilter, SIGNAL(activated(int)), this, SLOT(slotGridParameterSelected(int)));
connect(m_ui.rbNone, SIGNAL(toggled(bool)), this, SLOT(slotRbNone(bool)));
connect(m_ui.rbFourRingMean, SIGNAL(toggled(bool)), this, SLOT(slotRbFourRingMean(bool)));
connect(m_ui.rbHeightRingMean, SIGNAL(toggled(bool)), this, SLOT(slotRbHeightRingMean(bool)));
connect(m_ui.rbMeanMean, SIGNAL(toggled(bool)), this, SLOT(slotRbMeanMean(bool)));
connect(m_ui.rbMeanMedian, SIGNAL(toggled(bool)), this, SLOT(slotRbMeanMedian(bool)));
connect(m_ui.spMinVel, SIGNAL(valueChanged(double)), this, SLOT(slotSpMinVel(double)));
connect(m_ui.slMinVel, SIGNAL(sliderMoved(int)), this, SLOT(slotSlMinVel(int)));
connect(m_ui.spMaxVel, SIGNAL(valueChanged(double)), this, SLOT(slotSpMaxVel(double)));
connect(m_ui.slMaxVel, SIGNAL(sliderMoved(int)), this, SLOT(slotSlMaxVel(int)));
connect(m_ui.spStopVel, SIGNAL(valueChanged(double)), this, SLOT(slotSpStopVel(double)));
connect(m_ui.slStopVel, SIGNAL(sliderMoved(int)), this, SLOT(slotSlStopVel(int)));
connect(m_ui.spMinAcc, SIGNAL(valueChanged(double)), this, SLOT(slotSpMinAcc(double)));
connect(m_ui.slMinAcc, SIGNAL(sliderMoved(int)), this, SLOT(slotSlMinAcc(int)));
connect(m_ui.spMaxAcc, SIGNAL(valueChanged(double)), this, SLOT(slotSpMaxAcc(double)));
connect(m_ui.slMaxAcc, SIGNAL(sliderMoved(int)), this, SLOT(slotSlMaxAcc(int)));
connect(m_ui.spStopAcc, SIGNAL(valueChanged(double)), this, SLOT(slotSpStopAcc(double)));
connect(m_ui.slStopAcc, SIGNAL(sliderMoved(int)), this, SLOT(slotSlStopAcc(int)));
connect(m_ui.slWobblyness, SIGNAL(valueChanged(int)), this, SLOT(slotSlWobblyness(int)));
load();
}
@ -83,170 +56,33 @@ void WobblyWindowsEffectConfig::load()
KCModule::load();
KConfigGroup conf = EffectsHandler::effectConfig("Wobbly");
qreal stiffness = conf.readEntry("Stiffness", STIFFNESS);
qreal drag = conf.readEntry("Drag", DRAG);
qreal move_factor = conf.readEntry("MoveFactor", MOVEFACTOR);
bool change = true;
m_ui.spStiffness->setValue(stiffness);
m_ui.slStiffness->setSliderPosition(stiffness*50);
m_ui.spDrag->setValue(drag);
m_ui.slDrag->setSliderPosition(drag*100);
m_ui.spMovFactor->setValue(move_factor);
m_ui.slMovFactor->setValue(move_factor*100);
int xTesselation = conf.readEntry("XTesselation", XTESSELATION);
int yTesselation = conf.readEntry("YTesselation", YTESSELATION);
m_ui.spHNodes->setValue(xTesselation);
m_ui.spVNodes->setValue(yTesselation);
//squareRootMasterAcceleration = conf.readEntry("SquareRootMasterAcceleration", false);
QString velFilter = conf.readEntry("VelocityFilter", VELOCITYFILTER);
if (velFilter == "NoFilter")
unsigned int wobblynessLevel = 2;
QString settingsMode = conf.readEntry("Settings", "Auto");
if (settingsMode != "Custom")
{
velocityFilter = NoFilter;
}
else if (velFilter == "FourRingLinearMean")
{
velocityFilter = FourRingLinearMean;
}
else if (velFilter == "HeightRingLinearMean")
{
velocityFilter = HeightRingLinearMean;
}
else if (velFilter == "MeanWithMean")
{
velocityFilter = MeanWithMean;
}
else if (velFilter == "MeanWithMedian")
{
velocityFilter = MeanWithMedian;
}
else
{
velocityFilter = FourRingLinearMean;
kDebug() << "Unknown config value for VelocityFilter : " << velFilter;
wobblynessLevel = conf.readEntry("WobblynessLevel", 2);
change = false;
}
QString accFilter = conf.readEntry("AccelerationFilter", ACCELERATIONFILTER);
if (accFilter == "NoFilter")
if (wobblynessLevel > 4)
{
accelerationFilter = NoFilter;
}
else if (accFilter == "FourRingLinearMean")
{
accelerationFilter = FourRingLinearMean;
}
else if (accFilter == "HeightRingLinearMean")
{
accelerationFilter = HeightRingLinearMean;
}
else if (accFilter == "MeanWithMean")
{
accelerationFilter = MeanWithMean;
}
else if (accFilter == "MeanWithMedian")
{
accelerationFilter = MeanWithMedian;
}
else
{
accelerationFilter = NoFilter;
kDebug() << "Unknown config value for accelerationFilter : " << accFilter;
wobblynessLevel = 4;
change = true;
}
qreal minVel = conf.readEntry("MinVelocity", MINVELOCITY);
qreal maxVel = conf.readEntry("MaxVelocity", MAXVELOCITY);
qreal stopVel = conf.readEntry("StopVelocity", STOPVELOCITY);
qreal minAcc = conf.readEntry("MinAcceleration", MINACCELERATION);
qreal maxAcc = conf.readEntry("MaxAcceleration", MAXACCELERATION);
qreal stopAcc = conf.readEntry("StopAcceleration", STOPACCELERATION);
m_ui.slWobblyness->setSliderPosition(wobblynessLevel);
m_ui.spMinVel->setValue(minVel);
m_ui.slMinVel->setSliderPosition(minVel*100);
m_ui.spMaxVel->setValue(maxVel);
m_ui.slMaxVel->setSliderPosition(maxVel/10);
m_ui.spStopVel->setValue(stopVel);
m_ui.slStopVel->setSliderPosition(stopVel*10);
m_ui.spMinAcc->setValue(minAcc);
m_ui.slMinAcc->setSliderPosition(minAcc*100);
m_ui.spMaxAcc->setValue(maxAcc);
m_ui.slMaxAcc->setSliderPosition(maxAcc/10);
m_ui.spStopAcc->setValue(stopAcc);
m_ui.slStopAcc->setSliderPosition(stopAcc*10);
emit changed(false);
emit changed(change);
}
void WobblyWindowsEffectConfig::save()
{
KConfigGroup conf = EffectsHandler::effectConfig("Wobbly");
conf.writeEntry("Stiffness", m_ui.spStiffness->value());
conf.writeEntry("Drag", m_ui.spDrag->value());
conf.writeEntry("MoveFactor", m_ui.spMovFactor->value());
conf.writeEntry("XTesselation", m_ui.spHNodes->value());
conf.writeEntry("YTesselation", m_ui.spVNodes->value());
switch (velocityFilter)
{
case NoFilter:
conf.writeEntry("VelocityFilter", "NoFilter");
break;
case FourRingLinearMean:
conf.writeEntry("VelocityFilter", "FourRingLinearMean");
break;
case HeightRingLinearMean:
conf.writeEntry("VelocityFilter", "HeightRingLinearMean");
break;
case MeanWithMean:
conf.writeEntry("VelocityFilter", "MeanWithMean");
break;
case MeanWithMedian:
conf.writeEntry("VelocityFilter", "MeanWithMedian");
break;
}
switch (accelerationFilter)
{
case NoFilter:
conf.writeEntry("AccelerationFilter", "NoFilter");
break;
case FourRingLinearMean:
conf.writeEntry("AccelerationFilter", "FourRingLinearMean");
break;
case HeightRingLinearMean:
conf.writeEntry("AccelerationFilter", "HeightRingLinearMean");
break;
case MeanWithMean:
conf.writeEntry("AccelerationFilter", "MeanWithMean");
break;
case MeanWithMedian:
conf.writeEntry("AccelerationFilter", "MeanWithMedian");
break;
}
conf.writeEntry("MinVelocity", m_ui.spMinVel->value());
conf.writeEntry("MaxVelocity", m_ui.spMaxVel->value());
conf.writeEntry("StopVelocity", m_ui.spStopVel->value());
conf.writeEntry("MinAcceleration", m_ui.spMinAcc->value());
conf.writeEntry("MaxAcceleration", m_ui.spMaxAcc->value());
conf.writeEntry("StopAcceleration", m_ui.spStopAcc->value());
conf.sync();
conf.writeEntry("Settings", "Auto");
conf.writeEntry("WobblynessLevel", m_ui.slWobblyness->value());
emit changed(false);
EffectsHandler::sendReloadMessage("kwin4_effect_wobblywindows");
@ -254,293 +90,16 @@ void WobblyWindowsEffectConfig::save()
void WobblyWindowsEffectConfig::defaults()
{
m_ui.spStiffness->setValue(STIFFNESS);
m_ui.slStiffness->setSliderPosition(STIFFNESS*50);
m_ui.spDrag->setValue(DRAG);
m_ui.slDrag->setSliderPosition(DRAG*100);
m_ui.spMovFactor->setValue(MOVEFACTOR);
m_ui.slMovFactor->setValue(MOVEFACTOR*100);
m_ui.spHNodes->setValue(XTESSELATION);
m_ui.spVNodes->setValue(YTESSELATION);
velocityFilter = FourRingLinearMean;
accelerationFilter = NoFilter;
slotGridParameterSelected(m_ui.cbGridFilter->currentIndex());
m_ui.spMinVel->setValue(MINVELOCITY);
m_ui.slMinVel->setSliderPosition(MINVELOCITY*100);
m_ui.spMaxVel->setValue(MAXVELOCITY);
m_ui.slMaxVel->setSliderPosition(MAXVELOCITY/10);
m_ui.spStopVel->setValue(STOPVELOCITY);
m_ui.slStopVel->setSliderPosition(STOPVELOCITY*10);
m_ui.spMinAcc->setValue(MINACCELERATION);
m_ui.slMinAcc->setSliderPosition(MINACCELERATION*100);
m_ui.spMaxAcc->setValue(MAXACCELERATION);
m_ui.slMaxAcc->setSliderPosition(MAXACCELERATION/10);
m_ui.spStopAcc->setValue(STOPACCELERATION);
m_ui.slStopAcc->setSliderPosition(STOPACCELERATION*10);
m_ui.slWobblyness->setSliderPosition(2);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSpStiffness(double value)
void WobblyWindowsEffectConfig::slotSlWobblyness(int)
{
m_ui.slStiffness->setSliderPosition(value*50);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSlStiffness(int value)
{
m_ui.spStiffness->setValue(value/50.0);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSpDrag(double value)
{
m_ui.slDrag->setSliderPosition(value*100);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSlDrag(int value)
{
m_ui.spDrag->setValue(qreal(value)/100.0);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSpMovFactor(double value)
{
m_ui.slMovFactor->setValue(value*100);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSlMovFactor(int value)
{
m_ui.spMovFactor->setValue(qreal(value)/100.0);
emit changed(true);
}
// filters
void WobblyWindowsEffectConfig::slotRbNone(bool toggled)
{
if (toggled)
{
if (m_ui.cbGridFilter->currentIndex() == 0) // velocity
{
velocityFilter = NoFilter;
}
else if (m_ui.cbGridFilter->currentIndex() == 1) // acceleration
{
accelerationFilter = NoFilter;
}
}
emit changed(true);
}
void WobblyWindowsEffectConfig::slotRbFourRingMean(bool toggled)
{
if (toggled)
{
if (m_ui.cbGridFilter->currentIndex() == 0) // velocity
{
velocityFilter = FourRingLinearMean;
}
else if (m_ui.cbGridFilter->currentIndex() == 1) // acceleration
{
accelerationFilter = FourRingLinearMean;
}
}
emit changed(true);
}
void WobblyWindowsEffectConfig::slotRbHeightRingMean(bool toggled)
{
if (toggled)
{
if (m_ui.cbGridFilter->currentIndex() == 0) // velocity
{
velocityFilter = HeightRingLinearMean;
}
else if (m_ui.cbGridFilter->currentIndex() == 1) // acceleration
{
accelerationFilter = HeightRingLinearMean;
}
}
emit changed(true);
}
void WobblyWindowsEffectConfig::slotRbMeanMean(bool toggled)
{
if (toggled)
{
if (m_ui.cbGridFilter->currentIndex() == 0) // velocity
{
velocityFilter = MeanWithMean;
}
else if (m_ui.cbGridFilter->currentIndex() == 1) // acceleration
{
accelerationFilter = MeanWithMean;
}
}
emit changed(true);
}
void WobblyWindowsEffectConfig::slotRbMeanMedian(bool toggled)
{
if (toggled)
{
if (m_ui.cbGridFilter->currentIndex() == 0) // velocity
{
velocityFilter = MeanWithMedian;
}
else if (m_ui.cbGridFilter->currentIndex() == 1) // acceleration
{
accelerationFilter = MeanWithMedian;
}
}
emit changed(true);
}
void WobblyWindowsEffectConfig::slotGridParameterSelected(int index)
{
if (index == 0) // velocity
{
switch (velocityFilter)
{
case NoFilter:
m_ui.rbNone->setChecked(true);
break;
case FourRingLinearMean:
m_ui.rbFourRingMean->setChecked(true);
break;
case HeightRingLinearMean:
m_ui.rbHeightRingMean->setChecked(true);
break;
case MeanWithMean:
m_ui.rbMeanMean->setChecked(true);
break;
case MeanWithMedian:
m_ui.rbMeanMedian->setChecked(true);
break;
}
}
else if (index == 1) // acceleration
{
switch (accelerationFilter)
{
case NoFilter:
m_ui.rbNone->setChecked(true);
break;
case FourRingLinearMean:
m_ui.rbFourRingMean->setChecked(true);
break;
case HeightRingLinearMean:
m_ui.rbHeightRingMean->setChecked(true);
break;
case MeanWithMean:
m_ui.rbMeanMean->setChecked(true);
break;
case MeanWithMedian:
m_ui.rbMeanMedian->setChecked(true);
break;
}
}
emit changed(true);
}
// thresholds
void WobblyWindowsEffectConfig::slotSpMinVel(double value)
{
m_ui.slMinVel->setSliderPosition(value*100);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSlMinVel(int value)
{
m_ui.spMinVel->setValue(qreal(value)/100.0);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSpMaxVel(double value)
{
m_ui.slMaxVel->setSliderPosition(value/10);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSlMaxVel(int value)
{
m_ui.spMaxVel->setValue(value*10.0);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSpStopVel(double value)
{
m_ui.slStopVel->setSliderPosition(value*10);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSlStopVel(int value)
{
m_ui.spStopVel->setValue(value/10.0);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSpMinAcc(double value)
{
m_ui.slMinAcc->setSliderPosition(value*100);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSlMinAcc(int value)
{
m_ui.spMinAcc->setValue(value/100.0);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSpMaxAcc(double value)
{
m_ui.slMaxAcc->setSliderPosition(value/10);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSlMaxAcc(int value)
{
m_ui.spMaxAcc->setValue(value*10.0);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSpStopAcc(double value)
{
m_ui.slStopAcc->setSliderPosition(value*10);
emit changed(true);
}
void WobblyWindowsEffectConfig::slotSlStopAcc(int value)
{
m_ui.spStopAcc->setValue(value/10.0);
emit changed(true);
}
} // namespace
#include "wobblywindows_config.moc"

View file

@ -44,50 +44,11 @@ public slots:
virtual void load();
virtual void defaults();
private:
enum GridFilter
{
NoFilter,
FourRingLinearMean,
HeightRingLinearMean,
MeanWithMean,
MeanWithMedian
};
private slots:
void slotSpStiffness(double);
void slotSlStiffness(int);
void slotSpDrag(double);
void slotSlDrag(int);
void slotSpMovFactor(double);
void slotSlMovFactor(int);
void slotGridParameterSelected(int);
void slotRbNone(bool);
void slotRbFourRingMean(bool);
void slotRbHeightRingMean(bool);
void slotRbMeanMean(bool);
void slotRbMeanMedian(bool);
void slotSpMinVel(double);
void slotSlMinVel(int);
void slotSpMaxVel(double);
void slotSlMaxVel(int);
void slotSpStopVel(double);
void slotSlStopVel(int);
void slotSpMinAcc(double);
void slotSlMinAcc(int);
void slotSpMaxAcc(double);
void slotSlMaxAcc(int);
void slotSpStopAcc(double);
void slotSlStopAcc(int);
void slotSlWobblyness(int);
private:
Ui::WobblyWindowsEffectConfigForm m_ui;
GridFilter velocityFilter;
GridFilter accelerationFilter;
::Ui::WobblyWindowsEffectConfigForm m_ui;
};
} // namespace

View file

@ -1,663 +1,79 @@
<ui version="4.0" >
<class>KWin::WobblyWindowsEffectConfigForm</class>
<widget class="QWidget" name="KWin::WobblyWindowsEffectConfigForm" >
<class>WobblyWindowsEffectConfigForm</class>
<widget class="QWidget" name="WobblyWindowsEffectConfigForm" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>553</width>
<height>368</height>
<width>274</width>
<height>66</height>
</rect>
</property>
<property name="windowTitle" >
<string>WobblyWindows</string>
<string>WobblyWindowsEffectConfigForm</string>
</property>
<layout class="QGridLayout" >
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>0</number>
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Wobblyness :</string>
</property>
<widget class="QWidget" name="tab" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>531</width>
<height>321</height>
</rect>
</property>
<attribute name="title" >
<string>Grid Parameters</string>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Maximum" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Grid Minimal Tesselation</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Horizontal Nodes:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QSpinBox" name="spHNodes" >
<property name="minimum" >
<number>2</number>
</property>
<property name="value" >
<number>20</number>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Vertical Nodes:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QSpinBox" name="spVNodes" >
<property name="minimum" >
<number>2</number>
</property>
<property name="value" >
<number>20</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item rowspan="2" row="0" column="1" >
<widget class="QGroupBox" name="groupBox_4" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Grid Parameters</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Stiffness:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" >
<widget class="QDoubleSpinBox" name="spStiffness" >
<property name="maximum" >
<double>2.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.020000000000000</double>
</property>
<property name="value" >
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3" >
<widget class="QSlider" name="slStiffness" >
<property name="maximum" >
<number>100</number>
</property>
<property name="value" >
<number>25</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3" >
<widget class="Line" name="line" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Drag:</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2" >
<widget class="QDoubleSpinBox" name="spDrag" >
<property name="maximum" >
<double>1.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.010000000000000</double>
</property>
<property name="value" >
<double>0.940000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3" >
<widget class="QSlider" name="slDrag" >
<property name="maximum" >
<number>100</number>
</property>
<property name="value" >
<number>94</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3" >
<widget class="Line" name="line_4" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Move Factor:</string>
</property>
</widget>
</item>
<item row="6" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>16</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="2" >
<widget class="QDoubleSpinBox" name="spMovFactor" >
<property name="maximum" >
<double>1.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.010000000000000</double>
</property>
<property name="value" >
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3" >
<widget class="QSlider" name="slMovFactor" >
<property name="maximum" >
<number>100</number>
</property>
<property name="value" >
<number>1</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" >
<widget class="QGroupBox" name="groupBox_5" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Maximum" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Grid Filter</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QComboBox" name="cbGridFilter" >
<item>
<property name="text" >
<string>Velocity</string>
</property>
</item>
<item>
<property name="text" >
<string>Acceleration</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbNone" >
<property name="text" >
<string>None</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbFourRingMean" >
<property name="text" >
<string>Ring Mean (4 ways)</string>
</property>
<property name="checked" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbHeightRingMean" >
<property name="text" >
<string>Ring Mean (8 ways)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbMeanMean" >
<property name="text" >
<string>Mean With Mean</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbMeanMedian" >
<property name="text" >
<string>Mean With Median</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>533</width>
<height>338</height>
</rect>
</property>
<attribute name="title" >
<string>Thresholds</string>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>Velocity</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Min Velocity</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" colspan="2" >
<widget class="QDoubleSpinBox" name="spMinVel" >
<property name="maximum" >
<double>1.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.010000000000000</double>
</property>
<property name="value" >
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4" >
<widget class="QSlider" name="slMinVel" >
<property name="maximum" >
<number>100</number>
</property>
<property name="value" >
<number>50</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4" >
<widget class="Line" name="line_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<string>Max Velocity</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="3" >
<widget class="QDoubleSpinBox" name="spMaxVel" >
<property name="maximum" >
<double>1000.000000000000000</double>
</property>
<property name="singleStep" >
<double>10.000000000000000</double>
</property>
<property name="value" >
<double>500.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0" colspan="4" >
<widget class="QSlider" name="slMaxVel" >
<property name="maximum" >
<number>100</number>
</property>
<property name="value" >
<number>50</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="5" column="0" colspan="4" >
<widget class="Line" name="line_3" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="label_10" >
<property name="text" >
<string>Velocity Stop</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="3" >
<widget class="QDoubleSpinBox" name="spStopVel" >
<property name="maximum" >
<double>10.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.100000000000000</double>
</property>
<property name="value" >
<double>3.000000000000000</double>
</property>
</widget>
</item>
<item row="7" column="0" colspan="4" >
<widget class="QSlider" name="slStopVel" >
<property name="maximum" >
<number>100</number>
</property>
<property name="value" >
<number>30</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1" >
<widget class="QGroupBox" name="groupBox_3" >
<property name="title" >
<string>Acceleration</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>Min Acceleration</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3" >
<widget class="QDoubleSpinBox" name="spMinAcc" >
<property name="maximum" >
<double>1.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.010000000000000</double>
</property>
<property name="value" >
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4" >
<widget class="QSlider" name="slMinAcc" >
<property name="maximum" >
<number>100</number>
</property>
<property name="value" >
<number>10</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4" >
<widget class="Line" name="line_5" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Max Acceleration</string>
</property>
</widget>
</item>
<item row="3" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>21</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="3" >
<widget class="QDoubleSpinBox" name="spMaxAcc" >
<property name="maximum" >
<double>1000.000000000000000</double>
</property>
<property name="singleStep" >
<double>10.000000000000000</double>
</property>
<property name="value" >
<double>500.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0" colspan="4" >
<widget class="QSlider" name="slMaxAcc" >
<property name="maximum" >
<number>100</number>
</property>
<property name="value" >
<number>50</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="5" column="0" colspan="4" >
<widget class="Line" name="line_6" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2" >
<widget class="QLabel" name="label_11" >
<property name="text" >
<string>Acceleration Stop</string>
</property>
</widget>
</item>
<item row="6" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>21</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="3" >
<widget class="QDoubleSpinBox" name="spStopAcc" >
<property name="maximum" >
<double>10.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.100000000000000</double>
</property>
<property name="value" >
<double>8.000000000000000</double>
</property>
</widget>
</item>
<item row="7" column="0" colspan="4" >
<widget class="QSlider" name="slStopAcc" >
<property name="maximum" >
<number>100</number>
</property>
<property name="value" >
<number>80</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="0" column="1" >
<spacer name="horizontalSpacer" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>184</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="2" >
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>Less</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="slWobblyness" >
<property name="maximum" >
<number>6</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>More</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>4</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>