added animation config widget to allow individual animation configuration.
This commit is contained in:
parent
c21122c863
commit
f75111622b
3 changed files with 246 additions and 0 deletions
|
@ -5,6 +5,7 @@ set(kwin_oxygen_config_PART_SRCS
|
|||
../oxygenconfiguration.cpp
|
||||
../oxygenexception.cpp
|
||||
../oxygenexceptionlist.cpp
|
||||
oxygenanimationconfigwidget.cpp
|
||||
oxygenconfig.cpp
|
||||
oxygenconfigurationui.cpp
|
||||
oxygendetectwidget.cpp
|
||||
|
@ -31,6 +32,7 @@ target_link_libraries(
|
|||
${X11_X11_LIB}
|
||||
kdecorations
|
||||
oxygenstyle
|
||||
oxygenstyleconfig
|
||||
)
|
||||
|
||||
install(TARGETS kwin_oxygen_config DESTINATION ${PLUGIN_INSTALL_DIR} )
|
||||
|
|
147
clients/oxygen/config/oxygenanimationconfigwidget.cpp
Normal file
147
clients/oxygen/config/oxygenanimationconfigwidget.cpp
Normal file
|
@ -0,0 +1,147 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// oxygenanimationconfigwidget.cpp
|
||||
// animation configuration widget
|
||||
// -------------------
|
||||
//
|
||||
// Copyright (c) 2010 Hugo Pereira Da Costa <hugo@oxygen-icons.org>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "oxygenanimationconfigwidget.h"
|
||||
#include "oxygenanimationconfigwidget.moc"
|
||||
#include "oxygenanimationconfigitem.h"
|
||||
#include "oxygengenericanimationconfigitem.h"
|
||||
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include <QtGui/QHoverEvent>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <KLocale>
|
||||
|
||||
namespace Oxygen
|
||||
{
|
||||
|
||||
//_______________________________________________
|
||||
AnimationConfigWidget::AnimationConfigWidget( QWidget* parent ):
|
||||
BaseAnimationConfigWidget( parent )
|
||||
{
|
||||
|
||||
QGridLayout* layout( qobject_cast<QGridLayout*>( BaseAnimationConfigWidget::layout() ) );
|
||||
|
||||
setupItem( layout, _buttonAnimations = new GenericAnimationConfigItem( this,
|
||||
i18n("Button mouseover transition"),
|
||||
i18n("Configure window buttons' mouseover highlight animation" ) ) );
|
||||
|
||||
setupItem( layout, _titleAnimations = new GenericAnimationConfigItem( this,
|
||||
i18n("Title transitions" ),
|
||||
i18n("Configure fading transitions when window title is changed" ) ) );
|
||||
|
||||
setupItem( layout, _shadowAnimations = new GenericAnimationConfigItem( this,
|
||||
i18n("Shadow and glow transitions" ),
|
||||
i18n("Configure fading between window shadow and glow when window's active state is changed" ) ) );
|
||||
|
||||
setupItem( layout, _tabAnimations = new GenericAnimationConfigItem( this,
|
||||
i18n("Window grouping transitions" ),
|
||||
i18n("Configure window titlebar animations when windows are grouped/ungrouped" ) ) );
|
||||
|
||||
// add spacers to the first column, previous row to finalize layout
|
||||
layout->addItem( new QSpacerItem( 25, 0 ), _row-1, 0, 1, 1 );
|
||||
|
||||
// add vertical spacer
|
||||
layout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ), _row, 1, 1, 1 );
|
||||
++_row;
|
||||
|
||||
connect( animationsEnabled(), SIGNAL( toggled( bool ) ), SLOT( updateChanged() ) );
|
||||
foreach( AnimationConfigItem* item, findChildren<AnimationConfigItem*>() )
|
||||
{
|
||||
item->QWidget::setEnabled( false );
|
||||
connect( animationsEnabled(), SIGNAL( toggled( bool ) ), item, SLOT( setEnabled( bool ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//_______________________________________________
|
||||
AnimationConfigWidget::~AnimationConfigWidget( void )
|
||||
{}
|
||||
|
||||
//_______________________________________________
|
||||
void AnimationConfigWidget::load( void )
|
||||
{
|
||||
|
||||
animationsEnabled()->setChecked( configuration().animationsEnabled() );
|
||||
|
||||
_buttonAnimations->setEnabled( configuration().buttonAnimationsEnabled() );
|
||||
_buttonAnimations->setDuration( configuration().buttonAnimationsDuration() );
|
||||
|
||||
_titleAnimations->setEnabled( configuration().titleAnimationsEnabled() );
|
||||
_titleAnimations->setDuration( configuration().titleAnimationsDuration() );
|
||||
|
||||
_shadowAnimations->setEnabled( configuration().shadowAnimationsEnabled() );
|
||||
_shadowAnimations->setDuration( configuration().shadowAnimationsDuration() );
|
||||
|
||||
_tabAnimations->setEnabled( configuration().tabAnimationsEnabled() );
|
||||
_tabAnimations->setDuration( configuration().tabAnimationsDuration() );
|
||||
}
|
||||
|
||||
//_______________________________________________
|
||||
void AnimationConfigWidget::save( void )
|
||||
{
|
||||
|
||||
configuration().setAnimationsEnabled( animationsEnabled()->isChecked() );
|
||||
|
||||
configuration().setButtonAnimationsEnabled( _buttonAnimations->enabled() );
|
||||
configuration().setButtonAnimationsDuration( _buttonAnimations->duration() );
|
||||
|
||||
configuration().setTitleAnimationsEnabled( _titleAnimations->enabled() );
|
||||
configuration().setTitleAnimationsDuration( _titleAnimations->duration() );
|
||||
|
||||
configuration().setShadowAnimationsEnabled( _shadowAnimations->enabled() );
|
||||
configuration().setShadowAnimationsDuration( _shadowAnimations->duration() );
|
||||
|
||||
configuration().setTabAnimationsEnabled( _tabAnimations->enabled() );
|
||||
configuration().setTabAnimationsDuration( _tabAnimations->duration() );
|
||||
|
||||
setChanged( false );
|
||||
|
||||
}
|
||||
|
||||
//_______________________________________________
|
||||
void AnimationConfigWidget::updateChanged( void )
|
||||
{
|
||||
|
||||
bool modified( false );
|
||||
|
||||
if( animationsEnabled()->isChecked() != configuration().animationsEnabled() ) modified = true;
|
||||
else if( _buttonAnimations->enabled() != configuration().buttonAnimationsEnabled() ) modified = true;
|
||||
else if( _buttonAnimations->duration() != configuration().buttonAnimationsDuration() ) modified = true;
|
||||
|
||||
else if( _titleAnimations->enabled() != configuration().titleAnimationsEnabled() ) modified = true;
|
||||
else if( _titleAnimations->duration() != configuration().titleAnimationsDuration() ) modified = true;
|
||||
|
||||
else if( _shadowAnimations->enabled() != configuration().shadowAnimationsEnabled() ) modified = true;
|
||||
else if( _shadowAnimations->duration() != configuration().shadowAnimationsDuration() ) modified = true;
|
||||
|
||||
else if( _tabAnimations->enabled() != configuration().tabAnimationsEnabled() ) modified = true;
|
||||
else if( _tabAnimations->duration() != configuration().tabAnimationsDuration() ) modified = true;
|
||||
|
||||
setChanged( modified );
|
||||
|
||||
}
|
||||
|
||||
}
|
97
clients/oxygen/config/oxygenanimationconfigwidget.h
Normal file
97
clients/oxygen/config/oxygenanimationconfigwidget.h
Normal file
|
@ -0,0 +1,97 @@
|
|||
#ifndef oxygenanimationconfigwidget_h
|
||||
#define oxygenanimationconfigwidget_h
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// oxygenanimationconfigwidget.h
|
||||
// animation configuration item
|
||||
// -------------------
|
||||
//
|
||||
// Copyright (c) 2010 Hugo Pereira Da Costa <hugo@oxygen-icons.org>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "oxygenbaseanimationconfigwidget.h"
|
||||
#include "../oxygenconfiguration.h"
|
||||
|
||||
namespace Oxygen
|
||||
{
|
||||
|
||||
// forward declaration
|
||||
class GenericAnimationConfigItem;
|
||||
|
||||
//! container to configure animations individually
|
||||
class AnimationConfigWidget: public BaseAnimationConfigWidget
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
explicit AnimationConfigWidget( QWidget* = 0 );
|
||||
|
||||
//! destructor
|
||||
virtual ~AnimationConfigWidget( void );
|
||||
|
||||
//! configuration
|
||||
void setConfiguration( const Configuration& configuration )
|
||||
{ _configuration = configuration; }
|
||||
|
||||
//! configuration
|
||||
const Configuration& configuration( void ) const
|
||||
{ return _configuration; }
|
||||
|
||||
public slots:
|
||||
|
||||
//! read current configuration
|
||||
virtual void load( void );
|
||||
|
||||
//! save current configuration
|
||||
virtual void save( void );
|
||||
|
||||
protected slots:
|
||||
|
||||
//! check whether configuration is changed and emit appropriate signal if yes
|
||||
virtual void updateChanged();
|
||||
|
||||
protected:
|
||||
|
||||
//! configuration
|
||||
Configuration& configuration( void )
|
||||
{ return _configuration; }
|
||||
|
||||
private:
|
||||
|
||||
//! local configuration, needed to handle I/O
|
||||
Configuration _configuration;
|
||||
|
||||
//!@name animations
|
||||
//@{
|
||||
GenericAnimationConfigItem* _buttonAnimations;
|
||||
GenericAnimationConfigItem* _titleAnimations;
|
||||
GenericAnimationConfigItem* _shadowAnimations;
|
||||
GenericAnimationConfigItem* _tabAnimations;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue