18#ifndef SCREENCAPTURE_H
19#define SCREENCAPTURE_H
28class ScreenCaptureToolbar;
29class RectangleSelector;
32class ScreenCapture :
public QObject
37 enum CaptureMode { Fullscreen, Rectangle, Window, Interactive };
39 explicit ScreenCapture(
const QString &outputFile, CaptureMode mode, QObject *parent =
nullptr);
42 void startRecording();
44 static bool isWayland();
47 void finished(
bool success);
48 void beginRecording(
const QRect &captureRect,
bool recordAudio);
49 void onSelectionCanceled();
50 void minimizeShotcut();
53 void onCaptureModeSelected(CaptureMode mode,
bool minimizeShotcut,
bool recordAudio);
54 void onRectangleSelected(
const QRect &rect);
55 void onWindowSelected(
const QRect &rect);
56 void onImageRectangleSelected(
const QRect &rect);
57 void onImageWindowSelected(
const QRect &rect);
59 void onPortalResponse(uint response,
const QVariantMap &results);
62 void startFullscreenRecording();
63 void startRectangleRecording();
64 void startWindowRecording();
65 void startFullscreenSnapshot();
66 void startRectangleSnapshot();
67 void startWindowSnapshot();
68 void captureAndSaveImage(
const QRect &rect);
69 void doCaptureAndSaveImage(
const QRect &rect);
70 QPixmap captureScreen(
const QRect &rect);
71 QRect adjustRectForVideo(
const QRect &rect);
72 QRect applyDevicePixelRatio(
const QRect &rect);
73 QRect invertDevicePixelRatio(
const QRect &rect);
74 bool captureImagePortal(
const QRect &rect,
const QString &outputPath);
77 bool m_portalSuccess =
false;
79 QEventLoop *m_portalEventLoop =
nullptr;
84 bool m_minimizeShotcut;
87 std::unique_ptr<ScreenCaptureToolbar> m_toolbar;
88 std::unique_ptr<RectangleSelector> m_rectangleSelector;
89 std::unique_ptr<WindowPicker> m_windowPicker;