Commit 6bef4f9c authored by Jasem Mutlaq's avatar Jasem Mutlaq

Check if wcsWatcher is not running first before running a job

parent c0823cc3
......@@ -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;
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment