diff --git a/Tests/kstars_ui/test_ekos.cpp b/Tests/kstars_ui/test_ekos.cpp --- a/Tests/kstars_ui/test_ekos.cpp +++ b/Tests/kstars_ui/test_ekos.cpp @@ -133,20 +133,18 @@ { QTest::mouseClick(b, Qt::LeftButton); }); - QWARN("Intentionally leaving a delay here for BZ398192"); - QTest::qWait(5000); // --------- Fifth step: waiting for Ekos to finish stopping // Start button that became a stop button has to be available - QTRY_VERIFY_WITH_TIMEOUT(startEkos->isEnabled(), 7000); + QTRY_VERIFY_WITH_TIMEOUT(startEkos->isEnabled(), 10000); // Hang INDI client up QTimer::singleShot(200, ekos, [&] { QTest::mouseClick(startEkos, Qt::LeftButton); }); - QTRY_VERIFY_WITH_TIMEOUT(!buttonReadyToStart.compare(startEkos->icon().name()), 7000); + QTRY_VERIFY_WITH_TIMEOUT(!buttonReadyToStart.compare(startEkos->icon().name()), 10000); } void TestEkos::testManipulateProfiles() diff --git a/Tests/kstars_ui/test_ekos_focus.h b/Tests/kstars_ui/test_ekos_focus.h --- a/Tests/kstars_ui/test_ekos_focus.h +++ b/Tests/kstars_ui/test_ekos_focus.h @@ -62,7 +62,8 @@ * @warning Fails the test if the exposure cannot be entered or if the capture button is * disabled or does not toggle during exposure or if the stop button is not the opposite of the capture button. */ -#define KTRY_FOCUS_CAPTURE(exposure, averaged) do { \ +/** @{ */ +#define KTRY_FOCUS_DETECT(exposure, averaged) do { \ KTRY_FOCUS_GADGET(QDoubleSpinBox, exposureIN); \ exposureIN->setValue(exposure); \ KTRY_FOCUS_GADGET(QSpinBox, focusFramesSpin); \ @@ -73,10 +74,11 @@ QTRY_VERIFY_WITH_TIMEOUT(!stopFocusB->isEnabled(), 1000); \ KTRY_FOCUS_CLICK(captureB); \ QTRY_VERIFY_WITH_TIMEOUT(!captureB->isEnabled(), 1000); \ - QTRY_VERIFY_WITH_TIMEOUT(stopFocusB->isEnabled(), 1000); \ - QTest::qWait(1.2*exposure*averaged); \ + QVERIFY(stopFocusB->isEnabled()); \ + QTest::qWait(exposure*averaged*1000); \ QTRY_VERIFY_WITH_TIMEOUT(captureB->isEnabled(), 5000); \ - QTRY_VERIFY_WITH_TIMEOUT(!stopFocusB->isEnabled(), 5000); } while (false) + QVERIFY(!stopFocusB->isEnabled()); } while (false) +/** @} */ /** brief Helper to configure main star detection parameters. * @param detection is the name of the star detection method to use. @@ -87,7 +89,7 @@ */ #define KTRY_FOCUS_CONFIGURE(detection, algorithm, fieldin, fieldout) do { \ KTRY_FOCUS_GADGET(QCheckBox, useFullField); \ - useFullField->setCheckState(Qt::CheckState::Checked); \ + useFullField->setCheckState(fieldin < fieldout ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); \ KTRY_FOCUS_GADGET(QDoubleSpinBox, fullFieldInnerRing); \ fullFieldInnerRing->setValue(fieldin); \ KTRY_FOCUS_GADGET(QDoubleSpinBox, fullFieldOuterRing); \ diff --git a/Tests/kstars_ui/test_ekos_focus.cpp b/Tests/kstars_ui/test_ekos_focus.cpp --- a/Tests/kstars_ui/test_ekos_focus.cpp +++ b/Tests/kstars_ui/test_ekos_focus.cpp @@ -125,53 +125,48 @@ // Run the focus procedure for SEP KTRY_FOCUS_CONFIGURE("SEP", "Iterative", 0.0, 100.0); - KTRY_FOCUS_CAPTURE(1, 1); - QWARN("No way to know when star detection procedure is fininshed."); - QTest::qWait(1000); + KTRY_FOCUS_DETECT(1, 3); QTRY_VERIFY_WITH_TIMEOUT(starsOut->text().toInt() >= 1, 5000); // Run the focus procedure for Centroid KTRY_FOCUS_CONFIGURE("Centroid", "Iterative", 0.0, 100.0); - KTRY_FOCUS_CAPTURE(1, 1); - QWARN("No way to know when star detection procedure is fininshed."); - QTest::qWait(1000); + KTRY_FOCUS_DETECT(1, 3); QTRY_VERIFY_WITH_TIMEOUT(starsOut->text().toInt() >= 1, 5000); - // Run the focus procedure for Threshold - KTRY_FOCUS_CONFIGURE("Threshold", "Iterative", 0.0, 100.0); - KTRY_FOCUS_CAPTURE(1, 1); - QWARN("No way to know when procedure is fininshed."); - QTest::qWait(1000); + // Run the focus procedure for Threshold - disable full-field + KTRY_FOCUS_CONFIGURE("Threshold", "Iterative", 0.0, 0.0); + KTRY_FOCUS_DETECT(1, 3); QTRY_VERIFY_WITH_TIMEOUT(starsOut->text().toInt() >= 1, 5000); - // Run the focus procedure for Gradient - KTRY_FOCUS_CONFIGURE("Gradient", "Iterative", 0.0, 100.0); - KTRY_FOCUS_CAPTURE(1, 1); - QWARN("No way to know when procedure is fininshed."); - QTest::qWait(1000); + // Run the focus procedure for Gradient - disable full-field + KTRY_FOCUS_CONFIGURE("Gradient", "Iterative", 0.0, 0.0); + KTRY_FOCUS_DETECT(1, 3); + QTRY_VERIFY_WITH_TIMEOUT(starsOut->text().toInt() >= 1, 5000); + + // Longer exposure + KTRY_FOCUS_CONFIGURE("SEP", "Iterative", 0.0, 100.0); + KTRY_FOCUS_DETECT(8, 1); QTRY_VERIFY_WITH_TIMEOUT(starsOut->text().toInt() >= 1, 5000); // Run the focus procedure again to cover more code // Filtering annulus is independent of the detection method // Run the HFR average over three frames with SEP to avoid - for (double inner = 0.0; inner < 100.0; inner += 23.0) + for (double inner = 0.0; inner < 100.0; inner += 43.0) { - for (double outer = 100.0; inner < outer; outer -= 22.0) + for (double outer = 100.0; inner < outer; outer -= 42.0) { KTRY_FOCUS_CONFIGURE("SEP", "Iterative", inner, outer); - KTRY_FOCUS_CAPTURE(0.5, 5); - QTest::qWait(1000); + KTRY_FOCUS_DETECT(0.1, 2); } } - // Test threshold + // Test threshold - disable full-field for (double threshold = 80.0; threshold < 200.0; threshold += 13.3) { KTRY_FOCUS_GADGET(QDoubleSpinBox, thresholdSpin); thresholdSpin->setValue(threshold); - KTRY_FOCUS_CONFIGURE("Threshold", "Iterative", 0, 100.0); - KTRY_FOCUS_CAPTURE(0.5, 1); - QTest::qWait(1000); + KTRY_FOCUS_CONFIGURE("Threshold", "Iterative", 0, 0.0); + KTRY_FOCUS_DETECT(0.1, 1); } #endif } diff --git a/kstars/ekos/focus/focus.cpp b/kstars/ekos/focus/focus.cpp --- a/kstars/ekos/focus/focus.cpp +++ b/kstars/ekos/focus/focus.cpp @@ -1033,6 +1033,7 @@ setCaptureComplete(); else abort(); + resetButtons(); }); connect(DarkLibrary::Instance(), &DarkLibrary::newLog, this, &Ekos::Focus::appendLogText); @@ -1049,6 +1050,7 @@ } setCaptureComplete(); + resetButtons(); } double Focus::analyzeSources(FITSData *image_data) @@ -1058,7 +1060,7 @@ // a bounding box for them to be effective in near real-time application. if (Options::focusUseFullField()) { - Q_ASSERT_X(focusView->getTrackingBox().isNull(), __FUNCTION__, "Tracking box is disabled when detecting in full-field"); + focusView->setTrackingBoxEnabled(false); if (focusDetection != ALGORITHM_CENTROID && focusDetection != ALGORITHM_SEP) focusView->findStars(ALGORITHM_CENTROID); @@ -1165,13 +1167,8 @@ if (inFocusLoop == false) appendLogText(i18n("Image received.")); - // If we're not looping and not in autofocus, enable user to capture again. if (captureInProgress && inFocusLoop == false && inAutoFocus == false) - { - captureB->setEnabled(true); - stopFocusB->setEnabled(false); currentCCD->setUploadMode(rememberUploadMode); - } if (rememberCCDExposureLooping) currentCCD->setExposureLoopingEnabled(true); diff --git a/kstars/ekos/focus/focus.ui b/kstars/ekos/focus/focus.ui --- a/kstars/ekos/focus/focus.ui +++ b/kstars/ekos/focus/focus.ui @@ -1113,7 +1113,7 @@ - <html><head/><body><p>Select star detection algorithm</p></body></html> + <html><head/><body><p>Star detection method:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">SEP:</span> Source Extractor and Photometry, an efficient source detection method based on Source Extractor (Bertin and Arnouts 1996; Bertin 2016). See <a href="https://joss.theoj.org/papers/10.21105/joss.00058.pdf"><span style=" text-decoration: underline; color:#0000ff;">SEP: Source Extractor as a library</span></a> in the Journal of Open Source Software.</li><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Centroid</span>: a source detection based on estimating star mass around signal peaks.</li><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Gradient</span>: a single source detection based on the Sobel filter. Initial or full-field analysis will use SEP instead of this method.</li><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Threshold</span>: a single source detection based on pixel values. Initial or full-field analysis will use SEP instead of this method.</li></ul></body></html> diff --git a/kstars/fitsviewer/fpackutil.c b/kstars/fitsviewer/fpackutil.c --- a/kstars/fitsviewer/fpackutil.c +++ b/kstars/fitsviewer/fpackutil.c @@ -962,20 +962,20 @@ */ int fp_unpack (char *infits, char *outfits, fpstate fpvar) { - fitsfile *infptr, *outfptr; - int stat=0, hdutype, extnum, single = 0; + fitsfile *infptr, *outfptr; + int stat=0, hdutype, extnum, single = 0; char *loc, *hduloc, hduname[SZ_STR]; - fits_open_file (&infptr, infits, READONLY, &stat); - fits_create_file (&outfptr, outfits, &stat); + fits_open_file (&infptr, infits, READONLY, &stat); + fits_create_file (&outfptr, outfits, &stat); if (stat) { fp_abort_output(infptr, outfptr, stat); } - if (fpvar.extname[0]) { /* unpack a list of HDUs? */ + if (fpvar.extname[0]) { /* unpack a list of HDUs? */ - /* move to the first HDU in the list */ + /* move to the first HDU in the list */ hduloc = fpvar.extname; loc = strchr(hduloc, ','); /* look for 'comma' delimiter between names */ @@ -986,107 +986,107 @@ if (loc) hduloc = loc + 1; /* advance to the beginning of the next name, if any */ - else { + else { hduloc += strlen(hduname); /* end of the list */ single = 1; /* only 1 HDU is being unpacked */ - } + } - if (isdigit( (int) hduname[0]) ) { - extnum = strtol(hduname, &loc, 10); /* read the string as an integer */ + if (isdigit( (int) hduname[0]) ) { + extnum = strtol(hduname, &loc, 10); /* read the string as an integer */ - /* check for junk following the integer */ - if (*loc == '\0' ) /* no junk, so move to this HDU number (+1) */ - { - fits_movabs_hdu(infptr, extnum + 1, &hdutype, &stat); /* move to HDU number */ - if (hdutype != IMAGE_HDU) - stat = NOT_IMAGE; + /* check for junk following the integer */ + if (*loc == '\0' ) /* no junk, so move to this HDU number (+1) */ + { + fits_movabs_hdu(infptr, extnum + 1, &hdutype, &stat); /* move to HDU number */ + if (hdutype != IMAGE_HDU) + stat = NOT_IMAGE; - } else { /* the string is not an integer, so must be the column name */ - hdutype = IMAGE_HDU; - fits_movnam_hdu(infptr, hdutype, hduname, 0, &stat); - } + } else { /* the string is not an integer, so must be the column name */ + hdutype = IMAGE_HDU; + fits_movnam_hdu(infptr, hdutype, hduname, 0, &stat); } + } else { - /* move to the named image extension */ + /* move to the named image extension */ hdutype = IMAGE_HDU; fits_movnam_hdu(infptr, hdutype, hduname, 0, &stat); - } } + } - if (stat) { - fp_msg ("Unable to find and move to extension '"); - fp_msg(hduname); - fp_msg("'\n"); - fp_abort_output(infptr, outfptr, stat); - } + if (stat) { + fp_msg ("Unable to find and move to extension '"); + fp_msg(hduname); + fp_msg("'\n"); + fp_abort_output(infptr, outfptr, stat); + } - while (! stat) { + while (! stat) { if (single) stat = -1; /* special status flag to force output primary array */ - fp_unpack_hdu (infptr, outfptr, fpvar, &stat); + fp_unpack_hdu (infptr, outfptr, fpvar, &stat); if (fpvar.do_checksums) { fits_write_chksum (outfptr, &stat); } /* move to the next HDU */ - if (fpvar.extname[0]) { /* unpack a list of HDUs? */ + if (fpvar.extname[0]) { /* unpack a list of HDUs? */ - if (!(*hduloc)) { - stat = END_OF_FILE; /* we reached the end of the list */ - } else { - /* parse the next HDU name and move to it */ + if (!(*hduloc)) { + stat = END_OF_FILE; /* we reached the end of the list */ + } else { + /* parse the next HDU name and move to it */ loc = strchr(hduloc, ','); if (loc) /* look for 'comma' delimiter between names */ - *loc = '\0'; /* terminate the first name in the string */ + *loc = '\0'; /* terminate the first name in the string */ strcpy(hduname, hduloc); /* copy the next name into temporary string */ if (loc) hduloc = loc + 1; /* advance to the beginning of the next name, if any */ - else - *hduloc = '\0'; /* end of the list */ + else + *hduloc = '\0'; /* end of the list */ - if (isdigit( (int) hduname[0]) ) { - extnum = strtol(hduname, &loc, 10); /* read the string as an integer */ + if (isdigit( (int) hduname[0]) ) { + extnum = strtol(hduname, &loc, 10); /* read the string as an integer */ - /* check for junk following the integer */ - if (*loc == '\0' ) /* no junk, so move to this HDU number (+1) */ - { + /* check for junk following the integer */ + if (*loc == '\0' ) /* no junk, so move to this HDU number (+1) */ + { fits_movabs_hdu(infptr, extnum + 1, &hdutype, &stat); /* move to HDU number */ if (hdutype != IMAGE_HDU) - stat = NOT_IMAGE; + stat = NOT_IMAGE; + + } else { /* the string is not an integer, so must be the column name */ + hdutype = IMAGE_HDU; + fits_movnam_hdu(infptr, hdutype, hduname, 0, &stat); + } - } else { /* the string is not an integer, so must be the column name */ + } else { + /* move to the named image extension */ hdutype = IMAGE_HDU; fits_movnam_hdu(infptr, hdutype, hduname, 0, &stat); - } - - } else { - /* move to the named image extension */ - hdutype = IMAGE_HDU; - fits_movnam_hdu(infptr, hdutype, hduname, 0, &stat); - } + } - if (stat) { - fp_msg ("Unable to find and move to extension '"); - fp_msg(hduname); - fp_msg("'\n"); - } + if (stat) { + fp_msg ("Unable to find and move to extension '"); + fp_msg(hduname); + fp_msg("'\n"); } - } else { - /* increment to the next HDU */ - fits_movrel_hdu (infptr, 1, NULL, &stat); } + } else { + /* increment to the next HDU */ + fits_movrel_hdu (infptr, 1, NULL, &stat); } + } - if (stat == END_OF_FILE) stat = 0; + if (stat == END_OF_FILE) stat = 0; - /* set checksum for case of newly created primary HDU + /* set checksum for case of newly created primary HDU */ if (fpvar.do_checksums) { fits_movabs_hdu (outfptr, 1, NULL, &stat); diff --git a/kstars/printing/legend.h b/kstars/printing/legend.h --- a/kstars/printing/legend.h +++ b/kstars/printing/legend.h @@ -87,7 +87,11 @@ * \brief copy constructor * \note This class needs to be explicitly copied because of the m_Painter pointer */ + /** @{ */ explicit Legend(const Legend &o); + Legend& operator=(const Legend &o) noexcept; + /** @} */ + /** * \brief Destructor. diff --git a/kstars/printing/legend.cpp b/kstars/printing/legend.cpp --- a/kstars/printing/legend.cpp +++ b/kstars/printing/legend.cpp @@ -594,3 +594,25 @@ m_XSymbolSpacing(o.m_XSymbolSpacing), m_YSymbolSpacing(o.m_YSymbolSpacing) { } + +Legend& Legend::operator=(const Legend &o) noexcept +{ + m_SkyMap = o.m_SkyMap; + m_DeletePainter = o.m_DeletePainter; + m_Type = o.m_Type; + m_Orientation = o.m_Orientation; + m_Position = o.m_Position; + m_PositionFloating = o.m_PositionFloating; + m_cScheme = o.m_cScheme; + m_Font = o.m_Font; + m_BgColor = o.m_BgColor; + m_DrawFrame = o.m_DrawFrame; + m_SymbolSize = o.m_SymbolSize; + m_BRectWidth = o.m_BRectWidth; + m_BRectHeight = o.m_BRectHeight; + m_MaxHScalePixels = o.m_MaxHScalePixels; + m_MaxVScalePixels = o.m_MaxVScalePixels; + m_XSymbolSpacing = o.m_XSymbolSpacing; + m_YSymbolSpacing = o.m_YSymbolSpacing; + return *this; +} diff --git a/kstars/time/kstarsdatetime.h b/kstars/time/kstarsdatetime.h --- a/kstars/time/kstarsdatetime.h +++ b/kstars/time/kstarsdatetime.h @@ -66,7 +66,10 @@ *@p kdt The KStarsDateTime object to copy. *@note The timespec is copied from kdt. */ + /** @{ */ KStarsDateTime(const KStarsDateTime &kdt); + KStarsDateTime& operator=(const KStarsDateTime &kdt) noexcept; + /** @} */ /** *@short Copy constructor diff --git a/kstars/time/kstarsdatetime.cpp b/kstars/time/kstarsdatetime.cpp --- a/kstars/time/kstarsdatetime.cpp +++ b/kstars/time/kstarsdatetime.cpp @@ -31,11 +31,17 @@ } KStarsDateTime::KStarsDateTime(const KStarsDateTime &kdt) : QDateTime() +{ + *this = kdt; +} + +KStarsDateTime& KStarsDateTime::operator=(const KStarsDateTime &kdt) noexcept { setDJD(kdt.djd()); setTimeSpec(kdt.timeSpec()); //utcoffset deprecated //setUtcOffset(kdt.utcOffset()); + return *this; } /*KStarsDateTime::KStarsDateTime( const QDateTime &kdt ) : diff --git a/kstars/tools/modcalcvizequinox.cpp b/kstars/tools/modcalcvizequinox.cpp --- a/kstars/tools/modcalcvizequinox.cpp +++ b/kstars/tools/modcalcvizequinox.cpp @@ -378,7 +378,7 @@ qreal modCalcEquinox::FindCorrection(uint32_t year) { - int tblFirst = 1620, tblLast = 2002; + uint32_t tblFirst = 1620, tblLast = 2002; // Corrections taken from Meeus -1991 chapter 10 qreal tbl[] = {/*1620*/ 121,112,103, 95, 88, 82, 77, 72, 68, 63, 60, 56, 53, 51, 48, 46, 44, 42, 40, 38,