00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "kchartParameter3dConfigPage.h"
00021 #include "kchartParameter3dConfigPage.moc"
00022
00023 #include <kapplication.h>
00024 #include <kdialog.h>
00025 #include <klocale.h>
00026 #include <qlayout.h>
00027 #include <qlabel.h>
00028 #include <qcheckbox.h>
00029 #include <qbuttongroup.h>
00030 #include <qwhatsthis.h>
00031
00032 #include "kchart_params.h"
00033
00034 namespace KChart
00035 {
00036
00037 KChartParameter3dConfigPage::KChartParameter3dConfigPage( KChartParams* params,
00038 QWidget* parent ) :
00039 QWidget( parent ),m_params( params )
00040 {
00041 QGridLayout* layout = new QGridLayout(this, 2, 2,KDialog::marginHint(),KDialog::spacingHint());
00042
00043
00044 QButtonGroup* gb = new QButtonGroup( 0, Qt::Vertical,
00045 i18n("3D Parameters"), this );
00046 gb->layout()->setSpacing(KDialog::spacingHint());
00047 gb->layout()->setMargin(KDialog::marginHint());
00048
00049
00050 QGridLayout *grid1 = new QGridLayout(gb->layout(), 5, 3);
00051 layout->addWidget(gb,0,0);
00052
00053
00054 bar3d=new QCheckBox(i18n("3D bar"),gb);
00055 QWhatsThis::add(bar3d, i18n("If checked, this will enable 3D mode for viewing the bars. You can then add a shadow and set the angle and depth for 3D."));
00056 grid1->addWidget(bar3d,0,0);
00057
00058 connect(bar3d, SIGNAL(toggled ( bool )),
00059 this, SLOT(slotChange3DParameter(bool)));
00060
00061
00062 drawShadowColor=new QCheckBox(i18n("Draw dark shadow"),gb);
00063 QWhatsThis::add(drawShadowColor, i18n("If checked, this will add a dark shadow on the 3D bars."));
00064 grid1->addWidget(drawShadowColor,1,0);
00065
00066 QLabel *tmpLabel = new QLabel( i18n( "Angle:" ), gb );
00067 tmpLabel->resize( tmpLabel->sizeHint() );
00068 grid1->addWidget(tmpLabel,2,0);
00069
00070 angle3d=new KIntNumInput(0, gb, 10);
00071 QWhatsThis::add(angle3d, i18n("You can set here the angle for the 3D effect from 0 to 90. 90 will give you flat bars without any 3D effect.\nDefault is 45."));
00072 grid1->addWidget(angle3d,2,1);
00073 angle3d->setRange(0, 90, 1);
00074
00075 tmpLabel = new QLabel( i18n( "Depth:" ), gb );
00076 tmpLabel->resize( tmpLabel->sizeHint() );
00077 grid1->addWidget(tmpLabel,3,0);
00078
00079 depth=new KDoubleNumInput(0, gb);
00080 QWhatsThis::add(depth, i18n("You can set here the depth of the 3D effect from 0 to 2. 0 will give you no depth at all.\nDefault is 1."));
00081 depth->resize(100,depth->sizeHint().height());
00082 grid1->addWidget(depth,3,1);
00083 depth->setRange(0, 2.0, 0.1);
00084
00085 gb->setAlignment(Qt::AlignLeft);
00086 grid1->addColSpacing(0,depth->width());
00087 grid1->addColSpacing(0,angle3d->width());
00088 grid1->setColStretch(2,1);
00089 grid1->setRowStretch(4,1);
00090
00091
00092
00093
00094 }
00095
00096
00097 void KChartParameter3dConfigPage::slotChange3DParameter(bool b)
00098 {
00099 angle3d->setEnabled(b);
00100 depth->setEnabled(b);
00101 drawShadowColor->setEnabled(b);
00102 }
00103
00104
00105 void KChartParameter3dConfigPage::init()
00106 {
00107 bool state=m_params->threeDBars();
00108 bar3d->setChecked(state);
00109
00110 drawShadowColor->setChecked(m_params->threeDShadowColors());
00111 angle3d->setValue( m_params->threeDBarAngle() );
00112 depth->setValue( m_params->threeDBarDepth() );
00113 slotChange3DParameter(state);
00114 }
00115
00116
00117 void KChartParameter3dConfigPage::apply()
00118 {
00119 m_params->setThreeDBars(bar3d->isChecked());
00120 m_params->setThreeDBarAngle( angle3d->value() );
00121 m_params->setThreeDBarDepth( depth->value() );
00122 m_params->setThreeDShadowColors( drawShadowColor->isChecked());
00123 }
00124
00125
00126 }