You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
183 lines
8.1 KiB
183 lines
8.1 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
Copyright (C) 2001,2002,2003,2004 Laurent Montel <montel@kde.org>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
* Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
#include "kchartHeaderFooterConfigPage.h"
|
||
|
#include "kchartHeaderFooterConfigPage.moc"
|
||
|
|
||
12 years ago
|
#include <tdeapplication.h>
|
||
15 years ago
|
#include <kdialog.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
13 years ago
|
#include <tqlayout.h>
|
||
14 years ago
|
#include <tqlabel.h>
|
||
|
#include <tqlineedit.h>
|
||
|
#include <tqbuttongroup.h>
|
||
|
#include <tqwhatsthis.h>
|
||
12 years ago
|
#include <tdefontdialog.h>
|
||
15 years ago
|
|
||
|
#include "kchart_params.h"
|
||
|
|
||
|
namespace KChart
|
||
|
{
|
||
|
|
||
|
KChartHeaderFooterConfigPage::KChartHeaderFooterConfigPage( KChartParams* params,
|
||
14 years ago
|
TQWidget* parent ) :
|
||
|
TQWidget( parent ),_params( params )
|
||
15 years ago
|
{
|
||
13 years ago
|
TQGridLayout* layout = new TQGridLayout( this, 4, 3 );
|
||
|
layout->setSpacing( KDialog::spacingHint() );
|
||
|
layout->setMargin( KDialog::marginHint() );
|
||
15 years ago
|
|
||
14 years ago
|
TQLabel *lab=new TQLabel(i18n("Title:"), this);
|
||
|
TQWhatsThis::add(lab, i18n("Write here the title of your chart if you want one. The title will be centered on top above your chart."));
|
||
13 years ago
|
layout->addWidget(lab,0,0);
|
||
15 years ago
|
|
||
14 years ago
|
titleEdit=new TQLineEdit(this);
|
||
|
TQWhatsThis::add(titleEdit, i18n("Write here the title of your chart if you want one. The title will be centered on top above your chart."));
|
||
13 years ago
|
layout->addWidget(titleEdit,0,1);
|
||
15 years ago
|
|
||
|
titleColorButton=new KColorButton(this);
|
||
14 years ago
|
TQWhatsThis::add(titleColorButton, i18n("Click on this button to choose the color for the title font."));
|
||
13 years ago
|
layout->addWidget(titleColorButton,0,2);
|
||
15 years ago
|
|
||
14 years ago
|
titleFontButton=new TQPushButton(i18n("Font..."),this);
|
||
|
TQWhatsThis::add(titleFontButton, i18n("Click on this button to choose the font family, style and size for the title."));
|
||
13 years ago
|
layout->addWidget(titleFontButton,0,3);
|
||
14 years ago
|
connect( titleFontButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(changeTitleFont()));
|
||
15 years ago
|
|
||
14 years ago
|
lab=new TQLabel(i18n("Subtitle:"),this);
|
||
|
TQWhatsThis::add(lab, i18n("Write here the subtitle of your chart if you want one. The subtitle will be centered on top just below the title."));
|
||
13 years ago
|
layout->addWidget(lab,1,0);
|
||
15 years ago
|
|
||
14 years ago
|
subtitleEdit=new TQLineEdit(this);
|
||
|
TQWhatsThis::add(subtitleEdit, i18n("Write here the subtitle of your chart if you want one. The subtitle will be centered on top just below the title."));
|
||
13 years ago
|
layout->addWidget(subtitleEdit,1,1);
|
||
15 years ago
|
|
||
|
subtitleColorButton=new KColorButton(this);
|
||
14 years ago
|
TQWhatsThis::add(subtitleColorButton, i18n("Click on this button to choose the color for the subtitle font."));
|
||
13 years ago
|
layout->addWidget(subtitleColorButton,1,2);
|
||
15 years ago
|
|
||
14 years ago
|
subtitleFontButton=new TQPushButton(i18n("Font..."),this);
|
||
|
TQWhatsThis::add(subtitleFontButton, i18n("Click on this button to choose the font family, style and size for the subtitle."));
|
||
13 years ago
|
layout->addWidget(subtitleFontButton,1,3);
|
||
14 years ago
|
connect( subtitleFontButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(changeSubtitleFont()));
|
||
15 years ago
|
|
||
14 years ago
|
lab=new TQLabel(i18n("Footer:"),this);
|
||
|
TQWhatsThis::add(lab, i18n("Write here the footer of your chart if you want one. The footer will be centered at the bottom just below your chart."));
|
||
13 years ago
|
layout->addWidget(lab,2,0);
|
||
15 years ago
|
|
||
14 years ago
|
footerEdit=new TQLineEdit(this);
|
||
|
TQWhatsThis::add(footerEdit, i18n("Write here the subtitle of your chart if you want one. The subtitle will be centered on top just below the title."));
|
||
13 years ago
|
layout->addWidget(footerEdit,2,1);
|
||
15 years ago
|
|
||
|
footerColorButton=new KColorButton(this);
|
||
14 years ago
|
TQWhatsThis::add(footerColorButton, i18n("Click on this button to choose the color for the footer font."));
|
||
13 years ago
|
layout->addWidget(footerColorButton,2,2);
|
||
15 years ago
|
|
||
14 years ago
|
footerFontButton=new TQPushButton(i18n("Font..."),this);
|
||
|
TQWhatsThis::add(footerFontButton, i18n("Click on this button to choose the font family, style and size for the footer."));
|
||
|
connect( footerFontButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(changeFooterFont()));
|
||
13 years ago
|
layout->addWidget(footerFontButton,2,3);
|
||
15 years ago
|
|
||
13 years ago
|
layout->addItem( new TQSpacerItem( 5, 5, TQSizePolicy::Minimum, TQSizePolicy::Expanding ), 3, 0 );
|
||
15 years ago
|
|
||
13 years ago
|
layout->activate();
|
||
15 years ago
|
}
|
||
|
|
||
|
void KChartHeaderFooterConfigPage::init()
|
||
|
{
|
||
|
titleColorButton->setColor(_params->headerFooterColor( KDChartParams::HdFtPosHeader ) );
|
||
|
subtitleColorButton->setColor(_params->headerFooterColor( KDChartParams::HdFtPosHeader2 ));
|
||
|
footerColorButton->setColor(_params->headerFooterColor( KDChartParams::HdFtPosFooter ) );
|
||
|
titleEdit->setText(_params->header1Text());
|
||
|
subtitleEdit->setText(_params->header2Text());
|
||
|
footerEdit->setText(_params->footerText());
|
||
|
|
||
|
|
||
|
titleFont = _params->header1Font();
|
||
|
titleFontIsRelative = _params->headerFooterFontUseRelSize(KDChartParams::HdFtPosHeader)
|
||
14 years ago
|
? TQButton::On
|
||
|
: TQButton::Off;
|
||
|
if( TQButton::On == titleFontIsRelative )
|
||
15 years ago
|
titleFont.setPointSize( _params->headerFooterFontRelSize(KDChartParams::HdFtPosHeader) );
|
||
|
|
||
|
subtitleFont = _params->header2Font();
|
||
|
subtitleFontIsRelative = _params->headerFooterFontUseRelSize(KDChartParams::HdFtPosHeader2)
|
||
14 years ago
|
? TQButton::On
|
||
|
: TQButton::Off;
|
||
|
if( TQButton::On == subtitleFontIsRelative )
|
||
15 years ago
|
subtitleFont.setPointSize( _params->headerFooterFontRelSize(KDChartParams::HdFtPosHeader2) );
|
||
|
|
||
|
footerFont = _params->footerFont();
|
||
|
footerFontIsRelative = _params->headerFooterFontUseRelSize(KDChartParams::HdFtPosFooter)
|
||
14 years ago
|
? TQButton::On
|
||
|
: TQButton::Off;
|
||
|
if( TQButton::On == footerFontIsRelative )
|
||
15 years ago
|
footerFont.setPointSize( _params->headerFooterFontRelSize(KDChartParams::HdFtPosFooter) );
|
||
|
}
|
||
|
|
||
|
|
||
|
void KChartHeaderFooterConfigPage::apply()
|
||
|
{
|
||
|
_params->setHeaderFooterColor( KDChartParams::HdFtPosHeader,titleColorButton->color() );
|
||
|
_params->setHeaderFooterColor( KDChartParams::HdFtPosHeader2,subtitleColorButton->color() );
|
||
|
_params->setHeaderFooterColor( KDChartParams::HdFtPosFooter, footerColorButton->color() );
|
||
|
|
||
|
|
||
|
_params->setHeader1Text(titleEdit->text());
|
||
|
_params->setHeader2Text(subtitleEdit->text());
|
||
|
_params->setFooterText(footerEdit->text());
|
||
|
|
||
|
|
||
|
_params->setHeaderFooterFont( KDChartParams::HdFtPosHeader, titleFont,
|
||
|
titleFontIsRelative,
|
||
|
titleFont.pointSize() );
|
||
|
_params->setHeaderFooterFont( KDChartParams::HdFtPosHeader2, subtitleFont,
|
||
|
subtitleFontIsRelative,
|
||
|
subtitleFont.pointSize() );
|
||
|
_params->setHeaderFooterFont( KDChartParams::HdFtPosFooter, footerFont,
|
||
|
footerFontIsRelative,
|
||
|
footerFont.pointSize() );
|
||
|
}
|
||
|
|
||
|
void KChartHeaderFooterConfigPage::changeTitleFont()
|
||
|
{
|
||
14 years ago
|
TQButton::ToggleState state = titleFontIsRelative;
|
||
12 years ago
|
if ( TDEFontDialog::getFont( titleFont,false,this, true,&state ) != TQDialog::Rejected
|
||
14 years ago
|
&& TQButton::NoChange != state )
|
||
15 years ago
|
titleFontIsRelative = state;
|
||
|
}
|
||
|
|
||
|
void KChartHeaderFooterConfigPage::changeSubtitleFont()
|
||
|
{
|
||
14 years ago
|
TQButton::ToggleState state = subtitleFontIsRelative;
|
||
12 years ago
|
if ( TDEFontDialog::getFont( subtitleFont,false,this, true,&state ) != TQDialog::Rejected
|
||
14 years ago
|
&& TQButton::NoChange != state )
|
||
15 years ago
|
subtitleFontIsRelative = state;
|
||
|
}
|
||
|
|
||
|
void KChartHeaderFooterConfigPage::changeFooterFont()
|
||
|
{
|
||
14 years ago
|
TQButton::ToggleState state = footerFontIsRelative;
|
||
12 years ago
|
if ( TDEFontDialog::getFont( footerFont,false,this, true,&state ) != TQDialog::Rejected
|
||
14 years ago
|
&& TQButton::NoChange != state )
|
||
15 years ago
|
footerFontIsRelative = state;
|
||
|
}
|
||
|
|
||
|
} //KChart namespace
|