File indexing completed on 2024-04-21 03:42:44

0001 /*
0002     SPDX-FileCopyrightText: 2011 Rafał Kułaga <rl.kulaga@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ui_exportimagedialog.h"
0010 
0011 #include "../printing/legend.h"
0012 
0013 #include <QDialog>
0014 
0015 class KStars;
0016 class QString;
0017 class QSize;
0018 class ImageExporter;
0019 
0020 // ExportImageDialog user interface.
0021 class ExportImageDialogUI : public QFrame, public Ui::ExportImageDialog
0022 {
0023     Q_OBJECT
0024 
0025   public:
0026     explicit ExportImageDialogUI(QWidget *parent = nullptr);
0027 };
0028 
0029 /** @short Export sky image dialog. This dialog enables user to set up basic legend
0030   properties before image is exported.
0031   */
0032 class ExportImageDialog : public QDialog
0033 {
0034     Q_OBJECT
0035 
0036   public:
0037     /**short Default constructor. Creates dialog operating on passed URL and
0038           output image width and height.
0039           *@param url URL for exported image.
0040           *@param size size of exported image.
0041           *@param imgExporter A pointer to an ImageExporter that we can use instead of creating our own. if 0, we will create our own.
0042           */
0043     ExportImageDialog(const QString &url, const QSize &size, ImageExporter *imgExporter = nullptr);
0044 
0045     ~ExportImageDialog() override = default;
0046 
0047     inline void setOutputUrl(const QString &url) { m_Url = url; }
0048     inline void setOutputSize(const QSize &size) { m_Size = size; }
0049 
0050   private slots:
0051     void switchLegendEnabled(bool enabled);
0052     void previewImage();
0053     void exportImage();
0054 
0055     void setupWidgets();
0056     void updateLegendSettings();
0057 
0058   private:
0059     KStars *m_KStars;
0060     ExportImageDialogUI *m_DialogUI;
0061     QString m_Url;
0062     QSize m_Size;
0063     ImageExporter *m_ImageExporter;
0064 };