on xenial help sign in
Some documentation
fab8160Albert Astals Cid
plugins/SessionScreenshoter/sessionscreenshoter.h+15
@@ -25,12 +25,22 @@
25class QQuickItem;
25class QQuickItem;
26class QQuickItemGrabResult;
26class QQuickItemGrabResult;
27
27
28+/**
29+ * SessionScreenshoter saves to disk screenshots of the given item.
30+ * Images are saved into $HOME/.cache/app_shots/appId.png
31+ * It also handles giving back the screenshot path if it already exists (e.g. because a reboot)
32+ */
28class SessionScreenshoter : public QObject
33class SessionScreenshoter : public QObject
29{
34{
30 Q_OBJECT
35 Q_OBJECT
31
36
37+ /// appId is the key of the screenshot name.
32 Q_PROPERTY(QString appId READ appId WRITE setAppdId NOTIFY appdIdChanged)
38 Q_PROPERTY(QString appId READ appId WRITE setAppdId NOTIFY appdIdChanged)
39+
40+ /// path where the screenshot is saved, can be empty if no screenshot has been taken yet.
33 Q_PROPERTY(QString path READ path NOTIFY pathChanged)
41 Q_PROPERTY(QString path READ path NOTIFY pathChanged)
42+
43+ /// target item for the screenshot taking.
34 Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged)
44 Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged)
35
45
36public:
46public:
@@ -44,13 +54,18 @@ public:
44
54
45 QString path() const;
55 QString path() const;
46
56
57+ /// Starts taking a screenshot. Emits screenshotTaken when ready.
47 Q_INVOKABLE void take();
58 Q_INVOKABLE void take();
59+
60+ /// Removes the existing screenshot
48 Q_INVOKABLE void removeScreenshot();
61 Q_INVOKABLE void removeScreenshot();
49
62
50Q_SIGNALS:
63Q_SIGNALS:
51 void appdIdChanged();
64 void appdIdChanged();
52 void targetChanged();
65 void targetChanged();
53 void pathChanged();
66 void pathChanged();
67+
68+ /// Signals screenshot taking has finished.
54 void screenshotTaken();
69 void screenshotTaken();
55
70
56private Q_SLOTS:
71private Q_SLOTS: