kchart

kchartPrinterDlg.cpp
1/*
2*
3* Copyright (C) 2005 Fredrik Edemar
4* f_edemar@linux.se
5*
6* This program is free software; you can redistribute it and/or modify
7* it under the terms of the GNU General Public License as published by
8* the Free Software Foundation; either version 2 of the License, or
9* (at your option) any later version.
10*
11* This program is distributed in the hope that it will be useful,
12* but WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14* GNU General Public License for more details.
15*
16* You should have received a copy of the GNU General Public License
17* along with this program; if not, write to the Free Software
18* Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*
21*/
22
23// TQt includes
24#include <tqlayout.h>
25
26// KDE includes
27#include <kdebug.h>
28#include <kdialog.h>
29#include <tdelocale.h>
30
31// local includes
32#include "kchartPrinterDlg.h"
33namespace KChart
34{
35
36 KChartPrinterDlg::KChartPrinterDlg( TQWidget *parent, const char *name )
37 : KPrintDialogPage( parent, name )
38{
39 setTitle( i18n( "KChart Options" ) );
40 TQVBoxLayout *layout = new TQVBoxLayout( this );
41 layout->setMargin( KDialog::marginHint() );
42 layout->setSpacing( KDialog::spacingHint() );
43 txtSizex = new KIntNumInput(this );
44 txtSizex->setSuffix("%");
45 txtSizex->setMinValue(1);
46 txtSizex->setMaxValue(100);
47 txtSizex->setValue(100);
48 txtSizey = new KIntNumInput(this );
49 txtSizey->setSuffix("%");
50 txtSizey->setMinValue(1);
51 txtSizey->setMaxValue(100);
52 txtSizey->setValue(100);
53
54 layout->addWidget( new TQLabel(i18n("Print Size"), this) );
55 layout->addWidget( new TQLabel(i18n("Width: "), this) );
56 layout->addWidget( txtSizex );
57 layout->addWidget( new TQLabel(i18n("Height: "), this) );
58 layout->addWidget( txtSizey );
59 layout->addStretch( 1 );
60}
61
62void KChartPrinterDlg::getOptions( TQMap<TQString, TQString>& opts, bool )
63{
64 opts["kde-kchart-printsizex"] = TQString::number(txtSizex->value());
65 opts["kde-kchart-printsizey"] = TQString::number(txtSizey->value());
66}
67
68void KChartPrinterDlg::setOptions( const TQMap<TQString, TQString>& opts )
69{
70 if ( opts["kde-kchart-printsizex"].isEmpty() )
71 txtSizex->setValue(100);
72 else
73 txtSizex->setValue((opts["kde-kchart-printsizex"]).toInt());
74 if ( opts["kde-kchart-printsizey"].isEmpty() )
75 txtSizey->setValue(100);
76 else
77 txtSizey->setValue((opts["kde-kchart-printsizey"]).toInt());
78}
79
80bool KChartPrinterDlg::isValid( const TQString& )
81{
82 return true;
83}
84} //namespace KChart
85#include "kchartPrinterDlg.moc"