added necessary options to configure all type of animations individually.

icc-effect-5.14.5
Hugo Pereira Da Costa 2011-07-18 07:36:44 +02:00
parent 6c235bbe1e
commit c21122c863
9 changed files with 207 additions and 98 deletions

View File

@ -117,8 +117,7 @@ namespace Oxygen
else if( ui->ui.separatorMode->currentIndex() != configuration.separatorMode() ) modified = true;
else if( ui->ui.titleOutline->isChecked() != configuration.drawTitleOutline() ) modified = true;
else if( ui->ui.useAnimations->isChecked() != configuration.useAnimations() ) modified = true;
else if( ui->ui.animateTitleChange->isChecked() != configuration.animateTitleChange() ) modified = true;
else if( ui->ui.animationsEnabled->isChecked() != configuration.animationsEnabled() ) modified = true;
else if( ui->ui.narrowButtonSpacing->isChecked() != configuration.useNarrowButtonSpacing() ) modified = true;
// shadow configurations
@ -152,8 +151,7 @@ namespace Oxygen
configuration.setDrawTitleOutline( ui->ui.titleOutline->isChecked() );
configuration.setUseDropShadows( ui->shadowConfigurations[1]->isChecked() );
configuration.setUseOxygenShadows( ui->shadowConfigurations[0]->isChecked() );
configuration.setUseAnimations( ui->ui.useAnimations->isChecked() );
configuration.setAnimateTitleChange( ui->ui.animateTitleChange->isChecked() );
configuration.setAnimationsEnabled( ui->ui.animationsEnabled->isChecked() );
configuration.setUseNarrowButtonSpacing( ui->ui.narrowButtonSpacing->isChecked() );
// save standard configuration
@ -229,8 +227,7 @@ namespace Oxygen
ui->ui.titleOutline->setChecked( configuration.drawTitleOutline() );
ui->shadowConfigurations[0]->setChecked( configuration.useOxygenShadows() );
ui->shadowConfigurations[1]->setChecked( configuration.useDropShadows() );
ui->ui.useAnimations->setChecked( configuration.useAnimations() );
ui->ui.animateTitleChange->setChecked( configuration.animateTitleChange() );
ui->ui.animationsEnabled->setChecked( configuration.animationsEnabled() );
ui->ui.narrowButtonSpacing->setChecked( configuration.useNarrowButtonSpacing() );
}

View File

