4#include <openssl/tls1.h>
7#include "DlgSetFreeRDP.h"
8#include "ui_DlgSetFreeRDP.h"
9#include "ParameterNetUI.h"
11#include <QApplication>
13#include <QFileSystemModel>
14#include <QButtonGroup>
15#include <QLoggingCategory>
17#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
18 #include <QMediaDevices>
19 #include <QAudioDevice>
21 #include <QAudioDeviceInfo>
24#include "DlgDesktopSize.h"
25#include "freerdp/version.h"
27static Q_LOGGING_CATEGORY(log,
"FreeRDP.Parameter.Dlg")
32 , m_pSettings(pSettings)
33 , m_pFileModel(
nullptr)
35 , m_pRecordUI(
nullptr)
36 , m_pButtonGroup(
nullptr)
38 setAttribute(Qt::WA_DeleteOnClose);
41 ui->leName->setText(m_pSettings->GetName());
44 ui->leDomain->setText(m_pSettings->GetDomain());
45 ui->wNet->SetParameter(&m_pSettings->m_Net);
47 ui->cbOnlyView->setChecked(m_pSettings->GetOnlyView());
48 ui->cbClipboard->setChecked(m_pSettings->GetClipboard());
49 ui->cbShowServerName->setChecked(m_pSettings->GetShowServerName());
52 m_pProxyUI->SetParameter(&m_pSettings->m_Proxy);
53 InsertView(m_pProxyUI, 1);
56 m_pRecordUI->SetParameter(&m_pSettings->m_Record);
63 ui->cbAllMonitor->setChecked(m_pSettings->GetUseMultimon());
65 int width = GetScreenGeometry().width();
66 int height = GetScreenGeometry().height();
67 QString curSize = QString::number(width) +
"×" + QString::number(height);
68 UINT32 desktopWidth = 0, desktopHeight = 0;
69 desktopWidth = m_pSettings->GetDesktopWidth();
70 desktopHeight = m_pSettings->GetDesktopHeight();
71 if(width == desktopWidth && height == desktopHeight)
73 ui->rbLocalScreen->setChecked(
true);
74 ui->cbDesktopSize->setCurrentText(curSize);
76 ui->rbSelect->setChecked(
true);
77 curSize = QString::number(desktopWidth)
78 +
"×" + QString::number(desktopHeight);
79 ui->cbDesktopSize->setCurrentText(curSize);
82 ui->cbColorDepth->addItem(tr(
"8 bits"), 8);
83 ui->cbColorDepth->addItem(tr(
"16 bits"), 16);
84 ui->cbColorDepth->addItem(tr(
"24 bits"), 24);
85 ui->cbColorDepth->addItem(tr(
"32 bits"), 32);
86 int nIndex = ui->cbColorDepth->findData(
87 m_pSettings->GetColorDepth());
89 ui->cbColorDepth->setCurrentIndex(nIndex);
91 ui->sbReconnect->setValue(m_pSettings->GetReconnectInterval());
94 ui->cbPrinter->setChecked(m_pSettings->GetRedirectionPrinter());
96 ui->cbEnableLocalInputMethod->setChecked(m_pSettings->GetEnableLocalInputMethod());
99 ui->gbAudio->setEnabled(HasAudioOutput() || HasAudioInput());
100 if(m_pSettings->GetRedirectionSound() == CParameterFreeRDP::RedirecionSoundType::Disable)
101 ui->rbAudioDisable->setChecked(
true);
102 if(m_pSettings->GetRedirectionSound() == CParameterFreeRDP::RedirecionSoundType::Local)
103 ui->rbAudioLocal->setChecked(
true);
104 if(m_pSettings->GetRedirectionSound() == CParameterFreeRDP::RedirecionSoundType::Remote)
105 ui->rbAudioRemote->setChecked(
true);
106 QString szRdpSndParameters
107 = tr(
"- [sys:<sys>,][dev:<dev>,][format:<format>,][rate:<rate>,][channel:<channel>]\n"
108 #
if defined (Q_OS_WINDOWS) || defined(Q_OS_WIN) || defined(Q_OS_WIN32) || defined(Q_OS_WINRT)
110 #elif defined(Q_OS_IOS)
113 #elif defined (Q_OS_ANDROID)
115 #elif defined (Q_OS_LINUX) || defined (Q_OS_UNIX)
118 "- sys:oss,dev:1,format:1\n"
122 QString szRdpSnd = tr(
"Options for redirection of audio output:\n") + szRdpSndParameters;
123 ui->leRdpSnd->setToolTip(szRdpSnd);
124 ui->leRdpSnd->setStatusTip(szRdpSnd);
125 ui->leRdpSnd->setWhatsThis(szRdpSnd);
126 ui->leRdpSnd->setEnabled(HasAudioOutput());
127 ui->leRdpSnd->setText(m_pSettings->GetRedirectionSoundParameters());
129 QString szAudin = tr(
"Options for redirection of audio input:\n") + szRdpSndParameters;
130 ui->leAudin->setToolTip(szAudin);
131 ui->leAudin->setStatusTip(szAudin);
132 ui->leAudin->setWhatsThis(szAudin);
133 ui->leAudin->setText(m_pSettings->GetRedirectionMicrophoneParameters());
134 if(HasAudioInput()) {
135 ui->cbAudin->setChecked(m_pSettings->GetRedirectionMicrophone());
137 ui->cbAudin->setChecked(
false);
138 ui->cbAudin->setEnabled(
false);
139 ui->leAudin->setEnabled(
false);
143 m_pFileModel=
new QFileSystemModel();
144 m_pFileModel->setNameFilterDisables(
false);
145 m_pFileModel->setFilter(QDir::Drives | QDir::Dirs | QDir::NoDotAndDotDot);
146 m_pFileModel->setRootPath(
"");
147 ui->tvDrive->setModel(m_pFileModel);
148 ui->tvDrive->setEditTriggers(QAbstractItemView::NoEditTriggers);
149 int count = m_pFileModel->columnCount();
150 for(
int i = 1; i < count; i++)
151 ui->tvDrive->hideColumn(i);
152 bool check = connect(ui->tvDrive->selectionModel(),
153 SIGNAL(selectionChanged(
const QItemSelection &,
154 const QItemSelection &)),
156 SLOT(slotSelectionChanged(QItemSelection,QItemSelection)));
158 QStringList lstDrives = m_pSettings->GetRedirectionDrives();
159 foreach(
auto path, lstDrives)
162 if(!path.isEmpty()) {
163 index = m_pFileModel->index(path);
164 ui->tvDrive->setCurrentIndex(index);
167 ShowDriveSelected(lstDrives.size());
170 ui->cbSecurityEnable->setChecked(m_pSettings->GetNegotiateSecurityLayer());
171 on_cbSecurityEnable_stateChanged(ui->cbSecurityEnable->checkState());
172 CParameterFreeRDP::Security security = m_pSettings->GetSecurity();
173 if(CParameterFreeRDP::Security::RDP & (uint)security)
174 ui->cbSecurityRDP->setChecked(
true);
175 if(CParameterFreeRDP::Security::TLS & (uint)security)
176 ui->cbSecurityTls->setChecked(
true);
177 if(CParameterFreeRDP::Security::NLA & (uint)security)
178 ui->cbSecurityNLA->setChecked(
true);
179 if(CParameterFreeRDP::Security::NLA_Ext & (uint)security)
180 ui->cbSecurityNlaExt->setChecked(
true);
181 if(CParameterFreeRDP::Security::RDSAAD & (uint)security)
182 ui->cbSecurityRDSAAD->setChecked(
true);
183 if(CParameterFreeRDP::Security::RDSTLS & (uint)security)
184 ui->cbSecurityRDSTLS->setChecked(
true);
185#if FREERDP_VERSION_MAJOR >= 3
186 ui->cbSecurityRDSAAD->setVisible(
true);
187 ui->cbSecurityRDSTLS->setVisible(
true);
189 ui->cbSecurityRDSAAD->setVisible(
false);
190 ui->cbSecurityRDSTLS->setVisible(
false);
193 switch(m_pSettings->GetTlsVersion())
196 ui->rbTls1_0->setChecked(
true);
199 ui->rbTls1_1->setChecked(
true);
202 ui->rbTls1_2->setChecked(
true);
205 ui->rbTls1_3->setChecked(
true);
210 m_vPerformanceFlags[CONNECTION_TYPE_MODEM - 1] = PERF_DISABLE_WALLPAPER | PERF_DISABLE_FULLWINDOWDRAG | PERF_DISABLE_MENUANIMATIONS | PERF_DISABLE_THEMING;
211 m_vPerformanceFlags[CONNECTION_TYPE_BROADBAND_LOW - 1] = PERF_DISABLE_WALLPAPER | PERF_DISABLE_FULLWINDOWDRAG | PERF_DISABLE_MENUANIMATIONS;
212 m_vPerformanceFlags[CONNECTION_TYPE_SATELLITE - 1] = PERF_DISABLE_WALLPAPER | PERF_ENABLE_DESKTOP_COMPOSITION | PERF_DISABLE_FULLWINDOWDRAG | PERF_DISABLE_MENUANIMATIONS;
213 m_vPerformanceFlags[CONNECTION_TYPE_BROADBAND_HIGH - 1] = PERF_DISABLE_WALLPAPER | PERF_ENABLE_DESKTOP_COMPOSITION | PERF_DISABLE_FULLWINDOWDRAG | PERF_DISABLE_MENUANIMATIONS;
214 m_vPerformanceFlags[CONNECTION_TYPE_WAN - 1] = PERF_ENABLE_FONT_SMOOTHING | PERF_ENABLE_DESKTOP_COMPOSITION;
215 m_vPerformanceFlags[CONNECTION_TYPE_LAN - 1] = PERF_ENABLE_FONT_SMOOTHING | PERF_ENABLE_DESKTOP_COMPOSITION;
216 m_vPerformanceFlags[CONNECTION_TYPE_AUTODETECT - 1] = PERF_ENABLE_FONT_SMOOTHING | PERF_ENABLE_DESKTOP_COMPOSITION;
218 if(m_pSettings->GetConnectType() > 0 && m_pSettings->GetPerformanceFlags() > 0)
219 m_vPerformanceFlags[m_pSettings->GetConnectType() - 1] = m_pSettings->GetPerformanceFlags();
221 ui->cbConnectType->addItem(tr(
"Modem(56 kbps)"), CONNECTION_TYPE_MODEM);
222 ui->cbConnectType->addItem(tr(
"Broadband low(256 kbps - 2 Mbps)"), CONNECTION_TYPE_BROADBAND_LOW);
223 ui->cbConnectType->addItem(tr(
"Satellite(2 Mbps - 16 Mbps, High latency)"), CONNECTION_TYPE_SATELLITE);
224 ui->cbConnectType->addItem(tr(
"Broadband high(2 Mbps - 10 Mbps)"), CONNECTION_TYPE_BROADBAND_HIGH);
225 ui->cbConnectType->addItem(tr(
"Wan(10 Mbps or higher speed, High latency)"), CONNECTION_TYPE_WAN);
226 ui->cbConnectType->addItem(tr(
"Lan(10 Mbps or higher speed)"), CONNECTION_TYPE_LAN);
227 ui->cbConnectType->addItem(tr(
"Automatically detect"), CONNECTION_TYPE_AUTODETECT);
228 ui->cbConnectType->setCurrentIndex(ui->cbConnectType->findData(m_pSettings->GetConnectType()));
232CDlgSetFreeRDP::~CDlgSetFreeRDP()
238void CDlgSetFreeRDP::on_pbOk_clicked()
242 if(!ui->wNet->CheckValidity(
true)) {
243 ui->tabWidget->setCurrentIndex(0);
247 ui->tabWidget->setCurrentWidget(m_pProxyUI);
250 if(!m_pRecordUI->CheckValidity(
true)) {
251 ui->tabWidget->setCurrentWidget(m_pRecordUI);
255 m_pSettings->SetName(ui->leName->text());
258 m_pSettings->SetDomain(ui->leDomain->text());
259 nRet = ui->wNet->Accept();
262 nRet = m_pProxyUI->
Accept();
265 nRet = m_pRecordUI->Accept();
268 m_pSettings->SetOnlyView(ui->cbOnlyView->isChecked());
269 m_pSettings->SetClipboard(ui->cbClipboard->isChecked());
270 m_pSettings->SetShowServerName(ui->cbShowServerName->isChecked());
273 m_pSettings->SetUseMultimon(ui->cbAllMonitor->isChecked());
274 QString szSize = ui->cbDesktopSize->currentText();
275 int index = szSize.indexOf(
"×");
278 UINT32 width = szSize.left(index).toInt();
279 UINT32 height = szSize.right(szSize.length() - index - 1).toInt();
280 m_pSettings->SetDesktopWidth(width);
281 m_pSettings->SetDesktopHeight(height);
283 m_pSettings->SetColorDepth(ui->cbColorDepth->currentData().toInt());
284 m_pSettings->SetReconnectInterval(ui->sbReconnect->value());
287 m_pSettings->SetRedirectionPrinter(ui->cbPrinter->isChecked());
288 m_pSettings->SetEnableLocalInputMethod(ui->cbEnableLocalInputMethod->isChecked());
289 if(HasAudioOutput()) {
290 CParameterFreeRDP::RedirecionSoundType tRdirectionSound
291 = CParameterFreeRDP::RedirecionSoundType::Disable;
292 if(ui->rbAudioDisable->isChecked())
293 tRdirectionSound = CParameterFreeRDP::RedirecionSoundType::Disable;
294 else if(ui->rbAudioLocal->isChecked())
295 tRdirectionSound = CParameterFreeRDP::RedirecionSoundType::Local;
296 else if(ui->rbAudioRemote->isChecked())
297 tRdirectionSound = CParameterFreeRDP::RedirecionSoundType::Remote;
298 m_pSettings->SetRedirectionSound(tRdirectionSound);
300 m_pSettings->SetRedirectionSound(
301 CParameterFreeRDP::RedirecionSoundType::Disable);
303 m_pSettings->SetRedirectionSoundParameters(ui->leRdpSnd->text());
305 m_pSettings->SetRedirectionMicrophone(ui->cbAudin->isChecked());
307 m_pSettings->SetRedirectionMicrophone(
false);
308 m_pSettings->SetRedirectionMicrophoneParameters(ui->leAudin->text());
310 QStringList lstDrives;
312 QModelIndexList selected = ui->tvDrive->selectionModel()->selectedRows(0);
313 QList<QModelIndex>::iterator it;
314 QModelIndex modelIndex;
316 for (it = selected.begin(); it != selected.end(); ++it)
319 szPath = m_pFileModel->filePath(modelIndex);
320 if(!szPath.isEmpty())
321 lstDrives.append(szPath);
323 m_pSettings->SetRedirectionDrives(lstDrives);
326 m_pSettings->SetNegotiateSecurityLayer(ui->cbSecurityEnable->isChecked());
328 if(ui->cbSecurityRDP->isChecked())
329 security |= CParameterFreeRDP::Security::RDP;
330 if(ui->cbSecurityTls->isChecked())
331 security |= CParameterFreeRDP::Security::TLS;
332 if(ui->cbSecurityNLA->isChecked())
333 security |= CParameterFreeRDP::Security::NLA;
334 if(ui->cbSecurityNlaExt->isChecked())
335 security |= CParameterFreeRDP::Security::NLA_Ext;
336 if(ui->cbSecurityRDSTLS->isChecked())
337 security |= CParameterFreeRDP::Security::RDSTLS;
338 if(ui->cbSecurityRDSAAD->isChecked())
339 security |= CParameterFreeRDP::Security::RDSAAD;
340 m_pSettings->SetSecurity((CParameterFreeRDP::Security)security);
343 if(ui->rbTls1_0->isChecked())
344 m_pSettings->SetTlsVersion(TLS1_VERSION);
345 else if(ui->rbTls1_1->isChecked())
346 m_pSettings->SetTlsVersion(TLS1_1_VERSION);
347 else if(ui->rbTls1_2->isChecked())
348 m_pSettings->SetTlsVersion(TLS1_2_VERSION);
349 else if(ui->rbTls1_3->isChecked())
350 m_pSettings->SetTlsVersion(TLS1_3_VERSION);
353 m_pSettings->SetConnectType(ui->cbConnectType->currentData().toUInt());
355 UINT32 performanceFlags = 0;
356 if(!ui->cbDesktopBackground->isChecked())
357 performanceFlags |= PERF_DISABLE_WALLPAPER;
358 if(!ui->cbWindowDrag->isChecked())
359 performanceFlags |= PERF_DISABLE_FULLWINDOWDRAG;
360 if(!ui->cbMenuAnims->isChecked())
361 performanceFlags |= PERF_DISABLE_MENUANIMATIONS;
362 if(!ui->cbThemes->isChecked())
363 performanceFlags |= PERF_DISABLE_THEMING;
364 if(ui->cbFontSmoothing->isChecked())
365 performanceFlags |= PERF_ENABLE_FONT_SMOOTHING;
366 if(ui->cbDesktopCompositing->isChecked())
367 performanceFlags |= PERF_ENABLE_DESKTOP_COMPOSITION;
368 m_pSettings->SetPerformanceFlags(performanceFlags);
374void CDlgSetFreeRDP::on_pbCancel_clicked()
379void CDlgSetFreeRDP::on_rbLocalScreen_clicked(
bool checked)
382 int width = GetScreenGeometry().width();
383 int height = GetScreenGeometry().height();
384 QString curSize = QString::number(width) +
"×" + QString::number(height);
385 ui->rbLocalScreen->setText(tr(
"Local screen") +
": " + curSize);
386 if(ui->cbDesktopSize->findText(curSize) == -1)
387 InsertDesktopSize(width, height);
388 ui->cbDesktopSize->setCurrentText(curSize);
391QRect CDlgSetFreeRDP::GetScreenGeometry()
394 QScreen* pScreen = QApplication::primaryScreen();
395 if(ui->cbAllMonitor->isChecked())
398 r = pScreen->virtualGeometry();
414 r = pScreen->geometry();
419int CDlgSetFreeRDP::UpdateDesktopSize()
421 ui->cbDesktopSize->clear();
422 QStringList lstDesktopSizes;
423 lstDesktopSizes <<
"640×480"
440 ui->cbDesktopSize->addItems(lstDesktopSizes);
442 int width = GetScreenGeometry().width();
443 int height = GetScreenGeometry().height();
444 QString curSize = QString::number(width) +
"×" + QString::number(height);
445 ui->rbLocalScreen->setText(tr(
"Local screen") +
": " + curSize);
446 if(ui->cbDesktopSize->findText(curSize) == -1)
447 InsertDesktopSize(width, height);
451int CDlgSetFreeRDP::InsertDesktopSize(QString szSize)
454 int nIndex = szSize.indexOf(
"×");
458 w = szSize.left(nIndex).toInt(&ok);
460 h = szSize.right(szSize.length() - nIndex - 1).toInt(&ok);
464 return InsertDesktopSize(w, h);
467int CDlgSetFreeRDP::InsertDesktopSize(
int width,
int height)
469 QString curSize = QString::number(width) +
"×" + QString::number(height);
470 if(ui->cbDesktopSize->findText(curSize) > -1)
473 int nCount = ui->cbDesktopSize->count();
474 for(
int i = 0; i < nCount; i++)
476 QString curText = ui->cbDesktopSize->itemText(i);
477 int nIndex = curText.indexOf(
"×");
480 int w = curText.left(nIndex).toInt();
481 int h = curText.right(curText.length() - nIndex - 1).toInt();
484 ui->cbDesktopSize->insertItem(i, curSize);
486 }
else if(w == width) {
489 ui->cbDesktopSize->insertItem(i, curSize);
496 QString curText = ui->cbDesktopSize->itemText(j);
497 int nIndex = curText.indexOf(
"×");
501 int w = curText.left(nIndex).toInt();
502 int h = curText.right(curText.length() - nIndex - 1).toInt();
504 ui->cbDesktopSize->insertItem(j, curSize);
509 ui->cbDesktopSize->insertItem(j, curSize);
511 }
else if(h == height)
523 if(ui->cbDesktopSize->findText(curSize) == -1)
524 ui->cbDesktopSize->addItem(curSize);
530void CDlgSetFreeRDP::on_rbAudioDisable_toggled(
bool checked)
532 ui->leRdpSnd->setEnabled(!checked);
535void CDlgSetFreeRDP::on_rbAudioLocal_toggled(
bool checked)
537 ui->leRdpSnd->setEnabled(checked);
540void CDlgSetFreeRDP::on_rbAudioRemote_toggled(
bool checked)
542 ui->leRdpSnd->setEnabled(!checked);
543 ui->leAudin->setEnabled(!checked);
544 ui->cbAudin->setEnabled(!checked);
547bool CDlgSetFreeRDP::HasAudioOutput()
549#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
550 auto d = QMediaDevices::defaultAudioOutput();
553 return !QAudioDeviceInfo::defaultOutputDevice().isNull();
557bool CDlgSetFreeRDP::HasAudioInput()
559#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
560 auto d = QMediaDevices::defaultAudioInput();
563 return !QAudioDeviceInfo::defaultInputDevice().isNull();
567void CDlgSetFreeRDP::on_pbSizeEdit_clicked()
571 for(
int i = 0; i < ui->cbDesktopSize->count(); i++)
572 lstSize << ui->cbDesktopSize->itemText(i);
573 dlg.SetDesktopSizes(lstSize);
574 if(QDialog::Accepted == dlg.exec())
576 ui->cbDesktopSize->clear();
577 foreach(
auto s, dlg.GetDesktopSize())
579 InsertDesktopSize(s);
584void CDlgSetFreeRDP::on_pbDriveClearAll_clicked()
586 ui->tvDrive->clearSelection();
587 ShowDriveSelected(0);
590void CDlgSetFreeRDP::slotSelectionChanged(
const QItemSelection &selected,
591 const QItemSelection &deselected)
593 QModelIndexList s = ui->tvDrive->selectionModel()->selectedRows(0);
594 ShowDriveSelected(s.size());
597int CDlgSetFreeRDP::ShowDriveSelected(
int counts)
599 ui->lbDriveSelected->setText(tr(
"Selected counts: ") + QString::number(counts));
603void CDlgSetFreeRDP::on_cbAllMonitor_stateChanged(
int arg1)
605 on_rbLocalScreen_clicked(
true);
608void CDlgSetFreeRDP::on_cbSecurityEnable_stateChanged(
int arg1)
611 m_pButtonGroup->deleteLater();
612 m_pButtonGroup =
nullptr;
614 if(!ui->cbSecurityEnable->isChecked()) {
615 m_pButtonGroup =
new QButtonGroup(
this);
616 m_pButtonGroup->addButton(ui->cbSecurityRDP);
617 m_pButtonGroup->addButton(ui->cbSecurityTls);
618 m_pButtonGroup->addButton(ui->cbSecurityNLA);
619 m_pButtonGroup->addButton(ui->cbSecurityNlaExt);
620 m_pButtonGroup->addButton(ui->cbSecurityRDSAAD);
621 m_pButtonGroup->addButton(ui->cbSecurityRDSTLS);
625void CDlgSetFreeRDP::on_cbConnectType_currentIndexChanged(
int index)
627 UINT32 type = ui->cbConnectType->itemData(index).toUInt();
628 if(0 >= type || CONNECTION_TYPE_AUTODETECT < type)
631 UINT32 performanceFlags = m_vPerformanceFlags[type - 1];
632 if(CONNECTION_TYPE_AUTODETECT == type)
634 performanceFlags = PERF_ENABLE_FONT_SMOOTHING | PERF_ENABLE_DESKTOP_COMPOSITION;
637 ui->cbDesktopBackground->setChecked(!(PERF_DISABLE_WALLPAPER & performanceFlags));
638 ui->cbWindowDrag->setChecked(!(PERF_DISABLE_FULLWINDOWDRAG & performanceFlags));
639 ui->cbMenuAnims->setChecked(!(PERF_DISABLE_MENUANIMATIONS & performanceFlags));
640 ui->cbThemes->setChecked(!(PERF_DISABLE_THEMING & performanceFlags));
641 ui->cbFontSmoothing->setChecked(PERF_ENABLE_FONT_SMOOTHING & performanceFlags);
642 ui->cbDesktopCompositing->setChecked(PERF_ENABLE_DESKTOP_COMPOSITION & performanceFlags);
644 ui->cbDesktopBackground->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
645 ui->cbWindowDrag->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
646 ui->cbMenuAnims->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
647 ui->cbThemes->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
648 ui->cbFontSmoothing->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
649 ui->cbDesktopCompositing->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
652void CDlgSetFreeRDP::InsertView(QWidget* pView,
int pos)
657 nWidth = qMax(nWidth, pView->frameSize().width());
658 nHeigth = qMax(nHeigth, pView->frameSize().height());
660 bool bScroll =
false;
661 QScreen* pScreen = QApplication::primaryScreen();
662 QSize size = this->size();
663 if(nWidth > size.width() || nHeigth > size.height())
670 QScrollArea* pScroll =
new QScrollArea(ui->tabWidget);
672 pScroll->setWidget(pView);
675 ui->tabWidget->insertTab(pos, pView, pView->windowIcon(), pView->windowTitle());
677 check = connect(
this, SIGNAL(accepted()), pView, SLOT(slotAccept()));
680 szMsg =
"Class '" + QString(pView->metaObject()->className())
681 +
"' must has slot slotAccept(), please add it. "
682 +
"Or the class derived from CParameterUI";
683 qCritical(log) << szMsg;
685 Q_ASSERT_X(check,
"CParameterDlgSettings", szMsg.toStdString().c_str());
690void CDlgSetFreeRDP::AddViewers(
const QList<QWidget *> &wViewer)
694 foreach(
auto p, wViewer) {
696 nWidth = qMax(nWidth, p->frameSize().width());
697 nHeigth = qMax(nHeigth, p->frameSize().height());
699 bool bScroll =
false;
700 QScreen* pScreen = QApplication::primaryScreen();
701 QSize size = this->size();
702 if(nWidth > size.width() || nHeigth > size.height())
705 foreach(
auto p, wViewer)
711 QScrollArea* pScroll =
new QScrollArea(ui->tabWidget);
712 if(!pScroll)
continue;
713 pScroll->setWidget(p);
716 ui->tabWidget->addTab(pView, p->windowIcon(), p->windowTitle());
718 check = connect(
this, SIGNAL(accepted()), p, SLOT(slotAccept()));
721 szMsg =
"Class '" + QString(p->metaObject()->className())
722 +
"' must has slot slotAccept(), please add it. "
723 +
"Or the class derived from CParameterUI";
724 qCritical(log) << szMsg;
726 Q_ASSERT_X(check,
"CParameterDlgSettings", szMsg.toStdString().c_str());
[Declare CParameterFreeRDP]
bool CheckValidity(bool validity=false)
检查参数的有效性