summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-11-08 08:30:50 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-11-08 08:30:50 (GMT)
commitcead4ef99dbe3d17cf0db5c00f3820a353abeb6d (patch)
treed631c07d31779ea65bbeef405a6d1dbada42e891
parente7271785ddcbde7a73ef536591fc6608e113b92b (diff)
Ensure box size combo index >= 0
-rw-r--r--kstars/ekos/guide/guide.cpp18
-rw-r--r--kstars/ekos/guide/guide.h1
2 files changed, 10 insertions, 9 deletions
diff --git a/kstars/ekos/guide/guide.cpp b/kstars/ekos/guide/guide.cpp
index eb20059..c17b790 100644
--- a/kstars/ekos/guide/guide.cpp
+++ b/kstars/ekos/guide/guide.cpp
@@ -1322,7 +1322,9 @@ void Guide::syncTrackingBoxPosition()
// If box size is larger than image size, set it to lower index
if (boxSize/subBinX >= w || boxSize/subBinY >= h)
{
- boxSizeCombo->setCurrentIndex(boxSizeCombo->currentIndex()-1);
+ int newIndex = boxSizeCombo->currentIndex()-1;
+ if (newIndex >= 0)
+ boxSizeCombo->setCurrentIndex(newIndex);
return;
}
@@ -1459,9 +1461,11 @@ bool Guide::setGuiderType(int type)
void Guide::updateTrackingBoxSize(int currentIndex)
{
- Options::setGuideSquareSizeIndex(currentIndex);
-
- syncTrackingBoxPosition();
+ if (currentIndex >= 0)
+ {
+ Options::setGuideSquareSizeIndex(currentIndex);
+ syncTrackingBoxPosition();
+ }
}
bool Guide::selectAutoStar()
@@ -1989,12 +1993,10 @@ bool Guide::executeOneOperation(GuideState operation)
// Do not subframe if we are capturing calibration frame
if (subFramed == false && Options::guideSubframeEnabled() == true && targetChip->canSubframe())
{
- int minX, maxX, minY, maxY, minW, maxW, minH, maxH;//, fx,fy,fw,fh;
+ int minX, maxX, minY, maxY, minW, maxW, minH, maxH;
targetChip->getFrameMinMax(&minX, &maxX, &minY, &maxY, &minW, &maxW, &minH, &maxH);
- int offset = boxSizeCombo->currentText().toInt()/subBinX;
- //int x = guideView->getTrackingBox().x() + guideView->getTrackingBox().width()/2;
- //int y = guideView->getTrackingBox().y() + guideView->getTrackingBox().height()/2;
+ int offset = boxSizeCombo->currentText().toInt()/subBinX;
int x = starCenter.x();
int y = starCenter.y();
diff --git a/kstars/ekos/guide/guide.h b/kstars/ekos/guide/guide.h
index cbfe329..9b276b3 100644
--- a/kstars/ekos/guide/guide.h
+++ b/kstars/ekos/guide/guide.h
@@ -195,7 +195,6 @@ public:
QVector3D getStarPosition() { return starCenter; }
// Tracking Box
- void setTrackingBoxSize(int index) { boxSizeCombo->setCurrentIndex(index); }
int getTrackingBoxSize() { return boxSizeCombo->currentText().toInt(); }
//void startRapidGuide();