2009-08-24 16:15:14 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nitrogenconfigurationui.cpp
|
|
|
|
// -------------------
|
|
|
|
//
|
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
|
|
|
|
// IN THE SOFTWARE.
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
#include <kdeversion.h>
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QLayout>
|
|
|
|
#include <QGroupBox>
|
|
|
|
#include <KLocale>
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "../nitrogenconfiguration.h"
|
|
|
|
#include "nitrogenconfigurationui.h"
|
|
|
|
#include "nitrogenconfigurationui.moc"
|
|
|
|
|
|
|
|
namespace Nitrogen
|
|
|
|
{
|
|
|
|
|
|
|
|
//_________________________________________________________
|
|
|
|
NitrogenConfigurationUI::NitrogenConfigurationUI( QWidget* parent ):
|
|
|
|
QWidget( parent ),
|
|
|
|
titleAlignment(0),
|
|
|
|
buttonSize(0),
|
|
|
|
buttonType(0),
|
|
|
|
frameBorder(0),
|
|
|
|
blendColor(0),
|
|
|
|
drawSeparator(0),
|
|
|
|
showStripes(0),
|
|
|
|
drawSizeGrip(0)
|
|
|
|
{ setupUI(); }
|
|
|
|
|
|
|
|
//_________________________________________________________
|
|
|
|
void NitrogenConfigurationUI::setupUI( void )
|
|
|
|
{
|
|
|
|
|
|
|
|
std::cout << "NitrogenConfigurationUI::setupUI.\n" << std::endl;
|
|
|
|
|
|
|
|
QVBoxLayout* mainLayout = new QVBoxLayout( this );
|
|
|
|
mainLayout->setSpacing(6);
|
|
|
|
mainLayout->setMargin(0);
|
|
|
|
|
|
|
|
QHBoxLayout* hboxLayout = new QHBoxLayout();
|
|
|
|
hboxLayout->setSpacing(6);
|
|
|
|
mainLayout->addLayout(hboxLayout);
|
|
|
|
|
|
|
|
// left box for comboboxes
|
|
|
|
QGroupBox* box;
|
2009-08-24 07:33:05 +00:00
|
|
|
hboxLayout->addWidget( box = new QGroupBox( i18n("Layout"), this ) );
|
2009-08-22 08:24:06 +00:00
|
|
|
QGridLayout* gridLayout = new QGridLayout();
|
|
|
|
gridLayout->setSpacing(6);
|
|
|
|
box->setLayout( gridLayout );
|
2009-08-25 04:55:39 +00:00
|
|
|
|
|
|
|
// frame border
|
|
|
|
QLabel* label;
|
|
|
|
gridLayout->addWidget( label = new QLabel( i18n("Border size:"), box ), 0, 0, 1, 1);
|
|
|
|
gridLayout->addWidget( frameBorder = new QComboBox(box), 0, 1, 1, 1);
|
|
|
|
frameBorder->setObjectName(QString::fromUtf8("frameBorder"));
|
|
|
|
frameBorder->insertItems(0, QStringList()
|
|
|
|
<< NitrogenConfiguration::frameBorderName( NitrogenConfiguration::BorderNone, true )
|
|
|
|
<< NitrogenConfiguration::frameBorderName( NitrogenConfiguration::BorderTiny, true )
|
|
|
|
<< NitrogenConfiguration::frameBorderName( NitrogenConfiguration::BorderDefault, true )
|
|
|
|
<< NitrogenConfiguration::frameBorderName( NitrogenConfiguration::BorderLarge, true )
|
|
|
|
<< NitrogenConfiguration::frameBorderName( NitrogenConfiguration::BorderVeryLarge, true )
|
|
|
|
<< NitrogenConfiguration::frameBorderName( NitrogenConfiguration::BorderHuge, true )
|
|
|
|
<< NitrogenConfiguration::frameBorderName( NitrogenConfiguration::BorderVeryHuge, true )
|
|
|
|
<< NitrogenConfiguration::frameBorderName( NitrogenConfiguration::BorderOversized, true )
|
|
|
|
);
|
|
|
|
|
|
|
|
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
|
|
|
label->setBuddy( frameBorder );
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
// title alignment
|
2009-08-25 04:55:39 +00:00
|
|
|
gridLayout->addWidget( label = new QLabel( i18n("Title alignment:"), box ), 1, 0, 1, 1 );
|
|
|
|
gridLayout->addWidget( titleAlignment = new QComboBox(box), 1, 1, 1, 1 );
|
2009-08-22 08:24:06 +00:00
|
|
|
titleAlignment->setObjectName(QString::fromUtf8("titleAlignment"));
|
|
|
|
titleAlignment->insertItems(0, QStringList()
|
2009-08-24 16:15:14 +00:00
|
|
|
<< NitrogenConfiguration::titleAlignmentName( Qt::AlignLeft, true )
|
|
|
|
<< NitrogenConfiguration::titleAlignmentName( Qt::AlignHCenter, true )
|
|
|
|
<< NitrogenConfiguration::titleAlignmentName( Qt::AlignRight, true )
|
2009-08-22 08:24:06 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
|
|
|
label->setBuddy( titleAlignment );
|
|
|
|
|
|
|
|
// button size
|
2009-08-25 04:55:39 +00:00
|
|
|
gridLayout->addWidget( label = new QLabel( i18n("Button size:"), box ), 2, 0, 1, 1 );
|
|
|
|
gridLayout->addWidget( buttonSize = new QComboBox(box), 2, 1, 1, 1 );
|
2009-08-22 08:24:06 +00:00
|
|
|
buttonSize->setObjectName(QString::fromUtf8("buttonSize"));
|
|
|
|
buttonSize->insertItems(0, QStringList()
|
2009-08-24 16:15:14 +00:00
|
|
|
<< NitrogenConfiguration::buttonSizeName( NitrogenConfiguration::ButtonSmall, true )
|
|
|
|
<< NitrogenConfiguration::buttonSizeName( NitrogenConfiguration::ButtonDefault, true )
|
|
|
|
<< NitrogenConfiguration::buttonSizeName( NitrogenConfiguration::ButtonLarge, true )
|
|
|
|
<< NitrogenConfiguration::buttonSizeName( NitrogenConfiguration::ButtonHuge, true )
|
2009-08-22 08:24:06 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
|
|
|
label->setBuddy( buttonSize );
|
|
|
|
|
|
|
|
// button type
|
2009-08-25 04:55:39 +00:00
|
|
|
gridLayout->addWidget( label = new QLabel( i18n("Button style:"), box ), 3, 0, 1, 1 );
|
|
|
|
gridLayout->addWidget( buttonType = new QComboBox(box), 3, 1, 1, 1 );
|
2009-08-22 08:24:06 +00:00
|
|
|
buttonType->setObjectName(QString::fromUtf8("buttonType"));
|
|
|
|
buttonType->insertItems(0, QStringList()
|
2009-08-24 16:15:14 +00:00
|
|
|
<< NitrogenConfiguration::buttonTypeName( NitrogenConfiguration::ButtonKde42, true )
|
|
|
|
<< NitrogenConfiguration::buttonTypeName( NitrogenConfiguration::ButtonKde43, true )
|
2009-08-22 08:24:06 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
|
|
|
label->setBuddy( buttonType );
|
|
|
|
|
|
|
|
// title bar blending
|
2009-08-29 06:04:04 +00:00
|
|
|
gridLayout->addWidget( label = new QLabel( i18n("Background style:" ), box ), 4, 0, 1, 1 );
|
2009-08-22 08:24:06 +00:00
|
|
|
gridLayout->addWidget( blendColor = new QComboBox(box), 4, 1, 1, 1 );
|
|
|
|
blendColor->setObjectName(QString::fromUtf8("blendColor"));
|
|
|
|
blendColor->insertItems(0, QStringList()
|
2009-08-24 16:15:14 +00:00
|
|
|
<< NitrogenConfiguration::blendColorName( NitrogenConfiguration::NoBlending, true )
|
|
|
|
<< NitrogenConfiguration::blendColorName( NitrogenConfiguration::RadialBlending, true )
|
2009-08-22 08:24:06 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
|
|
|
label->setBuddy( blendColor );
|
|
|
|
|
|
|
|
// right is for checkboxes
|
2009-08-24 07:33:05 +00:00
|
|
|
hboxLayout->addWidget( box = new QGroupBox( i18n("Flags"), this ) );
|
2009-08-22 08:24:06 +00:00
|
|
|
QVBoxLayout* vboxLayout = new QVBoxLayout();
|
|
|
|
box->setLayout( vboxLayout );
|
|
|
|
|
|
|
|
// oxygen shadow
|
2009-08-24 16:34:10 +00:00
|
|
|
vboxLayout->addWidget( useOxygenShadows = new QCheckBox( i18n("Glow active window" ), this ) );
|
2009-08-22 08:24:06 +00:00
|
|
|
useOxygenShadows->setObjectName(QString::fromUtf8("useOxygenShadows"));
|
2009-08-24 07:31:29 +00:00
|
|
|
useOxygenShadows->setWhatsThis(i18n(
|
2009-08-24 16:34:10 +00:00
|
|
|
"When this option is enabled, oxygen signature blue glow is used for the active window shadow."));
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
// draw separator
|
2009-08-24 16:34:10 +00:00
|
|
|
vboxLayout->addWidget( drawSeparator = new QCheckBox( i18n("Draw separator between title bar and window contents"), this ) );
|
2009-08-22 08:24:06 +00:00
|
|
|
drawSeparator->setObjectName(QString::fromUtf8("drawSeparator"));
|
2009-08-24 07:31:29 +00:00
|
|
|
drawSeparator->setWhatsThis(i18n(
|
2009-08-24 16:34:10 +00:00
|
|
|
"When enabled, this option makes an horizontal separator appear between the window title bar and the window contents."));
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
// show stripes
|
2009-08-24 16:34:10 +00:00
|
|
|
vboxLayout->addWidget( showStripes = new QCheckBox( i18n("Show stripes next to the title"), this) );
|
2009-08-22 08:24:06 +00:00
|
|
|
showStripes->setObjectName(QString::fromUtf8("showStripes"));
|
2009-08-24 07:31:29 +00:00
|
|
|
showStripes->setWhatsThis(i18n(
|
2009-08-24 16:34:10 +00:00
|
|
|
"When enabled, this option increases the visibility of the window titlebar by showing stripes"));
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
// overwrite colors
|
2009-08-24 16:34:10 +00:00
|
|
|
vboxLayout->addWidget( overwriteColors = new QCheckBox( i18n("Blend title bar colors with window contents"), this) );
|
2009-08-22 08:24:06 +00:00
|
|
|
overwriteColors->setObjectName(QString::fromUtf8("overwriteColors"));
|
2009-08-24 07:31:29 +00:00
|
|
|
overwriteColors->setWhatsThis(i18n(
|
2009-08-24 16:34:10 +00:00
|
|
|
"When enabled, window colors are used in place of default title bar colors to draw the decoration"));
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
// draw size grip
|
2009-08-24 16:34:10 +00:00
|
|
|
vboxLayout->addWidget( drawSizeGrip = new QCheckBox( i18n("Draw size grip widget in bottom-right corner of windows"), this ) );
|
2009-08-22 08:24:06 +00:00
|
|
|
drawSizeGrip->setObjectName(QString::fromUtf8("drawSizeGrip"));
|
2009-08-24 07:31:29 +00:00
|
|
|
drawSizeGrip->setWhatsThis(i18n(
|
2009-08-22 08:24:06 +00:00
|
|
|
"When this option is enabled, a small triangular widget is drawn in bottom-right corner of every window \n"
|
2009-08-24 16:34:10 +00:00
|
|
|
"that allow to resize the window. This the \"No Border\" border size is selected."));
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
// exceptions
|
|
|
|
mainLayout->addLayout( hboxLayout = new QHBoxLayout() );
|
|
|
|
hboxLayout->addStretch( 1 );
|
|
|
|
|
2009-08-24 07:31:29 +00:00
|
|
|
hboxLayout->addWidget( showExceptions = new QPushButton( i18n("Exceptions ..." ), box ) );
|
2009-08-24 16:34:10 +00:00
|
|
|
showExceptions->setToolTip(i18n("Raise a dialog to store blending type exceptions based on window title."));
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
// about
|
|
|
|
// this is disabled until I find a suitable icon for nitrogen.
|
2009-08-24 07:31:29 +00:00
|
|
|
// hboxLayout->addWidget( aboutNitrogen = new QPushButton( i18n("About Nitrogen" ), box ) );
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
QMetaObject::connectSlotsByName(this);
|
|
|
|
|
2009-08-24 06:27:49 +00:00
|
|
|
}
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2009-08-24 06:27:49 +00:00
|
|
|
}
|