summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-08-29 07:31:16 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-08-29 07:31:16 (GMT)
commit701a50583f38d09d566be576807855fd714a4a99 (patch)
tree2e3eaae4ef4e686be2b629e0da41760a28a66c57
parentb214f5b90411b30bfd39d0b6ab11a8080334ac73 (diff)
Use QTimer instead of single shot stuff
-rw-r--r--kstars/ekos/mount.cpp14
-rw-r--r--kstars/ekos/mount.h1
2 files changed, 11 insertions, 4 deletions
diff --git a/kstars/ekos/mount.cpp b/kstars/ekos/mount.cpp
index d07517f..6d2537b 100644
--- a/kstars/ekos/mount.cpp
+++ b/kstars/ekos/mount.cpp
@@ -105,11 +105,13 @@ Mount::Mount()
connect(enableLimitsCheck, SIGNAL(toggled(bool)), this, SLOT(enableAltitudeLimits(bool)));
enableLimitsCheck->setChecked(Options::enableAltitudeLimits());
altLimitEnabled = enableLimitsCheck->isChecked();
+
+ updateTimer.setInterval(UPDATE_DELAY);
+ connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateTelescopeCoords()));
}
Mount::~Mount()
{
-
}
void Mount::setTelescope(ISD::GDInterface *newTelescope)
@@ -126,7 +128,7 @@ void Mount::setTelescope(ISD::GDInterface *newTelescope)
if (enableLimitsCheck->isChecked())
currentTelescope->setAltLimits(minAltLimit->value(), maxAltLimit->value());
- QTimer::singleShot(UPDATE_DELAY, this, SLOT(updateTelescopeCoords()));
+ updateTimer.start();
syncTelescopeInfo();
}
@@ -262,9 +264,13 @@ void Mount::updateTelescopeCoords()
newStatus(currentTelescope->getStatus());
- if (currentTelescope->isConnected())
- QTimer::singleShot(UPDATE_DELAY, this, SLOT(updateTelescopeCoords()));
+ if (currentTelescope->isConnected() == false)
+ updateTimer.stop();
+ else if (updateTimer.isActive() == false)
+ updateTimer.start();
}
+ else
+ updateTimer.stop();
}
void Mount::updateNumber(INumberVectorProperty *nvp)
diff --git a/kstars/ekos/mount.h b/kstars/ekos/mount.h
index a6ed495..2c8ab3b 100644
--- a/kstars/ekos/mount.h
+++ b/kstars/ekos/mount.h
@@ -221,6 +221,7 @@ private:
QStringList logText;
SkyPoint telescopeCoord;
QString lastNotificationMessage;
+ QTimer updateTimer;
double lastAlt;
int abortDispatch;
bool altLimitEnabled;