[Kstars-devel] kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Mon Feb 7 06:13:35 CET 2005


CVS commit by harris: 

Fix some string formatting.

+ Details window: NGC galaxies showed extra leading "," before their 
secondary names (UGC and PGC numbers)

+ Do not want a thousands-place separator for the epoch ("2005.1", not 
"2,005.1"), nor for the Julian Day ("2453408.72", not "2,453,408.72").
In both cases, the localized decimalSymbol is still used.

CCMAIL: kstars-devel at kde.org


  M +18 -6     detaildialog.cpp   1.50
  M +8 -2      infoboxes.cpp   1.23


--- kdeedu/kstars/kstars/detaildialog.cpp  #1.49:1.50
@@ -307,11 +307,17 @@ void DetailDialog::createGeneralTab( con
                 }
 
-                if ( ! dso->name2().isEmpty() ) {
+                if ( ! dso->translatedName2().isEmpty() ) {
                         if ( oname.isEmpty() ) oname = dso->translatedName2();
                         else oname += ", " + dso->translatedName2();
                 }
 
-                if ( dso->ugc() != 0 ) oname += ", UGC " + QString("%1").arg( dso->ugc() );
-                if ( dso->pgc() != 0 ) oname += ", PGC " + QString("%1").arg( dso->pgc() );
+                if ( dso->ugc() != 0 ) {
+                        if ( ! oname.isEmpty() ) oname += ", ";
+                        oname += "UGC " + QString("%1").arg( dso->ugc() );
+                }
+                if ( dso->pgc() != 0 ) {
+                        if ( ! oname.isEmpty() ) oname += ", ";
+                        oname += "PGC " + QString("%1").arg( dso->pgc() );
+                }
 
                 //Only show decimal place for small angular sizes
@@ -411,6 +417,12 @@ DetailDialog::CoordBox::CoordBox( SkyObj
                 const char *name ) : QGroupBox( i18n( "Coordinates" ), parent, name ) {
 
-                        RALabel = new QLabel( i18n( "RA (%1):" ).arg( KGlobal::locale()->formatNumber( epoch ) ), this );
-                        DecLabel = new QLabel( i18n( "Dec (%1):" ).arg( KGlobal::locale()->formatNumber( epoch ) ), this );
+                        //Displaying the epoch as a string; don't use KLocale::formatNumber(), 
+                        //because we don't want a thousands-place separator!
+                        QString sEpoch = QString::number( epoch, 'f', 1 );
+                        //Replace the decimal point with localized version
+                        sEpoch.replace( ".", KGlobal::locale()->decimalSymbol() );
+                        
+                        RALabel = new QLabel( i18n( "RA (%1):" ).arg( sEpoch ), this );
+                        DecLabel = new QLabel( i18n( "Dec (%1):" ).arg( sEpoch ), this );
         HALabel = new QLabel( i18n( "Hour angle:" ), this );
         

--- kdeedu/kstars/kstars/infoboxes.cpp  #1.22:1.23
@@ -345,9 +345,15 @@ bool InfoBoxes::timeChanged( const KStar
         TimeBox->setText2( i18n( "Universal Time", "UT: " ) + ut.time().toString()
                 + "   " + ut.date().toString( "%d %b %Y" ) );
+        
         QString STString;
         STString = STString.sprintf( "%02d:%02d:%02d   ", lst->hour(), lst->minute(), lst->second() );
+        
+        //Don't use KLocale::formatNumber() for Julian Day because we don't want 
+        //thousands-place separators
+        QString JDString = QString::number( ut.djd(), 'f', 2 );
+        JDString.replace( ".", KGlobal::locale()->decimalSymbol() );
+        
         TimeBox->setText3( i18n( "Sidereal Time", "ST: " ) + STString +
-                i18n( "Julian Day", "JD: " ) +
-                KGlobal::locale()->formatNumber( ut.djd(), 2 ) );
+                        i18n( "Julian Day", "JD: " ) + JDString );
 
         if ( ot1 == TimeBox->text1() && ot2 == TimeBox->text2() &&




More information about the Kstars-devel mailing list