File indexing completed on 2024-04-28 16:13:22

0001 /**
0002  * SPDX-FileCopyrightText: 2019 Black Hat <bhat@encom.eu.org>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-only
0005  */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 
0011 class QClipboard;
0012 class QImage;
0013 
0014 /**
0015  * Clipboard proxy
0016  */
0017 class Clipboard : public QObject
0018 {
0019     Q_OBJECT
0020     Q_PROPERTY(bool hasImage READ hasImage NOTIFY imageChanged)
0021     Q_PROPERTY(QImage image READ image NOTIFY imageChanged)
0022 
0023 public:
0024     explicit Clipboard(QObject *parent = nullptr);
0025 
0026     [[nodiscard]] bool hasImage() const;
0027     [[nodiscard]] QImage image() const;
0028 
0029     Q_INVOKABLE bool saveImage(const QUrl &localPath) const;
0030 
0031     Q_INVOKABLE void saveText(QString message);
0032 
0033 private:
0034     QClipboard *m_clipboard;
0035 
0036 Q_SIGNALS:
0037     void imageChanged();
0038 };