summaryrefslogtreecommitdiffstats
path: root/kchart/kchartWizardSetupDataPage.cc
blob: 897ee69c9512fe764dbdd1c1f669f11f29df7678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* $Id$ */

#include "kchartWizardSetupDataPage.h"
#include "kchart_view.h"
#include "kchartWizard.h"

#include <qradiobutton.h>
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qlabel.h>

namespace KChart
{

KChartWizardSetupDataPage::KChartWizardSetupDataPage( QWidget* parent,
                                                                                                          KChartPart* chart) :
  QWidget( parent ),
  _chart( chart ),
  _parent( (KChartWizard*)parent )
{
  QButtonGroup* tmpQGroupBox;
  tmpQGroupBox = new QButtonGroup( this, "GroupBox_1" );
  tmpQGroupBox->setGeometry( 260, 10, 130, 80 );
  tmpQGroupBox->setFrameStyle( 49 );
  tmpQGroupBox->setAlignment( 1 );

  datarow = new QRadioButton( this, "RadioButton_1" );
  datarow->setGeometry( 270, 40, 100, 20 );
  datarow->setText( i18n("Rows") );
  connect( datarow, SIGNAL( clicked() ),
                   this, SLOT( dataInRowsClicked() ) );
  tmpQGroupBox->insert( datarow );

  datacol = new QRadioButton( this, "RadioButton_2" );
  datacol->setGeometry( 270, 60, 100, 20 );
  datacol->setText( i18n("Columns") );
  datacol->setChecked( true );
  connect( datarow, SIGNAL( clicked() ),
                   this, SLOT( dataInColsClicked() ) );
  tmpQGroupBox->insert( datacol );

  QLabel* tmpQLabel;
  tmpQLabel = new QLabel( this, "Label_3" );
  tmpQLabel->setGeometry( 270, 20, 100, 20 );
  tmpQLabel->setText( i18n("Data is in:") );

  QButtonGroup* descrBG = new QButtonGroup( this );
  descrBG->hide();
  coldescript = new QCheckBox( this, "CheckBox_3" );
  coldescript->setGeometry( 260, 110, 20, 30 );
  coldescript->setChecked( true );
  connect( coldescript, SIGNAL( toggled( bool ) ),
                   this, SLOT( firstColumnIsDescriptionToggled( bool ) ) );
  coldescript->setText( "" );
  descrBG->insert( coldescript );

  tmpQLabel = new QLabel( this, "Label_4" );
  tmpQLabel->setGeometry( 280, 110, 100, 30 );
  tmpQLabel->setText( i18n("Use first row as description") );
  tmpQLabel->setAlignment( 1313 );

  rowdescript = new QCheckBox( this, "CheckBox_4" );
  rowdescript->setGeometry( 260, 150, 20, 30 );
  connect( rowdescript, SIGNAL( toggled( bool ) ),
                   this, SLOT( firstRowIsDescriptionToggled( bool ) ) );
  rowdescript->setText( "" );
  descrBG->insert( rowdescript );

  tmpQLabel = new QLabel( this, "Label_5" );
  tmpQLabel->setGeometry( 280, 150, 100, 30 );
  tmpQLabel->setText( i18n("Use first column as description") );
  tmpQLabel->setAlignment( 1313 );

  QFrame* tmpQFrame;
  tmpQFrame = new QFrame( this, "Frame_1" );
  tmpQFrame->setGeometry( 10, 10, 240, 220 );
  tmpQFrame->setFrameStyle( QFrame::Panel | QFrame::Sunken );
  tmpQFrame->setLineWidth( 2 );

  /*
  preview = new kchartWidget( _chart, tmpQFrame );
  preview->show();
  _chart->addAutoUpdate( preview );
  preview->resize( tmpQFrame->contentsRect().width(),
                                   tmpQFrame->contentsRect().height() );
  */
  //parent->resize( 400, 350 );
}


KChartWizardSetupDataPage::~KChartWizardSetupDataPage()
{
    /*
  _chart->removeAutoUpdate( preview );
    */
}


void KChartWizardSetupDataPage::dataInRowsClicked()
{
  _parent->emitNeedNewData( (const char*)_parent->dataArea().local8Bit(), KChartWizard::Row,
                                                                 coldescript->isChecked(),
                                                                 rowdescript->isChecked() );
}

void KChartWizardSetupDataPage::dataInColsClicked()
{
  _parent->emitNeedNewData( (const char*)_parent->dataArea().local8Bit(), KChartWizard::Col,
                                                        coldescript->isChecked(),
                                                        rowdescript->isChecked() );
}

void KChartWizardSetupDataPage::firstColumnIsDescriptionToggled( bool )
{
  _parent->emitNeedNewData( (const char*)_parent->dataArea().local8Bit(),
                                                        ( datarow->isChecked() ? KChartWizard::Row :
                                                          KChartWizard::Col ),
                                                        coldescript->isChecked(),
                                                        rowdescript->isChecked() );
}

void KChartWizardSetupDataPage::firstRowIsDescriptionToggled( bool )
{
  _parent->emitNeedNewData( (const char*)_parent->dataArea().local8Bit(),
			    ( datarow->isChecked() ? KChartWizard::Row 
			                           : KChartWizard::Col ),
			    coldescript->isChecked(),
			    rowdescript->isChecked() );
}

}  //namespace KChart

#include "kchartWizardSetupDataPage.moc"