[Kstars-devel] KDE/kdeedu/kstars/kstars

Akarsh Simha akarshsimha at gmail.com
Mon Dec 29 20:51:34 CET 2008


SVN commit 903047 by asimha:

Fixing localization issues.

+ We want to use only the correct decimal symbol while formatting FOV
  sizes and avoid using the appropriate digit spacing.

+ The ok button refused to accept correctly localized strings and was
  looking for the standard '.' as the decimal symbol. Fixing that.

The FOV editor now generates, and accepts strings of the form "1000.0"
(where the . represents the appropriate decimal symbol in the locale)

This closes Bug #179034

CCMAIL: kstars-devel at kde.org
BUG: 179034



 M  +5 -5      fovdialog.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/fovdialog.cpp #903046:903047
@@ -150,7 +150,7 @@
         return;
 
     newfdlg.ui->FOVName->setText( f->name() );
-    newfdlg.ui->FOVEdit->setText( KGlobal::locale()->formatNumber( f->size(), 3 ) );
+    newfdlg.ui->FOVEdit->setText( QString::number( (double)( f->size() ), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
     newfdlg.ui->ColorButton->setColor( QColor( f->color() ) );
     newfdlg.ui->ShapeBox->setCurrentIndex( f->shape() );
     newfdlg.slotUpdateFOV();
@@ -211,7 +211,7 @@
 void NewFOV::slotUpdateFOV() {
     bool sizeOk( false );
     f.setName( ui->FOVName->text() );
-    float size = (float)(ui->FOVEdit->text().toDouble( &sizeOk ));
+    float size = ui->FOVEdit->text().replace( KGlobal::locale()->decimalSymbol(), "." ).toDouble( &sizeOk );
     if ( sizeOk ) f.setSize( size );
     f.setShape( ui->ShapeBox->currentIndex() );
     f.setColor( ui->ColorButton->color().name() );
@@ -227,11 +227,11 @@
 
 void NewFOV::slotComputeFOV() {
     if ( sender() == ui->ComputeEyeFOV && ui->TLength1->value() > 0.0 )
-        ui->FOVEdit->setText( KGlobal::locale()->formatNumber( ui->EyeFOV->value() * ui->EyeLength->value() / ui->TLength1->value() ) );
+        ui->FOVEdit->setText( QString::number( (double) ui->EyeFOV->value() * ui->EyeLength->value() / ui->TLength1->value(), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
     else if ( sender() == ui->ComputeCameraFOV && ui->TLength2->value() > 0.0 )
-        ui->FOVEdit->setText( KGlobal::locale()->formatNumber( ui->ChipSize->value() * 3438.0 / ui->TLength2->value() ) );
+        ui->FOVEdit->setText( QString::number( (double) ui->ChipSize->value() * 3438.0 / ui->TLength2->value(), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
     else if ( sender() == ui->ComputeHPBW && ui->RTDiameter->value() > 0.0 && ui->WaveLength->value() > 0.0 ) {
-        ui->FOVEdit->setText( KGlobal::locale()->formatNumber( 34.34 * 1.2 * ui->WaveLength->value() / ui->RTDiameter->value() ) );
+        ui->FOVEdit->setText( QString::number( (double) 34.34 * 1.2 * ui->WaveLength->value() / ui->RTDiameter->value(), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
         // Beam width for an antenna is usually a circle on the sky.
         ui->ShapeBox->setCurrentIndex(4);
         slotUpdateFOV();


More information about the Kstars-devel mailing list