Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
ClipboardFreeRDP.h
1// Author: Kang Lin <kl222@126.com>
2
3#ifndef CCLIPBOARDFREERDP_H
4#define CCLIPBOARDFREERDP_H
5
6#include <QObject>
7#include <QVector>
8#include <QLoggingCategory>
9#include <QList>
10#include "ClipboardMimeData.h"
11#include "freerdp/client/cliprdr.h"
12#include "winpr/clipboard.h"
13
14class CConnectFreeRDP;
15class CClipboardFreeRDP : public QObject
16{
17 Q_OBJECT
18public:
19 explicit CClipboardFreeRDP(CConnectFreeRDP *parent = nullptr);
20 virtual ~CClipboardFreeRDP();
21
22 int Init(CliprdrClientContext *context, bool bEnable);
23 int UnInit(CliprdrClientContext* context, bool bEnable);
24
25 static UINT cb_cliprdr_server_capabilities(CliprdrClientContext* context,
26 const CLIPRDR_CAPABILITIES* capabilities);
27
28 static UINT cb_cliprdr_server_format_list(CliprdrClientContext* context,
29 const CLIPRDR_FORMAT_LIST* formatList);
30 static UINT
31 cb_cliprdr_server_format_list_response(CliprdrClientContext* context,
32 const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse);
33
34 static UINT
35 cb_cliprdr_server_format_data_response(CliprdrClientContext* context,
36 const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse);
37 static UINT
38 cb_cliprdr_server_file_contents_request(CliprdrClientContext* context,
39 const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest);
40 static UINT
41 cb_cliprdr_server_file_contents_response(CliprdrClientContext* context,
42 const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse);
43
45 static UINT cb_cliprdr_monitor_ready(CliprdrClientContext* context,
46 const CLIPRDR_MONITOR_READY* monitorReady);
47 static UINT SendClientFormatList(CliprdrClientContext *context);
48
50 static UINT
51 cb_cliprdr_server_format_data_request(CliprdrClientContext* context,
52 const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest);
53 static UINT SendFormatDataResponse(CliprdrClientContext* context,
54 const BYTE* data, size_t size);
55public Q_SLOTS:
56 static UINT slotSendFormatDataRequest(CliprdrClientContext* context,
57 UINT32 formatId);
58
59public:
61 static UINT SendFileContentsFailure(CliprdrClientContext* context,
62 const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest);
63 UINT ServerFileSizeRequest(
64 const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest);
65 UINT ServerFileRangeRequest(
66 const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest);
67 static UINT cb_clipboard_file_size_success(wClipboardDelegate* delegate,
68 const wClipboardFileSizeRequest* request,
69 UINT64 fileSize);
70 static UINT cb_clipboard_file_size_failure(
71 wClipboardDelegate* delegate,
72 const wClipboardFileSizeRequest* request,
73 UINT errorCode);
74 static UINT cb_clipboard_file_range_success(
75 wClipboardDelegate* delegate,
76 const wClipboardFileRangeRequest* request,
77 const BYTE* data, UINT32 size);
78 static UINT cb_clipboard_file_range_failure(
79 wClipboardDelegate* delegate,
80 const wClipboardFileRangeRequest* request,
81 UINT errorCode);
82 static BOOL cbIsFileNameComponentValid(LPCWSTR lpFileName);
83
84public Q_SLOTS:
85 virtual void slotClipBoardChanged();
86
87Q_SIGNALS:
94 void sigServerFormatData(const BYTE* pData, UINT32 nLen,
95 UINT32 formatId);
96 void sigServerFileContentsRespose(UINT32 streamId, QByteArray& data);
97
98private:
99 CConnectFreeRDP* m_pConnect;
100 CliprdrClientContext* m_pCliprdrClientContext;
101 friend CClipboardMimeData;
102 QList<qint32> m_lstClipboardMimeDataId;
103 wClipboard* m_pClipboard; // Clipboard interface provided by winpr
104 // Client request format data
105 UINT32 m_RequestFormatId;
106
107 // File
108 UINT32 m_FileCapabilityFlags;
109 bool m_bFileSupported; // Whether is server support file
110 BOOL m_bFileFormatsRegistered;
111};
112
113#endif // CCLIPBOARDFREERDP_H
void sigServerFormatData(const BYTE *pData, UINT32 nLen, UINT32 formatId)
Notify clipboard get data from server.