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