Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/scheduler/schedulerjob.h
Show First 20 Lines • Show All 244 Lines • ▼ Show 20 Line(s) | 24 | public: | |||
---|---|---|---|---|---|
245 | /** @} */ | 245 | /** @} */ | ||
246 | 246 | | |||
247 | /** @brief Shortcut to widget cell for startup time in the job queue table. */ | 247 | /** @brief Shortcut to widget cell for startup time in the job queue table. */ | ||
248 | /** @{ */ | 248 | /** @{ */ | ||
249 | QTableWidgetItem *getStartupCell() const { return startupCell; } | 249 | QTableWidgetItem *getStartupCell() const { return startupCell; } | ||
250 | void setStartupCell(QTableWidgetItem *value); | 250 | void setStartupCell(QTableWidgetItem *value); | ||
251 | /** @} */ | 251 | /** @} */ | ||
252 | 252 | | |||
253 | /** @brief Shortcut to widget cell for altitude in the job queue table. */ | ||||
254 | /** @{ */ | ||||
255 | QTableWidgetItem *getAltitudeCell() const { return altitudeCell; } | ||||
256 | void setAltitudeCell(QTableWidgetItem *value); | ||||
257 | /** @} */ | ||||
258 | | ||||
253 | /** @brief Time after which the job is considered complete. */ | 259 | /** @brief Time after which the job is considered complete. */ | ||
254 | /** @{ */ | 260 | /** @{ */ | ||
255 | QDateTime getCompletionTime() const { return completionTime; } | 261 | QDateTime getCompletionTime() const { return completionTime; } | ||
256 | void setCompletionTime(const QDateTime &value); | 262 | void setCompletionTime(const QDateTime &value); | ||
257 | /** @} */ | 263 | /** @} */ | ||
258 | 264 | | |||
259 | /** @brief Shortcut to widget cell for completion time in the job queue table. */ | 265 | /** @brief Shortcut to widget cell for completion time in the job queue table. */ | ||
260 | /** @{ */ | 266 | /** @{ */ | ||
261 | QTableWidgetItem *getCompletionCell() const { return completionCell; } | 267 | QTableWidgetItem *getCompletionCell() const { return completionCell; } | ||
262 | void setCompletionCell(QTableWidgetItem *value); | 268 | void setCompletionCell(QTableWidgetItem *value); | ||
263 | /** @} */ | 269 | /** @} */ | ||
264 | 270 | | |||
265 | /** @brief Estimation of the time the job will take to process. */ | 271 | /** @brief Estimation of the time the job will take to process. */ | ||
266 | /** @{ */ | 272 | /** @{ */ | ||
267 | int64_t getEstimatedTime() const { return estimatedTime; } | 273 | int64_t getEstimatedTime() const { return estimatedTime; } | ||
268 | void setEstimatedTime(const int64_t &value); | 274 | void setEstimatedTime(const int64_t &value); | ||
269 | /** @} */ | 275 | /** @} */ | ||
270 | 276 | | |||
271 | /** @brief Shortcut to widget cell for estimated time in the job queue table. */ | 277 | /** @brief Shortcut to widget cell for estimated time in the job queue table. */ | ||
272 | /** @{ */ | 278 | /** @{ */ | ||
273 | QTableWidgetItem *getEstimatedTimeCell() const { return estimatedTimeCell; } | 279 | QTableWidgetItem *getEstimatedTimeCell() const { return estimatedTimeCell; } | ||
274 | void setEstimatedTimeCell(QTableWidgetItem *value); | 280 | void setEstimatedTimeCell(QTableWidgetItem *value); | ||
275 | /** @} */ | 281 | /** @} */ | ||
276 | 282 | | |||
283 | /** @brief Estimation of the lead time the job will have to process. */ | ||||
284 | /** @{ */ | ||||
285 | int64_t getLeadTime() const { return leadTime; } | ||||
286 | void setLeadTime(const int64_t &value); | ||||
287 | /** @} */ | ||||
288 | | ||||
289 | /** @brief Shortcut to widget cell for estimated time in the job queue table. */ | ||||
290 | /** @{ */ | ||||
291 | QTableWidgetItem *getLeadTimeCell() const { return leadTimeCell; } | ||||
292 | void setLeadTimeCell(QTableWidgetItem *value); | ||||
293 | /** @} */ | ||||
294 | | ||||
277 | /** @brief Current score of the scheduler job. */ | 295 | /** @brief Current score of the scheduler job. */ | ||
278 | /** @{ */ | 296 | /** @{ */ | ||
279 | int getScore() const { return score; } | 297 | int getScore() const { return score; } | ||
280 | void setScore(int value); | 298 | void setScore(int value); | ||
281 | /** @} */ | 299 | /** @} */ | ||
282 | 300 | | |||
283 | /** @brief Shortcut to widget cell for job score in the job queue table. */ | 301 | /** @brief Shortcut to widget cell for job score in the job queue table. */ | ||
284 | /** @{ */ | 302 | /** @{ */ | ||
Show All 22 Lines | |||||
307 | /** @brief The map of capture counts for this job, keyed by its capture storage signatures. */ | 325 | /** @brief The map of capture counts for this job, keyed by its capture storage signatures. */ | ||
308 | /** @{ */ | 326 | /** @{ */ | ||
309 | typedef QMap<QString, uint16_t> CapturedFramesMap; | 327 | typedef QMap<QString, uint16_t> CapturedFramesMap; | ||
310 | const CapturedFramesMap& getCapturedFramesMap() const { return capturedFramesMap; } | 328 | const CapturedFramesMap& getCapturedFramesMap() const { return capturedFramesMap; } | ||
311 | void setCapturedFramesMap(const CapturedFramesMap &value); | 329 | void setCapturedFramesMap(const CapturedFramesMap &value); | ||
312 | /** @} */ | 330 | /** @} */ | ||
313 | 331 | | |||
314 | /** @brief Refresh all cells connected to this SchedulerJob. */ | 332 | /** @brief Refresh all cells connected to this SchedulerJob. */ | ||
315 | void updateJobCell(); | 333 | void updateJobCells(); | ||
316 | 334 | | |||
317 | /** @brief Resetting a job to original values: | 335 | /** @brief Resetting a job to original values: | ||
318 | * - idle state and stage | 336 | * - idle state and stage | ||
319 | * - original startup, none if asap, else user original setting | 337 | * - original startup, none if asap, else user original setting | ||
320 | * - duration not estimated | 338 | * - duration not estimated | ||
321 | * - full repeat count | 339 | * - full repeat count | ||
322 | */ | 340 | */ | ||
323 | void reset(); | 341 | void reset(); | ||
324 | 342 | | |||
325 | /** @brief Determining whether a SchedulerJob is a duplicate of another. | 343 | /** @brief Determining whether a SchedulerJob is a duplicate of another. | ||
326 | * @param a_job is the other SchedulerJob to test duplication against. | 344 | * @param a_job is the other SchedulerJob to test duplication against. | ||
327 | * @return True if objects are different, but name and sequence file are identical, else false. | 345 | * @return True if objects are different, but name and sequence file are identical, else false. | ||
328 | * @fixme This is a weak comparison, but that's what the scheduler looks at to decide completion. | 346 | * @fixme This is a weak comparison, but that's what the scheduler looks at to decide completion. | ||
329 | */ | 347 | */ | ||
330 | bool isDuplicateOf(SchedulerJob const *a_job) const { return this != a_job && name == a_job->name && sequenceFile == a_job->sequenceFile; } | 348 | bool isDuplicateOf(SchedulerJob const *a_job) const { return this != a_job && name == a_job->name && sequenceFile == a_job->sequenceFile; } | ||
331 | 349 | | |||
332 | /** @brief Compare ::SchedulerJob instances based on score. This is a qSort predicate, deprecated in QT5. | 350 | /** @brief Compare ::SchedulerJob instances based on score. | ||
351 | * @fixme This is a qSort predicate, deprecated in QT5. | ||||
333 | * @arg a, b are ::SchedulerJob instances to compare. | 352 | * @arg a, b are ::SchedulerJob instances to compare. | ||
334 | * @return true if the score of b is lower than the score of a. | 353 | * @return true if the score of b is lower than the score of a. | ||
335 | * @return false if the score of b is higher than or equal to the score of a. | 354 | * @return false if the score of b is higher than or equal to the score of a. | ||
336 | */ | 355 | */ | ||
337 | static bool decreasingScoreOrder(SchedulerJob const *a, SchedulerJob const *b); | 356 | static bool decreasingScoreOrder(SchedulerJob const *a, SchedulerJob const *b); | ||
338 | 357 | | |||
339 | /** @brief Compare ::SchedulerJob instances based on priority. This is a qSort predicate, deprecated in QT5. | 358 | /** @brief Compare ::SchedulerJob instances based on priority. | ||
359 | * @fixme This is a qSort predicate, deprecated in QT5. | ||||
340 | * @arg a, b are ::SchedulerJob instances to compare. | 360 | * @arg a, b are ::SchedulerJob instances to compare. | ||
341 | * @return true if the priority of a is lower than the priority of b. | 361 | * @return true if the priority of a is lower than the priority of b. | ||
342 | * @return false if the priority of a is higher than or equal to the priority of b. | 362 | * @return false if the priority of a is higher than or equal to the priority of b. | ||
343 | */ | 363 | */ | ||
344 | static bool increasingPriorityOrder(SchedulerJob const *a, SchedulerJob const *b); | 364 | static bool increasingPriorityOrder(SchedulerJob const *a, SchedulerJob const *b); | ||
345 | 365 | | |||
346 | /** @brief Compare ::SchedulerJob instances based on altitude. This is a qSort predicate, deprecated in QT5. | 366 | /** @brief Compare ::SchedulerJob instances based on altitude and movement in sky at startup time. | ||
367 | * @fixme This is a qSort predicate, deprecated in QT5. | ||||
347 | * @arg a, b are ::SchedulerJob instances to compare. | 368 | * @arg a, b are ::SchedulerJob instances to compare. | ||
348 | * @return true if the altitude of b is lower than the altitude of a. | 369 | * @arg when is the date/time to use to calculate the altitude to sort with, defaulting to a's startup time. | ||
349 | * @return false if the altitude of b is higher than or equal to the altitude of a. | 370 | * @note To obtain proper sort between several SchedulerJobs, all should have the same startup time. | ||
371 | * @note Use std:bind to bind a specific date/time to this predicate for altitude calculation. | ||||
372 | * @return true is a is setting but not b. | ||||
373 | * @return false if b is setting but not a. | ||||
374 | * @return true otherwise, if the altitude of b is lower than the altitude of a. | ||||
375 | * @return false otherwise, if the altitude of b is higher than or equal to the altitude of a. | ||||
350 | */ | 376 | */ | ||
351 | static bool decreasingAltitudeOrder(SchedulerJob const *a, SchedulerJob const *b); | 377 | static bool decreasingAltitudeOrder(SchedulerJob const *a, SchedulerJob const *b, QDateTime const &when = QDateTime()); | ||
352 | 378 | | |||
353 | /** @brief Compare ::SchedulerJob instances based on startup time. This is a qSort predicate, deprecated in QT5. | 379 | /** @brief Compare ::SchedulerJob instances based on startup time. | ||
380 | * @fixme This is a qSort predicate, deprecated in QT5. | ||||
354 | * @arg a, b are ::SchedulerJob instances to compare. | 381 | * @arg a, b are ::SchedulerJob instances to compare. | ||
355 | * @return true if the startup time of a is sooner than the priority of b. | 382 | * @return true if the startup time of a is sooner than the priority of b. | ||
356 | * @return false if the startup time of a is later than or equal to the priority of b. | 383 | * @return false if the startup time of a is later than or equal to the priority of b. | ||
357 | */ | 384 | */ | ||
358 | static bool increasingStartupTimeOrder(SchedulerJob const *a, SchedulerJob const *b); | 385 | static bool increasingStartupTimeOrder(SchedulerJob const *a, SchedulerJob const *b); | ||
359 | 386 | | |||
360 | private: | 387 | private: | ||
361 | QString name; | 388 | QString name; | ||
362 | SkyPoint targetCoords; | 389 | SkyPoint targetCoords; | ||
363 | JOBStatus state { JOB_IDLE }; | 390 | JOBStatus state { JOB_IDLE }; | ||
364 | JOBStage stage { STAGE_IDLE }; | 391 | JOBStage stage { STAGE_IDLE }; | ||
365 | 392 | | |||
366 | StartupCondition fileStartupCondition { START_ASAP }; | 393 | StartupCondition fileStartupCondition { START_ASAP }; | ||
367 | StartupCondition startupCondition { START_ASAP }; | 394 | StartupCondition startupCondition { START_ASAP }; | ||
368 | CompletionCondition completionCondition { FINISH_SEQUENCE }; | 395 | CompletionCondition completionCondition { FINISH_SEQUENCE }; | ||
369 | 396 | | |||
370 | int sequenceCount { 0 }; | 397 | int sequenceCount { 0 }; | ||
371 | int completedCount { 0 }; | 398 | int completedCount { 0 }; | ||
372 | 399 | | |||
373 | QDateTime fileStartupTime; | 400 | QDateTime fileStartupTime; | ||
374 | QDateTime startupTime; | 401 | QDateTime startupTime; | ||
375 | QDateTime completionTime; | 402 | QDateTime completionTime; | ||
376 | 403 | | |||
404 | /* @internal Caches to optimize cell rendering. */ | ||||
405 | /* @{ */ | ||||
406 | double altitudeAtStartup; | ||||
407 | double altitudeAtCompletion; | ||||
408 | bool isSettingAtStartup; | ||||
409 | bool isSettingAtCompletion; | ||||
410 | /* @} */ | ||||
411 | | ||||
377 | QUrl sequenceFile; | 412 | QUrl sequenceFile; | ||
378 | QUrl fitsFile; | 413 | QUrl fitsFile; | ||
379 | 414 | | |||
380 | double minAltitude { -1 }; | 415 | double minAltitude { -90 }; | ||
381 | double minMoonSeparation { -1 }; | 416 | double minMoonSeparation { -1 }; | ||
382 | 417 | | |||
383 | bool enforceWeather { false }; | 418 | bool enforceWeather { false }; | ||
384 | bool enforceTwilight { false }; | 419 | bool enforceTwilight { false }; | ||
385 | 420 | | |||
386 | StepPipeline stepPipeline { USE_NONE }; | 421 | StepPipeline stepPipeline { USE_NONE }; | ||
387 | 422 | | |||
388 | /** @internal Widget cell/label shortcuts. */ | 423 | /** @internal Widget cell/label shortcuts. */ | ||
389 | /** @{ */ | 424 | /** @{ */ | ||
390 | QTableWidgetItem *nameCell { nullptr }; | 425 | QTableWidgetItem *nameCell { nullptr }; | ||
391 | QLabel *nameLabel { nullptr }; | 426 | QLabel *nameLabel { nullptr }; | ||
392 | QTableWidgetItem *statusCell { nullptr }; | 427 | QTableWidgetItem *statusCell { nullptr }; | ||
393 | QTableWidgetItem *stageCell { nullptr }; | 428 | QTableWidgetItem *stageCell { nullptr }; | ||
394 | QLabel *stageLabel { nullptr }; | 429 | QLabel *stageLabel { nullptr }; | ||
430 | QTableWidgetItem *altitudeCell { nullptr }; | ||||
395 | QTableWidgetItem *startupCell { nullptr }; | 431 | QTableWidgetItem *startupCell { nullptr }; | ||
396 | QTableWidgetItem *completionCell { nullptr }; | 432 | QTableWidgetItem *completionCell { nullptr }; | ||
397 | QTableWidgetItem *estimatedTimeCell { nullptr }; | 433 | QTableWidgetItem *estimatedTimeCell { nullptr }; | ||
398 | QTableWidgetItem *captureCountCell { nullptr }; | 434 | QTableWidgetItem *captureCountCell { nullptr }; | ||
399 | QTableWidgetItem *scoreCell { nullptr }; | 435 | QTableWidgetItem *scoreCell { nullptr }; | ||
436 | QTableWidgetItem *leadTimeCell { nullptr }; | ||||
400 | /** @} */ | 437 | /** @} */ | ||
401 | 438 | | |||
402 | int score { 0 }; | 439 | int score { 0 }; | ||
403 | int16_t culminationOffset { 0 }; | 440 | int16_t culminationOffset { 0 }; | ||
404 | uint8_t priority { 10 }; | 441 | uint8_t priority { 10 }; | ||
405 | int64_t estimatedTime { -1 }; | 442 | int64_t estimatedTime { -1 }; | ||
443 | int64_t leadTime { 0 }; | ||||
406 | uint16_t repeatsRequired { 1 }; | 444 | uint16_t repeatsRequired { 1 }; | ||
407 | uint16_t repeatsRemaining { 1 }; | 445 | uint16_t repeatsRemaining { 1 }; | ||
408 | bool inSequenceFocus { false }; | 446 | bool inSequenceFocus { false }; | ||
409 | 447 | | |||
410 | QString dateTimeDisplayFormat; | 448 | QString dateTimeDisplayFormat; | ||
411 | 449 | | |||
412 | bool lightFramesRequired { false }; | 450 | bool lightFramesRequired { false }; | ||
413 | 451 | | |||
414 | QMap<QString, uint16_t> capturedFramesMap; | 452 | QMap<QString, uint16_t> capturedFramesMap; | ||
415 | }; | 453 | }; |