[Kstars-devel] KDE/kdeedu/kstars/kstars/tools
Jason Harris
kstars at 30doradus.org
Mon Dec 11 03:09:29 CET 2006
SVN commit 612365 by harris:
Fix crash when opening Planet Viewer.
Stop the Planet Viewer clock when closing the window, so it doesn't
continue to update planet positions when the window is closed
TODO: this tool reveals that the label positioning code in KPlotWidget
is insufficient.
NOTE: you must update libkdeedu/kdeeduplot as well.
CCMAIL: kstars-devel at kde.org
M +9 -3 planetviewer.cpp
M +1 -1 planetviewer.h
--- trunk/KDE/kdeedu/kstars/kstars/tools/planetviewer.cpp #612364:612365
@@ -111,6 +111,7 @@
connect( pw->RunButton, SIGNAL( clicked() ), SLOT( slotRunClock() ) );
connect( pw->DateBox, SIGNAL( valueChanged( const ExtDate & ) ), SLOT( slotChangeDate( const ExtDate & ) ) );
connect( pw->TodayButton, SIGNAL( clicked() ), SLOT( slotToday() ) );
+ connect( this, SIGNAL( closeClicked() ), SLOT( slotCloseWindow() ) );
}
PlanetViewer::~PlanetViewer()
@@ -148,6 +149,14 @@
updatePlanets();
}
+void PlanetViewer::slotCloseWindow() {
+ //Stop the clock if it's running
+ if ( isClockRunning ) {
+ tmr.stop();
+ isClockRunning = false;
+ }
+}
+
void PlanetViewer::updatePlanets() {
KSNumbers num( ut.djd() );
bool changed(false);
@@ -163,8 +172,6 @@
p->helEcLat()->SinCos( s2, c2 );
planet[i]->point(0)->setX( p->rsun()*c*c2 );
planet[i]->point(0)->setY( p->rsun()*s*c2 );
- planetLabel[i]->point(0)->setX( p->rsun()*c*c2 );
- planetLabel[i]->point(0)->setY( p->rsun()*s*c2 );
if ( centerPlanet() == pName[i] ) {
double xc = (pw->map->x2() + pw->map->x())*0.5;
@@ -226,7 +233,6 @@
planet[i]->addPoint( p->rsun()*c, p->rsun()*s, i18n(pName[i].toLocal8Bit()) );
pw->map->addObject( planet[i] );
- pw->map->addObject( planetLabel[i] );
}
update();
--- trunk/KDE/kdeedu/kstars/kstars/tools/planetviewer.h #612364:612365
@@ -69,6 +69,7 @@
void slotChangeDate( const ExtDate &d );
void slotRunClock();
void slotToday();
+ void slotCloseWindow();
private:
void updatePlanets();
@@ -86,7 +87,6 @@
KPlotObject *ksun;
KPlotObject *planet[9];
- KPlotObject *planetLabel[9];
};
#endif
More information about the Kstars-devel
mailing list