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

Prakash Mohan prak902000 at gmail.com
Thu Jul 23 23:53:34 CEST 2009


SVN commit 1001665 by prakash:

Making the sessionList editable by external lists by passing a reference to it rather than the QList itsef

CCMAIL: kstars-devel at kde.org


 M  +1 -1      comast/log.cpp  
 M  +2 -2      skymapdraw.cpp  
 M  +10 -10    tools/observinglist.cpp  
 M  +1 -1      tools/observinglist.h  


--- branches/kstars/summer/kstars/kstars/comast/log.cpp #1001664:1001665
@@ -36,7 +36,7 @@
 QString Comast::Log::writeLog( bool _native ) {
     ks = KStars::Instance();
     output = "";
-    m_targetList = ks->observingList()->sessionList();
+    m_targetList = *(ks->observingList()->sessionList());
     native = _native;
     writeBegin();
     if( native )
--- branches/kstars/summer/kstars/kstars/skymapdraw.cpp #1001664:1001665
@@ -377,8 +377,8 @@
     int penWidth = int(m_Scale);
     psky.setPen( QPen( QColor( data->colorScheme()->colorNamed( "ObsListColor" ) ), penWidth ) );
 
-    if ( ks && ks->observingList()->sessionList().size() ) {
-        foreach ( SkyObject* obj, ks->observingList()->sessionList() ) {
+    if ( ks && ks->observingList()->sessionList()->size() ) {
+        foreach ( SkyObject* obj, *( ks->observingList()->sessionList() ) ) {
             if ( checkVisibility( obj ) ) {
                 QPointF o = toScreen( obj );
 
--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #1001664:1001665
@@ -242,7 +242,7 @@
         }
     }
 
-    if ( session && sessionList().contains( obj ) ) { 
+    if ( session && sessionList()->contains( obj ) ) { 
         ks->statusBar()->changeItem( i18n( "%1 is already in the session plan.", obj->name() ), 0 );
         return;
     }
@@ -349,7 +349,7 @@
         ui->TableView->resizeColumnsToContents();
         if( ! update ) slotSaveList();
     } else {
-        int k = sessionList().indexOf( o );
+        int k = sessionList()->indexOf( o );
         if ( o == LogObject ) saveCurrentUserLog();
         //Remove row from the Session View model
         bool found(false);
@@ -377,7 +377,7 @@
         }
         if( ! update )
             TimeHash.remove( o->name() );
-        sessionList().removeAt(k);//Remove from the session list
+        sessionList()->removeAt(k);//Remove from the session list
         if ( ! isModified ) isModified = true;//Removing an object should trigger the modified flag
         ui->View->removeAllPlotObjects();
         ui->SessionView->resizeColumnsToContents();
@@ -396,7 +396,7 @@
                 int irow = mIndex.row();
                 QString ra = m_Session->item(irow, 1)->text();
                 QString dc = m_Session->item(irow, 2)->text();
-                foreach ( SkyObject *o, sessionList() ) {
+                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 ) {
@@ -472,7 +472,7 @@
             //Find the selected object in the SessionList,
             //then break the loop.  Now SessionList.current()
             //points to the new selected object (until now it was the previous object)
-            foreach ( o, sessionList() ) {
+            foreach ( o, *sessionList() ) {
                 if ( o->translatedName() == newName ) {
                     found = true;
                     break;
@@ -772,7 +772,7 @@
                 int irow = mIndex.row();
                 QString ra = m_Session->item(irow, 1)->text();
                 QString dc = m_Session->item(irow, 2)->text();
-                foreach ( SkyObject *o, sessionList() ) {
+                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 ) {
@@ -851,7 +851,7 @@
         saveCurrentList();//See if the current list needs to be saved before opening the new one
         ui->tabWidget->setCurrentIndex(1);
         slotChangeTab(1);
-        sessionList().clear();
+        sessionList()->clear();
         TimeHash.clear();
         m_CurrentObject = 0;
         m_Session->removeRows( 0, m_Session->rowCount() );
@@ -875,7 +875,7 @@
 void ObservingList::saveCurrentList() {
     //Before loading a new list, do we need to save the current one?
     //Assume that if the list is empty, then there's no need to save
-    if ( sessionList().size() ) {
+    if ( sessionList()->size() ) {
         if ( isModified ) {
             QString message = i18n( "Do you want to save the current session?" );
             if ( KMessageBox::questionYesNo( this, message,
@@ -1207,7 +1207,7 @@
     ui->SessionView->clearSelection();
 
     if( sessionView ) {
-        foreach( SkyObject *o, sessionList() ) {
+        foreach( SkyObject *o, *sessionList() ) {
             setCurrentImage( o );
             QString img( CurrentImagePath  );
             KUrl url( SDSSUrl );
@@ -1281,7 +1281,7 @@
 void ObservingList::setSaveImages() {
     ui->saveImages->setEnabled( false );
     if( sessionView ) {
-        if( ! sessionList().isEmpty() )
+        if( ! sessionList()->isEmpty() )
             ui->saveImages->setEnabled( true );
     } else {
         if( ! obsList().isEmpty() )
--- branches/kstars/summer/kstars/kstars/tools/observinglist.h #1001664:1001665
@@ -105,7 +105,7 @@
     
     /**@return reference to the current observing list
         */
-    QList<SkyObject*>& sessionList() { return m_SessionList; }
+    QList<SkyObject*>* sessionList() { return &m_SessionList; }
 
     /**@return pointer to the currently-selected object in the observing list
         *@note if more than one object is selected, this function returns 0.


More information about the Kstars-devel mailing list