[Kstars-devel] KDE/kdeedu/kstars/kstars
Jason Harris
kstars at 30doradus.org
Fri Jan 18 19:15:49 CET 2008
SVN commit 763142 by harris:
I believe this fixes bug #154195, but I NEED someone
with a non en_US localization to test it!
I used QString::replace() to replae all "." with
KLocale::decimalSymbol() when parsing data files.
I did this for the Moon, planets, planet orbits (in
the solar system tool), stars, asteroids, comets, and
deep-sky objects. PLMK if I missed something!
BUG: 154195
CCMAIL: kstars-devel at kde.org
M +4 -0 ksmoon.cpp
M +4 -0 ksplanet.cpp
M +5 -0 skycomponents/asteroidscomponent.cpp
M +4 -0 skycomponents/cometscomponent.cpp
M +5 -0 skycomponents/deepskycomponent.cpp
M +6 -1 skycomponents/starcomponent.cpp
M +10 -5 tools/planetviewer.cpp
--- trunk/KDE/kdeedu/kstars/kstars/ksmoon.cpp #763141:763142
@@ -22,6 +22,7 @@
#include <QFile>
#include <QTextStream>
+#include <kglobal.h>
#include "ksnumbers.h"
#include "ksutils.h"
@@ -56,6 +57,9 @@
QTextStream stream( &f );
while ( !stream.atEnd() ) {
line = stream.readLine();
+ //Localize the decimal symbol
+ line.replace( ".", KGlobal::locale()->decimalSymbol() );
+
QTextStream instream( &line, QIODevice::ReadOnly );
instream >> nd >> nm >> nm1 >> nf >> Li >> Ri;
LRData.append(new MoonLRData(nd, nm, nm1, nf, Li, Ri));
--- trunk/KDE/kdeedu/kstars/kstars/ksplanet.cpp #763141:763142
@@ -23,6 +23,7 @@
#include <QTextStream>
#include <kdebug.h>
+#include <kglobal.h>
#include "ksnumbers.h"
#include "ksutils.h"
@@ -47,6 +48,9 @@
KSFileReader fileReader( f ); // close file is included
while ( fileReader.hasMoreLines() ) {
line = fileReader.readLine();
+ //Localize the decimal symbol
+ line.replace( ".", KGlobal::locale()->decimalSymbol() );
+
QTextStream instream( &line );
instream >> A >> B >> C;
vector->append( OrbitData(A, B, C) );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/asteroidscomponent.cpp #763141:763142
@@ -19,6 +19,7 @@
#include <QPen>
#include <QPainter>
+#include <kglobal.h>
#include "skycomponent.h"
@@ -63,6 +64,10 @@
while( fileReader.hasMoreLines() ) {
KSAsteroid *ast = 0;
line = fileReader.readLine();
+
+ //Localize the decimal symbol
+ line.replace( ".", KGlobal::locale()->decimalSymbol() );
+
name = line.mid( 6, 17 ).trimmed();
mJD = line.mid( 24, 5 ).toInt();
a = line.mid( 30, 9 ).toDouble();
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/cometscomponent.cpp #763141:763142
@@ -21,6 +21,7 @@
#include <QFile>
#include <QPen>
#include <QPainter>
+#include <kglobal.h>
#include "Options.h"
#include "kscomet.h"
@@ -54,6 +55,9 @@
KSComet *com = 0;
line = fileReader.readLine();
+ //Localize the decimal symbol
+ line.replace( ".", KGlobal::locale()->decimalSymbol() );
+
name = line.mid( 3, 35 ).trimmed();
mJD = line.mid( 38, 5 ).toInt();
q = line.mid( 44, 10 ).toDouble();
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/deepskycomponent.cpp #763141:763142
@@ -82,6 +82,8 @@
QChar iflag;
line = fileReader.readLine();
+ //Localize the decimal symbol
+ line.replace( ".", KGlobal::locale()->decimalSymbol() );
//Ignore comment lines
while ( line.at(0) == '#' && fileReader.hasMoreLines() ) line = fileReader.readLine();
@@ -91,6 +93,9 @@
line = fileReader.readLine();
}
+ //Localize the decimal symbol
+ line.replace( ".", KGlobal::locale()->decimalSymbol() );
+
iflag = line.at( 0 ); //check for NGC/IC catalog flag
if ( iflag == 'I' ) cat = "IC";
else if ( iflag == 'N' ) cat = "NGC";
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #763141:763142
@@ -22,6 +22,7 @@
#include <QRectF>
#include <QFontMetricsF>
+#include <kglobal.h>
#include "Options.h"
#include "kstarsdata.h"
@@ -384,7 +385,7 @@
}
-StarObject* StarComponent::processStar( const QString &line ) {
+StarObject* StarComponent::processStar( const QString &_line ) {
QString name, gname, SpType, visibleName;
int rah, ram, ras, ras2, dd, dm, ds, ds2;
bool mult(false), var(false);
@@ -392,6 +393,10 @@
double mag, bv, dmag, vper;
double pmra, pmdec, plx;
+ //Localize the decimal symbol
+ QString line = _line;
+ line.replace( ".", KGlobal::locale()->decimalSymbol() );
+
//parse coordinates
rah = line.mid( 0, 2 ).toInt();
ram = line.mid( 2, 2 ).toInt();
--- trunk/KDE/kdeedu/kstars/kstars/tools/planetviewer.cpp #763141:763142
@@ -38,6 +38,7 @@
#include "kstarsdata.h"
#include "ksutils.h"
#include "ksnumbers.h"
+#include "ksfilereader.h"
#include "ksplanetbase.h"
#include "ksplanet.h"
#include "kspluto.h"
@@ -216,12 +217,16 @@
QFile orbitFile;
if ( KSUtils::openDataFile( orbitFile, pName[i].toLower() + ".orbit" ) ) {
- QTextStream orbitStream( &orbitFile );
- double x, y, z;
- orbitStream >> x >> y >> z;
- while ( !orbitStream.atEnd() ) {
+ KSFileReader fileReader( orbitFile ); // close file is included
+ double x,y,z;
+ while ( fileReader.hasMoreLines() ) {
+ QString line = fileReader.readLine();
+ //Localize the decimal symbol
+ line.replace( ".", KGlobal::locale()->decimalSymbol() );
+
+ QTextStream instream( &line );
+ instream >> x >> y >> z;
orbit[i]->addPoint( x, y );
- orbitStream >> x >> y >> z;
}
}
More information about the Kstars-devel
mailing list