Skip to content

Commit 8f091cf

Browse files
committed
Plugins: modify settings diaglog
1 parent 9b727f9 commit 8f091cf

25 files changed

Lines changed: 290 additions & 172 deletions

Plugins/FileTransfer/DlgFileTransfer.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>400</width>
10-
<height>300</height>
9+
<width>600</width>
10+
<height>400</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">

Plugins/FileTransfer/FrmFileTransfer.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>581</width>
10-
<height>329</height>
9+
<width>600</width>
10+
<height>450</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">

Plugins/FreeRDP/Client/DlgDesktopSize.ui

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>400</width>
10-
<height>300</height>
9+
<width>600</width>
10+
<height>400</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -19,7 +19,7 @@
1919
<item>
2020
<widget class="QListView" name="lstSizes">
2121
<property name="editTriggers">
22-
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
22+
<set>QAbstractItemView::EditTrigger::DoubleClicked|QAbstractItemView::EditTrigger::EditKeyPressed|QAbstractItemView::EditTrigger::SelectedClicked</set>
2323
</property>
2424
</widget>
2525
</item>
@@ -65,10 +65,10 @@
6565
<item row="2" column="0">
6666
<widget class="QDialogButtonBox" name="buttonBox">
6767
<property name="orientation">
68-
<enum>Qt::Horizontal</enum>
68+
<enum>Qt::Orientation::Horizontal</enum>
6969
</property>
7070
<property name="standardButtons">
71-
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
71+
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
7272
</property>
7373
</widget>
7474
</item>

Plugins/FreeRDP/Client/DlgGetUserPasswordFreeRDP.ui

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,21 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>400</width>
10-
<height>171</height>
9+
<width>600</width>
10+
<height>400</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
1414
<string>Input password</string>
1515
</property>
1616
<layout class="QGridLayout" name="gridLayout">
17+
<item row="0" column="0">
18+
<widget class="QLabel" name="lbText">
19+
<property name="text">
20+
<string>TextLabel</string>
21+
</property>
22+
</widget>
23+
</item>
1724
<item row="2" column="0">
1825
<widget class="CParameterUserUI" name="wUser" native="true"/>
1926
</item>
@@ -31,19 +38,12 @@
3138
</item>
3239
</layout>
3340
</item>
34-
<item row="0" column="0">
35-
<widget class="QLabel" name="lbText">
36-
<property name="text">
37-
<string>TextLabel</string>
38-
</property>
39-
</widget>
40-
</item>
41-
<item row="3" column="0">
41+
<item row="4" column="0">
4242
<layout class="QHBoxLayout" name="horizontalLayout">
4343
<item>
4444
<spacer name="horizontalSpacer_3">
4545
<property name="orientation">
46-
<enum>Qt::Horizontal</enum>
46+
<enum>Qt::Orientation::Horizontal</enum>
4747
</property>
4848
<property name="sizeHint" stdset="0">
4949
<size>
@@ -69,6 +69,19 @@
6969
</item>
7070
</layout>
7171
</item>
72+
<item row="3" column="0">
73+
<spacer name="verticalSpacer">
74+
<property name="orientation">
75+
<enum>Qt::Orientation::Vertical</enum>
76+
</property>
77+
<property name="sizeHint" stdset="0">
78+
<size>
79+
<width>20</width>
80+
<height>40</height>
81+
</size>
82+
</property>
83+
</spacer>
84+
</item>
7285
</layout>
7386
</widget>
7487
<customwidgets>

Plugins/FreeRDP/Client/DlgSetFreeRDP.cpp

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ CDlgSetFreeRDP::CDlgSetFreeRDP(CParameterFreeRDP *pSettings, QWidget *parent) :
5050

5151
m_pProxyUI = new CParameterProxyUI(ui->tabWidget);
5252
m_pProxyUI->SetParameter(&m_pSettings->m_Proxy);
53-
ui->tabWidget->insertTab(1, m_pProxyUI, m_pProxyUI->windowIcon(), tr("Proxy"));
54-
53+
InsertView(m_pProxyUI, 1);
54+
5555
m_pRecordUI = new CParameterRecordUI(ui->tabWidget);
5656
m_pRecordUI->SetParameter(&m_pSettings->m_Record);
57-
ui->tabWidget->addTab(m_pRecordUI, m_pRecordUI->windowIcon(), tr("Record"));
57+
QList<QWidget *> ws;
58+
ws << m_pRecordUI;
59+
AddViewers(ws);
5860

