summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <[email protected]>2016-05-31 09:44:33 +0300
committerJasem Mutlaq <[email protected]>2016-05-31 09:44:33 +0300
commit63db5a46906535046ae5aa05bd61cd7301ebe597 (patch)
tree24cc7f3712d6adc96b090e7d333252eb3c5b57fe
parent3c9b48e91fbb5df14920b5e5595cdc1b83f52deb (diff)
Do not add new tabs on capture failure
-rw-r--r--kstars/indi/indiccd.cpp45
1 files changed, 33 insertions, 12 deletions
diff --git a/kstars/indi/indiccd.cpp b/kstars/indi/indiccd.cpp
index 9ed0dc8..dfb66cd 100644
--- a/kstars/indi/indiccd.cpp
+++ b/kstars/indi/indiccd.cpp
@@ -1258,19 +1258,26 @@ void CCD::processBLOB(IBLOB* bp)
}
+ int tabRC = -1;
+
switch (targetChip->getCaptureMode())
{
case FITS_NORMAL:
if (normalTabID == -1 || Options::singlePreviewFITS() == false)
- normalTabID = fv->addFITS(&fileURL, FITS_NORMAL, captureFilter, previewTitle);
+ tabRC = fv->addFITS(&fileURL, FITS_NORMAL, captureFilter, previewTitle);
else if (fv->updateFITS(&fileURL, normalTabID, captureFilter) == false)
{
fv->removeFITS(normalTabID);
- normalTabID = fv->addFITS(&fileURL, FITS_NORMAL, captureFilter, previewTitle);
+ tabRC = fv->addFITS(&fileURL, FITS_NORMAL, captureFilter, previewTitle);
}
+ else
+ tabRC = normalTabID;
- if (normalTabID >= 0)
+ if (tabRC >= 0)
+ {
+ normalTabID = tabRC;
targetChip->setImage(fv->getView(normalTabID), FITS_NORMAL);
+ }
else
// If opening file fails, we treat it the same as exposure failure and recapture again if possible
emit newExposureValue(targetChip, 0, IPS_ALERT);
@@ -1278,47 +1285,61 @@ void CCD::processBLOB(IBLOB* bp)
case FITS_FOCUS:
if (focusTabID == -1)
- focusTabID = fv->addFITS(&fileURL, FITS_FOCUS, captureFilter);
+ tabRC = fv->addFITS(&fileURL, FITS_FOCUS, captureFilter);
else if (fv->updateFITS(&fileURL, focusTabID, captureFilter) == false)
{
fv->removeFITS(focusTabID);
- focusTabID = fv->addFITS(&fileURL, FITS_FOCUS, captureFilter);
+ tabRC = fv->addFITS(&fileURL, FITS_FOCUS, captureFilter);
}
+ else
+ tabRC = focusTabID;
- if (focusTabID >= 0)
+ if (tabRC >= 0)
+ {
+ focusTabID = tabRC;
targetChip->setImage(fv->getView(focusTabID), FITS_FOCUS);
+ }
else
emit newExposureValue(targetChip, 0, IPS_ALERT);
break;
case FITS_GUIDE:
if (guideTabID == -1)
- guideTabID = fv->addFITS(&fileURL, FITS_GUIDE, captureFilter);
+ tabRC = fv->addFITS(&fileURL, FITS_GUIDE, captureFilter);
else if (fv->updateFITS(&fileURL, guideTabID, captureFilter) == false)
{
fv->removeFITS(guideTabID);
- guideTabID = fv->addFITS(&fileURL, FITS_GUIDE, captureFilter);
+ tabRC = fv->addFITS(&fileURL, FITS_GUIDE, captureFilter);
}
+ else
+ tabRC = guideTabID;
if (guideTabID >= 0)
+ {
+ guideTabID = tabRC;
targetChip->setImage(fv->getView(guideTabID), FITS_GUIDE);
+ }
else
emit newExposureValue(targetChip, 0, IPS_ALERT);
break;
case FITS_CALIBRATE:
if (calibrationTabID == -1)
- calibrationTabID = fv->addFITS(&fileURL, FITS_CALIBRATE, captureFilter);
+ tabRC = fv->addFITS(&fileURL, FITS_CALIBRATE, captureFilter);
else if (fv->updateFITS(&fileURL, calibrationTabID, captureFilter) == false)
{
fv->removeFITS(calibrationTabID);
- calibrationTabID = fv->addFITS(&fileURL, FITS_CALIBRATE, captureFilter);
+ tabRC = fv->addFITS(&fileURL, FITS_CALIBRATE, captureFilter);
}
+ else
+ tabRC = calibrationTabID;
- if (calibrationTabID >= 0)
+ if (tabRC >= 0)
+ {
+ calibrationTabID = tabRC;
targetChip->setImage(fv->getView(calibrationTabID), FITS_CALIBRATE);
+ }
else
-
emit newExposureValue(targetChip, 0, IPS_ALERT);
break;