From e84c5e2ee59edb2591eb50587480d574d43e1141 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Tue, 14 Feb 2017 14:30:47 +0100 Subject: [PATCH] feat(ui/views/App/Settings/SettingsNetwork): view in progress --- linphone-desktop/assets/languages/en.ts | 8 ++-- linphone-desktop/assets/languages/fr.ts | 8 ++-- linphone-desktop/resources.qrc | 13 +++--- .../Common/Form/{ => Placements}/Form.qml | 0 .../Common/Form/Placements/FormEntry.qml | 30 ++++++++++++ .../Form/{ => Placements}/FormGroup.qml | 11 +++-- .../Common/Form/{ => Placements}/FormLine.qml | 0 .../Form/{ => Placements}/FormGroupStyle.qml | 0 .../Form/{ => Placements}/FormLineStyle.qml | 0 .../Form/{ => Placements}/FormStyle.qml | 0 .../ui/modules/Common/Styles/qmldir | 7 +-- linphone-desktop/ui/modules/Common/qmldir | 8 ++-- .../ui/views/App/Settings/SettingsNetwork.qml | 46 ++++++++++--------- 13 files changed, 84 insertions(+), 47 deletions(-) rename linphone-desktop/ui/modules/Common/Form/{ => Placements}/Form.qml (100%) create mode 100644 linphone-desktop/ui/modules/Common/Form/Placements/FormEntry.qml rename linphone-desktop/ui/modules/Common/Form/{ => Placements}/FormGroup.qml (78%) rename linphone-desktop/ui/modules/Common/Form/{ => Placements}/FormLine.qml (100%) rename linphone-desktop/ui/modules/Common/Styles/Form/{ => Placements}/FormGroupStyle.qml (100%) rename linphone-desktop/ui/modules/Common/Styles/Form/{ => Placements}/FormLineStyle.qml (100%) rename linphone-desktop/ui/modules/Common/Styles/Form/{ => Placements}/FormStyle.qml (100%) diff --git a/linphone-desktop/assets/languages/en.ts b/linphone-desktop/assets/languages/en.ts index 48c5f28c5..0ab95f7c5 100644 --- a/linphone-desktop/assets/languages/en.ts +++ b/linphone-desktop/assets/languages/en.ts @@ -613,7 +613,7 @@ Server url not configured. randomSipUdpPortLabel - Random + Random sipTcpPortLabel @@ -621,7 +621,7 @@ Server url not configured. randomSipTcpPortLabel - Random + Random audioRtpUdpPortLabel @@ -629,11 +629,11 @@ Server url not configured. randomAudioRtpUdpPortLabel - Random + Random randomVideoRtpUdpPortLabel - Random + Random videoRtpUdpPortLabel diff --git a/linphone-desktop/assets/languages/fr.ts b/linphone-desktop/assets/languages/fr.ts index b76b9c28d..3c25d759d 100644 --- a/linphone-desktop/assets/languages/fr.ts +++ b/linphone-desktop/assets/languages/fr.ts @@ -623,7 +623,7 @@ Url du serveur non configurée. randomSipUdpPortLabel - Aléatoire + Aléatoire sipTcpPortLabel @@ -631,7 +631,7 @@ Url du serveur non configurée. randomSipTcpPortLabel - Aléatoire + Aléatoire audioRtpUdpPortLabel @@ -639,11 +639,11 @@ Url du serveur non configurée. randomAudioRtpUdpPortLabel - Aléatoire + Aléatoire randomVideoRtpUdpPortLabel - Aléatoire + Aléatoire videoRtpUdpPortLabel diff --git a/linphone-desktop/resources.qrc b/linphone-desktop/resources.qrc index ba20323cc..15a38c45a 100644 --- a/linphone-desktop/resources.qrc +++ b/linphone-desktop/resources.qrc @@ -181,10 +181,11 @@ ui/modules/Common/Form/ExclusiveButtons.qml ui/modules/Common/Form/Fields/NumericField.qml ui/modules/Common/Form/Fields/TextField.qml - ui/modules/Common/Form/FormGroup.qml - ui/modules/Common/Form/FormLine.qml - ui/modules/Common/Form/Form.qml ui/modules/Common/Form/ListForm.qml + ui/modules/Common/Form/Placements/FormEntry.qml + ui/modules/Common/Form/Placements/FormGroup.qml + ui/modules/Common/Form/Placements/FormLine.qml + ui/modules/Common/Form/Placements/Form.qml ui/modules/Common/Form/SmallButton.qml ui/modules/Common/Form/StaticListForm.qml ui/modules/Common/Form/Switch.qml @@ -221,10 +222,10 @@ ui/modules/Common/Styles/Form/ExclusiveButtonsStyle.qml ui/modules/Common/Styles/Form/Fields/NumericFieldStyle.qml ui/modules/Common/Styles/Form/Fields/TextFieldStyle.qml - ui/modules/Common/Styles/Form/FormGroupStyle.qml - ui/modules/Common/Styles/Form/FormLineStyle.qml - ui/modules/Common/Styles/Form/FormStyle.qml ui/modules/Common/Styles/Form/ListFormStyle.qml + ui/modules/Common/Styles/Form/Placements/FormGroupStyle.qml + ui/modules/Common/Styles/Form/Placements/FormLineStyle.qml + ui/modules/Common/Styles/Form/Placements/FormStyle.qml ui/modules/Common/Styles/Form/SmallButtonStyle.qml ui/modules/Common/Styles/Form/SwitchStyle.qml ui/modules/Common/Styles/Form/Tab/TabButtonStyle.qml diff --git a/linphone-desktop/ui/modules/Common/Form/Form.qml b/linphone-desktop/ui/modules/Common/Form/Placements/Form.qml similarity index 100% rename from linphone-desktop/ui/modules/Common/Form/Form.qml rename to linphone-desktop/ui/modules/Common/Form/Placements/Form.qml diff --git a/linphone-desktop/ui/modules/Common/Form/Placements/FormEntry.qml b/linphone-desktop/ui/modules/Common/Form/Placements/FormEntry.qml new file mode 100644 index 000000000..fabacd2ae --- /dev/null +++ b/linphone-desktop/ui/modules/Common/Form/Placements/FormEntry.qml @@ -0,0 +1,30 @@ +import QtQuick 2.7 +import QtQuick.Layouts 1.3 + +import Common.Styles 1.0 + +// ============================================================================= +// Like a `FormGroup` but without label. +// ============================================================================= + +RowLayout { + default property alias _content: content.data + + // --------------------------------------------------------------------------- + + spacing: 0 + width: FormGroupStyle.content.width + + Item { + id: content + + readonly property int currentHeight: _content[0] ? _content[0].height : 0 + + Layout.alignment: ( + currentHeight < FormGroupStyle.legend.height ? Qt.AlignVCenter : Qt.AlignTop + ) | Qt.AlignHCenter + + Layout.preferredHeight: currentHeight + Layout.maximumWidth: FormGroupStyle.content.width + } +} diff --git a/linphone-desktop/ui/modules/Common/Form/FormGroup.qml b/linphone-desktop/ui/modules/Common/Form/Placements/FormGroup.qml similarity index 78% rename from linphone-desktop/ui/modules/Common/Form/FormGroup.qml rename to linphone-desktop/ui/modules/Common/Form/Placements/FormGroup.qml index 045c2abc1..1d03850d0 100644 --- a/linphone-desktop/ui/modules/Common/Form/FormGroup.qml +++ b/linphone-desktop/ui/modules/Common/Form/Placements/FormGroup.qml @@ -31,13 +31,14 @@ RowLayout { Item { id: content - Layout.alignment: { - var height = _content[0] ? _content[0].height : 0 - return height < label.height ? Qt.AlignVCenter : Qt.AlignTop - } + readonly property int currentHeight: _content[0] ? _content[0].height : 0 + + Layout.alignment: currentHeight < FormGroupStyle.legend.height + ? Qt.AlignVCenter + : Qt.AlignTop Layout.maximumWidth: FormGroupStyle.content.width - Layout.preferredHeight: _content[0] ? _content[0].height : 0 + Layout.preferredHeight: currentHeight Layout.preferredWidth: FormGroupStyle.content.width } } diff --git a/linphone-desktop/ui/modules/Common/Form/FormLine.qml b/linphone-desktop/ui/modules/Common/Form/Placements/FormLine.qml similarity index 100% rename from linphone-desktop/ui/modules/Common/Form/FormLine.qml rename to linphone-desktop/ui/modules/Common/Form/Placements/FormLine.qml diff --git a/linphone-desktop/ui/modules/Common/Styles/Form/FormGroupStyle.qml b/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormGroupStyle.qml similarity index 100% rename from linphone-desktop/ui/modules/Common/Styles/Form/FormGroupStyle.qml rename to linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormGroupStyle.qml diff --git a/linphone-desktop/ui/modules/Common/Styles/Form/FormLineStyle.qml b/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormLineStyle.qml similarity index 100% rename from linphone-desktop/ui/modules/Common/Styles/Form/FormLineStyle.qml rename to linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormLineStyle.qml diff --git a/linphone-desktop/ui/modules/Common/Styles/Form/FormStyle.qml b/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormStyle.qml similarity index 100% rename from linphone-desktop/ui/modules/Common/Styles/Form/FormStyle.qml rename to linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormStyle.qml diff --git a/linphone-desktop/ui/modules/Common/Styles/qmldir b/linphone-desktop/ui/modules/Common/Styles/qmldir index 56ea84b58..d12322347 100644 --- a/linphone-desktop/ui/modules/Common/Styles/qmldir +++ b/linphone-desktop/ui/modules/Common/Styles/qmldir @@ -17,6 +17,10 @@ singleton ForceScrollBarStyle 1.0 ForceScrollBarStyle.qml singleton NumericFieldStyle 1.0 Form/Fields/NumericFieldStyle.qml singleton TextFieldStyle 1.0 Form/Fields/TextFieldStyle.qml +singleton FormGroupStyle 1.0 Form/Placements/FormGroupStyle.qml +singleton FormLineStyle 1.0 Form/Placements/FormLineStyle.qml +singleton FormStyle 1.0 Form/Placements/FormStyle.qml + singleton TabButtonStyle 1.0 Form/Tab/TabButtonStyle.qml singleton TabContainerStyle 1.0 Form/Tab/TabContainerStyle.qml @@ -24,9 +28,6 @@ singleton AbstractTextButtonStyle 1.0 Form/AbstractTextButtonStyle.qml singleton ActionBarStyle 1.0 Form/ActionBarStyle.qml singleton CheckBoxTextStyle 1.0 Form/CheckBoxTextStyle.qml singleton ExclusiveButtonsStyle 1.0 Form/ExclusiveButtonsStyle.qml -singleton FormGroupStyle 1.0 Form/FormGroupStyle.qml -singleton FormLineStyle 1.0 Form/FormLineStyle.qml -singleton FormStyle 1.0 Form/FormStyle.qml singleton ListFormStyle 1.0 Form/ListFormStyle.qml singleton SmallButtonStyle 1.0 Form/SmallButtonStyle.qml singleton SwitchStyle 1.0 Form/SwitchStyle.qml diff --git a/linphone-desktop/ui/modules/Common/qmldir b/linphone-desktop/ui/modules/Common/qmldir index 813b3b9a4..1ed2d4656 100644 --- a/linphone-desktop/ui/modules/Common/qmldir +++ b/linphone-desktop/ui/modules/Common/qmldir @@ -34,6 +34,11 @@ ForceScrollBar 1.0 ForceScrollBar.qml NumericField 1.0 Form/Fields/NumericField.qml TextField 1.0 Form/Fields/TextField.qml +Form 1.0 Form/Placements/Form.qml +FormEntry 1.0 Form/Placements/FormEntry.qml +FormGroup 1.0 Form/Placements/FormGroup.qml +FormLine 1.0 Form/Placements/FormLine.qml + TabBar 1.0 Form/Tab/TabBar.qml TabButton 1.0 Form/Tab/TabButton.qml TabContainer 1.0 Form/Tab/TabContainer.qml @@ -43,9 +48,6 @@ ActionButton 1.0 Form/ActionButton.qml ActionSwitch 1.0 Form/ActionSwitch.qml CheckBoxText 1.0 Form/CheckBoxText.qml ExclusiveButtons 1.0 Form/ExclusiveButtons.qml -Form 1.0 Form/Form.qml -FormGroup 1.0 Form/FormGroup.qml -FormLine 1.0 Form/FormLine.qml LightButton 1.0 Form/LightButton.qml ListForm 1.0 Form/ListForm.qml StaticListForm 1.0 Form/StaticListForm.qml diff --git a/linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml b/linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml index 107aee8b6..ed746a95a 100644 --- a/linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml +++ b/linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml @@ -67,9 +67,7 @@ TabContainer { } } - FormGroup { - label: qsTr('randomSipUdpPortLabel') - + FormEntry { Switch { id: randomSipUdpPort @@ -77,8 +75,10 @@ TabContainer { } } - Switch { - id: enableSipUdpPort + FormEntry { + Switch { + id: enableSipUdpPort + } } } @@ -91,9 +91,7 @@ TabContainer { } } - FormGroup { - label: qsTr('randomSipTcpPortLabel') - + FormEntry { Switch { id: randomSipTcpPort @@ -101,8 +99,10 @@ TabContainer { } } - Switch { - id: enableSipTcpPort + FormEntry { + Switch { + id: enableSipTcpPort + } } } @@ -115,9 +115,7 @@ TabContainer { } } - FormGroup { - label: qsTr('randomAudioRtpUdpPortLabel') - + FormEntry { Switch { id: randomAudioRtpUdpPort @@ -125,8 +123,10 @@ TabContainer { } } - Switch { - id: enableAudioRtpUdpPort + FormEntry { + Switch { + id: enableAudioRtpUdpPort + } } } @@ -139,9 +139,7 @@ TabContainer { } } - FormGroup { - label: qsTr('randomVideoRtpUdpPortLabel') - + FormEntry { Switch { id: randomVideoRtpUdpPort @@ -149,8 +147,10 @@ TabContainer { } } - Switch { - id: enableVideoRtpUdpPort + FormEntry { + Switch { + id: enableVideoRtpUdpPort + } } } } @@ -187,6 +187,8 @@ TabContainer { Switch { id: enableTurn + + enabled: enableIce.checked } } @@ -194,7 +196,7 @@ TabContainer { label: qsTr('turnUserLabel') TextField { - readOnly: !enableTurn.checked + readOnly: !enableTurn.checked || !enableTurn.enabled } } } @@ -209,7 +211,7 @@ TabContainer { TextField { echoMode: TextInput.Password - readOnly: !enableTurn.checked + readOnly: !enableTurn.checked || !enableTurn.enabled } } }