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

Prakash Mohan prak902000 at gmail.com
Sat May 30 03:23:17 CEST 2009


SVN commit 975382 by prakash:

Editing slot signals to make the SetTime functional, now the user can set time in the session list.
( The times are not saved yet, need to figure a way to store QHashes )

CCMAIL: kstars-devel at kde.org


 M  +39 -12    observinglist.cpp  
 M  +3 -0      observinglist.h  
 M  +7 -7      observinglist.ui  


--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #975381:975382
@@ -166,6 +166,8 @@
              this, SLOT( slotLocation() ) );
     connect( ui->Update, SIGNAL( clicked() ),
              this, SLOT( slotUpdate() ) );
+    connect( ui->SetTime, SIGNAL( clicked() ),
+             this, SLOT( slotSetTime() ) );
     connect( ui->tabWidget, SIGNAL( currentChanged(int) ),
              this, SLOT( slotChangeTab(int) ) );
     //Add icons to Push Buttons
@@ -183,9 +185,8 @@
     ui->NotesLabel->setEnabled( false );
     ui->NotesEdit->setEnabled( false );
     ui->AddToSession->setEnabled( false );
-//    ui->SetDate->hide();
-//    ui->SetLocation->hide();
-//    ui->timeEdit->hide();
+    ui->SetTime->setEnabled( false );
+    ui->TimeEdit->setEnabled( false );
 
     slotLoadWishList();
     //Hide the MiniButton until I can figure out how to resize the Dialog!
@@ -256,18 +257,21 @@
     {
         m_SessionList.append(obj);
         QList<QStandardItem*> itemList;
+        if(!init && obj->name() != "star" ) TimeHash [obj->name()] = obj->transitTime( dt, geo );
         if(obj->name() == "star" )
             itemList << new QStandardItem( obj->translatedName() ) 
                     << new QStandardItem( obj->ra0()->toHMSString() ) 
                     << new QStandardItem( obj->dec0()->toDMSString() ) 
                     << new QStandardItem( smag )
-                    << new QStandardItem( obj->typeName() );
+                    << new QStandardItem( obj->typeName() )
+                    << new QStandardItem( "--"  );
         else
             itemList << new QStandardItem( obj->translatedName() ) 
                     << new QStandardItem( obj->recomputeCoords(dt,geo).ra()->toHMSString() ) 
                     << new QStandardItem( obj->recomputeCoords(dt,geo).dec()->toDMSString() ) 
                     << new QStandardItem( smag )
-                    << new QStandardItem( obj->typeName() );
+                    << new QStandardItem( obj->typeName() )
+                    << new QStandardItem( TimeHash[obj->name()].toString( "h:mm A" ) );
         m_Session->appendRow( itemList );
         if ( ! isModified ) isModified = true;
         ui->SessionView->resizeColumnsToContents();
@@ -485,11 +489,10 @@
         #ifdef HAVE_INDI_H
             ui->ScopeButton->setEnabled( true );
         #endif
-            ui->DetailsButton->setEnabled( true );
-            ui->AVTButton->setEnabled( true );
-            ui->RemoveButton->setEnabled( true );
-            ui->AddToSession->setEnabled( true );
-
+        ui->DetailsButton->setEnabled( true );
+        ui->AVTButton->setEnabled( true );
+        ui->RemoveButton->setEnabled( true );
+        ui->AddToSession->setEnabled( true );
         if ( found ) {
             m_CurrentObject = o;
             PlotObject = currentObject();
@@ -509,6 +512,11 @@
                 } else {
                     ui->NotesEdit->setPlainText( LogObject->userLog() );
                 }
+                if( ui->tabWidget->currentIndex() ) {
+                    ui->TimeEdit->setEnabled( true );
+                    ui->SetTime->setEnabled( true );
+                    ui->TimeEdit->setTime( TimeHash[o->name()] );
+                }   
             } else { //selected object is named "star"
                 //clear the log text box
                 saveCurrentUserLog();
@@ -533,6 +541,8 @@
         ui->NotesEdit->setEnabled( false );
         ui->AddToSession->setEnabled( false );
         m_CurrentObject = 0;
+        ui->TimeEdit->setEnabled( false );
+        ui->SetTime->setEnabled( false );
 
         //Clear the user log text box.
         saveCurrentUserLog();
@@ -549,6 +559,8 @@
         ui->NotesLabel->setText( i18n( "Select an object to record notes on it here:" ) );
         ui->NotesLabel->setEnabled( false );
         ui->NotesEdit->setEnabled( false );
+        ui->TimeEdit->setEnabled( false );
+        ui->SetTime->setEnabled( false );
         m_CurrentObject = 0;
         ui->View->removeAllPlotObjects();
 
@@ -993,7 +1005,10 @@
 void ObservingList::plot( SkyObject *o ) {
     if( !o ) return;
     float DayOffset = 0;
-    if ( o->transitTime( dt, geo ).hour() > 12 )
+    if( ui->tabWidget->currentIndex() ) {
+        if( TimeHash[o->name()].hour() > 12)
+            DayOffset = 1;
+    } else if ( o->transitTime( dt, geo ).hour() > 12 )
         DayOffset = 1;
     KStarsDateTime ut = dt;
     ut.setTime(QTime());
@@ -1108,6 +1123,8 @@
     ui->NotesLabel->setEnabled( false );
     ui->NotesEdit->setEnabled( false );
     ui->AddToSession->setEnabled( false );
+    ui->TimeEdit->setEnabled( false );
+    ui->SetTime->setEnabled( false );
     m_CurrentObject = 0;
 
     //Clear the user log text box.
@@ -1119,6 +1136,10 @@
     LocationDialog ld( (KStars*) topLevelWidget()->parent() );
 
     if ( ld.exec() == QDialog::Accepted ) {
+        foreach ( SkyObject *obj, SessionList() ) {
+            if(obj->transitTime(dt, geo) == TimeHash[obj->name()] )
+                TimeHash[obj->name()] = obj->transitTime( dt, ld.selectedCity() );
+        }
         geo = ld.selectedCity();
         ui->SetLocation -> setText( geo -> fullName() );
     }
@@ -1136,10 +1157,16 @@
         }
     }
     foreach ( SkyObject *obj, _SessionList ) {
-        if( obj->name() != "star" ) { 
+        if( obj->name() != "star" ) {  
             slotRemoveObject( obj, true );
             slotAddObject( obj, true, true );
         }
     }
 }
+void ObservingList::slotSetTime() {
+    SkyObject *o = currentObject();
+    slotRemoveObject( o, true );
+    TimeHash [o->name()] = ui->TimeEdit->time();
+    slotAddObject(o, true, true );
+}
 #include "observinglist.moc"
--- branches/kstars/summer/kstars/kstars/tools/observinglist.h #975381:975382
@@ -210,6 +210,8 @@
     void slotLocation();
 
     void slotUpdate();
+
+    void slotSetTime();
 protected slots:
     void slotClose();
 
@@ -227,6 +229,7 @@
     GeoLocation *geo;
     QStandardItemModel *m_Model, *m_Session;
     QSortFilterProxyModel *m_SortModel, *m_SortModelSession;
+    QHash<QString, QTime> TimeHash; 
 };
 
 #endif // OBSERVINGLIST_H_
--- branches/kstars/summer/kstars/kstars/tools/observinglist.ui #975381:975382
@@ -495,7 +495,7 @@
        <property name="geometry">
         <rect>
          <x>660</x>
-         <y>70</y>
+         <y>60</y>
          <width>100</width>
          <height>27</height>
         </rect>
@@ -507,17 +507,17 @@
         </size>
        </property>
       </widget>
-      <widget class="QLabel" name="label">
+      <widget class="QPushButton" name="SetTime">
        <property name="geometry">
         <rect>
-         <x>673</x>
-         <y>50</y>
-         <width>71</width>
-         <height>20</height>
+         <x>660</x>
+         <y>90</y>
+         <width>91</width>
+         <height>27</height>
         </rect>
        </property>
        <property name="text">
-        <string>Set Time:</string>
+        <string>Set Time</string>
        </property>
       </widget>
      </widget>


More information about the Kstars-devel mailing list