diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/debian/changelog kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/debian/changelog --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/debian/changelog 2023-12-05 08:44:42.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/debian/changelog 2023-12-11 18:13:04.000000000 +0000 @@ -1,8 +1,8 @@ -kstars-bleeding (6:3.6.8+202312050844~ubuntu22.04.1) jammy; urgency=low +kstars-bleeding (6:3.6.8+202312111813~ubuntu22.04.1) jammy; urgency=low * Auto build. - -- Jasem Mutlaq Tue, 05 Dec 2023 08:44:42 +0000 + -- Jasem Mutlaq Mon, 11 Dec 2023 18:13:04 +0000 kstars-bleeding (6:3.6.8) jammy; urgency=medium diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/debian/git-build-recipe.manifest kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/debian/git-build-recipe.manifest --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/debian/git-build-recipe.manifest 2023-12-05 08:44:42.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/debian/git-build-recipe.manifest 2023-12-11 18:13:04.000000000 +0000 @@ -1,3 +1,3 @@ -# git-build-recipe format 0.4 deb-version {debversion}+202312050844 -lp:~mutlaqja/kstars-bleeding/+git/kstars-master git-commit:d56a0c6484713070c82b9a2ce1eb7b922e0b4caf -nest-part packaging lp:~mutlaqja/kstars-bleeding/+git/kstars-master packaging/linux/debian debian git-commit:d56a0c6484713070c82b9a2ce1eb7b922e0b4caf +# git-build-recipe format 0.4 deb-version {debversion}+202312111813 +lp:~mutlaqja/kstars-bleeding/+git/kstars-master git-commit:87d93bb90433502cbded22cead343cde53a5c722 +nest-part packaging lp:~mutlaqja/kstars-bleeding/+git/kstars-master packaging/linux/debian debian git-commit:87d93bb90433502cbded22cead343cde53a5c722 diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/align/align.cpp kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/align/align.cpp --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/align/align.cpp 2023-12-05 08:44:39.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/align/align.cpp 2023-12-11 18:13:00.000000000 +0000 @@ -3319,6 +3319,10 @@ { fv = KStars::Instance()->createFITSViewer(); fv->loadData(m_ImageData, url, &lastFVTabID); + connect(fv.get(), &FITSViewer::terminated, this, [this]() + { + fv.clear(); + }); } else if (fv->updateData(m_ImageData, url, lastFVTabID, &lastFVTabID) == false) fv->loadData(m_ImageData, url, &lastFVTabID); diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/analyze/analyze.cpp kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/analyze/analyze.cpp --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/analyze/analyze.cpp 2023-12-05 08:44:39.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/analyze/analyze.cpp 2023-12-11 18:13:00.000000000 +0000 @@ -2433,9 +2433,10 @@ { fitsViewer = KStars::Instance()->createFITSViewer(); fitsViewer->loadFile(url); - // FITSView *currentView = fitsViewer->getCurrentView(); - // if (currentView) - // currentView->getImageData()->setAutoRemoveTemporaryFITS(false); + connect(fitsViewer.get(), &FITSViewer::terminated, this, [this]() + { + fitsViewer.clear(); + }); } else fitsViewer->updateFile(url, 0); diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/capture/capture.cpp kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/capture/capture.cpp --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/capture/capture.cpp 2023-12-05 08:44:39.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/capture/capture.cpp 2023-12-11 18:13:00.000000000 +0000 @@ -717,13 +717,13 @@ // Make sure we have a valid chip and valid base device. // Make sure we are not in capture process. auto camera = activeCamera(); - - if (!camera) - return; - - ISD::CameraChip *targetChip = devices()->getActiveChip(); - if (!targetChip || !targetChip->getCCD() || targetChip->isCapturing()) + auto targetChip = devices()->getActiveChip(); + // If camera is restarted, try again in one second + if (!camera || !targetChip || !targetChip->getCCD() || targetChip->isCapturing()) + { + QTimer::singleShot(1000, this, &Capture::refreshCameraSettings); return; + } if (camera->hasCoolerControl()) { diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/capture/captureprocess.cpp kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/capture/captureprocess.cpp --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/capture/captureprocess.cpp 2023-12-05 08:44:39.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/capture/captureprocess.cpp 2023-12-11 18:13:00.000000000 +0000 @@ -166,6 +166,10 @@ devices()->setActiveCamera(device); + // If we capturing, then we need to process capture timeout immediately since this is a crash recovery + if (state()->getCaptureTimeout().isActive() && state()->getCaptureState() == CAPTURE_CAPTURING) + QTimer::singleShot(100, this, &CaptureProcess::processCaptureTimeout); + return true; } @@ -645,6 +649,14 @@ return; } + // Double check all pointers are valid. + if (!activeCamera() || !devices()->getActiveChip()) + { + checkCamera(); + QTimer::singleShot(1000, this, &CaptureProcess::executeJob); + return; + } + QList FITSHeaders; if (Options::defaultObserver().isEmpty() == false) FITSHeaders.append(FITSData::Record("Observer", Options::defaultObserver(), "Observer")); @@ -658,7 +670,6 @@ // Update button status state()->setBusy(true); - state()->setUseGuideHead((devices()->getActiveChip()->getType() == ISD::CameraChip::PRIMARY_CCD) ? false : true); @@ -840,7 +851,7 @@ // Since this function is looping while pending tasks are running in parallel // it might happen that one of them leads to abort() which sets the #activeJob() to nullptr. // In this case we terminate the loop by returning #IPS_IDLE without starting a new capture. - SequenceJob *theJob = activeJob(); + auto theJob = activeJob(); if (theJob == nullptr) return IPS_IDLE; @@ -1751,9 +1762,16 @@ void CaptureProcess::checkCamera() { // Do not update any camera settings while capture is in progress. - if (state()->getCaptureState() == CAPTURE_CAPTURING || !activeCamera()) + if (state()->getCaptureState() == CAPTURE_CAPTURING) return; + // If camera is restarted, try again in 1 second + if (!activeCamera()) + { + QTimer::singleShot(1000, this, &CaptureProcess::checkCamera); + return; + } + devices()->setActiveChip(nullptr); // FIXME TODO fix guide head detection @@ -1797,7 +1815,7 @@ if (activeCamera() && activeCamera()->getDeviceName() == camera) { // Set camera again to the one we restarted - CaptureState rememberState = state()->getCaptureState(); + auto rememberState = state()->getCaptureState(); state()->setCaptureState(CAPTURE_IDLE); checkCamera(); state()->setCaptureState(rememberState); @@ -1870,6 +1888,7 @@ { activeCamera()->disconnect(this); devices()->setActiveCamera(nullptr); + devices()->setActiveChip(nullptr); QSharedPointer generic; if (INDIListener::findDevice(name, generic)) @@ -1877,7 +1896,7 @@ QTimer::singleShot(1000, this, [this]() { - emit refreshCameraSettings(); + checkCamera(); }); } @@ -1925,11 +1944,17 @@ // Double check that m_Camera is valid in case it was reset due to driver restart. if (activeCamera() && activeJob()) { + setCamera(true); emit newLog(i18n("Exposure timeout. Restarting exposure...")); activeCamera()->setEncodingFormat("FITS"); - ISD::CameraChip *targetChip = activeCamera()->getChip(state()->useGuideHead() ? - ISD::CameraChip::GUIDE_CCD : - ISD::CameraChip::PRIMARY_CCD); + auto rememberState = state()->getCaptureState(); + state()->setCaptureState(CAPTURE_IDLE); + checkCamera(); + state()->setCaptureState(rememberState); + + auto targetChip = activeCamera()->getChip(state()->useGuideHead() ? + ISD::CameraChip::GUIDE_CCD : + ISD::CameraChip::PRIMARY_CCD); targetChip->abortExposure(); const double exptime = activeJob()->getCoreProperty(SequenceJob::SJ_Exposure).toDouble(); targetChip->capture(exptime); @@ -2247,16 +2272,17 @@ auto activeFilter = activeDevices->findWidgetByName("ACTIVE_FILTER"); if (activeFilter) { + QString activeFilterText = QString(activeFilter->getText()); if (devices()->filterWheel()) { - if (activeFilter->getText() != devices()->filterWheel()->getDeviceName()) + if (activeFilterText != devices()->filterWheel()->getDeviceName()) { activeFilter->setText(devices()->filterWheel()->getDeviceName().toLatin1().constData()); oneDevice->sendNewProperty(activeDevices); } } // Reset filter name in CCD driver - else if (QString(activeFilter->getText()).isEmpty()) + else if (activeFilterText.isEmpty()) { // Add debug info since this issue is reported by users. Need to know when it happens. qCDebug(KSTARS_EKOS_CAPTURE) << "No active filter wheel. " << oneDevice->getDeviceName() << " ACTIVE_FILTER is reset."; @@ -2546,12 +2572,10 @@ if (connection) { // TODO: do not simply forward the newExposureValue - connect(activeCamera(), &ISD::Camera::newExposureValue, this, - &CaptureProcess::setExposureProgress, Qt::UniqueConnection); + connect(activeCamera(), &ISD::Camera::newExposureValue, this, &CaptureProcess::setExposureProgress, Qt::UniqueConnection); connect(activeCamera(), &ISD::Camera::newImage, this, &CaptureProcess::processFITSData, Qt::UniqueConnection); connect(activeCamera(), &ISD::Camera::newRemoteFile, this, &CaptureProcess::processNewRemoteFile, Qt::UniqueConnection); - //connect(m_Camera, &ISD::Camera::previewFITSGenerated, this, &Capture::setGeneratedPreviewFITS, Qt::UniqueConnection); - connect(activeCamera(), &ISD::Camera::ready, this, &CaptureProcess::cameraReady); + connect(activeCamera(), &ISD::Camera::ready, this, &CaptureProcess::cameraReady, Qt::UniqueConnection); } else { diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/capture/placeholderpath.cpp kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/capture/placeholderpath.cpp --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/capture/placeholderpath.cpp 2023-12-05 08:44:39.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/capture/placeholderpath.cpp 2023-12-11 18:13:00.000000000 +0000 @@ -217,7 +217,7 @@ const bool gettingSignature) { QMap pathPropertyMap; - setGenerateFilenameSettings(job, pathPropertyMap, local); + setGenerateFilenameSettings(job, pathPropertyMap, local, gettingSignature); return generateFilenameInternal(pathPropertyMap, local, batch_mode, nextSequenceID, extension, filename, glob, gettingSignature); @@ -475,7 +475,7 @@ } void PlaceholderPath::setGenerateFilenameSettings(const SequenceJob &job, QMap &pathPropertyMap, - bool local) + const bool local, const bool gettingSignature) { setPathProperty(pathPropertyMap, PP_TARGETNAME, job.getCoreProperty(SequenceJob::SJ_TargetName)); setPathProperty(pathPropertyMap, PP_FRAMETYPE, QVariant(job.getFrameType())); @@ -493,21 +493,21 @@ // handle optional parameters if (job.getCoreProperty(SequenceJob::SJ_EnforceTemperature).toBool()) setPathProperty(pathPropertyMap, PP_TEMPERATURE, QVariant(job.getTargetTemperature())); - else if (job.currentTemperature() != Ekos::INVALID_VALUE) + else if (job.currentTemperature() != Ekos::INVALID_VALUE && !gettingSignature) setPathProperty(pathPropertyMap, PP_TEMPERATURE, QVariant(job.currentTemperature())); else pathPropertyMap.remove(PP_TEMPERATURE); if (job.getCoreProperty(SequenceJob::SequenceJob::SJ_Gain).toInt() >= 0) setPathProperty(pathPropertyMap, PP_GAIN, job.getCoreProperty(SequenceJob::SJ_Gain)); - else if (job.currentGain() >= 0) + else if (job.currentGain() >= 0 && !gettingSignature) setPathProperty(pathPropertyMap, PP_GAIN, job.currentGain()); else pathPropertyMap.remove(PP_GAIN); if (job.getCoreProperty(SequenceJob::SequenceJob::SJ_Offset).toInt() >= 0) setPathProperty(pathPropertyMap, PP_OFFSET, job.getCoreProperty(SequenceJob::SJ_Offset)); - else if (job.currentOffset() >= 0) + else if (job.currentOffset() >= 0 && !gettingSignature) setPathProperty(pathPropertyMap, PP_OFFSET, job.currentOffset()); else pathPropertyMap.remove(PP_OFFSET); @@ -573,6 +573,59 @@ return getCompletedFileIds(job).length(); } +int PlaceholderPath::getCompletedFiles(const QString &path) +{ + int seqFileCount = 0; +#ifdef Q_OS_WIN + // Splitting directory and baseName in QFileInfo does not distinguish regular expression backslash from directory separator on Windows. + // So do not use QFileInfo for the code that separates directory and basename for Windows. + // Conditions for calling this function: + // - Directory separators must always be "/". + // - Directory separators must not contain backslash. + QString sig_dir; + QString sig_file; + int index = path.lastIndexOf('/'); + if (0 <= index) + { + // found '/'. path has both dir and filename + sig_dir = path.left(index); + sig_file = path.mid(index + 1); + } // not found '/'. path has only filename + else + { + sig_file = path; + } + // remove extension + index = sig_file.lastIndexOf('.'); + if (0 <= index) + { + // found '.', then remove extension + sig_file = sig_file.left(index); + } + qCDebug(KSTARS_EKOS_SCHEDULER) << "Scheduler::getCompletedFiles path:" << path << " sig_dir:" << sig_dir << " sig_file:" << + sig_file; +#else + QFileInfo const path_info(path); + QString const sig_dir(path_info.dir().path()); + QString const sig_file(path_info.completeBaseName()); +#endif + QRegularExpression re(sig_file); + + QDirIterator it(sig_dir, QDir::Files); + + /* FIXME: this counts all files with prefix in the storage location, not just captures. DSS analysis files are counted in, for instance. */ + while (it.hasNext()) + { + QString const fileName = QFileInfo(it.next()).completeBaseName(); + + QRegularExpressionMatch match = re.match(fileName); + if (match.hasMatch()) + seqFileCount++; + } + + return seqFileCount; +} + int PlaceholderPath::checkSeqBoundary(const SequenceJob &job) { auto ids = getCompletedFileIds(job); diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/capture/placeholderpath.h kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/capture/placeholderpath.h --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/capture/placeholderpath.h 2023-12-05 08:44:39.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/capture/placeholderpath.h 2023-12-11 18:13:00.000000000 +0000 @@ -115,7 +115,7 @@ */ void setGenerateFilenameSettings(const SequenceJob &job) { - setGenerateFilenameSettings(job, m_PathPropertyMap, true); + setGenerateFilenameSettings(job, m_PathPropertyMap, true, false); } /** @@ -140,6 +140,11 @@ int getCompletedFiles(const SequenceJob &job); /** + * @brief getCompletedFiles determines the number of files matching the given path pattern + */ + static int getCompletedFiles(const QString &path); + + /** * @brief checkSeqBoundary provides the ID to use for the next file * @param sequence job to be processed * @return number for the next fileIDs @@ -187,12 +192,16 @@ const QString &filename, const bool glob = false, const bool gettingSignature = false) const; /** - * @brief setGenerateFilenameSettings Generate property map from job settings + * @brief setGenerateFilenameSettings Generate property map from job settings. In case that gettingSignature is set to true, + * only explicitly defined parameters from the job's core properties are filled. This is necessary for a proper cooperation with the + * scheduler, that generates signatures for captured files without proper knowledge of the involved camera and therefore has no ability + * to fill core properties from camera values. In all other cases, missing properties are filled from current camera values. * @param job sequence job holding the attributes * @param pathPropertyMap property map to be filled * @param local set true if local file directory should be used + * @param is this parameter setting for generating a signature? */ - void setGenerateFilenameSettings(const SequenceJob &job, QMap &pathPropertyMap, bool local); + void setGenerateFilenameSettings(const SequenceJob &job, QMap &pathPropertyMap, const bool local, const bool gettingSignature = false); /** * @brief generateReplacement Generate the replacement for the given property. if usePattern diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/focus/focus.cpp kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/focus/focus.cpp --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/focus/focus.cpp 2023-12-05 08:44:39.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/focus/focus.cpp 2023-12-11 18:13:00.000000000 +0000 @@ -4757,6 +4757,10 @@ { fv = KStars::Instance()->createFITSViewer(); fv->loadData(m_ImageData, url, &lastFVTabID); + connect(fv.get(), &FITSViewer::terminated, this, [this]() + { + fv.clear(); + }); } else if (fv->updateData(m_ImageData, url, lastFVTabID, &lastFVTabID) == false) fv->loadData(m_ImageData, url, &lastFVTabID); diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/guide/guide.cpp kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/guide/guide.cpp --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/guide/guide.cpp 2023-12-05 08:44:39.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/guide/guide.cpp 2023-12-11 18:13:00.000000000 +0000 @@ -352,6 +352,11 @@ checkCamera(); configurePHD2Camera(); + + // In case we are recovering from a crash and capture is pending, process it immediately. + if (captureTimeout.isActive() && m_State >= Ekos::GUIDE_CAPTURE) + QTimer::singleShot(100, this, &Guide::processCaptureTimeout); + return true; } @@ -489,10 +494,9 @@ return; } - checkUseGuideHead(); - ISD::CameraChip *targetChip = m_Camera->getChip(useGuideHead ? ISD::CameraChip::GUIDE_CCD : ISD::CameraChip::PRIMARY_CCD); + auto targetChip = m_Camera->getChip(useGuideHead ? ISD::CameraChip::GUIDE_CCD : ISD::CameraChip::PRIMARY_CCD); if (!targetChip) { qCCritical(KSTARS_EKOS_GUIDE) << "Failed to retrieve active guide chip in camera"; @@ -913,6 +917,9 @@ ISD::CameraChip *targetChip = m_Camera->getChip(useGuideHead ? ISD::CameraChip::GUIDE_CCD : ISD::CameraChip::PRIMARY_CCD); targetChip->abortExposure(); prepareCapture(targetChip); + connect(m_Camera, &ISD::Camera::newImage, this, &Ekos::Guide::processData, Qt::UniqueConnection); + connect(m_Camera, &ISD::Camera::propertyUpdated, this, &Ekos::Guide::updateProperty, Qt::UniqueConnection); + connect(m_Camera, &ISD::Camera::newExposureValue, this, &Ekos::Guide::checkExposureValue, Qt::UniqueConnection); targetChip->capture(guideExposure->value()); captureTimeout.start(guideExposure->value() * 1000 + CAPTURE_TIMEOUT_THRESHOLD); }; @@ -952,7 +959,6 @@ }); return; } - else restartExposure(); } @@ -2485,6 +2491,10 @@ { fv = KStars::Instance()->createFITSViewer(); fv->loadData(m_ImageData, url, &lastFVTabID); + connect(fv.get(), &FITSViewer::terminated, this, [this]() + { + fv.clear(); + }); } else if (fv->updateData(m_ImageData, url, lastFVTabID, &lastFVTabID) == false) fv->loadData(m_ImageData, url, &lastFVTabID); diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/scheduler/scheduler.cpp kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/scheduler/scheduler.cpp --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/scheduler/scheduler.cpp 2023-12-05 08:44:39.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/scheduler/scheduler.cpp 2023-12-11 18:13:00.000000000 +0000 @@ -3497,7 +3497,7 @@ } /* Else recount captures already stored */ - newFramesCount[signature] = getCompletedFiles(signature); + newFramesCount[signature] = PlaceholderPath::getCompletedFiles(signature); } // determine whether we need to continue capturing, depending on captured frames @@ -4119,59 +4119,6 @@ return job; } -int Scheduler::getCompletedFiles(const QString &path) -{ - int seqFileCount = 0; -#ifdef Q_OS_WIN - // Splitting directory and baseName in QFileInfo does not distinguish regular expression backslash from directory separator on Windows. - // So do not use QFileInfo for the code that separates directory and basename for Windows. - // Conditions for calling this function: - // - Directory separators must always be "/". - // - Directory separators must not contain backslash. - QString sig_dir; - QString sig_file; - int index = path.lastIndexOf('/'); - if (0 <= index) - { - // found '/'. path has both dir and filename - sig_dir = path.left(index); - sig_file = path.mid(index + 1); - } // not found '/'. path has only filename - else - { - sig_file = path; - } - // remove extension - index = sig_file.lastIndexOf('.'); - if (0 <= index) - { - // found '.', then remove extension - sig_file = sig_file.left(index); - } - qCDebug(KSTARS_EKOS_SCHEDULER) << "Scheduler::getCompletedFiles path:" << path << " sig_dir:" << sig_dir << " sig_file:" << - sig_file; -#else - QFileInfo const path_info(path); - QString const sig_dir(path_info.dir().path()); - QString const sig_file(path_info.completeBaseName()); -#endif - QRegularExpression re(sig_file); - - QDirIterator it(sig_dir, QDir::Files); - - /* FIXME: this counts all files with prefix in the storage location, not just captures. DSS analysis files are counted in, for instance. */ - while (it.hasNext()) - { - QString const fileName = QFileInfo(it.next()).completeBaseName(); - - QRegularExpressionMatch match = re.match(fileName); - if (match.hasMatch()) - seqFileCount++; - } - - return seqFileCount; -} - void Scheduler::setINDICommunicationStatus(Ekos::CommunicationStatus status) { TEST_PRINT(stderr, "sch%d @@@dbus(%s): %d\n", __LINE__, "ekosInterface:indiStatusChanged", status); diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/scheduler/scheduler.h kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/scheduler/scheduler.h --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/ekos/scheduler/scheduler.h 2023-12-05 08:44:39.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/ekos/scheduler/scheduler.h 2023-12-11 18:13:00.000000000 +0000 @@ -667,8 +667,6 @@ SchedulerJob &schedJob, SchedulerJob::CapturedFramesMap &capture_map, int &completedIterations); - int getCompletedFiles(const QString &path); - // Returns true if the job is storing its captures on the same machine as the scheduler. bool canCountCaptures(const SchedulerJob &job); diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/indi/servermanager.cpp kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/indi/servermanager.cpp --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/indi/servermanager.cpp 2023-12-05 08:44:39.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/indi/servermanager.cpp 2023-12-11 18:13:00.000000000 +0000 @@ -286,20 +286,23 @@ void ServerManager::stopDriver(const QSharedPointer &driver) { QTextStream out(&indiFIFO); + const auto exec = driver->getExecutable(); - qCDebug(KSTARS_INDI) << "Stopping INDI Driver " << driver->getExecutable(); + qCDebug(KSTARS_INDI) << "Stopping INDI Driver " << exec; if (driver->getUniqueLabel().isEmpty() == false) - out << "stop " << driver->getExecutable() << " -n \"" << driver->getUniqueLabel() << "\""; + out << "stop " << exec << " -n \"" << driver->getUniqueLabel() << "\""; else - out << "stop " << driver->getExecutable(); + out << "stop " << exec; out << Qt::endl; out.flush(); driver->setServerState(false); driver->setPort(driver->getUserPort()); - m_ManagedDrivers.removeOne(driver); - + m_ManagedDrivers.erase(std::remove_if(m_ManagedDrivers.begin(), m_ManagedDrivers.end(), [exec](const auto & driver) + { + return driver->getExecutable() == exec; + })); emit driverStopped(driver); } @@ -307,6 +310,7 @@ bool ServerManager::restartDriver(const QSharedPointer &driver) { auto cm = driver->getClientManager(); + const auto label = driver->getLabel(); if (cm) { @@ -320,11 +324,19 @@ else { cm = DriverManager::Instance()->getClientManager(driver); + const auto exec = driver->getExecutable(); + m_ManagedDrivers.erase(std::remove_if(m_ManagedDrivers.begin(), m_ManagedDrivers.end(), [exec](const auto & driver) + { + return driver->getExecutable() == exec; + })); } // Wait 1 second before starting the driver again. - QTimer::singleShot(1000, this, [this, driver, cm]() + QTimer::singleShot(1000, this, [this, label, cm]() { + auto driver = DriverManager::Instance()->findDriverByLabel(label); + if (!driver) + return; cm->appendManagedDriver(driver); if (m_ManagedDrivers.contains(driver) == false) m_ManagedDrivers.append(driver); diff -Nru kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/kstars.cpp kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/kstars.cpp --- kstars-bleeding-3.6.8+202312050844~ubuntu22.04.1/kstars/kstars.cpp 2023-12-05 08:44:39.000000000 +0000 +++ kstars-bleeding-3.6.8+202312111813~ubuntu22.04.1/kstars/kstars.cpp 2023-12-11 18:13:00.000000000 +0000 @@ -598,9 +598,13 @@ { QSharedPointer newFITSViewer(new FITSViewer(Options::independentWindowFITS() ? nullptr : KStars::Instance())); m_FITSViewers.append(newFITSViewer); - connect(newFITSViewer.get(), &FITSViewer::terminated, this, [ & ]() + connect(newFITSViewer.get(), &FITSViewer::terminated, this, [this]() { - m_FITSViewers.removeOne(newFITSViewer); + auto rawPointer = dynamic_cast(sender()); + m_FITSViewers.erase(std::remove_if(m_FITSViewers.begin(), m_FITSViewers.end(), [rawPointer](auto & viewer) + { + return viewer.get() == rawPointer; + })); }); return m_FITSViewers.constLast(); }