clipboardmanager.h 871 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef CLIPBOARDMANAGER_H
  2. #define CLIPBOARDMANAGER_H
  3. #include <QObject>
  4. #include <QClipboard>
  5. #include <QDebug>
  6. #include <QMap>
  7. class ClipboardManager : public QObject
  8. {
  9. Q_OBJECT
  10. public:
  11. explicit ClipboardManager(QObject *parent = nullptr);
  12. ~ClipboardManager() { delete m_pbinbuf; delete m_ptextbuf; }
  13. QByteArray data() const;
  14. private:
  15. void clear();
  16. QClipboard* m_pclipboard;
  17. QByteArray* m_pbinbuf; // out bin
  18. QByteArray* m_ptextbuf; // in base64
  19. QString m_fileName;
  20. qint64 m_lastBufferChanging = 0;
  21. QString m_myHardwareId;
  22. signals:
  23. void readyToSave(QString name);
  24. void preparedToTransfer(QString name);
  25. void rawBufferChanged(QString name);
  26. void tooBigSize(QString string);
  27. void clearFields();
  28. public slots:
  29. void handleClipboard();
  30. void prepareToTransfer();
  31. };
  32. #endif // CLIPBOARDMANAGER_H