File indexing completed on 2024-02-25 17:31:04

0001 /*
0002  * SPDX-FileCopyrightText: 2018 Red Hat Inc
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  *
0006  * SPDX-FileCopyrightText: 2018 Jan Grulich <jgrulich@redhat.com>
0007  */
0008 
0009 #ifndef XDG_DESKTOP_PORTAL_KDE_SCREENSHOT_DIALOG_H
0010 #define XDG_DESKTOP_PORTAL_KDE_SCREENSHOT_DIALOG_H
0011 
0012 #include "quickdialog.h"
0013 #include <QFuture>
0014 #include <QImage>
0015 
0016 class ScreenshotDialog : public QuickDialog
0017 {
0018     Q_OBJECT
0019 public:
0020     explicit ScreenshotDialog(QObject *parent = nullptr);
0021 
0022     enum Flags {
0023         Borders = 1,
0024         Cursor = 1 << 1,
0025     };
0026     Q_ENUM(Flags)
0027     enum ScreenshotType {
0028         FullScreen,
0029         CurrentScreen,
0030         ActiveWindow,
0031     };
0032     Q_ENUM(ScreenshotType)
0033 
0034     QImage image() const;
0035     void takeScreenshotNonInteractive();
0036 
0037 public Q_SLOTS:
0038     void takeScreenshotInteractive();
0039 
0040 Q_SIGNALS:
0041     void failed();
0042 
0043 private:
0044     QFuture<QImage> takeScreenshot();
0045 
0046     QImage m_image;
0047 };
0048 
0049 #endif // XDG_DESKTOP_PORTAL_KDE_SCREENSHOT_DIALOG_H