2 This file is part of Kig, a KDE program for Interactive Geometry...
3 Copyright (C) 2004 Dominique Devriese <devriese@kde.org>
4 Copyright (C) 2004 Pino Toscano <toscano.pino@tiscali.it>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 #include "editanglesize.h"
23 #include "editanglesize.moc"
25 #include <kcombobox.h>
26 #include <klineedit.h>
27 #include <kpushbutton.h>
28 #include <kstdguiitem.h>
30 EditAngleSize::EditAngleSize( QWidget
* parent
, double angle
, Goniometry::System system
)
31 : EditAngleSizeBase( parent
, "editsizeangle", true ), mang( angle
, system
), mang_orig( angle
, system
)
33 // improving GUI look'n'feel...
34 buttonOk
->setGuiItem( KStdGuiItem::ok() );
35 buttonCancel
->setGuiItem( KStdGuiItem::cancel() );
37 comboSystem
->insertStringList( Goniometry::systemList() );
39 comboSystem
->setCurrentItem( system
);
40 editAngle
->setText( QString::number( angle
) );
44 EditAngleSize::~EditAngleSize()
48 void EditAngleSize::okSlot()
50 double dang
= mang
.getValue( Goniometry::Rad
);
51 double dang_orig
= mang_orig
.getValue( Goniometry::Rad
);
52 done( dang
!= dang_orig
);
55 void EditAngleSize::cancelSlot()
60 void EditAngleSize::activatedSlot( int index
)
64 Goniometry::System newsys
= Goniometry::intToSystem( index
);
65 if ( newsys
== mang_orig
.system() )
68 mang
.convertTo( newsys
);
69 editAngle
->setText( QString::number( mang
.value() ) );
73 void EditAngleSize::textChangedSlot( const QString
& txt
)
79 double d
= txt
.toDouble( &isnum
);
82 buttonOk
->setEnabled( isnum
);
85 const double EditAngleSize::angle() const
90 const Goniometry::System
EditAngleSize::system() const