@ -104,14 +104,12 @@ namespace Oxygen
connect( ui.blendColor, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
connect( ui.sizeGripMode, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
connect( ui.useAnimations, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui.animateTitleChange, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui.animationsEnabled, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui.narrowButtonSpacing, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui.separatorMode, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
connect( ui.titleOutline, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui.exceptions, SIGNAL(changed()), SIGNAL(changed()) );
connect( ui.useAnimations, SIGNAL( toggled( bool ) ), ui.animateTitleChange, SLOT( setEnabled( bool ) ) );
connect( ui._expertModeButton, SIGNAL( pressed( void ) ), SLOT( toggleExpertModeInternal( void ) ) );
ui._expertModeButton->setIcon( KIcon("configure") );
@ -137,7 +135,6 @@ namespace Oxygen
// update button text
ui._expertModeButton->setText( _expertMode ? i18n( "Hide Advanced Configuration Options" ):i18n( "Show Advanced Configuration Options" ) );
ui.animateTitleChange->setVisible( _expertMode );
ui.narrowButtonSpacing->setVisible( _expertMode );
// size grip mode

View File

@ -92,23 +92,13 @@
<widget class="KComboBox" name="buttonSize"/>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="useAnimations">
<widget class="QCheckBox" name="animationsEnabled">
<property name="text">
<string>Enable animations</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="4">
<widget class="QCheckBox" name="animateTitleChange">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Enable title transition animations</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>

View File

@ -95,8 +95,8 @@ namespace Oxygen
{ return (!_forceInactive) && _client.isActive(); }
//___________________________________________________
bool Button::animateButtonHover( void ) const
{ return _client.useAnimations(); }
bool Button::buttonAnimationsEnabled( void ) const
{ return _client.animationsEnabled() && _client.configuration().buttonAnimationsEnabled(); }
//___________________________________________________
QSize Button::sizeHint() const
@ -107,7 +107,7 @@ namespace Oxygen
//___________________________________________________
void Button::reset( unsigned long )
{ _glowAnimation->setDuration( _client.configuration().animationsDuration() ); }
{ _glowAnimation->setDuration( _client.configuration().buttonAnimationsDuration() ); }
//___________________________________________________
@ -116,7 +116,7 @@ namespace Oxygen
KCommonDecorationButton::enterEvent( event );
if( _status != Oxygen::Pressed ) _status = Oxygen::Hovered;
if( animateButtonHover() )
if( buttonAnimationsEnabled() )
{
_glowAnimation->setDirection( Animation::Forward );
@ -132,7 +132,7 @@ namespace Oxygen
KCommonDecorationButton::leaveEvent( event );
if( _status == Oxygen::Hovered && animateButtonHover() )
if( _status == Oxygen::Hovered && buttonAnimationsEnabled() )
{
_glowAnimation->setDirection( Animation::Backward );
if( !isAnimated() ) _glowAnimation->start();

View File

@ -149,7 +149,7 @@ namespace Oxygen
bool isActive( void ) const;
//! true if buttons hover are animated
bool animateButtonHover( void ) const;
bool buttonAnimationsEnabled( void ) const;
//!@name button properties
//@{

View File

@ -142,11 +142,15 @@ namespace Oxygen
_configuration = _factory->configuration( *this );
// animations duration
_glowAnimation->setDuration( configuration().animationsDuration() );
_titleAnimationData->setDuration( configuration().animationsDuration() );
_itemData.animation().data()->setDuration( configuration().animationsDuration() );
_itemData.setAnimationsEnabled( useAnimations() );
// glow animations
_glowAnimation->setDuration( configuration().shadowAnimationsDuration() );
// title transitions
_titleAnimationData->setDuration( configuration().titleAnimationsDuration() );
// tabs
_itemData.setAnimationsEnabled( animationsEnabled() && configuration().tabAnimationsEnabled() );
_itemData.animation().data()->setDuration( configuration().tabAnimationsDuration() );
// reset title transitions
_titleAnimationData->reset();
@ -1193,7 +1197,7 @@ namespace Oxygen
_itemData.setDirty( true );
// reset animation
if( animateActiveChange() )
if( shadowAnimationsEnabled() )
{
_glowAnimation->setDirection( isActive() ? Animation::Forward : Animation::Backward );
if(!glowIsAnimated()) { _glowAnimation->start(); }
@ -1230,7 +1234,7 @@ namespace Oxygen
KCommonDecorationUnstable::captionChange();
_itemData.setDirty( true );
if( animateTitleChange() )
if( titleAnimationsEnabled() )
{ _titleAnimationData->setDirty( true ); }
}

View File

@ -79,10 +79,9 @@ namespace Oxygen
virtual bool isMaximized( void ) const
{ return maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows(); }
//! true if animations are used
bool useAnimations( void ) const
{ return configuration().useAnimations(); }
bool animationsEnabled( void ) const
{ return configuration().animationsEnabled(); }
//! true if glow is animated
bool glowIsAnimated( void ) const
@ -341,15 +340,15 @@ namespace Oxygen
QPixmap itemDragPixmap( int, const QRect& );
//! return true when activity change are animated
bool animateActiveChange( void ) const
{ return ( useAnimations() && !isPreview() ); }
bool shadowAnimationsEnabled( void ) const
{ return ( animationsEnabled() && configuration().shadowAnimationsEnabled() && !isPreview() ); }
//! return true when activity change are animated
bool animateTitleChange( void ) const
bool titleAnimationsEnabled( void ) const
{
return
useAnimations() &&
configuration().animateTitleChange() &&
animationsEnabled() &&
configuration().titleAnimationsEnabled() &&
!configuration().drawTitleOutline() &&
!hideTitleBar() &&
!isPreview();

View File

@ -47,10 +47,16 @@ namespace Oxygen
_hideTitleBar( false ),
_useDropShadows( true ),
_useOxygenShadows( true ),
_useAnimations( true ),
_animateTitleChange( true ),
_animationsDuration( 150 ),
_useNarrowButtonSpacing( false )
_useNarrowButtonSpacing( false ),
_animationsEnabled( true ),
_buttonAnimationsEnabled( true ),
_titleAnimationsEnabled( true ),
_shadowAnimationsEnabled( true ),
_tabAnimationsEnabled( true ),
_buttonAnimationsDuration( 150 ),
_titleAnimationsDuration( 150 ),
_shadowAnimationsDuration( 150 ),
_tabAnimationsDuration( 150 )
{}
//__________________________________________________
@ -121,26 +127,49 @@ namespace Oxygen
OxygenConfig::USE_OXYGEN_SHADOWS,
defaultConfiguration.useOxygenShadows() ) );
// animations
setUseAnimations( group.readEntry(
OxygenConfig::USE_ANIMATIONS,
defaultConfiguration.useAnimations() ) );
// animations
setAnimateTitleChange( group.readEntry(
OxygenConfig::ANIMATE_TITLE_CHANGE,
defaultConfiguration.animateTitleChange() ) );
// animations
setAnimationsDuration( group.readEntry(
OxygenConfig::ANIMATIONS_DURATION,
defaultConfiguration.animationsDuration() ) );
// buttonSpacing
setUseNarrowButtonSpacing( group.readEntry(
OxygenConfig::NARROW_BUTTON_SPACING,
defaultConfiguration.useNarrowButtonSpacing() ) );
// animations
setAnimationsEnabled( group.readEntry(
OxygenConfig::ANIMATIONS_ENABLED,
defaultConfiguration.animationsEnabled() ) );
setButtonAnimationsEnabled( group.readEntry(
OxygenConfig::BUTTON_ANIMATIONS_ENABLED,
defaultConfiguration.buttonAnimationsEnabled() ) );
setTitleAnimationsEnabled( group.readEntry(
OxygenConfig::TITLE_ANIMATIONS_ENABLED,
defaultConfiguration.titleAnimationsEnabled() ) );
setShadowAnimationsEnabled( group.readEntry(
OxygenConfig::SHADOW_ANIMATIONS_ENABLED,
defaultConfiguration.shadowAnimationsEnabled() ) );
setTabAnimationsEnabled( group.readEntry(
OxygenConfig::TAB_ANIMATIONS_ENABLED,
defaultConfiguration.tabAnimationsEnabled() ) );
// animations duration
setButtonAnimationsDuration( group.readEntry(
OxygenConfig::BUTTON_ANIMATIONS_DURATION,
defaultConfiguration.buttonAnimationsDuration() ) );
setTitleAnimationsDuration( group.readEntry(
OxygenConfig::TITLE_ANIMATIONS_DURATION,
defaultConfiguration.titleAnimationsDuration() ) );
setShadowAnimationsDuration( group.readEntry(
OxygenConfig::SHADOW_ANIMATIONS_DURATION,
defaultConfiguration.shadowAnimationsDuration() ) );
setTabAnimationsDuration( group.readEntry(
OxygenConfig::TAB_ANIMATIONS_DURATION,
defaultConfiguration.tabAnimationsDuration() ) );
}
//__________________________________________________
@ -179,11 +208,21 @@ namespace Oxygen
if( hideTitleBar() != defaultConfiguration.hideTitleBar() ) group.writeEntry( OxygenConfig::HIDE_TITLEBAR, hideTitleBar() );
if( useDropShadows() != defaultConfiguration.useDropShadows() ) group.writeEntry( OxygenConfig::USE_DROP_SHADOWS, useDropShadows() );
if( useOxygenShadows() != defaultConfiguration.useOxygenShadows() ) group.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, useOxygenShadows() );
if( useAnimations() != defaultConfiguration.useAnimations() ) group.writeEntry( OxygenConfig::USE_ANIMATIONS, useAnimations() );
if( animateTitleChange() != defaultConfiguration.animateTitleChange() ) group.writeEntry( OxygenConfig::ANIMATE_TITLE_CHANGE, animateTitleChange() );
if( animationsDuration() != defaultConfiguration.animationsDuration() ) group.writeEntry( OxygenConfig::ANIMATIONS_DURATION, animationsDuration() );
if( useNarrowButtonSpacing() != defaultConfiguration.useNarrowButtonSpacing() ) group.writeEntry( OxygenConfig::NARROW_BUTTON_SPACING, useNarrowButtonSpacing() );
// animations
if( animationsEnabled() != defaultConfiguration.animationsEnabled() ) group.writeEntry( OxygenConfig::ANIMATIONS_ENABLED, animationsEnabled() );
if( buttonAnimationsEnabled() != defaultConfiguration.buttonAnimationsEnabled() ) group.writeEntry( OxygenConfig::BUTTON_ANIMATIONS_ENABLED, buttonAnimationsEnabled() );
if( titleAnimationsEnabled() != defaultConfiguration.titleAnimationsEnabled() ) group.writeEntry( OxygenConfig::TITLE_ANIMATIONS_ENABLED, titleAnimationsEnabled() );
if( shadowAnimationsEnabled() != defaultConfiguration.shadowAnimationsEnabled() ) group.writeEntry( OxygenConfig::SHADOW_ANIMATIONS_ENABLED, shadowAnimationsEnabled() );
if( tabAnimationsEnabled() != defaultConfiguration.tabAnimationsEnabled() ) group.writeEntry( OxygenConfig::TAB_ANIMATIONS_ENABLED, tabAnimationsEnabled() );
// animations duration
if( buttonAnimationsDuration() != defaultConfiguration.buttonAnimationsDuration() ) group.writeEntry( OxygenConfig::BUTTON_ANIMATIONS_DURATION, buttonAnimationsDuration() );
if( titleAnimationsDuration() != defaultConfiguration.titleAnimationsDuration() ) group.writeEntry( OxygenConfig::TITLE_ANIMATIONS_DURATION, titleAnimationsDuration() );
if( shadowAnimationsDuration() != defaultConfiguration.shadowAnimationsDuration() ) group.writeEntry( OxygenConfig::SHADOW_ANIMATIONS_DURATION, shadowAnimationsDuration() );
if( tabAnimationsDuration() != defaultConfiguration.tabAnimationsDuration() ) group.writeEntry( OxygenConfig::TAB_ANIMATIONS_DURATION, tabAnimationsDuration() );
}
//__________________________________________________
@ -362,10 +401,16 @@ namespace Oxygen
hideTitleBar() == other.hideTitleBar() &&
useDropShadows() == other.useDropShadows() &&
useOxygenShadows() == other.useOxygenShadows() &&
useAnimations() == other.useAnimations() &&
animateTitleChange() == other.animateTitleChange() &&
animationsDuration() == other.animationsDuration() &&
useNarrowButtonSpacing() == other.useNarrowButtonSpacing();
useNarrowButtonSpacing() == other.useNarrowButtonSpacing() &&
animationsEnabled() == other.animationsEnabled() &&
buttonAnimationsEnabled() == other.buttonAnimationsEnabled() &&
titleAnimationsEnabled() == other.titleAnimationsEnabled() &&
shadowAnimationsEnabled() == other.shadowAnimationsEnabled() &&
tabAnimationsEnabled() == other.tabAnimationsEnabled() &&
buttonAnimationsDuration() == other.buttonAnimationsDuration() &&
titleAnimationsDuration() == other.titleAnimationsDuration() &&
shadowAnimationsDuration() == other.shadowAnimationsDuration() &&
tabAnimationsDuration() == other.tabAnimationsDuration();
}

