[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/kstars/summer/kstars/kstars/tools
From: Prakash Mohan <prak902000 () gmail ! com>
Date: 2009-05-31 21:25:06
Message-ID: 1243805106.932157.7450.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 976096 by prakash:
Implementing the saving of user set times in a non redundant manner.
CCMAIL: kstars-devel@kde.org
M +19 -22 observinglist.cpp
--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #976095:976096
@@ -824,6 +824,7 @@
ui->DateEdit->setDate( dt.date() );
while ( ! istream.atEnd() ) {
line = istream.readLine();
+ QStringList parts = line.split('|');
//If the object is named "star", add it by coordinates
SkyObject *o;
@@ -837,20 +838,18 @@
} else if ( line.startsWith( "QHash" ) ) {
break;
} else {
- o = ks->data()->objectNamed( line );
+ o = ks->data()->objectNamed( parts[0] );
}
//If we haven't identified the object, try interpreting the
//name as a star's genetive name (with ascii letters)
- if ( !o ) o = ks->data()->skyComposite()->findStarByGenetiveName( line \
); + if ( !o ) o = ks->data()->skyComposite()->findStarByGenetiveName( \
parts[0] );
- if ( o ) slotAddObject( o, true );
+ if ( o ) {
+ slotAddObject( o, true );
+ if( !parts[1].isEmpty() ) TimeHash.insert( o->name(), \
QTime::fromString( parts[1], "hms ap" ) ); + }
}
- while ( ! istream.atEnd() ) {
- line = istream.readLine();
- QStringList hashdata = line.split(':');
- TimeHash.insert( hashdata[0], QTime::fromString( hashdata[1], " hms ap" \
) );
- }
//Update the location and user set times from file
slotUpdate();
//Newly-opened list should not trigger isModified flag
@@ -977,24 +976,22 @@
foreach ( SkyObject* o, SessionList() ) {
if ( o->name() == "star" ) {
ostream << o->name() << " " << o->ra()->Hours() << " " << \
o->dec()->Degrees() << endl;
- } else if ( o->type() == SkyObject::STAR ) {
- StarObject *s = (StarObject*)o;
+ } else {
+ if ( o->type() == SkyObject::STAR ) {
+ StarObject *s = (StarObject*)o;
- if ( s->name() == s->gname() ) {
- ostream << s->name2() << endl;
- } else {
- ostream << s->name() << endl;
+ if ( s->name() == s->gname() ) {
+ ostream << s->name2() << "|";
+ } else {
+ ostream << s->name() << "|";
+ }
+ } else {
+ ostream << o->name() << "|";
}
- } else {
- ostream << o->name() << endl;
+ if( TimeHash.value( o->name(), QTime(30,0,0) ).isValid() ) ostream << \
TimeHash.value( o->name() ).toString("hms ap"); + ostream<<endl;
}
}
- ostream << "QHash" << endl;
- QHashIterator<QString, QTime> i(TimeHash);
- while (i.hasNext()) {
- i.next();
- ostream << i.key() << ": " << i.value().toString("hms ap") << endl;
- }
f.close();
isModified = false;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic