[Kstars-devel] KDE/kdeedu/kstars/kstars
Jason Harris
kstars at 30doradus.org
Mon Feb 19 05:48:36 CET 2007
SVN commit 635023 by harris:
Fix the Manual Focus dialog. It's a bad idea to connect
slot B to signal A, if slot B itslef calls signal A.
Also changed the internal variable holding the desired
SkyPoint from a pointer to a normal instance.
CCMAIL: kstars-devel at kde.org
M +13 -13 focusdialog.cpp
M +2 -3 focusdialog.h
M +13 -16 kstarsactions.cpp
--- trunk/KDE/kdeedu/kstars/kstars/focusdialog.cpp #635022:635023
@@ -25,6 +25,7 @@
#include "kstarsdata.h"
#include "dms.h"
#include "skypoint.h"
+#include "skymap.h"
#include "focusdialog.h"
FocusDialogUI::FocusDialogUI( QWidget *parent ) : QFrame( parent ) {
@@ -34,13 +35,15 @@
FocusDialog::FocusDialog( KStars *_ks )
: KDialog( _ks ), ks( _ks )
{
- Point = 0; //initialize pointer to null
+ //initialize point to the current focus position
+ Point.set( ks->map()->focus()->ra(), ks->map()->focus()->dec() );
+
UsedAltAz = false; //assume RA/Dec by default
fd = new FocusDialogUI(this);
setMainWidget(fd);
- setCaption( i18n( "Set Focus Manually" ) );
- setButtons( KDialog::Ok|KDialog::Cancel );
+ setCaption( i18n( "Set Focus Manually" ) );
+ setButtons( KDialog::Ok|KDialog::Cancel );
fd->epochBox->setValidator( new KDoubleValidator( fd->epochBox ) );
fd->raBox->setDegType(false); //RA box should be HMS-style
@@ -52,7 +55,6 @@
connect( fd->azBox, SIGNAL(textChanged( const QString & ) ), this, SLOT( checkLineEdits() ) );
connect( fd->altBox, SIGNAL(textChanged( const QString & ) ), this, SLOT( checkLineEdits() ) );
connect( this, SIGNAL( okClicked() ), this, SLOT( validatePoint() ) );
- connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
}
FocusDialog::~FocusDialog(){
@@ -70,10 +72,6 @@
enableButtonOk( false );
}
-void FocusDialog::slotOk() {
- emit okClicked();
-}
-
void FocusDialog::validatePoint() {
bool raOk(false), decOk(false), azOk(false), altOk(false);
dms ra( fd->raBox->createDms( false, &raOk ) ); //false means expressed in hours
@@ -91,10 +89,11 @@
return;
}
- Point = new SkyPoint( ra, dec );
+ Point.set( ra, dec );
double epoch0 = getEpoch( fd->epochBox->text() );
long double jd0 = epochToJd ( epoch0 );
- Point->apparentCoord(jd0, ks->data()->ut().djd() );
+ Point.apparentCoord(jd0, ks->data()->ut().djd() );
+ Point.EquatorialToHorizontal( ks->LST(), ks->geo()->lat() );
QDialog::accept();
} else {
@@ -112,9 +111,10 @@
return;
}
- Point = new SkyPoint();
- Point->setAz( az );
- Point->setAlt( alt );
+ Point.setAz( az );
+ Point.setAlt( alt );
+ Point.HorizontalToEquatorial( ks->LST(), ks->geo()->lat() );
+
UsedAltAz = true;
QDialog::accept();
--- trunk/KDE/kdeedu/kstars/kstars/focusdialog.h #635022:635023
@@ -46,7 +46,7 @@
~FocusDialog();
/**@return pointer to the SkyPoint described by the entered RA, Dec */
- inline SkyPoint* point() const { return Point; }
+ inline SkyPoint& point() { return Point; }
/**@return suggested size of focus window. */
QSize sizeHint() const;
@@ -84,11 +84,10 @@
*If the point is validated, close the window.
*/
void validatePoint();
- void slotOk();
private:
KStars *ks;
- SkyPoint *Point;
+ SkyPoint Point;
FocusDialogUI *fd;
bool UsedAltAz;
};
--- trunk/KDE/kdeedu/kstars/kstars/kstarsactions.cpp #635022:635023
@@ -689,27 +689,24 @@
if ( Options::useAltAz() ) focusDialog.activateAzAltPage();
if ( focusDialog.exec() == QDialog::Accepted ) {
+ //DEBUG
+ kDebug() << "focusDialog point: " << &focusDialog << endl;
+
//If the requested position is very near the pole, we need to point first
//to an intermediate location just below the pole in order to get the longitudinal
//position (RA/Az) right.
- double realAlt( focusDialog.point()->alt()->Degrees() );
- double realDec( focusDialog.point()->dec()->Degrees() );
+ double realAlt( focusDialog.point().alt()->Degrees() );
+ double realDec( focusDialog.point().dec()->Degrees() );
if ( Options::useAltAz() && realAlt > 89.0 ) {
- focusDialog.point()->setAlt( 89.0 );
+ focusDialog.point().setAlt( 89.0 );
+ focusDialog.point().HorizontalToEquatorial( LST(), geo()->lat() );
}
if ( ! Options::useAltAz() && realDec > 89.0 ) {
- focusDialog.point()->setDec( 89.0 );
+ focusDialog.point().setDec( 89.0 );
+ focusDialog.point().EquatorialToHorizontal( LST(), geo()->lat() );
}
- //Do we need to convert Az/Alt to RA/Dec?
- if ( focusDialog.usedAltAz() )
- focusDialog.point()->HorizontalToEquatorial( LST(), geo()->lat() );
-
- //Do we need to convert RA/Dec to Alt/Az?
- if ( ! focusDialog.usedAltAz() )
- focusDialog.point()->EquatorialToHorizontal( LST(), geo()->lat() );
-
- map()->setClickedPoint( focusDialog.point() );
+ map()->setClickedPoint( & focusDialog.point() );
if ( Options::isTracking() ) slotTrack();
map()->slotCenter();
@@ -723,10 +720,10 @@
//automatically correct the final pointing from the intermediate offset position to the final position
if ( Options::useAltAz() ) {
data()->setSnapNextFocus();
- map()->setDestinationAltAz( focusDialog.point()->alt()->Degrees(), focusDialog.point()->az()->Degrees() );
+ map()->setDestinationAltAz( focusDialog.point().alt()->Degrees(), focusDialog.point().az()->Degrees() );
} else {
data()->setSnapNextFocus();
- map()->setDestination( focusDialog.point()->ra()->Hours(), focusDialog.point()->dec()->Degrees() );
+ map()->setDestination( focusDialog.point().ra()->Hours(), focusDialog.point().dec()->Degrees() );
}
//Now, if the requested point was near a pole, we need to reset the Alt/Dec of the focus.
@@ -846,7 +843,7 @@
Options::setProjection( SkyMap::Gnomonic );
//DEBUG
- kDebug() << "Projection system: " << Options::projection() << endl;
+ kDebug() << i18n( "Projection system: ", Options::projection() ) << endl;
skymap->forceUpdate();
}
More information about the Kstars-devel
mailing list