Changeset View
Changeset View
Standalone View
Standalone View
src/BackendInterfaces/ScreenshotInterface.h
- This file was added.
1 | /* This file is part of Spectacle, the KDE screenshot utility | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2019 Leon De Andrade <leondeandrade@hotmail.com> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU Lesser General Public License as published by | ||||
6 | * the Free Software Foundation; either version 2 of the License, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Lesser General Public License | ||||
15 | * along with this program; if not, write to the Free Software | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
17 | * Boston, MA 02110-1301, USA. | ||||
18 | * | ||||
19 | * SPDX-License-Identifier: LGPL-2.0-or-later | ||||
20 | */ | ||||
21 | | ||||
22 | | ||||
23 | #ifndef SCREENSHOT_INTERFACE_H | ||||
24 | #define SCREENSHOT_INTERFACE_H | ||||
25 | | ||||
26 | #include <QFlags> | ||||
27 | #include <QObject> | ||||
28 | #include <QtPlugin> | ||||
29 | | ||||
30 | enum class CaptureMode { | ||||
31 | AllScreens = 1, | ||||
32 | CurrentScreen = 2, | ||||
33 | ActiveWindow = 4, | ||||
34 | WindowUnderCursor = 8, | ||||
35 | TransientWithParent = 16, | ||||
36 | RectangularRegion = 32 | ||||
37 | }; | ||||
38 | Q_DECLARE_FLAGS(CaptureModes, CaptureMode) | ||||
39 | Q_DECLARE_OPERATORS_FOR_FLAGS(CaptureModes) | ||||
40 | | ||||
41 | enum class ShutterMode { | ||||
42 | Immediate = 1, | ||||
43 | OnClick = 2 | ||||
44 | }; | ||||
45 | Q_DECLARE_FLAGS(ShutterModes, ShutterMode) | ||||
46 | Q_DECLARE_OPERATORS_FOR_FLAGS(ShutterModes) | ||||
47 | | ||||
48 | enum class Platform { | ||||
49 | Xcb, | ||||
50 | Wayland, | ||||
51 | Unknown | ||||
52 | }; | ||||
53 | | ||||
54 | class ScreenshotInterface : public QObject { | ||||
55 | Q_OBJECT | ||||
56 | | ||||
57 | public: | ||||
58 | ScreenshotInterface(QObject* parent) : QObject(parent) {} | ||||
59 | virtual ~ScreenshotInterface() = default; | ||||
60 | | ||||
61 | //Meta Data | ||||
62 | virtual QString name() const = 0; | ||||
63 | virtual Platform platform() const = 0; | ||||
64 | virtual CaptureModes supportedCaptureModes() const = 0; | ||||
65 | virtual ShutterModes supportedShutterModes() const = 0; | ||||
66 | | ||||
67 | virtual bool requirementsComplied() const = 0; | ||||
68 | | ||||
69 | virtual void doGrab(ShutterMode theShutterMode, CaptureMode theCaptureMode, bool theIncludePointer, bool theIncludeDecorations) = 0; | ||||
70 | | ||||
71 | Q_SIGNALS: | ||||
72 | void newScreenshotTaken(const QPixmap &thePixmap); | ||||
73 | void newScreenshotFailed(); | ||||
74 | void windowTitleChanged(const QString &theWindowTitle); | ||||
75 | }; | ||||
76 | | ||||
77 | Q_DECLARE_INTERFACE(ScreenshotInterface, "org.kde.spectacle.ScreenshotInterface/1.0") | ||||
78 | | ||||
79 | #endif //SCREENSHOT_INTERFACE_H | ||||
80 | No newline at end of file |