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