22#include "kchartSubTypeChartPage.h"
23#include "kchartSubTypeChartPage.moc"
25#include <tdeapplication.h>
27#include <kiconloader.h>
29#include <tqvbuttongroup.h>
30#include <tqradiobutton.h>
33#include <tqhgroupbox.h>
35#include <tqwhatsthis.h>
38#include "kchart_params.h"
40#include "kchart_factory.h"
45KChartHiloSubTypeChartPage::KChartHiloSubTypeChartPage( KChartParams* params,
47 KChartSubTypeChartPage( params, parent )
49 TQHBoxLayout* toplevel =
new TQHBoxLayout(
this, 10 );
50 TQVButtonGroup* subtypeBG =
new TQVButtonGroup( i18n(
"Sub-type" ),
this );
51 TQWhatsThis::add(subtypeBG, i18n(
"Select the desired sub-type of a chart. The available sub-types depend on the chart type. Some chart types have no sub-type at all, in which case this configuration page is not shown."));
52 toplevel->addWidget( subtypeBG, AlignCenter| AlignVCenter );
53 normal =
new TQRadioButton( i18n(
"Normal" ), subtypeBG );
54 subtypeBG->insert( normal, KDChartParams::AreaNormal );
55 stacked =
new TQRadioButton(i18n(
"HiLoClose"), subtypeBG );
56 subtypeBG->insert( stacked, KDChartParams::AreaStacked );
57 percent =
new TQRadioButton( i18n(
"HiLoOpenClose"), subtypeBG );
58 subtypeBG->insert( percent, KDChartParams::AreaPercent );
59 subtypeBG->setFixedWidth( subtypeBG->sizeHint().width() );
60 connect( subtypeBG, TQ_SIGNAL( clicked(
int ) ),
61 this, TQ_SLOT( slotChangeSubType(
int ) ) );
63 TQHGroupBox* exampleGB =
new TQHGroupBox( i18n(
"Example" ),
this );
64 TQWhatsThis::add(exampleGB, i18n(
"Preview the sub-type you choose."));
65 toplevel->addWidget( exampleGB, 2 );
66 exampleLA =
new TQLabel( exampleGB );
67 exampleLA->setAlignment( AlignCenter | AlignVCenter );
71void KChartHiloSubTypeChartPage::init()
73 switch( m_params->hiLoChartSubType() ) {
74 case KDChartParams::HiLoNormal:
75 normal->setChecked(
true );
77 case KDChartParams::HiLoClose:
78 stacked->setChecked(
true );
80 case KDChartParams::HiLoOpenClose:
81 percent->setChecked(
true );
85 kdDebug( 35001 ) <<
"Error in stack_type" << endl;
91 slotChangeSubType( m_params->hiLoChartSubType() );
94void KChartHiloSubTypeChartPage::slotChangeSubType(
int type )
97 case KDChartParams::HiLoNormal:
98 exampleLA->setPixmap( UserIcon(
"chart_hilo_normal", KChartFactory::global() ) );
100 case KDChartParams::HiLoClose:
101 exampleLA->setPixmap( UserIcon(
"chart_hilo_close", KChartFactory::global() ) );
103 case KDChartParams::HiLoOpenClose:
104 exampleLA->setPixmap( UserIcon(
"chart_hilo_openclose", KChartFactory::global() ) );
111void KChartHiloSubTypeChartPage::apply()
113 if( normal->isChecked() )
114 m_params->setHiLoChartSubType( KDChartParams::HiLoNormal );
115 else if( stacked->isChecked() )
116 m_params->setHiLoChartSubType( KDChartParams::HiLoClose );
117 else if( percent->isChecked() )
118 m_params->setHiLoChartSubType( KDChartParams::HiLoOpenClose );
120 kdDebug( 35001 ) <<
"Error in groupbutton" << endl;
124KChartAreaSubTypeChartPage::KChartAreaSubTypeChartPage( KChartParams* params,
126 KChartSubTypeChartPage( params, parent )
128 TQHBoxLayout* toplevel =
new TQHBoxLayout(
this, 10 );
129 TQVButtonGroup* subtypeBG =
new TQVButtonGroup( i18n(
"Sub-type" ),
this );
130 TQWhatsThis::add(subtypeBG, i18n(
"Select the desired sub-type of a chart. The available sub-types depend on the chart type. Some chart types have no sub-type at all, in which case this configuration page is not shown."));
131 toplevel->addWidget( subtypeBG, AlignCenter| AlignVCenter );
132 normal =
new TQRadioButton( i18n(
"Normal" ), subtypeBG );
133 subtypeBG->insert( normal, KDChartParams::AreaNormal );
134 stacked =
new TQRadioButton( i18n(
"Stacked" ), subtypeBG );
135 subtypeBG->insert( stacked, KDChartParams::AreaStacked );
136 percent =
new TQRadioButton( i18n(
"Percent" ), subtypeBG );
137 subtypeBG->insert( percent, KDChartParams::AreaPercent );
138 subtypeBG->setFixedWidth( subtypeBG->sizeHint().width() );
139 connect( subtypeBG, TQ_SIGNAL( clicked(
int ) ),
140 this, TQ_SLOT( slotChangeSubType(
int ) ) );
142 TQHGroupBox* exampleGB =
new TQHGroupBox( i18n(
"Example" ),
this );
143 TQWhatsThis::add(exampleGB, i18n(
"Preview the sub-type you choose."));
144 toplevel->addWidget( exampleGB, 2 );
145 exampleLA =
new TQLabel( exampleGB );
146 exampleLA->setAlignment( AlignCenter | AlignVCenter );
151void KChartAreaSubTypeChartPage::init()
153 switch( m_params->areaChartSubType() ) {
154 case KDChartParams::AreaNormal:
155 normal->setChecked(
true );
157 case KDChartParams::AreaStacked:
158 stacked->setChecked(
true );
160 case KDChartParams::AreaPercent:
161 percent->setChecked(
true );
165 kdDebug( 35001 ) <<
"Error in stack_type" << endl;
171 slotChangeSubType( m_params->areaChartSubType() );
174void KChartAreaSubTypeChartPage::slotChangeSubType(
int type )
177 case KDChartParams::AreaNormal:
178 exampleLA->setPixmap( UserIcon(
"chart_area_normal", KChartFactory::global() ) );
180 case KDChartParams::AreaStacked:
181 exampleLA->setPixmap( UserIcon(
"chart_area_stacked", KChartFactory::global() ) );
183 case KDChartParams::AreaPercent:
184 exampleLA->setPixmap( UserIcon(
"chart_area_percent", KChartFactory::global() ) );
191void KChartAreaSubTypeChartPage::apply()
193 if( normal->isChecked() )
194 m_params->setAreaChartSubType( KDChartParams::AreaNormal );
195 else if( stacked->isChecked() )
196 m_params->setAreaChartSubType( KDChartParams::AreaStacked );
197 else if( percent->isChecked() )
198 m_params->setAreaChartSubType( KDChartParams::AreaPercent );
200 kdDebug( 35001 ) <<
"Error in groupbutton" << endl;
204KChartBarSubTypeChartPage::KChartBarSubTypeChartPage( KChartParams* params,
206 KChartSubTypeChartPage( params, parent )
208 TQHBoxLayout* toplevel =
new TQHBoxLayout(
this, 10 );
209 TQVBox *left =
new TQVBox(
this );
210 TQVButtonGroup* subtypeBG =
new TQVButtonGroup( i18n(
"Sub-type" ), left );
211 TQWhatsThis::add(subtypeBG, i18n(
"Select the desired sub-type of a chart. The available sub-types depend on the chart type. Some chart types have no sub-type at all, in which case this configuration page is not shown."));
213 toplevel->addWidget( left, AlignCenter );
215 normal =
new TQRadioButton( i18n(
"Normal" ), subtypeBG );
216 subtypeBG->insert( normal, KDChartParams::BarNormal );
217 stacked =
new TQRadioButton( i18n(
"Stacked" ), subtypeBG );
218 subtypeBG->insert( stacked, KDChartParams::BarStacked );
219 percent =
new TQRadioButton( i18n(
"Percent" ), subtypeBG );
220 subtypeBG->insert( percent, KDChartParams::BarPercent );
222 subtypeBG->setFixedWidth( subtypeBG->sizeHint().width() );
223 connect( subtypeBG, TQ_SIGNAL( clicked(
int ) ),
224 this, TQ_SLOT( slotChangeSubType(
int ) ) );
227 new TQLabel( i18n(
"Number of lines: "), left );
228 m_numLines =
new TQSpinBox( left );
230 new TQLabel(
"", left);
231 left->setStretchFactor( left, 1 );
233 TQHGroupBox* exampleGB =
new TQHGroupBox( i18n(
"Example" ),
this );
234 TQWhatsThis::add(exampleGB, i18n(
"Preview the sub-type you choose."));
235 toplevel->addWidget( exampleGB, 2 );
236 exampleLA =
new TQLabel( exampleGB );
237 exampleLA->setAlignment( AlignCenter | AlignVCenter );
240void KChartBarSubTypeChartPage::init()
243 switch( m_params->barChartSubType() ) {
244 case KDChartParams::BarNormal:
245 normal->setChecked(
true );
247 case KDChartParams::BarStacked:
248 stacked->setChecked(
true );
250 case KDChartParams::BarPercent:
251 percent->setChecked(
true );
255 kdDebug( 35001 ) <<
"Error in stack_type" << endl;
260 m_numLines->setValue( m_params->barNumLines() );
262 slotChangeSubType( m_params->barChartSubType() );
266void KChartBarSubTypeChartPage::slotChangeSubType(
int type )
269 case KDChartParams::BarStacked:
270 exampleLA->setPixmap( UserIcon(
"chart_bar_layer", KChartFactory::global() ) );
272 case KDChartParams::BarNormal:
273 exampleLA->setPixmap( UserIcon(
"chart_bar_beside", KChartFactory::global() ) );
275 case KDChartParams::BarPercent:
276 exampleLA->setPixmap( UserIcon(
"chart_bar_percent", KChartFactory::global() ) );
282void KChartBarSubTypeChartPage::apply()
284 if( normal->isChecked() ) {
285 m_params->setBarChartSubType( KDChartParams::BarNormal );
286 }
else if( stacked->isChecked() ) {
287 m_params->setBarChartSubType( KDChartParams::BarStacked );
288 }
else if( percent->isChecked() ) {
289 m_params->setBarChartSubType( KDChartParams::BarPercent );
291 kdDebug( 35001 ) <<
"Error in groupbutton" << endl;
295 m_params->setBarNumLines( m_numLines->value() );
298KChartLineSubTypeChartPage::KChartLineSubTypeChartPage( KChartParams* params,
300 KChartSubTypeChartPage( params, parent )
302 TQHBoxLayout* toplevel =
new TQHBoxLayout(
this, 10 );
303 TQVButtonGroup* subtypeBG =
new TQVButtonGroup( i18n(
"Sub-type" ),
this );
304 TQWhatsThis::add(subtypeBG, i18n(
"Select the desired sub-type of a chart. The available sub-types depend on the chart type. Some chart types have no sub-type at all, in which case this configuration page is not shown."));
305 toplevel->addWidget( subtypeBG, AlignCenter| AlignVCenter );
306 normal =
new TQRadioButton( i18n(
"Normal" ), subtypeBG );
307 subtypeBG->insert( normal, KDChartParams::AreaNormal );
308 stacked =
new TQRadioButton( i18n(
"Stacked" ), subtypeBG );
309 subtypeBG->insert( stacked, KDChartParams::AreaStacked );
310 percent =
new TQRadioButton( i18n(
"Percent" ), subtypeBG );
311 subtypeBG->insert( percent, KDChartParams::AreaPercent );
312 subtypeBG->setFixedWidth( subtypeBG->sizeHint().width() );
313 connect( subtypeBG, TQ_SIGNAL( clicked(
int ) ),
314 this, TQ_SLOT( slotChangeSubType(
int ) ) );
316 TQHGroupBox* exampleGB =
new TQHGroupBox( i18n(
"Example" ),
this );
317 TQWhatsThis::add(exampleGB, i18n(
"Preview the sub-type you choose."));
318 toplevel->addWidget( exampleGB, 2 );
319 exampleLA =
new TQLabel( exampleGB );
320 exampleLA->setAlignment( AlignCenter | AlignVCenter );
324void KChartLineSubTypeChartPage::init()
326 switch( m_params->lineChartSubType() ) {
327 case KDChartParams::LineNormal:
328 normal->setChecked(
true );
330 case KDChartParams::LineStacked:
331 stacked->setChecked(
true );
333 case KDChartParams::LinePercent:
334 percent->setChecked(
true );
338 kdDebug( 35001 ) <<
"Error in stack_type" << endl;
344 slotChangeSubType( m_params->lineChartSubType() );
347void KChartLineSubTypeChartPage::slotChangeSubType(
int type )
350 case KDChartParams::AreaNormal:
351 exampleLA->setPixmap( UserIcon(
"chart_line_normal", KChartFactory::global() ) );
353 case KDChartParams::AreaStacked:
354 exampleLA->setPixmap( UserIcon(
"chart_line_stacked", KChartFactory::global() ) );
356 case KDChartParams::AreaPercent:
357 exampleLA->setPixmap( UserIcon(
"chart_line_percent", KChartFactory::global() ) );
364void KChartLineSubTypeChartPage::apply()
366 if( normal->isChecked() )
367 m_params->setLineChartSubType( KDChartParams::LineNormal );
368 else if( stacked->isChecked() )
369 m_params->setLineChartSubType( KDChartParams::LineStacked );
370 else if( percent->isChecked() )
371 m_params->setLineChartSubType( KDChartParams::LinePercent );
373 kdDebug( 35001 ) <<
"Error in groupbutton" << endl;
377KChartPolarSubTypeChartPage::KChartPolarSubTypeChartPage( KChartParams* params,
379 KChartSubTypeChartPage( params, parent )
381 TQHBoxLayout* toplevel =
new TQHBoxLayout(
this, 10 );
382 TQVButtonGroup* subtypeBG =
new TQVButtonGroup( i18n(
"Sub-type" ),
this );
383 TQWhatsThis::add(subtypeBG, i18n(
"Select the desired sub-type of a chart. The available sub-types depend on the chart type. Some chart types have no sub-type at all, in which case this configuration page is not shown."));
384 toplevel->addWidget( subtypeBG, AlignCenter| AlignVCenter );
385 normal =
new TQRadioButton( i18n(
"Normal" ), subtypeBG );
386 subtypeBG->insert( normal, KDChartParams::AreaNormal );
387 stacked =
new TQRadioButton( i18n(
"Stacked" ), subtypeBG );
388 subtypeBG->insert( stacked, KDChartParams::AreaStacked );
389 percent =
new TQRadioButton( i18n(
"Percent" ), subtypeBG );
390 subtypeBG->insert( percent, KDChartParams::AreaPercent );
391 subtypeBG->setFixedWidth( subtypeBG->sizeHint().width() );
392 connect( subtypeBG, TQ_SIGNAL( clicked(
int ) ),
393 this, TQ_SLOT( slotChangeSubType(
int ) ) );
395 TQHGroupBox* exampleGB =
new TQHGroupBox( i18n(
"Example" ),
this );
396 TQWhatsThis::add(exampleGB, i18n(
"Preview the sub-type you choose."));
397 toplevel->addWidget( exampleGB, 2 );
398 exampleLA =
new TQLabel( exampleGB );
399 exampleLA->setAlignment( AlignCenter | AlignVCenter );
403void KChartPolarSubTypeChartPage::init()
405 switch( m_params->polarChartSubType() ) {
406 case KDChartParams::PolarNormal:
407 normal->setChecked(
true );
409 case KDChartParams::PolarStacked:
410 stacked->setChecked(
true );
412 case KDChartParams::PolarPercent:
413 percent->setChecked(
true );
417 kdDebug( 35001 ) <<
"Error in stack_type" << endl;
423 slotChangeSubType( m_params->lineChartSubType() );
426void KChartPolarSubTypeChartPage::slotChangeSubType(
int type )
429 case KDChartParams::PolarNormal:
430 exampleLA->setPixmap( UserIcon(
"chart_polar_normal", KChartFactory::global() ) );
432 case KDChartParams::PolarStacked:
433 exampleLA->setPixmap( UserIcon(
"chart_polar_stacked", KChartFactory::global() ) );
435 case KDChartParams::PolarPercent:
436 exampleLA->setPixmap( UserIcon(
"chart_polar_percent", KChartFactory::global() ) );
443void KChartPolarSubTypeChartPage::apply()
445 if( normal->isChecked() )
446 m_params->setPolarChartSubType( KDChartParams::PolarNormal );
447 else if( stacked->isChecked() )
448 m_params->setPolarChartSubType( KDChartParams::PolarStacked );
449 else if( percent->isChecked() )
450 m_params->setPolarChartSubType( KDChartParams::PolarPercent );
452 kdDebug( 35001 ) <<
"Error in groupbutton" << endl;