[Kstars-devel] KDE/kdeedu/kstars/kstars
Akarsh Simha
akarshsimha at gmail.com
Fri Dec 26 16:23:40 CET 2008
SVN commit 901758 by asimha:
Fixing a lot of issues caused by translated planet names.
These are temporary "ugly" fixes, before the KDE 4.2 release that we
might want to revert and re-design later.
The trouble is that in the case of Sun, Earth and Moon, the name()
method returns the English name whereas on other planets, it returns
the translated name (while that's not the way it should be, according
to the documentation in skyobject.h). A quick fix for this is to make
sure that we always use the translated name to find the planet.
There will still be (minor) issues with languages that have a
translation for Pluto.
CCMAIL: kstars-devel at kde.org
M +1 -1 detaildialog.cpp
M +12 -12 ksplanetbase.cpp
M +10 -10 skycomponents/skymapcomposite.cpp
M +8 -8 skymapdraw.cpp
M +2 -2 tools/ksconjunct.cpp
M +16 -16 tools/obslistwizard.cpp
M +3 -2 tools/planetviewer.cpp
--- trunk/KDE/kdeedu/kstars/kstars/detaildialog.cpp #901757:901758
@@ -177,7 +177,7 @@
Data->Type->setText( i18n("G5 star") );
else if ( ps->name() == "Moon" )
Data->Type->setText( ps->translatedName() );
- else if ( ps->name() == "Pluto" || ps->name() == "Ceres" || ps->name() == "Eris" )
+ else if ( ps->name() == i18n("Pluto") || ps->name() == "Ceres" || ps->name() == "Eris" ) // TODO: Check if Ceres / Eris have translations and i18n() them
Data->Type->setText( i18n("Dwarf planet") );
else
Data->Type->setText( ps->typeName() );
--- trunk/KDE/kdeedu/kstars/kstars/ksplanetbase.cpp #901757:901758
@@ -146,9 +146,9 @@
}
bool KSPlanetBase::isMajorPlanet() const {
- if ( name() == "Mercury" || name() == "Venus" || name() == "Mars" ||
- name() == "Jupiter" || name() == "Saturn" || name() == "Uranus" ||
- name() == "Neptune" )
+ if ( name() == i18n( "Mercury" ) || name() == i18n( "Venus" ) || name() == i18n( "Mars" ) ||
+ name() == i18n( "Jupiter" ) || name() == i18n( "Saturn" ) || name() == i18n( "Uranus" ) ||
+ name() == i18n( "Neptune" ) )
return true;
return false;
}
@@ -268,7 +268,7 @@
size = minsize;
//Inflate offset for Saturn
- if ( name() == "Saturn" )
+ if ( name() == i18n( "Saturn" ) )
size = int(2.5*size);
return 0.5*size + 4.;
@@ -310,18 +310,18 @@
double param = 5 * log10(rsun() * rearth() );
double f1 = phase/100.;
- if ( name() == "Mercury" ) {
+ if ( name() == i18n( "Mercury" ) ) {
if ( phase > 150. ) f1 = 1.5;
magnitude = -0.36 + param + 3.8*f1 - 2.73*f1*f1 + 2*f1*f1*f1;
}
- if ( name() =="Venus")
+ if ( name() == i18n( "Venus" ) )
magnitude = -4.29 + param + 0.09*f1 + 2.39*f1*f1 - 0.65*f1*f1*f1;
- if( name() == "Mars")
+ if( name() == i18n( "Mars" ) )
magnitude = -1.52 + param + 0.016*phase;
- if( name() == "Jupiter")
+ if( name() == i18n( "Jupiter" ) )
magnitude = -9.25 + param + 0.005*phase;
- if( name() == "Saturn") {
+ if( name() == i18n( "Saturn" ) ) {
double T = num->julianCenturies();
double a0 = (40.66-4.695*T)* dms::PI / 180.;
double d0 = (83.52+0.403*T)* dms::PI / 180.;
@@ -331,11 +331,11 @@
magnitude = -8.88 + param + 0.044*phase + rings;
}
- if( name() == "Uranus")
+ if( name() == i18n( "Uranus" ) )
magnitude = -7.19 + param + 0.0028*phase;
- if( name() == "Neptune")
+ if( name() == i18n( "Neptune" ) )
magnitude = -6.87 + param;
- if( name() == "Pluto" )
+ if( name() == i18n( "Pluto" ) )
magnitude = -1.01 + param + 0.041*phase;
if( type() == SkyObject::ASTEROID ) {
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.cpp #901757:901758
@@ -440,16 +440,16 @@
**/
KSPlanetBase* SkyMapComposite::planet( int n ) {
- if ( n == KSPlanetBase::SUN ) return (KSPlanetBase*)(m_SolarSystem->findByName( "Sun" ) );
- if ( n == KSPlanetBase::MERCURY ) return (KSPlanetBase*)(m_SolarSystem->findByName( "Mercury" ) );
- if ( n == KSPlanetBase::VENUS ) return (KSPlanetBase*)(m_SolarSystem->findByName( "Venus" ) );
- if ( n == KSPlanetBase::MOON ) return (KSPlanetBase*)(m_SolarSystem->findByName( "Moon" ) );
- if ( n == KSPlanetBase::MARS ) return (KSPlanetBase*)(m_SolarSystem->findByName( "Mars" ) );
- if ( n == KSPlanetBase::JUPITER ) return (KSPlanetBase*)(m_SolarSystem->findByName( "Jupiter" ) );
- if ( n == KSPlanetBase::SATURN ) return (KSPlanetBase*)(m_SolarSystem->findByName( "Saturn" ) );
- if ( n == KSPlanetBase::URANUS ) return (KSPlanetBase*)(m_SolarSystem->findByName( "Uranus" ) );
- if ( n == KSPlanetBase::NEPTUNE ) return (KSPlanetBase*)(m_SolarSystem->findByName( "Neptune" ) );
- if ( n == KSPlanetBase::PLUTO ) return (KSPlanetBase*)(m_SolarSystem->findByName( "Pluto" ) );
+ if ( n == KSPlanetBase::SUN ) return (KSPlanetBase*)(m_SolarSystem->findByName( "Sun" ) );
+ if ( n == KSPlanetBase::MERCURY ) return (KSPlanetBase*)(m_SolarSystem->findByName( i18n( "Mercury" ) ) );
+ if ( n == KSPlanetBase::VENUS ) return (KSPlanetBase*)(m_SolarSystem->findByName( i18n( "Venus" ) ) );
+ if ( n == KSPlanetBase::MOON ) return (KSPlanetBase*)(m_SolarSystem->findByName( "Moon" ) );
+ if ( n == KSPlanetBase::MARS ) return (KSPlanetBase*)(m_SolarSystem->findByName( i18n( "Mars" ) ) );
+ if ( n == KSPlanetBase::JUPITER ) return (KSPlanetBase*)(m_SolarSystem->findByName( i18n( "Jupiter" ) ) );
+ if ( n == KSPlanetBase::SATURN ) return (KSPlanetBase*)(m_SolarSystem->findByName( i18n( "Saturn" ) ) );
+ if ( n == KSPlanetBase::URANUS ) return (KSPlanetBase*)(m_SolarSystem->findByName( i18n( "Uranus" ) ) );
+ if ( n == KSPlanetBase::NEPTUNE ) return (KSPlanetBase*)(m_SolarSystem->findByName( i18n( "Neptune" ) ) );
+ if ( n == KSPlanetBase::PLUTO ) return (KSPlanetBase*)(m_SolarSystem->findByName( i18n( "Pluto" ) ) );
return 0;
}
--- trunk/KDE/kdeedu/kstars/kstars/skymapdraw.cpp #901757:901758
@@ -323,15 +323,15 @@
if ( obj->type() == SkyObject::PLANET ) {
if ( ! drawPlanets ) continue;
if ( obj->name() == "Sun" && ! Options::showSun() ) continue;
- if ( obj->name() == "Mercury" && ! Options::showMercury() ) continue;
- if ( obj->name() == "Venus" && ! Options::showVenus() ) continue;
+ if ( obj->name() == i18n( "Mercury" ) && ! Options::showMercury() ) continue;
+ if ( obj->name() == i18n( "Venus" ) && ! Options::showVenus() ) continue;
if ( obj->name() == "Moon" && ! Options::showMoon() ) continue;
- if ( obj->name() == "Mars" && ! Options::showMars() ) continue;
- if ( obj->name() == "Jupiter" && ! Options::showJupiter() ) continue;
- if ( obj->name() == "Saturn" && ! Options::showSaturn() ) continue;
- if ( obj->name() == "Uranus" && ! Options::showUranus() ) continue;
- if ( obj->name() == "Neptune" && ! Options::showNeptune() ) continue;
- if ( obj->name() == "Pluto" && ! Options::showPluto() ) continue;
+ if ( obj->name() == i18n( "Mars" ) && ! Options::showMars() ) continue;
+ if ( obj->name() == i18n( "Jupiter" ) && ! Options::showJupiter() ) continue;
+ if ( obj->name() == i18n( "Saturn" ) && ! Options::showSaturn() ) continue;
+ if ( obj->name() == i18n( "Uranus" ) && ! Options::showUranus() ) continue;
+ if ( obj->name() == i18n( "Neptune" ) && ! Options::showNeptune() ) continue;
+ if ( obj->name() == i18n( "Pluto" ) && ! Options::showPluto() ) continue;
}
if ( obj->type() >= SkyObject::OPEN_CLUSTER && obj->type() <= SkyObject::GALAXY ) {
if ( ((DeepSkyObject*)obj)->isCatalogM() && ! drawMessier ) continue;
--- trunk/KDE/kdeedu/kstars/kstars/tools/ksconjunct.cpp #901757:901758
@@ -49,10 +49,10 @@
prevSign = 0;
step0 = (stopJD - startJD) / 4.0;
- if(Object1.name() == "Mars" || Object2.name() == "Mars")
+ if(Object1.name() == i18n( "Mars" ) || Object2.name() == i18n( "Mars" ))
if (step0 > 10.0)
step0 = 10.0;
- if(Object1.name() == "Venus" || Object1.name() == "Mercury" || Object2.name() == "Mercury" || Object2.name() == "Venus")
+ if(Object1.name() == i18n( "Venus" ) || Object1.name() == i18n( "Mercury" ) || Object2.name() == i18n( "Mercury" ) || Object2.name() == i18n( "Venus" ))
if (step0 > 5.0)
step0 = 5.0;
if(Object1.name() == "Moon" || Object2.name() == "Moon")
--- trunk/KDE/kdeedu/kstars/kstars/tools/obslistwizard.cpp #901757:901758
@@ -413,28 +413,28 @@
if ( needRegion ) {
applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Sun"), doBuildList );
applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Moon"), doBuildList );
- applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Mercury"), doBuildList );
- applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Venus"), doBuildList );
- applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Mars"), doBuildList );
- applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Jupiter"), doBuildList );
- applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Saturn"), doBuildList );
- applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Uranus"), doBuildList );
- applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Neptune"), doBuildList );
- applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Pluto"), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Mercury" )), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Venus" )), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Mars" )), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Jupiter" )), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Saturn" )), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Uranus" )), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Neptune" )), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Pluto" )), doBuildList );
}
//Filter objects visible from geo at Date
if ( olw->SelectByDate->isChecked() ) {
applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Sun"), doBuildList );
applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Moon"), doBuildList );
- applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Mercury"), doBuildList );
- applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Venus"), doBuildList );
- applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Mars"), doBuildList );
- applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Jupiter"), doBuildList );
- applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Saturn"), doBuildList );
- applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Uranus"), doBuildList );
- applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Neptune"), doBuildList );
- applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName("Pluto"), doBuildList );
+ applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Mercury" )), doBuildList );
+ applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Venus" )), doBuildList );
+ applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Mars" )), doBuildList );
+ applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Jupiter" )), doBuildList );
+ applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Saturn" )), doBuildList );
+ applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Uranus" )), doBuildList );
+ applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Neptune" )), doBuildList );
+ applyObservableFilter( (SkyObject*)ksw->data()->skyComposite()->findByName(i18n( "Pluto" )), doBuildList );
}
}
--- trunk/KDE/kdeedu/kstars/kstars/tools/planetviewer.cpp #901757:901758
@@ -76,7 +76,7 @@
KStarsData *data = KStarsData::Instance();
PlanetList.append( KSPlanetBase::createPlanet( KSPlanetBase::MERCURY ) );
PlanetList.append( KSPlanetBase::createPlanet( KSPlanetBase::VENUS ) );
- PlanetList.append( new KSPlanet( data, i18n("Earth") ) );
+ PlanetList.append( new KSPlanet( data, "Earth" ) );
PlanetList.append( KSPlanetBase::createPlanet( KSPlanetBase::MARS ) );
PlanetList.append( KSPlanetBase::createPlanet( KSPlanetBase::JUPITER ) );
PlanetList.append( KSPlanetBase::createPlanet( KSPlanetBase::SATURN ) );
@@ -217,7 +217,8 @@
orbit[i] = new KPlotObject( Qt::white, KPlotObject::Lines, 1.0 );
QFile orbitFile;
- if ( KSUtils::openDataFile( orbitFile, p->name().toLower() + ".orbit" ) ) {
+ QString orbitFileName = ( p->isMajorPlanet() ? ((KSPlanet *)p)->untranslatedName().toLower() : p->name().toLower() ) + ".orbit";
+ if ( KSUtils::openDataFile( orbitFile, orbitFileName ) ) {
KSFileReader fileReader( orbitFile ); // close file is included
double x,y;
while ( fileReader.hasMoreLines() ) {
More information about the Kstars-devel
mailing list