[Kstars-devel] KDE/kdeedu/kstars/kstars
Jason Harris
kstars at 30doradus.org
Mon Jan 28 18:09:25 CET 2008
SVN commit 767735 by harris:
Number formatting fixes (use KLocale), thanks for the patches Mederic!
CCMAIL: kstars-devel at kde.org
M +3 -3 detaildialog.cpp
M +6 -6 starobject.cpp
--- trunk/KDE/kdeedu/kstars/kstars/detaildialog.cpp #767734:767735
@@ -129,7 +129,7 @@
Data->Distance->setText( QString(i18nc("larger than 2000 parsecs", "> 2000 pc") ) );
else if ( s->distance() > 50.0 ) //show to nearest integer
Data->Distance->setText( i18nc( "number in parsecs", "%1 pc" ,
- int( s->distance() + 0.5 ) ) );
+ KGlobal::locale()->formatNumber( s->distance(), 0 ) ) );
else if ( s->distance() > 10.0 ) //show to tenths place
Data->Distance->setText( i18nc( "number in parsecs", "%1 pc" ,
KGlobal::locale()->formatNumber( s->distance(), 1 ) ) );
@@ -171,7 +171,7 @@
//Magnitude: The moon displays illumination fraction instead
if ( selectedObject->name() == "Moon" ) {
Data->MagLabel->setText( i18n("Illumination:") );
- Data->Magnitude->setText( QString("%1 %").arg( int( ((KSMoon *)selectedObject)->illum()*100. ) ) );
+ Data->Magnitude->setText( QString("%1 %").arg( KGlobal::locale()->formatNumber( ((KSMoon *)selectedObject)->illum()*100., 0 ) ) );
} else {
Data->Magnitude->setText( i18nc( "number in magnitudes", "%1 mag" ,
KGlobal::locale()->formatNumber( ps->mag(), 1 ) ) ); //show to tenths place
@@ -242,7 +242,7 @@
//Only show decimal place for small angular sizes
if ( dso->a() > 10.0 )
Data->AngSize->setText( i18nc("angular size in arcminutes", "%1 arcmin",
- int( dso->a() ) ) );
+ KGlobal::locale()->formatNumber(dso->a(), 0 ) ) );
else if ( dso->a() )
Data->AngSize->setText( i18nc("angular size in arcminutes", "%1 arcmin",
KGlobal::locale()->formatNumber( dso->a(), 1 ) ) );
--- trunk/KDE/kdeedu/kstars/kstars/starobject.cpp #767734:767735
@@ -444,14 +444,14 @@
sName = gname( true );
else {
if ( drawMag )
- return QString().sprintf("%.1f", mag() );
+ return KGlobal::locale()->formatNumber( mag(), 1 );
}
if ( ! drawMag )
return sName;
else
- return sName + QString().sprintf(" %.1f", mag() );
+ return sName + ' ' + KGlobal::locale()->formatNumber( mag(), 1 );
}
- return QString().sprintf("%.1f", mag() );
+ return KGlobal::locale()->formatNumber( mag(), 1 );
}
QString StarObject::customLabel( bool drawName, bool drawMag )
@@ -466,12 +466,12 @@
if ( drawMag && drawName ) {
if ( sName == i18n("star") )
- return QString().sprintf("%.1f, ", mag() ) + sName;
+ return KGlobal::locale()->formatNumber( mag(), 1 ) + ", " + sName;
else
- return sName + QString().sprintf(" %.1f", mag() );
+ return sName + ' ' + KGlobal::locale()->formatNumber( mag(), 1 );
}
else if ( drawMag && ! drawName )
- return QString().sprintf("%.1f, ", mag() ) + sName;
+ return KGlobal::locale()->formatNumber( mag(), 1 ) + ", " + sName;
return sName;
}
More information about the Kstars-devel
mailing list