[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/kstars
From:       Jason Harris <kstars () 30doradus ! org>
Date:       2008-07-10 14:48:56
Message-ID: 1215701336.171871.24181.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 830459 by harris:

Merged revisions 827475 via svnmerge from 
https://svn.kde.org/home/kde/branches/kstars/unfrozen/kstars

........
  r827475 | harris | 2008-07-02 22:14:34 -0700 (Wed, 02 Jul 2008) | 20 lines
  
  Applying variable timestep patch from trunk (r827206).
  
  Akarsh, your commit message mentioned fixing a few bugs that my original patch 
  revealed...was there anything besides reducing the tolerance of findPrecise() to 
1 
  minute?
  
  Also adding a nice progress bar that appears in place of the Compute button 
while 
  the computation takes place, and then disappears when it's done.
  
  TODO: 
  
  + it would be nice to see conjunctions added to the results box as they are 
found, 
  rather than waiting until the computation is finished.
  
  + Add a "Show conjunction" button that will set the date/time to the time found 
by 
  the tool for the highlighted event, and set the focus to Object1.
  
........

CCMAIL: kstars-devel@kde.org



 _M            . (directory)  
 M  +9 -3      kstars/tools/conjunctions.cpp  
 M  +1 -0      kstars/tools/conjunctions.h  
 M  +94 -38    kstars/tools/conjunctions.ui  
 M  +31 -5     kstars/tools/ksconjunct.cpp  
 M  +7 -2      kstars/tools/ksconjunct.h  


** trunk/KDE/kdeedu/kstars #property svnmerge-integrated
   - /branches/kstars/unfrozen/kstars:1-822093,823176-826602,826607-826609,826612,8266 \
14-826640,826642-827470,827472-827474,827476-827647,827649-829108,829110-829310,829312-829464
  + /branches/kstars/unfrozen/kstars:1-822093,823176-826602,826607-826609,826612,826614-826640,826642-827470,827472-827647,827649-829108,829110-829310,829312-829464
                
--- trunk/KDE/kdeedu/kstars/kstars/tools/conjunctions.cpp #830458:830459
@@ -86,7 +86,6 @@
   // signals and slots connections
   connect(LocationButton, SIGNAL(clicked()), this, SLOT(slotLocation()));
   connect(ComputeButton, SIGNAL(clicked()), this, SLOT(slotCompute()));
-  
   show();
 }
 
@@ -120,14 +119,21 @@
 
   QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
   KSConjunct ksc;
+  ComputeStack->setCurrentIndex( 1 );
+  connect( &ksc, SIGNAL(madeProgress(int)), this, SLOT(showProgress(int)) );
+  
   showConjunctions(ksc.findClosestApproach(*Object1, *Object2, startJD, stopJD, \
                maxSeparation));
-  QApplication::restoreOverrideCursor();
-
+  ComputeStack->setCurrentIndex( 0 );
+    
   delete Object1;
   delete Object2;
 
 }
 
+void ConjunctionsTool::showProgress(int n) {
+  progress->setValue( n );
+}
+
 void ConjunctionsTool::showConjunctions(QMap<long double, dms> conjunctionlist) {
 
   KStarsDateTime dt;
--- trunk/KDE/kdeedu/kstars/kstars/tools/conjunctions.h #830458:830459
@@ -49,6 +49,7 @@
 
     void slotLocation();
     void slotCompute();
+    void showProgress(int);
 
 private:
     void showConjunctions(QMap<long double, dms> conjunctionlist);
--- trunk/KDE/kdeedu/kstars/kstars/tools/conjunctions.ui #830458:830459
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>479</width>
-    <height>547</height>
+    <width>464</width>
+    <height>408</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2" >
@@ -96,41 +96,97 @@
     </layout>
    </item>
    <item>
-    <layout class="QHBoxLayout" name="horizontalLayout_2" >
-     <item>
-      <spacer name="horizontalSpacer" >
-       <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0" >
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QPushButton" name="ComputeButton" >
-       <property name="text" >
-        <string>Compute</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_2" >
-       <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0" >
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
+    <widget class="QStackedWidget" name="ComputeStack" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="currentIndex" >
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="page" >
+      <property name="geometry" >
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>456</width>
+        <height>40</height>
+       </rect>
+      </property>
+      <property name="sizePolicy" >
+       <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <layout class="QHBoxLayout" name="horizontalLayout_4" >
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2" >
+         <item>
+          <spacer name="horizontalSpacer" >
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0" >
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="ComputeButton" >
+           <property name="text" >
+            <string>Compute</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_2" >
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0" >
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="page_2" >
+      <property name="geometry" >
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>456</width>
+        <height>40</height>
+       </rect>
+      </property>
+      <property name="sizePolicy" >
+       <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <layout class="QHBoxLayout" name="horizontalLayout_3" >
+       <item>
+        <widget class="QProgressBar" name="progress" >
+         <property name="value" >
+          <number>24</number>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </widget>
    </item>
    <item>
     <widget class="QGroupBox" name="groupBox_2" >
@@ -141,7 +197,7 @@
       <item>
        <widget class="QListWidget" name="OutputView" >
         <property name="sizePolicy" >
-         <sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
+         <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
--- trunk/KDE/kdeedu/kstars/kstars/tools/ksconjunct.cpp #830458:830459
@@ -58,15 +58,18 @@
 
   step = step0;
   
-  //  kDebug() << "Initial Separation between " << Object1.name() << " and " << \
Object2.name() << " = " << (prevDist.toDMSString()); +//  kDebug() << "Initial \
Separation between " << Object1.name() << " and " << Object2.name() << " = " << \
(prevDist.toDMSString());  
   long double jd = startJD;
   prevDist = findDistance(jd, &Object1, &Object2);
   jd += step;
   while ( jd <= stopJD ) {
+    int progress = int( 100.0*(jd - startJD)/(stopJD - startJD) );
+    emit madeProgress( progress );
+    
     Dist = findDistance(jd, &Object1, &Object2);
     Sign = sgn(Dist.Degrees() - prevDist.Degrees()); 
-    //    kDebug() << "Dist = " << Dist.toDMSString() << "; prevDist = " << \
prevDist.toDMSString() << "; Difference = " << (Dist.Degrees() - prevDist.Degrees()) \
<< "; Step = " << step; +//    kDebug() << "Dist = " << Dist.toDMSString() << "; \
prevDist = " << prevDist.toDMSString() << "; Difference = " << (Dist.Degrees() - \
prevDist.Degrees()) << "; Step = " << step;  
     //How close are we to a conjunction, and how fast are we approaching one?
     double factor = fabs( Dist.Degrees() / (Dist.Degrees() - prevDist.Degrees()) );
@@ -76,6 +79,30 @@
         step = step0;
     }
     
+    if( Sign != prevSign ) { //all right, we may have just passed a conjunction
+      if ( step > step0 ) { //mini-loop to back up and make sure we're close enough
+//        kDebug() << "Entering slow loop: " << endl;
+        jd -= step;
+        step = step0;
+        Sign = prevSign;
+        while ( jd <= stopJD ) {
+          Dist = findDistance(jd, &Object1, &Object2);
+          Sign = sgn(Dist.Degrees() - prevDist.Degrees()); 
+//          kDebug() << "Dist = " << Dist.toDMSString() << "; prevDist = " << \
prevDist.toDMSString() << "; Difference = " << (Dist.Degrees() - prevDist.Degrees()); \
+          if ( Sign != prevSign ) break; +
+          prevDist = Dist;
+          prevSign = Sign;
+          jd += step;
+        }
+      }
+      
+      //      kDebug() << "Sign = " << Sign << " and " << "prevSign = " << prevSign \
<< ": Entering findPrecise()\n"; +      if(findPrecise(&extremum, &Object1, &Object2, \
jd, step, prevSign)) +        if(extremum.second.radians() < maxSeparation.radians())
+          Separations.insert(extremum.first, extremum.second);
+    }
+    
     if( Sign != prevSign && prevSign == -1) { //all right, we may have just passed a \
                conjunction
         if ( step > step0 ) { //mini-loop to back up and make sure we're close \
enough  //            kDebug() << "Entering slow loop: " << endl;
@@ -150,7 +177,7 @@
     Dist = findDistance(jd, Object1, Object2);
     //    kDebug() << "Dist=" << Dist.toDMSString() << "; prevDist=" << \
prevDist.toDMSString() << "; Diff=" << (Dist.Degrees() - prevDist.Degrees()) << \
"step=" << step;  
-    if(fabs(step) < 1.0 / (24.0 * 60.0) ) {
+    if(fabs(step) < 1.0 / (24.0*60.0) ) {
       out -> first = jd - step / 2.0;
       out -> second = findDistance(jd - step/2.0, Object1, Object2);
       if(out -> second.radians() < findDistance(jd - 5.0, Object1, \
Object2).radians()) @@ -176,5 +203,4 @@
   return ((a.radians() > 0)?1:((a.radians() < 0)?-1:0));
 
 }
-
-
+#include "ksconjunct.moc"
--- trunk/KDE/kdeedu/kstars/kstars/tools/ksconjunct.h #830458:830459
@@ -20,6 +20,7 @@
 #define KSCONJUNCT_H_
 
 #include <QMap>
+#include <QObject>
 
 #include "dms.h"
 #include "ksplanet.h"
@@ -42,8 +43,9 @@
   *@version 1.0
   */
 
-class KSConjunct {
-
+class KSConjunct :public QObject {
+ Q_OBJECT
+ 
  public:
   /**
     *Constructor.  Instantiates a KSNumbers for internal computations.
@@ -71,6 +73,9 @@
 
   QMap<long double, dms> findClosestApproach(KSPlanetBase& Object1, KSPlanetBase& \
Object2, long double startJD, long double stopJD, dms maxSeparation);  
+ signals:
+  void madeProgress( int progress );
+
  private:
 
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic