Rabbit Remote Control 0.0.36
Loading...
Searching...
No Matches
DlgSetFreeRDP.cpp
1// Author: Kang Lin <kl222@126.com>
2
3#if HAVE_OPENSSL
4#include <openssl/tls1.h>
5#endif
6
7#include "DlgSetFreeRDP.h"
8#include "ui_DlgSetFreeRDP.h"
9#include "ParameterNetUI.h"
10
11#include <QApplication>
12#include <QScreen>
13#include <QFileSystemModel>
14#include <QButtonGroup>
15#include <QLoggingCategory>
16
17#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
18 #include <QMediaDevices>
19 #include <QAudioDevice>
20#else
21 #include <QAudioDeviceInfo>
22#endif
23
24#include "DlgDesktopSize.h"
25#include "freerdp/version.h"
26
27static Q_LOGGING_CATEGORY(log, "FreeRDP.Parameter.Dlg")
28
29CDlgSetFreeRDP::CDlgSetFreeRDP(CParameterFreeRDP *pSettings, QWidget *parent) :
30 QDialog(parent)
31 , ui(new Ui::CDlgSetFreeRDP)
32 , m_pSettings(pSettings)
33 , m_pFileModel(nullptr)
34 , m_pProxyUI(nullptr)
35 , m_pRecordUI(nullptr)
36 , m_pButtonGroup(nullptr)
37{
38 setAttribute(Qt::WA_DeleteOnClose);
39 ui->setupUi(this);
40
41 ui->leName->setText(m_pSettings->GetName());
42
43 // Server
44 ui->leDomain->setText(m_pSettings->GetDomain());
45 ui->wNet->SetParameter(&m_pSettings->m_Net);
46
47 ui->cbOnlyView->setChecked(m_pSettings->GetOnlyView());
48 ui->cbClipboard->setChecked(m_pSettings->GetClipboard());
49 ui->cbShowServerName->setChecked(m_pSettings->GetShowServerName());
50
51 m_pProxyUI = new CParameterProxyUI(ui->tabWidget);
52 m_pProxyUI->SetParameter(&m_pSettings->m_Proxy);
53 ui->tabWidget->insertTab(1, m_pProxyUI, m_pProxyUI->windowIcon(), tr("Proxy"));
54
55 m_pRecordUI = new CParameterRecordUI(ui->tabWidget);
56 m_pRecordUI->SetParameter(&m_pSettings->m_Record);
57 ui->tabWidget->addTab(m_pRecordUI, m_pRecordUI->windowIcon(), tr("Record"));
58
59 // Display
60 // It has to be the first. GetScreenGeometry depends on it
61 ui->cbAllMonitor->setChecked(m_pSettings->GetUseMultimon());
62 UpdateDesktopSize();
63 int width = GetScreenGeometry().width();
64 int height = GetScreenGeometry().height();
65 QString curSize = QString::number(width) + "×" + QString::number(height);
66 UINT32 desktopWidth = 0, desktopHeight = 0;
67 desktopWidth = m_pSettings->GetDesktopWidth();
68 desktopHeight = m_pSettings->GetDesktopHeight();
69 if(width == desktopWidth && height == desktopHeight)
70 {
71 ui->rbLocalScreen->setChecked(true);
72 ui->cbDesktopSize->setCurrentText(curSize);
73 } else {
74 ui->rbSelect->setChecked(true);
75 curSize = QString::number(desktopWidth)
76 + "×" + QString::number(desktopHeight);
77 ui->cbDesktopSize->setCurrentText(curSize);
78 }
79
80 ui->cbColorDepth->addItem(tr("8 bits"), 8);
81 ui->cbColorDepth->addItem(tr("16 bits"), 16);
82 ui->cbColorDepth->addItem(tr("24 bits"), 24);
83 ui->cbColorDepth->addItem(tr("32 bits"), 32);
84 int nIndex = ui->cbColorDepth->findData(
85 m_pSettings->GetColorDepth());
86 if(-1 != nIndex)
87 ui->cbColorDepth->setCurrentIndex(nIndex);
88
89 ui->sbReconnect->setValue(m_pSettings->GetReconnectInterval());
90
91 // Redirection printer
92 ui->cbPrinter->setChecked(m_pSettings->GetRedirectionPrinter());
93
94 // Redirection audio output
95 ui->gbAudio->setEnabled(HasAudioOutput() || HasAudioInput());
96 if(m_pSettings->GetRedirectionSound() == CParameterFreeRDP::RedirecionSoundType::Disable)
97 ui->rbAudioDisable->setChecked(true);
98 if(m_pSettings->GetRedirectionSound() == CParameterFreeRDP::RedirecionSoundType::Local)
99 ui->rbAudioLocal->setChecked(true);
100 if(m_pSettings->GetRedirectionSound() == CParameterFreeRDP::RedirecionSoundType::Remote)
101 ui->rbAudioRemote->setChecked(true);
102 QString szRdpSndParameters
103 = tr("- [sys:<sys>,][dev:<dev>,][format:<format>,][rate:<rate>,][channel:<channel>]\n"
104 #if defined (Q_OS_WINDOWS) || defined(Q_OS_WIN) || defined(Q_OS_WIN32) || defined(Q_OS_WINRT)
105 "- sys:winmm"
106 #elif defined(Q_OS_IOS)
107 "- sys:ios\n"
108 "- sys:mac"
109 #elif defined (Q_OS_ANDROID)
110 "- sys:opensles"
111 #elif defined (Q_OS_LINUX) || defined (Q_OS_UNIX)
112 "- sys:alsa\n"
113 "- sys:oss\n"
114 "- sys:oss,dev:1,format:1\n"
115 "- sys:sndio"
116 #endif
117 );
118 QString szRdpSnd = tr("Options for redirection of audio output:\n") + szRdpSndParameters;
119 ui->leRdpSnd->setToolTip(szRdpSnd);
120 ui->leRdpSnd->setStatusTip(szRdpSnd);
121 ui->leRdpSnd->setWhatsThis(szRdpSnd);
122 ui->leRdpSnd->setEnabled(HasAudioOutput());
123 ui->leRdpSnd->setText(m_pSettings->GetRedirectionSoundParameters());
124 // Redirection audio input
125 QString szAudin = tr("Options for redirection of audio input:\n") + szRdpSndParameters;
126 ui->leAudin->setToolTip(szAudin);
127 ui->leAudin->setStatusTip(szAudin);
128 ui->leAudin->setWhatsThis(szAudin);
129 ui->leAudin->setText(m_pSettings->GetRedirectionMicrophoneParameters());
130 if(HasAudioInput()) {
131 ui->cbAudin->setChecked(m_pSettings->GetRedirectionMicrophone());
132 } else {
133 ui->cbAudin->setChecked(false);
134 ui->cbAudin->setEnabled(false);
135 ui->leAudin->setEnabled(false);
136 }
137
138 // Drive
139 m_pFileModel= new QFileSystemModel();
140 m_pFileModel->setNameFilterDisables(false);
141 m_pFileModel->setFilter(QDir::Drives | QDir::Dirs | QDir::NoDotAndDotDot);
142 m_pFileModel->setRootPath("");
143 ui->tvDrive->setModel(m_pFileModel);
144 ui->tvDrive->setEditTriggers(QAbstractItemView::NoEditTriggers);
145 int count = m_pFileModel->columnCount();
146 for(int i = 1; i < count; i++)
147 ui->tvDrive->hideColumn(i);
148 bool check = connect(ui->tvDrive->selectionModel(),
149 SIGNAL(selectionChanged(const QItemSelection &,
150 const QItemSelection &)),
151 this,
152 SLOT(slotSelectionChanged(QItemSelection,QItemSelection)));
153 Q_ASSERT(check);
154 QStringList lstDrives = m_pSettings->GetRedirectionDrives();
155 foreach(auto path, lstDrives)
156 {
157 QModelIndex index;
158 if(!path.isEmpty()) {
159 index = m_pFileModel->index(path);
160 ui->tvDrive->setCurrentIndex(index);
161 }
162 }
163 ShowDriveSelected(lstDrives.size());
164
165 // Security
166 ui->cbSecurityEnable->setChecked(m_pSettings->GetNegotiateSecurityLayer());
167 on_cbSecurityEnable_stateChanged(ui->cbSecurityEnable->checkState());
168 CParameterFreeRDP::Security security = m_pSettings->GetSecurity();
169 if(CParameterFreeRDP::Security::RDP & (uint)security)
170 ui->cbSecurityRDP->setChecked(true);
171 if(CParameterFreeRDP::Security::TLS & (uint)security)
172 ui->cbSecurityTls->setChecked(true);
173 if(CParameterFreeRDP::Security::NLA & (uint)security)
174 ui->cbSecurityNLA->setChecked(true);
175 if(CParameterFreeRDP::Security::NLA_Ext & (uint)security)
176 ui->cbSecurityNlaExt->setChecked(true);
177 if(CParameterFreeRDP::Security::RDSAAD & (uint)security)
178 ui->cbSecurityRDSAAD->setChecked(true);
179 if(CParameterFreeRDP::Security::RDSTLS & (uint)security)
180 ui->cbSecurityRDSTLS->setChecked(true);
181#if FREERDP_VERSION_MAJOR >= 3
182 ui->cbSecurityRDSAAD->setVisible(true);
183 ui->cbSecurityRDSTLS->setVisible(true);
184#else
185 ui->cbSecurityRDSAAD->setVisible(false);
186 ui->cbSecurityRDSTLS->setVisible(false);
187#endif
188 // Tls version
189 switch(m_pSettings->GetTlsVersion())
190 {
191 case TLS1_VERSION:
192 ui->rbTls1_0->setChecked(true);
193 break;
194 case TLS1_1_VERSION:
195 ui->rbTls1_1->setChecked(true);
196 break;
197 case TLS1_2_VERSION:
198 ui->rbTls1_2->setChecked(true);
199 break;
200 case TLS1_3_VERSION:
201 ui->rbTls1_3->setChecked(true);
202 break;
203 }
204
205 // Initial default performance flags
206 m_vPerformanceFlags[CONNECTION_TYPE_MODEM - 1] = PERF_DISABLE_WALLPAPER | PERF_DISABLE_FULLWINDOWDRAG | PERF_DISABLE_MENUANIMATIONS | PERF_DISABLE_THEMING;
207 m_vPerformanceFlags[CONNECTION_TYPE_BROADBAND_LOW - 1] = PERF_DISABLE_WALLPAPER | PERF_DISABLE_FULLWINDOWDRAG | PERF_DISABLE_MENUANIMATIONS;
208 m_vPerformanceFlags[CONNECTION_TYPE_SATELLITE - 1] = PERF_DISABLE_WALLPAPER | PERF_ENABLE_DESKTOP_COMPOSITION | PERF_DISABLE_FULLWINDOWDRAG | PERF_DISABLE_MENUANIMATIONS;
209 m_vPerformanceFlags[CONNECTION_TYPE_BROADBAND_HIGH - 1] = PERF_DISABLE_WALLPAPER | PERF_ENABLE_DESKTOP_COMPOSITION | PERF_DISABLE_FULLWINDOWDRAG | PERF_DISABLE_MENUANIMATIONS;
210 m_vPerformanceFlags[CONNECTION_TYPE_WAN - 1] = PERF_ENABLE_FONT_SMOOTHING | PERF_ENABLE_DESKTOP_COMPOSITION;
211 m_vPerformanceFlags[CONNECTION_TYPE_LAN - 1] = PERF_ENABLE_FONT_SMOOTHING | PERF_ENABLE_DESKTOP_COMPOSITION;
212 m_vPerformanceFlags[CONNECTION_TYPE_AUTODETECT - 1] = PERF_ENABLE_FONT_SMOOTHING | PERF_ENABLE_DESKTOP_COMPOSITION;
213 // Load performance flags
214 if(m_pSettings->GetConnectType() > 0 && m_pSettings->GetPerformanceFlags() > 0)
215 m_vPerformanceFlags[m_pSettings->GetConnectType() - 1] = m_pSettings->GetPerformanceFlags();
216 // Connect type
217 ui->cbConnectType->addItem(tr("Modem(56 kpbs)"), CONNECTION_TYPE_MODEM);
218 ui->cbConnectType->addItem(tr("Broadband low(256 kbps - 2 Mbps)"), CONNECTION_TYPE_BROADBAND_LOW);
219 ui->cbConnectType->addItem(tr("Satellite(2 Mbps - 16 Mbps, High latency)"), CONNECTION_TYPE_SATELLITE);
220 ui->cbConnectType->addItem(tr("Broadband high(2 Mbps - 10 Mbps)"), CONNECTION_TYPE_BROADBAND_HIGH);
221 ui->cbConnectType->addItem(tr("Wan(10 Mbps or higher speed, High latency)"), CONNECTION_TYPE_WAN);
222 ui->cbConnectType->addItem(tr("Lan(10 Mbps or higher speed)"), CONNECTION_TYPE_LAN);
223 ui->cbConnectType->addItem(tr("Automatically detect"), CONNECTION_TYPE_AUTODETECT);
224 ui->cbConnectType->setCurrentIndex(ui->cbConnectType->findData(m_pSettings->GetConnectType()));
225
226}
227
228CDlgSetFreeRDP::~CDlgSetFreeRDP()
229{
230 delete ui;
231}
232
233void CDlgSetFreeRDP::on_pbOk_clicked()
234{
235 int nRet = 0;
236
237 if(!ui->wNet->CheckValidity(true)) {
238 ui->tabWidget->setCurrentIndex(0);
239 return;
240 }
241 if(!m_pProxyUI->CheckValidity(true)) {
242 ui->tabWidget->setCurrentWidget(m_pProxyUI);
243 return;
244 }
245 if(!m_pRecordUI->CheckValidity(true)) {
246 ui->tabWidget->setCurrentWidget(m_pRecordUI);
247 return;
248 }
249
250 m_pSettings->SetName(ui->leName->text());
251
252 // Server
253 m_pSettings->SetDomain(ui->leDomain->text());
254 nRet = ui->wNet->Accept();
255 if(nRet) return;
256
257 nRet = m_pProxyUI->Accept();
258 if(nRet) return;
259
260 nRet = m_pRecordUI->Accept();
261 if(nRet) return;
262
263 m_pSettings->SetOnlyView(ui->cbOnlyView->isChecked());
264 m_pSettings->SetClipboard(ui->cbClipboard->isChecked());
265 m_pSettings->SetShowServerName(ui->cbShowServerName->isChecked());
266
267 // Display
268 m_pSettings->SetUseMultimon(ui->cbAllMonitor->isChecked());
269 QString szSize = ui->cbDesktopSize->currentText();
270 int index = szSize.indexOf("×");
271 if(-1 < index)
272 {
273 UINT32 width = szSize.left(index).toInt();
274 UINT32 height = szSize.right(szSize.length() - index - 1).toInt();
275 m_pSettings->SetDesktopWidth(width);
276 m_pSettings->SetDesktopHeight(height);
277 }
278 m_pSettings->SetColorDepth(ui->cbColorDepth->currentData().toInt());
279 m_pSettings->SetReconnectInterval(ui->sbReconnect->value());
280
281 // Redirection
282 m_pSettings->SetRedirectionPrinter(ui->cbPrinter->isChecked());
283 if(HasAudioOutput()) {
284 CParameterFreeRDP::RedirecionSoundType tRdirectionSound
285 = CParameterFreeRDP::RedirecionSoundType::Disable;
286 if(ui->rbAudioDisable->isChecked())
287 tRdirectionSound = CParameterFreeRDP::RedirecionSoundType::Disable;
288 else if(ui->rbAudioLocal->isChecked())
289 tRdirectionSound = CParameterFreeRDP::RedirecionSoundType::Local;
290 else if(ui->rbAudioRemote->isChecked())
291 tRdirectionSound = CParameterFreeRDP::RedirecionSoundType::Remote;
292 m_pSettings->SetRedirectionSound(tRdirectionSound);
293 } else {
294 m_pSettings->SetRedirectionSound(
295 CParameterFreeRDP::RedirecionSoundType::Disable);
296 }
297 m_pSettings->SetRedirectionSoundParameters(ui->leRdpSnd->text());
298 if(HasAudioInput())
299 m_pSettings->SetRedirectionMicrophone(ui->cbAudin->isChecked());
300 else
301 m_pSettings->SetRedirectionMicrophone(false);
302 m_pSettings->SetRedirectionMicrophoneParameters(ui->leAudin->text());
303
304 QStringList lstDrives;
305 //获取选中的行,默认获取选中行的第一列数据(0),列的索引值和上面一样0、1、2、3......
306 QModelIndexList selected = ui->tvDrive->selectionModel()->selectedRows(0);
307 QList<QModelIndex>::iterator it;
308 QModelIndex modelIndex;
309 QString szPath;
310 for (it = selected.begin(); it != selected.end(); ++it)
311 {
312 modelIndex = *it;
313 szPath = m_pFileModel->filePath(modelIndex);
314 if(!szPath.isEmpty())
315 lstDrives.append(szPath);
316 }
317 m_pSettings->SetRedirectionDrives(lstDrives);
318
319 // Security
320 m_pSettings->SetNegotiateSecurityLayer(ui->cbSecurityEnable->isChecked());
321 uint security = 0;
322 if(ui->cbSecurityRDP->isChecked())
323 security |= CParameterFreeRDP::Security::RDP;
324 if(ui->cbSecurityTls->isChecked())
325 security |= CParameterFreeRDP::Security::TLS;
326 if(ui->cbSecurityNLA->isChecked())
327 security |= CParameterFreeRDP::Security::NLA;
328 if(ui->cbSecurityNlaExt->isChecked())
329 security |= CParameterFreeRDP::Security::NLA_Ext;
330 if(ui->cbSecurityRDSTLS->isChecked())
331 security |= CParameterFreeRDP::Security::RDSTLS;
332 if(ui->cbSecurityRDSAAD->isChecked())
333 security |= CParameterFreeRDP::Security::RDSAAD;
334 m_pSettings->SetSecurity((CParameterFreeRDP::Security)security);
335
336 // Tls version
337 if(ui->rbTls1_0->isChecked())
338 m_pSettings->SetTlsVersion(TLS1_VERSION);
339 else if(ui->rbTls1_1->isChecked())
340 m_pSettings->SetTlsVersion(TLS1_1_VERSION);
341 else if(ui->rbTls1_2->isChecked())
342 m_pSettings->SetTlsVersion(TLS1_2_VERSION);
343 else if(ui->rbTls1_3->isChecked())
344 m_pSettings->SetTlsVersion(TLS1_3_VERSION);
345
346 // Connect type
347 m_pSettings->SetConnectType(ui->cbConnectType->currentData().toUInt());
348 // Performance flags
349 UINT32 performanceFlags = 0;
350 if(!ui->cbDesktopBackground->isChecked())
351 performanceFlags |= PERF_DISABLE_WALLPAPER;
352 if(!ui->cbWindowDrag->isChecked())
353 performanceFlags |= PERF_DISABLE_FULLWINDOWDRAG;
354 if(!ui->cbMenuAnims->isChecked())
355 performanceFlags |= PERF_DISABLE_MENUANIMATIONS;
356 if(!ui->cbThemes->isChecked())
357 performanceFlags |= PERF_DISABLE_THEMING;
358 if(ui->cbFontSmoothing->isChecked())
359 performanceFlags |= PERF_ENABLE_FONT_SMOOTHING;
360 if(ui->cbDesktopCompositing->isChecked())
361 performanceFlags |= PERF_ENABLE_DESKTOP_COMPOSITION;
362 m_pSettings->SetPerformanceFlags(performanceFlags);
363
364 accept();
365}
366
367void CDlgSetFreeRDP::on_pbCancel_clicked()
368{
369 reject();
370}
371
372void CDlgSetFreeRDP::on_rbLocalScreen_clicked(bool checked)
373{
374 if(!checked) return;
375 int width = GetScreenGeometry().width();
376 int height = GetScreenGeometry().height();
377 QString curSize = QString::number(width) + "×" + QString::number(height);
378 ui->rbLocalScreen->setText(tr("Local screen") + ": " + curSize);
379 if(ui->cbDesktopSize->findText(curSize) == -1)
380 InsertDesktopSize(width, height);
381 ui->cbDesktopSize->setCurrentText(curSize);
382}
383
384QRect CDlgSetFreeRDP::GetScreenGeometry()
385{
386 QRect r;
387 QScreen* pScreen = QApplication::primaryScreen();
388 if(ui->cbAllMonitor->isChecked())
389 {
390 //TODO: check this is a virtual geometry
391 r = pScreen->virtualGeometry();
392 /*
393 auto lstScreen = QApplication::screens();
394 qDebug(log) << "Screen counts:" << lstScreen.count();
395 int i = 0;
396 foreach(auto pScreen, lstScreen)
397 {
398 //r = r.united(pScreen->geometry());
399 qDebug(log)
400 << "ID:" << i++
401 << "geometry:" << pScreen->geometry()
402 << "availableGeometry:" << pScreen->availableGeometry()
403 << "virtualGeometry" << pScreen->virtualGeometry()
404 << "availableVirtualGeometry" << pScreen->availableVirtualGeometry();
405 }//*/
406 } else {
407 r = pScreen->geometry();
408 }
409 return r;
410}
411
412int CDlgSetFreeRDP::UpdateDesktopSize()
413{
414 ui->cbDesktopSize->clear();
415 QStringList lstDesktopSizes;
416 lstDesktopSizes <<"640×480"
417 <<"800×600"
418 <<"1024×600"
419 <<"1024×768"
420 <<"1280×720"
421 <<"1280×854"
422 <<"1280×960"
423 <<"1280×1024"
424 <<"1366×768"
425 <<"1400×1050"
426 <<"1440×900"
427 <<"1600×900"
428 <<"1600×1024"
429 <<"1600×1200"
430 <<"1680×1050"
431 <<"1920×1080"
432 <<"1920×1200";
433 ui->cbDesktopSize->addItems(lstDesktopSizes);
434
435 int width = GetScreenGeometry().width();
436 int height = GetScreenGeometry().height();
437 QString curSize = QString::number(width) + "×" + QString::number(height);
438 ui->rbLocalScreen->setText(tr("Local screen") + ": " + curSize);
439 if(ui->cbDesktopSize->findText(curSize) == -1)
440 InsertDesktopSize(width, height);
441 return 0;
442}
443
444int CDlgSetFreeRDP::InsertDesktopSize(QString szSize)
445{
446 int w, h;
447 int nIndex = szSize.indexOf("×");
448 if(nIndex > -1)
449 {
450 bool ok = false;
451 w = szSize.left(nIndex).toInt(&ok);
452 if(ok)
453 h = szSize.right(szSize.length() - nIndex - 1).toInt(&ok);
454 if(!ok)
455 return -1;
456 }
457 return InsertDesktopSize(w, h);
458}
459
460int CDlgSetFreeRDP::InsertDesktopSize(int width, int height)
461{
462 QString curSize = QString::number(width) + "×" + QString::number(height);
463 if(ui->cbDesktopSize->findText(curSize) > -1)
464 return 0;
465
466 int nCount = ui->cbDesktopSize->count();
467 for(int i = 0; i < nCount; i++)
468 {
469 QString curText = ui->cbDesktopSize->itemText(i);
470 int nIndex = curText.indexOf("×");
471 if(nIndex > -1)
472 {
473 int w = curText.left(nIndex).toInt();
474 int h = curText.right(curText.length() - nIndex - 1).toInt();
475 if(w > width)
476 {
477 ui->cbDesktopSize->insertItem(i, curSize);
478 return 0;
479 } else if(w == width) {
480 if(h > height)
481 {
482 ui->cbDesktopSize->insertItem(i, curSize);
483 return 0;
484 } if(h == height) {
485 return 0;
486 } else {
487 int j = i + 1;
488 while(j < nCount) {
489 QString curText = ui->cbDesktopSize->itemText(j);
490 int nIndex = curText.indexOf("×");
491 if(-1 >= nIndex) {
492 j++;
493 } else {
494 int w = curText.left(nIndex).toInt();
495 int h = curText.right(curText.length() - nIndex - 1).toInt();
496 if(w != width) {
497 ui->cbDesktopSize->insertItem(j, curSize);
498 return 0;
499 } else {
500 if(h > height)
501 {
502 ui->cbDesktopSize->insertItem(j, curSize);
503 return 0;
504 } else if(h == height)
505 return 0;
506 else
507 j++;
508 }
509 }
510 }
511 }
512 }
513 }
514 }
515
516 if(ui->cbDesktopSize->findText(curSize) == -1)
517 ui->cbDesktopSize->addItem(curSize);
518
519 return 0;
520}
521
522
523void CDlgSetFreeRDP::on_rbAudioDisable_toggled(bool checked)
524{
525 ui->leRdpSnd->setEnabled(!checked);
526}
527
528void CDlgSetFreeRDP::on_rbAudioLocal_toggled(bool checked)
529{
530 ui->leRdpSnd->setEnabled(checked);
531}
532
533void CDlgSetFreeRDP::on_rbAudioRemote_toggled(bool checked)
534{
535 ui->leRdpSnd->setEnabled(!checked);
536 ui->leAudin->setEnabled(!checked);
537 ui->cbAudin->setEnabled(!checked);
538}
539
540bool CDlgSetFreeRDP::HasAudioOutput()
541{
542#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
543 auto d = QMediaDevices::defaultAudioOutput();
544 return !d.isNull();
545#else
546 return !QAudioDeviceInfo::defaultOutputDevice().isNull();
547#endif
548}
549
550bool CDlgSetFreeRDP::HasAudioInput()
551{
552#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
553 auto d = QMediaDevices::defaultAudioInput();
554 return !d.isNull();
555#else
556 return !QAudioDeviceInfo::defaultInputDevice().isNull();
557#endif
558}
559
560void CDlgSetFreeRDP::on_pbSizeEdit_clicked()
561{
562 CDlgDesktopSize dlg;
563 QStringList lstSize;
564 for(int i = 0; i < ui->cbDesktopSize->count(); i++)
565 lstSize << ui->cbDesktopSize->itemText(i);
566 dlg.SetDesktopSizes(lstSize);
567 if(QDialog::Accepted == dlg.exec())
568 {
569 ui->cbDesktopSize->clear();
570 foreach(auto s, dlg.GetDesktopSize())
571 {
572 InsertDesktopSize(s);
573 }
574 }
575}
576
577void CDlgSetFreeRDP::on_pbDriveClearAll_clicked()
578{
579 ui->tvDrive->clearSelection();
580 ShowDriveSelected(0);
581}
582
583void CDlgSetFreeRDP::slotSelectionChanged(const QItemSelection &selected,
584 const QItemSelection &deselected)
585{
586 QModelIndexList s = ui->tvDrive->selectionModel()->selectedRows(0);
587 ShowDriveSelected(s.size());
588}
589
590int CDlgSetFreeRDP::ShowDriveSelected(int counts)
591{
592 ui->lbDriveSelected->setText(tr("Selected counts: ") + QString::number(counts));
593 return 0;
594}
595
596void CDlgSetFreeRDP::on_cbAllMonitor_stateChanged(int arg1)
597{
598 on_rbLocalScreen_clicked(true);
599}
600
601void CDlgSetFreeRDP::on_cbSecurityEnable_stateChanged(int arg1)
602{
603 if(m_pButtonGroup) {
604 m_pButtonGroup->deleteLater();
605 m_pButtonGroup = nullptr;
606 }
607 if(!ui->cbSecurityEnable->isChecked()) {
608 m_pButtonGroup = new QButtonGroup(this);
609 m_pButtonGroup->addButton(ui->cbSecurityRDP);
610 m_pButtonGroup->addButton(ui->cbSecurityTls);
611 m_pButtonGroup->addButton(ui->cbSecurityNLA);
612 m_pButtonGroup->addButton(ui->cbSecurityNlaExt);
613 m_pButtonGroup->addButton(ui->cbSecurityRDSAAD);
614 m_pButtonGroup->addButton(ui->cbSecurityRDSTLS);
615 }
616}
617
618void CDlgSetFreeRDP::on_cbConnectType_currentIndexChanged(int index)
619{
620 UINT32 type = ui->cbConnectType->itemData(index).toUInt();
621 if(0 >= type || CONNECTION_TYPE_AUTODETECT < type)
622 return;
623
624 UINT32 performanceFlags = m_vPerformanceFlags[type - 1];
625 if(CONNECTION_TYPE_AUTODETECT == type)
626 {
627 performanceFlags = PERF_ENABLE_FONT_SMOOTHING | PERF_ENABLE_DESKTOP_COMPOSITION;
628 }
629
630 ui->cbDesktopBackground->setChecked(!(PERF_DISABLE_WALLPAPER & performanceFlags));
631 ui->cbWindowDrag->setChecked(!(PERF_DISABLE_FULLWINDOWDRAG & performanceFlags));
632 ui->cbMenuAnims->setChecked(!(PERF_DISABLE_MENUANIMATIONS & performanceFlags));
633 ui->cbThemes->setChecked(!(PERF_DISABLE_THEMING & performanceFlags));
634 ui->cbFontSmoothing->setChecked(PERF_ENABLE_FONT_SMOOTHING & performanceFlags);
635 ui->cbDesktopCompositing->setChecked(PERF_ENABLE_DESKTOP_COMPOSITION & performanceFlags);
636
637 ui->cbDesktopBackground->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
638 ui->cbWindowDrag->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
639 ui->cbMenuAnims->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
640 ui->cbThemes->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
641 ui->cbFontSmoothing->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
642 ui->cbDesktopCompositing->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
643}
644
[Declare CParameterFreeRDP]
The proxy parameter UI.
bool CheckValidity(bool validity=false)
Check parameters validity.
int Accept()
Accept parameters.
virtual bool CheckValidity(bool validity=false)
Check parameters validity.