-
Notifications
You must be signed in to change notification settings - Fork 21
/
screenapi.h
61 lines (49 loc) · 1.48 KB
/
screenapi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef SCREENSHOTAPI_H
#define SCREENSHOTAPI_H
#include <QObject>
#include <QDebug>
#include <QFile>
#include <QPainter>
#include <QDBusObjectPath>
#include <QMutex>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <liboxide.h>
#include "apibase.h"
#include "screenshot.h"
#define DISPLAYWIDTH 1404
#define DISPLAYHEIGHT 1872
#define TEMP_USE_REMARKABLE_DRAW 0x0018
#define remarkable_color uint16_t
#define DISPLAYSIZE DISPLAYWIDTH * DISPLAYHEIGHT * sizeof(remarkable_color)
#define screenAPI ScreenAPI::singleton()
class ScreenAPI : public APIBase {
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", OXIDE_SCREEN_INTERFACE)
Q_PROPERTY(bool enabled READ enabled)
Q_PROPERTY(QList<QDBusObjectPath> screenshots READ screenshots)
public:
static ScreenAPI* singleton(ScreenAPI* self = nullptr);
ScreenAPI(QObject* parent);
void setEnabled(bool enabled);
bool enabled();
QList<QDBusObjectPath> screenshots();
Q_INVOKABLE QDBusObjectPath screenshot();
public slots:
QDBusObjectPath addScreenshot(QByteArray blob);
signals:
void screenshotAdded(QDBusObjectPath);
void screenshotRemoved(QDBusObjectPath);
void screenshotModified(QDBusObjectPath);
private:
QList<Screenshot*> m_screenshots;
bool m_enabled;
QMutex mutex;
Screenshot* addScreenshot(QString filePath);
void mkdirs(const QString& path, mode_t mode = 0700);
QString getTimestamp();
QString getNextPath();
};
#endif // SCREENSHOTAPI_H