2009-08-24 16:15:14 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-09-15 07:12:54 +00:00
|
|
|
// oxygenconfigurationui.cpp
|
2009-08-24 16:15:14 +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:15:14 +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:15:14 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2009-09-16 06:09:31 +00:00
|
|
|
#include "oxygenconfigurationui.h"
|
|
|
|
#include "../oxygenconfiguration.h"
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
#include <kdeversion.h>
|
|
|
|
|
2009-09-20 07:42:03 +00:00
|
|
|
#include <QtGui/QLabel>
|
|
|
|
#include <QtGui/QLayout>
|
|
|
|
#include <QtGui/QGroupBox>
|
2009-08-22 08:24:06 +00:00
|
|
|
#include <KLocale>
|
2009-09-16 06:09:31 +00:00
|
|
|
#include <KTabWidget>
|
2009-08-22 08:24:06 +00:00
|
|
|
|
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
|
|
|
//_________________________________________________________
|
2010-05-02 18:34:08 +00:00
|
|
|
ConfigurationUi::ConfigurationUi( QWidget* parent ):
|
2010-05-01 22:25:45 +00:00
|
|
|
QWidget( parent ),
|
|
|
|
expertMode_( false )
|
2009-10-31 04:25:38 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-31 04:25:38 +00:00
|
|
|
ui.setupUi( this );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
// basic configuration
|
2009-10-31 04:25:38 +00:00
|
|
|
ui.frameBorder->insertItems(0, QStringList()
|
2010-05-02 18:34:08 +00:00
|
|
|
<< Configuration::frameBorderName( Configuration::BorderNone, true )
|
|
|
|
<< Configuration::frameBorderName( Configuration::BorderNoSide, true )
|
|
|
|
<< Configuration::frameBorderName( Configuration::BorderTiny, true )
|
|
|
|
<< Configuration::frameBorderName( Configuration::BorderDefault, true )
|
|
|
|
<< Configuration::frameBorderName( Configuration::BorderLarge, true )
|
|
|
|
<< Configuration::frameBorderName( Configuration::BorderVeryLarge, true )
|
|
|
|
<< Configuration::frameBorderName( Configuration::BorderHuge, true )
|
|
|
|
<< Configuration::frameBorderName( Configuration::BorderVeryHuge, true )
|
|
|
|
<< Configuration::frameBorderName( Configuration::BorderOversized, true )
|
2009-10-31 04:25:38 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
ui.titleAlignment->insertItems(0, QStringList()
|
2010-05-02 18:34:08 +00:00
|
|
|
<< Configuration::titleAlignmentName( Qt::AlignLeft, true )
|
|
|
|
<< Configuration::titleAlignmentName( Qt::AlignHCenter, true )
|
|
|
|
<< Configuration::titleAlignmentName( Qt::AlignRight, true )
|
2009-10-31 04:25:38 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
ui.buttonSize->insertItems(0, QStringList()
|
2010-05-02 18:34:08 +00:00
|
|
|
<< Configuration::buttonSizeName( Configuration::ButtonSmall, true )
|
|
|
|
<< Configuration::buttonSizeName( Configuration::ButtonDefault, true )
|
|
|
|
<< Configuration::buttonSizeName( Configuration::ButtonLarge, true )
|
2010-05-15 06:22:46 +00:00
|
|
|
<< Configuration::buttonSizeName( Configuration::ButtonVeryLarge, true )
|
2010-05-02 18:34:08 +00:00
|
|
|
<< Configuration::buttonSizeName( Configuration::ButtonHuge, true )
|
2009-10-31 04:25:38 +00:00
|
|
|
);
|
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
// advanced configuration
|
2009-10-31 04:25:38 +00:00
|
|
|
ui.blendColor->insertItems(0, QStringList()
|
2010-05-02 18:34:08 +00:00
|
|
|
<< Configuration::blendColorName( Configuration::NoBlending, true )
|
|
|
|
<< Configuration::blendColorName( Configuration::RadialBlending, true )
|
2009-10-31 04:25:38 +00:00
|
|
|
);
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2009-10-31 04:25:38 +00:00
|
|
|
// draw size grip
|
|
|
|
ui.sizeGripMode->insertItems(0, QStringList()
|
2010-05-02 18:34:08 +00:00
|
|
|
<< Configuration::sizeGripModeName( Configuration::SizeGripNever, true )
|
|
|
|
<< Configuration::sizeGripModeName( Configuration::SizeGripWhenNeeded, true )
|
2009-10-31 04:25:38 +00:00
|
|
|
);
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2009-10-31 04:25:38 +00:00
|
|
|
// shadows
|
2010-04-25 20:28:02 +00:00
|
|
|
ui.shadowMode->insertItems(0, QStringList()
|
2010-05-02 18:34:08 +00:00
|
|
|
<< Configuration::shadowModeName( Configuration::OxygenShadows, true )
|
|
|
|
<< Configuration::shadowModeName( Configuration::KWinShadows, true )
|
|
|
|
<< Configuration::shadowModeName( Configuration::NoShadows, true ) );
|
2010-04-25 20:28:02 +00:00
|
|
|
|
2010-05-01 22:25:45 +00:00
|
|
|
ui.shadowCacheMode->insertItems(0, QStringList()
|
2010-05-02 18:34:08 +00:00
|
|
|
<< Configuration::shadowCacheModeName( Configuration::CacheDisabled, true )
|
|
|
|
<< Configuration::shadowCacheModeName( Configuration::CacheVariable, true )
|
|
|
|
<< Configuration::shadowCacheModeName( Configuration::CacheMaximum, true ) );
|
2010-05-01 22:25:45 +00:00
|
|
|
|
2009-10-31 04:25:38 +00:00
|
|
|
shadowConfigurations.push_back( ui.activeShadowConfiguration );
|
|
|
|
shadowConfigurations.push_back( ui.inactiveShadowConfiguration );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-14 19:21:39 +00:00
|
|
|
// connections
|
2010-05-10 02:06:45 +00:00
|
|
|
connect( ui.shadowMode, SIGNAL( currentIndexChanged(int)), SLOT(shadowModeChanged(int)) );
|
|
|
|
connect( ui.shadowMode, SIGNAL( currentIndexChanged(int)), SIGNAL(changed()) );
|
|
|
|
connect( ui.shadowCacheMode, SIGNAL( currentIndexChanged(int)), SIGNAL(changed()) );
|
2009-10-31 04:25:38 +00:00
|
|
|
connect( ui.titleOutline, SIGNAL(toggled( bool )), ui.drawSeparator, SLOT( setDisabled( bool ) ) );
|
2009-09-14 19:21:39 +00:00
|
|
|
|
|
|
|
connect( shadowConfigurations[0], SIGNAL( changed() ), SIGNAL( changed() ) );
|
2009-12-07 23:53:02 +00:00
|
|
|
connect( shadowConfigurations[0], SIGNAL( toggled( bool ) ), SIGNAL( changed() ) );
|
2010-03-25 00:51:27 +00:00
|
|
|
|
2009-09-14 19:21:39 +00:00
|
|
|
connect( shadowConfigurations[1], SIGNAL( changed() ), SIGNAL( changed() ) );
|
2010-03-25 00:51:27 +00:00
|
|
|
connect( shadowConfigurations[1], SIGNAL( toggled( bool ) ), SIGNAL( changed() ) );
|
|
|
|
|
2009-10-31 04:25:38 +00:00
|
|
|
connect( ui.titleAlignment, SIGNAL(currentIndexChanged(int)), SIGNAL( changed() ) );
|
|
|
|
connect( ui.buttonSize, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
|
|
|
connect( ui.frameBorder, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
|
|
|
connect( ui.blendColor, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
|
|
|
connect( ui.sizeGripMode, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
connect( ui.tabsEnabled, SIGNAL(clicked()), SIGNAL(changed()) );
|
2010-02-12 01:18:46 +00:00
|
|
|
connect( ui.useAnimations, SIGNAL(clicked()), SIGNAL(changed()) );
|
2010-05-01 22:25:45 +00:00
|
|
|
connect( ui.animateTitleChange, SIGNAL(clicked()), SIGNAL(changed()) );
|
|
|
|
connect( ui.narrowButtonSpacing, SIGNAL(clicked()), SIGNAL(changed()) );
|
2009-10-31 04:25:38 +00:00
|
|
|
connect( ui.drawSeparator, SIGNAL(clicked()), SIGNAL(changed()) );
|
|
|
|
connect( ui.titleOutline, SIGNAL(clicked()), SIGNAL(changed()) );
|
|
|
|
connect( ui.exceptions, SIGNAL(changed()), SIGNAL(changed()) );
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-01 22:25:45 +00:00
|
|
|
connect( ui.useAnimations, SIGNAL( toggled( bool ) ), ui.animateTitleChange, SLOT( setEnabled( bool ) ) );
|
|
|
|
|
|
|
|
toggleExpertMode( false );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//_________________________________________________________
|
2010-05-02 18:34:08 +00:00
|
|
|
void ConfigurationUi::toggleExpertMode( bool value )
|
2010-05-01 22:25:45 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
expertMode_ = value;
|
|
|
|
ui.animateTitleChange->setVisible( expertMode_ );
|
|
|
|
ui.narrowButtonSpacing->setVisible( expertMode_ );
|
2010-06-09 04:01:57 +00:00
|
|
|
|
|
|
|
// shadow mode
|
|
|
|
ui.shadowsExpertWidget->setVisible( expertMode_ );
|
2010-05-01 22:25:45 +00:00
|
|
|
|
|
|
|
if( expertMode_ ) ui.shadowSpacer->changeSize(0,0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
|
|
else ui.shadowSpacer->changeSize(0,0, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
|
|
|
|
2009-08-24 06:27:49 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-04-25 20:28:02 +00:00
|
|
|
//_________________________________________________________
|
2010-05-02 18:34:08 +00:00
|
|
|
void ConfigurationUi::shadowModeChanged( int index )
|
2010-04-25 20:28:02 +00:00
|
|
|
{
|
2010-05-02 18:34:08 +00:00
|
|
|
bool enabled( ui.shadowMode->itemText( index ) == Configuration::shadowModeName( Configuration::OxygenShadows, true ) );
|
|
|
|
foreach( ShadowConfigurationUi* shadowConfiguration, shadowConfigurations )
|
2010-04-25 20:28:02 +00:00
|
|
|
{ shadowConfiguration->setEnabled( enabled ); }
|
|
|
|
}
|
2009-08-24 06:27:49 +00:00
|
|
|
}
|