summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <[email protected]>2017-07-11 22:58:37 +0300
committerJasem Mutlaq <[email protected]>2017-07-11 22:58:37 +0300
commit6bef4f9c78214c02272458074549fe8a7c7895f4 (patch)
tree996abadd5654a3df77008f0cec4b2f3d1f7be930
parentc0823cc39f48ffe89b4ba5ac35b987da3b267518 (diff)
Check if wcsWatcher is not running first before running a job
-rw-r--r--kstars/ekos/align/alignview.cpp10
-rw-r--r--kstars/fitsviewer/fitsview.cpp8
2 files changed, 11 insertions, 7 deletions
diff --git a/kstars/ekos/align/alignview.cpp b/kstars/ekos/align/alignview.cpp
index 83d9f22..5983495 100644
--- a/kstars/ekos/align/alignview.cpp
+++ b/kstars/ekos/align/alignview.cpp
@@ -50,9 +50,13 @@ bool AlignView::createWCSFile(const QString &newWCSFile, double orientation, dou
return false;
}
- // Load WCS async
- QFuture<bool> future = QtConcurrent::run(imageData, &FITSData::loadWCS);
- wcsWatcher.setFuture(future);
+ if (wcsWatcher.isRunning() == false)
+ {
+ // Load WCS async
+ QFuture<bool> future = QtConcurrent::run(imageData, &FITSData::loadWCS);
+ wcsWatcher.setFuture(future);
+ }
+
return true;
}
diff --git a/kstars/fitsviewer/fitsview.cpp b/kstars/fitsviewer/fitsview.cpp
index 94cb25e..a8e0d5d 100644
--- a/kstars/fitsviewer/fitsview.cpp
+++ b/kstars/fitsviewer/fitsview.cpp
@@ -165,7 +165,7 @@ void FITSView::setMouseMode(int mode)
}
if (mode==FITSView::scopeMouse&&imageHasWCS())
{
- if(imageData->isWCSLoaded() == false)
+ if(imageData->isWCSLoaded() == false && wcsWatcher.isRunning() == false)
{
QFuture<bool> future = QtConcurrent::run(imageData, &FITSData::loadWCS);
wcsWatcher.setFuture(future);
@@ -288,7 +288,7 @@ bool FITSView::loadFITS(const QString &inFilename, bool silent)
setAlignment(Qt::AlignCenter);
// Load WCS data now if selected and image contains valid WCS header
- if (imageData->hasWCS() && Options::autoWCS() && (mode == FITS_NORMAL || mode == FITS_ALIGN))
+ if (imageData->hasWCS() && Options::autoWCS() && (mode == FITS_NORMAL || mode == FITS_ALIGN) && wcsWatcher.isRunning() == false)
{
QFuture<bool> future = QtConcurrent::run(imageData, &FITSData::loadWCS);
wcsWatcher.setFuture(future);
@@ -1166,7 +1166,7 @@ void FITSView::toggleEQGrid()
{
showEQGrid = !showEQGrid;
- if (imageData->isWCSLoaded() == false)
+ if (imageData->isWCSLoaded() == false && wcsWatcher.isRunning() == false)
{
QFuture<bool> future = QtConcurrent::run(imageData, &FITSData::loadWCS);
wcsWatcher.setFuture(future);
@@ -1181,7 +1181,7 @@ void FITSView::toggleObjects()
{
showObjects = !showObjects;
- if (imageData->isWCSLoaded() == false)
+ if (imageData->isWCSLoaded() == false && wcsWatcher.isRunning() == false)
{
QFuture<bool> future = QtConcurrent::run(imageData, &FITSData::loadWCS);
wcsWatcher.setFuture(future);