[Kstars-devel] branches/kstars/summer/kstars/kstars/tools

Prakash Mohan prak902000 at gmail.com
Sun Jun 28 00:41:06 CEST 2009


SVN commit 988367 by prakash:

Display a default "no_image" image, and get the DSS/SDSS image from the web if clicked, instead of simply hiding the ImagePreview when there is no image saved for the selected object.
If an image is present, a mousePressEvent will show the image in an ImageViewer.

CCMAIL: kstars-devel at kde.org


 M  +14 -3     observinglist.cpp  


--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #988366:988367
@@ -48,6 +48,7 @@
 #include "obslistwizard.h"
 #include "kstars.h"
 #include "kstarsdata.h"
+#include "ksutils.h"
 #include "dialogs/locationdialog.h"
 #include "skyobjects/skyobject.h"
 #include "skyobjects/starobject.h"
@@ -518,12 +519,17 @@
                 ui->NotesEdit->clear();
                 ui->NotesEdit->setEnabled( false );
             }
+            QFile file;
             if( QFile::exists( KStandardDirs::locateLocal( "appdata", CurrentImage ) ) ) {//If the image is present, show it!
-                ui->ImagePreview->showPreview( KUrl( KStandardDirs::locateLocal( "appdata", CurrentImage ) ));
+                ui->ImagePreview->showPreview( KUrl( KStandardDirs::locateLocal( "appdata", CurrentImage ) ) );
                 ui->ImagePreview->show();
             } else if( QFile::exists( KStandardDirs::locateLocal( "appdata", "Temp_" + CurrentImage ) ) ) {
-                ui->ImagePreview->showPreview( KUrl( KStandardDirs::locateLocal( "appdata","Temp_" + CurrentImage ) ));
+                ui->ImagePreview->showPreview( KUrl( KStandardDirs::locateLocal( "appdata","Temp_" + CurrentImage ) ) );
                 ui->ImagePreview->show();
+            } else if ( KSUtils::openDataFile( file, "noimage.png" ) ) {
+                file.close();
+                ui->ImagePreview->showPreview( KUrl( file.fileName() ) );
+                ui->ImagePreview->show();
             }
         } else {
             kDebug() << i18n( "Object %1 not found in list.", newName );
@@ -1301,6 +1307,11 @@
 bool ObservingList::eventFilter( QObject *obj, QEvent *event ) {
     if( obj == ui->ImagePreview )
         if( event->type() == QEvent::MouseButtonRelease )
-            slotImageViewer();
+            if( ! currentObject()->isSolarSystem() ) {
+                if( ! QFile::exists( KStandardDirs::locateLocal( "appdata", CurrentImage ) ) && ! QFile::exists( KStandardDirs::locateLocal( "appdata", "Temp_" + CurrentImage ) ) )
+                    slotGetImage();
+                else
+                    slotImageViewer();
+            }
 }
 #include "observinglist.moc"


More information about the Kstars-devel mailing list