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

Prakash Mohan prak902000 at gmail.com
Thu Jul 16 10:36:12 CEST 2009


SVN commit 997638 by prakash:

Adding a new feature "Add objects visible tonight to session plan".

CCMAIL: kstars-devel at kde.org


 M  +2 -0      obslistpopupmenu.cpp  
 M  +15 -0     tools/observinglist.cpp  
 M  +2 -0      tools/observinglist.h  
 M  +3 -3      tools/wutdialog.cpp  
 M  +16 -11    tools/wutdialog.h  


--- branches/kstars/summer/kstars/kstars/obslistpopupmenu.cpp #997637:997638
@@ -38,6 +38,8 @@
     //Insert item for adding the object to the session view
     if( showAddToSession )
         addAction( i18n( "Add to session plan" ), ks->observingList(), SLOT( slotAddToSession() ) );
+    if( !sessionView )
+        addAction( i18n( "Add objects visible tonight to session plan" ), ks->observingList(), SLOT( slotAddVisibleObj() ) );
     addSeparator();
     //Insert item for centering on object
     if( showCenter )
--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #997637:997638
@@ -1371,4 +1371,19 @@
     nativeSave = true;
 }
 
+void ObservingList::slotAddVisibleObj() {
+    KStarsDateTime lt = dt;
+    lt.setTime( QTime(8,0,0) );
+    QPointer<WUTDialog> w = new WUTDialog( ks, sessionView, geo, lt );
+    w->init();
+    QModelIndexList selectedItems;
+    selectedItems = m_SortModel->mapSelectionToSource( ui->TableView->selectionModel()->selection() ).indexes();
+    if ( selectedItems.size() )
+        foreach ( const QModelIndex &i, selectedItems ) {
+            foreach ( SkyObject *o, obsList() )
+                if ( o->translatedName() == i.data().toString() && w->checkVisibility( o ) )
+                    slotAddObject( o, true );
+        }
+    delete w;
+}
 #include "observinglist.moc"
--- branches/kstars/summer/kstars/kstars/tools/observinglist.h #997637:997638
@@ -311,6 +311,8 @@
         */
     void slotOALExport(); 
 
+    void slotAddVisibleObj();
+
 protected slots:
     void slotClose();
     void downloadReady();
--- branches/kstars/summer/kstars/kstars/tools/wutdialog.cpp #997637:997638
@@ -42,7 +42,7 @@
     setupUi( this );
 }
 
-WUTDialog::WUTDialog( KStars *ks, bool _session ) :
+WUTDialog::WUTDialog( KStars *ks, bool _session, GeoLocation *_geo, KStarsDateTime _lt ) :
         KDialog( (QWidget*)ks ), kstars(ks), EveningFlag(0),
         timer(NULL)
 {
@@ -54,9 +54,9 @@
     setModal( false );
 
     //initialize location and date to current KStars settings:
-    geo = kstars->geo();
+    geo = _geo; 
     session = _session;
-    T0 = kstars->data()->lt();
+    T0 = _lt;
     //If the Time is earlier than 6:00 am, assume the user wants the night of the previous date
     if ( T0.time().hour() < 6 )
         T0 = T0.addDays( -1 );
--- branches/kstars/summer/kstars/kstars/tools/wutdialog.h #997637:997638
@@ -22,6 +22,7 @@
 #include <kdialog.h>
 #include <q3listview.h>
 #include "kstarsdatetime.h"
+#include "kstars.h"
 #include "ui_wutdialog.h"
 
 #define NCATEGORY 8
@@ -48,10 +49,24 @@
 public:
 
     /**@short Constructor*/
-    WUTDialog(KStars *ks, bool session = false);
+    WUTDialog( KStars *ks, bool session = false,GeoLocation *geo = KStars::Instance()->geo(), KStarsDateTime lt = KStars::Instance()->data()->lt() );
+
     /**@short Destructor*/
     ~WUTDialog();
 
+    /**@short Check visibility of object
+        *@p o the object to check
+        *@return true if visible
+        */
+    bool checkVisibility(SkyObject *o);
+
+public slots:
+
+    /**@short Determine which objects are visible, and store them in
+        *an array of lists, classified by object type 
+        */
+    void init();
+
 private slots:
 
     /**@short Load the list of visible objects for selected object type.
@@ -59,11 +74,6 @@
         */
     void slotLoadList(const QString &category);
 
-    /**@short Determine which objects are visible, and store them in
-        *an array of lists, classified by object type 
-        */
-    void init();
-
     /**@short display the rise/transit/set times for selected object
         */
     void slotDisplayObject(const QString &name);
@@ -118,11 +128,6 @@
     /**@short Initialize catgory list, used in constructor */
     void initCategories();
 
-    /**@short Check visibility of object
-        *@p o the object to check
-        *@return true if visible
-        */
-    bool checkVisibility(SkyObject *o);
 
     QTime sunRiseTomorrow, sunSetToday, sunRiseToday, moonRise, moonSet;
     KStarsDateTime T0, UT0, Tomorrow, TomorrowUT, Evening, EveningUT;


More information about the Kstars-devel mailing list