18#ifndef SCREENCAPTURE_H
19#define SCREENCAPTURE_H
28class RectangleSelector;
31class ScreenCapture :
public QObject
36 enum CaptureMode { Fullscreen, Rectangle, Window, Interactive };
38 explicit ScreenCapture(
const QString &outputFile, CaptureMode mode, QObject *parent =
nullptr);
41 void startRecording();
43 static bool isWayland();
46 void finished(
bool success);
47 void beginRecording(
const QRect &captureRect);
48 void onSelectionCanceled();
51 void onCaptureModeSelected(CaptureMode mode);
52 void onRectangleSelected(
const QRect &rect);
53 void onWindowSelected(
const QRect &rect);
54 void onImageRectangleSelected(
const QRect &rect);
55 void onImageWindowSelected(
const QRect &rect);
57 void onPortalResponse(uint response,
const QVariantMap &results);
60 void startFullscreenRecording();
61 void startRectangleRecording();
62 void startWindowRecording();
63 void startFullscreenSnapshot();
64 void startRectangleSnapshot();
65 void startWindowSnapshot();
66 void captureAndSaveImage(
const QRect &rect);
67 void doCaptureAndSaveImage(
const QRect &rect);
68 QPixmap captureScreen(
const QRect &rect);
69 QRect adjustRectForVideo(
const QRect &rect);
70 QRect applyDevicePixelRatio(
const QRect &rect);
71 QRect invertDevicePixelRatio(
const QRect &rect);
72 bool captureImagePortal(
const QRect &rect,
const QString &outputPath);
75 bool m_portalSuccess =
false;
77 QEventLoop *m_portalEventLoop =
nullptr;
83 std::unique_ptr<ToolbarWidget> m_toolbar;
84 std::unique_ptr<RectangleSelector> m_rectangleSelector;
85 std::unique_ptr<WindowPicker> m_windowPicker;