1 /*
2     SPDX-License-Identifier: GPL-2.0-or-later
3     SPDX-FileCopyrightText: 2006-2020 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4 */
5 
6 #ifndef UMLVIEWIMAGEEXPORTER_H
7 #define UMLVIEWIMAGEEXPORTER_H
8 
9 #include "umlviewimageexportermodel.h"
10 
11 #if QT_VERSION < 0x050000
12 #include <kurl.h>
13 #endif
14 
15 #include <QString>
16 #if QT_VERSION >= 0x050000
17 #include <QUrl>
18 #endif
19 
20 class UMLScene;
21 class UMLFileDialog;
22 
23 /**
24  * Exports the scene as an image.
25  * This class takes care of asking the user the needed parameters and
26  * then exports the scene.
27  */
28 class UMLViewImageExporter
29 {
30 public:
31 
32     explicit UMLViewImageExporter(UMLScene* scene);
33     virtual ~UMLViewImageExporter();
34 
35     void exportView();
36 #if QT_VERSION >= 0x050000
getImageURL()37     QUrl    getImageURL() const { return m_imageURL; }
38 #else
getImageURL()39     KUrl    getImageURL() const { return m_imageURL; }
40 #endif
getImageMimeType()41     QString getImageMimeType() const { return m_imageMimeType; }
42 
43 private:
44 
45     UMLScene* m_scene;          ///< The scene to export.
46 #if QT_VERSION >= 0x050000
47     QUrl      m_imageURL;       ///< The URL used to save the image.
48 #else
49     KUrl      m_imageURL;       ///< The URL used to save the image.
50 #endif
51     QString   m_imageMimeType;  ///< The mime type used to save the image.
52 
53     bool getParametersFromUser();
54 
55     bool prepareExport();
56     void prepareFileDialog(UMLFileDialog *fileDialog);
57 
58 };
59 
60 #endif
61