kchart

kchartWizardSetupDataPage.cc

00001 /* $Id$ */
00002 
00003 #include "kchartWizardSetupDataPage.h"
00004 #include "kchart_view.h"
00005 #include "kchartWizard.h"
00006 
00007 #include <qradiobutton.h>
00008 #include <qcheckbox.h>
00009 #include <qbuttongroup.h>
00010 #include <qlabel.h>
00011 
00012 namespace KChart
00013 {
00014 
00015 KChartWizardSetupDataPage::KChartWizardSetupDataPage( QWidget* parent,
00016                                                                                                           KChartPart* chart) :
00017   QWidget( parent ),
00018   _chart( chart ),
00019   _parent( (KChartWizard*)parent )
00020 {
00021   QButtonGroup* tmpQGroupBox;
00022   tmpQGroupBox = new QButtonGroup( this, "GroupBox_1" );
00023   tmpQGroupBox->setGeometry( 260, 10, 130, 80 );
00024   tmpQGroupBox->setFrameStyle( 49 );
00025   tmpQGroupBox->setAlignment( 1 );
00026 
00027   datarow = new QRadioButton( this, "RadioButton_1" );
00028   datarow->setGeometry( 270, 40, 100, 20 );
00029   datarow->setText( i18n("Rows") );
00030   connect( datarow, SIGNAL( clicked() ),
00031                    this, SLOT( dataInRowsClicked() ) );
00032   tmpQGroupBox->insert( datarow );
00033 
00034   datacol = new QRadioButton( this, "RadioButton_2" );
00035   datacol->setGeometry( 270, 60, 100, 20 );
00036   datacol->setText( i18n("Columns") );
00037   datacol->setChecked( true );
00038   connect( datarow, SIGNAL( clicked() ),
00039                    this, SLOT( dataInColsClicked() ) );
00040   tmpQGroupBox->insert( datacol );
00041 
00042   QLabel* tmpQLabel;
00043   tmpQLabel = new QLabel( this, "Label_3" );
00044   tmpQLabel->setGeometry( 270, 20, 100, 20 );
00045   tmpQLabel->setText( i18n("Data is in:") );
00046 
00047   QButtonGroup* descrBG = new QButtonGroup( this );
00048   descrBG->hide();
00049   coldescript = new QCheckBox( this, "CheckBox_3" );
00050   coldescript->setGeometry( 260, 110, 20, 30 );
00051   coldescript->setChecked( true );
00052   connect( coldescript, SIGNAL( toggled( bool ) ),
00053                    this, SLOT( firstColumnIsDescriptionToggled( bool ) ) );
00054   coldescript->setText( "" );
00055   descrBG->insert( coldescript );
00056 
00057   tmpQLabel = new QLabel( this, "Label_4" );
00058   tmpQLabel->setGeometry( 280, 110, 100, 30 );
00059   tmpQLabel->setText( i18n("Use first row as description") );
00060   tmpQLabel->setAlignment( 1313 );
00061 
00062   rowdescript = new QCheckBox( this, "CheckBox_4" );
00063   rowdescript->setGeometry( 260, 150, 20, 30 );
00064   connect( rowdescript, SIGNAL( toggled( bool ) ),
00065                    this, SLOT( firstRowIsDescriptionToggled( bool ) ) );
00066   rowdescript->setText( "" );
00067   descrBG->insert( rowdescript );
00068 
00069   tmpQLabel = new QLabel( this, "Label_5" );
00070   tmpQLabel->setGeometry( 280, 150, 100, 30 );
00071   tmpQLabel->setText( i18n("Use first column as description") );
00072   tmpQLabel->setAlignment( 1313 );
00073 
00074   QFrame* tmpQFrame;
00075   tmpQFrame = new QFrame( this, "Frame_1" );
00076   tmpQFrame->setGeometry( 10, 10, 240, 220 );
00077   tmpQFrame->setFrameStyle( QFrame::Panel | QFrame::Sunken );
00078   tmpQFrame->setLineWidth( 2 );
00079 
00080   /*
00081   preview = new kchartWidget( _chart, tmpQFrame );
00082   preview->show();
00083   _chart->addAutoUpdate( preview );
00084   preview->resize( tmpQFrame->contentsRect().width(),
00085                                    tmpQFrame->contentsRect().height() );
00086   */
00087   //parent->resize( 400, 350 );
00088 }
00089 
00090 
00091 KChartWizardSetupDataPage::~KChartWizardSetupDataPage()
00092 {
00093     /*
00094   _chart->removeAutoUpdate( preview );
00095     */
00096 }
00097 
00098 
00099 void KChartWizardSetupDataPage::dataInRowsClicked()
00100 {
00101   _parent->emitNeedNewData( (const char*)_parent->dataArea().local8Bit(), KChartWizard::Row,
00102                                                                  coldescript->isChecked(),
00103                                                                  rowdescript->isChecked() );
00104 }
00105 
00106 void KChartWizardSetupDataPage::dataInColsClicked()
00107 {
00108   _parent->emitNeedNewData( (const char*)_parent->dataArea().local8Bit(), KChartWizard::Col,
00109                                                         coldescript->isChecked(),
00110                                                         rowdescript->isChecked() );
00111 }
00112 
00113 void KChartWizardSetupDataPage::firstColumnIsDescriptionToggled( bool )
00114 {
00115   _parent->emitNeedNewData( (const char*)_parent->dataArea().local8Bit(),
00116                                                         ( datarow->isChecked() ? KChartWizard::Row :
00117                                                           KChartWizard::Col ),
00118                                                         coldescript->isChecked(),
00119                                                         rowdescript->isChecked() );
00120 }
00121 
00122 void KChartWizardSetupDataPage::firstRowIsDescriptionToggled( bool )
00123 {
00124   _parent->emitNeedNewData( (const char*)_parent->dataArea().local8Bit(),
00125                 ( datarow->isChecked() ? KChartWizard::Row 
00126                                        : KChartWizard::Col ),
00127                 coldescript->isChecked(),
00128                 rowdescript->isChecked() );
00129 }
00130 
00131 }  //namespace KChart
00132 
00133 #include "kchartWizardSetupDataPage.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys