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

Prakash Mohan prak902000 at gmail.com
Sat Jun 27 16:31:39 CEST 2009


SVN commit 988176 by prakash:

Using a QTImer and filtering the list by magnitude instead of using a update Button.

CCMAIL: kstars-devel at kde.org


 M  +15 -3     wutdialog.cpp  
 M  +3 -0      wutdialog.h  
 M  +1 -8      wutdialog.ui  


--- branches/kstars/summer/kstars/kstars/tools/wutdialog.cpp #988175:988176
@@ -43,7 +43,8 @@
 }
 
 WUTDialog::WUTDialog( KStars *ks, bool _session ) :
-        KDialog( (QWidget*)ks ), kstars(ks), EveningFlag(0)
+        KDialog( (QWidget*)ks ), kstars(ks), EveningFlag(0),
+        timer(NULL)
 {
 
     WUT = new WUTDialogUI( this );
@@ -103,7 +104,7 @@
     connect( WUT->ObjectListWidget, SIGNAL( currentTextChanged(const QString &) ),
              SLOT( slotDisplayObject(const QString &) ) );
     connect( WUT->EveningMorningBox, SIGNAL( activated(int) ), SLOT( slotEveningMorning(int) ) );
-    connect( WUT->MagnitudeUpdate, SIGNAL( clicked() ), SLOT( slotChangeMagnitude() ) );
+    connect( WUT->MagnitudeEdit, SIGNAL( valueChanged( double ) ), SLOT( slotChangeMagnitude() ) );
 }
 
 void WUTDialog::initCategories() {
@@ -514,9 +515,20 @@
     }
 }
 
-void WUTDialog::slotChangeMagnitude() {
+void WUTDialog::updateMag() {
     m_Mag = WUT->MagnitudeEdit->value();
     init();
     slotLoadList( WUT->CategoryListWidget->currentItem()->text() );
 }
+
+void WUTDialog::slotChangeMagnitude() {
+    if( timer ) {
+        timer->stop();
+    } else {
+        timer = new QTimer( this );
+        timer->setSingleShot( true );
+        connect( timer, SIGNAL( timeout() ), this, SLOT( updateMag() ) );
+    }
+    timer->start( 500 );
+}
 #include "wutdialog.moc"
--- branches/kstars/summer/kstars/kstars/tools/wutdialog.h #988175:988176
@@ -102,6 +102,8 @@
         */
     void slotChangeMagnitude();
 
+    void updateMag();
+
 private:
 
     KStars *kstars;
@@ -128,6 +130,7 @@
     GeoLocation *geo;
     int EveningFlag;
     double m_Mag;
+    QTimer *timer;
 
     QStringList m_Categories;
     QHash< QString, QList< SkyObject* > > m_VisibleList;
--- branches/kstars/summer/kstars/kstars/tools/wutdialog.ui #988175:988176
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>458</width>
-    <height>518</height>
+    <height>520</height>
    </rect>
   </property>
   <layout class="QVBoxLayout">
@@ -162,13 +162,6 @@
          </property>
         </widget>
        </item>
-       <item>
-        <widget class="QPushButton" name="MagnitudeUpdate">
-         <property name="text">
-          <string>Update</string>
-         </property>
-        </widget>
-       </item>
       </layout>
      </item>
     </layout>


More information about the Kstars-devel mailing list