[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kstars/kstars/tools
From: Alexey Khudyakov <alexey.skladnoy () gmail ! com>
Date: 2009-11-27 21:01:23
Message-ID: 1259355683.910566.26886.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1055336 by khudyakov:
* Remove blind casts to KStars* they are evil
* Minor refactring
M +5 -11 planetviewer.cpp
--- trunk/KDE/kdeedu/kstars/kstars/tools/planetviewer.cpp #1055335:1055336
@@ -34,7 +34,6 @@
#include <KPlotPoint>
#include "ui_planetviewer.h"
-#include "kstars.h"
#include "kstarsdata.h"
#include "ksutils.h"
#include "ksnumbers.h"
@@ -52,6 +51,7 @@
PlanetViewer::PlanetViewer(QWidget *parent)
: KDialog( parent ), scale(1.0), isClockRunning(false), tmr(this)
{
+ KStarsData *data = KStarsData::Instance();
pw = new PlanetViewerUI( this );
setMainWidget( pw );
setCaption( i18n("Solar System Viewer") );
@@ -68,14 +68,13 @@
pw->RunButton->setIcon( KIcon("arrow-right") );
pw->ZoomInButton->setIcon( KIcon("zoom-in") );
pw->ZoomOutButton->setIcon( KIcon("zoom-out") );
- pw->DateBox->setDate( ((KStars*)parent)->data()->lt().date() );
+ pw->DateBox->setDate( data->lt().date() );
resize( 500, 500 );
pw->map->QWidget::setFocus(); //give keyboard focus to the plot widget for key and mouse events
setCenterPlanet(QString());
- KStarsData *data = KStarsData::Instance();
PlanetList.append( KSPlanetBase::createPlanet( KSPlanetBase::MERCURY ) );
PlanetList.append( KSPlanetBase::createPlanet( KSPlanetBase::VENUS ) );
PlanetList.append( new KSPlanet( "Earth" ) );
@@ -200,8 +199,7 @@
}
void PlanetViewer::slotToday() {
- KStars *ks = (KStars*)parent();
- pw->DateBox->setDate( ks->data()->lt().date() );
+ pw->DateBox->setDate( KStarsData::Instance()->lt().date() );
}
void PlanetViewer::paintEvent( QPaintEvent* ) {
@@ -254,14 +252,10 @@
}
void PlanetViewer::keyPressEvent( QKeyEvent *e ) {
- switch ( e->key() ) {
- case Qt::Key_Escape:
+ if( e->key() == Qt::Key_Escape )
close();
- break;
- default:
+ else
e->ignore();
- break;
- }
}
void PlanetViewer::slotMapZoomIn() {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic