You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
197 lines
6.0 KiB
197 lines
6.0 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
Copyright (C) 2000,2001,2002,2003,2004 Laurent Montel <montel@kde.org>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
* Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
#include "kchartPieConfigPage.h"
|
||
|
#include "kchartPieConfigPage.moc"
|
||
|
|
||
12 years ago
|
#include <tdeapplication.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
13 years ago
|
#include <tqlayout.h>
|
||
14 years ago
|
#include <tqlabel.h>
|
||
12 years ago
|
#include <tdefontdialog.h>
|
||
15 years ago
|
|
||
14 years ago
|
#include <tqcheckbox.h>
|
||
|
#include <tqlineedit.h>
|
||
|
#include <tqradiobutton.h>
|
||
|
#include <tqpushbutton.h>
|
||
|
#include <tqfont.h>
|
||
|
#include <tqspinbox.h>
|
||
15 years ago
|
|
||
|
#include "kchart_params.h"
|
||
|
|
||
|
|
||
|
namespace KChart
|
||
|
{
|
||
|
|
||
|
KChartPieConfigPage::KChartPieConfigPage( KChartParams* params,
|
||
13 years ago
|
TQWidget* parent,
|
||
15 years ago
|
KDChartTableData* data) :
|
||
13 years ago
|
TQWidget( parent ),_params( params )
|
||
15 years ago
|
{
|
||
|
// col=_params->colPie;
|
||
|
pos=-1;
|
||
14 years ago
|
TQGridLayout *grid = new TQGridLayout(this,10,4,KDialog::marginHint(),
|
||
15 years ago
|
KDialog::spacingHint());
|
||
|
// The listview
|
||
14 years ago
|
list = new TQListView( this );
|
||
13 years ago
|
list->resize( list->sizeHint() );
|
||
15 years ago
|
grid->addMultiCellWidget(list,0,9,0,0);
|
||
|
list->addColumn( i18n("Hide Piece") );
|
||
|
list->setRootIsDecorated( TRUE );
|
||
|
|
||
14 years ago
|
TQLabel* label = new TQLabel( i18n( "Column active:" ), this );
|
||
13 years ago
|
label->resize( label->sizeHint() );
|
||
15 years ago
|
grid->addWidget( label,0,1);
|
||
|
|
||
14 years ago
|
column = new TQSpinBox(1, data->cols(), 1, this);
|
||
13 years ago
|
column->resize(100, column->sizeHint().height() );
|
||
15 years ago
|
grid->addWidget( column,1,1);
|
||
|
|
||
|
column->setValue(col+1);
|
||
|
|
||
14 years ago
|
label = new TQLabel( i18n( "Move piece to:" ), this );
|
||
13 years ago
|
label->resize( label->sizeHint() );
|
||
15 years ago
|
grid->addWidget( label,2,1);
|
||
|
|
||
14 years ago
|
dist = new TQSpinBox(0, 400, 1, this);
|
||
13 years ago
|
dist->resize(100, dist->sizeHint().height() );
|
||
15 years ago
|
grid->addWidget( dist,3,1);
|
||
|
|
||
14 years ago
|
label = new TQLabel( i18n( "Explode factor (%):" ), this );
|
||
13 years ago
|
label->resize( label->sizeHint() );
|
||
15 years ago
|
grid->addWidget( label,4,1);
|
||
|
|
||
14 years ago
|
explose = new TQSpinBox(0, 100, 1, this);
|
||
13 years ago
|
explose->resize(100, explose->sizeHint().height() );
|
||
15 years ago
|
grid->addWidget( explose,5,1);
|
||
|
|
||
|
grid->addColSpacing(0,list->width());
|
||
|
grid->addColSpacing(2,list->width());
|
||
|
grid->addColSpacing(3,list->width());
|
||
|
|
||
|
|
||
|
initList();
|
||
|
dist->setEnabled(false);
|
||
|
|
||
14 years ago
|
connect(column,TQT_SIGNAL(valueChanged(int)),this,TQT_SLOT(changeValue(int)));
|
||
15 years ago
|
|
||
14 years ago
|
connect( list, TQT_SIGNAL( selectionChanged(TQListViewItem *) ), this, TQT_SLOT( slotselected(TQListViewItem *) ) );
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
|
void KChartPieConfigPage::initList()
|
||
|
{
|
||
|
//int index;
|
||
|
// PENDING(kalle) Put back in
|
||
14 years ago
|
// for( TQStringList::Iterator it = _params->legend.begin(); it != _params->legend.end(); ++it ) {
|
||
|
// (void)new TQCheckListItem( list, (*it),TQCheckListItem::CheckBox ) ;
|
||
15 years ago
|
|
||
|
// }
|
||
14 years ago
|
TQListViewItemIterator it( list );
|
||
15 years ago
|
//Select or not CheckBox
|
||
|
// PENDING(kalle) Put back in
|
||
|
// for( ; it.current(); ++it ) {
|
||
14 years ago
|
// index = _params->legend.findIndex(((TQCheckListItem*)it.current())->text());
|
||
|
// ((TQCheckListItem*)it.current())->setOn(_params->missing[_params->legend.count()*col+index]) ;
|
||
15 years ago
|
// }
|
||
|
// value.duplicate(_params->explode);
|
||
|
}
|
||
|
|
||
|
|
||
14 years ago
|
void KChartPieConfigPage::slotselected(TQListViewItem */*it*/)
|
||
15 years ago
|
{
|
||
|
//column : 0
|
||
|
//cout <<"Select :"<<(it)->text(0).ascii()<<endl;
|
||
|
// PENDING(kalle) Put back in
|
||
|
// int index = _params->legend.findIndex((it)->text(0));
|
||
|
if(pos==-1)
|
||
|
dist->setEnabled(true);
|
||
|
else
|
||
|
value[pos]=dist->value();
|
||
|
|
||
|
// PENDING(kalle) Put back in
|
||
|
// pos=_params->legend.count()*col+index;
|
||
|
dist->setValue(value[pos]);
|
||
|
}
|
||
|
|
||
|
|
||
|
void KChartPieConfigPage::changeValue(int val)
|
||
|
{
|
||
|
col=val-1;
|
||
14 years ago
|
TQListViewItemIterator it( list );
|
||
15 years ago
|
//Select or not CheckBox
|
||
|
;
|
||
|
//int index=0;
|
||
|
for( ; it.current(); ++it ) {
|
||
|
// PENDING(kalle) Put back in
|
||
14 years ago
|
// index = _params->legend.findIndex(((TQCheckListItem*)it.current())->text());
|
||
|
// ((TQCheckListItem*)it.current())->setOn(_params->missing[_params->legend.count()*col+index]) ;
|
||
15 years ago
|
}
|
||
|
|
||
|
if(pos!=-1) {
|
||
|
value[pos]=dist->value();
|
||
|
// PENDING(kalle) Put back in
|
||
|
// pos=_params->legend.count()*col+index;
|
||
|
dist->setValue(value[pos]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
void KChartPieConfigPage::init()
|
||
|
{
|
||
14 years ago
|
TQListViewItemIterator it( list );
|
||
15 years ago
|
//Select or not CheckBox
|
||
|
|
||
|
//int index = 0;
|
||
|
for( ; it.current(); ++it ) {
|
||
|
// PENDING(kalle) Put back in
|
||
14 years ago
|
// index = _params->legend.findIndex(((TQCheckListItem*)it.current())->text());
|
||
|
// ((TQCheckListItem*)it.current())->setOn(_params->missing[_params->legend.count()*col+index]) ;
|
||
15 years ago
|
}
|
||
|
|
||
|
// PENDING(kalle) Put back in
|
||
|
// value.duplicate(_params->explode);
|
||
|
// if(pos!=-1) {
|
||
|
// pos=_params->legend.count()*col;
|
||
|
// dist->setValue( value[pos]);
|
||
|
// }
|
||
|
explose->setValue((int)(_params->explodeFactor()*100));
|
||
|
}
|
||
|
|
||
|
|
||
|
void KChartPieConfigPage::apply()
|
||
|
{
|
||
14 years ago
|
TQListViewItemIterator it( list );
|
||
15 years ago
|
//Select or not CheckBox
|
||
|
//int index = 0;
|
||
|
for( ; it.current(); ++it ) {
|
||
|
// PENDING(kalle) Put back in
|
||
14 years ago
|
// index = _params->legend.findIndex(((TQCheckListItem*)it.current())->text());
|
||
|
// _params->missing[_params->legend.count()*col+index]=((TQCheckListItem*)it.current())->isOn() ;
|
||
15 years ago
|
}
|
||
|
// _params->colPie=col;
|
||
|
|
||
|
// PENDING(kalle) Put back in
|
||
|
// value[pos]=dist->value();
|
||
|
// _params->explode.duplicate(value);
|
||
|
_params->setExplodeFactor(((double)(explose->value()))/100);
|
||
|
}
|
||
|
|
||
|
} //KChart namespace
|