kchart
kchartParameterPieConfigPage.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "kchartParameterPieConfigPage.h"
00021
00022 #include "kchartParameterPieConfigPage.moc"
00023
00024 #include <kapplication.h>
00025 #include <klocale.h>
00026 #include <kdebug.h>
00027 #include <kdialog.h>
00028
00029 #include <qlayout.h>
00030 #include <qlabel.h>
00031 #include <qbuttongroup.h>
00032 #include <qcheckbox.h>
00033 #include <qlineedit.h>
00034 #include <qradiobutton.h>
00035 #include <qspinbox.h>
00036 #include <qvbuttongroup.h>
00037 #include <qwhatsthis.h>
00038
00039 #include "kchart_params.h"
00040
00041 namespace KChart
00042 {
00043
00044 KChartParameterPieConfigPage::KChartParameterPieConfigPage( KChartParams* params,
00045 QWidget* parent ) :
00046 QWidget( parent ),_params( params )
00047 {
00048 QVBoxLayout *toplevel = new QVBoxLayout( this, 10 );
00049 QVBoxLayout *grid1 = new QVBoxLayout(this);
00050 toplevel->addLayout( grid1 );
00051
00052 QVButtonGroup* gb = new QVButtonGroup( i18n( "Parameter" ), this );
00053 grid1->addWidget(gb);
00054
00055 pie3d = new QCheckBox(i18n("Pie 3D"), gb);
00056 QWhatsThis::add(pie3d, i18n("Uncheck this option if you do not want a 3D effect for your pie."));
00057 drawShadowColor=new QCheckBox(i18n("Draw shadow color"), gb);
00058 QWhatsThis::add(drawShadowColor, i18n("Uncheck this option if you do not want a shadow color on a 3D pie."));
00059
00060 QLabel *label = new QLabel( i18n( "Explode factor (%):" ), gb );
00061 explode = new QSpinBox(0, 100, 1, gb);
00062 QWhatsThis::add(explode, i18n("This will place gaps between the segments of your pie. Default is 0 which means the pie is a whole."));
00063
00064 label = new QLabel( i18n( "Start angle:" ), gb );
00065 angle = new QSpinBox(0, 90, 1, gb);
00066 QWhatsThis::add(angle, i18n("This will set the orientation of your pie. Default is 0."));
00067
00068 label = new QLabel( i18n( "3D-depth:" ), gb );
00069 depth = new QSpinBox(0, 40, 1, gb);
00070 QWhatsThis::add(depth, i18n("Set the depth from 0 to 40 of the 3D effect, if you have checked Pie 3D. Default is 20."));
00071
00072 grid1->activate();
00073
00074 connect(pie3d,SIGNAL(toggled ( bool )),this, SLOT(active3DPie(bool)));
00075 }
00076
00077 void KChartParameterPieConfigPage::active3DPie(bool b)
00078 {
00079 drawShadowColor->setEnabled(b);
00080 depth->setEnabled(b);
00081 }
00082
00083 void KChartParameterPieConfigPage::init()
00084 {
00085 bool state=_params->threeDPies();
00086 pie3d->setChecked(state);
00087 depth->setEnabled(state);
00088 active3DPie(state);
00089
00090 explode->setValue((int)(_params->explodeFactor() * 100));
00091 depth->setValue( _params->threeDPieHeight() );
00092 drawShadowColor->setChecked(_params->threeDShadowColors());
00093 angle->setValue( _params->pieStart() );
00094
00095 }
00096
00097
00098 void KChartParameterPieConfigPage::apply()
00099 {
00100 _params->setThreeDPies( pie3d->isChecked() );
00101 if( _params->threeDPies() ) {
00102 _params->setThreeDPieHeight( depth->value() );
00103 }
00104 _params->setThreeDShadowColors( drawShadowColor->isChecked());
00105 _params->setExplodeFactor(((double)(explode->value()))/100.0);
00106 _params->setPieStart( angle->value() );
00107 }
00108
00109 }
|