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

Prakash Mohan prak902000 at gmail.com
Wed Jul 29 23:06:42 CEST 2009


SVN commit 1004325 by prakash:

Selecting the current target of the Execute UI as the currentSelection in the OL and centering the object on the screen.

CCMAIL: kstars-devel at kde.org


 M  +6 -2      comast/execute.cpp  
 M  +14 -0     tools/observinglist.cpp  
 M  +2 -0      tools/observinglist.h  


--- branches/kstars/summer/kstars/kstars/comast/execute.cpp #1004324:1004325
@@ -250,10 +250,14 @@
 
 void Execute::slotSetTarget( QString name ) { 
     currentTarget = ks->observingList()->findObjectByName( name );
-    if( !currentTarget )
+    if( ! currentTarget ) {
         ui.NextButton->setEnabled( false );
-    else
+        return;
+    } else {
         ui.NextButton->setEnabled( true );
+        ks->observingList()->selectObject( currentTarget );
+        ks->observingList()->slotCenterObject();
+    }
 }
 
 void Execute::selectNextTarget() {
--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #1004324:1004325
@@ -1394,4 +1394,18 @@
             return o;
     return NULL;
 }
+
+void ObservingList::selectObject( SkyObject *o ) {
+    ui->tabWidget->setCurrentIndex( 1 );
+    ui->SessionView->selectionModel()->clear();
+    for ( int irow = m_Session->rowCount()-1; irow >= 0; --irow ) {
+        QModelIndex mSortIndex = m_SortModelSession->index( irow, 0 );
+        QModelIndex mIndex = m_SortModelSession->mapToSource( mSortIndex );
+        int irow = mIndex.row();
+        if(  m_Session->item(irow, 0)->text() == o->translatedName() )
+            ui->SessionView->selectRow( irow );
+        slotNewSelection();
+    }
+}
+
 #include "observinglist.moc"
--- branches/kstars/summer/kstars/kstars/tools/observinglist.h #1004324:1004325
@@ -324,6 +324,8 @@
 
     void slotAddVisibleObj();
 
+    void selectObject( SkyObject *o );
+
 protected slots:
     void slotClose();
     void downloadReady();


More information about the Kstars-devel mailing list