diff --git a/linphone-desktop/resources.qrc b/linphone-desktop/resources.qrc index 22438eff6..295ad6a77 100644 --- a/linphone-desktop/resources.qrc +++ b/linphone-desktop/resources.qrc @@ -194,13 +194,12 @@ ui/modules/Common/Form/+linux/SearchBox.qml ui/modules/Common/Form/ListForm.qml ui/modules/Common/Form/Placements/FormEmptyLine.qml - ui/modules/Common/Form/Placements/FormEntry.qml ui/modules/Common/Form/Placements/FormGroup.qml - ui/modules/Common/Form/Placements/FormHeaderEntry.qml - ui/modules/Common/Form/Placements/FormHeaderGroup.qml - ui/modules/Common/Form/Placements/FormHeader.qml ui/modules/Common/Form/Placements/FormLine.qml ui/modules/Common/Form/Placements/Form.qml + ui/modules/Common/Form/Placements/FormTableEntry.qml + ui/modules/Common/Form/Placements/FormTableLine.qml + ui/modules/Common/Form/Placements/FormTable.qml ui/modules/Common/Form/SearchBox.qml ui/modules/Common/Form/StaticListForm.qml ui/modules/Common/Form/Switch.qml @@ -241,10 +240,10 @@ ui/modules/Common/Styles/Form/Fields/TextFieldStyle.qml ui/modules/Common/Styles/Form/ListFormStyle.qml ui/modules/Common/Styles/Form/Placements/FormGroupStyle.qml - ui/modules/Common/Styles/Form/Placements/FormHeaderGroupStyle.qml - ui/modules/Common/Styles/Form/Placements/FormHeaderStyle.qml ui/modules/Common/Styles/Form/Placements/FormLineStyle.qml ui/modules/Common/Styles/Form/Placements/FormStyle.qml + ui/modules/Common/Styles/Form/Placements/FormTableLineStyle.qml + ui/modules/Common/Styles/Form/Placements/FormTableStyle.qml ui/modules/Common/Styles/Form/SearchBoxStyle.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/Fields/HexField.qml b/linphone-desktop/ui/modules/Common/Form/Fields/HexField.qml index 0207e85e3..6e0b41b09 100644 --- a/linphone-desktop/ui/modules/Common/Form/Fields/HexField.qml +++ b/linphone-desktop/ui/modules/Common/Form/Fields/HexField.qml @@ -1,5 +1,7 @@ import QtQuick 2.7 +import Common.Styles 1.0 + // ============================================================================= Item { @@ -23,7 +25,7 @@ Item { // --------------------------------------------------------------------------- implicitHeight: textField.height - implicitWidth: textField.width + width: TextFieldStyle.background.width // --------------------------------------------------------------------------- @@ -40,6 +42,8 @@ Item { regExp: /[0-9A-Fa-f]*/ } + width: parent.width + onEditingFinished: { text = _computeText('0x' + text) wrapper.editingFinished(parseInt(text, 16)) diff --git a/linphone-desktop/ui/modules/Common/Form/Fields/PortField.qml b/linphone-desktop/ui/modules/Common/Form/Fields/PortField.qml index 2fc87804b..92f7c3ca3 100644 --- a/linphone-desktop/ui/modules/Common/Form/Fields/PortField.qml +++ b/linphone-desktop/ui/modules/Common/Form/Fields/PortField.qml @@ -1,5 +1,6 @@ import QtQuick 2.7 +import Common.Styles 1.0 import Utils 1.0 // ============================================================================= @@ -47,7 +48,7 @@ Item { // --------------------------------------------------------------------------- implicitHeight: textField.height - implicitWidth: textField.width + width: TextFieldStyle.background.width // --------------------------------------------------------------------------- @@ -66,6 +67,8 @@ Item { : Utils.PORT_REGEX } + width: parent.width + // Workaround to supports empty string. Keys.onReturnPressed: editingFinished() onActiveFocusChanged: !activeFocus && editingFinished() diff --git a/linphone-desktop/ui/modules/Common/Form/Placements/Form.qml b/linphone-desktop/ui/modules/Common/Form/Placements/Form.qml index 4980c3641..0e192fa4f 100644 --- a/linphone-desktop/ui/modules/Common/Form/Placements/Form.qml +++ b/linphone-desktop/ui/modules/Common/Form/Placements/Form.qml @@ -12,10 +12,11 @@ Column { spacing: FormStyle.spacing - ColumnLayout { - width: parent.width + // --------------------------------------------------------------------------- + ColumnLayout { spacing: FormStyle.header.spacing + width: parent.width Text { id: title diff --git a/linphone-desktop/ui/modules/Common/Form/Placements/FormEntry.qml b/linphone-desktop/ui/modules/Common/Form/Placements/FormEntry.qml deleted file mode 100644 index 314f187c7..000000000 --- a/linphone-desktop/ui/modules/Common/Form/Placements/FormEntry.qml +++ /dev/null @@ -1,42 +0,0 @@ -import QtQuick 2.7 -import QtQuick.Layouts 1.3 - -import Common.Styles 1.0 - -// ============================================================================= -// Like a `FormGroup` but without label. -// Must be used in a `FormLine`. -// ============================================================================= - -Item { - default property alias _content: content.data - - // --------------------------------------------------------------------------- - - implicitHeight: content.height - width: FormGroupStyle.content.width - - Item { - id: content - - readonly property int currentHeight: _content[0] ? _content[0].height : 0 - readonly property int currentWidth: _content[0] ? _content[0].width : 0 - - anchors { - horizontalCenter: parent.horizontalCenter - - top: width > FormGroupStyle.legend.width - ? parent.top - : undefined - - verticalCenter: width > FormGroupStyle.legend.width - ? undefined - : parent.verticalCenter - } - - height: currentHeight - width: currentWidth > FormGroupStyle.content.width - ? FormGroupStyle.content.width - : currentWidth - } -} diff --git a/linphone-desktop/ui/modules/Common/Form/Placements/FormGroup.qml b/linphone-desktop/ui/modules/Common/Form/Placements/FormGroup.qml index f8272a09b..1a3347dba 100644 --- a/linphone-desktop/ui/modules/Common/Form/Placements/FormGroup.qml +++ b/linphone-desktop/ui/modules/Common/Form/Placements/FormGroup.qml @@ -3,19 +3,19 @@ import QtQuick.Layouts 1.3 import Common.Styles 1.0 -// ============================================================================= -// Display a form component with a legend. -// Must be used in a `FormLine`. // ============================================================================= RowLayout { property alias label: label.text - default property alias _content: content.data + default property var _content: null // --------------------------------------------------------------------------- spacing: FormGroupStyle.spacing + width: parent.maxItemWidth + + // --------------------------------------------------------------------------- Text { id: label @@ -31,17 +31,36 @@ RowLayout { verticalAlignment: Text.AlignVCenter } + // --------------------------------------------------------------------------- + Item { - id: content + readonly property int currentHeight: _content ? _content.height : 0 - readonly property int currentHeight: _content[0] ? _content[0].height : 0 + Layout.alignment: ( + currentHeight < FormGroupStyle.legend.height + ? Qt.AlignVCenter + : Qt.AlignTop + ) | Qt.AlignLeft - Layout.alignment: currentHeight < FormGroupStyle.legend.height - ? Qt.AlignVCenter - : Qt.AlignTop - - Layout.maximumWidth: FormGroupStyle.content.width + Layout.fillWidth: true Layout.preferredHeight: currentHeight - Layout.preferredWidth: FormGroupStyle.content.width + + Loader { + active: !!_content + anchors.fill: parent + + sourceComponent: Item { + id: content + + data: [ _content ] + width: parent.width + + Component.onCompleted: _content.width = Qt.binding(function () { + var contentWidth = content.width + var wishedWidth = FormGroupStyle.content.maxWidth + return contentWidth > wishedWidth ? wishedWidth : contentWidth + }) + } + } } } diff --git a/linphone-desktop/ui/modules/Common/Form/Placements/FormHeader.qml b/linphone-desktop/ui/modules/Common/Form/Placements/FormHeader.qml deleted file mode 100644 index 792d3d61f..000000000 --- a/linphone-desktop/ui/modules/Common/Form/Placements/FormHeader.qml +++ /dev/null @@ -1,10 +0,0 @@ -import Common.Styles 1.0 - -// ============================================================================= -// Like a `FormLine` but used as form header. -// ============================================================================= - -FormLine { - height: FormHeaderStyle.height - width: parent.width -} diff --git a/linphone-desktop/ui/modules/Common/Form/Placements/FormHeaderEntry.qml b/linphone-desktop/ui/modules/Common/Form/Placements/FormHeaderEntry.qml deleted file mode 100644 index 1febaf1a8..000000000 --- a/linphone-desktop/ui/modules/Common/Form/Placements/FormHeaderEntry.qml +++ /dev/null @@ -1,28 +0,0 @@ -import QtQuick 2.7 - -import Common.Styles 1.0 - -// ============================================================================= -// Display a title on a `FormEntry`. -// Must be used in a `FormHeader`. -// ============================================================================= - -Item { - property alias text: text.text - - height: parent.height - width: FormGroupStyle.content.width - - Text { - id: text - - anchors.centerIn: parent - color: FormHeaderGroupStyle.text.color - elide: Text.ElideRight - - font { - bold: true - pointSize: FormHeaderGroupStyle.text.fontSize - } - } -} diff --git a/linphone-desktop/ui/modules/Common/Form/Placements/FormHeaderGroup.qml b/linphone-desktop/ui/modules/Common/Form/Placements/FormHeaderGroup.qml deleted file mode 100644 index 2460c2a9c..000000000 --- a/linphone-desktop/ui/modules/Common/Form/Placements/FormHeaderGroup.qml +++ /dev/null @@ -1,34 +0,0 @@ -import QtQuick 2.7 - -import Common.Styles 1.0 - -// ============================================================================= -// Display a title on a `FormGroup`. -// Must be used in a `FormHeader`. -// ============================================================================= - -Item { - property alias text: text.text - - height: parent.height - width: FormGroupStyle.spacing + FormGroupStyle.legend.width + FormGroupStyle.content.width - - Text { - id: text - - anchors { - fill: parent - leftMargin: FormGroupStyle.spacing + FormGroupStyle.legend.width - } - - color: FormHeaderGroupStyle.text.color - elide: Text.ElideRight - font { - bold: true - pointSize: FormHeaderGroupStyle.text.fontSize - } - - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } -} diff --git a/linphone-desktop/ui/modules/Common/Form/Placements/FormLine.qml b/linphone-desktop/ui/modules/Common/Form/Placements/FormLine.qml index cf34c47bd..3860683b8 100644 --- a/linphone-desktop/ui/modules/Common/Form/Placements/FormLine.qml +++ b/linphone-desktop/ui/modules/Common/Form/Placements/FormLine.qml @@ -1,12 +1,21 @@ import QtQuick 2.7 +import QtQuick.Layouts 1.3 import Common.Styles 1.0 -// ============================================================================= -// A line of `FormGroup`/`FormEntry`. // ============================================================================= Row { + readonly property double maxItemWidth: { + var n = children.length + var curWidth = width / n - (n - 1) * spacing + var maxWidth = FormGroupStyle.legend.width + FormGroupStyle.content.maxWidth + FormGroupStyle.spacing + + return curWidth < maxWidth ? curWidth : maxWidth + } + + // --------------------------------------------------------------------------- + spacing: FormLineStyle.spacing width: parent.width } diff --git a/linphone-desktop/ui/modules/Common/Form/Placements/FormTable.qml b/linphone-desktop/ui/modules/Common/Form/Placements/FormTable.qml new file mode 100644 index 000000000..3588b6b24 --- /dev/null +++ b/linphone-desktop/ui/modules/Common/Form/Placements/FormTable.qml @@ -0,0 +1,56 @@ +import QtQuick 2.7 + +import Common.Styles 1.0 + +// ============================================================================= + +Column { + id: formTable + + property alias titles: header.model + readonly property double maxItemWidth: { + var n = titles.length + var curWidth = (width - FormTableStyle.entry.width) / n - (n - 1) * FormTableLineStyle.spacing + var maxWidth = FormTableStyle.entry.maxWidth + + return curWidth < maxWidth ? curWidth : maxWidth + } + + // --------------------------------------------------------------------------- + + spacing: FormTableStyle.spacing + width: parent.width + + // --------------------------------------------------------------------------- + + Row { + spacing: FormTableLineStyle.spacing + width: parent.width + + // No title for the titles column. + Item { + height: FormTableStyle.entry.height + width: FormTableStyle.entry.width + } + + Repeater { + id: header + + Text { + id: text + + color: FormTableStyle.entry.text.color + elide: Text.ElideRight + horizontalAlignment: Text.AlignHCenter + text: modelData + height: FormTableStyle.entry.height + width: formTable.maxItemWidth + + font { + bold: true + pointSize: FormTableStyle.entry.text.fontSize + } + } + } + } +} diff --git a/linphone-desktop/ui/modules/Common/Form/Placements/FormTableEntry.qml b/linphone-desktop/ui/modules/Common/Form/Placements/FormTableEntry.qml new file mode 100644 index 000000000..8f0a8ba44 --- /dev/null +++ b/linphone-desktop/ui/modules/Common/Form/Placements/FormTableEntry.qml @@ -0,0 +1,28 @@ +import QtQuick 2.7 + +import Common.Styles 1.0 + +// ============================================================================= + +Item { + default property var _content + readonly property int currentHeight: _content ? _content.height : 0 + + // --------------------------------------------------------------------------- + + height: currentHeight + width: parent.maxItemWidth + + Loader { + active: !!_content + anchors.fill: parent + + sourceComponent: Item { + id: item + + data: [ _content ] + + Component.onCompleted: _content.anchors.centerIn = item + } + } +} diff --git a/linphone-desktop/ui/modules/Common/Form/Placements/FormTableLine.qml b/linphone-desktop/ui/modules/Common/Form/Placements/FormTableLine.qml new file mode 100644 index 000000000..6d2f4baaf --- /dev/null +++ b/linphone-desktop/ui/modules/Common/Form/Placements/FormTableLine.qml @@ -0,0 +1,36 @@ +import QtQuick 2.7 +import QtQuick.Layouts 1.3 + +import Common.Styles 1.0 + +// ============================================================================= + +Row { + property alias title: title.text + readonly property double maxItemWidth: parent.maxItemWidth + + // --------------------------------------------------------------------------- + + spacing: FormLineStyle.spacing + width: parent.width + + // --------------------------------------------------------------------------- + + Text { + id: title + + color: FormTableStyle.entry.text.color + elide: Text.ElideRight + + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + + height: FormTableStyle.entry.height + width: FormTableStyle.entry.width + + font { + bold: false + pointSize: FormTableStyle.entry.text.fontSize + } + } +} diff --git a/linphone-desktop/ui/modules/Common/Form/Tab/TabContainer.qml b/linphone-desktop/ui/modules/Common/Form/Tab/TabContainer.qml index 792620c08..58401c401 100644 --- a/linphone-desktop/ui/modules/Common/Form/Tab/TabContainer.qml +++ b/linphone-desktop/ui/modules/Common/Form/Tab/TabContainer.qml @@ -44,8 +44,6 @@ Rectangle { top: parent.top topMargin: TabContainerStyle.topMargin } - - width: parent.width } } diff --git a/linphone-desktop/ui/modules/Common/Styles/Form/ComboBoxStyle.qml b/linphone-desktop/ui/modules/Common/Styles/Form/ComboBoxStyle.qml index ee15fee45..0310491f3 100644 --- a/linphone-desktop/ui/modules/Common/Styles/Form/ComboBoxStyle.qml +++ b/linphone-desktop/ui/modules/Common/Styles/Form/ComboBoxStyle.qml @@ -11,7 +11,7 @@ QtObject { property int height: 36 property int iconSize: 10 property int radius: 4 - property int width: 400 + property int width: 200 property QtObject border: QtObject { property color color: Colors.c diff --git a/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormGroupStyle.qml b/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormGroupStyle.qml index 2561de9ef..030d8be3f 100644 --- a/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormGroupStyle.qml +++ b/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormGroupStyle.qml @@ -9,8 +9,7 @@ QtObject { property int spacing: 20 property QtObject content: QtObject { - property int height: 300 - property int width: 200 + property int maxWidth: 400 } property QtObject legend: QtObject { diff --git a/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormHeaderGroupStyle.qml b/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormHeaderGroupStyle.qml deleted file mode 100644 index 34ee9c3f0..000000000 --- a/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormHeaderGroupStyle.qml +++ /dev/null @@ -1,13 +0,0 @@ -pragma Singleton -import QtQuick 2.7 - -import Common 1.0 - -// ============================================================================= - -QtObject { - property QtObject text: QtObject { - property color color: Colors.j - property int fontSize: 10 - } -} diff --git a/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormLineStyle.qml b/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormLineStyle.qml index 2e8763336..58cd90e82 100644 --- a/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormLineStyle.qml +++ b/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormLineStyle.qml @@ -4,5 +4,5 @@ import QtQuick 2.7 // ============================================================================= QtObject { - property int spacing: 10 + property int spacing: 20 } diff --git a/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormHeaderStyle.qml b/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormTableLineStyle.qml similarity index 83% rename from linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormHeaderStyle.qml rename to linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormTableLineStyle.qml index 86856f975..58cd90e82 100644 --- a/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormHeaderStyle.qml +++ b/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormTableLineStyle.qml @@ -4,5 +4,5 @@ import QtQuick 2.7 // ============================================================================= QtObject { - property int height: 30 + property int spacing: 20 } diff --git a/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormTableStyle.qml b/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormTableStyle.qml new file mode 100644 index 000000000..eaaebf438 --- /dev/null +++ b/linphone-desktop/ui/modules/Common/Styles/Form/Placements/FormTableStyle.qml @@ -0,0 +1,21 @@ +pragma Singleton +import QtQuick 2.7 + +import Common 1.0 + +// ============================================================================= + +QtObject { + property int spacing: 10 + + property QtObject entry: QtObject { + property int height: 36 + property int width: 200 + property int maxWidth: 400 + + property QtObject text: QtObject { + property color color: Colors.j + property int fontSize: 10 + } + } +} diff --git a/linphone-desktop/ui/modules/Common/Styles/Form/Tab/TabContainerStyle.qml b/linphone-desktop/ui/modules/Common/Styles/Form/Tab/TabContainerStyle.qml index 70840e9aa..c7f27e6c9 100644 --- a/linphone-desktop/ui/modules/Common/Styles/Form/Tab/TabContainerStyle.qml +++ b/linphone-desktop/ui/modules/Common/Styles/Form/Tab/TabContainerStyle.qml @@ -9,7 +9,7 @@ QtObject { property color color: Colors.k property int bottomMargin: 30 property int leftMargin: 30 - property int rightMargin: 30 + property int rightMargin: 40 property int topMargin: 30 property QtObject separator: QtObject { diff --git a/linphone-desktop/ui/modules/Common/Styles/qmldir b/linphone-desktop/ui/modules/Common/Styles/qmldir index afae90bb1..1abc677d3 100644 --- a/linphone-desktop/ui/modules/Common/Styles/qmldir +++ b/linphone-desktop/ui/modules/Common/Styles/qmldir @@ -29,10 +29,10 @@ singleton TextAreaFieldStyle 1.0 Form/Fields/TextAreaFieldStyle.qml singleton TextFieldStyle 1.0 Form/Fields/TextFieldStyle.qml singleton FormGroupStyle 1.0 Form/Placements/FormGroupStyle.qml -singleton FormHeaderStyle 1.0 Form/Placements/FormHeaderStyle.qml -singleton FormHeaderGroupStyle 1.0 Form/Placements/FormHeaderGroupStyle.qml singleton FormLineStyle 1.0 Form/Placements/FormLineStyle.qml singleton FormStyle 1.0 Form/Placements/FormStyle.qml +singleton FormTableLineStyle 1.0 Form/Placements/FormTableLineStyle.qml +singleton FormTableStyle 1.0 Form/Placements/FormTableStyle.qml singleton TabButtonStyle 1.0 Form/Tab/TabButtonStyle.qml singleton TabContainerStyle 1.0 Form/Tab/TabContainerStyle.qml diff --git a/linphone-desktop/ui/modules/Common/qmldir b/linphone-desktop/ui/modules/Common/qmldir index 6c455151c..766c91558 100644 --- a/linphone-desktop/ui/modules/Common/qmldir +++ b/linphone-desktop/ui/modules/Common/qmldir @@ -41,12 +41,11 @@ TextField 1.0 Form/Fields/TextField.qml Form 1.0 Form/Placements/Form.qml FormEmptyLine 1.0 Form/Placements/FormEmptyLine.qml -FormEntry 1.0 Form/Placements/FormEntry.qml FormGroup 1.0 Form/Placements/FormGroup.qml -FormHeader 1.0 Form/Placements/FormHeader.qml -FormHeaderEntry 1.0 Form/Placements/FormHeaderEntry.qml -FormHeaderGroup 1.0 Form/Placements/FormHeaderGroup.qml FormLine 1.0 Form/Placements/FormLine.qml +FormTable 1.0 Form/Placements/FormTable.qml +FormTableEntry 1.0 Form/Placements/FormTableEntry.qml +FormTableLine 1.0 Form/Placements/FormTableLine.qml TabBar 1.0 Form/Tab/TabBar.qml TabButton 1.0 Form/Tab/TabButton.qml diff --git a/linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml b/linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml index 161cf5669..ef2da7227 100644 --- a/linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml +++ b/linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml @@ -104,128 +104,123 @@ TabContainer { title: qsTr('networkProtocolAndPortsTitle') width: parent.width - FormHeader { - FormHeaderGroup { - text: qsTr('portHeader') - } + FormTable { + titles: [ + qsTr('portHeader'), + qsTr('randomPortHeader'), + qsTr('enabledPortHeader') + ] - FormHeaderEntry { - text: qsTr('randomPortHeader') - } + FormTableLine { + title: qsTr('sipUdpPortLabel') - FormHeaderEntry { - text: qsTr('enabledPortHeader') - } - } + FormTableEntry { + NumericField { + minValue: 0 + maxValue: 65535 + readOnly: randomSipUdpPort.checked || !enableSipUdpPort.checked + } + } - FormLine { - FormGroup { - label: qsTr('sipUdpPortLabel') + FormTableEntry { + Switch { + id: randomSipUdpPort - NumericField { - minValue: 0 - maxValue: 65535 - readOnly: randomSipUdpPort.checked || !enableSipUdpPort.checked + enabled: enableSipUdpPort.checked + } + } + + FormTableEntry { + Switch { + id: enableSipUdpPort + } } } - FormEntry { - Switch { - id: randomSipUdpPort + FormTableLine { + title: qsTr('sipTcpPortLabel') - enabled: enableSipUdpPort.checked + FormTableEntry { + NumericField { + + minValue: 0 + maxValue: 65535 + readOnly: randomSipTcpPort.checked || !enableSipTcpPort.checked + } + } + + FormTableEntry { + Switch { + id: randomSipTcpPort + + enabled: enableSipTcpPort.checked + } + } + + FormTableEntry { + Switch { + id: enableSipTcpPort + } } } - FormEntry { - Switch { - id: enableSipUdpPort + FormTableLine { + id: audioRtpUdpPort + + readonly property int defaultPort: 7078 + + title: qsTr('audioRtpUdpPortLabel') + + FormTableEntry { + PortField { + readOnly: randomAudioRtpUdpPort.checked + supportsRange: true + text: SettingsModel.audioPortRange.join(':') + + onEditingFinished: SettingsModel.audioPortRange = [ portA, portB ] + } } - } - } - FormLine { - FormGroup { - label: qsTr('sipTcpPortLabel') + FormTableEntry { + Switch { + id: randomAudioRtpUdpPort - NumericField { - minValue: 0 - maxValue: 65535 - readOnly: randomSipTcpPort.checked || !enableSipTcpPort.checked + checked: SettingsModel.audioPortRange[0] === -1 + + onClicked: SettingsModel.audioPortRange = checked + ? [ audioRtpUdpPort.defaultPort, -1 ] + : [ -1, -1 ] + } } } - FormEntry { - Switch { - id: randomSipTcpPort + FormTableLine { + id: videoRtpUdpPort - enabled: enableSipTcpPort.checked + readonly property int defaultPort: 9078 + + title: qsTr('videoRtpUdpPortLabel') + + FormTableEntry { + PortField { + readOnly: randomVideoRtpUdpPort.checked + supportsRange: true + text: SettingsModel.videoPortRange.join(':') + + onEditingFinished: SettingsModel.videoPortRange = [ portA, portB ] + } } - } - FormEntry { - Switch { - id: enableSipTcpPort - } - } - } + FormTableEntry { + Switch { + id: randomVideoRtpUdpPort - FormLine { - id: audioRtpUdpPort + checked: SettingsModel.videoPortRange[0] === -1 - readonly property int defaultPort: 7078 - - FormGroup { - label: qsTr('audioRtpUdpPortLabel') - - PortField { - readOnly: randomAudioRtpUdpPort.checked - supportsRange: true - text: SettingsModel.audioPortRange.join(':') - - onEditingFinished: SettingsModel.audioPortRange = [ portA, portB ] - } - } - - FormEntry { - Switch { - id: randomAudioRtpUdpPort - - checked: SettingsModel.audioPortRange[0] === -1 - - onClicked: SettingsModel.audioPortRange = checked - ? [ audioRtpUdpPort.defaultPort, -1 ] - : [ -1, -1 ] - } - } - } - - FormLine { - id: videoRtpUdpPort - - readonly property int defaultPort: 9078 - - FormGroup { - label: qsTr('videoRtpUdpPortLabel') - - PortField { - readOnly: randomVideoRtpUdpPort.checked - supportsRange: true - text: SettingsModel.videoPortRange.join(':') - - onEditingFinished: SettingsModel.videoPortRange = [ portA, portB ] - } - } - - FormEntry { - Switch { - id: randomVideoRtpUdpPort - - checked: SettingsModel.videoPortRange[0] === -1 - - onClicked: SettingsModel.videoPortRange = checked - ? [ videoRtpUdpPort.defaultPort, -1 ] - : [ -1, -1 ] + onClicked: SettingsModel.videoPortRange = checked + ? [ videoRtpUdpPort.defaultPort, -1 ] + : [ -1, -1 ] + } } } } @@ -304,9 +299,7 @@ TabContainer { } FormLine { - FormGroup { - label: '' - } + FormGroup {} FormGroup { label: qsTr('turnPasswordLabel') @@ -338,6 +331,8 @@ TabContainer { onEditingFinished: SettingsModel.dscpSip = value } } + + FormGroup {} } FormLine {