5961
// Display
6062
// It has to be the first. GetScreenGeometry depends on it
@@ -647,3 +649,81 @@ void CDlgSetFreeRDP::on_cbConnectType_currentIndexChanged(int index)
647649
ui->cbDesktopCompositing->setEnabled(!(CONNECTION_TYPE_AUTODETECT == type));
648650
}
649651

652+
void CDlgSetFreeRDP::InsertView(QWidget* pView, int pos)
653+
{
654+
int nWidth = 0;
655+
int nHeigth = 0;
656+
if(!pView) return;
657+
nWidth = qMax(nWidth, pView->frameSize().width());
658+
nHeigth = qMax(nHeigth, pView->frameSize().height());
659+
660+
bool bScroll = false;
661+
QScreen* pScreen = QApplication::primaryScreen();
662+
QSize size = this->size();
663+
if(nWidth > size.width() || nHeigth > size.height())
664+
bScroll = true;
665+
// [connect accepted to slotAccept of widget]
666+
667+
QString szMsg;
668+
if(bScroll)
669+
{
670+
QScrollArea* pScroll = new QScrollArea(ui->tabWidget);
671+
if(!pScroll) return;
672+
pScroll->setWidget(pView);
673+
pView = pScroll;
674+
}
675+
ui->tabWidget->insertTab(pos, pView, pView->windowIcon(), pView->windowTitle());
676+
bool check = false;
677+
check = connect(this, SIGNAL(accepted()), pView, SLOT(slotAccept()));
678+
if(!check)
679+
{
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;
684+
}
685+
Q_ASSERT_X(check, "CParameterDlgSettings", szMsg.toStdString().c_str());
686+
687+
// [connect accepted to slotAccept of widget]
688+
}
689+
690+
void CDlgSetFreeRDP::AddViewers(const QList<QWidget *> &wViewer)
691+
{
692+
int nWidth = 0;
693+
int nHeigth = 0;
694+
foreach(auto p, wViewer) {
695+
if(!p) continue;
696+
nWidth = qMax(nWidth, p->frameSize().width());
697+
nHeigth = qMax(nHeigth, p->frameSize().height());
698+
}
699+
bool bScroll = false;
700+
QScreen* pScreen = QApplication::primaryScreen();
701+
QSize size = this->size();
702+
if(nWidth > size.width() || nHeigth > size.height())
703+
bScroll = true;
704+
// [connect accepted to slotAccept of widget]
705+
foreach(auto p, wViewer)
706+
{
707+
QString szMsg;
708+
QWidget* pView = p;
709+
if(bScroll)
710+
{
711+
QScrollArea* pScroll = new QScrollArea(ui->tabWidget);
712+
if(!pScroll) continue;
713+
pScroll->setWidget(p);
714+
pView = pScroll;
715+
}
716+
ui->tabWidget->addTab(pView, p->windowIcon(), p->windowTitle());
717+
bool check = false;
718+
check = connect(this, SIGNAL(accepted()), p, SLOT(slotAccept()));
719+
if(!check)
720+
{
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;
725+
}
726+
Q_ASSERT_X(check, "CParameterDlgSettings", szMsg.toStdString().c_str());
727+
}
728+
// [connect accepted to slotAccept of widget]
729+
}

Plugins/FreeRDP/Client/DlgSetFreeRDP.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ private slots:
4747
void on_cbSecurityEnable_stateChanged(int arg1);
4848

4949
private:
50+
void InsertView(QWidget *p, int pos);
51+
void AddViewers(const QList<QWidget*> &wViewer);
5052
QRect GetScreenGeometry();
5153
int UpdateDesktopSize();
5254
int InsertDesktopSize(QString szSize);

0 commit comments

Comments
 (0)