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
|
|
|
//_________________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenConfigurationUI::OxygenConfigurationUI( QWidget* parent ):
|
2009-08-22 08:24:06 +00:00
|
|
|
QWidget( parent ),
|
|
|
|
titleAlignment(0),
|
|
|
|
buttonSize(0),
|
|
|
|
frameBorder(0),
|
|
|
|
blendColor(0),
|
2009-09-02 02:19:26 +00:00
|
|
|
sizeGripMode(0),
|
2009-09-08 00:48:39 +00:00
|
|
|
drawSeparator(0),
|
|
|
|
titleOutline(0)
|
2009-08-22 08:24:06 +00:00
|
|
|
{ setupUI(); }
|
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 OxygenConfigurationUI::setupUI( void )
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
QVBoxLayout* mainLayout = new QVBoxLayout( this );
|
|
|
|
mainLayout->setMargin(0);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
// tab widget for basic and advanced mode
|
2009-09-16 06:09:31 +00:00
|
|
|
KTabWidget* tab( new KTabWidget( this ) );
|
2009-08-30 17:39:31 +00:00
|
|
|
mainLayout->addWidget( tab );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
// basic configuration
|
|
|
|
{
|
|
|
|
QWidget *basicWidget = new QWidget();
|
2009-09-04 19:09:23 +00:00
|
|
|
int index = tab->addTab( basicWidget, i18n("&General") );
|
2009-08-30 17:39:31 +00:00
|
|
|
tab->setTabToolTip( index, i18n( "Basic window decoration configuration options" ) );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
QVBoxLayout* vboxLayout = new QVBoxLayout();
|
|
|
|
basicWidget->setLayout( vboxLayout );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
QGridLayout* gridLayout = new QGridLayout();
|
|
|
|
gridLayout->setMargin(0);
|
|
|
|
vboxLayout->addLayout( gridLayout );
|
2009-08-25 04:55:39 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
gridLayout->setColumnStretch(2, 1);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
// frame border
|
|
|
|
QLabel* label;
|
|
|
|
gridLayout->addWidget( label = new QLabel( i18n("Border size:"), basicWidget ), 0, 0, 1, 1);
|
2009-09-16 06:09:31 +00:00
|
|
|
gridLayout->addWidget( frameBorder = new KComboBox(basicWidget), 0, 1, 1, 1);
|
2009-08-30 17:39:31 +00:00
|
|
|
frameBorder->setObjectName(QString::fromUtf8("frameBorder"));
|
|
|
|
frameBorder->insertItems(0, QStringList()
|
2009-09-15 07:12:54 +00:00
|
|
|
<< OxygenConfiguration::frameBorderName( OxygenConfiguration::BorderNone, true )
|
|
|
|
<< OxygenConfiguration::frameBorderName( OxygenConfiguration::BorderNoSide, true )
|
|
|
|
<< OxygenConfiguration::frameBorderName( OxygenConfiguration::BorderTiny, true )
|
|
|
|
<< OxygenConfiguration::frameBorderName( OxygenConfiguration::BorderDefault, true )
|
|
|
|
<< OxygenConfiguration::frameBorderName( OxygenConfiguration::BorderLarge, true )
|
|
|
|
<< OxygenConfiguration::frameBorderName( OxygenConfiguration::BorderVeryLarge, true )
|
|
|
|
<< OxygenConfiguration::frameBorderName( OxygenConfiguration::BorderHuge, true )
|
|
|
|
<< OxygenConfiguration::frameBorderName( OxygenConfiguration::BorderVeryHuge, true )
|
|
|
|
<< OxygenConfiguration::frameBorderName( OxygenConfiguration::BorderOversized, true )
|
2009-08-30 17:39:31 +00:00
|
|
|
);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
|
|
|
label->setBuddy( frameBorder );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
// title alignment
|
|
|
|
gridLayout->addWidget( label = new QLabel( i18n("Title alignment:"), basicWidget ), 1, 0, 1, 1 );
|
2009-09-16 06:09:31 +00:00
|
|
|
gridLayout->addWidget( titleAlignment = new KComboBox(basicWidget), 1, 1, 1, 1 );
|
2009-09-09 00:55:55 +00:00
|
|
|
titleAlignment->setObjectName(QString::fromUtf8("titleAlignment"));
|
2009-08-30 17:39:31 +00:00
|
|
|
titleAlignment->insertItems(0, QStringList()
|
2009-09-15 07:12:54 +00:00
|
|
|
<< OxygenConfiguration::titleAlignmentName( Qt::AlignLeft, true )
|
|
|
|
<< OxygenConfiguration::titleAlignmentName( Qt::AlignHCenter, true )
|
|
|
|
<< OxygenConfiguration::titleAlignmentName( Qt::AlignRight, true )
|
2009-08-30 17:39:31 +00:00
|
|
|
);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
|
|
|
label->setBuddy( titleAlignment );
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
// button size
|
|
|
|
gridLayout->addWidget( label = new QLabel( i18n("Button size:"), basicWidget ), 2, 0, 1, 1 );
|
2009-09-16 06:09:31 +00:00
|
|
|
gridLayout->addWidget( buttonSize = new KComboBox(basicWidget), 2, 1, 1, 1 );
|
2009-09-09 00:55:55 +00:00
|
|
|
buttonSize->setObjectName(QString::fromUtf8("buttonSize"));
|
2009-08-30 17:39:31 +00:00
|
|
|
buttonSize->insertItems(0, QStringList()
|
2009-09-15 07:12:54 +00:00
|
|
|
<< OxygenConfiguration::buttonSizeName( OxygenConfiguration::ButtonSmall, true )
|
|
|
|
<< OxygenConfiguration::buttonSizeName( OxygenConfiguration::ButtonDefault, true )
|
|
|
|
<< OxygenConfiguration::buttonSizeName( OxygenConfiguration::ButtonLarge, true )
|
|
|
|
<< OxygenConfiguration::buttonSizeName( OxygenConfiguration::ButtonHuge, true )
|
2009-08-30 17:39:31 +00:00
|
|
|
);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
|
|
|
label->setBuddy( buttonSize );
|
2009-09-07 18:23:18 +00:00
|
|
|
vboxLayout->addStretch(1);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
// advanced configuration
|
|
|
|
{
|
|
|
|
QWidget *advancedWidget = new QWidget();
|
2009-09-10 16:05:14 +00:00
|
|
|
int index = tab->addTab( advancedWidget, i18n( "&Fine Tuning" ) );
|
|
|
|
tab->setTabToolTip( index, i18n( "Additional window decoration configuration options" ) );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
QVBoxLayout* vboxLayout = new QVBoxLayout();
|
|
|
|
advancedWidget->setLayout( vboxLayout );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
QGridLayout* gridLayout = new QGridLayout();
|
|
|
|
gridLayout->setMargin(0);
|
|
|
|
vboxLayout->addLayout( gridLayout );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
gridLayout->setColumnStretch(2, 1);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
// title bar blending
|
2009-09-04 01:50:20 +00:00
|
|
|
QLabel* label;
|
2009-08-30 17:39:31 +00:00
|
|
|
gridLayout->addWidget( label = new QLabel( i18n("Background style:" ), advancedWidget ), 1, 0, 1, 1 );
|
2009-09-16 06:09:31 +00:00
|
|
|
gridLayout->addWidget( blendColor = new KComboBox(advancedWidget), 1, 1, 1, 1 );
|
2009-08-30 17:39:31 +00:00
|
|
|
blendColor->setObjectName(QString::fromUtf8("blendColor"));
|
|
|
|
blendColor->insertItems(0, QStringList()
|
2009-09-15 07:12:54 +00:00
|
|
|
<< OxygenConfiguration::blendColorName( OxygenConfiguration::NoBlending, true )
|
|
|
|
<< OxygenConfiguration::blendColorName( OxygenConfiguration::RadialBlending, true )
|
2009-08-30 17:39:31 +00:00
|
|
|
);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
|
|
|
label->setBuddy( blendColor );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-02 02:19:26 +00:00
|
|
|
// draw size grip
|
|
|
|
gridLayout->addWidget( label = new QLabel( i18n("Extra Size grip display:"), advancedWidget ), 2, 0, 1, 1 );
|
2009-09-16 06:09:31 +00:00
|
|
|
gridLayout->addWidget( sizeGripMode = new KComboBox(advancedWidget), 2, 1, 1, 1 );
|
2009-09-02 02:19:26 +00:00
|
|
|
sizeGripMode->setObjectName(QString::fromUtf8("sizeGripMode"));
|
|
|
|
sizeGripMode->setWhatsThis(i18n(
|
2009-09-02 02:26:30 +00:00
|
|
|
"The extra size grip is a small triangle shown in the bottom-right corner of a window \n"
|
|
|
|
"which allows to resize the window. This option controls in which case this size grip \n"
|
|
|
|
"is shown."));
|
2009-09-02 02:19:26 +00:00
|
|
|
sizeGripMode->insertItems(0, QStringList()
|
2009-09-15 07:12:54 +00:00
|
|
|
<< OxygenConfiguration::sizeGripModeName( OxygenConfiguration::SizeGripNever, true )
|
|
|
|
<< OxygenConfiguration::sizeGripModeName( OxygenConfiguration::SizeGripWhenNeeded, true )
|
2009-09-02 02:19:26 +00:00
|
|
|
);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-02 02:19:26 +00:00
|
|
|
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
|
|
|
label->setBuddy( sizeGripMode );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-07 18:23:18 +00:00
|
|
|
// active window title outline
|
|
|
|
vboxLayout->addWidget( titleOutline = new QCheckBox( i18n("Outline active window title"), advancedWidget) );
|
|
|
|
titleOutline->setObjectName(QString::fromUtf8("titleOutline"));
|
|
|
|
titleOutline->setWhatsThis(i18n(
|
|
|
|
"When enabled, an additional frame is shown around the active window as well as its title"));
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-07 18:23:18 +00:00
|
|
|
// draw separator
|
|
|
|
vboxLayout->addWidget( drawSeparator = new QCheckBox( i18n("Draw separator between title bar and active window contents"), advancedWidget ) );
|
|
|
|
drawSeparator->setObjectName(QString::fromUtf8("drawSeparator"));
|
|
|
|
drawSeparator->setWhatsThis(i18n(
|
|
|
|
"When enabled, this option makes an horizontal separator appear between the window title bar and the window contents."));
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-14 19:21:39 +00:00
|
|
|
vboxLayout->addStretch(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// shadow configurations
|
|
|
|
{
|
2009-09-15 07:12:54 +00:00
|
|
|
shadowConfigurations = QVector<OxygenShadowConfigurationUI*>( 2, 0 );
|
2009-09-14 19:21:39 +00:00
|
|
|
QWidget* widget = new QWidget();
|
|
|
|
int index = tab->addTab( widget, i18n( "&Shadows" ) );
|
|
|
|
tab->setTabToolTip( index, i18n( "Configure shadow colors for active and inactive windows" ) );
|
|
|
|
|
|
|
|
QGridLayout* gridLayout( new QGridLayout() );
|
|
|
|
widget->setLayout( gridLayout );
|
|
|
|
|
2009-08-30 17:39:31 +00:00
|
|
|
// oxygen shadow
|
2009-09-14 19:21:39 +00:00
|
|
|
gridLayout->addWidget( useOxygenShadows = new QCheckBox( i18n("Glow active window" ), this ), 0, 0, 1, 1 );
|
2009-08-30 17:39:31 +00:00
|
|
|
useOxygenShadows->setObjectName(QString::fromUtf8("useOxygenShadows"));
|
|
|
|
useOxygenShadows->setWhatsThis(i18n(
|
|
|
|
"When this option is enabled, oxygen signature blue glow is used for the active window shadow."));
|
2009-09-04 19:09:23 +00:00
|
|
|
|
2009-09-14 19:21:39 +00:00
|
|
|
// regular shadow configuration
|
2009-09-15 07:12:54 +00:00
|
|
|
gridLayout->addWidget( shadowConfigurations[1] = new OxygenShadowConfigurationUI( i18n( "Window Dropdown Shadow" ), widget ), 1, 0, 1, 1 );
|
2009-09-14 19:21:39 +00:00
|
|
|
shadowConfigurations[1]->setObjectName( "inactiveShadowConfiguration" );
|
|
|
|
|
|
|
|
// active window glow
|
2009-09-15 07:12:54 +00:00
|
|
|
gridLayout->addWidget( shadowConfigurations[0] = new OxygenShadowConfigurationUI( i18n( "Active Window Glow" ), widget ), 1, 1, 1, 1 );
|
2009-09-14 19:21:39 +00:00
|
|
|
shadowConfigurations[0]->setObjectName( "activeShadowConfiguration" );
|
|
|
|
shadowConfigurations[0]->setEnabled( false );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-05 03:14:36 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
// exceptions
|
2009-08-30 17:39:31 +00:00
|
|
|
{
|
2009-09-15 07:12:54 +00:00
|
|
|
exceptions = new OxygenExceptionListWidget();
|
2009-08-30 17:39:31 +00:00
|
|
|
exceptions->setObjectName(QString::fromUtf8("exceptions"));
|
2009-09-10 16:05:14 +00:00
|
|
|
int index = tab->addTab( exceptions, i18n( "&Window-Specific Overrides" ) );
|
|
|
|
tab->setTabToolTip( index, i18n( "Configure window decoraction option overrides for specific windows" ) );
|
2009-08-30 17:39:31 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-14 19:21:39 +00:00
|
|
|
// connections
|
2009-09-09 00:55:55 +00:00
|
|
|
QMetaObject::connectSlotsByName(this);
|
|
|
|
|
2009-09-14 19:21:39 +00:00
|
|
|
connect( titleOutline, SIGNAL(toggled( bool )), drawSeparator, SLOT( setDisabled( bool ) ) );
|
|
|
|
connect( useOxygenShadows, SIGNAL(toggled( bool )), shadowConfigurations[0], SLOT( setEnabled( bool ) ) );
|
|
|
|
|
|
|
|
connect( shadowConfigurations[0], SIGNAL( changed() ), SIGNAL( changed() ) );
|
|
|
|
connect( shadowConfigurations[1], SIGNAL( changed() ), SIGNAL( changed() ) );
|
|
|
|
connect( titleAlignment, SIGNAL(currentIndexChanged(int)), SIGNAL( changed() ) );
|
|
|
|
connect( buttonSize, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
|
|
|
connect( frameBorder, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
|
|
|
connect( blendColor, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
|
|
|
connect( sizeGripMode, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
|
|
|
|
|
|
|
connect( drawSeparator, SIGNAL(clicked()), SIGNAL(changed()) );
|
|
|
|
connect( titleOutline, SIGNAL(clicked()), SIGNAL(changed()) );
|
|
|
|
connect( useOxygenShadows, SIGNAL(clicked()), SIGNAL(changed()) );
|
|
|
|
connect( exceptions, SIGNAL(changed()), SIGNAL(changed()) );
|
|
|
|
|
2009-08-24 06:27:49 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-24 06:27:49 +00:00
|
|
|
}
|