2 * Copyright (C) 2015 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18#ifndef SESSIONGRABBER_H
19#define SESSIONGRABBER_H
22#include <QSharedPointer>
23#include <QFutureWatcher>
26class QQuickItemGrabResult;
29 * SessionGrabber 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)
33class SessionGrabber : public QObject
37 /// appId is the key of the screenshot name.
38 Q_PROPERTY(QString appId READ appId WRITE setAppId NOTIFY appIdChanged)
40 /// path where the screenshot is saved, can be empty if no screenshot has been grabbed yet.
41 Q_PROPERTY(QString path READ path NOTIFY pathChanged)
43 /// target item for the screenshot grabbing.
44 Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged)
47 explicit SessionGrabber(QObject *parent = 0);
49 QString appId() const;
50 void setAppId(const QString &appId);
52 QQuickItem *target() const;
53 void setTarget(QQuickItem *target);
57 /// Starts grabbing a screenshot. Emits screenshotGrabbed when ready.
58 Q_INVOKABLE void grab();
60 /// Removes the existing screenshot
61 Q_INVOKABLE void removeScreenshot();
68 /// Signals screenshot grabbing has finished.
69 void screenshotGrabbed();
76 void setPath(const QString &path);
81 QFutureWatcher<QString> *m_watcher;
82 QSharedPointer<QQuickItemGrabResult> m_grabResult;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list