summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <[email protected]>2017-06-22 00:31:29 +0300
committerJasem Mutlaq <[email protected]>2017-06-22 00:31:29 +0300
commit97a3f8d36c7af35dc07f52ffa41bfec5f9e2472e (patch)
treed0da3c3c5ceb2c3fac56a64495bb11c846b8d114
parentc0a58d2f3114bfcf319737a2682e6887dfafed66 (diff)
No need to perform meridian flip if there are no more pending jobs in the sequence queue
-rw-r--r--kstars/ekos/capture/capture.cpp18
-rw-r--r--kstars/ekos/capture/capture.h5
-rw-r--r--kstars/org.kde.kstars.Ekos.Capture.xml3
3 files changed, 24 insertions, 2 deletions
diff --git a/kstars/ekos/capture/capture.cpp b/kstars/ekos/capture/capture.cpp
index 74289bf..6f4ac8b 100644
--- a/kstars/ekos/capture/capture.cpp
+++ b/kstars/ekos/capture/capture.cpp
@@ -1236,8 +1236,9 @@ void Capture::processJobCompletion()
stop();
- // Check if meridian condition is met
- if (checkMeridianFlip())
+ // Check if meridian condition is met IF there are more pending jobs in the queue
+ // Otherwise, no need to check meridian flip is all jobs are over.
+ if (getPendingJobCount() > 0 && checkMeridianFlip())
return;
// Check if there are more pending jobs and execute them
@@ -3155,6 +3156,19 @@ int Capture::getActiveJobID()
return -1;
}
+int Capture::getPendingJobCount()
+{
+ int completedJobs = 0;
+
+ foreach (SequenceJob *job, jobs)
+ {
+ if (job->getStatus() == SequenceJob::JOB_DONE)
+ completedJobs++;
+ }
+
+ return (jobs.count() - completedJobs);
+}
+
QString Capture::getJobState(int id)
{
if (id < jobs.count())
diff --git a/kstars/ekos/capture/capture.h b/kstars/ekos/capture/capture.h
index f1310a5..bcd4395 100644
--- a/kstars/ekos/capture/capture.h
+++ b/kstars/ekos/capture/capture.h
@@ -207,6 +207,11 @@ class Capture : public QWidget, public Ui::Capture
Q_SCRIPTABLE int getJobCount() { return jobs.count(); }
/** DBUS interface function.
+ * @return Returns the number of pending uncompleted jobs in the sequence queue.
+ */
+ Q_SCRIPTABLE int getPendingJobCount();
+
+ /** DBUS interface function.
* @return Returns ID of current active job if any, or -1 if there are no active jobs.
*/
Q_SCRIPTABLE int getActiveJobID();
diff --git a/kstars/org.kde.kstars.Ekos.Capture.xml b/kstars/org.kde.kstars.Ekos.Capture.xml
index b5853ed..8a4c789 100644
--- a/kstars/org.kde.kstars.Ekos.Capture.xml
+++ b/kstars/org.kde.kstars.Ekos.Capture.xml
@@ -51,6 +51,9 @@
<method name="getJobCount">
<arg type="i" direction="out"/>
</method>
+ <method name="getPendingJobCount">
+ <arg type="i" direction="out"/>
+ </method>
<method name="getJobState">
<arg type="s" direction="out"/>
<arg name="id" type="i" direction="in"/>