summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-08-25 12:43:44 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-08-25 12:43:44 (GMT)
commit72b99242b391af788242e4a39b6871989afdbe3a (patch)
tree9abe9b2dba60249a8e179377be48fe830b1fed3a
parent249df869349218c89d8a92892ce4c6d38197fefc (diff)
Change DSS / ref. image file-naming conventions! (Breaks some files)
When naming DSS (or other reference) images in the Observation Planner, the following things have changed: 1. Quotes are removed from the object name. For example, the reference image for Hoag's Object will have the file name Image_HoagsObject.png -- this prevents failure on Windows and cleaner paths on Linux. 2. Naming convention for star images has changed to follow the standard RA/Dec format more closely. So instead of Image_HHMMSSDDMMSS-, we have Image_JHHMMSS-DDMMSS.png 3. The downloaded image files now have extension .png. Whenever KStars loads an older file without the extension, it will rename it so it has the extension. This will make the files more usable on Windows outside of KStars. This breaks some things: 1. If the user had already downloaded images for stars, they are no longer going to be available in KStars and must be re-downloaded! 2. If the user had already downloaded images for Hoag's Object, Mayall's Object, Minkowski's Object, ... they are no longer going to be available in KStars and must be re-downloaded! FIXED-IN: CCMAIL: kstars-devel@kde.org
-rw-r--r--kstars/tools/observinglist.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/kstars/tools/observinglist.cpp b/kstars/tools/observinglist.cpp
index 951f7b5..ce4448f 100644
--- a/kstars/tools/observinglist.cpp
+++ b/kstars/tools/observinglist.cpp
@@ -1180,15 +1180,22 @@ void ObservingList::downloadReady( bool success ) {
}
void ObservingList::setCurrentImage( const SkyObject *o ) {
- m_currentImageFileName = "Image_" + o->name().remove(' ');
- ThumbImage = "thumb-" + o->name().toLower().remove(' ') + ".png";
+ QString sanitizedName = o->name().remove(' ').remove( '\'' ).remove( '\"' );
+ m_currentImageFileName = "Image_" + sanitizedName;
+ ThumbImage = "thumb-" + sanitizedName.toLower() + ".png";
if( o->name() == "star" ) {
QString RAString( o->ra0().toHMSString() );
QString DecString( o->dec0().toDMSString() );
- m_currentImageFileName = "Image" + RAString.remove(' ') + DecString.remove(' ');
- QChar decsgn = ( (o->dec0().Degrees() < 0.0 ) ? '-' : '+' );
- m_currentImageFileName = m_currentImageFileName.remove('+').remove('-') + decsgn;
+ m_currentImageFileName = "Image_J" + RAString.remove(' ').remove( ':' ) + DecString.remove(' ').remove( ':' ); // Note: Changed naming convention to standard 2016-08-25 asimha; old images shall have to be re-downloaded.
+ // Unnecessary complication below:
+ // QChar decsgn = ( (o->dec0().Degrees() < 0.0 ) ? '-' : '+' );
+ // m_currentImageFileName = m_currentImageFileName.remove('+').remove('-') + decsgn;
}
+ QString imagePath;
+ if ( QFile::exists( imagePath = getCurrentImagePath() ) ) { // New convention -- append filename extension so file is usable on Windows etc.
+ QFile::rename( imagePath, imagePath + ".png" );
+ }
+ m_currentImageFileName += ".png";
// DSSUrl = KSDssDownloader::getDSSURL( o );
// QString UrlPrefix("http://casjobs.sdss.org/ImgCutoutDR6/getjpeg.aspx?"); // FIXME: Upgrade to use SDSS Data Release 9 / 10. DR6 is well outdated.
// QString UrlSuffix("&scale=1.0&width=600&height=600&opt=GST&query=SR(10,20)");