2009-08-24 16:12:50 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-09-15 07:12:54 +00:00
|
|
|
// oxygenconfiguration.cpp
|
2009-08-24 16:12:50 +00:00
|
|
|
// -------------------
|
2009-09-09 00:55:55 +00:00
|
|
|
//
|
2009-08-25 04:15:13 +00:00
|
|
|
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
2009-08-24 16:12:50 +00:00
|
|
|
//
|
|
|
|
// 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
|
2009-09-09 00:55:55 +00:00
|
|
|
// IN THE SOFTWARE.
|
2009-08-24 16:12:50 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
#include "oxygenconfiguration.h"
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2009-09-16 06:09:31 +00:00
|
|
|
#include <KLocale>
|
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
namespace Oxygen
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenConfiguration::OxygenConfiguration( void ):
|
2009-09-17 08:16:46 +00:00
|
|
|
titleAlignment_( Qt::AlignHCenter ),
|
2009-08-22 08:24:06 +00:00
|
|
|
buttonSize_( ButtonDefault ),
|
|
|
|
frameBorder_( BorderDefault ),
|
|
|
|
blendColor_( RadialBlending ),
|
2009-09-02 02:15:53 +00:00
|
|
|
sizeGripMode_( SizeGripWhenNeeded ),
|
2009-09-17 08:16:46 +00:00
|
|
|
drawSeparator_( false ),
|
2009-09-04 19:02:20 +00:00
|
|
|
drawTitleOutline_( false ),
|
2009-11-07 03:33:53 +00:00
|
|
|
hideTitleBar_( false ),
|
2010-03-25 00:51:27 +00:00
|
|
|
useDropShadows_( true ),
|
2009-10-02 02:52:41 +00:00
|
|
|
useOxygenShadows_( true ),
|
|
|
|
useAnimations_( true ),
|
2010-02-12 00:42:25 +00:00
|
|
|
animateTitleChange_( true ),
|
2009-11-10 23:11:08 +00:00
|
|
|
animationsDuration_( 150 ),
|
2009-11-15 03:24:04 +00:00
|
|
|
tabsEnabled_( true ),
|
2010-04-14 22:21:08 +00:00
|
|
|
useNarrowButtonSpacing_( false ),
|
|
|
|
shadowCacheMode_( CacheVariable )
|
2009-08-22 08:24:06 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenConfiguration::OxygenConfiguration( KConfigGroup group )
|
2009-09-09 00:55:55 +00:00
|
|
|
{
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
// used to set default values when entries are not found in kconfig
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenConfiguration defaultConfiguration;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
// title alignment
|
2009-09-09 00:55:55 +00:00
|
|
|
setTitleAlignment( titleAlignment(
|
2009-09-15 07:12:54 +00:00
|
|
|
group.readEntry( OxygenConfig::TITLE_ALIGNMENT,
|
2009-08-24 16:12:50 +00:00
|
|
|
defaultConfiguration.titleAlignmentName( false ) ), false ) );
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
// button size
|
2009-09-09 00:55:55 +00:00
|
|
|
setButtonSize( buttonSize(
|
2009-09-15 07:12:54 +00:00
|
|
|
group.readEntry( OxygenConfig::BUTTON_SIZE,
|
2009-08-24 16:12:50 +00:00
|
|
|
defaultConfiguration.buttonSizeName( false ) ), false ) );
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
// frame border
|
2009-09-09 00:55:55 +00:00
|
|
|
setFrameBorder( frameBorder(
|
2009-09-15 07:12:54 +00:00
|
|
|
group.readEntry( OxygenConfig::FRAME_BORDER,
|
2009-08-24 16:12:50 +00:00
|
|
|
defaultConfiguration.frameBorderName( false ) ), false ) );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
// blend color
|
|
|
|
setBlendColor( blendColor(
|
2009-09-15 07:12:54 +00:00
|
|
|
group.readEntry( OxygenConfig::BLEND_COLOR,
|
2009-08-24 16:12:50 +00:00
|
|
|
defaultConfiguration.blendColorName( false ) ), false ) );
|
2009-09-02 02:15:53 +00:00
|
|
|
|
|
|
|
// size grip
|
2009-09-09 00:55:55 +00:00
|
|
|
setSizeGripMode( sizeGripMode(
|
2009-09-15 07:12:54 +00:00
|
|
|
group.readEntry( OxygenConfig::SIZE_GRIP_MODE,
|
2009-09-02 02:15:53 +00:00
|
|
|
defaultConfiguration.sizeGripModeName( false ) ), false ) );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
// draw separator
|
2009-09-09 00:55:55 +00:00
|
|
|
setDrawSeparator( group.readEntry(
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenConfig::DRAW_SEPARATOR,
|
2009-08-22 08:24:06 +00:00
|
|
|
defaultConfiguration.drawSeparator() ) );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-04 19:02:20 +00:00
|
|
|
// title outline
|
2009-09-09 00:55:55 +00:00
|
|
|
setDrawTitleOutline( group.readEntry(
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenConfig::DRAW_TITLE_OUTLINE,
|
2009-09-04 19:02:20 +00:00
|
|
|
defaultConfiguration.drawTitleOutline() ) );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-11-07 03:33:53 +00:00
|
|
|
// hide title bar
|
|
|
|
setHideTitleBar( group.readEntry(
|
|
|
|
OxygenConfig::HIDE_TITLEBAR,
|
|
|
|
defaultConfiguration.hideTitleBar() ) );
|
|
|
|
|
2010-03-25 00:51:27 +00:00
|
|
|
// drop shadows
|
|
|
|
setUseDropShadows( group.readEntry(
|
|
|
|
OxygenConfig::USE_DROP_SHADOWS,
|
|
|
|
defaultConfiguration.useDropShadows() ) );
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
// oxygen shadows
|
|
|
|
setUseOxygenShadows( group.readEntry(
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenConfig::USE_OXYGEN_SHADOWS,
|
2009-08-22 08:24:06 +00:00
|
|
|
defaultConfiguration.useOxygenShadows() ) );
|
2009-10-02 02:52:41 +00:00
|
|
|
|
|
|
|
// animations
|
|
|
|
setUseAnimations( group.readEntry(
|
|
|
|
OxygenConfig::USE_ANIMATIONS,
|
|
|
|
defaultConfiguration.useAnimations() ) );
|
|
|
|
|
2010-01-06 01:42:38 +00:00
|
|
|
// animations
|
|
|
|
setAnimateTitleChange( group.readEntry(
|
|
|
|
OxygenConfig::ANIMATE_TITLE_CHANGE,
|
|
|
|
defaultConfiguration.animateTitleChange() ) );
|
|
|
|
|
2009-10-02 02:52:41 +00:00
|
|
|
// animations
|
|
|
|
setAnimationsDuration( group.readEntry(
|
|
|
|
OxygenConfig::ANIMATIONS_DURATION,
|
|
|
|
defaultConfiguration.animationsDuration() ) );
|
2009-11-10 23:11:08 +00:00
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
// tabbing
|
|
|
|
setTabsEnabled( group.readEntry(
|
|
|
|
OxygenConfig::TABS_ENABLED,
|
|
|
|
defaultConfiguration.tabsEnabled() ) );
|
|
|
|
|
2009-11-10 23:11:08 +00:00
|
|
|
// buttonSpacing
|
|
|
|
setUseNarrowButtonSpacing( group.readEntry(
|
|
|
|
OxygenConfig::NARROW_BUTTON_SPACING,
|
|
|
|
defaultConfiguration.useNarrowButtonSpacing() ) );
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2010-04-14 22:35:46 +00:00
|
|
|
// shadow cache mode
|
|
|
|
setShadowCacheMode( shadowCacheMode( group.readEntry(
|
|
|
|
OxygenConfig::SHADOW_CACHE_MODE, defaultConfiguration.shadowCacheModeName( false ) ), false ) );
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
void OxygenConfiguration::write( KConfigGroup& group ) const
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
group.writeEntry( OxygenConfig::TITLE_ALIGNMENT, titleAlignmentName( false ) );
|
|
|
|
group.writeEntry( OxygenConfig::BUTTON_SIZE, buttonSizeName( false ) );
|
|
|
|
group.writeEntry( OxygenConfig::BLEND_COLOR, blendColorName( false ) );
|
|
|
|
group.writeEntry( OxygenConfig::FRAME_BORDER, frameBorderName( false ) );
|
|
|
|
group.writeEntry( OxygenConfig::SIZE_GRIP_MODE, sizeGripModeName( false ) );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
group.writeEntry( OxygenConfig::DRAW_SEPARATOR, drawSeparator() );
|
|
|
|
group.writeEntry( OxygenConfig::DRAW_TITLE_OUTLINE, drawTitleOutline() );
|
2009-11-07 03:33:53 +00:00
|
|
|
group.writeEntry( OxygenConfig::HIDE_TITLEBAR, hideTitleBar() );
|
2010-03-25 00:51:27 +00:00
|
|
|
group.writeEntry( OxygenConfig::USE_DROP_SHADOWS, useDropShadows() );
|
2009-09-15 07:12:54 +00:00
|
|
|
group.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, useOxygenShadows() );
|
2009-10-02 02:52:41 +00:00
|
|
|
group.writeEntry( OxygenConfig::USE_ANIMATIONS, useAnimations() );
|
2010-01-06 01:42:38 +00:00
|
|
|
group.writeEntry( OxygenConfig::ANIMATE_TITLE_CHANGE, animateTitleChange() );
|
2009-10-02 02:52:41 +00:00
|
|
|
group.writeEntry( OxygenConfig::ANIMATIONS_DURATION, animationsDuration() );
|
2009-11-15 03:24:04 +00:00
|
|
|
group.writeEntry( OxygenConfig::TABS_ENABLED, tabsEnabled() );
|
2009-11-10 23:11:08 +00:00
|
|
|
group.writeEntry( OxygenConfig::NARROW_BUTTON_SPACING, useNarrowButtonSpacing() );
|
2010-04-14 22:35:46 +00:00
|
|
|
group.writeEntry( OxygenConfig::SHADOW_CACHE_MODE, shadowCacheModeName( false ) );
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
QString OxygenConfiguration::titleAlignmentName( Qt::Alignment value, bool translated )
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 06:17:48 +00:00
|
|
|
QString out;
|
2009-08-22 08:24:06 +00:00
|
|
|
switch( value )
|
|
|
|
{
|
2009-09-09 06:17:48 +00:00
|
|
|
case Qt::AlignLeft: out = translated ? i18n( "Left" ):"Left"; break;
|
|
|
|
case Qt::AlignHCenter: out = translated ? i18n( "Center" ):"Center"; break;
|
|
|
|
case Qt::AlignRight: out = translated ? i18n( "Right" ):"Right"; break;
|
2009-09-15 07:12:54 +00:00
|
|
|
default: return OxygenConfiguration().titleAlignmentName( translated );
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-09 06:17:48 +00:00
|
|
|
return out;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
Qt::Alignment OxygenConfiguration::titleAlignment( QString value, bool translated )
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-08-24 16:12:50 +00:00
|
|
|
if (value == titleAlignmentName( Qt::AlignLeft, translated ) ) return Qt::AlignLeft;
|
2009-08-25 05:00:41 +00:00
|
|
|
else if (value == titleAlignmentName( Qt::AlignHCenter, translated ) ) return Qt::AlignHCenter;
|
|
|
|
else if (value == titleAlignmentName( Qt::AlignRight, translated ) ) return Qt::AlignRight;
|
2009-09-15 07:12:54 +00:00
|
|
|
else return OxygenConfiguration().titleAlignment();
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
QString OxygenConfiguration::buttonSizeName( ButtonSize value, bool translated )
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 06:17:48 +00:00
|
|
|
QString out;
|
2009-08-22 08:24:06 +00:00
|
|
|
switch( value )
|
|
|
|
{
|
2009-09-09 06:17:48 +00:00
|
|
|
case ButtonSmall: out = translated ? i18n( "Small" ):"Small"; break;
|
|
|
|
case ButtonDefault: out = translated ? i18n( "Normal" ):"Normal"; break;
|
|
|
|
case ButtonLarge: out = translated ? i18n( "Large" ):"Large"; break;
|
|
|
|
case ButtonHuge: out = translated ? i18n( "Huge" ):"Huge"; break;
|
2009-09-15 07:12:54 +00:00
|
|
|
default: return OxygenConfiguration().buttonSizeName( translated );
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-09 06:17:48 +00:00
|
|
|
return out;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenConfiguration::ButtonSize OxygenConfiguration::buttonSize( QString value, bool translated )
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-08-24 16:12:50 +00:00
|
|
|
if( value == buttonSizeName( ButtonSmall, translated ) ) return ButtonSmall;
|
|
|
|
else if( value == buttonSizeName( ButtonDefault, translated ) ) return ButtonDefault;
|
|
|
|
else if( value == buttonSizeName( ButtonLarge, translated ) ) return ButtonLarge;
|
|
|
|
else if( value == buttonSizeName( ButtonHuge, translated ) ) return ButtonHuge;
|
2009-09-15 07:12:54 +00:00
|
|
|
else return OxygenConfiguration().buttonSize();
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
|
|
|
|
2009-08-29 05:38:58 +00:00
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
int OxygenConfiguration::iconScale( ButtonSize value )
|
2009-08-29 05:38:58 +00:00
|
|
|
{
|
|
|
|
switch( value )
|
|
|
|
{
|
|
|
|
case ButtonSmall: return 13;
|
2009-09-09 00:55:55 +00:00
|
|
|
case ButtonDefault: return 16;
|
2009-08-29 05:38:58 +00:00
|
|
|
case ButtonLarge: return 24;
|
|
|
|
case ButtonHuge: return 35;
|
2009-09-15 07:12:54 +00:00
|
|
|
default: return OxygenConfiguration().iconScale();
|
2009-08-29 05:38:58 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-29 05:38:58 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
QString OxygenConfiguration::frameBorderName( FrameBorder value, bool translated )
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 06:17:48 +00:00
|
|
|
QString out;
|
2009-08-22 08:24:06 +00:00
|
|
|
switch( value )
|
|
|
|
{
|
2009-09-09 06:17:48 +00:00
|
|
|
case BorderNone: out = translated ? i18n( "No Border" ):"No Border"; break;
|
2009-09-09 07:39:16 +00:00
|
|
|
case BorderNoSide: out = translated ? i18n( "No Side Border" ):"No Side Border"; break;
|
2009-09-09 06:17:48 +00:00
|
|
|
case BorderTiny: out = translated ? i18n( "Tiny" ):"Tiny"; break;
|
|
|
|
case BorderDefault: out = translated ? i18n( "Normal" ):"Normal"; break;
|
|
|
|
case BorderLarge: out = translated ? i18n( "Large" ):"Large"; break;
|
|
|
|
case BorderVeryLarge: out = translated ? i18n( "Very Large" ):"Very Large"; break;
|
|
|
|
case BorderHuge: out = translated ? i18n( "Huge" ):"Huge"; break;
|
|
|
|
case BorderVeryHuge: out = translated ? i18n( "Very Huge" ):"Very Huge"; break;
|
|
|
|
case BorderOversized: out = translated ? i18n( "Oversized" ):"Oversized"; break;
|
2009-09-15 07:12:54 +00:00
|
|
|
default: return OxygenConfiguration().frameBorderName( translated );
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-09 06:17:48 +00:00
|
|
|
return out;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenConfiguration::FrameBorder OxygenConfiguration::frameBorder( QString value, bool translated )
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-08-24 16:12:50 +00:00
|
|
|
if( value == frameBorderName( BorderNone, translated ) ) return BorderNone;
|
2009-09-09 07:39:16 +00:00
|
|
|
else if( value == frameBorderName( BorderNoSide, translated ) ) return BorderNoSide;
|
2009-08-24 16:12:50 +00:00
|
|
|
else if( value == frameBorderName( BorderTiny, translated ) ) return BorderTiny;
|
|
|
|
else if( value == frameBorderName( BorderDefault, translated ) ) return BorderDefault;
|
|
|
|
else if( value == frameBorderName( BorderLarge, translated ) ) return BorderLarge;
|
2009-08-25 04:51:08 +00:00
|
|
|
else if( value == frameBorderName( BorderVeryLarge, translated ) ) return BorderVeryLarge;
|
|
|
|
else if( value == frameBorderName( BorderHuge, translated ) ) return BorderHuge;
|
|
|
|
else if( value == frameBorderName( BorderVeryHuge, translated ) ) return BorderVeryHuge;
|
|
|
|
else if( value == frameBorderName( BorderOversized, translated ) ) return BorderOversized;
|
2009-09-15 07:12:54 +00:00
|
|
|
else return OxygenConfiguration().frameBorder();
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
QString OxygenConfiguration::blendColorName( BlendColorType value, bool translated )
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 06:17:48 +00:00
|
|
|
QString out;
|
2009-08-22 08:24:06 +00:00
|
|
|
switch( value )
|
|
|
|
{
|
2009-09-09 06:17:48 +00:00
|
|
|
case NoBlending: out = translated ? i18n( "Solid Color" ):"Solid Color"; break;
|
|
|
|
case RadialBlending: out = translated ? i18n( "Radial Gradient" ):"Radial Gradient"; break;
|
2009-09-15 07:12:54 +00:00
|
|
|
default: return OxygenConfiguration().blendColorName( translated );
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-09 06:17:48 +00:00
|
|
|
return out;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenConfiguration::BlendColorType OxygenConfiguration::blendColor( QString value, bool translated )
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-08-24 16:12:50 +00:00
|
|
|
if( value == blendColorName( NoBlending, translated ) ) return NoBlending;
|
|
|
|
else if( value == blendColorName( RadialBlending, translated ) ) return RadialBlending;
|
2009-09-15 07:12:54 +00:00
|
|
|
else return OxygenConfiguration().blendColor();
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-02 02:15:53 +00:00
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
QString OxygenConfiguration::sizeGripModeName( SizeGripMode value, bool translated )
|
2009-09-02 02:15:53 +00:00
|
|
|
{
|
2009-09-09 06:17:48 +00:00
|
|
|
QString out;
|
2009-09-02 02:15:53 +00:00
|
|
|
switch( value )
|
|
|
|
{
|
2009-09-09 06:17:48 +00:00
|
|
|
case SizeGripNever: out = translated ? i18n( "Always Hide Extra Size Grip" ):"Always Hide Extra Size Grip"; break;
|
|
|
|
case SizeGripWhenNeeded: out = translated ? i18n( "Show Extra Size Grip When Needed" ):"Show Extra Size Grip When Needed"; break;
|
2009-09-15 07:12:54 +00:00
|
|
|
default: return OxygenConfiguration().sizeGripModeName( translated );
|
2009-09-02 02:15:53 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-09 06:17:48 +00:00
|
|
|
return out;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-02 02:15:53 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-02 02:15:53 +00:00
|
|
|
//__________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenConfiguration::SizeGripMode OxygenConfiguration::sizeGripMode( QString value, bool translated )
|
2009-09-02 02:15:53 +00:00
|
|
|
{
|
2009-09-04 20:46:37 +00:00
|
|
|
if( value == sizeGripModeName( SizeGripNever, translated ) ) return SizeGripNever;
|
2009-09-02 02:15:53 +00:00
|
|
|
else if( value == sizeGripModeName( SizeGripWhenNeeded, translated ) ) return SizeGripWhenNeeded;
|
2009-09-15 07:12:54 +00:00
|
|
|
else return OxygenConfiguration().sizeGripMode();
|
2009-09-02 02:15:53 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//________________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
bool OxygenConfiguration::operator == (const OxygenConfiguration& other ) const
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
return
|
|
|
|
titleAlignment() == other.titleAlignment() &&
|
|
|
|
buttonSize() == other.buttonSize() &&
|
|
|
|
frameBorder() == other.frameBorder() &&
|
|
|
|
blendColor() == other.blendColor() &&
|
2009-09-02 02:15:53 +00:00
|
|
|
sizeGripMode() == other.sizeGripMode() &&
|
2009-08-22 08:24:06 +00:00
|
|
|
drawSeparator() == other.drawSeparator() &&
|
2009-09-04 19:02:20 +00:00
|
|
|
drawTitleOutline() == other.drawTitleOutline() &&
|
2009-11-07 03:33:53 +00:00
|
|
|
hideTitleBar() == other.hideTitleBar() &&
|
2010-03-25 00:51:27 +00:00
|
|
|
useDropShadows() == other.useDropShadows() &&
|
2009-10-02 02:52:41 +00:00
|
|
|
useOxygenShadows() == other.useOxygenShadows() &&
|
|
|
|
useAnimations() == other.useAnimations() &&
|
2010-01-06 01:42:38 +00:00
|
|
|
animateTitleChange() == other.animateTitleChange() &&
|
2009-11-10 23:11:08 +00:00
|
|
|
animationsDuration() == other.animationsDuration() &&
|
2009-11-15 03:24:04 +00:00
|
|
|
tabsEnabled() == other.tabsEnabled() &&
|
2009-11-10 23:11:08 +00:00
|
|
|
useNarrowButtonSpacing() == other.useNarrowButtonSpacing();
|
2009-10-02 02:52:41 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
|
|
|
|
2010-04-14 22:35:46 +00:00
|
|
|
//__________________________________________________
|
|
|
|
QString OxygenConfiguration::shadowCacheModeName( ShadowCacheMode value, bool translated )
|
|
|
|
{
|
|
|
|
QString out;
|
|
|
|
switch( value )
|
|
|
|
{
|
|
|
|
case CacheDisabled: out = translated ? i18n( "Disabled" ):"Disabled"; break;
|
|
|
|
case CacheVariable: out = translated ? i18n( "Variable" ):"Variable"; break;
|
|
|
|
case CacheMaximum: out = translated ? i18n( "Maximum" ):"Maximum"; break;
|
|
|
|
default: return OxygenConfiguration().shadowCacheModeName( translated );
|
|
|
|
}
|
|
|
|
|
|
|
|
return out;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//__________________________________________________
|
|
|
|
OxygenConfiguration::ShadowCacheMode OxygenConfiguration::shadowCacheMode( QString value, bool translated )
|
|
|
|
{
|
|
|
|
if( value == shadowCacheModeName( CacheDisabled, translated ) ) return CacheDisabled;
|
|
|
|
else if( value == shadowCacheModeName( CacheVariable, translated ) ) return CacheVariable;
|
|
|
|
else if( value == shadowCacheModeName( CacheMaximum, translated ) ) return CacheMaximum;
|
|
|
|
else return OxygenConfiguration().shadowCacheMode();
|
|
|
|
}
|
|
|
|
|
2009-08-24 06:27:49 +00:00
|
|
|
}
|