File indexing completed on 2024-04-21 14:46:52

0001 /*
0002     SPDX-FileCopyrightText: 2016 Akarsh Simha <akarsh.simha@kdemail.net>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kstarsdatetime.h"
0010 
0011 #include <QDialog>
0012 #include <QImage>
0013 
0014 #include <memory>
0015 
0016 class QComboBox;
0017 class QLabel;
0018 class QPixmap;
0019 
0020 class SkyPoint;
0021 
0022 /**
0023  * @class ExportEyepieceView
0024  * @short Dialog to export the eyepiece view as an image, with some annotations for field-use
0025  *
0026  * @author Akarsh Simha <akarsh@kde.org>
0027  */
0028 class ExportEyepieceView : public QDialog
0029 {
0030     Q_OBJECT;
0031 
0032   public:
0033     /**
0034      * @short Constructor
0035      * @note Class self-destructs (commits suicide). Invoke and forget.
0036      */
0037     ExportEyepieceView(const SkyPoint *_sp, const KStarsDateTime &dt, const QPixmap *renderImage,
0038                        const QPixmap *renderChart, QWidget *parent = nullptr);
0039 
0040   public slots:
0041 
0042     /** Change the tick overlay scheme */
0043     void slotOverlayTicks(int overlayType);
0044 
0045     /** Save the image (export), and then close the dialog by calling slotCloseDialog() */
0046     void slotSaveImage();
0047 
0048     /** Closes the dialog, and sets up deleteLater() so that the dialog is destructed. */
0049     void slotCloseDialog();
0050 
0051   private slots:
0052 
0053     /** Render the output */
0054     void render();
0055 
0056   private:
0057     QLabel *m_outputDisplay { nullptr };
0058     QLabel *m_tickWarningLabel { nullptr };
0059     QComboBox *m_tickConfigCombo { nullptr };
0060 
0061     KStarsDateTime m_dt;
0062     std::unique_ptr<SkyPoint> m_sp;
0063     std::unique_ptr<QPixmap> m_renderImage;
0064     std::unique_ptr<QPixmap> m_renderChart;
0065     QImage m_output;
0066     int m_tickConfig { 0 };
0067 };