Patch by Nadeem Hasan:

- "Animate Minimize and Restore" disables slider when not checked.
- Slider tickmarks added.
- Misc. code cleanups.

svn path=/trunk/kdebase/kwin/; revision=139844
This commit is contained in:
Karol Szwed 2002-03-01 11:38:40 +00:00
parent d0dc9e979d
commit 2ba2ca09c9
2 changed files with 26 additions and 39 deletions

View file

@ -693,9 +693,15 @@ KMovingConfig::KMovingConfig (KConfig *_config, QWidget *parent, const char *nam
rLay->addWidget(minimizeAnimOn,0,0); rLay->addWidget(minimizeAnimOn,0,0);
minimizeAnimSlider = new QSlider(0,10,10,0,QSlider::Horizontal, windowsBox); minimizeAnimSlider = new QSlider(0,10,10,0,QSlider::Horizontal, windowsBox);
minimizeAnimSlider->setSteps(10,1); minimizeAnimSlider->setSteps(1, 1);
// QSlider::Below clashes with a X11/X.h #define
#undef Below
minimizeAnimSlider->setTickmarks(QSlider::Below);
rLay->addMultiCellWidget(minimizeAnimSlider,0,0,1,2); rLay->addMultiCellWidget(minimizeAnimSlider,0,0,1,2);
connect(minimizeAnimOn, SIGNAL(toggled(bool)), this, SLOT(setMinimizeAnim(bool)));
connect(minimizeAnimSlider, SIGNAL(valueChanged(int)), this, SLOT(setMinimizeAnimSpeed(int)));
minimizeAnimSlowLabel= new QLabel(i18n("Slow"),windowsBox); minimizeAnimSlowLabel= new QLabel(i18n("Slow"),windowsBox);
minimizeAnimSlowLabel->setAlignment(AlignTop|AlignLeft); minimizeAnimSlowLabel->setAlignment(AlignTop|AlignLeft);
rLay->addWidget(minimizeAnimSlowLabel,1,1); rLay->addWidget(minimizeAnimSlowLabel,1,1);
@ -716,7 +722,6 @@ KMovingConfig::KMovingConfig (KConfig *_config, QWidget *parent, const char *nam
" and allows you to move or resize them," " and allows you to move or resize them,"
" just like for normal windows")); " just like for normal windows"));
rLay = new QGridLayout(1,3); rLay = new QGridLayout(1,3);
bLay->addLayout(rLay); bLay->addLayout(rLay);
rLay->setColStretch(0,1); rLay->setColStretch(0,1);
@ -803,7 +808,7 @@ KMovingConfig::KMovingConfig (KConfig *_config, QWidget *parent, const char *nam
// Any changes goes to slotChanged() // Any changes goes to slotChanged()
connect( opaque, SIGNAL(clicked()), this, SLOT(slotChanged())); connect( opaque, SIGNAL(clicked()), this, SLOT(slotChanged()));
connect( resizeOpaqueOn, SIGNAL(clicked()), this, SLOT(slotChanged())); connect( resizeOpaqueOn, SIGNAL(clicked()), this, SLOT(slotChanged()));
connect( minimizeAnimOn, SIGNAL(clicked() ), SLOT(slotChanged())); connect( minimizeAnimOn, SIGNAL(clicked() ), this, SLOT(slotChanged()));
connect( minimizeAnimSlider, SIGNAL(valueChanged(int)), this, SLOT(slotChanged())); connect( minimizeAnimSlider, SIGNAL(valueChanged(int)), this, SLOT(slotChanged()));
connect( moveResizeMaximized, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect( moveResizeMaximized, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
connect( placementCombo, SIGNAL(activated(int)), this, SLOT(slotChanged())); connect( placementCombo, SIGNAL(activated(int)), this, SLOT(slotChanged()));
@ -820,18 +825,12 @@ void KMovingConfig::slotChanged()
int KMovingConfig::getMove() int KMovingConfig::getMove()
{ {
if (opaque->isChecked()) return (opaque->isChecked())? OPAQUE : TRANSPARENT;
return OPAQUE;
else
return TRANSPARENT;
} }
void KMovingConfig::setMove(int trans) void KMovingConfig::setMove(int trans)
{ {
if (trans == TRANSPARENT) opaque->setChecked(trans == OPAQUE);
opaque->setChecked(false);
else
opaque->setChecked(true);
} }
// placement policy --- CT 31jan98 --- // placement policy --- CT 31jan98 ---
@ -855,29 +854,27 @@ int KMovingConfig::getMinimizeAnimSpeed()
return minimizeAnimSlider->value(); return minimizeAnimSlider->value();
} }
void KMovingConfig::setMinimizeAnim(bool anim, int speed) void KMovingConfig::setMinimizeAnim(bool anim)
{ {
minimizeAnimOn->setChecked( anim ); minimizeAnimOn->setChecked( anim );
minimizeAnimSlider->setValue(speed);
minimizeAnimSlider->setEnabled( anim ); minimizeAnimSlider->setEnabled( anim );
minimizeAnimSlowLabel->setEnabled( anim ); minimizeAnimSlowLabel->setEnabled( anim );
minimizeAnimFastLabel->setEnabled( anim ); minimizeAnimFastLabel->setEnabled( anim );
} }
void KMovingConfig::setMinimizeAnimSpeed(int speed)
{
minimizeAnimSlider->setValue(speed);
}
int KMovingConfig::getResizeOpaque() int KMovingConfig::getResizeOpaque()
{ {
if (resizeOpaqueOn->isChecked()) return (resizeOpaqueOn->isChecked())? RESIZE_OPAQUE : RESIZE_TRANSPARENT;
return RESIZE_OPAQUE;
else
return RESIZE_TRANSPARENT;
} }
void KMovingConfig::setResizeOpaque(int opaque) void KMovingConfig::setResizeOpaque(int opaque)
{ {
if (opaque == RESIZE_OPAQUE) resizeOpaqueOn->setChecked(opaque == RESIZE_OPAQUE);
resizeOpaqueOn->setChecked(true);
else
resizeOpaqueOn->setChecked(false);
} }
void KMovingConfig::setMoveResizeMaximized(bool a) { void KMovingConfig::setMoveResizeMaximized(bool a) {
@ -897,18 +894,12 @@ void KMovingConfig::load( void )
setMove(OPAQUE); setMove(OPAQUE);
//CT 17Jun1998 - variable animation speed from 0 (none!!) to 10 (max) //CT 17Jun1998 - variable animation speed from 0 (none!!) to 10 (max)
int anim = 1; bool anim = config->readBoolEntry(KWIN_MINIMIZE_ANIM, true );
if (config->hasKey(KWIN_MINIMIZE_ANIM_SPEED)) { int animSpeed = config->readNumEntry(KWIN_MINIMIZE_ANIM_SPEED, 5);
anim = config->readNumEntry(KWIN_MINIMIZE_ANIM_SPEED); if( animSpeed < 1 ) animSpeed = 0;
if( anim < 1 ) anim = 0; if( animSpeed > 10 ) animSpeed = 10;
if( anim > 10 ) anim = 10; setMinimizeAnim( anim );
setMinimizeAnim( config->readBoolEntry(KWIN_MINIMIZE_ANIM, true ), anim ); setMinimizeAnimSpeed( animSpeed );
}
else{
config->writeEntry(KWIN_MINIMIZE_ANIM, true );
config->writeEntry(KWIN_MINIMIZE_ANIM_SPEED, 5);
setMinimizeAnim(true, 5);
}
// DF: please keep the default consistent with kwin (options.cpp line 145) // DF: please keep the default consistent with kwin (options.cpp line 145)
key = config->readEntry(KWIN_RESIZE_OPAQUE, "Opaque"); key = config->readEntry(KWIN_RESIZE_OPAQUE, "Opaque");
@ -996,10 +987,6 @@ void KMovingConfig::save( void )
config->writeEntry(KWIN_MINIMIZE_ANIM, getMinimizeAnim()); config->writeEntry(KWIN_MINIMIZE_ANIM, getMinimizeAnim());
config->writeEntry(KWIN_MINIMIZE_ANIM_SPEED, getMinimizeAnimSpeed()); config->writeEntry(KWIN_MINIMIZE_ANIM_SPEED, getMinimizeAnimSpeed());
if ( getMinimizeAnim() > 0 )
config->writeEntry("AnimateMinimize", true );
v = getResizeOpaque(); v = getResizeOpaque();
if (v == RESIZE_OPAQUE) if (v == RESIZE_OPAQUE)
config->writeEntry(KWIN_RESIZE_OPAQUE, "Opaque"); config->writeEntry(KWIN_RESIZE_OPAQUE, "Opaque");

View file

@ -126,9 +126,10 @@ signals:
private slots: private slots:
void slotChanged(); void slotChanged();
void setMinimizeAnim( bool );
void setMinimizeAnimSpeed( int );
private: private:
int getMove( void ); int getMove( void );
bool getMinimizeAnim( void ); bool getMinimizeAnim( void );
int getMinimizeAnimSpeed( void ); int getMinimizeAnimSpeed( void );
@ -136,7 +137,6 @@ private:
int getPlacement( void ); //CT int getPlacement( void ); //CT
void setMove(int); void setMove(int);
void setMinimizeAnim(bool,int);
void setResizeOpaque(int); void setResizeOpaque(int);
void setPlacement(int); //CT void setPlacement(int); //CT
void setMoveResizeMaximized(bool); void setMoveResizeMaximized(bool);