Changeset View
Changeset View
Standalone View
Standalone View
src/SpectacleCore.h
Show All 16 Lines | |||||
17 | * Boston, MA 02110-1301, USA. | 17 | * Boston, MA 02110-1301, USA. | ||
18 | * | 18 | * | ||
19 | * SPDX-License-Identifier: LGPL-2.0-or-later | 19 | * SPDX-License-Identifier: LGPL-2.0-or-later | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #pragma once | 22 | #pragma once | ||
23 | 23 | | |||
24 | #include <QObject> | 24 | #include <QObject> | ||
25 | #include <QCommandLineParser> | ||||
25 | 26 | | |||
26 | #include "ExportManager.h" | 27 | #include "ExportManager.h" | ||
27 | #include "Gui/KSMainWindow.h" | 28 | #include "Gui/KSMainWindow.h" | ||
28 | #include "QuickEditor/QuickEditor.h" | 29 | #include "QuickEditor/QuickEditor.h" | ||
29 | #include "Platforms/PlatformLoader.h" | 30 | #include "Platforms/PlatformLoader.h" | ||
30 | 31 | | |||
31 | #include <memory> | 32 | #include <memory> | ||
32 | 33 | | |||
Show All 13 Lines | 44 | { | |||
46 | public: | 47 | public: | ||
47 | 48 | | |||
48 | enum class StartMode { | 49 | enum class StartMode { | ||
49 | Gui = 0, | 50 | Gui = 0, | ||
50 | DBus = 1, | 51 | DBus = 1, | ||
51 | Background = 2 | 52 | Background = 2 | ||
52 | }; | 53 | }; | ||
53 | 54 | | |||
54 | explicit SpectacleCore(StartMode theStartMode, | 55 | explicit SpectacleCore(QObject *parent = nullptr); | ||
55 | Spectacle::CaptureMode theCaptureMode, | | |||
56 | QString &theSaveFileName, | | |||
57 | qint64 theDelayMsec, | | |||
58 | bool theNotifyOnGrab, | | |||
59 | bool theCopyToClipboard, | | |||
60 | QObject *parent = nullptr); | | |||
61 | virtual ~SpectacleCore() = default; | 56 | virtual ~SpectacleCore() = default; | ||
57 | void init(); | ||||
62 | 58 | | |||
63 | QString filename() const; | 59 | QString filename() const; | ||
64 | void setFilename(const QString &filename); | 60 | void setFilename(const QString &filename); | ||
65 | 61 | | |||
62 | void populateCommandLineParser(QCommandLineParser *lCmdLineParser); | ||||
63 | | ||||
66 | Q_SIGNALS: | 64 | Q_SIGNALS: | ||
67 | 65 | | |||
68 | void errorMessage(const QString &errString); | 66 | void errorMessage(const QString &errString); | ||
69 | void allDone(); | 67 | void allDone(); | ||
70 | void filenameChanged(const QString &filename); | 68 | void filenameChanged(const QString &filename); | ||
71 | void grabFailed(); | 69 | void grabFailed(); | ||
72 | 70 | | |||
73 | public Q_SLOTS: | 71 | public Q_SLOTS: | ||
74 | 72 | | |||
75 | void takeNewScreenshot(Spectacle::CaptureMode theCaptureMode, int theTimeout, bool theIncludePointer, bool theIncludeDecorations); | 73 | void takeNewScreenshot(Spectacle::CaptureMode theCaptureMode, int theTimeout, bool theIncludePointer, bool theIncludeDecorations); | ||
76 | void showErrorMessage(const QString &theErrString); | 74 | void showErrorMessage(const QString &theErrString); | ||
77 | void screenshotUpdated(const QPixmap &thePixmap); | 75 | void screenshotUpdated(const QPixmap &thePixmap); | ||
78 | void screenshotFailed(); | 76 | void screenshotFailed(); | ||
79 | void dbusStartAgent(); | | |||
80 | void doStartDragAndDrop(); | 77 | void doStartDragAndDrop(); | ||
81 | void doNotify(const QUrl &theSavedAt); | 78 | void doNotify(const QUrl &theSavedAt); | ||
82 | void doCopyPath(const QUrl &savedAt); | 79 | void doCopyPath(const QUrl &savedAt); | ||
83 | 80 | | |||
84 | private: | 81 | void onActivateRequested(QStringList arguments, const QString& /*workingDirectory */); | ||
85 | 82 | | |||
83 | private: | ||||
86 | 84 | | |||
87 | void initGui(bool theIncludePointer, bool theIncludeDecorations); | 85 | void initGui(int theDelay, bool theIncludePointer, bool theIncludeDecorations); | ||
88 | Platform::GrabMode toPlatformGrabMode(Spectacle::CaptureMode theCaptureMode); | 86 | Platform::GrabMode toPlatformGrabMode(Spectacle::CaptureMode theCaptureMode); | ||
89 | void setUpShortcuts(); | 87 | void setUpShortcuts(); | ||
90 | 88 | | |||
91 | StartMode mStartMode; | 89 | StartMode mStartMode; | ||
92 | bool mNotify; | 90 | bool mNotify; | ||
93 | QString mFileNameString; | 91 | QString mFileNameString; | ||
94 | QUrl mFileNameUrl; | 92 | QUrl mFileNameUrl; | ||
95 | PlatformPtr mPlatform; | 93 | PlatformPtr mPlatform; | ||
96 | MainWindowPtr mMainWindow; | 94 | MainWindowPtr mMainWindow; | ||
97 | EditorPtr mQuickEditor; | 95 | EditorPtr mQuickEditor; | ||
98 | bool mIsGuiInited; | 96 | bool mIsGuiInited; | ||
99 | bool mCopyToClipboard; | 97 | bool mCopyToClipboard; | ||
100 | KWayland::Client::PlasmaShell *mWaylandPlasmashell; | 98 | KWayland::Client::PlasmaShell *mWaylandPlasmashell; | ||
101 | }; | 99 | }; |