Rabbit Remote Control 0.0.37
Loading...
Searching...
No Matches
OperateDesktop.cpp
1// Author: Kang Lin <kl222@126.com>
2
3#include <QLoggingCategory>
4#include <QDesktopServices>
5#include <QUrl>
6#include <QWidgetAction>
7#include <QActionGroup>
8
9#include "OperateDesktop.h"
10#include "BackendThread.h"
11#include "Plugin.h"
12
13static Q_LOGGING_CATEGORY(log, "Operate.Desktop")
14
16 , m_pPara(nullptr)
17 , m_pThread(nullptr)
18 , m_pFrmViewer(nullptr)
19 , m_pScroll(nullptr)
20 , m_pZoomToWindow(nullptr)
21 , m_pZoomAspectRatio(nullptr)
22 , m_pZoomOriginal(nullptr)
23 , m_pZoomIn(nullptr)
24 , m_pZoomOut(nullptr)
25 , m_psbZoomFactor(nullptr)
26 , m_pScreenShot(nullptr)
27#if HAVE_QT6_RECORD
28 , m_pRecord(nullptr)
29 , m_pRecordPause(nullptr)
30#endif
31{
32 qDebug(log) << Q_FUNC_INFO;
33}
34
35COperateDesktop::~COperateDesktop()
36{
37 qDebug(log) << Q_FUNC_INFO;
38}
39
40const QString COperateDesktop::Id()
41{
42 QString szId = COperate::Id();
43 if(GetParameter())
44 {
45 if(!GetParameter()->GetName().isEmpty())
46 szId += "_" + GetParameter()->GetName();
47 if(!GetParameter()->m_Net.GetHost().isEmpty())
48 szId += "_" + GetParameter()->m_Net.GetHost()
49 + "_" + QString::number(GetParameter()->m_Net.GetPort());
50 CParameterNet* net = nullptr;
51 QString szType;
52 switch(GetParameter()->m_Proxy.GetUsedType())
53 {
54 case CParameterProxy::TYPE::Http: {
55 net = &GetParameter()->m_Proxy.m_Http;
56 szType = "http";
57 break;
58 }
59 case CParameterProxy::TYPE::SockesV5:
60 {
61 net = &GetParameter()->m_Proxy.m_SockesV5;
62 szType = "sockesv5";
63 break;
64 }
65 case CParameterProxy::TYPE::SSHTunnel:
66 {
67 net = &GetParameter()->m_Proxy.m_SSH.m_Net;
68 szType = "ssh";
69 break;
70 }
71 default:
72 break;
73 }
74 if(!szType.isEmpty() && !net->GetHost().isEmpty()) {
75 szId += "_" + szType + "_";
76 szId += net->GetHost() + "_" + QString::number(net->GetPort());
77 }
78 }
79 static QRegularExpression exp("[-@:/#%!^&* \\.]");
80 szId = szId.replace(exp, "_");
81 return szId;
82}
83
84const QString COperateDesktop::Name()
85{
86 QString szName;
87 if(GetParameter() && GetParameter()->GetGlobalParameters()
88 && GetParameter()->GetGlobalParameters()->GetShowProtocolPrefix())
89 szName = Protocol() + ":";
90 if(GetParameter() && !(GetParameter()->GetName().isEmpty()))
91 szName += GetParameter()->GetName();
92 else
93 szName += ServerName();
94 return szName;
95}
96
98{
99 QString szDescription;
100 if(!Name().isEmpty())
101 szDescription = tr("Name: ") + Name() + "\n";
102
103 if(!GetTypeName().isEmpty())
104 szDescription += tr("Type:") + GetTypeName() + "\n";
105
106 if(!Protocol().isEmpty()) {
107 szDescription += tr("Protocol: ") + Protocol();
108#ifdef DEBUG
109 if(!GetPlugin()->DisplayName().isEmpty())
110 szDescription += " - " + GetPlugin()->DisplayName();
111#endif
112 szDescription += "\n";
113 }
114
115 if(!ServerName().isEmpty())
116 szDescription += tr("Server name: ") + ServerName() + "\n";
117
118 if(GetParameter()) {
119 if(!GetParameter()->m_Net.GetHost().isEmpty())
120 szDescription += tr("Server address: ") + GetParameter()->m_Net.GetHost() + ":"
121 + QString::number(GetParameter()->m_Net.GetPort()) + "\n";
122
123 QString szProxy(tr("Proxy") + " ");
124 auto &proxy = GetParameter()->m_Proxy;
125 switch(proxy.GetUsedType()) {
126 case CParameterProxy::TYPE::SSHTunnel:
127 {
128 auto &sshNet = proxy.m_SSH.m_Net;
129 szProxy += "(" + tr("SSH tunnel") + "): " + sshNet.GetHost() + ":"
130 + QString::number(sshNet.GetPort());
131 break;
132 }
133 case CParameterProxy::TYPE::SockesV5:
134 {
135 auto &sockesV5 = proxy.m_SockesV5;
136 szProxy += "(" + tr("Sockes v5") + "): " + sockesV5.GetHost() + ":"
137 + QString::number(sockesV5.GetPort());
138 break;
139 }
140 default:
141 szProxy.clear();
142 break;
143 }
144
145 if(!szProxy.isEmpty())
146 szDescription += szProxy + "\n";
147 }
148
149 if(GetSecurityLevel() != SecurityLevel::No)
150 szDescription += tr("Security level: ") + GetSecurityLevelString() + "\n";
151
152 if(!GetPlugin()->Description().isEmpty())
153 szDescription += tr("Description: ") + GetPlugin()->Description();
154
155 return szDescription;
156}
157
158const qint16 COperateDesktop::Version() const
159{
160 return 0;
161}
162
164{
165 qDebug(log) << Q_FUNC_INFO;
166 int nRet = 0;
167 bool check = false;
168
169 nRet = COperate::Initial();
170 if(nRet)
171 return nRet;
172
173 Q_ASSERT(!(m_pFrmViewer && m_pScroll));
174 m_pFrmViewer = new CFrmViewer(); // The owner is m_pScroll
175 m_pScroll = new CFrmScroll(m_pFrmViewer);
176
177 check = connect(m_pFrmViewer, SIGNAL(sigViewerFocusIn(QWidget*)),
178 this, SIGNAL(sigViewerFocusIn(QWidget*)));
179 Q_ASSERT(check);
180
181 nRet = InitialMenu();
182
183 return nRet;
184}
185
187{
188 qDebug(log) << Q_FUNC_INFO;
189 int nRet = 0;
190 if(m_pScroll)
191 {
192 delete m_pScroll;
193 m_pScroll = nullptr;
194 }
195 nRet = COperate::Clean();
196 return nRet;
197}
198
199int COperateDesktop::InitialMenu()
200{
201 int nRet = 0;
202 bool check = false;
203
204 QMenu* pMenuZoom = new QMenu(&m_Menu);
205 pMenuZoom->setTitle(tr("Zoom"));
206 pMenuZoom->setIcon(QIcon::fromTheme("zoom"));
207 pMenuZoom->setStatusTip(tr("Zoom"));
208 m_pMenuZoom = m_Menu.addMenu(pMenuZoom);
209 m_pZoomToWindow = pMenuZoom->addAction(
210 QIcon::fromTheme("zoom-fit-best"), tr("Zoom to window"));
211 m_pZoomToWindow->setCheckable(true);
212 m_pZoomToWindow->setStatusTip(tr("Zoom to window"));
213 m_pZoomToWindow->setToolTip(tr("Zoom to window"));
214 check = connect(m_pZoomToWindow, &QAction::triggered, this,
215 [&](){
216 m_pScroll->slotSetAdaptWindows(
218 });
219 Q_ASSERT(check);
220 m_pZoomAspectRatio = pMenuZoom->addAction(
221 QIcon::fromTheme("zoom-aspect-ratio"),
222 tr("Keep aspect ration to windows"));
223 m_pZoomAspectRatio->setCheckable(true);
224 m_pZoomAspectRatio->setStatusTip(tr("Keep aspect ration to windows"));
225 m_pZoomAspectRatio->setToolTip(tr("Keep aspect ration to windows"));
226 check = connect(m_pZoomAspectRatio, &QAction::triggered, this,
227 [&](){
228 m_pScroll->slotSetAdaptWindows(
230 });
231 Q_ASSERT(check);
232 m_pZoomOriginal = pMenuZoom->addAction(
233 QIcon::fromTheme("zoom-original"), tr("Original"));
234 m_pZoomOriginal->setCheckable(true);
235 m_pZoomOriginal->setStatusTip(tr("Original"));
236 m_pZoomOriginal->setToolTip(tr("Original"));
237 check = connect(m_pZoomOriginal, &QAction::triggered, this,
238 [&](){
239 m_pScroll->slotSetAdaptWindows(
241 });
242 Q_ASSERT(check);
243 m_pZoomIn = pMenuZoom->addAction(QIcon::fromTheme("zoom-in"), tr("Zoom in"));
244 m_pZoomIn->setCheckable(true);
245 m_pZoomIn->setStatusTip(tr("Zoom in"));
246 m_pZoomIn->setToolTip(tr("Zoom in"));
247 check = connect(
248 m_pZoomIn, &QAction::triggered, this,
249 [&](){
250 double factor = 0;
251 if(m_psbZoomFactor) {
252 factor = (m_pFrmViewer->GetZoomFactor() + 0.1) * 100;
253 qDebug(log) << "Zoom in:" << factor;
254 m_psbZoomFactor->setValue(factor);
255 }
256 });
257 Q_ASSERT(check);
258 m_pZoomOut = pMenuZoom->addAction(
259 QIcon::fromTheme("zoom-out"), tr("Zoom out"));
260 m_pZoomOut->setCheckable(true);
261 m_pZoomOut->setStatusTip(tr("Zoom out"));
262 m_pZoomOut->setToolTip(tr("Zoom out"));
263 check = connect(
264 m_pZoomOut, &QAction::triggered, this,
265 [&](){
266 double factor = 100;
267 if(m_psbZoomFactor) {
268 factor = (m_pFrmViewer->GetZoomFactor() - 0.1) * 100;
269 qDebug(log) << "Zoom out:" << factor;
270 m_psbZoomFactor->setValue(factor);
271 }
272 });
273 Q_ASSERT(check);
274 QActionGroup* pGBViewZoom = new QActionGroup(this);
275 if(pGBViewZoom) {
276 pGBViewZoom->addAction(m_pZoomToWindow);
277 pGBViewZoom->addAction(m_pZoomAspectRatio);
278 pGBViewZoom->addAction(m_pZoomOriginal);
279 pGBViewZoom->addAction(m_pZoomIn);
280 pGBViewZoom->addAction(m_pZoomOut);
281 check = connect(pGBViewZoom, &QActionGroup::triggered,
282 this, [&](QAction* a){
283 if(a == m_pZoomIn || a == m_pZoomOut)
284 m_psbZoomFactor->setEnabled(true);
285 else {
286 m_psbZoomFactor->setEnabled(false);
287 }
288 });
289 }
290 m_psbZoomFactor = new QSpinBox(pMenuZoom);
291 m_psbZoomFactor->setRange(0, 9999999);
292 m_psbZoomFactor->setValue(100);
293 m_psbZoomFactor->setSuffix("%");
294 m_psbZoomFactor->setEnabled(false);
295 //m_psbZoomFactor->setFocusPolicy(Qt::NoFocus);
296 check = connect(
297 m_psbZoomFactor, SIGNAL(valueChanged(int)),
298 this, SLOT(slotValueChanged(int)));
299 Q_ASSERT(check);
300 QWidgetAction* pFactor = new QWidgetAction(pMenuZoom);
301 pFactor->setDefaultWidget(m_psbZoomFactor);
302 pMenuZoom->insertAction(m_pZoomOut, pFactor);
303
304 QMenu* pMenuShortCut = new QMenu(&m_Menu);
305 pMenuShortCut->setTitle(tr("Send shortcut key"));
306 m_Menu.addMenu(pMenuShortCut);
307 pMenuShortCut->addAction(
308 tr("Send Ctl+Alt+Del"), this, SLOT(slotShortcutCtlAltDel()));
309 pMenuShortCut->addAction(
310 tr("Send lock screen (Win+L)"), this, SLOT(slotShortcutLock()));
311
312 m_Menu.addSeparator();
313 m_pScreenShot = new QAction(QIcon::fromTheme("camera-photo"),
314 tr("ScreenShot"), &m_Menu);
315 m_pScreenShot->setStatusTip(tr("ScreenShot"));
316 m_pScreenShot->setToolTip(tr("ScreenShot"));
317 check = connect(m_pScreenShot, SIGNAL(triggered()),
318 this, SLOT(slotScreenShot()));
319 Q_ASSERT(check);
320 m_Menu.addAction(m_pScreenShot);
321#if HAVE_QT6_RECORD
322 m_pRecord = new QAction(
323 QIcon::fromTheme("media-record"), tr("Start record"), &m_Menu);
324 m_pRecord->setCheckable(true);
325 m_pRecord->setStatusTip(tr("Start record"));
326 m_pRecord->setToolTip(tr("Start record"));
327 check = connect(m_pRecord, SIGNAL(triggered(bool)),
328 this, SLOT(slotRecord(bool)));
329 Q_ASSERT(check);
330 m_Menu.addAction(m_pRecord);
331 m_pRecordPause = new QAction(
332 QIcon::fromTheme("media-playback-pause"), tr("Record pause"), &m_Menu);
333 m_pRecordPause->setToolTip(tr("Record pause"));
334 m_pRecordPause->setStatusTip(tr("Record pause"));
335 m_pRecordPause->setCheckable(true);
336 m_pRecordPause->setEnabled(false);
337 check = connect(m_pRecordPause, SIGNAL(triggered(bool)),
338 this, SIGNAL(sigRecordPause(bool)));
339 Q_ASSERT(check);
340 m_Menu.addAction(m_pRecordPause);
341#endif
342
343 m_Menu.addSeparator();
344 if(m_pActionSettings)
345 m_Menu.addAction(m_pActionSettings);
346
347 return nRet;
348}
349
351{
352 return m_pScroll;
353}
354
355int COperateDesktop::Start()
356{
357 qDebug(log) << Q_FUNC_INFO;
358 int nRet = 0;
359 m_pThread = new CBackendThread(this);
360 if(!m_pThread) {
361 qCritical(log) << "new CBackendThread fail";
362 return -2;
363 }
364
365 m_pThread->start();
366
367 return nRet;
368}
369
370int COperateDesktop::Stop()
371{
372 qDebug(log) << Q_FUNC_INFO;
373 int nRet = 0;
374 if(m_pThread)
375 {
376 m_pThread->quit();
377 //Don't delete m_pThread, See CConnectThread
378 m_pThread = nullptr;
379 }
380 return nRet;
381}
382
384{
385 if(GetParameter())
386 {
387 GetParameter()->SetGlobalParameters(pPara);
389 LoadAdaptWindows();
390 return 0;
391 } else {
392 QString szMsg = "There is not parameters! "
393 "please first create parameters, "
394 "then call SetParameter() in the ";
395 szMsg += metaObject()->className() + QString("::")
396 + metaObject()->className();
397 szMsg += QString("() or ") + metaObject()->className()
398 + QString("::") + "Initial()";
399 szMsg += " to set the parameters pointer. "
400 "Default set CParameterClient for the parameters of operate "
401 "(CParameterOperate or its derived classes) "
402 "See CManager::CreateOperate. "
403 "If you are sure the parameter of operate "
404 "does not need CParameterClient. "
405 "Please overload the SetGlobalParameters() in the ";
406 szMsg += QString(metaObject()->className()) + " . don't set it";
407 qCritical(log) << szMsg.toStdString().c_str();
408 Q_ASSERT(false);
409 }
410 return -1;
411}
412
414{
415 return m_pPara;
416}
417
419{
420 Q_ASSERT(!m_pPara);
421 m_pPara = p;
422 if(GetParameter())
423 {
424 bool check = false;
425 check = connect(GetParameter(), SIGNAL(sigNameChanged()),
426 this, SLOT(slotUpdateName()));
427 Q_ASSERT(check);
428 check = connect(GetParameter(), SIGNAL(sigShowServerNameChanged()),
429 this, SLOT(slotUpdateName()));
430 Q_ASSERT(check);
431 check = connect(GetParameter(), &CParameter::sigChanged,
432 this, [&](){
433 emit this->sigUpdateParameters(this);
434 });
435 Q_ASSERT(check);
436 CFrmViewer* pViewer = m_pFrmViewer;
437 if(pViewer) {
438 check = connect(GetParameter(), SIGNAL(sigZoomFactorChanged(double)),
439 pViewer, SLOT(slotSetZoomFactor(double)));
440 Q_ASSERT(check);
441 check = connect(
442 GetParameter(),
443 SIGNAL(sigAdaptWindowsChanged(CFrmViewer::ADAPT_WINDOWS)),
444 pViewer, SLOT(slotSetAdaptWindows(CFrmViewer::ADAPT_WINDOWS)));
445 Q_ASSERT(check);
446 check = connect(GetParameter(), SIGNAL(sigEnableInputMethod(bool)),
447 pViewer, SLOT(slotEnableInputMethod(bool)));
448 Q_ASSERT(check);
449 }
450 }
451 return 0;
452}
453
454int COperateDesktop::LoadAdaptWindows()
455{
456 if(m_pFrmViewer && GetParameter())
457 {
458 m_pFrmViewer->slotSetZoomFactor(GetParameter()->GetZoomFactor());
459 if(m_psbZoomFactor)
460 m_psbZoomFactor->setValue(m_pFrmViewer->GetZoomFactor() * 100);
461 CFrmViewer::ADAPT_WINDOWS aw = GetParameter()->GetAdaptWindows();
463 if(m_pZoomToWindow) {
464 m_pZoomToWindow->trigger();
465 }
467 if(m_pZoomAspectRatio) {
468 m_pZoomAspectRatio->trigger();
469 }
470 } else if(CFrmViewer::ADAPT_WINDOWS::Original == aw) {
471 if(m_pZoomOriginal) {
472 m_pZoomOriginal->trigger();
473 }
474 } else if(CFrmViewer::ADAPT_WINDOWS::Zoom == aw) {
475 if(m_pZoomIn) {
476 m_pZoomIn->trigger();
477 }
478 }
479 }
480 return 0;
481}
482
483int COperateDesktop::Load(QSettings &set)
484{
485 int nRet = 0;
486 Q_ASSERT(m_pFrmViewer);
487 nRet = COperate::Load(set);
488 if(m_pPara)
489 nRet = m_pPara->Load(set);
490 else {
491 QString szMsg = "There is not parameters! "
492 "please first create parameters, "
493 "then call SetParameter() in the ";
494 szMsg += metaObject()->className() + QString("::")
495 + metaObject()->className();
496 szMsg += QString("() or ") + metaObject()->className()
497 + QString("::") + "Initial()";
498 szMsg += " to set the parameters pointer. ";
499 qWarning(log) << szMsg.toStdString().c_str();
500 Q_ASSERT(false);//TODO: delete it
501 }
502
503 LoadAdaptWindows();
504 return nRet;
505}
506
507int COperateDesktop::Save(QSettings &set)
508{
509 int nRet = 0;
510 Q_ASSERT(GetParameter());
511 if(GetParameter() && m_pFrmViewer)
512 {
513 GetParameter()->SetAdaptWindows(m_pFrmViewer->GetAdaptWindows());
514 GetParameter()->SetZoomFactor(m_pFrmViewer->GetZoomFactor());
515 }
516 nRet = COperate::Save(set);
517 if(m_pPara)
518 nRet = m_pPara->Save(set);
519 return nRet;
520}
521
522#if HAVE_QT6_RECORD
523void COperateDesktop::slotRecord(bool checked)
524{
525 qDebug(log) << Q_FUNC_INFO << checked;
526 QAction* pRecord = qobject_cast<QAction*>(sender());
527 if(pRecord)
528 {
529 if(checked) {
530 //pRecord->setIcon(QIcon::fromTheme("media-playback-stop"));
531 pRecord->setText(tr("Stop record"));
532 } else {
533 //pRecord->setIcon(QIcon::fromTheme("media-playback-start"));
534 pRecord->setText(tr("Start record"));
535 }
536 m_pRecordPause->setEnabled(checked);
537 emit sigRecord(checked);
538 }
539}
540
541void COperateDesktop::slotRecorderStateChanged(
542 QMediaRecorder::RecorderState state)
543{
544 qDebug(log) << Q_FUNC_INFO << state;
545 if(QMediaRecorder::StoppedState == state)
546 {
547 m_pRecord->setChecked(false);
548 m_pRecordPause->setChecked(false);
549 }
550}
551#endif
552
554{
555 qDebug(log) << "zoom:" << v;
556 if(!m_pScroll || !m_pFrmViewer) return;
557 m_pFrmViewer->slotSetZoomFactor(((double)v) / 100);
558 m_pScroll->slotSetAdaptWindows(CFrmViewer::ADAPT_WINDOWS::Zoom);
559}
560
561void COperateDesktop::slotScreenShot()
562{
563 if(!GetParameter() || !m_pFrmViewer)
564 return;
565 auto &record = GetParameter()->m_Record;
566 QString szFile = record.GetImageFile(true);
567 bool bRet = m_pFrmViewer->GrabImage().save(szFile);
568 if(bRet)
569 qDebug(log) << "Success: save screenshot to" << szFile;
570 else
571 qCritical(log) << "Fail: save screenshot to" << szFile;
572 if(record.GetEndAction() != CParameterRecord::ENDACTION::No)
573 QDesktopServices::openUrl(QUrl::fromLocalFile(szFile));
574}
575
576void COperateDesktop::slotShortcutCtlAltDel()
577{
578 if(!m_pFrmViewer)
579 return;
580 // Send ctl+alt+del
581 emit m_pFrmViewer->sigKeyPressEvent(new QKeyEvent(QKeyEvent::KeyPress, Qt::Key_Control, Qt::ControlModifier));
582 emit m_pFrmViewer->sigKeyPressEvent(new QKeyEvent(QKeyEvent::KeyPress, Qt::Key_Alt, Qt::AltModifier));
583 emit m_pFrmViewer->sigKeyPressEvent(new QKeyEvent(QKeyEvent::KeyPress, Qt::Key_Delete, Qt::ControlModifier | Qt::AltModifier));
584 emit m_pFrmViewer->sigKeyPressEvent(new QKeyEvent(QKeyEvent::KeyRelease, Qt::Key_Control, Qt::ControlModifier));
585 emit m_pFrmViewer->sigKeyPressEvent(new QKeyEvent(QKeyEvent::KeyRelease, Qt::Key_Alt, Qt::AltModifier));
586 emit m_pFrmViewer->sigKeyPressEvent(new QKeyEvent(QKeyEvent::KeyRelease, Qt::Key_Delete, Qt::ControlModifier | Qt::AltModifier));
587}
588
589void COperateDesktop::slotShortcutLock()
590{
591 if(!m_pFrmViewer)
592 return;
593 // Send ctl+alt+del
594 emit m_pFrmViewer->sigKeyPressEvent(new QKeyEvent(QKeyEvent::KeyPress, Qt::Key_Super_L, Qt::NoModifier));
595 emit m_pFrmViewer->sigKeyPressEvent(new QKeyEvent(QKeyEvent::KeyPress, Qt::Key_L, Qt::NoModifier));
596 emit m_pFrmViewer->sigKeyPressEvent(new QKeyEvent(QKeyEvent::KeyRelease, Qt::Key_Super_L, Qt::NoModifier));
597 emit m_pFrmViewer->sigKeyPressEvent(new QKeyEvent(QKeyEvent::KeyRelease, Qt::Key_L, Qt::NoModifier));
598}
599
600
602{
603 if(GetParameter())
604 if(!GetParameter()->GetShowServerName()
605 || m_szServerName.isEmpty())
606 {
607 if(!GetParameter()->m_Net.GetHost().isEmpty())
608 return GetParameter()->m_Net.GetHost() + ":"
609 + QString::number(GetParameter()->m_Net.GetPort());
610 }
611 if(GetParameter() && GetParameter()->GetGlobalParameters()
612 && GetParameter()->GetGlobalParameters()->GetShowIpPortInName())
613 {
614 return GetParameter()->m_Net.GetHost()
615 + ":" + QString::number(GetParameter()->m_Net.GetPort());
616 }
617 if(m_szServerName.isEmpty() && GetParameter())
618 return GetParameter()->GetServerName();
619 return m_szServerName;
620}
621
622void COperateDesktop::slotSetServerName(const QString& szName)
623{
624 if(m_szServerName == szName)
625 return;
626
627 m_szServerName = szName;
628 if(GetParameter())
629 {
630 if(GetParameter()->GetServerName() == szName)
631 return;
632 GetParameter()->SetServerName(szName);
633 }
634
635 emit sigUpdateName(Name());
636}
The backend thread.
virtual void quit()
Quit.
The scroll form class.
Definition FrmScroll.h:17
A widget which displays output image from a CConnectDesktop and sends input keypresses and mouse acti...
Definition FrmViewer.h:48
ADAPT_WINDOWS
The ADAPT_WINDOWS enum.
Definition FrmViewer.h:60
@ Original
Original desktop size, the left-top of the desktop is aligned with the left-top of the window.
@ Zoom
zoom windows = desktop size * factor
@ KeepAspectRationToWindow
Keep desktop aspectration adapt to windows.
@ ZoomToWindow
Desktop adapt to windows.
double GetZoomFactor() const
Adjust the zoom factor.
Remote desktop operate interface.
virtual QString ServerName()
Current connect server name (remote desktop name, if not present, then IP:PORT).
virtual int SetParameter(CParameterBase *p)
Set parameter pointer.
virtual void slotSetServerName(const QString &szName)
virtual int Save(QSettings &set) override
Save parameters.
virtual const QString Name() override
Name.
virtual const qint16 Version() const override
Version.
virtual int Load(QSettings &set) override
Load parameters.
virtual const QString Id() override
Identity.
virtual int Initial() override
Initial parameters and resource.
virtual QWidget * GetViewer() override
Get Viewer.
void slotValueChanged(int v)
emit by zoom menu in the class
virtual int SetGlobalParameters(CParameterPlugin *pPara) override
Apply the global parameters of the plug-in.
virtual const QString Description() override
Description.
virtual int Clean() override
Clean parameters and resource.
virtual CParameterBase * GetParameter()
Get parameter.
Operate interface.
Definition Operate.h:50
virtual int Load(QSettings &set)
Load parameters.
Definition Operate.cpp:211
virtual int Save(QSettings &set)
Save parameters.
Definition Operate.cpp:218
virtual Q_INVOKABLE int Initial()
Initial parameters and resource.
Definition Operate.cpp:225
virtual const QString Protocol() const
Protocol.
Definition Operate.cpp:71
virtual Q_INVOKABLE int SetGlobalParameters(CParameterPlugin *pPara)=0
Apply the global parameters of the plug-in.
Definition Operate.cpp:259
virtual Q_INVOKABLE int Clean()
Clean parameters and resource.
Definition Operate.cpp:242
void sigViewerFocusIn(QWidget *pView)
The view is focus.
Q_INVOKABLE CPlugin * GetPlugin() const
Get plugin.
Definition Operate.cpp:254
void sigUpdateParameters(COperate *pOperate)
Update parameters, notify application to save or show parameters.
virtual const QString Id()
Identity.
Definition Operate.cpp:33
void sigUpdateName(const QString &szName)
virtual const QString GetTypeName() const
Get type name.
Definition Operate.cpp:76
The interface of connecter parameters.
Basic network parameters.
Global parameters of plugins.
virtual int Save(QString szFile=QString(), bool bForce=true)
Save to file.
Definition Parameter.cpp:46
void sigChanged()
emit when the parameter changes Usually if required, the corresponding parameter corresponds to a cha...
virtual int Load(QString szFile=QString())
Load from file.
Definition Parameter.cpp:35
Plugin interface.
Definition Plugin.h:15
virtual const QString DisplayName() const
The plugin display name.
Definition Plugin.cpp:73
virtual const QString Description() const =0
Plugin description.