[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.0/kdeedu/kstars/kstars
From: Jason Harris <kstars () 30doradus ! org>
Date: 2008-01-30 8:19:40
Message-ID: 1201681180.002458.27536.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 768484 by harris:
Backporting final fix for bug #154195, just in time for 4,0,1 (sorry, I thought I
had done it already).
CCBUG: 154195
M +21 -11 ksmoon.cpp
M +8 -7 ksplanet.cpp
M +1 -4 skycomponents/asteroidscomponent.cpp
M +0 -2 skycomponents/cometscomponent.cpp
M +2 -7 skycomponents/deepskycomponent.cpp
M +1 -5 skycomponents/starcomponent.cpp
M +7 -7 tools/planetviewer.cpp
--- branches/KDE/4.0/kdeedu/kstars/kstars/ksmoon.cpp #768483:768484
@@ -48,7 +48,7 @@
bool KSMoon::loadData() {
if (data_loaded) return true;
- QString line;
+ QStringList fields;
QFile f;
int nd, nm, nm1, nf;
double Li, Ri, Bi; //coefficients of the sums
@@ -56,13 +56,17 @@
if ( KSUtils::openDataFile( f, "moonLR.dat" ) ) {
QTextStream stream( &f );
while ( !stream.atEnd() ) {
- line = stream.readLine();
- //Localize the decimal symbol
- line.replace( ".", KGlobal::locale()->decimalSymbol() );
+ fields = stream.readLine().split( " ", QString::SkipEmptyParts );
- QTextStream instream( &line, QIODevice::ReadOnly );
- instream >> nd >> nm >> nm1 >> nf >> Li >> Ri;
- LRData.append(new MoonLRData(nd, nm, nm1, nf, Li, Ri));
+ if ( fields.size() == 6 ) {
+ nd = fields[0].toInt();
+ nm = fields[1].toInt();
+ nm1= fields[2].toInt();
+ nf = fields[3].toInt();
+ Li = fields[4].toDouble();
+ Ri = fields[5].toDouble();
+ LRData.append(new MoonLRData(nd, nm, nm1, nf, Li, Ri));
+ }
}
f.close();
} else
@@ -72,10 +76,16 @@
if ( KSUtils::openDataFile( f, "moonB.dat" ) ) {
QTextStream stream( &f );
while ( !stream.atEnd() ) {
- line = stream.readLine();
- QTextStream instream( &line, QIODevice::ReadOnly );
- instream >> nd >> nm >> nm1 >> nf >> Bi;
- BData.append(new MoonBData(nd, nm, nm1, nf, Bi));
+ fields = stream.readLine().split( " ", QString::SkipEmptyParts );
+
+ if ( fields.size() == 5 ) {
+ nd = fields[0].toInt();
+ nm = fields[1].toInt();
+ nm1= fields[2].toInt();
+ nf = fields[3].toInt();
+ Bi = fields[4].toDouble();
+ BData.append(new MoonBData(nd, nm, nm1, nf, Bi));
+ }
}
f.close();
}
--- branches/KDE/4.0/kdeedu/kstars/kstars/ksplanet.cpp #768483:768484
@@ -40,20 +40,21 @@
bool KSPlanet::OrbitDataManager::readOrbitData(const QString &fname,
QVector<OrbitData> *vector) {
- QString line;
+ QStringList fields;
QFile f;
double A, B, C;
if ( KSUtils::openDataFile( f, fname ) ) {
KSFileReader fileReader( f ); // close file is included
while ( fileReader.hasMoreLines() ) {
- line = fileReader.readLine();
- //Localize the decimal symbol
- line.replace( ".", KGlobal::locale()->decimalSymbol() );
+ fields = fileReader.readLine().split( " ", QString::SkipEmptyParts );
- QTextStream instream( &line );
- instream >> A >> B >> C;
- vector->append( OrbitData(A, B, C) );
+ if ( fields.size() == 3 ) {
+ A = fields[0].toDouble();
+ B = fields[1].toDouble();
+ C = fields[2].toDouble();
+ vector->append( OrbitData(A, B, C) );
+ }
}
} else {
return false;
--- branches/KDE/4.0/kdeedu/kstars/kstars/skycomponents/asteroidscomponent.cpp #768483:768484
@@ -65,9 +65,6 @@
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();
@@ -77,7 +74,7 @@
dble_N = line.mid( 72, 9 ).toDouble();
dble_M = line.mid( 82, 11 ).toDouble();
H = line.mid( 94, 5 ).toDouble();
- G = line.mid( 102, 4 ).toDouble();
+ G = line.mid( 102, 4 ).toDouble();
JD = double( mJD ) + 2400000.5;
--- branches/KDE/4.0/kdeedu/kstars/kstars/skycomponents/cometscomponent.cpp #768483:768484
@@ -55,8 +55,6 @@
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();
--- branches/KDE/4.0/kdeedu/kstars/kstars/skycomponents/deepskycomponent.cpp #768483:768484
@@ -82,8 +82,6 @@
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();
@@ -93,9 +91,6 @@
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";
@@ -241,7 +236,7 @@
kDebug() << "Merging split NGC/IC files" << endl;
QString buffer;
- foreach ( QString fname, catFiles ) {
+ foreach ( const QString &fname, catFiles ) {
QFile f( localDir.absoluteFilePath(fname) );
if ( f.open( QIODevice::ReadOnly ) ) {
QTextStream stream( &f );
@@ -260,7 +255,7 @@
fout.close();
//Remove the split-files
- foreach ( QString fname, catFiles ) {
+ foreach ( const QString &fname, catFiles ) {
QString fullname = localDir.absoluteFilePath(fname);
//DEBUG
kDebug() << "Removing " << fullname << " ..." << endl;
--- branches/KDE/4.0/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #768483:768484
@@ -385,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);
@@ -393,10 +393,6 @@
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();
--- branches/KDE/4.0/kdeedu/kstars/kstars/tools/planetviewer.cpp #768483:768484
@@ -218,15 +218,15 @@
QFile orbitFile;
if ( KSUtils::openDataFile( orbitFile, pName[i].toLower() + ".orbit" ) ) {
KSFileReader fileReader( orbitFile ); // close file is included
- double x,y,z;
+ double x,y;
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 );
+ QStringList fields = line.split( " ", QString::SkipEmptyParts );
+ if ( fields.size() == 3 ) {
+ x = fields[0].toDouble();
+ y = fields[1].toDouble();
+ orbit[i]->addPoint( x, y );
+ }
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic