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

Victor Carbune victor.carbune at gmail.com
Tue Jun 29 17:27:07 CEST 2010


SVN commit 1144288 by vcarbune:

Cleaned up ObservingList of the code not used any more.
The ObsListPopupMenu is not used anymore (the KSObjectList with Context Menu will be used from now on)
If, for any reason, only the context menu is required, then this is the ObjListPopupMenu class

CCMAIL:kstars-devel at kde.org


 M  +1 -1      CMakeLists.txt  
 M  +12 -0     ksobjectlist.h  
 D             obslistpopupmenu.cpp  
 D             obslistpopupmenu.h  
 M  +0 -1      tools/objectlist.cpp  
 M  +0 -100    tools/observinglist.cpp  
 M  +0 -14     tools/observinglist.h  


--- branches/kstars/carbonix/kstars/kstars/CMakeLists.txt #1144287:1144288
@@ -292,7 +292,7 @@
 	colorscheme.cpp	dms.cpp fov.cpp geolocation.cpp
 	imageviewer.cpp
 	ksfilereader.cpp ksnumbers.cpp
-	kspopupmenu.cpp obslistpopupmenu.cpp objlistpopupmenu.cpp kstars.cpp ksalmanac.cpp 
+	kspopupmenu.cpp objlistpopupmenu.cpp kstars.cpp ksalmanac.cpp 
 	kstarsactions.cpp kstarsdata.cpp kstarsdb.cpp kstarsdatetime.cpp kstarsdcop.cpp kstarsinit.cpp
    ksobjectlist.cpp ksobjectlist.h
 	kstarssplash.cpp ksutils.cpp kswizard.cpp main.cpp 
--- branches/kstars/carbonix/kstars/kstars/ksobjectlist.h #1144287:1144288
@@ -76,9 +76,21 @@
 public slots:
     void slotContextMenu(const QPoint &pos);
     void slotCenterObject();
+
+    /**@short Add the object to the Session List
+        */
     void slotAddToSession();
+
+    /**@short slew the telescope to the selected object
+        */
     void slotSlewToObject();
+
+    /**@short Show the details window for the selected object
+        */
     void slotDetails();
+
+    /**@short Show the Altitude vs Time for selecteld objects
+        */
     void slotAVT();
 
 private:
--- branches/kstars/carbonix/kstars/kstars/tools/objectlist.cpp #1144287:1144288
@@ -64,7 +64,6 @@
 #include "Options.h"
 #include "imageviewer.h"
 #include "thumbnailpicker.h"
-#include "obslistpopupmenu.h"
 #include "oal/log.h"
 #include "oal/oal.h"
 #include "oal/execute.h"
--- branches/kstars/carbonix/kstars/kstars/tools/observinglist.cpp #1144287:1144288
@@ -61,7 +61,6 @@
 #include "Options.h"
 #include "imageviewer.h"
 #include "thumbnailpicker.h"
-#include "obslistpopupmenu.h"
 #include "oal/log.h"
 #include "oal/oal.h"
 #include "oal/execute.h"
@@ -101,7 +100,6 @@
     sessionView = false;
     nativeSave = true;
     FileName = "";
-    pmenu = new ObsListPopupMenu();
     //Set up the Table Views
     m_Model = new QStandardItemModel( 0, 5, this );
     m_Session = new QStandardItemModel( 0, 5 );
@@ -753,16 +751,6 @@
 #endif
 }
 
-//FIXME: This will open multiple Detail windows for each object;
-//Should have one window whose target object changes with selection
-void ObservingList::slotDetails() {
-    if ( currentObject() ) {
-        QPointer<DetailDialog> dd = new DetailDialog( currentObject(), ks->data()->lt(), geo, ks );
-        dd->exec();
-        delete dd;
-    }
-}
-
 void ObservingList::slotWUT() {
     KStarsDateTime lt = dt;
     lt.setTime( QTime(8,0,0) );
@@ -771,18 +759,6 @@
     delete w;
 }
 
-void ObservingList::slotAddToSession() {
-    QModelIndexList 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() )
-                    slotAddObject( o, true );
-                }
-        }
-    }
-}
-
 void ObservingList::slotFind() {
    QPointer<FindDialog> fd = new FindDialog( ks );    
    if ( fd->exec() == QDialog::Accepted ) {
@@ -794,51 +770,6 @@
    delete fd;
 }
 
-void ObservingList::slotAVT() {
-    QModelIndexList selectedItems;
-    // TODO: Think and see if there's a more effecient way to do this. I can't seem to think of any, but this code looks like it could be improved. - Akarsh
-    // DONE: Improved it by checking everything when a new selection is done, and use KSObjectList
-    // (see last lines from slotNewSelection()) - Victor
-    if( sessionView ) {
-        QPointer<AltVsTime> avt = new AltVsTime( ks );//FIXME KStars class is singleton, so why pass it?
-        for ( int irow = m_Session->rowCount()-1; irow >= 0; --irow ) {
-            if ( ui->SessionView->selectionModel()->isRowSelected( irow, QModelIndex() ) ) {
-                QModelIndex mSortIndex = m_SortModelSession->index( irow, 0 );
-                QModelIndex mIndex = m_SortModelSession->mapToSource( mSortIndex );
-                int irow = mIndex.row();
-                QString ra = m_Session->item(irow, 1)->text();
-                QString dc = m_Session->item(irow, 2)->text();
-                foreach ( SkyObject *o, sessionList() ) {
-                    //Stars named "star" must be matched by coordinates
-                    if ( o->name() == "star" ) {
-                        if ( o->ra0().toHMSString() == ra && o->dec0().toDMSString() == dc ) {
-                            avt->processObject( o );
-                            break;
-                        }
-                    } else if ( o->translatedName() == mIndex.data().toString() ) {
-                        avt->processObject( o );
-                        break;
-                    }
-                }
-            }
-        }
-        avt->exec();
-        delete avt;
-    } else {
-        selectedItems = m_SortModel->mapSelectionToSource( ui->TableView->selectionModel()->selection() ).indexes();
-        if ( selectedItems.size() ) {
-            QPointer<AltVsTime> avt = new AltVsTime( ks );//FIXME KStars class is singleton, so why pass it?
-            foreach ( const QModelIndex &i, selectedItems ) {
-                foreach ( SkyObject *o, obsList() )
-                    if ( o->translatedName() == i.data().toString() )
-                        avt->processObject( o );
-            }
-            avt->exec();
-            delete avt;
-        }
-    }
-}
-
 //FIXME: On close, we will need to close any open Details/AVT windows
 void ObservingList::slotClose() {
     //Save the current User log text
@@ -1353,38 +1284,7 @@
             return true;
         }
     }
-    /*
-    if( obj == ui->TableView->viewport() && ! noSelection ) {
-        if( event->type() == QEvent::MouseButtonRelease ) {
-            QMouseEvent *mouseEvent = static_cast<QMouseEvent* >(event);
-            if( mouseEvent->button() == Qt::RightButton ) {
-                QPoint pos( mouseEvent->globalX() , mouseEvent->globalY() );
-                if( singleSelection )
-                    pmenu->initPopupMenu( true, true, true, showScope, true, true );
-                else
-                    pmenu->initPopupMenu( true, false, false, false, true );
-                pmenu->popup( pos );
-                return true;
-            }
-        }
-    }
-    if( obj == ui->SessionView->viewport() && ! noSelection ) {
-        if( event->type() == QEvent::MouseButtonRelease ) {
-            QMouseEvent *mouseEvent = static_cast<QMouseEvent* >(event);
-            if( mouseEvent->button() == Qt::RightButton ) {
-                QPoint pos( mouseEvent->globalX() , mouseEvent->globalY() );
-                if( singleSelection )
-                    pmenu->initPopupMenu( false, true, true, showScope, true, true, true );
-                else
-                    pmenu->initPopupMenu( false, false, false, false, true, false, true );
-                pmenu->popup( pos );
-                return true;
-            }
-        }
-    }
-    */
     return false;
-
 }
 
 void ObservingList::slotGoogleImage() {
--- branches/kstars/carbonix/kstars/kstars/tools/observinglist.h #1144287:1144288
@@ -27,7 +27,6 @@
 #include "ui_observinglist.h"
 #include "kstarsdatetime.h"
 #include "skyobjects/skyobject.h"
-#include "obslistpopupmenu.h"
 
 class KSAlmanac;
 class QSortFilterProxyModel;
@@ -200,22 +199,10 @@
         */
     void slotSlewToObject();
 
-    /**@short Show the details window for the selected object
-        */
-    void slotDetails();
-
-    /**@short Show the Altitude vs Time for selecteld objects
-        */
-    void slotAVT();
-
     /**@short Open the WUT dialog
     */
     void slotWUT();
     
-    /**@short Add the object to the Session List
-        */
-    void slotAddToSession();
-
     /**@short Open the Find Dialog
         */
     void slotFind();
@@ -345,7 +332,6 @@
     KIO::Job *downloadJob;  // download job of image -> 0 == no job is running
     QHash<QString, QTime> TimeHash; 
     QList<QString> ImageList;
-    ObsListPopupMenu *pmenu; 
 };
 
 #endif // OBSERVINGLIST_H_


More information about the Kstars-devel mailing list