View File

@ -42,9 +42,25 @@ namespace OxygenConfig
static const QString BLEND_COLOR = "BlendColor";
static const QString SIZE_GRIP_MODE = "SizeGripMode";
static const QString HIDE_TITLEBAR = "HideTitleBar";
static const QString USE_ANIMATIONS = "UseAnimations";
static const QString ANIMATE_TITLE_CHANGE = "AnimateTitleChange";
static const QString ANIMATIONS_ENABLED = "AnimationsEnabled";
static const QString NARROW_BUTTON_SPACING = "UseNarrowButtonSpacing";
//!@name animation flags
//@{
static const QString BUTTON_ANIMATIONS_ENABLED = "ButtonAnimationsEnabled";
static const QString TITLE_ANIMATIONS_ENABLED = "TitleAnimationsEnabled";
static const QString SHADOW_ANIMATIONS_ENABLED = "ShadowAnimationsEnabled";
static const QString TAB_ANIMATIONS_ENABLED = "TabAnimationsEnabled";
//@}
//!@name animations duration
//@{
static const QString BUTTON_ANIMATIONS_DURATION = "ButtonAnimationsDuration";
static const QString TITLE_ANIMATIONS_DURATION = "TitleAnimationsDuration";
static const QString SHADOW_ANIMATIONS_DURATION = "ShadowAnimationsDuration";
static const QString TAB_ANIMATIONS_DURATION = "TabAnimationsDuration";
//@}
}
namespace Oxygen
@ -284,29 +300,82 @@ namespace Oxygen
virtual void setUseOxygenShadows( bool value )
{ _useOxygenShadows = value; }
//! animations
virtual bool useAnimations( void ) const
{ return _useAnimations; }
//!@name animations
//@{
//! animations
virtual void setUseAnimations( bool value )
{ _useAnimations = value; }
//! global flag
virtual bool animationsEnabled( void ) const
{ return _animationsEnabled; }
//! animations
virtual bool animateTitleChange( void ) const
{ return _animateTitleChange; }
//! global flag
virtual void setAnimationsEnabled( bool value )
{ _animationsEnabled = value; }
//! animations
virtual void setAnimateTitleChange( bool value )
{ _animateTitleChange = value; }
//! buttons
virtual bool buttonAnimationsEnabled( void ) const
{ return _buttonAnimationsEnabled; }
//! animations
virtual int animationsDuration( void ) const
{ return _animationsDuration; }
//! buttons
virtual void setButtonAnimationsEnabled( bool value )
{ _buttonAnimationsEnabled = value; }
//! animations
virtual void setAnimationsDuration( int value )
{ _animationsDuration = value; }
//! buttons
virtual int buttonAnimationsDuration( void ) const
{ return _buttonAnimationsDuration; }
//! buttons
virtual void setButtonAnimationsDuration( int value )
{ _buttonAnimationsDuration = value; }
//! titles
virtual bool titleAnimationsEnabled( void ) const
{ return _titleAnimationsEnabled; }
//! title
virtual void setTitleAnimationsEnabled( bool value )
{ _titleAnimationsEnabled = value; }
//! title
virtual int titleAnimationsDuration( void ) const
{ return _titleAnimationsDuration; }
//! title
virtual void setTitleAnimationsDuration( int value )
{ _titleAnimationsDuration = value; }
//! shadows
virtual bool shadowAnimationsEnabled( void ) const
{ return _shadowAnimationsEnabled; }
//! shadows
virtual void setShadowAnimationsEnabled( bool value )
{ _shadowAnimationsEnabled = value; }
//! shadows
virtual int shadowAnimationsDuration( void ) const
{ return _shadowAnimationsDuration; }
//! shadows
virtual void setShadowAnimationsDuration( int value )
{ _shadowAnimationsDuration = value; }
//! tabs
virtual bool tabAnimationsEnabled( void ) const
{ return _tabAnimationsEnabled; }
//! tabs
virtual void setTabAnimationsEnabled( bool value )
{ _tabAnimationsEnabled = value; }
//! tabs
virtual int tabAnimationsDuration( void ) const
{ return _tabAnimationsDuration; }
//! tabs
virtual void setTabAnimationsDuration( int value )
{ _tabAnimationsDuration = value; }
//@}
private:
@ -343,18 +412,26 @@ namespace Oxygen
//! oxygen shadows
bool _useOxygenShadows;
//! animations
bool _useAnimations;
//! animations
bool _animateTitleChange;
//! animations
int _animationsDuration;
//! narrow button spacing
bool _useNarrowButtonSpacing;
//!@name animation flags
//@{
bool _animationsEnabled;
bool _buttonAnimationsEnabled;
bool _titleAnimationsEnabled;
bool _shadowAnimationsEnabled;
bool _tabAnimationsEnabled;
//@}
//!@name animation durations
//@{
int _buttonAnimationsDuration;
int _titleAnimationsDuration;
int _shadowAnimationsDuration;
int _tabAnimationsDuration;
//@}
};
}