Unity 8
screengrabber.h
1 /*
2  * Copyright (C) 2014-2015 Canonical, Ltd.
3  *
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.
7  *
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.
12  *
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/>.
15  */
16 
17 #ifndef SNAPSHOTTER_H
18 #define SNAPSHOTTER_H
19 
20 #include <QObject>
21 #include <QString>
22 
23 class ScreenGrabber: public QObject
24 {
25  Q_OBJECT
26 
27 public:
28  explicit ScreenGrabber(QObject *parent = 0);
29  ~ScreenGrabber() = default;
30 
31 public Q_SLOTS:
32  void captureAndSave(int angle = 0);
33 
34 Q_SIGNALS:
35  void screenshotSaved(const QString &filename);
36 
37 private:
38  QString makeFileName() const;
39  QString getFormat() const;
40  QString fileNamePrefix;
41  int screenshotQuality = -1; // default quality for the format
42 };
43 
44 #endif