| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef KSNIP_WAYLANDIMAGEGRABBER_H |
| 21 |
#define KSNIP_WAYLANDIMAGEGRABBER_H |
| 22 |
|
| 23 |
#include <QtDBus/QDBusConnection> |
| 24 |
#include <QtDBus/QDBusInterface> |
| 25 |
#include <QtDBus/QDBusReply> |
| 26 |
#include <QUrl> |
| 27 |
|
| 28 |
#include "AbstractImageGrabber.h" |
| 29 |
#include "src/common/dtos/CaptureFromFileDto.h" |
| 30 |
#include "src/common/platform/HdpiScaler.h" |
| 31 |
|
| 32 |
class WaylandImageGrabber : public AbstractImageGrabber |
| 33 |
{ |
| 34 |
Q_OBJECT |
| 35 |
public: |
| 36 |
explicit WaylandImageGrabber(const QSharedPointer<IConfig> &config); |
| 37 |
~WaylandImageGrabber() override = default; |
| 38 |
|
| 39 |
public slots: |
| 40 |
void gotScreenshotResponse(uint response, const QVariantMap& results); |
| 41 |
|
| 42 |
protected: |
| 43 |
void grab() override; |
| 44 |
|
| 45 |
private: |
| 46 |
int mRequestTokenCounter; |
| 47 |
HdpiScaler mHdpiScaler; |
| 48 |
|
| 49 |
QString getRequestToken(); |
| 50 |
|
| 51 |
static QString getPathToScreenshot(const QVariantMap &results); |
| 52 |
static bool isTemporaryImage(const QString &path); |
| 53 |
static bool isResponseValid(uint response, const QVariantMap &results); |
| 54 |
QDBusMessage getDBusMessage(); |
| 55 |
|
| 56 |
private slots: |
| 57 |
void portalResponse(QDBusPendingCallWatcher *watcher); |
| 58 |
bool isInteractiveCapture() const; |
| 59 |
QPixmap createPixmapFromPath(const QString &path) const; |
| 60 |
}; |
| 61 |
|
| 62 |
#endif |