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