Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
FrmViewer.h
1// Author: Kang Lin <kl222@126.com>
2
3#ifndef FRMVIEWER_H
4#define FRMVIEWER_H
5
6#pragma once
7
8#include <QMutex>
9#include <QImage>
10#include <QSharedPointer>
11#include "client_export.h"
12
13#ifdef USE_FROM_OPENGL
14
15 #include "FrmViewerOpenGL.h"
16 #define CFrmViewer CFrmViewerOpenGL
17
18#else
19
20#include <QWidget>
21#include <QSettings>
22#include <QMutex>
23
25
48class CLIENT_EXPORT CFrmViewer : public QWidget
49{
50 Q_OBJECT
51 Q_PROPERTY(double ZoomFactor READ GetZoomFactor WRITE slotSetZoomFactor)
52
53public:
54 explicit CFrmViewer(QWidget *parent = nullptr);
55 virtual ~CFrmViewer() override;
56
61 enum class ADAPT_WINDOWS {
62 Disable = 0,
64 Auto = 1,
65 Original = 2,
67 OriginalCenter = 3,
69 Zoom = 4,
71 ZoomToWindow = 5,
73 KeepAspectRationToWindow = 6,
75 };
76 Q_ENUM(ADAPT_WINDOWS)
77 ADAPT_WINDOWS GetAdaptWindows();
78
86 double GetZoomFactor() const;
87
88 QSize GetDesktopSize();
89
90 enum LED_STATE{
91 Unknown = -1,
92 ScrollLock = 1,
93 NumLock = 1 << 1,
94 CapsLock = 1 << 2,
95 };
96 Q_ENUM(LED_STATE)
97
98public Q_SLOTS:
99 void slotSetAdaptWindows(CFrmViewer::ADAPT_WINDOWS aw = ADAPT_WINDOWS::Original);
100 int slotSetZoomFactor(double newZoomFactor);
101
102 /*================== Internal calls ==================*/
109 void slotSetDesktopSize(int width, int height);
114 void slotSetName(const QString& szName);
120 void slotUpdateRect(const QRect& r, const QImage& image);
121 void slotUpdateRect(const QImage& image);
126 void slotUpdateCursor(const QCursor& cursor);
131 void slotUpdateCursorPosition(const QPoint& pos);
132 void slotUpdateLedState(unsigned int state);
133 void slotSystemCombination();
134 void slotConnected();
135
136Q_SIGNALS:
137 void sigMousePressEvent(QMouseEvent* event, QPoint pos);
138 void sigMouseReleaseEvent(QMouseEvent* event, QPoint pos);
139 void sigMouseMoveEvent(QMouseEvent* event, QPoint pos);
140 void sigMouseMoveEvent(QMouseEvent* event);
141 void sigWheelEvent(QWheelEvent *event, QPoint pos);
142 void sigKeyPressEvent(QKeyEvent *event);
143 void sigKeyReleaseEvent(QKeyEvent *event);
144
145 // Please use CConnecter::sigServerName
146 void sigServerName(const QString &szName);
147
148 // QWidget interface
149protected:
150 virtual void paintEvent(QPaintEvent *event) override;
151
152 virtual void mousePressEvent(QMouseEvent *event) override;
153 virtual void mouseReleaseEvent(QMouseEvent *event) override;
154 virtual void mouseMoveEvent(QMouseEvent *event) override;
155 virtual void wheelEvent(QWheelEvent *event) override;
156 virtual void keyPressEvent(QKeyEvent *event) override;
157 virtual void keyReleaseEvent(QKeyEvent *event) override;
158
159private:
160 QImage m_Desktop;
161 QSize m_DesktopSize;
162
163 ADAPT_WINDOWS m_AdaptWindows;
164 double m_dbZoomFactor;
165
166 int ReSize(int width, int height);
167 void paintDesktop();
168 int TranslationMousePoint(QPointF inPos, QPointF &outPos);
169 QRectF GetAspectRationRect();
170
171public:
172 virtual QImage GrabImage(int x = 0, int y = 0, int w = -1, int h = -1);
173
174public Q_SLOTS:
175 void slotRecordVideo(bool bRecord);
176Q_SIGNALS:
177 void sigRecordVideo(const QImage& img);
178private:
179 bool m_bRecordVideo;
180};
181
182#endif // #ifdef USE_FROM_OPENGL
183
184#endif // FRMVIEWER_H
A widget which displays output image from a CConnectDesktop and sends input keypresses and mouse acti...
Definition FrmViewer.h:49
ADAPT_WINDOWS
The ADAPT_WINDOWS enum.
Definition FrmViewer.h:61
Record video thread.
Definition RecordVideo.h:29