File indexing completed on 2024-04-28 03:43:15

0001 /*
0002     SPDX-FileCopyrightText: 2012 Jasem Mutlaq <mutlaqja@ikarustech.com>
0003     SPDX-FileCopyrightText: 2021 Wolfgang Reissenberger <sterne-jaeger@openfuture.de>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #pragma once
0009 
0010 #include "ui_capturepreviewwidget.h"
0011 #include "captureprocessoverlay.h"
0012 
0013 #include <QObject>
0014 #include <QWidget>
0015 
0016 class FITSData;
0017 class SummaryFITSView;
0018 
0019 namespace Ekos
0020 {
0021 class Capture;
0022 class Mount;
0023 class Scheduler;
0024 class SequenceJob;
0025 }
0026 
0027 class CapturePreviewWidget : public QWidget, public Ui::CapturePreviewWidget
0028 {
0029     Q_OBJECT
0030 public:
0031     explicit CapturePreviewWidget(QWidget *parent = nullptr);
0032 
0033     void shareCaptureModule(Ekos::Capture *module);
0034     void shareSchedulerModule(Ekos::Scheduler *module);
0035     void shareMountModule(Ekos::Mount *module);
0036 
0037     /**
0038      * @brief display information about the currently running job
0039      * @param currently active job
0040      */
0041     void updateJobProgress(Ekos::SequenceJob *job, const QSharedPointer<FITSData> &data);
0042 
0043     /**
0044      * @brief Show the next frame from the capture history
0045      */
0046     void showNextFrame();
0047 
0048     /**
0049      * @brief Show the previous frame from the capture history
0050      */
0051     void showPreviousFrame();
0052 
0053     /**
0054      * @brief Delete the currently displayed frame
0055      */
0056     void deleteCurrentFrame();
0057 
0058     /**
0059      * @brief Set the summary FITS view
0060      */
0061     void setSummaryFITSView(SummaryFITSView *view);
0062 
0063     /**
0064      * @brief enable / disable display widgets
0065      */
0066     void setEnabled(bool enabled);
0067 
0068     /**
0069      * @brief reset display values
0070      */
0071     void reset();
0072 
0073     /**
0074      * @brief set the target name
0075      */
0076     void setTargetName(QString name);
0077 
0078 public slots:
0079     /**
0080      * @brief update display when the capture status changes
0081      * @param status current capture status
0082      */
0083     void updateCaptureStatus(Ekos::CaptureState status);
0084 
0085     /**
0086      * @brief Slot receiving the update of the current target distance.
0087      * @param targetDiff distance to the target in arcseconds.
0088      */
0089     void updateTargetDistance(double targetDiff);
0090 
0091     /**
0092      * @brief update the count down value of the current exposure
0093      * @param delta time difference
0094      */
0095     void updateCaptureCountDown(int delta);
0096 
0097 private:
0098     Ekos::Scheduler *schedulerModule = nullptr;
0099     Ekos::Capture *captureModule = nullptr;
0100     Ekos::Mount *mountModule = nullptr;
0101 
0102     // cache frame data
0103     CaptureProcessOverlay::FrameData m_currentFrame;
0104 
0105     // target the mount is pointing to (may be different to the scheduler job name)
0106     QString m_mountTarget = "";
0107 
0108     // summary FITS view
0109     SummaryFITSView *m_fitsPreview = nullptr;
0110     // FITS data overlay
0111     CaptureProcessOverlay *overlay = nullptr;
0112 
0113     // move to trash or delete finally
0114     bool m_permanentlyDelete {false};
0115 };