Kstars
scheduler.cpp
73QString CAPTURE_COUNT_TOOLTIP = i18n("Count of captures stored for the job, based on its sequence job.\n"
130 /* FIXME: Find a way to have multi-line tooltips in the .ui file, then move the widget configuration there - what about i18n? */
133 i18n("Job scheduler list.\nClick to select a job in the list.\nDouble click to edit a job with the left-hand fields."));
143 "If aborted, the Scheduler missed the scheduled time or encountered transitory issues and will reschedule the job.\n"
144 "If complete, the Scheduler verified that all sequence captures requested were stored, including repeats."));
154 completionHeader->setToolTip(i18n("Completion time for the job, as estimated by the Scheduler.\n"
156 "A warning symbol indicates the altitude at completion may cause the job to abort before completion.\n"));
165 i18n("Remove selected job from the observation list.\nJob properties are copied in the edition fields before removal."));
180 i18n("Reset state and sort observation jobs per altitude and movement in sky, using the start time of the first job.\n"
181 "This action sorts setting targets before rising targets, and may help scheduling when starting your observation.\n"
182 "Note the algorithm first calculates all altitudes using the same time, then evaluates jobs."));
221 connect(startupB, &QPushButton::clicked, process().data(), &SchedulerProcess::runStartupProcedure);
222 connect(shutdownB, &QPushButton::clicked, process().data(), &SchedulerProcess::runShutdownProcedure);
230 connect(KStars::Instance()->actionCollection()->action("show_mosaic_panel"), &QAction::triggered, this, [this](bool checked)
246 connect(evaluateOnlyB, &QPushButton::clicked, process().data(), &SchedulerProcess::startJobEvaluation);
248 connect(queueTable->selectionModel(), &QItemSelectionModel::selectionChanged, this, &Scheduler::queueTableSelectionChanged);
286 connect(moduleState().data(), &SchedulerModuleState::ekosStateChanged, this, &Scheduler::ekosStateChanged);
287 connect(moduleState().data(), &SchedulerModuleState::indiStateChanged, this, &Scheduler::indiStateChanged);
288 connect(moduleState().data(), &SchedulerModuleState::schedulerStateChanged, this, &Scheduler::handleSchedulerStateChanged);
289 connect(moduleState().data(), &SchedulerModuleState::startupStateChanged, this, &Scheduler::startupStateChanged);
290 connect(moduleState().data(), &SchedulerModuleState::shutdownStateChanged, this, &Scheduler::shutdownStateChanged);
291 connect(moduleState().data(), &SchedulerModuleState::parkWaitStateChanged, this, &Scheduler::parkWaitStateChanged);
292 connect(moduleState().data(), &SchedulerModuleState::profilesChanged, this, &Scheduler::updateProfiles);
293 connect(moduleState().data(), &SchedulerModuleState::currentPositionChanged, queueTable, &QTableWidget::selectRow);
294 connect(moduleState().data(), &SchedulerModuleState::jobStageChanged, this, &Scheduler::updateJobStageUI);
295 connect(moduleState().data(), &SchedulerModuleState::updateNightTime, this, &Scheduler::updateNightTime);
301 connect(process().data(), &SchedulerProcess::schedulerStopped, this, &Scheduler::schedulerStopped);
302 connect(process().data(), &SchedulerProcess::schedulerPaused, this, &Scheduler::handleSetPaused);
303 connect(process().data(), &SchedulerProcess::shutdownStarted, this, &Scheduler::handleShutdownStarted);
304 connect(process().data(), &SchedulerProcess::schedulerSleeping, this, &Scheduler::handleSchedulerSleeping);
310 connect(process().data(), &SchedulerProcess::changeCurrentSequence, this, &Scheduler::setSequence);
313 connect(process().data(), &SchedulerProcess::syncGreedyParams, this, &Scheduler::syncGreedyParams);
314 connect(process().data(), &SchedulerProcess::syncGUIToGeneralSettings, this, &Scheduler::syncGUIToGeneralSettings);
315 connect(process().data(), &SchedulerProcess::changeSleepLabel, this, &Scheduler::changeSleepLabel);
316 connect(process().data(), &SchedulerProcess::updateSchedulerURL, this, &Scheduler::updateSchedulerURL);
318 connect(process().data(), &SchedulerProcess::newWeatherStatus, this, &Scheduler::setWeatherStatus);
320 //connect(KStarsData::Instance()..., &LocationDialog::locationChanged..., this, &Scheduler::simClockTimeChanged);
334 connect(errorHandlingStrategyDelay, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [](int value)
343 i18n("Warning: The Classic scheduler algorithm has been retired. Switching you to the Greedy algorithm."));
359 connect(KConfigDialog::exists("settings"), &KConfigDialog::settingsChanged, this, &Scheduler::handleConfigChanged);
390 /* These are the widgets we want to connect, per signal function, to listen for modifications */
445 /* Connect the relevant signal to setDirty. Note that we are not keeping the connection object: we will
446 * only use that signal once, and there will be no leaks. If we were connecting multiple receiver functions
447 * to the same signal, we would have to be selective when disconnecting. We also use a lambda to absorb the
449 * The main problem with this implementation compared to the macro method is that it is now possible to
450 * stack signal connections. That is, multiple calls to WatchJobChanges will cause multiple signal-to-slot
451 * instances to be registered. As a result, one click will produce N signals, with N*=2 for each call to
465 connect(control, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this]()
471 connect(control, static_cast<void (QButtonGroup::*)(int, bool)>(&QButtonGroup::buttonToggled), this, [this](int, bool)
473 connect(control, static_cast<void (QButtonGroup::*)(int, bool)>(&QButtonGroup::idToggled), this, [this](int, bool)
479 connect(control, static_cast<void (QAbstractButton::*)(bool)>(&QAbstractButton::clicked), this, [this](bool)
489 connect(control, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, [this](double)
496 /* Disconnect the relevant signal from each widget. Actually, this method removes all signals from the widgets,
497 * because we did not take care to keep the connection object when connecting. No problem in our case, we do not
498 * expect other signals to be connected. Because we used a lambda, we cannot use the same function object to
506 disconnect(control, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, nullptr);
508 disconnect(control, static_cast<void (QAbstractButton::*)(bool)>(&QAbstractButton::clicked), this, nullptr);
511 disconnect(control, static_cast<void (QButtonGroup::*)(int, bool)>(&QButtonGroup::buttonToggled), this, nullptr);
513 disconnect(control, static_cast<void (QButtonGroup::*)(int, bool)>(&QButtonGroup::idToggled), this, nullptr);
516 disconnect(control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, nullptr);
518 disconnect(control, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, nullptr);
563 auto url = QFileDialog::getOpenFileUrl(Ekos::Manager::Instance(), i18nc("@title:window", "Select FITS/XISF Image"), dirPath,
613 process()->appendLogText(i18n("FITS header: cannot find OBJCTRA (%1).", QString(error_status)));
632 process()->appendLogText(i18n("FITS header: cannot find OBJCTDEC (%1).", QString(error_status)));
673 QString file = QFileDialog::getOpenFileName(Ekos::Manager::Instance(), i18nc("@title:window", "Select Sequence Queue"),
682 moduleState()->setStartupScriptURL(QFileDialog::getOpenFileUrl(Ekos::Manager::Instance(), i18nc("@title:window",
697 moduleState()->setShutdownScriptURL(QFileDialog::getOpenFileUrl(Ekos::Manager::Instance(), i18nc("@title:window",
839 * Make sure job is added at the right index, now that queueTable may have a line selected without being edited.
843 /* FIXME: jobUnderEdit is a parallel variable that may cause issues if it desyncs from moduleState()->currentPosition(). */
846 qCWarning(KSTARS_EKOS_SCHEDULER) << "BUG: the observation job under edit does not match the selected row in the job table.";
862 /* Instantiate a new job, insert it in the job list and add a row in the table for it just after the row currently selected. */
872 /* Insert the job in the job list and add a row in the table for it just after the row currently selected. */
879 // FIXME: Those duplicated jobs are not necessarily processed in the order they appear in the list!
891 /* FIXME: Warning about duplicate jobs only checks the target name, doing it properly would require checking storage for each sequence job of each scheduler job. */
900 process()->appendLogText(i18n("Warning: jobs '%1' at row %2 and %3 probably require a different repeat count "
901 "as currently they will complete simultaneously after %4 batches (or disable option 'Remember job progress')",
924 qCDebug(KSTARS_EKOS_SCHEDULER) << QString("Job '%1' at row #%2 was saved.").arg(job->getName()).arg(currentRow + 1);
1034 setErrorHandlingStrategy(static_cast<ErrorHandlingStrategy>(Options::errorHandlingStrategy()));
1037 schedulerStartupScript->setText(moduleState()->startupScriptURL().toString(QUrl::PreferLocalFile));
1038 schedulerShutdownScript->setText(moduleState()->shutdownScriptURL().toString(QUrl::PreferLocalFile));
1062 qCWarning(KSTARS_EKOS_SCHEDULER()) << "Cannot update night time, no matching job found at line" << currentRow;
1101 qCDebug(KSTARS_EKOS_SCHEDULER) << QString("Job '%1' at row #%2 is currently edited.").arg(job->getName()).arg(
1114void Scheduler::queueTableSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
1127 qCWarning(KSTARS_EKOS_SCHEDULER()) << "Unexpected row number" << current.row() << "- ignoring.";
1140 process()->appendLogText(i18n("Stop editing of job #%1, resetting to original value.", jobUnderEdit + 1));
1158 addToQueueB->setToolTip(i18n("Use edition fields to create a new job in the observation list."));
1198 SchedulerJob * const selectedJob = 0 <= selectedRow ? moduleState()->jobs().at(selectedRow) : nullptr;
1300 QTableWidgetItem *captureCountCell = queueTable->item(row, static_cast<int>(SCHEDCOL_CAPTURES));
1381 double const alt = SchedulerUtils::findAltitude(job->getTargetCoords(), QDateTime(), &is_setting);
1450 captureCountCell->setText(QString("%L1/%L2").arg(job->getCompletedCount()).arg(job->getSequenceCount()));
1523 qCDebug(KSTARS_EKOS_SCHEDULER) << QString("Job '%1' at row #%2 is not longer edited.").arg(job->getName()).arg(
1541 Q_ASSERT_X(jobUnderEdit == -1, __FUNCTION__, "No more edited/selected job after exiting edit mode");
1623 KSNotification::event(QLatin1String("ObservatoryShutdown"), i18n("Observatory is in the shutdown process"),
1653 KSNotification::event(QLatin1String("SchedulerAborted"), i18n("Scheduler aborted."), KSNotification::Scheduler,
1693 fileURL = QFileDialog::getOpenFileUrl(Ekos::Manager::Instance(), i18nc("@title:window", "Open Ekos Scheduler List"),
1771 if (schedulerURL.toLocalFile().startsWith(QLatin1String("/tmp/")) || schedulerURL.toLocalFile().contains("/Temp"))
1781 QFileDialog::getSaveFileUrl(Ekos::Manager::Instance(), i18nc("@title:window", "Save Ekos Scheduler List"), dirPath,
1820 bool const nameSelectionOK = !raBox->isEmpty() && !decBox->isEmpty() && !nameEdit->text().isEmpty();
1864 // Don't reset scheduler jobs startup times before sorting - we need the first job startup time
1926 i18n("Warning: The Classic scheduler algorithm has been retired. Switching you to the Greedy algorithm."));
1965 /* Translated string cache - overkill, probably, and doesn't warn about missing enums like switch/case should ; also, not thread-safe */
1966 /* FIXME: this should work with a static initializer in C++11, but QT versions are touchy on this, and perhaps i18n can't be used? */
2089 KSNotification::event(QLatin1String("WeatherWarning"), i18n("Weather conditions in warning zone"),
2098 i18n("Weather conditions are critical. Observatory shutdown is imminent"), KSNotification::Scheduler,
2350 setErrorHandlingStrategy(static_cast<ErrorHandlingStrategy>(Options::errorHandlingStrategy()));
2440 // Many other widget types (e.g. spinboxes) apparently have QLineEdit inside them so we want to skip those
2614 connect(oneWidget, QOverload<int>::of(&QComboBox::activated), this, &Ekos::Scheduler::syncSettings);
2618 connect(oneWidget, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &Ekos::Scheduler::syncSettings);
2622 connect(oneWidget, QOverload<int>::of(&QSpinBox::valueChanged), this, &Ekos::Scheduler::syncSettings);
2635 // Many other widget types (e.g. spinboxes) apparently have QLineEdit inside them so we want to skip those
2649 disconnect(oneWidget, QOverload<int>::of(&QComboBox::activated), this, &Ekos::Scheduler::syncSettings);
2653 disconnect(oneWidget, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &Ekos::Scheduler::syncSettings);
2657 disconnect(oneWidget, QOverload<int>::of(&QSpinBox::valueChanged), this, &Ekos::Scheduler::syncSettings);
The SchedulerProcess class holds the entire business logic for controlling the execution of the EKOS ...
Definition schedulerprocess.h:34
void runStartupProcedure()
runStartupProcedure Execute the startup of the scheduler itself to be prepared for running scheduler ...
Definition schedulerprocess.cpp:2105
void startJobEvaluation()
startJobEvaluation Start job evaluation only without starting the scheduler process itself.
Definition schedulerprocess.cpp:2304
void runShutdownProcedure()
runShutdownProcedure Shutdown the scheduler itself and EKOS (if configured to do so).
Definition schedulerprocess.cpp:2171
ErrorHandlingStrategy getErrorHandlingStrategy()
retrieve the error handling strategy from the UI
Definition scheduler.cpp:1889
void checkTwilightWarning(bool enabled)
checkWeather Check weather status and act accordingly depending on the current status of the schedule...
Definition scheduler.cpp:1938
void saveJob(SchedulerJob *job=nullptr)
addToQueue Construct a SchedulerJob and add it to the queue or save job settings from current form va...
Definition scheduler.cpp:831
void updateSchedulerURL(const QString &fileURL)
updateSchedulerURL Update scheduler URL after succesful loading a new file.
Definition scheduler.cpp:1107
void addJob(SchedulerJob *job=nullptr)
addJob Add a new job from form values
Definition scheduler.cpp:710
void insertJobTableRow(int row, bool above=true)
insertJobTableRow Insert a new row (empty) into the job table
Definition scheduler.cpp:1466
bool load(bool clearQueue, const QString &filename=QString())
load Open a file dialog to select an ESL file, and load its contents.
Definition scheduler.cpp:1688
void resumeCheckStatus()
resumeCheckStatus If the scheduler primary loop was suspended due to weather or sleep event,...
Definition scheduler.cpp:1882
void handleSchedulerSleeping(bool shutdown, bool sleep)
handleSchedulerSleeping Update UI if scheduler is set to sleep
Definition scheduler.cpp:2114
void setJobManipulation(bool can_reorder, bool can_delete)
setJobManipulation Enable or disable job manipulation buttons.
Definition scheduler.cpp:1170
bool importMosaic(const QJsonObject &payload)
importMosaic Import mosaic into planner and generate jobs for the scheduler.
Definition scheduler.cpp:2168
bool reorderJobs(QList< SchedulerJob * > reordered_sublist)
reorderJobs Change the order of jobs in the UI based on a subset of its jobs.
Definition scheduler.cpp:1187
void syncGUIToGeneralSettings()
syncGUIToGeneralSettings set all UI fields that are not job specific
Definition scheduler.cpp:1025
void updateNightTime(SchedulerJob const *job=nullptr)
updateNightTime update the Twilight restriction with the argument job properties.
Definition scheduler.cpp:1051
void handleSchedulerStateChanged(SchedulerState newState)
handleSchedulerStateChanged Update UI when the scheduler state changes
Definition scheduler.cpp:2125
bool fillJobFromUI(SchedulerJob *job)
createJob Create a new job from form values.
Definition scheduler.cpp:744
void setSequence(const QString &sequenceFileURL)
Set the file URL pointing to the capture sequence file.
Definition scheduler.cpp:658
void syncGUIToJob(SchedulerJob *job)
set all GUI fields to the values of the given scheduler job
Definition scheduler.cpp:934
void schedulerStopped()
schedulerStopped React when the process engine has stopped the scheduler
Definition scheduler.cpp:1637
void updateCellStyle(SchedulerJob *job, QTableWidgetItem *cell)
Update the style of a cell, depending on the job's state.
Definition scheduler.cpp:1507
void setJobAddApply(bool add_mode)
setJobAddApply Set first button state to add new job or apply changes.
Definition scheduler.cpp:1153
void handleConfigChanged()
handleConfigChanged Update UI after changes to the global configuration
Definition scheduler.cpp:524
void setErrorHandlingStrategy(ErrorHandlingStrategy strategy)
select the error handling strategy (no restart, restart after all terminated, restart immediately)
Definition scheduler.cpp:1900
void clickQueueTable(QModelIndex index)
jobSelectionChanged Update UI state when the job list is clicked once.
Definition scheduler.cpp:1148
void updateJobTable(SchedulerJob *job=nullptr)
updateJobTable Update the job's row in the job table.
Definition scheduler.cpp:1276
void interfaceReady(QDBusInterface *iface)
checkInterfaceReady Sometimes syncProperties() is not sufficient since the ready signal could have fi...
Definition scheduler.cpp:1997
void queueTableSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
Update scheduler parameters to the currently selected scheduler job.
Definition scheduler.cpp:1114
static KConfigDialog * exists(const QString &name)
void settingsChanged(const QString &dialogName)
The QProgressIndicator class lets an application display a progress indicator to show that a long tas...
Definition QProgressIndicator.h:24
The SchedulerState class holds all attributes defining the scheduler's state.
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
static dms fromString(const QString &s, bool deg)
Static function to create a DMS object from a QString.
Definition dms.cpp:429
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
char * toString(const EngineQuery &query)
@ SCHEDJOB_ABORTED
Job encountered a transitory issue while processing, and will be rescheduled.
Definition schedulertypes.h:105
@ SCHEDJOB_INVALID
Job has an incorrect configuration, and cannot proceed.
Definition schedulertypes.h:106
@ SCHEDJOB_ERROR
Job encountered a fatal issue while processing, and must be reset manually.
Definition schedulertypes.h:104
ErrorHandlingStrategy
options what should happen if an error or abort occurs
Definition schedulertypes.h:58
CompletionCondition
Conditions under which a SchedulerJob may complete.
Definition schedulertypes.h:80
ButtonCode warningContinueCancel(QWidget *parent, const QString &text, const QString &title=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
Cancel
KGuiItem insert()
KGuiItem cont()
KGuiItem cancel()
KGuiItem ok()
NETWORKMANAGERQT_EXPORT NetworkManager::Status status()
bool isChecked() const const
void clicked(bool checked)
void toggled(bool checked)
void clicked(const QModelIndex &index)
void doubleClicked(const QModelIndex &index)
void rangeChanged(int min, int max)
void valueChanged(int value)
void editingFinished()
void triggered(bool checked)
void buttonClicked(QAbstractButton *button)
void buttonToggled(QAbstractButton *button, bool checked)
void idToggled(int id, bool checked)
void currentIndexChanged(int index)
QDateTime fromString(QStringView string, QStringView format, QCalendar cal)
bool isValid() const const
void setTime(QTime time)
QTime time() const const
QString toString(QStringView format, QCalendar cal) const const
Accepted
QString homePath()
void valueChanged(double d)
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, Options options)
QUrl getOpenFileUrl(QWidget *parent, const QString &caption, const QUrl &dir, const QString &filter, QString *selectedFilter, Options options, const QStringList &supportedSchemes)
QUrl getSaveFileUrl(QWidget *parent, const QString &caption, const QUrl &dir, const QString &filter, QString *selectedFilter, Options options, const QStringList &supportedSchemes)
Int toInt() const const
ResizeToContents
QIcon fromTheme(const QString &name)
QModelIndexList indexes() const const
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
void editingFinished()
void textChanged(const QString &text)
bool empty() const const
bool isValid() const const
int row() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
QList< T > findChildren(Qt::FindChildOptions options) const const
objectName
QObject * sender() const const
QString tr(const char *sourceText, const char *disambiguation, int n)
value
void valueChanged(int i)
QString arg(Args &&... args) const const
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
QString fromUtf8(QByteArrayView str)
bool isEmpty() const const
qsizetype size() const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
QByteArray toLatin1() const const
AlignHCenter
ISODate
ItemIsSelectable
Horizontal
WA_LayoutUsesWidgetRect
QTextStream & center(QTextStream &stream)
void selectRow(int row)
QFont font() const const
void setFlags(Qt::ItemFlags flags)
void setFont(const QFont &font)
void setTextAlignment(Qt::Alignment alignment)
int hour() const const
int minute() const const
bool setHMS(int h, int m, int s, int ms)
RemoveFilename
void clear()
QString fileName(ComponentFormattingOptions options) const const
QUrl fromLocalFile(const QString &localFile)
QUrl fromUserInput(const QString &userInput, const QString &workingDirectory, UserInputResolutionOptions options)
bool isEmpty() const const
bool isValid() const const
void setPath(const QString &path, ParsingMode mode)
QString toLocalFile() const const
QString url(FormattingOptions options) const const
bool isValid() const const
bool toBool() const const
double toDouble(bool *ok) const const
int toInt(bool *ok) const const
QString toString() const const
enabled
font
pos
void setupUi(QWidget *widget)
size
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:03 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:03 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.