diff --git a/Linphone/view/Control/Button/BigButton.qml b/Linphone/view/Control/Button/BigButton.qml index f83318996..d20a90a18 100644 --- a/Linphone/view/Control/Button/BigButton.qml +++ b/Linphone/view/Control/Button/BigButton.qml @@ -3,15 +3,16 @@ import QtQuick.Controls.Basic as Control import QtQuick.Effects import QtQuick.Layouts import Linphone - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + Button { id: mainItem textSize: Typography.b1.pixelSize textWeight: Typography.b1.weight - leftPadding: Math.round(20 * DefaultStyle.dp) - rightPadding: Math.round(20 * DefaultStyle.dp) - topPadding: Math.round(11 * DefaultStyle.dp) - bottomPadding: Math.round(11 * DefaultStyle.dp) - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(20) + rightPadding: Utils.getSizeWithScreenRatio(20) + topPadding: Utils.getSizeWithScreenRatio(11) + bottomPadding: Utils.getSizeWithScreenRatio(11) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) } diff --git a/Linphone/view/Control/Button/CalendarComboBox.qml b/Linphone/view/Control/Button/CalendarComboBox.qml index 4afcddc78..f671f8cfe 100644 --- a/Linphone/view/Control/Button/CalendarComboBox.qml +++ b/Linphone/view/Control/Button/CalendarComboBox.qml @@ -4,6 +4,7 @@ import QtQuick.Effects import QtQuick.Layouts import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ComboBox { id: mainItem @@ -15,24 +16,24 @@ ComboBox { id: contentText text: UtilsCpp.formatDate(calendar.selectedDate, false, true, "ddd d, MMMM") anchors.fill: parent - anchors.leftMargin: Math.round(15 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(15) anchors.verticalCenter: parent.verticalCenter verticalAlignment: Text.AlignVCenter font { - pixelSize: Math.round(14 * DefaultStyle.dp) - weight: Math.min(Math.round(700 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(14) + weight: Math.min(Utils.getSizeWithScreenRatio(700), 1000) } } popup: Control.Popup { id: popupItem y: mainItem.height - width: Math.round(321 * DefaultStyle.dp) - height: Math.round(270 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(321) + height: Utils.getSizeWithScreenRatio(270) closePolicy: Popup.NoAutoClose - topPadding: Math.round(25 * DefaultStyle.dp) - bottomPadding: Math.round(24 * DefaultStyle.dp) - leftPadding: Math.round(21 * DefaultStyle.dp) - rightPadding: Math.round(19 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(25) + bottomPadding: Utils.getSizeWithScreenRatio(24) + leftPadding: Utils.getSizeWithScreenRatio(21) + rightPadding: Utils.getSizeWithScreenRatio(19) onOpened: calendar.forceActiveFocus() background: Item { anchors.fill: parent @@ -40,7 +41,7 @@ ComboBox { id: calendarBg anchors.fill: parent color: DefaultStyle.grey_0 - radius: Math.round(16 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(16) border.color: DefaultStyle.main1_500_main border.width: calendar.activeFocus? 1 : 0 } diff --git a/Linphone/view/Control/Button/CheckBox.qml b/Linphone/view/Control/Button/CheckBox.qml index 233ebf588..33f7db758 100644 --- a/Linphone/view/Control/Button/CheckBox.qml +++ b/Linphone/view/Control/Button/CheckBox.qml @@ -2,21 +2,22 @@ import QtQuick import QtQuick.Controls.Basic as Control import Linphone import QtQuick.Effects - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + Control.CheckBox { id: mainItem hoverEnabled: enabled indicator: Item{ - implicitWidth: Math.round(20 * DefaultStyle.dp) - implicitHeight: Math.round(20 * DefaultStyle.dp) + implicitWidth: Utils.getSizeWithScreenRatio(20) + implicitHeight: Utils.getSizeWithScreenRatio(20) x: (parent.width - width) / 2 y: (parent.height - height) / 2 Rectangle { id: backgroundArea anchors.fill: parent - radius: Math.round(3 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(3) border.color: mainItem.hovered || mainItem.activeFocus ? DefaultStyle.main1_600 : DefaultStyle.main1_500_main - border.width: Math.round(2 * DefaultStyle.dp) + border.width: Utils.getSizeWithScreenRatio(2) color: mainItem.checked ? DefaultStyle.main1_500_main : "transparent" EffectImage { visible: mainItem.checked diff --git a/Linphone/view/Control/Button/ComboBox.qml b/Linphone/view/Control/Button/ComboBox.qml index d5db5b300..1dd66ca8c 100644 --- a/Linphone/view/Control/Button/ComboBox.qml +++ b/Linphone/view/Control/Button/ComboBox.qml @@ -149,7 +149,7 @@ Control.ComboBox { y: mainItem.height - 1 width: mainItem.width implicitHeight: Math.min(contentItem.implicitHeight, mainWindow.height) - padding: Math.max(Math.round(1 * DefaultStyle.dp), 1) + padding: Utils.getSizeWithScreenRatio(1) onOpened: { listView.positionViewAtIndex(listView.currentIndex, ListView.Center); @@ -168,7 +168,7 @@ Control.ComboBox { highlight: Rectangle { width: listView.width color: DefaultStyle.main2_200 - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) y: listView.currentItem ? listView.currentItem.y : 0 } @@ -190,10 +190,10 @@ Control.ComboBox { anchors.fill: parent EffectImage { id: delegateImg - Layout.preferredWidth: visible ? Math.round(20 * DefaultStyle.dp) : 0 - Layout.leftMargin: Math.round(10 * DefaultStyle.dp) + Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(20) : 0 + Layout.leftMargin: Utils.getSizeWithScreenRatio(10) visible: imageSource != "" - imageWidth: Math.round(20 * DefaultStyle.dp) + imageWidth: Utils.getSizeWithScreenRatio(20) imageSource: typeof (modelData) != "undefined" && modelData.img ? modelData.img : "" fillMode: Image.PreserveAspectFit } @@ -201,7 +201,7 @@ Control.ComboBox { Text { id: flagItem Layout.preferredWidth: implicitWidth - Layout.leftMargin: delegateImg.visible ? 0 : Math.round(5 * DefaultStyle.dp) + Layout.leftMargin: delegateImg.visible ? 0 : Utils.getSizeWithScreenRatio(5) Layout.alignment: Qt.AlignCenter visible: mainItem.flagRole font { @@ -213,8 +213,8 @@ Control.ComboBox { } Text { Layout.fillWidth: true - Layout.leftMargin: delegateImg.visible ? 0 : flagItem.visble ? Utils.getSizeWithScreenRatio(5) : Utils.getSizeWithScreenRatio(25) - Layout.rightMargin: Math.round(20 * DefaultStyle.dp) + Layout.leftMargin: delegateImg.visible ? 0 : Utils.getSizeWithScreenRatio(flagItem.visble ? 5 : 25) + Layout.rightMargin: Utils.getSizeWithScreenRatio(20) Layout.alignment: Qt.AlignCenter text: typeof (modelData) != "undefined" ? mainItem.textRole ? modelData[mainItem.textRole] : modelData.text ? modelData.text : modelData : $modelData ? mainItem.textRole ? $modelData[mainItem.textRole] : $modelData : "" elide: Text.ElideRight diff --git a/Linphone/view/Control/Button/CountryIndicatorCombobox.qml b/Linphone/view/Control/Button/CountryIndicatorCombobox.qml index 7625941a7..5fe2c5dae 100644 --- a/Linphone/view/Control/Button/CountryIndicatorCombobox.qml +++ b/Linphone/view/Control/Button/CountryIndicatorCombobox.qml @@ -3,7 +3,8 @@ import QtQuick.Controls.Basic as Control import QtQuick.Layouts import QtQuick.Effects import Linphone - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + Control.ComboBox { id: mainItem property string defaultCallingCode: "" @@ -16,7 +17,7 @@ Control.ComboBox { } background: Rectangle { anchors.fill: parent - radius: Math.round(63 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(63) color: mainItem.enableBackgroundColor ? DefaultStyle.grey_100 : "transparent" border.color: mainItem.enableBackgroundColors ? (mainItem.errorMessage.length > 0 @@ -28,11 +29,11 @@ Control.ComboBox { } contentItem: RowLayout { readonly property var currentItem: combobox.model.getAt(combobox.currentIndex) - spacing: 0// Math.round(5 * DefaultStyle.dp) + spacing: 0 Text { id: selectedItemFlag visible: text.length > 0 - font.pixelSize: Math.round(21 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(21) text: parent.currentItem ? parent.currentItem.flag : "" font.family: DefaultStyle.flagFont } @@ -41,7 +42,7 @@ Control.ComboBox { // visible: false // layer.enabled: true // anchors.centerIn: selectedItemFlag - // radius: Math.round(600 * DefaultStyle.dp) + // radius: Utils.getSizeWithScreenRatio(600) // width: selectedItemFlag.width/2 // height: selectedItemFlag.height/2 // } @@ -68,11 +69,11 @@ Control.ComboBox { id: indicImage z: 1 anchors.right: parent.right - anchors.rightMargin: Math.round(15 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(15) anchors.verticalCenter: parent.verticalCenter imageSource: AppIcons.downArrow - width: Math.round(15 * DefaultStyle.dp) - height: Math.round(15 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(15) + height: Utils.getSizeWithScreenRatio(15) fillMode: Image.PreserveAspectFit colorizationColor: mainItem.indicatorColor } @@ -80,8 +81,8 @@ Control.ComboBox { popup: Control.Popup { id: listPopup y: combobox.height - 1 - width: Math.round(311 * DefaultStyle.dp) - height: Math.round(250 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(311) + height: Utils.getSizeWithScreenRatio(250) contentItem: ListView { id: listView @@ -92,14 +93,14 @@ Control.ComboBox { keyNavigationEnabled: true keyNavigationWraps: true maximumFlickVelocity: 1500 - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) highlight: Rectangle { anchors.left: parent.left anchors.right: parent.right width: listView.width height: listView.height color: DefaultStyle.main2_300 - // radius: Math.round(15 * DefaultStyle.dp) + // radius: Utils.getSizeWithScreenRatio(15) } delegate: Item { @@ -108,15 +109,15 @@ Control.ComboBox { RowLayout { id: contentLayout anchors.fill: parent - anchors.leftMargin: Math.round(20 * DefaultStyle.dp) - spacing: Math.round(5 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(5) Text { id: delegateImg visible: text.length > 0 text: $modelData.flag font { - pixelSize: Math.round(28 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(28) family: DefaultStyle.flagFont } } @@ -134,7 +135,7 @@ Control.ComboBox { Rectangle { id: separator - width: Math.max(Math.round(1 * DefaultStyle.dp), 1) + width: Utils.getSizeWithScreenRatio(1) height: combobox.height / 2 color: DefaultStyle.main2_500_main } @@ -158,7 +159,7 @@ Control.ComboBox { Rectangle { anchors.fill: parent opacity: 0.1 - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) color: DefaultStyle.main2_500_main visible: parent.containsMouse } @@ -180,7 +181,7 @@ Control.ComboBox { Rectangle { id: popupBg anchors.fill: parent - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) color: DefaultStyle.grey_100 } MultiEffect { diff --git a/Linphone/view/Control/Button/HelpIconLabelButton.qml b/Linphone/view/Control/Button/HelpIconLabelButton.qml index 60161db3e..a7802f7a3 100644 --- a/Linphone/view/Control/Button/HelpIconLabelButton.qml +++ b/Linphone/view/Control/Button/HelpIconLabelButton.qml @@ -2,13 +2,14 @@ import QtQuick import QtQuick.Effects import QtQuick.Layouts import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils MouseArea { id: mainItem property string iconSource property string title property string subTitle - property real iconSize: (32 * DefaultStyle.dp) + property real iconSize: Utils.getSizeWithScreenRatio(32) property bool shadowEnabled: containsMouse || activeFocus hoverEnabled: true width: content.implicitWidth @@ -36,7 +37,7 @@ MouseArea { ColumnLayout { width: implicitWidth height: implicitHeight - Layout.leftMargin: (16 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(16) Text { Layout.fillWidth: true text: mainItem.title diff --git a/Linphone/view/Control/Button/IconButton.qml b/Linphone/view/Control/Button/IconButton.qml index 80a146714..040e20c80 100644 --- a/Linphone/view/Control/Button/IconButton.qml +++ b/Linphone/view/Control/Button/IconButton.qml @@ -3,14 +3,15 @@ import QtQuick.Effects import QtQuick.Layouts import Linphone import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Button { id: mainItem - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) textSize: Typography.p1.pixelSize textWeight: Typography.p1.weight - radius: Math.round(5 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(5) shadowEnabled: mainItem.activeFocus || hovered style: ButtonStyle.hoveredBackground diff --git a/Linphone/view/Control/Button/IconLabelButton.qml b/Linphone/view/Control/Button/IconLabelButton.qml index 543eb67cd..1bb535681 100644 --- a/Linphone/view/Control/Button/IconLabelButton.qml +++ b/Linphone/view/Control/Button/IconLabelButton.qml @@ -3,20 +3,21 @@ import QtQuick.Effects import QtQuick.Layouts import Linphone import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Button { id: mainItem - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) textSize: Typography.p1.pixelSize textWeight: Typography.p1.weight - radius: Math.round(5 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(5) shadowEnabled: mainItem.activeFocus || hovered style: ButtonStyle.hoveredBackground property bool inverseLayout: false contentItem: RowLayout { - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) layoutDirection: mainItem.inverseLayout ? Qt.RightToLeft: Qt.LeftToRight EffectImage { imageSource: mainItem.icon.source diff --git a/Linphone/view/Control/Button/LabelButton.qml b/Linphone/view/Control/Button/LabelButton.qml index a3a5a807e..19d7296dc 100644 --- a/Linphone/view/Control/Button/LabelButton.qml +++ b/Linphone/view/Control/Button/LabelButton.qml @@ -4,6 +4,7 @@ import QtQuick.Effects import QtQuick.Layouts import Linphone import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: labelButton @@ -11,18 +12,18 @@ ColumnLayout { property alias button: button property alias text: text property string label - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) Button { id: button Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: Math.round(56 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(56 * DefaultStyle.dp) - topPadding: Math.round(16 * DefaultStyle.dp) - bottomPadding: Math.round(16 * DefaultStyle.dp) - leftPadding: Math.round(16 * DefaultStyle.dp) - rightPadding: Math.round(16 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(56) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(56) + topPadding: Utils.getSizeWithScreenRatio(16) + bottomPadding: Utils.getSizeWithScreenRatio(16) + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(16) contentImageColor: DefaultStyle.main2_600 - radius: Math.round(40 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(40) style: ButtonStyle.grey Accessible.name: labelButton.label } diff --git a/Linphone/view/Control/Button/MediumButton.qml b/Linphone/view/Control/Button/MediumButton.qml index 2a621a252..43a8a8793 100644 --- a/Linphone/view/Control/Button/MediumButton.qml +++ b/Linphone/view/Control/Button/MediumButton.qml @@ -3,15 +3,16 @@ import QtQuick.Controls.Basic as Control import QtQuick.Effects import QtQuick.Layouts import Linphone - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + Button { id: mainItem textSize: Typography.b2.pixelSize textWeight: Typography.b2.weight - leftPadding: Math.round(16 * DefaultStyle.dp) - rightPadding: Math.round(16 * DefaultStyle.dp) - topPadding: Math.round(10 * DefaultStyle.dp) - bottomPadding: Math.round(10 * DefaultStyle.dp) - icon.width: Math.round(16 * DefaultStyle.dp) - icon.height: Math.round(16 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(16) + topPadding: Utils.getSizeWithScreenRatio(10) + bottomPadding: Utils.getSizeWithScreenRatio(10) + icon.width: Utils.getSizeWithScreenRatio(16) + icon.height: Utils.getSizeWithScreenRatio(16) } diff --git a/Linphone/view/Control/Button/RadioButton.qml b/Linphone/view/Control/Button/RadioButton.qml index 44a7fa114..2a34314e6 100644 --- a/Linphone/view/Control/Button/RadioButton.qml +++ b/Linphone/view/Control/Button/RadioButton.qml @@ -3,7 +3,8 @@ import QtQuick.Controls.Basic as Control import QtQuick.Layouts import QtQuick.Effects import Linphone - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + Control.RadioButton { id: mainItem property string title @@ -11,7 +12,7 @@ Control.RadioButton { property string imgUrl property bool checkOnClick: true property color color - property real indicatorSize: Math.round(16 * DefaultStyle.dp) + property real indicatorSize: Utils.getSizeWithScreenRatio(16) property bool shadowEnabled: mainItem.activeFocus || mainItem.hovered //onClicked: if (checkOnClick && !mainItem.checked) mainItem.toggle() @@ -23,7 +24,7 @@ Control.RadioButton { cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor } - indicator: Item{ + indicator: Item { implicitWidth: mainItem.indicatorSize implicitHeight: mainItem.indicatorSize anchors.verticalCenter: mainItem.verticalCenter @@ -33,7 +34,7 @@ Control.RadioButton { radius: mainItem.indicatorSize/2 color: "transparent" border.color: mainItem.color - border.width: Math.round(2 * DefaultStyle.dp) + border.width: Utils.getSizeWithScreenRatio(2) Rectangle { width: parent.width/2 height: parent.height/2 diff --git a/Linphone/view/Control/Button/RoundButton.qml b/Linphone/view/Control/Button/RoundButton.qml index 1c7754089..94c10972d 100644 --- a/Linphone/view/Control/Button/RoundButton.qml +++ b/Linphone/view/Control/Button/RoundButton.qml @@ -3,15 +3,16 @@ import QtQuick.Controls.Basic as Control import QtQuick.Effects import QtQuick.Layouts import Linphone - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + Button { id: mainItem textSize: Typography.p1s.pixelSize textWeight: Typography.p1s.weight - padding: Math.round(16 * DefaultStyle.dp) + padding: Utils.getSizeWithScreenRatio(16) // icon.width: width // icon.height: width radius: width * 2 - // width: Math.round(24 * DefaultStyle.dp) + // width: Utils.getSizeWithScreenRatio(24) height: width } diff --git a/Linphone/view/Control/Button/SecurityRadioButton.qml b/Linphone/view/Control/Button/SecurityRadioButton.qml index 0710f64c3..c83df3f7e 100644 --- a/Linphone/view/Control/Button/SecurityRadioButton.qml +++ b/Linphone/view/Control/Button/SecurityRadioButton.qml @@ -2,7 +2,8 @@ import QtQuick import QtQuick.Controls.Basic as Control import QtQuick.Layouts import Linphone - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + Control.RadioButton { id: mainItem property string title @@ -21,18 +22,18 @@ Control.RadioButton { background: Rectangle { color: DefaultStyle.grey_100 border.color: mainItem.checked ? mainItem.color : "transparent" - radius: Math.round(20 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(20) } indicator: RowLayout { anchors.left: parent.left - anchors.leftMargin: Math.round(13 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(13) anchors.top: parent.top - anchors.topMargin: Math.round(8 * DefaultStyle.dp) - spacing: Math.round(4 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(4) Rectangle { - implicitWidth: Math.round(16 * DefaultStyle.dp) - implicitHeight: Math.round(16 * DefaultStyle.dp) + implicitWidth: Utils.getSizeWithScreenRatio(16) + implicitHeight: Utils.getSizeWithScreenRatio(16) radius: implicitWidth/2 border.color: mainItem.color @@ -51,7 +52,7 @@ Control.RadioButton { text: mainItem.title font.bold: true color: DefaultStyle.grey_900 - font.pixelSize: Math.round(16 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(16) } Button { padding: 0 @@ -59,12 +60,12 @@ Control.RadioButton { visible: false } icon.source: AppIcons.info - Layout.preferredWidth: Math.round(2 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(2 * DefaultStyle.dp) - width: Math.round(2 * DefaultStyle.dp) - height: Math.round(2 * DefaultStyle.dp) - icon.width: Math.round(2 * DefaultStyle.dp) - icon.height: Math.round(2 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(2) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(2) + width: Utils.getSizeWithScreenRatio(2) + height: Utils.getSizeWithScreenRatio(2) + icon.width: Utils.getSizeWithScreenRatio(2) + icon.height: Utils.getSizeWithScreenRatio(2) } } @@ -73,27 +74,27 @@ Control.RadioButton { anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right - anchors.leftMargin: Math.round(13 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(13) RowLayout { Layout.fillWidth: true Layout.fillHeight: true - Layout.bottomMargin: Math.round(10 * DefaultStyle.dp) - Layout.rightMargin: Math.round(10 * DefaultStyle.dp) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(10) + Layout.rightMargin: Utils.getSizeWithScreenRatio(10) Layout.alignment: Qt.AlignVCenter Text { id: innerText verticalAlignment: Text.AlignVCenter - Layout.preferredWidth: Math.round(220 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(100 * DefaultStyle.dp) - font.pixelSize: Math.round(14 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(220) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(100) + font.pixelSize: Utils.getSizeWithScreenRatio(14) text: mainItem.contentText Layout.fillHeight: true } Image { id: image Layout.fillHeight: true - Layout.preferredWidth: Math.round(100 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(100 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(100) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(100) fillMode: Image.PreserveAspectFit source: mainItem.imgUrl } diff --git a/Linphone/view/Control/Button/Settings/SwitchSetting.qml b/Linphone/view/Control/Button/Settings/SwitchSetting.qml index 103831c9e..af4ca4aa3 100644 --- a/Linphone/view/Control/Button/Settings/SwitchSetting.qml +++ b/Linphone/view/Control/Button/Settings/SwitchSetting.qml @@ -12,7 +12,7 @@ RowLayout { property var propertyOwner property var propertyOwnerGui property bool enabled: true - spacing : Math.round(20 * DefaultStyle.dp) + spacing : Utils.getSizeWithScreenRatio(20) signal checkedChanged(bool checked) function setChecked(value) { @@ -20,8 +20,8 @@ RowLayout { } ColumnLayout { - Layout.minimumHeight: Math.round(32 * DefaultStyle.dp) - spacing: Math.round(4 * DefaultStyle.dp) + Layout.minimumHeight: Utils.getSizeWithScreenRatio(32) + spacing: Utils.getSizeWithScreenRatio(4) Text { text: titleText font: Typography.p2l diff --git a/Linphone/view/Control/Button/SmallButton.qml b/Linphone/view/Control/Button/SmallButton.qml index e9d04654e..21e9698e2 100644 --- a/Linphone/view/Control/Button/SmallButton.qml +++ b/Linphone/view/Control/Button/SmallButton.qml @@ -3,15 +3,16 @@ import QtQuick.Controls.Basic as Control import QtQuick.Effects import QtQuick.Layouts import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Button { id: mainItem textSize: Typography.b3.pixelSize textWeight: Typography.b3.weight - leftPadding: Math.round(12 * DefaultStyle.dp) - rightPadding: Math.round(12 * DefaultStyle.dp) - topPadding: Math.round(6 * DefaultStyle.dp) - bottomPadding: Math.round(6 * DefaultStyle.dp) - icon.height: Math.round(14 * DefaultStyle.dp) - icon.width: Math.round(14 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(12) + rightPadding: Utils.getSizeWithScreenRatio(12) + topPadding: Utils.getSizeWithScreenRatio(6) + bottomPadding: Utils.getSizeWithScreenRatio(6) + icon.height: Utils.getSizeWithScreenRatio(14) + icon.width: Utils.getSizeWithScreenRatio(14) } diff --git a/Linphone/view/Control/Container/Call/ActiveSpeakerLayout.qml b/Linphone/view/Control/Container/Call/ActiveSpeakerLayout.qml index 43f45b548..95df7b4c2 100644 --- a/Linphone/view/Control/Container/Call/ActiveSpeakerLayout.qml +++ b/Linphone/view/Control/Container/Call/ActiveSpeakerLayout.qml @@ -7,6 +7,8 @@ import Linphone import EnumsToStringCpp import UtilsCpp import SettingsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + // ============================================================================= Item { @@ -33,8 +35,8 @@ Item { RowLayout{ anchors.fill: parent - anchors.rightMargin: Math.round(10 * DefaultStyle.dp) - spacing: Math.round(16 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(16) Sticker { id: activeSpeakerSticker Layout.fillWidth: true @@ -58,23 +60,23 @@ Item { ListView{ id: sideStickers Layout.fillHeight: true - Layout.preferredWidth: Math.round(300 * DefaultStyle.dp) - Layout.rightMargin: Math.round(10 * DefaultStyle.dp) - Layout.bottomMargin: Math.round(10 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(300) + Layout.rightMargin: Utils.getSizeWithScreenRatio(10) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(10) visible: allDevices.count > 2 || !!mainItem.conference?.core.isScreenSharingEnabled - //spacing: Math.round(15 * DefaultStyle.dp) // bugged? First item has twice margins + //spacing: Utils.getSizeWithScreenRatio(15) // bugged? First item has twice margins model: allDevices snapMode: ListView.SnapOneItem clip: true delegate: Item{ // Spacing workaround visible: $modelData && mainItem.callState != LinphoneEnums.CallState.End && mainItem.callState != LinphoneEnums.CallState.Released && ($modelData.core.address != activeSpeakerAddress || mainItem.conference?.core.isScreenSharingEnabled) || false - height: visible ? Math.round((180 + 15) * DefaultStyle.dp) : 0 - width: Math.round(300 * DefaultStyle.dp) + height: visible ? Utils.getSizeWithScreenRatio(180 + 15) : 0 + width: Utils.getSizeWithScreenRatio(300) Sticker { previewEnabled: index == 0 // before anchors for priority initialization anchors.fill: parent - anchors.bottomMargin: Math.round(15 * DefaultStyle.dp)// Spacing + anchors.bottomMargin: Utils.getSizeWithScreenRatio(15)// Spacing qmlName: 'S_'+index visible: parent.visible participantDevice: $modelData diff --git a/Linphone/view/Control/Container/Call/CallGridLayout.qml b/Linphone/view/Control/Container/Call/CallGridLayout.qml index a760201dd..8ad0e9388 100644 --- a/Linphone/view/Control/Container/Call/CallGridLayout.qml +++ b/Linphone/view/Control/Container/Call/CallGridLayout.qml @@ -4,6 +4,7 @@ import QtQml.Models import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= @@ -32,8 +33,8 @@ Mosaic { if(index < 0) cameraView.enabled = false // this is a delegate destruction. We need to stop camera before Qt change its currentDevice (and then, let CameraView to delete wrong renderer) } - height: grid.cellHeight - Math.round(10 * DefaultStyle.dp) - width: grid.cellWidth - Math.round(10 * DefaultStyle.dp) + height: grid.cellHeight - Utils.getSizeWithScreenRatio(10) + width: grid.cellWidth - Utils.getSizeWithScreenRatio(10) Sticker { id: cameraView previewEnabled: index == 0 diff --git a/Linphone/view/Control/Container/Call/CallHistoryLayout.qml b/Linphone/view/Control/Container/Call/CallHistoryLayout.qml index f7c367636..e177ef7e4 100644 --- a/Linphone/view/Control/Container/Call/CallHistoryLayout.qml +++ b/Linphone/view/Control/Container/Call/CallHistoryLayout.qml @@ -6,10 +6,11 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem - spacing: Math.round(30 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(30) property var callHistoryGui @@ -33,16 +34,16 @@ ColumnLayout { property alias detailContent: detailControl.data ColumnLayout { - spacing: Math.round(13 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(13) Item { - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) Layout.preferredHeight: detailAvatar.height Layout.alignment: Qt.AlignHCenter Avatar { id: detailAvatar anchors.horizontalCenter: parent.horizontalCenter - width: Math.round(100 * DefaultStyle.dp) - height: Math.round(100 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(100) + height: Utils.getSizeWithScreenRatio(100) contact: mainItem.contact || null isConference: !!mainItem.conferenceInfo displayNameVal: mainItem.contactName @@ -52,18 +53,18 @@ ColumnLayout { id: rightButton anchors.right: parent.right anchors.verticalCenter: detailAvatar.verticalCenter - anchors.rightMargin: Math.round(20 * DefaultStyle.dp) - width: Math.round(30 * DefaultStyle.dp) - height: Math.round(30 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(20) + width: Utils.getSizeWithScreenRatio(30) + height: Utils.getSizeWithScreenRatio(30) } } ColumnLayout { Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) - spacing: Math.round(5 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) + spacing: Utils.getSizeWithScreenRatio(5) ColumnLayout { - spacing: Math.round(2 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(2) Text { Layout.preferredWidth: implicitWidth Layout.alignment: Qt.AlignHCenter @@ -85,8 +86,8 @@ ColumnLayout { elide: Text.ElideMiddle maximumLineCount: 1 font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } @@ -98,8 +99,8 @@ ColumnLayout { text: contact ? contact.core.presenceStatus : "" color: contact ? contact.core.presenceColor : 'transparent' font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } @@ -120,15 +121,15 @@ ColumnLayout { } RowLayout { Layout.alignment: Qt.AlignHCenter - spacing: Math.round(72 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(72) Layout.fillWidth: true Layout.preferredHeight: childrenRect.height visible: !mainItem.isConference LabelButton { - width: Math.round(56 * DefaultStyle.dp) - height: Math.round(56 * DefaultStyle.dp) - button.icon.width: Math.round(24 * DefaultStyle.dp) - button.icon.height: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(56) + height: Utils.getSizeWithScreenRatio(56) + button.icon.width: Utils.getSizeWithScreenRatio(24) + button.icon.height: Utils.getSizeWithScreenRatio(24) button.icon.source: AppIcons.phone //: "Appel" label: qsTr("contact_call_action") @@ -139,10 +140,10 @@ ColumnLayout { } LabelButton { visible: !SettingsCpp.disableChatFeature - width: Math.round(56 * DefaultStyle.dp) - height: Math.round(56 * DefaultStyle.dp) - button.icon.width: Math.round(24 * DefaultStyle.dp) - button.icon.height: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(56) + height: Utils.getSizeWithScreenRatio(56) + button.icon.width: Utils.getSizeWithScreenRatio(24) + button.icon.height: Utils.getSizeWithScreenRatio(24) button.icon.source: AppIcons.chatTeardropText //: "Message" label: qsTr("contact_message_action") @@ -159,10 +160,10 @@ ColumnLayout { } LabelButton { visible: SettingsCpp.videoEnabled - width: Math.round(56 * DefaultStyle.dp) - height: Math.round(56 * DefaultStyle.dp) - button.icon.width: Math.round(24 * DefaultStyle.dp) - button.icon.height: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(56) + height: Utils.getSizeWithScreenRatio(56) + button.icon.width: Utils.getSizeWithScreenRatio(24) + button.icon.height: Utils.getSizeWithScreenRatio(24) button.icon.source: AppIcons.videoCamera //: "Appel Video" label: qsTr("contact_video_call_action") @@ -178,6 +179,6 @@ ColumnLayout { Layout.fillHeight: true Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Math.round(30 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(30) } } diff --git a/Linphone/view/Control/Container/Call/CallLayout.qml b/Linphone/view/Control/Container/Call/CallLayout.qml index 41d590fc3..eb14d0508 100644 --- a/Linphone/view/Control/Container/Call/CallLayout.qml +++ b/Linphone/view/Control/Container/Call/CallLayout.qml @@ -7,6 +7,8 @@ import Linphone import EnumsToStringCpp 1.0 import UtilsCpp 1.0 import SettingsCpp 1.0 +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + // ============================================================================= Item { @@ -67,7 +69,7 @@ Item { id: callTerminatedText anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top - anchors.topMargin: Math.round(25 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(25) z: 1 visible: mainItem.callState === LinphoneEnums.CallState.End || mainItem.callState === LinphoneEnums.CallState.Error || mainItem.callState === LinphoneEnums.CallState.Released text: mainItem.conference @@ -82,8 +84,8 @@ Item { : call && call.core.lastErrorMessage || "" color: DefaultStyle.grey_0 font { - pixelSize: Math.round(22 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(22) + weight: Utils.getSizeWithScreenRatio(300) } } @@ -105,12 +107,12 @@ Item { && mainItem.callState !== LinphoneEnums.CallState.OutgoingInit && !mainItem.conference?.core.isScreenSharingEnabled && mainItem.participantDeviceCount <= 2 - height: Math.round(180 * DefaultStyle.dp) - width: Math.round(300 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(180) + width: Utils.getSizeWithScreenRatio(300) anchors.right: mainItem.right anchors.bottom: mainItem.bottom - anchors.rightMargin: Math.round(20 * DefaultStyle.dp) - anchors.bottomMargin: Math.round(10 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(20) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(10) videoEnabled: preview.visible && mainItem.call && mainItem.call.core.localVideoEnabled onVideoEnabledChanged: console.log("P : " +videoEnabled + " / " +visible +" / " +mainItem.call) property var accountObj: UtilsCpp.findLocalAccountByAddress(mainItem.localAddress) @@ -123,7 +125,7 @@ Item { id: previewMouseArea anchors.fill: parent movableArea: mainItem - margin: Math.round(10 * DefaultStyle.dp) + margin: Utils.getSizeWithScreenRatio(10) function resetPosition(){ preview.anchors.right = mainItem.right preview.anchors.bottom = mainItem.bottom @@ -146,22 +148,22 @@ Item { id: waitingForOthersComponent Rectangle { color: DefaultStyle.grey_600 - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) ColumnLayout { anchors.centerIn: parent - spacing: Math.round(22 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(22) width: waitText.implicitWidth Text { id: waitText //: "En attente d'autres participants…" text: qsTr("conference_call_empty") - Layout.preferredHeight: Math.round(67 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(67) Layout.alignment: Qt.AlignHCenter horizontalAlignment: Text.AlignHCenter color: DefaultStyle.grey_0 font { - pixelSize: Math.round(30 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(30) + weight: Utils.getSizeWithScreenRatio(300) } } Item { diff --git a/Linphone/view/Control/Container/Call/Mosaic.qml b/Linphone/view/Control/Container/Call/Mosaic.qml index 33cea2476..836ef7ab1 100644 --- a/Linphone/view/Control/Container/Call/Mosaic.qml +++ b/Linphone/view/Control/Container/Call/Mosaic.qml @@ -2,6 +2,7 @@ import QtQuick import QtQuick.Controls.Basic import QtQuick.Layouts import QtQml.Models +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= ColumnLayout { @@ -56,7 +57,7 @@ ColumnLayout { GridView{ id: grid - property real margin: Math.round(10 * DefaultStyle.dp) + property real margin: Utils.getSizeWithScreenRatio(10) property int itemCount: model.count ? model.count :( model.length ? model.length : 0) property int columns: 1 property int rows: 1 diff --git a/Linphone/view/Control/Container/Carousel.qml b/Linphone/view/Control/Container/Carousel.qml index b79584b49..17d997ccb 100644 --- a/Linphone/view/Control/Container/Carousel.qml +++ b/Linphone/view/Control/Container/Carousel.qml @@ -3,6 +3,7 @@ import QtQuick.Layouts import QtQuick.Controls.Basic as Control import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem @@ -12,7 +13,7 @@ ColumnLayout { required property int itemsCount property int currentIndex: carouselStackLayout.currentIndex property var currentItem: carouselButton.itemAt(currentIndex) - spacing: Math.round(61 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(61) function goToSlide(index) { carouselStackLayout.goToSlideAtIndex(index) @@ -67,9 +68,9 @@ ColumnLayout { Item { Rectangle { id: currentIndicator - width: Math.round(13 * DefaultStyle.dp) - height: Math.round(8 * DefaultStyle.dp) - radius: Math.round(30 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(13) + height: Utils.getSizeWithScreenRatio(8) + radius: Utils.getSizeWithScreenRatio(30) color: DefaultStyle.main1_500_main z: 1 x: mainItem.currentIndex >= 0 && mainItem.currentItem ? mainItem.currentItem.x - width/2 + mainItem.currentItem.width/2 : 0 @@ -77,21 +78,21 @@ ColumnLayout { } RowLayout { id: carouselButtonsLayout - spacing: Math.round(7.5 * DefaultStyle.dp) - anchors.leftMargin: Math.round(2.5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(7.5) + anchors.leftMargin: Utils.getSizeWithScreenRatio(2.5) Repeater { id: carouselButton model: mainItem.itemsCount delegate: Button { - Layout.preferredWidth: Math.round(8 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(8 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(8) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(8) topPadding: 0 bottomPadding: 0 leftPadding: 0 rightPadding: 0 background: Rectangle { color: DefaultStyle.main2_200 - radius: Math.round(30 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(30) anchors.fill: parent } onClicked: { diff --git a/Linphone/view/Control/Container/Chat/ChatFilesGridLayout.qml b/Linphone/view/Control/Container/Chat/ChatFilesGridLayout.qml index b2c26d5cb..cb518d590 100644 --- a/Linphone/view/Control/Container/Chat/ChatFilesGridLayout.qml +++ b/Linphone/view/Control/Container/Chat/ChatFilesGridLayout.qml @@ -5,6 +5,7 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= GridLayout { @@ -12,10 +13,10 @@ GridLayout { property ChatMessageContentProxy proxyModel property bool isHoveringFile: false property int itemCount: delModel.count - property int itemWidth: Math.round(95 * DefaultStyle.dp) + property int itemWidth: Utils.getSizeWithScreenRatio(95) // cellWidth: - // cellHeight: Math.round(105 * DefaultStyle.dp) - property real maxWidth: 3 * 105 * DefaultStyle.dp + // cellHeight: Utils.getSizeWithScreenRatio(105) + property real maxWidth: Utils.getSizeWithScreenRatio(3 * 105) columns: optimalColumns diff --git a/Linphone/view/Control/Container/Contact/ContactLayout.qml b/Linphone/view/Control/Container/Contact/ContactLayout.qml index abd596367..52b1abb95 100644 --- a/Linphone/view/Control/Container/Contact/ContactLayout.qml +++ b/Linphone/view/Control/Container/Contact/ContactLayout.qml @@ -6,10 +6,11 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem - spacing: Math.round(30 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(30) property FriendGui contact @@ -17,34 +18,34 @@ ColumnLayout { property alias content: detailLayout.data property alias bannerContent: bannerLayout.data property alias secondLineContent: verticalLayoutSecondLine.data - property real minimumWidthForSwitchintToRowLayout: Math.round(756 * DefaultStyle.dp) + property real minimumWidthForSwitchintToRowLayout: Utils.getSizeWithScreenRatio(756) property var useVerticalLayout: width < minimumWidthForSwitchintToRowLayout GridLayout { - Layout.leftMargin: Math.round(64 * DefaultStyle.dp) - Layout.rightMargin: Math.round(64 * DefaultStyle.dp) - Layout.topMargin: Math.round(56 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(64) + Layout.rightMargin: Utils.getSizeWithScreenRatio(64) + Layout.topMargin: Utils.getSizeWithScreenRatio(56) Layout.fillWidth: true columns: mainItem.useVerticalLayout ? 1 : children.length rows: 1 - columnSpacing: Math.round(49 * DefaultStyle.dp) - rowSpacing: Math.round(27 * DefaultStyle.dp) + columnSpacing: Utils.getSizeWithScreenRatio(49) + rowSpacing: Utils.getSizeWithScreenRatio(27) ColumnLayout { - spacing: Math.round(16 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(341 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(341) RowLayout { - Layout.preferredWidth: Math.round(341 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(341) Control.Control { - // Layout.preferredWidth: Math.round(734 * DefaultStyle.dp) + // Layout.preferredWidth: Utils.getSizeWithScreenRatio(734) Layout.fillWidth: true - width: Math.round(734 * DefaultStyle.dp) - height: Math.round(100 * DefaultStyle.dp) - rightPadding: Math.round(21 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(734) + height: Utils.getSizeWithScreenRatio(100) + rightPadding: Utils.getSizeWithScreenRatio(21) background: GradientRectangle { anchors.fill: parent anchors.leftMargin: avatar.width / 2 - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) borderGradient: Gradient { orientation: Gradient.Horizontal GradientStop { position: 0.0; color: DefaultStyle.grey_100 } @@ -58,12 +59,12 @@ ColumnLayout { } contentItem: RowLayout { id: bannerLayout - spacing: Math.round(32 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(32) Avatar { id: avatar contact: mainItem.contact - Layout.preferredWidth: Math.round(100 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(100 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(100) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(100) } } } @@ -71,8 +72,8 @@ ColumnLayout { PresenceNoteLayout { visible: contact?.core.presenceNote.length > 0 && mainItem.useVerticalLayout friendCore: contact?.core || null - Layout.preferredWidth: 412 * DefaultStyle.dp - Layout.preferredHeight: 85 * DefaultStyle.dp + Layout.preferredWidth: Utils.getSizeWithScreenRatio(412) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(85) } } Item { @@ -90,23 +91,23 @@ ColumnLayout { } Rectangle { Layout.fillWidth:true - Layout.preferredHeight: 79 * DefaultStyle.dp + Layout.preferredHeight: Utils.getSizeWithScreenRatio(79) color: 'transparent' visible: contact && contact.core.presenceNote.length > 0 && !mainItem.useVerticalLayout PresenceNoteLayout { anchors.centerIn: parent friendCore: contact?.core || null - width: 412 * DefaultStyle.dp - height: 85 * DefaultStyle.dp + width: Utils.getSizeWithScreenRatio(412) + height: Utils.getSizeWithScreenRatio(85) } } StackLayout { id: detailLayout Layout.alignment: Qt.AlignCenter - Layout.topMargin: mainItem.useVerticalLayout ? 0 : Math.round(30 * DefaultStyle.dp) - Layout.leftMargin: Math.round(64 * DefaultStyle.dp) - Layout.rightMargin: Math.round(64 * DefaultStyle.dp) - Layout.bottomMargin: Math.round(53 * DefaultStyle.dp) + Layout.topMargin: mainItem.useVerticalLayout ? 0 : Utils.getSizeWithScreenRatio(30) + Layout.leftMargin: Utils.getSizeWithScreenRatio(64) + Layout.rightMargin: Utils.getSizeWithScreenRatio(64) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(53) Layout.fillWidth: true Layout.fillHeight: true } diff --git a/Linphone/view/Control/Container/Contact/PresenceNoteLayout.qml b/Linphone/view/Control/Container/Contact/PresenceNoteLayout.qml index 4e995b2cd..4e8c8a773 100644 --- a/Linphone/view/Control/Container/Contact/PresenceNoteLayout.qml +++ b/Linphone/view/Control/Container/Contact/PresenceNoteLayout.qml @@ -6,32 +6,33 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Rectangle { id: mainItem property var friendCore color: DefaultStyle.grey_0 - radius: 20 * DefaultStyle.dp + radius: Utils.getSizeWithScreenRatio(20) border.color: DefaultStyle.main2_200 - border.width: 2 * DefaultStyle.dp + border.width: Utils.getSizeWithScreenRatio(2) ColumnLayout { anchors.left: parent.left anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 16 * DefaultStyle.dp - anchors.rightMargin: 16 * DefaultStyle.dp - spacing: 8 * DefaultStyle.dp + anchors.leftMargin: Utils.getSizeWithScreenRatio(16) + anchors.rightMargin: Utils.getSizeWithScreenRatio(16) + spacing: Utils.getSizeWithScreenRatio(8) RowLayout { - spacing: 6 * DefaultStyle.dp + spacing: Utils.getSizeWithScreenRatio(6) EffectImage { fillMode: Image.PreserveAspectFit imageSource: AppIcons.presenceNote colorizationColor: DefaultStyle.main2_600 - Layout.preferredHeight: Math.round(17 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(17 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(17) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(17) } Text { diff --git a/Linphone/view/Control/Container/CreationFormLayout.qml b/Linphone/view/Control/Container/CreationFormLayout.qml index 59501ba4f..8fbcbd286 100644 --- a/Linphone/view/Control/Container/CreationFormLayout.qml +++ b/Linphone/view/Control/Container/CreationFormLayout.qml @@ -72,17 +72,17 @@ FocusScope { } Accessible.name: mainItem.startGroupButtonText contentItem: RowLayout { - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) anchors.verticalCenter: parent.verticalCenter Rectangle { - width: Math.round(44 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(44) height: width radius: width / 2 color: DefaultStyle.main1_500_main EffectImage { imageSource: AppIcons.usersThreeFilled anchors.centerIn: parent - width: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(24) height: width fillMode: Image.PreserveAspectFit colorizationColor: DefaultStyle.grey_0 diff --git a/Linphone/view/Control/Container/DetailLayout.qml b/Linphone/view/Control/Container/DetailLayout.qml index 1bbaa6c84..69ced935e 100644 --- a/Linphone/view/Control/Container/DetailLayout.qml +++ b/Linphone/view/Control/Container/DetailLayout.qml @@ -6,16 +6,17 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) property string label property var icon property alias content: contentControl.contentItem signal titleIconClicked RowLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Text { text: mainItem.label color: DefaultStyle.main1_500_main @@ -46,9 +47,9 @@ ColumnLayout { id: contentControl visible: expandButton.checked Layout.fillWidth: true - leftPadding: Math.round(20 * DefaultStyle.dp) - rightPadding: Math.round(20 * DefaultStyle.dp) - topPadding: Math.round(17 * DefaultStyle.dp) - bottomPadding: Math.round(17 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(20) + rightPadding: Utils.getSizeWithScreenRatio(20) + topPadding: Utils.getSizeWithScreenRatio(17) + bottomPadding: Utils.getSizeWithScreenRatio(17) } } \ No newline at end of file diff --git a/Linphone/view/Control/Container/FormItemLayout.qml b/Linphone/view/Control/Container/FormItemLayout.qml index 9c8f932bd..090581cef 100644 --- a/Linphone/view/Control/Container/FormItemLayout.qml +++ b/Linphone/view/Control/Container/FormItemLayout.qml @@ -3,6 +3,7 @@ import QtQuick.Layouts import QtQuick.Effects import Linphone import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils FocusScope{ id: mainItem @@ -40,11 +41,11 @@ FocusScope{ ColumnLayout { id: layout - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) anchors.left: parent.left anchors.right: parent.right RowLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) Text { visible: label.length > 0 verticalAlignment: Text.AlignVCenter @@ -63,8 +64,8 @@ FocusScope{ Item{Layout.fillWidth: true} PopupButton { visible: mainItem.tooltip !== "" - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) style: ButtonStyle.noBackground icon.source: AppIcons.info popUpTitle: mainItem.label diff --git a/Linphone/view/Control/Container/Main/MainRightPanel.qml b/Linphone/view/Control/Container/Main/MainRightPanel.qml index c1451517f..7f63c27aa 100644 --- a/Linphone/view/Control/Container/Main/MainRightPanel.qml +++ b/Linphone/view/Control/Container/Main/MainRightPanel.qml @@ -3,7 +3,8 @@ import QtQuick.Effects import QtQuick.Layouts import QtQuick.Controls.Basic as Control import Linphone -import UtilsCpp 1.0 +import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem @@ -17,10 +18,10 @@ ColumnLayout { id: rightPanelHeader Layout.fillWidth: true z: rightPanelContent.z + 1 - topPadding: Math.round(30 * DefaultStyle.dp) - bottomPadding: Math.round(24 * DefaultStyle.dp) - leftPadding: Math.round(32 * DefaultStyle.dp) - rightPadding: Math.round(32 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(30) + bottomPadding: Utils.getSizeWithScreenRatio(24) + leftPadding: Utils.getSizeWithScreenRatio(32) + rightPadding: Utils.getSizeWithScreenRatio(32) background: Item { anchors.fill: parent @@ -36,7 +37,7 @@ ColumnLayout { shadowColor: DefaultStyle.grey_1000 shadowBlur: 1 shadowOpacity: 0.05 - shadowVerticalOffset: Math.round(10 * DefaultStyle.dp) + shadowVerticalOffset: Utils.getSizeWithScreenRatio(10) } } } diff --git a/Linphone/view/Control/Container/ScrollBar.qml b/Linphone/view/Control/Container/ScrollBar.qml index 80d790a7e..50dde610b 100644 --- a/Linphone/view/Control/Container/ScrollBar.qml +++ b/Linphone/view/Control/Container/ScrollBar.qml @@ -3,14 +3,15 @@ import QtQuick.Controls.Basic as Control import QtQuick.Effects import QtQuick.Layouts import Linphone - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + Control.ScrollBar { id: mainItem padding: 0 property color color: DefaultStyle.grey_850 contentItem: Rectangle { - implicitWidth: Math.round(6 * DefaultStyle.dp) - radius: Math.round(32 * DefaultStyle.dp) + implicitWidth: Utils.getSizeWithScreenRatio(6) + radius: Utils.getSizeWithScreenRatio(32) color: mainItem.color } } diff --git a/Linphone/view/Control/Container/Section.qml b/Linphone/view/Control/Container/Section.qml index 25a378d1b..87ddf3e23 100644 --- a/Linphone/view/Control/Container/Section.qml +++ b/Linphone/view/Control/Container/Section.qml @@ -2,28 +2,30 @@ import QtQuick import QtQuick.Layouts import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + /* Layout with line separator used in several views */ ColumnLayout { - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) property alias content: contentLayout.data property alias contentLayout: contentLayout - implicitHeight: contentLayout.implicitHeight + Math.max(Math.round(1 * DefaultStyle.dp), 1) + spacing + implicitHeight: contentLayout.implicitHeight + Utils.getSizeWithScreenRatio(1) + spacing ColumnLayout { id: contentLayout - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) // width: parent.width // Layout.fillWidth: true // Layout.preferredHeight: childrenRect.height // Layout.preferredWidth: parent.width - // Layout.leftMargin: Math.round(8 * DefaultStyle.dp) + // Layout.leftMargin: Utils.getSizeWithScreenRatio(8) } Rectangle { color: DefaultStyle.main2_200 Layout.fillWidth: true - Layout.preferredHeight: Math.max(Math.round(1 * DefaultStyle.dp), 1) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) width: parent.width } } diff --git a/Linphone/view/Control/Container/VerticalTabBar.qml b/Linphone/view/Control/Container/VerticalTabBar.qml index e28c89bc1..8190fc03a 100644 --- a/Linphone/view/Control/Container/VerticalTabBar.qml +++ b/Linphone/view/Control/Container/VerticalTabBar.qml @@ -50,7 +50,7 @@ Control.TabBar { horizontalAlignment: Text.AlignHCenter color: DefaultStyle.grey_0 fontSizeMode: Text.Fit - font.pixelSize: Math.round(15 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(15) text: parent.unread > 100 ? '99+' : parent.unread } } @@ -136,7 +136,7 @@ Control.TabBar { contentItem: ColumnLayout { EffectImage { id: buttonIcon - property real buttonSize: mainItem.currentIndex !== index && tabButton.hovered ? Utils.getSizeWithScreenRatio(26) : Utils.getSizeWithScreenRatio(24) + property real buttonSize: Utils.getSizeWithScreenRatio(mainItem.currentIndex !== index && tabButton.hovered ? 26 : 24) imageSource: mainItem.currentIndex === index ? modelData.selectedIcon : modelData.icon Layout.preferredWidth: buttonSize Layout.preferredHeight: buttonSize diff --git a/Linphone/view/Control/Display/BusyIndicator.qml b/Linphone/view/Control/Display/BusyIndicator.qml index 70ca7ecc0..400147c3e 100644 --- a/Linphone/view/Control/Display/BusyIndicator.qml +++ b/Linphone/view/Control/Display/BusyIndicator.qml @@ -3,6 +3,7 @@ import QtQuick.Controls.Basic as Control import QtQuick.Effects import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Item { id: mainItem @@ -13,7 +14,7 @@ Item { height: busyIndicator.height Control.BusyIndicator { id: busyIndicator - width: Math.round(60 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(60) height: width running: mainItem.visible anchors.centerIn: mainItem diff --git a/Linphone/view/Control/Display/Call/CallHistoryListView.qml b/Linphone/view/Control/Display/Call/CallHistoryListView.qml index 6aca4aac5..f5db09fc4 100644 --- a/Linphone/view/Control/Display/Call/CallHistoryListView.qml +++ b/Linphone/view/Control/Display/Call/CallHistoryListView.qml @@ -32,9 +32,7 @@ ListView { onListAboutToBeReset: loading = true filterText: mainItem.searchText onFilterTextChanged: maxDisplayItems = initialDisplayItems - initialDisplayItems: Math.max( - 20, - 2 * mainItem.height / (Utils.getSizeWithScreenRatio(56))) + initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(56))) displayItemsStep: 3 * initialDisplayItems / 2 onModelReset: { mainItem.resultsReceived() diff --git a/Linphone/view/Control/Display/Call/CallListView.qml b/Linphone/view/Control/Display/Call/CallListView.qml index e2451a032..454d4eb70 100644 --- a/Linphone/view/Control/Display/Call/CallListView.qml +++ b/Linphone/view/Control/Display/Call/CallListView.qml @@ -7,6 +7,7 @@ import QtQml import SettingsCpp import UtilsCpp 1.0 import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ListView { id: mainItem @@ -15,7 +16,7 @@ ListView { sourceModel: AppCpp.calls } implicitHeight: contentHeight - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) clip: true onCountChanged: forceLayout() @@ -26,9 +27,9 @@ ListView { delegate: RowLayout { id: callInformationItem - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) width: mainItem.width - height: Math.round(45 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(45) property var remoteNameObj: UtilsCpp.getDisplayName(modelData.core.remoteAddress) property var callName : (modelData && !SettingsCpp.disableMeetingsFeature && modelData.core.isConference) ? modelData.core.conference.core.subject @@ -37,8 +38,8 @@ ListView { : "" Avatar { id: delegateAvatar - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) _address: modelData.core.remoteAddress secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified isConference: modelData.core.isConference @@ -49,7 +50,7 @@ ListView { Text { id: delegateName text: callInformationItem.callName - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) Layout.fillWidth: true maximumLineCount: 1 } @@ -59,7 +60,7 @@ ListView { property string type: modelData.core.isConference ? qsTr("meeting") //: "Appel" : qsTr("call") - Layout.rightMargin: Math.round(2 * DefaultStyle.dp) + Layout.rightMargin: Utils.getSizeWithScreenRatio(2) text: modelData.core.state === LinphoneEnums.CallState.Paused || modelData.core.state === LinphoneEnums.CallState.PausedByRemote //: "%1 en pause" @@ -67,16 +68,16 @@ ListView { //: "%1 en cours" : qsTr("ongoing_call_or_meeting").arg(type) font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } Item{Layout.fillWidth: true} Button { id: transferButton - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) Layout.alignment: Qt.AlignVCenter visible: mainItem.isTransferList && (mainItem.currentRemoteAddress !== modelData.core.remoteAddress) icon.source: AppIcons.transferCall @@ -90,21 +91,21 @@ ListView { Button { id: pausingButton enabled: !(modelData.core.state === LinphoneEnums.CallState.PausedByRemote) - Layout.preferredWidth: Math.round(28 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(28 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(28) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) Layout.alignment: Qt.AlignVCenter - leftPadding: Math.round(5 * DefaultStyle.dp) - rightPadding: Math.round(5 * DefaultStyle.dp) - topPadding: Math.round(5 * DefaultStyle.dp) - bottomPadding: Math.round(5 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(5) + rightPadding: Utils.getSizeWithScreenRatio(5) + topPadding: Utils.getSizeWithScreenRatio(5) + bottomPadding: Utils.getSizeWithScreenRatio(5) property bool pausedByUser: modelData.core.state === LinphoneEnums.CallState.Paused color: pausedByUser ? DefaultStyle.success_500_main : DefaultStyle.grey_500 contentImageColor: DefaultStyle.grey_0 KeyNavigation.right: endCallButton KeyNavigation.left: endCallButton icon.source: pausedByUser ? AppIcons.play : AppIcons.pause - icon.width: Math.round(18 * DefaultStyle.dp) - icon.height: Math.round(18 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(18) + icon.height: Utils.getSizeWithScreenRatio(18) onClicked: modelData.core.lSetPaused(!modelData.core.paused) TextMetrics { id: pauseMeter @@ -120,14 +121,14 @@ ListView { } SmallButton { id: endCallButton - Layout.preferredWidth: Math.round(38 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(28 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(38) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) style: ButtonStyle.phoneRed KeyNavigation.left: pausingButton KeyNavigation.right: pausingButton contentImageColor: DefaultStyle.grey_0 - icon.width: Math.round(18 * DefaultStyle.dp) - icon.height: Math.round(18 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(18) + icon.height: Utils.getSizeWithScreenRatio(18) onClicked: { mainWindow.callTerminatedByUser = true mainWindow.endCall(modelData) diff --git a/Linphone/view/Control/Display/Call/CallStatistics.qml b/Linphone/view/Control/Display/Call/CallStatistics.qml index d119f3fb8..a07965b1c 100644 --- a/Linphone/view/Control/Display/Call/CallStatistics.qml +++ b/Linphone/view/Control/Display/Call/CallStatistics.qml @@ -3,69 +3,70 @@ import QtQuick.Controls.Basic as Control import QtQuick.Layouts import Linphone import SettingsCpp 1.0 +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem property var call property string objectName: "statsPanel" - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) RoundedPane { Layout.fillWidth: true - leftPadding: Math.round(16 * DefaultStyle.dp) - rightPadding: Math.round(16 * DefaultStyle.dp) - topPadding: Math.round(13 * DefaultStyle.dp) - bottomPadding: Math.round(13 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(16) + topPadding: Utils.getSizeWithScreenRatio(13) + bottomPadding: Utils.getSizeWithScreenRatio(13) - Layout.topMargin: Math.round(13 * DefaultStyle.dp) - Layout.leftMargin: Math.round(16 * DefaultStyle.dp) - Layout.rightMargin: Math.round(16 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(13) + Layout.leftMargin: Utils.getSizeWithScreenRatio(16) + Layout.rightMargin: Utils.getSizeWithScreenRatio(16) contentItem: ColumnLayout { - spacing: Math.round(12 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(12) Layout.alignment: Qt.AlignHCenter Text { //: "Audio" text: qsTr("call_stats_audio_title") Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) weight: Typography.p2.weight } } ColumnLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) Layout.alignment: Qt.AlignHCenter Text { text: mainItem.call ? mainItem.call.core.audioStats.codec : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.audioStats.bandwidth : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.audioStats.lossRate : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.audioStats.jitterBufferSize : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } } @@ -73,69 +74,69 @@ ColumnLayout { } RoundedPane { Layout.fillWidth: true - leftPadding: Math.round(16 * DefaultStyle.dp) - rightPadding: Math.round(16 * DefaultStyle.dp) - topPadding: Math.round(13 * DefaultStyle.dp) - bottomPadding: Math.round(13 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(16) + topPadding: Utils.getSizeWithScreenRatio(13) + bottomPadding: Utils.getSizeWithScreenRatio(13) - Layout.leftMargin: Math.round(16 * DefaultStyle.dp) - Layout.rightMargin: Math.round(16 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(16) + Layout.rightMargin: Utils.getSizeWithScreenRatio(16) visible: mainItem.call && (mainItem.call.core.localVideoEnabled || mainItem.call.core.remoteVideoEnabled) contentItem: ColumnLayout { - spacing: Math.round(12 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(12) Layout.alignment: Qt.AlignHCenter Text { //: "Vidéo" text: qsTr("call_stats_video_title") Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) weight: Typography.p2.weight } } ColumnLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) Layout.alignment: Qt.AlignHCenter Text { text: mainItem.call ? mainItem.call.core.videoStats.codec : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.videoStats.bandwidth : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.videoStats.lossRate : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.videoStats.resolution : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.videoStats.fps : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } } diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index 866c5a98a..8d237364d 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -15,7 +15,7 @@ ListView { property SearchBar searchBar property bool loading: false property string searchText: searchBar?.text - property real busyIndicatorSize: Math.round(60 * DefaultStyle.dp) + property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) property ChatGui currentChatGui: model.getAt(currentIndex) || null property ChatGui chatToSelect: null @@ -41,7 +41,7 @@ ListView { loading = true } filterText: mainItem.searchText - initialDisplayItems: Math.max(20, 2 * mainItem.height / (Math.round(56 * DefaultStyle.dp))) + initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(56))) displayItemsStep: 3 * initialDisplayItems / 2 onModelReset: { loading = false @@ -62,7 +62,7 @@ ListView { } } // flickDeceleration: 10000 - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) function selectChat(chatGui) { var index = chatProxy.findChatIndex(chatGui) @@ -134,8 +134,8 @@ ListView { component UnreadNotification: Item { id: unreadNotif property int unread: 0 - width: Math.round(14 * DefaultStyle.dp) - height: Math.round(14 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(14) + height: Utils.getSizeWithScreenRatio(14) visible: unread > 0 Rectangle { id: background @@ -148,7 +148,7 @@ ListView { horizontalAlignment: Text.AlignHCenter color: DefaultStyle.grey_0 fontSizeMode: Text.Fit - font.pixelSize: Math.round(10 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(10) text: parent.unreadNotif > 100 ? '99+' : unreadNotif.unread } } @@ -168,7 +168,7 @@ ListView { delegate: FocusScope { visible: !mainItem.loading width: mainItem.width - height: Math.round(63 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(63) Connections { target: mainItem function onMarkAllAsRead() {modelData.core.lMarkAsRead()} @@ -176,18 +176,18 @@ ListView { RowLayout { z: 1 anchors.fill: parent - anchors.leftMargin: Math.round(11 * DefaultStyle.dp) - anchors.rightMargin: Math.round(11 * DefaultStyle.dp) - anchors.topMargin: Math.round(9 * DefaultStyle.dp) - anchors.bottomMargin: Math.round(9 * DefaultStyle.dp) - spacing: Math.round(10 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(11) + anchors.rightMargin: Utils.getSizeWithScreenRatio(11) + anchors.topMargin: Utils.getSizeWithScreenRatio(9) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(9) + spacing: Utils.getSizeWithScreenRatio(10) Avatar { property var contactObj: modelData ? UtilsCpp.findFriendByAddress(modelData.core.peerAddress) : null contact: contactObj?.value || null displayNameVal: modelData && modelData.core.avatarUri || "" secured: modelData?.core.isSecured || false - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) // isConference: modelData.core.isConference shadowEnabled: false asynchronous: false @@ -195,7 +195,7 @@ ListView { ColumnLayout { Layout.fillHeight: true Layout.fillWidth: true - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) Text { id: friendAddress Layout.fillWidth: true @@ -209,7 +209,7 @@ ListView { } RowLayout { - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) Layout.fillWidth: true EffectImage { @@ -217,8 +217,8 @@ ListView { fillMode: Image.PreserveAspectFit imageSource: AppIcons.reply colorizationColor: DefaultStyle.main2_500 - Layout.preferredHeight: Math.round(14 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(14 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) } EffectImage { @@ -226,8 +226,8 @@ ListView { fillMode: Image.PreserveAspectFit imageSource: AppIcons.forward colorizationColor: DefaultStyle.main2_500 - Layout.preferredHeight: Math.round(14 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(14 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) } EffectImage { @@ -235,8 +235,8 @@ ListView { fillMode: Image.PreserveAspectFit imageSource: AppIcons.paperclip colorizationColor: DefaultStyle.main2_500 - Layout.preferredHeight: Math.round(14 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(14 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) } EffectImage { @@ -244,8 +244,8 @@ ListView { fillMode: Image.PreserveAspectFit imageSource: AppIcons.waveform colorizationColor: DefaultStyle.main2_500 - Layout.preferredHeight: Math.round(14 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(14 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) } EffectImage { @@ -253,8 +253,8 @@ ListView { fillMode: Image.PreserveAspectFit imageSource: AppIcons.calendarBlank colorizationColor: DefaultStyle.main2_500 - Layout.preferredHeight: Math.round(14 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(14 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) } Text { @@ -306,26 +306,26 @@ ListView { } RowLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Item {Layout.fillWidth: true} EffectImage { visible: modelData?.core.ephemeralEnabled || false - Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 - Layout.preferredHeight: 14 * DefaultStyle.dp + Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) colorizationColor: DefaultStyle.main2_400 imageSource: AppIcons.clockCountDown } EffectImage { visible: modelData != undefined && modelData?.core.isBasic - Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 - Layout.preferredHeight: 14 * DefaultStyle.dp + Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) colorizationColor: DefaultStyle.warning_700 imageSource: AppIcons.lockSimpleOpen } EffectImage { visible: modelData != undefined && modelData?.core.muted - Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 - Layout.preferredHeight: 14 * DefaultStyle.dp + Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) colorizationColor: DefaultStyle.main2_400 imageSource: AppIcons.bellSlash } @@ -336,8 +336,8 @@ ListView { EffectImage { visible: modelData?.core.lastMessage && modelData?.core.lastMessageState !== LinphoneEnums.ChatMessageState.StateIdle && !modelData.core.lastMessage.core.isRemoteMessage || false - Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 - Layout.preferredHeight: 14 * DefaultStyle.dp + Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) colorizationColor: DefaultStyle.main1_500_main imageSource: modelData ? modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDelivered @@ -357,7 +357,7 @@ ListView { id: chatroomPopup // z: 1 popup.x: 0 - popup.padding: Math.round(10 * DefaultStyle.dp) + popup.padding: Utils.getSizeWithScreenRatio(10) visible: mouseArea.containsMouse || hovered || popup.opened enabled: visible popup.contentItem: ColumnLayout { @@ -369,7 +369,7 @@ ListView { : qsTr("chat_room_mute") : "" icon.source: modelData ? modelData.core.muted ? AppIcons.bell : AppIcons.bellSlash : "" - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Layout.fillWidth: true onClicked: { modelData.core.muted = !modelData.core.muted @@ -380,7 +380,7 @@ ListView { //: "Mark as read" text: qsTr("chat_room_mark_as_read") icon.source: AppIcons.checks - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Layout.fillWidth: true onClicked: { modelData.core.lMarkAsRead() @@ -392,14 +392,14 @@ ListView { visible: modelData && !modelData.core.isReadOnly && modelData.core.isGroupChat || false Rectangle { Layout.fillWidth: true - Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp)) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) color: DefaultStyle.main2_400 } IconLabelButton { //: "leave" text: qsTr("chat_room_leave") icon.source: AppIcons.trashCan - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Layout.fillWidth: true onClicked: { //: leave the conversation ? @@ -420,7 +420,7 @@ ListView { Rectangle { visible: deleteButton.visible Layout.fillWidth: true - Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp)) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) color: DefaultStyle.main2_400 } IconLabelButton { @@ -428,7 +428,7 @@ ListView { //: "Delete" text: qsTr("chat_room_delete") icon.source: AppIcons.trashCan - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Layout.fillWidth: true onClicked: { //: Delete the conversation ? @@ -463,7 +463,7 @@ ListView { Rectangle { anchors.fill: parent opacity: 0.7 - radius: Math.round(8 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(8) color: mainItem.currentIndex === index ? DefaultStyle.main2_200 : DefaultStyle.main2_100 visible: mainItem.lastMouseContainsIndex === index || mainItem.currentIndex === index } diff --git a/Linphone/view/Control/Display/Chat/ChatMessage.qml b/Linphone/view/Control/Display/Chat/ChatMessage.qml index cfe29c7df..0f3fb1b4e 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessage.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessage.qml @@ -458,7 +458,7 @@ Control.Control { } Rectangle { Layout.fillWidth: true - Layout.preferredHeight: Math.min(1, Utils.getSizeWithScreenRatio(1)) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) color: DefaultStyle.main2_400 } IconLabelButton { diff --git a/Linphone/view/Control/Display/Chat/ChatMessageContent.qml b/Linphone/view/Control/Display/Chat/ChatMessageContent.qml index 834fdfc84..a227d4ae4 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessageContent.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessageContent.qml @@ -6,6 +6,7 @@ import QtMultimedia import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= // Simple content display without reply and forward. These modules need to be splitted because of cyclic dependencies. @@ -30,8 +31,8 @@ ColumnLayout { property int fileBorderWidth : 0 - spacing: Math.round(5 * DefaultStyle.dp) - property int padding: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) + property int padding: Utils.getSizeWithScreenRatio(10) property ChatMessageContentProxy filescontentProxy: ChatMessageContentProxy { filterType: ChatMessageContentProxy.FilterContentType.File @@ -49,8 +50,8 @@ ColumnLayout { delegate: ChatAudioContent { id: audioContent // Layout.fillWidth: true - width: Math.round(269 * DefaultStyle.dp) - height: Math.round(48 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(269) + height: Utils.getSizeWithScreenRatio(48) Layout.preferredHeight: height chatMessageContentGui: modelData onEndOfFileReached: mainItem.endOfVoiceRecordingReached() @@ -73,7 +74,7 @@ ColumnLayout { chatMessageGui: mainItem.chatMessageGui } delegate: ChatMessageInvitationBubble { - Layout.preferredWidth: 490 * DefaultStyle.dp + Layout.preferredWidth: Utils.getSizeWithScreenRatio(490) conferenceInfoGui: modelData.core.conferenceInfo onMouseEvent: (event) => mainItem.mouseEvent(event) } @@ -85,7 +86,7 @@ ColumnLayout { contentGui: mainItem.filescontentProxy.count === 1 ? mainItem.filescontentProxy.getChatMessageContentAtIndex(0) : null - width: Math.round(285 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(285) Layout.alignment: Qt.AlignHCenter fillMode: Image.PreserveAspectFit } @@ -95,7 +96,7 @@ ColumnLayout { contentGui: mainItem.filescontentProxy.count === 1 ? mainItem.filescontentProxy.getChatMessageContentAtIndex(0) : null - Layout.preferredWidth: Math.round(285 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(285) Layout.preferredHeight: paintedHeight Layout.alignment: Qt.AlignHCenter fillMode: Image.PreserveAspectFit @@ -106,8 +107,8 @@ ColumnLayout { contentGui: mainItem.filescontentProxy.count === 1 ? mainItem.filescontentProxy.getChatMessageContentAtIndex(0) : null - width: Math.round(285 * DefaultStyle.dp) - height: Math.round(285 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(285) + height: Utils.getSizeWithScreenRatio(285) Layout.preferredWidth: videoOutput.contentRect.width Layout.preferredHeight: videoOutput.contentRect.height Layout.alignment: Qt.AlignHCenter @@ -123,7 +124,7 @@ ColumnLayout { && !singleVideoFile.visible Layout.fillWidth: visible Layout.fillHeight: visible - maxWidth: Math.round(115*3 * DefaultStyle.dp) + maxWidth: Utils.getSizeWithScreenRatio(115*3) // Layout.fillHeight: true proxyModel: visible ? mainItem.filescontentProxy : null // onIsHoveringFileChanged: mainItem.isFileHoveringChanged(isHoveringFile) diff --git a/Linphone/view/Control/Display/Chat/ChatMessageInvitationBubble.qml b/Linphone/view/Control/Display/Chat/ChatMessageInvitationBubble.qml index 73b6420f8..fa8082937 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessageInvitationBubble.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessageInvitationBubble.qml @@ -12,7 +12,7 @@ ColumnLayout { spacing: 0 id: mainItem - width: 490 * DefaultStyle.dp + width: Utils.getSizeWithScreenRatio(490) property ConferenceInfoGui conferenceInfoGui property var conferenceInfo: conferenceInfoGui?.core @@ -43,16 +43,16 @@ ColumnLayout { Control.Control { id: infoControl - topPadding: Math.round(16 * DefaultStyle.dp) - leftPadding: Math.round(16 * DefaultStyle.dp) - rightPadding: Math.round(16 * DefaultStyle.dp) - bottomPadding: Math.round(16 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(16) + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(16) + bottomPadding: Utils.getSizeWithScreenRatio(16) Layout.fillWidth: true background: Rectangle { anchors.fill: parent color: DefaultStyle.grey_100 - radius: 10 * DefaultStyle.dp // rounded all, but only top visible + radius: Utils.getSizeWithScreenRatio(10) // rounded all, but only top visible } contentItem: ColumnLayout { Text { @@ -77,21 +77,21 @@ ColumnLayout { RowLayout { Layout.fillWidth: true - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Control.Control { id: dayRect Layout.alignment: Qt.AlignTop - topPadding: Math.round(4 * DefaultStyle.dp) - bottomPadding: Math.round(6 * DefaultStyle.dp) - leftPadding: Math.round(13 * DefaultStyle.dp) - rightPadding: Math.round(13 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(4) + bottomPadding: Utils.getSizeWithScreenRatio(6) + leftPadding: Utils.getSizeWithScreenRatio(13) + rightPadding: Utils.getSizeWithScreenRatio(13) background: Item { Rectangle { id: dayRectBg anchors.fill: parent - radius: 10 * DefaultStyle.dp + radius: Utils.getSizeWithScreenRatio(10) color: DefaultStyle.grey_0 } MultiEffect { @@ -103,7 +103,7 @@ ColumnLayout { } } contentItem: ColumnLayout { - spacing: 2 * DefaultStyle.dp + spacing: Utils.getSizeWithScreenRatio(2) Text { Layout.fillWidth: true @@ -120,8 +120,8 @@ ColumnLayout { } Rectangle { - width: 23 * DefaultStyle.dp - height: 23 * DefaultStyle.dp + width: Utils.getSizeWithScreenRatio(23) + height: Utils.getSizeWithScreenRatio(23) radius: width / 2 color: DefaultStyle.main1_500_main // anchors.horizontalCenter: parent.horizontalCenter @@ -138,14 +138,14 @@ ColumnLayout { // Info ColumnLayout { - spacing: -2 * DefaultStyle.dp + spacing: Utils.getSizeWithScreenRatio(-2) RowLayout { - spacing: 8 * DefaultStyle.dp + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.videoconference colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } Text { @@ -189,26 +189,26 @@ ColumnLayout { Rectangle { visible: conferenceInfo.description.length > 0 || conferenceInfo.participantCount > 0 Layout.fillWidth: true - height: 10 * DefaultStyle.dp + height: Utils.getSizeWithScreenRatio(10) color: DefaultStyle.grey_100 - Layout.topMargin: -10 * DefaultStyle.dp + Layout.topMargin: Utils.getSizeWithScreenRatio(-10) z: infoControl.z + 1 } Rectangle { visible: conferenceInfo.description.length > 0 || conferenceInfo.participantCount > 0 Layout.fillWidth: true - height: 10 * DefaultStyle.dp + height: Utils.getSizeWithScreenRatio(10) color: DefaultStyle.grey_0 - Layout.bottomMargin: -10 * DefaultStyle.dp + Layout.bottomMargin: Utils.getSizeWithScreenRatio(-10) z: infoControl.z + 1 } Control.Control { visible: conferenceInfo.description.length > 0 || conferenceInfo.participantCount > 0 - topPadding: Math.round(16 * DefaultStyle.dp) // only 6 because the rectangle linking the 2 controls is size 10 - leftPadding: Math.round(16 * DefaultStyle.dp) - rightPadding: Math.round(16 * DefaultStyle.dp) - bottomPadding: Math.round(16 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(16) // only 6 because the rectangle linking the 2 controls is size 10 + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(16) + bottomPadding: Utils.getSizeWithScreenRatio(16) Layout.fillWidth: true MouseArea { @@ -221,11 +221,11 @@ ColumnLayout { background: Rectangle { anchors.fill: parent color: DefaultStyle.grey_0 - radius: 10 * DefaultStyle.dp + radius: Utils.getSizeWithScreenRatio(10) } contentItem: ColumnLayout { - spacing: 10 * DefaultStyle.dp + spacing: Utils.getSizeWithScreenRatio(10) ColumnLayout { spacing: 0 @@ -263,13 +263,13 @@ ColumnLayout { RowLayout { visible: conferenceInfo.participantCount > 0 Layout.fillHeight: true - Layout.preferredHeight: 30 * DefaultStyle.dp - spacing: 10 * DefaultStyle.dp + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + spacing: Utils.getSizeWithScreenRatio(10) EffectImage { imageSource: AppIcons.usersTwo colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Math.round(14 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(14 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) } Text { //: %n participant(s) diff --git a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml index 2acc3b419..38fbfebe6 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml @@ -6,15 +6,16 @@ import Qt.labs.qmlmodels import Linphone import UtilsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ListView { id: mainItem - spacing: Math.round(4 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(4) property ChatGui chat property color backgroundColor property bool lastItemVisible: false property int lastIndexFoundWithFilter: -1 - property real busyIndicatorSize: Math.round(60 * DefaultStyle.dp) + property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) property bool loading: false property bool isEncrypted: chat && chat.core.isEncrypted @@ -53,15 +54,15 @@ ListView { Button { visible: !mainItem.lastItemVisible icon.source: AppIcons.downArrow - leftPadding: Math.round(16 * DefaultStyle.dp) - rightPadding: Math.round(16 * DefaultStyle.dp) - topPadding: Math.round(16 * DefaultStyle.dp) - bottomPadding: Math.round(16 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(16) + topPadding: Utils.getSizeWithScreenRatio(16) + bottomPadding: Utils.getSizeWithScreenRatio(16) anchors.bottom: parent.bottom style: ButtonStyle.main anchors.right: parent.right - anchors.bottomMargin: Math.round(18 * DefaultStyle.dp) - anchors.rightMargin: Math.round(18 * DefaultStyle.dp) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(18) + anchors.rightMargin: Utils.getSizeWithScreenRatio(18) onClicked: { var index = eventLogProxy.findFirstUnreadIndex() mainItem.positionViewAtIndex(index, ListView.Beginning) @@ -129,32 +130,32 @@ ListView { footer: Item { visible: mainItem.chat && !mainItem.loading - height: visible ? headerMessage.height + headerMessage.topMargin + headerMessage.bottomMargin : Math.round(30 * DefaultStyle.dp) + height: visible ? (headerMessage.height + headerMessage.topMargin + headerMessage.bottomMargin) : Utils.getSizeWithScreenRatio(30) width: headerMessage.width anchors.horizontalCenter: parent.horizontalCenter Control.Control { id: headerMessage - property int topMargin: mainItem.contentHeight > mainItem.height ? Math.round(30 * DefaultStyle.dp) : Math.round(50 * DefaultStyle.dp) - property int bottomMargin: Math.round(30 * DefaultStyle.dp) + property int topMargin: Utils.getSizeWithScreenRatio(mainItem.contentHeight > mainItem.height ? 30 : 50) + property int bottomMargin: Utils.getSizeWithScreenRatio(30) anchors.topMargin: topMargin anchors.bottomMargin: bottomMargin anchors.top: parent.top - padding: Math.round(10 * DefaultStyle.dp) + padding: Utils.getSizeWithScreenRatio(10) background: Rectangle { color: "transparent" border.color: DefaultStyle.main2_200 - border.width: Math.round(2 * DefaultStyle.dp) - radius: Math.round(10 * DefaultStyle.dp) + border.width: Utils.getSizeWithScreenRatio(2) + radius: Utils.getSizeWithScreenRatio(10) } contentItem: RowLayout { EffectImage { - Layout.preferredWidth: Math.round(23 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(23 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(23) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(23) imageSource: mainItem.isEncrypted ? AppIcons.lockSimple : AppIcons.lockSimpleOpen colorizationColor: mainItem.isEncrypted ? DefaultStyle.info_500_main : DefaultStyle.warning_700 } ColumnLayout { - spacing: Math.round(2 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(2) Text { text: mainItem.isEncrypted //: End to end encrypted chat @@ -192,8 +193,8 @@ ListView { width: mainItem.width // height: visible ? contentItem.implicitHeight + topPadding + bottomPadding : 0 z: mainItem.z + 2 - topPadding: Math.round(5 * DefaultStyle.dp) - bottomPadding: Math.round(5 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(5) + bottomPadding: Utils.getSizeWithScreenRatio(5) background: Rectangle { anchors.fill: parent color: mainItem.backgroundColor @@ -202,8 +203,8 @@ ListView { id: composeLayout property var composingName: mainItem.chat?.core.composingName Avatar { - Layout.preferredWidth: Math.round(20 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(20 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) _address: mainItem.chat?.core.composingAddress } Text { @@ -303,11 +304,11 @@ ListView { } property bool showTopMargin: !header.visible && index == 0 width: mainItem.width - height: (showTopMargin ? 30 * DefaultStyle.dp : 0) + eventItem.implicitHeight + height: (showTopMargin ? Utils.getSizeWithScreenRatio(30) : 0) + eventItem.implicitHeight Event { id: eventItem anchors.top: parent.top - anchors.topMargin: showTopMargin ? 30 : 0 * DefaultStyle.dp + anchors.topMargin: showTopMargin ? Utils.getSizeWithScreenRatio(30) : 0 width: parent.width eventLogGui: modelData } @@ -328,12 +329,12 @@ ListView { } property bool showTopMargin: !header.visible && index == 0 width: mainItem.width - //height: 40 * DefaultStyle.dp - height: (showTopMargin ? 30 : 0 * DefaultStyle.dp) + ephemeralEventItem.height + //height: Utils.getSizeWithScreenRatio(40) + height: (showTopMargin ? Utils.getSizeWithScreenRatio(30) : 0) + ephemeralEventItem.height EphemeralEvent { id: ephemeralEventItem anchors.top: parent.top - anchors.topMargin: showTopMargin ? 30 : 0 * DefaultStyle.dp + anchors.topMargin: showTopMargin ? Utils.getSizeWithScreenRatio(30) : 0 eventLogGui: modelData } } diff --git a/Linphone/view/Control/Display/Chat/Emoji/EmojiPicker.qml b/Linphone/view/Control/Display/Chat/Emoji/EmojiPicker.qml index 8b6b96808..16566de16 100644 --- a/Linphone/view/Control/Display/Chat/Emoji/EmojiPicker.qml +++ b/Linphone/view/Control/Display/Chat/Emoji/EmojiPicker.qml @@ -64,23 +64,23 @@ ColumnLayout { } RowLayout { id: categoriesRow - Layout.preferredWidth: parent.width - Math.round(15 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(35 * DefaultStyle.dp) - Layout.leftMargin: Math.round(5 * DefaultStyle.dp) + Layout.preferredWidth: parent.width - Utils.getSizeWithScreenRatio(15) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(35) + Layout.leftMargin: Utils.getSizeWithScreenRatio(5) Layout.alignment: Qt.AlignCenter - spacing: searchField.widthSize > 0 ? Math.round(7 * DefaultStyle.dp) : Math.round(17 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(searchField.widthSize > 0 ? 7 : 17) clip: true Image { id: searchIcon source: "image://emoji/icons/search.svg" - sourceSize: Qt.size(Math.round(21 * DefaultStyle.dp), Math.round(21 * DefaultStyle.dp)) + sourceSize: Qt.size(Utils.getSizeWithScreenRatio(21),Utils.getSizeWithScreenRatio(21)) visible: !mainItem.searchMode MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: { mainItem.searchMode = true - searchField.widthSize = categoriesRow.width - Math.round(25 * DefaultStyle.dp) + searchField.widthSize = categoriesRow.width - Utils.getSizeWithScreenRatio(25) list.model = 1 searchField.focus = true } @@ -89,7 +89,7 @@ ColumnLayout { Image { id: closeIcon source: "image://emoji/icons/close.svg" - sourceSize: Qt.size(Math.round(21 * DefaultStyle.dp), Math.round(21 * DefaultStyle.dp)) + sourceSize: Qt.size(Utils.getSizeWithScreenRatio(21),Utils.getSizeWithScreenRatio(21)) visible: mainItem.searchMode MouseArea { anchors.fill: parent @@ -106,7 +106,7 @@ ColumnLayout { id: searchField property int widthSize: 0 Layout.preferredWidth: widthSize - Layout.preferredHeight: Math.round(28 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) visible: widthSize > 0 ? true : false placeholderText: 'Search Emoji' Behavior on widthSize { @@ -115,7 +115,7 @@ ColumnLayout { } } background: Rectangle { - radius: Math.round(10 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(10) border.color: DefaultStyle.main1_500_main } onTextChanged: { @@ -134,7 +134,7 @@ ColumnLayout { delegate: Image { id: icon source: "image://emoji/icons/" + cateIcons.blackSvg[index] - sourceSize: Qt.size(Math.round(20 * DefaultStyle.dp), Math.round(20 * DefaultStyle.dp)) + sourceSize: Qt.size(Utils.getSizeWithScreenRatio(20),Utils.getSizeWithScreenRatio(20)) MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor @@ -156,46 +156,46 @@ ColumnLayout { ListView { id: list width: mainItem.width - height: Math.round(250 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(250) Layout.fillWidth: true Layout.fillHeight: true model: mainItem.categories - spacing: Math.round(30 * DefaultStyle.dp) - topMargin: Math.round(7 * DefaultStyle.dp) - bottomMargin: Math.round(7 * DefaultStyle.dp) - leftMargin: Math.round(12 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(30) + topMargin: Utils.getSizeWithScreenRatio(7) + bottomMargin: Utils.getSizeWithScreenRatio(7) + leftMargin: Utils.getSizeWithScreenRatio(12) clip: true delegate: GridLayout { id: grid property string category: mainItem.searchMode ? 'Search Result' : modelData - property int columnCount: Math.round(list.width / 50 * DefaultStyle.dp) + property int columnCount: Math.round(list.width / Utils.getSizeWithScreenRatio(50)) property int sc: grid.category === 'People & Body' ? mainItem.skinColor : -1 columns: columnCount width: list.width - columnSpacing: Math.round(5 * DefaultStyle.dp) + columnSpacing: Utils.getSizeWithScreenRatio(5) Text { Layout.fillWidth: true - Layout.preferredHeight: Math.round(20 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) text: grid.category color: Qt.rgba(0, 0, 0, 0.5) - font.pixelSize: Math.round(15 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(15) horizontalAlignment: Text.AlignLeft - leftPadding: Math.round(6 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(6) Layout.columnSpan: grid.columnCount != 0 ? grid.columnCount : 1 - Layout.bottomMargin: Math.round(8 * DefaultStyle.dp) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(8) } Repeater { model: mainItem.searchMode ? mainItem.searchModel : mainItem.model.count(grid.category) delegate: Rectangle { property alias es: emojiSvg - Layout.preferredWidth: Math.round(40 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(40 * DefaultStyle.dp) - radius: Math.round(40 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(40) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(40) + radius: Utils.getSizeWithScreenRatio(40) color: mouseArea.containsMouse ? '#e6e6e6' : '#ffffff' Image { id: emojiSvg source: mainItem.searchMode ? path : mainItem.model.path(grid.category, index, grid.sc) - sourceSize: Qt.size(Math.round(30 * DefaultStyle.dp), Math.round(30 * DefaultStyle.dp)) + sourceSize: Qt.size(Utils.getSizeWithScreenRatio(30),Utils.getSizeWithScreenRatio(30)) anchors.centerIn: parent asynchronous: true } @@ -224,7 +224,7 @@ ColumnLayout { } } RowLayout { - Layout.preferredHeight: Math.round(35 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(35) Layout.alignment: Qt.AlignCenter spacing: 10 Repeater { @@ -234,10 +234,10 @@ ColumnLayout { model: 6 delegate: Rectangle { id: colorRect - Layout.preferredWidth: Math.round(30 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(30 * DefaultStyle.dp) - Layout.bottomMargin: Math.round(3 * DefaultStyle.dp) - radius: Math.round(30 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(3) + radius: Utils.getSizeWithScreenRatio(30) scale: 0.65 color: skinColors.colors[index] Behavior on scale { diff --git a/Linphone/view/Control/Display/Chat/EphemeralEvent.qml b/Linphone/view/Control/Display/Chat/EphemeralEvent.qml index 461647841..9bec8bec7 100644 --- a/Linphone/view/Control/Display/Chat/EphemeralEvent.qml +++ b/Linphone/view/Control/Display/Chat/EphemeralEvent.qml @@ -2,24 +2,25 @@ import QtQuick import QtQuick.Layouts import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Rectangle { anchors.centerIn: parent property EventLogGui eventLogGui property var eventLogCore: eventLogGui.core visible: eventLogCore.handled - height: row.height + 15 * DefaultStyle.dp - width: row.width + 15 * DefaultStyle.dp - radius: 10 * DefaultStyle.dp - border.width: 2 * DefaultStyle.dp + height: row.height + Utils.getSizeWithScreenRatio(15) + width: row.width + Utils.getSizeWithScreenRatio(15) + radius: Utils.getSizeWithScreenRatio(10) + border.width: Utils.getSizeWithScreenRatio(2) border.color: DefaultStyle.main2_200 color: "transparent" RowLayout { id: row anchors.centerIn: parent EffectImage { - Layout.preferredWidth: visible ? 20 * DefaultStyle.dp : 0 - Layout.preferredHeight: 20 * DefaultStyle.dp + Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(20) : 0 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) colorizationColor: DefaultStyle.main2_400 imageSource: AppIcons.clockCountDown Layout.alignment: Qt.AlignHCenter diff --git a/Linphone/view/Control/Display/Chat/Event.qml b/Linphone/view/Control/Display/Chat/Event.qml index 801f37a4f..eaa131149 100644 --- a/Linphone/view/Control/Display/Chat/Event.qml +++ b/Linphone/view/Control/Display/Chat/Event.qml @@ -2,10 +2,11 @@ import QtQuick import QtQuick.Layouts import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils RowLayout { id: mainLayout - height: 40 * DefaultStyle.dp + height: Utils.getSizeWithScreenRatio(40) visible: eventLogCore.handled property EventLogGui eventLogGui property var eventLogCore: eventLogGui.core @@ -17,8 +18,8 @@ RowLayout { } ColumnLayout { - Layout.rightMargin: 20 * DefaultStyle.dp - Layout.leftMargin: 20 * DefaultStyle.dp + Layout.rightMargin: Utils.getSizeWithScreenRatio(20) + Layout.leftMargin: Utils.getSizeWithScreenRatio(20) Layout.alignment: Qt.AlignVCenter Text { diff --git a/Linphone/view/Control/Display/Chat/FileView.qml b/Linphone/view/Control/Display/Chat/FileView.qml index 1db5ed529..f95a9b139 100644 --- a/Linphone/view/Control/Display/Chat/FileView.qml +++ b/Linphone/view/Control/Display/Chat/FileView.qml @@ -116,8 +116,8 @@ Item { EffectImage { anchors.centerIn: parent visible: videoThumbnail.playbackState !== MediaPlayer.PlayingState - width: Math.round(24 * DefaultStyle.dp) - height: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(24) + height: Utils.getSizeWithScreenRatio(24) imageSource: AppIcons.playFill colorizationColor: DefaultStyle.main2_0 } @@ -126,8 +126,8 @@ Item { property int timeDisplayed: videoThumbnail.playbackState === MediaPlayer.PlayingState ? videoThumbnail.position : videoThumbnail.duration anchors.bottom: parent.bottom anchors.left: parent.left - anchors.bottomMargin: Math.round(6 * DefaultStyle.dp) - anchors.leftMargin: Math.round(6 * DefaultStyle.dp) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(6) + anchors.leftMargin: Utils.getSizeWithScreenRatio(6) text: UtilsCpp.formatDuration(timeDisplayed) color: DefaultStyle.grey_0 font { @@ -156,10 +156,10 @@ Item { Component { id: defaultSquareView Control.Control { - leftPadding: Math.round(4 * DefaultStyle.dp) - rightPadding: Math.round(4 * DefaultStyle.dp) - topPadding: Math.round(23 * DefaultStyle.dp) - bottomPadding: Math.round(4 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(4) + rightPadding: Utils.getSizeWithScreenRatio(4) + topPadding: Utils.getSizeWithScreenRatio(23) + bottomPadding: Utils.getSizeWithScreenRatio(4) hoverEnabled: false background: Rectangle { @@ -172,12 +172,12 @@ Item { anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - height: Math.round(23 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(23) EffectImage { anchors.centerIn: parent imageSource: mainItem.imageSource - imageWidth: Math.round(14 * DefaultStyle.dp) - imageHeight: Math.round(14 * DefaultStyle.dp) + imageWidth: Utils.getSizeWithScreenRatio(14) + imageHeight: Utils.getSizeWithScreenRatio(14) colorizationColor: DefaultStyle.main2_600 } } @@ -234,8 +234,8 @@ Item { visible: thumbnailProvider.state === 'hovered' && mainItem.contentGui && (/*!mainItem.isOutgoing &&*/ !mainItem.contentGui.core.wasDownloaded) anchors.centerIn: parent imageSource: AppIcons.download - width: Math.round(24 * DefaultStyle.dp) - height: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(24) + height: Utils.getSizeWithScreenRatio(24) colorizationColor: DefaultStyle.main2_600 } } @@ -244,20 +244,20 @@ Item { Component { id: defaultView Control.Control { - rightPadding: Math.round(17*DefaultStyle.dp) + rightPadding: Utils.getSizeWithScreenRatio(17) background: Rectangle { id: bg color: DefaultStyle.grey_100 width: mainItem.width height: mainItem.height - radius: Math.round(10 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(10) } contentItem: RowLayout { - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) Rectangle { color: DefaultStyle.main2_200 - width: Math.round(58 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(58) height: bg.height radius: bg.radius Rectangle { @@ -272,13 +272,13 @@ Item { z: parent.z + 1 anchors.centerIn: parent imageSource: defaultViewStack.imageSource - width: Math.round(22 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(22) height: width colorizationColor: DefaultStyle.main2_600 } } ColumnLayout { - spacing: Math.round(1 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(1) Text { text: mainItem.name Layout.fillWidth: true diff --git a/Linphone/view/Control/Display/Chat/VideoFileView.qml b/Linphone/view/Control/Display/Chat/VideoFileView.qml index b3add571b..00621baf8 100644 --- a/Linphone/view/Control/Display/Chat/VideoFileView.qml +++ b/Linphone/view/Control/Display/Chat/VideoFileView.qml @@ -40,8 +40,8 @@ Rectangle { property int timeDisplayed: mediaPlayer.playbackState === MediaPlayer.PlayingState ? mediaPlayer.position : mediaPlayer.duration anchors.bottom: parent.bottom anchors.left: parent.left - anchors.bottomMargin: Math.round(6 * DefaultStyle.dp) - anchors.leftMargin: Math.round(6 * DefaultStyle.dp) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(6) + anchors.leftMargin: Utils.getSizeWithScreenRatio(6) text: UtilsCpp.formatDuration(timeDisplayed) color: DefaultStyle.grey_0 font { @@ -64,8 +64,8 @@ Rectangle { EffectImage { anchors.centerIn: parent visible: mediaPlayer.playbackState !== MediaPlayer.PlayingState - width: Math.round(24 * DefaultStyle.dp) - height: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(24) + height: Utils.getSizeWithScreenRatio(24) imageSource: AppIcons.playFill colorizationColor: DefaultStyle.main2_0 } diff --git a/Linphone/view/Control/Display/Contact/AllContactListView.qml b/Linphone/view/Control/Display/Contact/AllContactListView.qml index ac0291e0a..7c6b7d43c 100644 --- a/Linphone/view/Control/Display/Contact/AllContactListView.qml +++ b/Linphone/view/Control/Display/Contact/AllContactListView.qml @@ -46,10 +46,10 @@ Flickable { property bool haveContacts: count > 0 property real sectionsPixelSize: Typography.h4.pixelSize property real sectionsWeight: Typography.h4.weight - property real sectionsSpacing: Math.round(18 * DefaultStyle.dp) - property real busyIndicatorSize: Math.round(60 * DefaultStyle.dp) + property real sectionsSpacing: Utils.getSizeWithScreenRatio(18) + property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) - property real itemsRightMargin: Math.round(39 * DefaultStyle.dp) + property real itemsRightMargin: Utils.getSizeWithScreenRatio(39) property int count: contactsList.count + suggestionsList.count + favoritesList.count contentHeight: contentsLayout.height @@ -233,7 +233,7 @@ Flickable { Control.ScrollBar.vertical: ScrollBar { id: scrollbar z: 1 - topPadding: Math.round(24 * DefaultStyle.dp) // Avoid to be on top of collapse button + topPadding: Utils.getSizeWithScreenRatio(24) // Avoid to be on top of collapse button active: true interactive: true visible: mainItem.contentHeight > mainItem.height @@ -243,7 +243,7 @@ Flickable { ColumnLayout { id: contentsLayout width: mainItem.width - spacing: 0 //Math.round(20 * DefaultStyle.dp) + spacing: 0 BusyIndicator { id: busyIndicator @@ -307,7 +307,7 @@ Flickable { visible: contentHeight > 0 Layout.fillWidth: true Layout.preferredHeight: implicitHeight - Layout.topMargin: favoritesList.height > 0 ? Math.round(4 * DefaultStyle.dp) : 0 + Layout.topMargin: favoritesList.height > 0 ? Utils.getSizeWithScreenRatio(4) : 0 interactive: false highlightText: mainItem.highlightText showActions: mainItem.showActions @@ -345,13 +345,11 @@ Flickable { | (mainItem.searchText != '*' && mainItem.searchText != '' || SettingsCpp.syncLdapContacts ? MagicSearchProxy.FilteringTypes.Ldap | MagicSearchProxy.FilteringTypes.CardDAV : 0) - initialDisplayItems: Math.max( - 20, - 2 * mainItem.height / (Math.round(63 * DefaultStyle.dp))) + initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(63))) displayItemsStep: 3 * initialDisplayItems / 2 - onLocalFriendCreated: index => { - contactsList.selectIndex(index) - } + onLocalFriendCreated: (index) => { + contactsList.selectIndex(index) + } } } ContactListView { @@ -359,8 +357,7 @@ Flickable { visible: contentHeight > 0 Layout.fillWidth: true Layout.preferredHeight: implicitHeight - Layout.topMargin: contactsList.height + favoritesList.height - > 0 ? Math.round(4 * DefaultStyle.dp) : 0 + Layout.topMargin: (contactsList.height + favoritesList.height) > 0 ? Utils.getSizeWithScreenRatio(4) : 0 interactive: false showInitials: false highlightText: mainItem.highlightText @@ -395,11 +392,9 @@ Flickable { id: suggestionsProxy parentProxy: mainItem.mainModel filterType: mainItem.hideSuggestions ? MagicSearchProxy.FilteringTypes.None : MagicSearchProxy.FilteringTypes.Other - initialDisplayItems: contactsProxy.haveMore - && contactsList.expanded ? 0 : Math.max( - 20, - 2 * mainItem.height - / (Math.round(63 * DefaultStyle.dp))) + initialDisplayItems: contactsProxy.haveMore && contactsList.expanded + ? 0 + : Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(63))) onInitialDisplayItemsChanged: maxDisplayItems = initialDisplayItems displayItemsStep: 3 * initialDisplayItems / 2 onModelReset: maxDisplayItems = initialDisplayItems diff --git a/Linphone/view/Control/Display/Contact/Avatar.qml b/Linphone/view/Control/Display/Contact/Avatar.qml index 303a60c5b..6dc981534 100644 --- a/Linphone/view/Control/Display/Contact/Avatar.qml +++ b/Linphone/view/Control/Display/Contact/Avatar.qml @@ -6,6 +6,7 @@ import QtQuick.Effects import Linphone import UtilsCpp import SettingsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // Fill contact, account or call // Initials will be displayed if there isn't any avatar. @@ -93,7 +94,7 @@ Loader{ z: 1 color: "transparent" border { - width: Math.round(2 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(2) color: mainItem.secured ? DefaultStyle.info_500_main : DefaultStyle.danger_500_main } EffectImage { diff --git a/Linphone/view/Control/Display/Contact/Contact.qml b/Linphone/view/Control/Display/Contact/Contact.qml index 21e36cba8..0b6ee84a9 100644 --- a/Linphone/view/Control/Display/Contact/Contact.qml +++ b/Linphone/view/Control/Display/Contact/Contact.qml @@ -120,8 +120,8 @@ Control.Control{ color: DefaultStyle.grey_0 minimumPixelSize: 5 fontSizeMode: Text.Fit - font.pixelSize: Math.round(11 * DefaultStyle.dp) - font.weight: Math.round(700 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(11) + font.weight: Utils.getSizeWithScreenRatio(700) text: mainItem.account.core.unreadNotifications >= 100 ? '99+' : mainItem.account.core.unreadNotifications } } diff --git a/Linphone/view/Control/Display/Contact/ContactListItem.qml b/Linphone/view/Control/Display/Contact/ContactListItem.qml index 3e39f6730..c9ffc5dba 100644 --- a/Linphone/view/Control/Display/Contact/ContactListItem.qml +++ b/Linphone/view/Control/Display/Contact/ContactListItem.qml @@ -7,10 +7,11 @@ import UtilsCpp 1.0 import ConstantsCpp import SettingsCpp import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils FocusScope { id: mainItem - implicitHeight: visible ? Math.round(56 * DefaultStyle.dp) : 0 + implicitHeight: visible ? Utils.getSizeWithScreenRatio(56) : 0 property var searchResultItem property bool showInitials: true // Display Initials of Display name. property bool showDefaultAddress: true // Display address below display name. @@ -32,7 +33,7 @@ FocusScope { property var previousInitial // Use directly previous initial - property real itemsRightMargin: Math.round(39 * DefaultStyle.dp) + property real itemsRightMargin: Utils.getSizeWithScreenRatio(39) property var displayName: searchResultItem? searchResultItem.core.fullName : "" property var initial: displayName != "" ? displayName[0].toLocaleLowerCase(ConstantsCpp.DefaultLocale) : '' @@ -48,15 +49,15 @@ FocusScope { anchors.left: parent.left visible: mainItem.showInitials anchors.verticalCenter: parent.verticalCenter - anchors.rightMargin: Math.round(15 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(15) verticalAlignment: Text.AlignVCenter - width: Math.round(20 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(20) opacity: previousInitial != mainItem.initial ? 1 : 0 text: mainItem.initial || "" color: DefaultStyle.main2_400 font { - pixelSize: Math.round(20 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Utils.getSizeWithScreenRatio(500) capitalization: Font.AllUppercase } } @@ -67,12 +68,12 @@ FocusScope { anchors.rightMargin: mainItem.itemsRightMargin anchors.top: parent.top anchors.bottom: parent.bottom - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) z: contactArea.z + 1 Avatar { - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) - Layout.leftMargin: Math.round(5 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + Layout.leftMargin: Utils.getSizeWithScreenRatio(5) contact: searchResultItem shadowEnabled: false } @@ -93,7 +94,7 @@ FocusScope { maximumLineCount: 1 } Text { - Layout.topMargin: Math.round(2 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(2) Layout.fillWidth: true Layout.preferredHeight: visible ? implicitHeight: 0 visible: mainItem.showDefaultAddress @@ -104,8 +105,8 @@ FocusScope { maximumLineCount: 1 elide: Text.ElideRight font { - weight: Math.round(300 * DefaultStyle.dp) - pixelSize: Math.round(12 * DefaultStyle.dp) + weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(12) } } } @@ -116,31 +117,31 @@ FocusScope { id: actionsRow z: contactArea.z + 1 visible: mainItem.showActions || actionButtons.visible || mainItem.showContactMenu || mainItem.multiSelectionEnabled - spacing: visible ? Math.round(16 * DefaultStyle.dp) : 0 + spacing: visible ? Utils.getSizeWithScreenRatio(16) : 0 enabled: visible - Layout.rightMargin: Math.round(5 * DefaultStyle.dp) + Layout.rightMargin: Utils.getSizeWithScreenRatio(5) EffectImage { id: isSelectedCheck visible: mainItem.multiSelectionEnabled && (mainItem.selectedContacts.indexOf(mainItem.addressFromFilter) != -1) - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) imageSource: AppIcons.check colorizationColor: DefaultStyle.main1_500_main } RowLayout { id: actionButtons visible: mainItem.showActions - spacing: visible ? Math.round(10 * DefaultStyle.dp) : 0 + spacing: visible ? Utils.getSizeWithScreenRatio(10) : 0 IconButton { id: callButton - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) icon.source: AppIcons.phone focus: visible - radius: Math.round(40 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(40) style: ButtonStyle.grey onClicked: UtilsCpp.createCall(mainItem.addressFromFilter) KeyNavigation.left: chatButton @@ -149,13 +150,13 @@ FocusScope { IconButton { id: videoCallButton visible: SettingsCpp.videoEnabled - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) icon.source: AppIcons.videoCamera focus: visible && !callButton.visible - radius: Math.round(40 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(40) style: ButtonStyle.grey onClicked: UtilsCpp.createCall(mainItem.addressFromFilter, {"localVideoEnabled": true}) KeyNavigation.left: callButton @@ -165,14 +166,14 @@ FocusScope { id: chatButton visible: actionButtons.visible && !SettingsCpp.disableChatFeature - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) icon.source: AppIcons.chatTeardropText focus: visible && !callButton.visible && !videoCallButton.visible - radius: Math.round(40 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(40) style: ButtonStyle.grey KeyNavigation.left: videoCallButton KeyNavigation.right: callButton @@ -186,7 +187,7 @@ FocusScope { id: friendPopup z: contactArea.z + 1 popup.x: 0 - popup.padding: Math.round(10 * DefaultStyle.dp) + popup.padding: Utils.getSizeWithScreenRatio(10) visible: mainItem.showContactMenu && (contactArea.containsMouse || mainItem.isLastHovered || hovered || popup.opened) enabled: visible @@ -200,7 +201,7 @@ FocusScope { //: "Ajouter aux favoris" : qsTr("contact_details_add_to_favourites") icon.source: searchResultItem.core.starred ? AppIcons.heartFill : AppIcons.heart - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) textColor: DefaultStyle.main2_500_main hoveredImageColor: searchResultItem.core.starred ? DefaultStyle.main1_700 : DefaultStyle.danger_700 contentImageColor: searchResultItem.core.starred ? DefaultStyle.danger_500_main : DefaultStyle.main2_600 @@ -215,7 +216,7 @@ FocusScope { text: qsTr("Partager") Layout.fillWidth: true icon.source: AppIcons.shareNetwork - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) textColor: DefaultStyle.main2_500_main onClicked: { var vcard = searchResultItem.core.getVCard() @@ -243,7 +244,7 @@ FocusScope { //: "Supprimer" text: qsTr("contact_details_delete") icon.source: AppIcons.trashCan - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) visible: searchResultItem && searchResultItem.core.isStored && !searchResultItem.core.readOnly Layout.fillWidth: true onClicked: { @@ -269,7 +270,7 @@ FocusScope { } Rectangle { anchors.fill: contactArea - radius: Math.round(8 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(8) opacity: 0.7 color: mainItem.isSelected ? DefaultStyle.main2_200 : DefaultStyle.main2_100 visible: mainItem.isLastHovered || mainItem.isSelected || friendPopup.hovered diff --git a/Linphone/view/Control/Display/Contact/ContactStatusPopup.qml b/Linphone/view/Control/Display/Contact/ContactStatusPopup.qml index bf640f654..a095e1089 100644 --- a/Linphone/view/Control/Display/Contact/ContactStatusPopup.qml +++ b/Linphone/view/Control/Display/Contact/ContactStatusPopup.qml @@ -63,18 +63,18 @@ PopupButton { colorizationColor: DefaultStyle.main2_600 Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) - Layout.rightMargin: 8 * DefaultStyle.dp + Layout.rightMargin: Utils.getSizeWithScreenRatio(8) } } } popup.contentItem: Rectangle { implicitWidth: Utils.getSizeWithScreenRatio(280) - implicitHeight: 20 * DefaultStyle.dp + (setCustomStatus.visible ? 240 * DefaultStyle.dp : setPresence.implicitHeight) + implicitHeight: Utils.getSizeWithScreenRatio(20) + (setCustomStatus.visible ? Utils.getSizeWithScreenRatio(240) : setPresence.implicitHeight) Presence { id: setPresence visible: !presenceAndRegistrationItem.editCustomStatus anchors.fill: parent - anchors.margins: 20 * DefaultStyle.dp + anchors.margins: Utils.getSizeWithScreenRatio(20) accountCore: mainItem.account.core onSetCustomStatusClicked: { presenceAndRegistrationItem.editCustomStatus = true @@ -85,7 +85,7 @@ PopupButton { id: setCustomStatus visible: presenceAndRegistrationItem.editCustomStatus anchors.fill: parent - anchors.margins: 20 * DefaultStyle.dp + anchors.margins: Utils.getSizeWithScreenRatio(20) accountCore: mainItem.account.core onVisibleChanged: { if (!visible) { diff --git a/Linphone/view/Control/Display/Contact/PresenceSetCustomStatus.qml b/Linphone/view/Control/Display/Contact/PresenceSetCustomStatus.qml index 8b7cfa851..8d14de162 100644 --- a/Linphone/view/Control/Display/Contact/PresenceSetCustomStatus.qml +++ b/Linphone/view/Control/Display/Contact/PresenceSetCustomStatus.qml @@ -4,10 +4,11 @@ import QtQuick.Layouts import Linphone import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Column { id: mainItem - spacing: 20 * DefaultStyle.dp + spacing: Utils.getSizeWithScreenRatio(20) anchors.centerIn: parent property var accountCore signal isSet @@ -21,15 +22,15 @@ Column { Rectangle { width: parent.width - height: 150 * DefaultStyle.dp + height: Utils.getSizeWithScreenRatio(150) color: "transparent" border.color: DefaultStyle.main1_500_main - border.width: 1 * DefaultStyle.dp - radius: 8 * DefaultStyle.dp + border.width: Utils.getSizeWithScreenRatio(1) + radius: Utils.getSizeWithScreenRatio(8) ColumnLayout { anchors.fill: parent - anchors.margins: 10 * DefaultStyle.dp + anchors.margins: Utils.getSizeWithScreenRatio(10) TextEdit { id: statusMessage wrapMode: TextEdit.Wrap @@ -62,7 +63,7 @@ Column { } Row { - spacing: 10 * DefaultStyle.dp + spacing: Utils.getSizeWithScreenRatio(10) anchors.right: parent.right SmallButton { diff --git a/Linphone/view/Control/Display/Contact/Voicemail.qml b/Linphone/view/Control/Display/Contact/Voicemail.qml index df30c7be1..aba4fe242 100644 --- a/Linphone/view/Control/Display/Contact/Voicemail.qml +++ b/Linphone/view/Control/Display/Contact/Voicemail.qml @@ -5,13 +5,14 @@ import QtQuick.Controls.Basic import Linphone import UtilsCpp import SettingsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Rectangle{ id: mainItem property int voicemailCount: 0 property bool showMwi: false - width: Math.round(42 * DefaultStyle.dp) * scaleFactor - height: Math.round(36 * DefaultStyle.dp) * scaleFactor + width: Utils.getSizeWithScreenRatio(42 * scaleFactor) + height: Utils.getSizeWithScreenRatio(36 * scaleFactor) property real scaleFactor: 1.0 signal clicked() color: 'transparent' @@ -20,7 +21,7 @@ Rectangle{ anchors.left: parent.left icon.source: AppIcons.voicemail icon.color: DefaultStyle.main2_600 - width: Math.round(33 * DefaultStyle.dp) * scaleFactor + width: Utils.getSizeWithScreenRatio(33 * scaleFactor) height: width icon.width: width icon.height: width @@ -35,7 +36,7 @@ Rectangle{ Text { anchors.top: parent.top anchors.right: parent.right - width: Math.round(14 * DefaultStyle.dp) * scaleFactor + width: Utils.getSizeWithScreenRatio(14 * scaleFactor) height: width horizontalAlignment: Text.AlignHCenter font.weight: Typography.p2.weight @@ -51,12 +52,12 @@ Rectangle{ anchors.right: parent.right color: DefaultStyle.danger_500_main visible: showMwi && voicemailCount == 0 - width: Math.round(14 * DefaultStyle.dp) * scaleFactor + width: Utils.getSizeWithScreenRatio(14 * scaleFactor) height: width radius: width / 2 EffectImage { anchors.fill: parent - anchors.margins: Math.round(1.5 * DefaultStyle.dp) * scaleFactor + anchors.margins: Utils.getSizeWithScreenRatio(1.5 * scaleFactor) imageSource: AppIcons.bell colorizationColor: DefaultStyle.grey_0 } diff --git a/Linphone/view/Control/Display/GradientRectangle.qml b/Linphone/view/Control/Display/GradientRectangle.qml index 7771afe00..80dc08882 100644 --- a/Linphone/view/Control/Display/GradientRectangle.qml +++ b/Linphone/view/Control/Display/GradientRectangle.qml @@ -1,9 +1,10 @@ import QtQuick import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Item { id: mainItem - property real borderWidth: Math.max(Math.round(1 * DefaultStyle.dp), 1) + property real borderWidth: Utils.getSizeWithScreenRatio(1) property alias borderGradient: border.gradient property alias gradient: fill.gradient property alias color: fill.color diff --git a/Linphone/view/Control/Display/MediaProgressBar.qml b/Linphone/view/Control/Display/MediaProgressBar.qml index 852821e05..f87a9133f 100644 --- a/Linphone/view/Control/Display/MediaProgressBar.qml +++ b/Linphone/view/Control/Display/MediaProgressBar.qml @@ -9,6 +9,7 @@ import Linphone import UtilsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= @@ -74,7 +75,7 @@ ProgressBar { GradientStop { position: 0.0; color: "#FF9E79" } GradientStop { position: 1.0; color: "#FE5E00" } } - radius: Math.round(70 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(70) } Rectangle { id: mask @@ -115,10 +116,10 @@ ProgressBar { RoundButton { z: parent.z + 1 anchors.left: parent.left - anchors.leftMargin: Math.round(9 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(9) anchors.verticalCenter: parent.verticalCenter - icon.width: Math.round(14 * DefaultStyle.dp) - icon.height: Math.round(14 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(14) + icon.height: Utils.getSizeWithScreenRatio(14) icon.source: animationTest.running ? mainItem.recording ? AppIcons.stopFill @@ -131,25 +132,25 @@ ProgressBar { } Control.Control { anchors.right: parent.right - anchors.rightMargin: Math.round(9 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(9) anchors.verticalCenter: parent.verticalCenter - leftPadding: Math.round(18 * DefaultStyle.dp) - rightPadding: Math.round(18 * DefaultStyle.dp) - topPadding: Math.round(5 * DefaultStyle.dp) - bottomPadding: Math.round(5 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(18) + rightPadding: Utils.getSizeWithScreenRatio(18) + topPadding: Utils.getSizeWithScreenRatio(5) + bottomPadding: Utils.getSizeWithScreenRatio(5) background: Rectangle { anchors.fill: parent color: DefaultStyle.grey_0 - radius: Math.round(50 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(50) } contentItem: RowLayout { - spacing: mainItem.recording ? Math.round(5 * DefaultStyle.dp) : 0 + spacing: mainItem.recording ? Utils.getSizeWithScreenRatio(5) : 0 EffectImage { visible: mainItem.recording colorizationColor: DefaultStyle.danger_500_main imageSource: AppIcons.recordFill - Layout.preferredWidth: Math.round(14 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(14 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) } Text { id: durationText diff --git a/Linphone/view/Control/Display/Meeting/MeetingListView.qml b/Linphone/view/Control/Display/Meeting/MeetingListView.qml index c599ad607..cf6ad3d26 100644 --- a/Linphone/view/Control/Display/Meeting/MeetingListView.qml +++ b/Linphone/view/Control/Display/Meeting/MeetingListView.qml @@ -18,12 +18,12 @@ ListView { property ConferenceInfoGui selectedConference property bool _moveToIndex: false property bool loading: false - property real busyIndicatorSize: Math.round(60 * DefaultStyle.dp) + property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) clip: true cacheBuffer: height/2 - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) highlightFollowsCurrentItem: false signal meetingDeletionRequested(ConferenceInfoGui confInfo, bool canCancel) @@ -93,13 +93,13 @@ ListView { } // Let some space for better UI - footer: Item{height: Math.round(38 * DefaultStyle.dp)} + footer: Item{height: Utils.getSizeWithScreenRatio(38)} model: ConferenceInfoProxy { id: confInfoProxy filterText: searchBarText filterType: ConferenceInfoProxy.None - initialDisplayItems: Math.max(20, 2 * mainItem.height / (Math.round(63 * DefaultStyle.dp))) + initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(63))) displayItemsStep: initialDisplayItems/2 Component.onCompleted: { mainItem.loading = !confInfoProxy.accountConnected @@ -137,7 +137,7 @@ ListView { ScrollBar.vertical: ScrollBar { id: scrollbar - rightPadding: Math.round(8 * DefaultStyle.dp) + rightPadding: Utils.getSizeWithScreenRatio(8) active: true interactive: true @@ -147,14 +147,14 @@ ListView { section { criteria: ViewSection.FullString delegate: Text { - topPadding: Math.round(24 * DefaultStyle.dp) - bottomPadding: Math.round(16 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(24) + bottomPadding: Utils.getSizeWithScreenRatio(16) text: section - height: Math.round(29 * DefaultStyle.dp) + topPadding + bottomPadding + height: Utils.getSizeWithScreenRatio(29) + topPadding + bottomPadding wrapMode: Text.NoWrap font { - pixelSize: Math.round(20 * DefaultStyle.dp) - weight: Math.round(800 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Utils.getSizeWithScreenRatio(800) capitalization: Font.Capitalize } } @@ -164,7 +164,7 @@ ListView { delegate: FocusScope { id: itemDelegate visible: !mainItem.loading - height: Math.round(63 * DefaultStyle.dp) + (!isFirst && dateDay.visible ? topOffset : 0) + height: Utils.getSizeWithScreenRatio(63) + (!isFirst && dateDay.visible ? topOffset : 0) width: mainItem.width enabled: haveModel @@ -176,7 +176,7 @@ ListView { property string dateString: UtilsCpp.toDateString(dateTime) property string previousDateString: previousConfInfoGui ? UtilsCpp.toDateString(previousConfInfoGui.core ? previousConfInfoGui.core.dateTime : UtilsCpp.getCurrentDateTime()) : '' property bool isFirst : ListView.previousSection !== ListView.section - property real topOffset: (dateDay.visible && !isFirst? Math.round(8 * DefaultStyle.dp) : 0) + property real topOffset: (dateDay.visible && !isFirst) ? Utils.getSizeWithScreenRatio(8) : 0 property var endDateTime: itemGui.core ? itemGui.core.endDateTime : UtilsCpp.getCurrentDateTime() property bool haveModel: itemGui.core ? itemGui.core.haveModel : false property bool isCanceled: itemGui.core ? itemGui.core.state === LinphoneEnums.ConferenceInfoState.Cancelled : false @@ -188,19 +188,19 @@ ListView { anchors.topMargin: !itemDelegate.isFirst && dateDay.visible ? itemDelegate.topOffset : 0 spacing: 0 Item{ - Layout.preferredWidth: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) visible: !dateDay.visible } ColumnLayout { id: dateDay Layout.fillWidth: false - Layout.preferredWidth: Math.round(32 * DefaultStyle.dp) - Layout.minimumWidth: Math.round(32 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(51 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) + Layout.minimumWidth: Utils.getSizeWithScreenRatio(32) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(51) visible: previousDateString.length == 0 || previousDateString != dateString spacing: 0 Text { - Layout.preferredHeight: Math.round(19 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(19) Layout.alignment: Qt.AlignCenter text: day.substring(0,3) + '.' color: DefaultStyle.main2_500_main @@ -214,8 +214,8 @@ ListView { } Rectangle { id: dayNum - Layout.preferredWidth: Math.round(32 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) Layout.alignment: Qt.AlignCenter radius: height/2 property var isCurrentDay: UtilsCpp.isCurrentDay(dateTime) @@ -230,40 +230,40 @@ ListView { color: dayNum.isCurrentDay ? DefaultStyle.grey_0 : DefaultStyle.main2_500_main wrapMode: Text.NoWrap font { - pixelSize: Math.round(20 * DefaultStyle.dp) - weight: Math.round(800 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Utils.getSizeWithScreenRatio(800) } } } Item{Layout.fillHeight:true;Layout.fillWidth: true} } Item { - Layout.preferredWidth: Math.round(265 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(63 * DefaultStyle.dp) - Layout.leftMargin: Math.round(23 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(265) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(63) + Layout.leftMargin: Utils.getSizeWithScreenRatio(23) Rectangle { id: conferenceInfoDelegate anchors.fill: parent anchors.rightMargin: 5 // margin to avoid clipping shadows at right - radius: Math.round(10 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(10) visible: itemDelegate.haveModel || itemDelegate.activeFocus color: itemDelegate.isSelected ? DefaultStyle.main2_200 : DefaultStyle.grey_0 // mainItem.currentIndex === index ColumnLayout { anchors.fill: parent anchors.left: parent.left - anchors.leftMargin: Math.round(16 * DefaultStyle.dp) - anchors.rightMargin: Math.round(16 * DefaultStyle.dp) - anchors.topMargin: Math.round(10 * DefaultStyle.dp) - anchors.bottomMargin: Math.round(10 * DefaultStyle.dp) - spacing: Math.round(2 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(16) + anchors.rightMargin: Utils.getSizeWithScreenRatio(16) + anchors.topMargin: Utils.getSizeWithScreenRatio(10) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(2) visible: itemDelegate.haveModel RowLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.usersThree colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } Text { text: itemGui.core? itemGui.core.subject : "" @@ -296,14 +296,14 @@ ListView { } Text { anchors.fill: parent - anchors.rightMargin: Math.round(5 * DefaultStyle.dp) // margin to avoid clipping shadows at right - anchors.leftMargin: Math.round(16 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(5) // margin to avoid clipping shadows at right + anchors.leftMargin: Utils.getSizeWithScreenRatio(16) verticalAlignment: Text.AlignVCenter visible: !itemDelegate.haveModel //: "Aucune réunion aujourd'hui" text: qsTr("meetings_list_no_meeting_for_today") lineHeightMode: Text.FixedHeight - lineHeight: Math.round(18 * DefaultStyle.dp) + lineHeight: Utils.getSizeWithScreenRatio(18) font { pixelSize: Typography.p2.pixelSize weight: Typography.p2.weight diff --git a/Linphone/view/Control/Display/Participant/ParticipantDeviceListView.qml b/Linphone/view/Control/Display/Participant/ParticipantDeviceListView.qml index 813043770..5c53064b7 100644 --- a/Linphone/view/Control/Display/Participant/ParticipantDeviceListView.qml +++ b/Linphone/view/Control/Display/Participant/ParticipantDeviceListView.qml @@ -2,7 +2,8 @@ import QtQuick import QtQuick.Layouts import Linphone -import UtilsCpp 1.0 +import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ListView { id: mainItem @@ -10,8 +11,8 @@ ListView { height: contentHeight visible: contentHeight > 0 clip: true - rightMargin: Math.round(5 * DefaultStyle.dp) - spacing: Math.round(5 * DefaultStyle.dp) + rightMargin: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) property string searchBarText @@ -31,28 +32,28 @@ ListView { } delegate: Item { - height: Math.round(56 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(56) width: mainItem.width RowLayout { id: participantDelegate anchors.left: parent.left - anchors.leftMargin: Math.round(10 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(10) anchors.right: parent.right - anchors.rightMargin: Math.round(10 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(10) anchors.verticalCenter: parent.verticalCenter - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) z: 1 Avatar { - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) _address: modelData.core.address secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified shadowEnabled: false } Text { text: modelData.core.displayName - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) font.capitalization: mainItem.displayNameCapitalization ? Font.Capitalize : Font.MixedCase maximumLineCount: 1 Layout.fillWidth: true diff --git a/Linphone/view/Control/Display/Participant/ParticipantInfoListView.qml b/Linphone/view/Control/Display/Participant/ParticipantInfoListView.qml index 4b1e6d93f..32851d00f 100644 --- a/Linphone/view/Control/Display/Participant/ParticipantInfoListView.qml +++ b/Linphone/view/Control/Display/Participant/ParticipantInfoListView.qml @@ -3,11 +3,12 @@ import QtQuick.Layouts import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ListView { id: mainItem clip: true - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) property bool hoverEnabled: true property bool displayNameCapitalization: true @@ -26,22 +27,22 @@ ListView { delegate: Item { id: participantDelegate - height: Math.round(56 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(56) width: mainItem.width//mainItem.width RowLayout { anchors.fill: parent - anchors.leftMargin: Math.round(18 * DefaultStyle.dp) - anchors.rightMargin: Math.round(18 * DefaultStyle.dp) - spacing: Math.round(10 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(18) + anchors.rightMargin: Utils.getSizeWithScreenRatio(18) + spacing: Utils.getSizeWithScreenRatio(10) Avatar { - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) _address: modelData.core.sipAddress shadowEnabled: false } Text { text: modelData.core.displayName - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) font.capitalization: mainItem.displayNameCapitalization ? Font.Capitalize : Font.MixedCase maximumLineCount: 1 Layout.fillWidth: true diff --git a/Linphone/view/Control/Display/Participant/ParticipantListView.qml b/Linphone/view/Control/Display/Participant/ParticipantListView.qml index 12d832fc9..fd3fb8bc7 100644 --- a/Linphone/view/Control/Display/Participant/ParticipantListView.qml +++ b/Linphone/view/Control/Display/Participant/ParticipantListView.qml @@ -3,15 +3,16 @@ import QtQuick.Layouts import QtQuick.Controls.Basic as Control import Linphone -import UtilsCpp 1.0 +import UtilsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ListView { id: mainItem visible: contentHeight > 0 clip: true - rightMargin: Math.round(5 * DefaultStyle.dp) - spacing: Math.round(8 * DefaultStyle.dp) + rightMargin: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(8) property string searchBarText @@ -43,25 +44,25 @@ ListView { } delegate: Item { - height: Math.round(56 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(56) width: mainItem.width RowLayout { id: participantDelegate anchors.fill: parent - anchors.rightMargin: (scrollbar.width + 5 * DefaultStyle.dp) - spacing: Math.round(10 * DefaultStyle.dp) + anchors.rightMargin: (scrollbar.width + Utils.getSizeWithScreenRatio(5)) + spacing: Utils.getSizeWithScreenRatio(10) z: 1 Avatar { - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) _address: modelData.core.sipAddress secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified shadowEnabled: false } Text { text: modelData.core.displayName - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) font.capitalization: mainItem.displayNameCapitalization ? Font.Capitalize : Font.MixedCase maximumLineCount: 1 Layout.fillWidth: true @@ -71,9 +72,9 @@ ListView { Layout.alignment: Qt.AlignRight property bool isMe: modelData.core.isMe onIsMeChanged: if (isMe) mainItem.me = modelData - spacing: Math.round(26 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(26) RowLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Text { visible: mainItem.isMeAdmin || modelData.core.isAdmin Layout.alignment: Qt.AlignRight @@ -81,8 +82,8 @@ ListView { text: qsTr("meeting_participant_is_admin_label") color: DefaultStyle.main2_400 font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } Switch { @@ -94,13 +95,13 @@ ListView { } SmallButton { opacity: mainItem.isMeAdmin && !modelData.core.isMe ? 1 : 0 - Layout.preferredWidth: Math.round(20 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(20 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) color: DefaultStyle.main2_100 - leftPadding: Math.round(3 * DefaultStyle.dp) - rightPadding: Math.round(3 * DefaultStyle.dp) - topPadding: Math.round(3 * DefaultStyle.dp) - bottomPadding: Math.round(3 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(3) + rightPadding: Utils.getSizeWithScreenRatio(3) + topPadding: Utils.getSizeWithScreenRatio(3) + bottomPadding: Utils.getSizeWithScreenRatio(3) style: ButtonStyle.hoveredBackground icon.source: AppIcons.closeX onClicked: participantModel.removeParticipant(modelData.core) diff --git a/Linphone/view/Control/Display/ProgressBar.qml b/Linphone/view/Control/Display/ProgressBar.qml index 5fd61c216..4334c71ff 100644 --- a/Linphone/view/Control/Display/ProgressBar.qml +++ b/Linphone/view/Control/Display/ProgressBar.qml @@ -1,11 +1,12 @@ import QtQuick import QtQuick.Controls.Basic as Control import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.ProgressBar { id: mainItem - padding: Math.round(3 * DefaultStyle.dp) + padding: Utils.getSizeWithScreenRatio(3) property color backgroundColor: DefaultStyle.main2_100 property color innerColor: DefaultStyle.info_500_main @@ -19,15 +20,15 @@ Control.ProgressBar { id: textSize text: mainItem.innerText font { - pixelSize: Math.round(10 * DefaultStyle.dp) - weight: Math.round(700 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(10) + weight: Utils.getSizeWithScreenRatio(700) bold: true } } background: Rectangle { color: mainItem.backgroundColor - radius: Math.round(50 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(50) anchors.fill: mainItem width: mainItem.width height: mainItem.height @@ -37,7 +38,7 @@ Control.ProgressBar { Rectangle { id: bar color: mainItem.innerColor - radius: Math.round(50 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(50) width: mainItem.barWidth height: parent.height } @@ -51,8 +52,8 @@ Control.ProgressBar { color: mainItem.innerTextColor maximumLineCount: 1 font { - pixelSize: Math.round(10 * DefaultStyle.dp) - weight: Math.round(700 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(10) + weight: Utils.getSizeWithScreenRatio(700) } } } diff --git a/Linphone/view/Control/Display/RoundProgressBar.qml b/Linphone/view/Control/Display/RoundProgressBar.qml index 60bb3b537..d88029619 100644 --- a/Linphone/view/Control/Display/RoundProgressBar.qml +++ b/Linphone/view/Control/Display/RoundProgressBar.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Shapes import Linphone - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ProgressBar{ id: mainItem @@ -22,9 +22,9 @@ ProgressBar{ Shape { id: shape anchors.fill: parent - anchors.margins: Math.round(2 * DefaultStyle.dp) + anchors.margins: Utils.getSizeWithScreenRatio(2) - property real progressionRadius : Math.min(shape.width / 2, shape.height / 2) - Math.round(3 * DefaultStyle.dp) / 2 + property real progressionRadius : Math.round(Math.min(shape.width / 2, shape.height / 2) - Utils.getSizeWithScreenRatio(3) / 2) layer.enabled: true layer.samples: 8 @@ -35,14 +35,14 @@ ProgressBar{ id: pathDial strokeColor: DefaultStyle.main1_100 fillColor: 'transparent' - strokeWidth: Math.round(3 * DefaultStyle.dp) + strokeWidth: Utils.getSizeWithScreenRatio(3) capStyle: Qt.RoundCap PathAngleArc { radiusX: shape.progressionRadius radiusY: shape.progressionRadius - centerX: shape.width / 2 - centerY: shape.height / 2 + centerX: Math.round(shape.width / 2) + centerY: Math.round(shape.height / 2) startAngle: -90 // top start sweepAngle: 360 } @@ -52,14 +52,14 @@ ProgressBar{ id: pathProgress strokeColor: DefaultStyle.main1_500_main fillColor: 'transparent' - strokeWidth: Math.round(3 * DefaultStyle.dp) + strokeWidth: Utils.getSizeWithScreenRatio(3) capStyle: Qt.RoundCap PathAngleArc { radiusX: shape.progressionRadius radiusY: shape.progressionRadius - centerX: shape.width / 2 - centerY: shape.height / 2 + centerX: Math.round(shape.width / 2) + centerY: Math.round(shape.height / 2) startAngle: -90 // top start sweepAngle: (360/ mainItem.to * mainItem.value) } diff --git a/Linphone/view/Control/Display/RoundedPane.qml b/Linphone/view/Control/Display/RoundedPane.qml index 5181578df..4b8f3f61a 100644 --- a/Linphone/view/Control/Display/RoundedPane.qml +++ b/Linphone/view/Control/Display/RoundedPane.qml @@ -1,15 +1,16 @@ import QtQuick import QtQuick.Controls.Basic as Control import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.Control { id: mainItem - // width: Math.round(360 * DefaultStyle.dp) + // width: Utils.getSizeWithScreenRatio(360) property color backgroundColor: DefaultStyle.grey_0 - padding: Math.round(10 * DefaultStyle.dp) + padding: Utils.getSizeWithScreenRatio(10) background: Rectangle { anchors.fill: parent - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) color: mainItem.backgroundColor } } diff --git a/Linphone/view/Control/Display/Sticker.qml b/Linphone/view/Control/Display/Sticker.qml index 9d955f8db..8afe80d84 100644 --- a/Linphone/view/Control/Display/Sticker.qml +++ b/Linphone/view/Control/Display/Sticker.qml @@ -5,6 +5,7 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp import SettingsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // Display a sticker from a call or from an account. // The Avatar is shown while the camera become available. @@ -25,7 +26,7 @@ Item { property bool displayBorder : participantDevice && participantDevice.core.isSpeaking || false property alias displayPresence: avatar.displayPresence property color color: DefaultStyle.grey_600 - property real radius: Math.round(15 * DefaultStyle.dp) + property real radius: Utils.getSizeWithScreenRatio(15) property bool remoteIsPaused: participantDevice ? participantDevice.core.isPaused : previewEnabled @@ -74,7 +75,7 @@ Item { radius: mainItem.radius anchors.fill: parent border.color: DefaultStyle.main2_200 - border.width: mainItem.displayBorder ? Math.round(3 * DefaultStyle.dp) : 0 + border.width: mainItem.displayBorder ? Utils.getSizeWithScreenRatio(3) : 0 property real minSize: Math.min(height, width) Item { id: noCameraLayout @@ -82,7 +83,7 @@ Item { visible: !cameraLoader.active || cameraLoader.status != Loader.Ready || !cameraLoader.item.isReady ColumnLayout { anchors.top: parent.top - anchors.topMargin: Math.round(81 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(81) anchors.horizontalCenter: parent.horizontalCenter // Layout.alignment: Qt.AlignHCenter |Qt.AlignTop spacing: 0 @@ -94,8 +95,8 @@ Item { BusyIndicator { indicatorColor: DefaultStyle.main2_100 Layout.alignment: Qt.AlignHCenter - indicatorHeight: Math.round(42 * DefaultStyle.dp) - indicatorWidth: Math.round(42 * DefaultStyle.dp) + indicatorHeight: Utils.getSizeWithScreenRatio(42) + indicatorWidth: Utils.getSizeWithScreenRatio(42) } } Item{ @@ -104,7 +105,7 @@ Item { anchors.centerIn: parent height: mainItem.conference ? background.minSize * 142 / 372 - : Math.round(120 * DefaultStyle.dp) + : Utils.getSizeWithScreenRatio(120) width: height Avatar{ id: avatar @@ -122,30 +123,30 @@ Item { spacing: 0 visible: mainItem.participantDevice && (mainItem.participantDevice.core.state == LinphoneEnums.ParticipantDeviceState.Joining || mainItem.participantDevice.core.state == LinphoneEnums.ParticipantDeviceState.Alerting) || false BusyIndicator { - Layout.preferredHeight: Math.round(42 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(42) indicatorColor: DefaultStyle.main2_100 Layout.alignment: Qt.AlignHCenter - indicatorHeight: Math.round(42 * DefaultStyle.dp) - indicatorWidth: Math.round(42 * DefaultStyle.dp) + indicatorHeight: Utils.getSizeWithScreenRatio(42) + indicatorWidth: Utils.getSizeWithScreenRatio(42) } Text { - Layout.preferredHeight: Math.round(27 * DefaultStyle.dp) - Layout.topMargin: Math.round(15 * DefaultStyle.dp) // (84-27)-42 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(27) + Layout.topMargin: Utils.getSizeWithScreenRatio(15) // (84-27)-42 //: "rejoint…" text: qsTr("conference_participant_joining_text") color: DefaultStyle.grey_0 Layout.alignment: Qt.AlignHCenter horizontalAlignment: Text.AlignHCenter font { - pixelSize: Math.round(20 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Utils.getSizeWithScreenRatio(500) } } } } ColumnLayout { anchors.centerIn: parent - spacing: Math.round(12 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(12) visible: mainItem.remoteIsPaused EffectImage { imageSource: AppIcons.pause @@ -160,8 +161,8 @@ Item { //: "En pause" text: qsTr("conference_participant_paused_text") font { - pixelSize: Math.round(20 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Utils.getSizeWithScreenRatio(500) } } } @@ -169,7 +170,7 @@ Item { spacing: 0 visible: mainItem.displayAll && !mainItem.remoteIsPaused && !mainItem.conference anchors.top: centerItem.bottom - anchors.topMargin: Math.round(21 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(21) anchors.left: parent.left anchors.right: parent.right @@ -179,8 +180,8 @@ Item { text: mainItem.displayName color: DefaultStyle.grey_0 font { - pixelSize: Math.round(22 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(22) + weight: Utils.getSizeWithScreenRatio(300) capitalization: Font.Capitalize } } @@ -191,8 +192,8 @@ Item { text: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(_text) : _text color: DefaultStyle.grey_0 font { - pixelSize: Math.round(14 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(14) + weight: Utils.getSizeWithScreenRatio(300) } } } @@ -255,9 +256,9 @@ Item { anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - anchors.leftMargin: Math.round(10 * DefaultStyle.dp) - anchors.rightMargin: Math.round(10 * DefaultStyle.dp) - anchors.bottomMargin: Math.round(10 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(10) + anchors.rightMargin: Utils.getSizeWithScreenRatio(10) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(10) width: implicitWidth maximumLineCount: 1 property string _text: mainItem.displayName != '' @@ -268,8 +269,8 @@ Item { text: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(_text) : _text color: DefaultStyle.grey_0 font { - pixelSize: Math.round(14 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(14) + weight: Utils.getSizeWithScreenRatio(500) } } } @@ -286,22 +287,22 @@ Item { RowLayout{ anchors.right: parent.right anchors.top: parent.top - anchors.rightMargin: Math.round(8 * DefaultStyle.dp) - anchors.topMargin: Math.round(8 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(8) + anchors.topMargin: Utils.getSizeWithScreenRatio(8) - height: Math.round(18 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(18) spacing: 0 Rectangle { id: muteIcon - Layout.preferredWidth: Math.min(mainItem.width / 16, Math.round(20 * DefaultStyle.dp)) - Layout.preferredHeight: Math.min(mainItem.width / 16, Math.round(20 * DefaultStyle.dp)) + Layout.preferredWidth: Math.min(Math.round(mainItem.width / 16), Utils.getSizeWithScreenRatio(20)) + Layout.preferredHeight: Math.min(Math.round(mainItem.width / 16), Utils.getSizeWithScreenRatio(20)) visible: mainItem.mutedStatus color: DefaultStyle.grey_0 radius: width /2 EffectImage { anchors.centerIn: parent - imageWidth: Math.min(mainItem.width / 16, Math.round(20 * DefaultStyle.dp)) - imageHeight: Math.min(mainItem.width / 16, Math.round(20 * DefaultStyle.dp)) + imageWidth: Math.min(Math.round(mainItem.width / 16),Utils.getSizeWithScreenRatio(20)) + imageHeight: Math.min(Math.round(mainItem.width / 16),Utils.getSizeWithScreenRatio(20)) imageSource: AppIcons.microphoneSlash colorizationColor: DefaultStyle.main2_500_main } diff --git a/Linphone/view/Control/Display/Text.qml b/Linphone/view/Control/Display/Text.qml index fa0b9df4b..57edd2cf1 100644 --- a/Linphone/view/Control/Display/Text.qml +++ b/Linphone/view/Control/Display/Text.qml @@ -1,6 +1,7 @@ import QtQuick as Quick import QtQuick.Layouts import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Quick.Text { id: mainItem @@ -8,7 +9,7 @@ Quick.Text { width: txtMeter.advanceWidth font { family: DefaultStyle.defaultFont - pixelSize: Math.round(10 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(10) weight: Typography.p1.weight } color: DefaultStyle.main2_600 diff --git a/Linphone/view/Control/Display/ToolTip.qml b/Linphone/view/Control/Display/ToolTip.qml index d6df05e96..a866596ca 100644 --- a/Linphone/view/Control/Display/ToolTip.qml +++ b/Linphone/view/Control/Display/ToolTip.qml @@ -1,7 +1,8 @@ import QtQuick import QtQuick.Controls.Basic as Control import Linphone - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + Control.ToolTip { id: mainItem delay: 1000 @@ -10,7 +11,7 @@ Control.ToolTip { id: tooltipBackground opacity: 0.7 color: DefaultStyle.main2_200 - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) } contentItem: Text { text: mainItem.text diff --git a/Linphone/view/Control/Form/Call/ChangeLayoutForm.qml b/Linphone/view/Control/Form/Call/ChangeLayoutForm.qml index ea847f625..8148117e7 100644 --- a/Linphone/view/Control/Form/Call/ChangeLayoutForm.qml +++ b/Linphone/view/Control/Form/Call/ChangeLayoutForm.qml @@ -3,6 +3,7 @@ import QtQuick.Controls.Basic as Control import QtQuick.Layouts import Linphone import SettingsCpp 1.0 +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils FocusScope { id: mainItem @@ -12,11 +13,11 @@ FocusScope { ColumnLayout { anchors.fill: parent - anchors.topMargin: Math.round(16 * DefaultStyle.dp) - anchors.bottomMargin: Math.round(16 * DefaultStyle.dp) - anchors.leftMargin: Math.round(17 * DefaultStyle.dp) - anchors.rightMargin: Math.round(17 * DefaultStyle.dp) - spacing: Math.round(12 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(16) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(16) + anchors.leftMargin: Utils.getSizeWithScreenRatio(17) + anchors.rightMargin: Utils.getSizeWithScreenRatio(17) + spacing: Utils.getSizeWithScreenRatio(12) RoundedPane { Layout.fillWidth: true @@ -32,9 +33,9 @@ FocusScope { id: radiobutton checkOnClick: false color: DefaultStyle.main1_500_main - indicatorSize: Math.round(20 * DefaultStyle.dp) + indicatorSize: Utils.getSizeWithScreenRatio(20) leftPadding: indicator.width + spacing - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) checkable: false // Qt Documentation is wrong: It is true by default. We don't want to change the checked state if the layout change is not effective. checked: index == 0 ? mainItem.conferenceLayout === LinphoneEnums.ConferenceLayout.Grid @@ -44,11 +45,11 @@ FocusScope { onClicked: mainItem.changeLayoutRequested(index) contentItem: RowLayout { - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) EffectImage { id: radioButtonImg - Layout.preferredWidth: Math.round(32 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) imageSource: modelData.imgUrl colorizationColor: DefaultStyle.main2_500_main } @@ -56,7 +57,7 @@ FocusScope { text: modelData.text color: DefaultStyle.main2_500_main verticalAlignment: Text.AlignVCenter - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) Layout.fillWidth: true } } diff --git a/Linphone/view/Control/Form/Login/LoginForm.qml b/Linphone/view/Control/Form/Login/LoginForm.qml index b5ae8194d..d4300a57b 100644 --- a/Linphone/view/Control/Form/Login/LoginForm.qml +++ b/Linphone/view/Control/Form/Login/LoginForm.qml @@ -86,7 +86,7 @@ ColumnLayout { implicitHeight: parent.height Layout.alignment: Qt.AlignCenter indicatorColor: DefaultStyle.grey_0 - indicatorWidth: Math.round(25 * DefaultStyle.dp) + indicatorWidth: Utils.getSizeWithScreenRatio(25) } Connections { target: LoginPageCpp diff --git a/Linphone/view/Control/Form/Settings/EncryptionSettings.qml b/Linphone/view/Control/Form/Settings/EncryptionSettings.qml index d7c5666a4..6a61a17cd 100644 --- a/Linphone/view/Control/Form/Settings/EncryptionSettings.qml +++ b/Linphone/view/Control/Form/Settings/EncryptionSettings.qml @@ -4,6 +4,7 @@ import QtQuick.Layouts import Linphone import SettingsCpp 1.0 import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem @@ -11,32 +12,32 @@ ColumnLayout { property var call RoundedPane { Layout.fillWidth: true - leftPadding: Math.round(16 * DefaultStyle.dp) - rightPadding: Math.round(16 * DefaultStyle.dp) - topPadding: Math.round(13 * DefaultStyle.dp) - bottomPadding: Math.round(13 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(16) + topPadding: Utils.getSizeWithScreenRatio(13) + bottomPadding: Utils.getSizeWithScreenRatio(13) contentItem: ColumnLayout { - spacing: Math.round(12 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(12) Text { //: "Encryption :" text: qsTr("call_stats_media_encryption_title") Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) weight: Typography.p2.weight } } ColumnLayout { Layout.alignment: Qt.AlignHCenter - spacing: Math.round(7 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(7) Text { property bool isPostQuantum: mainItem.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp && mainItem.call.core.zrtpStats.isPostQuantum //: Media encryption : %1 text: qsTr("call_stats_media_encryption").arg(mainItem.call.core.encryptionString) Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } ColumnLayout { @@ -46,8 +47,8 @@ ColumnLayout { text: qsTr("call_stats_zrtp_cipher_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.cipherAlgo) Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { @@ -55,8 +56,8 @@ ColumnLayout { text: qsTr("call_stats_zrtp_key_agreement_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.keyAgreementAlgo) Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { @@ -64,8 +65,8 @@ ColumnLayout { text: qsTr("call_stats_zrtp_hash_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.hashAlgo) Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { @@ -73,8 +74,8 @@ ColumnLayout { text: qsTr("call_stats_zrtp_auth_tag_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.authenticationAlgo) Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { @@ -82,8 +83,8 @@ ColumnLayout { text: qsTr("call_stats_zrtp_sas_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.sasAlgo) Layout.alignment: Qt.AlignHCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } } @@ -97,9 +98,9 @@ ColumnLayout { //: "Validation chiffrement" text: qsTr("call_zrtp_validation_button_label") onClicked: mainItem.encryptionValidationRequested() - Layout.bottomMargin: Math.round(13 * DefaultStyle.dp) - Layout.leftMargin: Math.round(16 * DefaultStyle.dp) - Layout.rightMargin: Math.round(16 * DefaultStyle.dp) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(13) + Layout.leftMargin: Utils.getSizeWithScreenRatio(16) + Layout.rightMargin: Utils.getSizeWithScreenRatio(16) style: ButtonStyle.main } } diff --git a/Linphone/view/Control/Form/Settings/ScreencastSettings.qml b/Linphone/view/Control/Form/Settings/ScreencastSettings.qml index bdf6f28f0..ef2078aa2 100644 --- a/Linphone/view/Control/Form/Settings/ScreencastSettings.qml +++ b/Linphone/view/Control/Form/Settings/ScreencastSettings.qml @@ -5,6 +5,7 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp 1.0 import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem @@ -14,21 +15,21 @@ ColumnLayout { property bool isLocalScreenSharing : conference?.core.isLocalScreenSharing || false property bool screenSharingAvailable: !!conference && (!conference.core.isScreenSharingEnabled || isLocalScreenSharing) - spacing: Math.round(12 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(12) onIsLocalScreenSharingChanged: {if(isLocalScreenSharing) mainItem.call.core.videoSourceDescriptor = mainItem.desc } Text { Layout.fillWidth: true //: "Veuillez choisir l’écran ou la fenêtre que vous souihaitez partager au autres participants" text: qsTr("screencast_settings_choose_window_text") - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) color: DefaultStyle.main2_500_main } TabBar { Layout.fillWidth: true id: bar - spacing: Math.round(40 * DefaultStyle.dp) - pixelSize: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(40) + pixelSize: Utils.getSizeWithScreenRatio(16) //: "Ecran entier" model: [qsTr("screencast_settings_all_screen_label"), //: "Fenêtre" @@ -42,18 +43,18 @@ ColumnLayout { property bool selected: false property bool displayScreen: true property real horizontalMargin: 0 - leftPadding: Math.round(18 * DefaultStyle.dp) - rightPadding: Math.round(18 * DefaultStyle.dp) - topPadding: Math.round(13 * DefaultStyle.dp) - bottomPadding: Math.round(13 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(18) + rightPadding: Utils.getSizeWithScreenRatio(18) + topPadding: Utils.getSizeWithScreenRatio(13) + bottomPadding: Utils.getSizeWithScreenRatio(13) background: Rectangle { anchors.fill: parent anchors.leftMargin: screenPreview.horizontalMargin anchors.rightMargin: screenPreview.horizontalMargin color: screenPreview.selected ? DefaultStyle.main2_100 : DefaultStyle.grey_0 - border.width: Math.round(2 * DefaultStyle.dp) + border.width: Utils.getSizeWithScreenRatio(2) border.color: screenPreview.selected ? DefaultStyle.main2_400 : DefaultStyle.main2_200 - radius: Math.round(10 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(10) MouseArea { anchors.fill: parent onClicked: { @@ -68,7 +69,7 @@ ColumnLayout { Layout.fillHeight: true Image { anchors.centerIn: parent - //Layout.preferredHeight: Math.round(170 * DefaultStyle.dp) + //Layout.preferredHeight: Utils.getSizeWithScreenRatio(170) source: $modelData?.windowId ? "image://window/"+ $modelData.windowId : "image://screen/"+ $modelData.screenIndex sourceSize.width: parent.width sourceSize.height: parent.height @@ -76,11 +77,11 @@ ColumnLayout { } } RowLayout{ - Layout.topMargin: Math.round(6 * DefaultStyle.dp) - spacing: Math.round(5 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(6) + spacing: Utils.getSizeWithScreenRatio(5) Image{ - Layout.preferredHeight: Math.round(15 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(15 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(15) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(15) visible: !!$modelData?.windowId source: visible ? "image://window_icon/"+ $modelData.windowId : '' sourceSize.width: width @@ -92,7 +93,7 @@ ColumnLayout { //: "Ecran %1" text: !!$modelData?.windowId ? $modelData.name : qsTr("screencast_settings_screen").arg(screenIndex+1) horizontalAlignment: Text.AlignHCenter - font.pixelSize: Math.round((displayScreen ? 14 : 10) * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(displayScreen ? 14 : 10) elide: Text.ElideRight maximumLineCount: 1 } @@ -104,7 +105,7 @@ ColumnLayout { currentIndex: bar.currentIndex ListView{ id: screensLayout - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) clip: true Layout.fillWidth: true height: visible ? contentHeight : 0 @@ -118,9 +119,9 @@ ColumnLayout { else currentIndex = -1 } delegate: ScreenPreviewLayout { - horizontalMargin: Math.round((28 - 20 ) * DefaultStyle.dp) // 20 coming from CallsWindow panel + horizontalMargin: Utils.getSizeWithScreenRatio(28 - 20 ) // 20 coming from CallsWindow panel width: screensLayout.width - height: Math.round(219 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(219) screenIndex: index onClicked: {//screensLayout.selectedIndex = index screensLayout.currentIndex = index @@ -147,14 +148,14 @@ ColumnLayout { else currentIndex = -1 } cellWidth: width / 2 - cellHeight: Math.round((112 + 15) * DefaultStyle.dp) + cellHeight: Utils.getSizeWithScreenRatio(112 + 15) clip: true delegate: Item { width: windowsLayout.cellWidth height: windowsLayout.cellHeight ScreenPreviewLayout { anchors.fill: parent - anchors.margins: Math.round(7 * DefaultStyle.dp) + anchors.margins: Utils.getSizeWithScreenRatio(7) displayScreen: false screenIndex: index onClicked: { diff --git a/Linphone/view/Control/Input/Calendar.qml b/Linphone/view/Control/Input/Calendar.qml index 215a5f856..6b0bc2d66 100644 --- a/Linphone/view/Control/Input/Calendar.qml +++ b/Linphone/view/Control/Input/Calendar.qml @@ -7,6 +7,7 @@ import Linphone import ConstantsCpp 1.0 import UtilsCpp 1.0 import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ListView { id: mainItem @@ -40,10 +41,10 @@ ListView { ColumnLayout { anchors.fill: parent property int currentMonth: model.month - spacing: Math.round(18 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(18) RowLayout { Layout.fillWidth: true - spacing: Math.round(38 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(38) Text { text: UtilsCpp.toDateMonthAndYearString(new Date(model.year, model.month, 15))// 15 because of timezones that can change the date for localeString font { @@ -57,8 +58,8 @@ ListView { } Button { id: previousButton - Layout.preferredWidth: Math.round(20 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(20 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) icon.width: width icon.height: height style: ButtonStyle.noBackground @@ -67,8 +68,8 @@ ListView { } Button { id: nextButton - Layout.preferredWidth: Math.round(20 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(20 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) icon.width: width icon.height: height style: ButtonStyle.noBackground @@ -78,7 +79,7 @@ ListView { } ColumnLayout { - spacing: Math.round(12 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(12) Control.DayOfWeekRow { locale: monthGrid.locale Layout.column: 1 @@ -89,8 +90,8 @@ ListView { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } @@ -146,9 +147,9 @@ ListView { Rectangle { anchors.centerIn: parent - width: Math.round(30 * DefaultStyle.dp) - height: Math.round(30 * DefaultStyle.dp) - radius: Math.round(50 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(30) + height: Utils.getSizeWithScreenRatio(30) + radius: Utils.getSizeWithScreenRatio(50) color: isSelectedDay ? DefaultStyle.main1_500_main : "transparent" border.width: focusDay.activeFocus || hoveringArea.containsMouse ? 1 : 0 @@ -164,8 +165,8 @@ ListView { ? DefaultStyle.main2_700 : DefaultStyle.main2_400 font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } diff --git a/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml b/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml index 274f453f0..996540d93 100644 --- a/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml +++ b/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml @@ -58,10 +58,10 @@ Control.Control { // width: mainItem.implicitWidth // height: mainItem.height - leftPadding: Math.round(15 * DefaultStyle.dp) - rightPadding: Math.round(15 * DefaultStyle.dp) - topPadding: Math.round(16 * DefaultStyle.dp) - bottomPadding: Math.round(16 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(15) + rightPadding: Utils.getSizeWithScreenRatio(15) + topPadding: Utils.getSizeWithScreenRatio(16) + bottomPadding: Utils.getSizeWithScreenRatio(16) background: Rectangle { anchors.fill: parent color: DefaultStyle.grey_100 @@ -75,13 +75,13 @@ Control.Control { Component { id: textAreaComp RowLayout { - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) PopupButton { id: emojiPickerButton style: ButtonStyle.noBackground icon.source: checked ? AppIcons.closeX : AppIcons.smiley - popup.width: Math.round(393 * DefaultStyle.dp) - popup.height: Math.round(291 * DefaultStyle.dp) + popup.width: Utils.getSizeWithScreenRatio(393) + popup.height: Utils.getSizeWithScreenRatio(291) popup.contentItem: EmojiPicker { editor: sendingTextArea } @@ -100,14 +100,14 @@ Control.Control { } Layout.fillWidth: true Layout.alignment: Qt.AlignCenter - leftPadding: Math.round(24 * DefaultStyle.dp) - rightPadding: Math.round(20 * DefaultStyle.dp) - topPadding: Math.round(12 * DefaultStyle.dp) - bottomPadding: Math.round(12 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(24) + rightPadding: Utils.getSizeWithScreenRatio(20) + topPadding: Utils.getSizeWithScreenRatio(12) + bottomPadding: Utils.getSizeWithScreenRatio(12) background: Rectangle { id: inputBackground anchors.fill: parent - radius: Math.round(35 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(35) color: DefaultStyle.grey_0 MouseArea { anchors.fill: parent @@ -118,7 +118,7 @@ Control.Control { contentItem: RowLayout { Flickable { id: sendingAreaFlickable - Layout.preferredHeight: Math.min(Math.round(100 * DefaultStyle.dp), contentHeight) + Layout.preferredHeight: Math.min(Utils.getSizeWithScreenRatio(100), contentHeight) Layout.fillHeight: true width: sendingControl.width - sendingControl.leftPadding - sendingControl.rightPadding Layout.fillWidth: true @@ -215,15 +215,15 @@ Control.Control { Component { id: voiceMessageRecordComp RowLayout { - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) RoundButton { style: ButtonStyle.player shadowEnabled: true - padding: Math.round(4 * DefaultStyle.dp) - icon.width: Math.round(22 * DefaultStyle.dp) - icon.height: Math.round(22 * DefaultStyle.dp) + padding: Utils.getSizeWithScreenRatio(4) + icon.width: Utils.getSizeWithScreenRatio(22) + icon.height: Utils.getSizeWithScreenRatio(22) icon.source: AppIcons.closeX - width: Math.round(30 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(30) Layout.preferredWidth: width Layout.preferredHeight: height onClicked: { @@ -238,7 +238,7 @@ Control.Control { } recording: true Layout.fillWidth: true - Layout.preferredHeight: Math.round(48 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(48) chatMessageContentGui: chatMessage ? chatMessage.core.getVoiceRecordingContent() : null onVoiceRecordingMessageCreationRequested: (recorderGui) => { chatMessageObj = UtilsCpp.createVoiceRecordingMessage(recorderGui, mainItem.chat) @@ -248,8 +248,8 @@ Control.Control { id: sendButton style: ButtonStyle.noBackgroundOrange icon.source: AppIcons.paperPlaneRight - icon.width: Math.round(22 * DefaultStyle.dp) - icon.height: Math.round(22 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(22) + icon.height: Utils.getSizeWithScreenRatio(22) // Layout.preferredWidth: icon.width // Layout.preferredHeight: icon.height property bool sendVoiceRecordingOnCreated: false @@ -283,13 +283,13 @@ Control.Control { anchors.fill: parent color: DefaultStyle.main2_0 visible: false - radius: Math.round(20 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(20) EffectImage { anchors.centerIn: parent imageSource: AppIcons.filePlus - width: Math.round(37 * DefaultStyle.dp) - height: Math.round(37 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(37) + height: Utils.getSizeWithScreenRatio(37) colorizationColor: DefaultStyle.main2_500_main } diff --git a/Linphone/view/Control/Input/DecoratedTextField.qml b/Linphone/view/Control/Input/DecoratedTextField.qml index 100b62e99..636dd993e 100644 --- a/Linphone/view/Control/Input/DecoratedTextField.qml +++ b/Linphone/view/Control/Input/DecoratedTextField.qml @@ -4,6 +4,7 @@ import QtQuick.Layouts 1.0 import QtQuick.Effects import UtilsCpp import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils FormItemLayout { id: mainItem @@ -39,7 +40,7 @@ FormItemLayout { contentItem: TextField { id: textField - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) placeholderText: useTitleAsPlaceHolder ? mainItem.title : mainItem.placeHolder initialText: (mainItem.propertyOwnerGui ? mainItem.propertyOwnerGui.core[mainItem.propertyName] : mainItem.propertyOwner[mainItem.propertyName]) || '' customWidth: mainItem.parent.width diff --git a/Linphone/view/Control/Input/DigitInput.qml b/Linphone/view/Control/Input/DigitInput.qml index 53d90dfa6..43a7ee957 100644 --- a/Linphone/view/Control/Input/DigitInput.qml +++ b/Linphone/view/Control/Input/DigitInput.qml @@ -1,10 +1,11 @@ import QtQuick import QtQuick.Controls.Basic as Control import Linphone - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + Control.TextField { id: mainItem - property real inputSize: Math.round(100 * DefaultStyle.dp) + property real inputSize: Utils.getSizeWithScreenRatio(100) color: activeFocus ? DefaultStyle.main1_500_main : DefaultStyle.main2_500_main validator: IntValidator{bottom: 0; top: 9} @@ -24,7 +25,7 @@ Control.TextField { // horizontalAlignment: Control.TextField.AlignHCenter font.family: DefaultStyle.defaultFont font.pixelSize: inputSize / 2 - font.weight: Math.round(300 * DefaultStyle.dp) + font.weight: Utils.getSizeWithScreenRatio(300) background: Item { anchors.fill: parent @@ -32,7 +33,7 @@ Control.TextField { // height: mainItem.inputSize Rectangle { id: background - border.width: Math.round(Math.max(DefaultStyle.dp), 1) + border.width: Utils.getSizeWithScreenRatio(1) border.color: mainItem.activeFocus ? DefaultStyle.main1_500_main : DefaultStyle.main2_500_main radius: mainItem.inputSize * 0.15 width: mainItem.inputSize * 0.9 @@ -42,11 +43,11 @@ Control.TextField { id: indicator visible: mainItem.activeFocus color: DefaultStyle.main1_500_main - height : Math.max(1, Math.round(1 * DefaultStyle.dp)) + height : Utils.getSizeWithScreenRatio(1) width: mainItem.inputSize * 0.67 anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom - anchors.bottomMargin: Math.round((mainItem.inputSize / 8) * DefaultStyle.dp) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(mainItem.inputSize / 8) } } } diff --git a/Linphone/view/Control/Input/NumericPad.qml b/Linphone/view/Control/Input/NumericPad.qml index b53a172a3..a84d3bef1 100644 --- a/Linphone/view/Control/Input/NumericPad.qml +++ b/Linphone/view/Control/Input/NumericPad.qml @@ -5,6 +5,7 @@ import QtQuick.Effects import Linphone import UtilsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils FocusScope { id: mainItem @@ -90,8 +91,8 @@ FocusScope { Layout.GridLayout { id: numPadGrid columns: 3 - columnSpacing: Math.round(40 * DefaultStyle.dp) - rowSpacing: Math.round(10 * DefaultStyle.dp) + columnSpacing: Utils.getSizeWithScreenRatio(40) + rowSpacing: Utils.getSizeWithScreenRatio(10) function getButtonAt(index){ index = (index+15) % 15 if(index >= 0){ @@ -113,8 +114,8 @@ FocusScope { id: numPadButton Layout.Layout.alignment: Qt.AlignHCenter required property int index - implicitWidth: Math.round(60 * DefaultStyle.dp) - implicitHeight: Math.round(60 * DefaultStyle.dp) + implicitWidth: Utils.getSizeWithScreenRatio(60) + implicitHeight: Utils.getSizeWithScreenRatio(60) onClicked: { mainItem.buttonPressed(text) } @@ -123,10 +124,10 @@ FocusScope { KeyNavigation.up: numPadGrid.getButtonAt(index - 3) KeyNavigation.down: numPadGrid.getButtonAt(index + 3) style: ButtonStyle.numericPad - radius: Math.round(71 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(71) text: index + 1 - textSize: Math.round(32 * DefaultStyle.dp) - textWeight: Math.round(400 * DefaultStyle.dp) + textSize: Utils.getSizeWithScreenRatio(32) + textWeight: Utils.getSizeWithScreenRatio(400) } } Repeater { @@ -139,8 +140,8 @@ FocusScope { BigButton { id: digitButton Layout.Layout.alignment: Qt.AlignHCenter - implicitWidth: Math.round(60 * DefaultStyle.dp) - implicitHeight: Math.round(60 * DefaultStyle.dp) + implicitWidth: Utils.getSizeWithScreenRatio(60) + implicitHeight: Utils.getSizeWithScreenRatio(60) onClicked: mainItem.buttonPressed(pressText.text) onPressAndHold: mainItem.buttonPressed(longPressText.text) @@ -149,7 +150,7 @@ FocusScope { KeyNavigation.right: numPadGrid.getButtonAt((index + 1)+9) KeyNavigation.up: numPadGrid.getButtonAt((index - 3)+9) KeyNavigation.down: numPadGrid.getButtonAt((index + 3)+9) - radius: Math.round(71 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(71) style: ButtonStyle.numericPad contentItem: Item { @@ -163,7 +164,7 @@ FocusScope { horizontalAlignment: Text.AlignHCenter Component.onCompleted: {if (modelData.longPressText === undefined) anchors.centerIn= parent} text: modelData.pressText - font.pixelSize: Math.round(32 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(32) } Text { id: longPressText @@ -175,7 +176,7 @@ FocusScope { horizontalAlignment: Text.AlignHCenter visible: modelData.longPressText ? modelData.longPressText.length > 0 : false text: modelData.longPressText ? modelData.longPressText : "" - font.pixelSize: Math.round(22 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(22) } } } @@ -187,12 +188,12 @@ FocusScope { Button { id: launchCallButton visible: mainItem.lastRowVisible - implicitWidth: Math.round(75 * DefaultStyle.dp) - implicitHeight: Math.round(55 * DefaultStyle.dp) + implicitWidth: Utils.getSizeWithScreenRatio(75) + implicitHeight: Utils.getSizeWithScreenRatio(55) Layout.Layout.alignment: Qt.AlignHCenter - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) - radius: Math.round(71 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + radius: Utils.getSizeWithScreenRatio(71) style: ButtonStyle.phoneGreen onClicked: mainItem.launchCall() @@ -205,17 +206,17 @@ FocusScope { Button { id: eraseButton visible: mainItem.lastRowVisible - leftPadding: Math.round(5 * DefaultStyle.dp) - rightPadding: Math.round(5 * DefaultStyle.dp) - topPadding: Math.round(5 * DefaultStyle.dp) - bottomPadding: Math.round(5 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(5) + rightPadding: Utils.getSizeWithScreenRatio(5) + topPadding: Utils.getSizeWithScreenRatio(5) + bottomPadding: Utils.getSizeWithScreenRatio(5) Layout.Layout.alignment: Qt.AlignHCenter icon.source: AppIcons.backspaceFill style: ButtonStyle.noBackground - icon.width: Math.round(38 * DefaultStyle.dp) - icon.height: Math.round(38 * DefaultStyle.dp) - Layout.Layout.preferredWidth: Math.round(38 * DefaultStyle.dp) - Layout.Layout.preferredHeight: Math.round(38 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(38) + icon.height: Utils.getSizeWithScreenRatio(38) + Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(38) + Layout.Layout.preferredHeight: Utils.getSizeWithScreenRatio(38) onClicked: mainItem.wipe() diff --git a/Linphone/view/Control/Input/PhoneNumberInput.qml b/Linphone/view/Control/Input/PhoneNumberInput.qml index 63ecb041c..25a883e5f 100644 --- a/Linphone/view/Control/Input/PhoneNumberInput.qml +++ b/Linphone/view/Control/Input/PhoneNumberInput.qml @@ -3,7 +3,8 @@ import QtQuick.Controls.Basic as Control import QtQuick.Layouts import Linphone import CustomControls 1.0 - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + ColumnLayout { id: mainItem @@ -19,7 +20,7 @@ ColumnLayout { property string defaultCallingCode property bool keyboardFocus: FocusHelper.keyboardFocus - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) Text { visible: label.length > 0 @@ -34,12 +35,12 @@ ColumnLayout { Control.Control { Layout.preferredWidth: mainItem.width - Layout.preferredHeight: Math.round(49 * DefaultStyle.dp) - leftPadding: Math.round(16 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + leftPadding: Utils.getSizeWithScreenRatio(16) background: Rectangle { id: contentBackground anchors.fill: parent - radius: Math.round(63 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(63) color: DefaultStyle.grey_100 border.color: mainItem.errorMessage.length > 0 ? DefaultStyle.danger_500_main @@ -50,7 +51,7 @@ ColumnLayout { contentItem: RowLayout { CountryIndicatorCombobox { id: combobox - implicitWidth: Math.round(110 * DefaultStyle.dp) + implicitWidth: Utils.getSizeWithScreenRatio(110) Layout.fillHeight: true defaultCallingCode: mainItem.defaultCallingCode property bool keyboardFocus: FocusHelper.keyboardFocus @@ -58,10 +59,10 @@ ColumnLayout { Accessible.name: qsTr("prefix_phone_number_accessible_name").arg(mainItem.Accessible.name) } Rectangle { - Layout.preferredWidth: Math.max(Math.round(1 * DefaultStyle.dp), 1) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(1) Layout.fillHeight: true - Layout.topMargin: Math.round(10 * DefaultStyle.dp) - Layout.bottomMargin: Math.round(10 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(10) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(10) color: DefaultStyle.main2_600 } TextField { @@ -80,7 +81,7 @@ ColumnLayout { TemporaryText { id: errorText Layout.fillWidth: true - Layout.topMargin: Math.round(-3 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(-3) // visible: mainItem.enableErrorText text: mainItem.errorMessage color: DefaultStyle.danger_500_main @@ -88,7 +89,7 @@ ColumnLayout { elide: Text.ElideRight wrapMode: Text.Wrap font { - pixelSize: Math.round(13 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(13) family: DefaultStyle.defaultFont bold: true } diff --git a/Linphone/view/Control/Input/SearchBar.qml b/Linphone/view/Control/Input/SearchBar.qml index 8fe35a7b0..0d2378f19 100644 --- a/Linphone/view/Control/Input/SearchBar.qml +++ b/Linphone/view/Control/Input/SearchBar.qml @@ -25,7 +25,7 @@ FocusScope { // Text properties property string placeholderText: "" property color placeholderTextColor: DefaultStyle.main2_400 - property real textInputWidth: Math.round(350 * DefaultStyle.dp) + property real textInputWidth: Utils.getSizeWithScreenRatio(350) property string text: textField.searchText signal openNumericPadRequested()// Useful for redirection before displaying numeric pad. @@ -45,12 +45,12 @@ FocusScope { implicitWidth: mainItem.textInputWidth - implicitHeight: Math.round(50 * DefaultStyle.dp) + implicitHeight: Utils.getSizeWithScreenRatio(50) Rectangle{ id: backgroundItem anchors.fill: parent - radius: Math.round(28 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(28) color: DefaultStyle.grey_100 border.color: textField.keyboardFocus ? mainItem.keyboardFocusedBorderColor : textField.activeFocus ? mainItem.focusedBorderColor : mainItem.borderColor border.width: textField.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth @@ -61,15 +61,15 @@ FocusScope { colorizationColor: DefaultStyle.main2_500_main anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: Math.round(10 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(10) imageSource: AppIcons.magnifier - width: Math.round(20 * DefaultStyle.dp) - height: Math.round(20 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(20) + height: Utils.getSizeWithScreenRatio(20) } Control.TextField { id: textField anchors.left: magnifier.visible ? magnifier.right : parent.left - anchors.leftMargin: magnifier.visible ? 0 : Math.round(10 * DefaultStyle.dp) + anchors.leftMargin: magnifier.visible ? 0 : Utils.getSizeWithScreenRatio(10) anchors.right: clearTextButton.left anchors.verticalCenter: parent.verticalCenter property bool keyboardFocus: FocusHelper.keyboardFocus @@ -96,7 +96,7 @@ FocusScope { cursorDelegate: Rectangle { visible: textField.cursorVisible color: DefaultStyle.main2_500_main - width: Math.max(Math.round(1 * DefaultStyle.dp), 1) + width: Utils.getSizeWithScreenRatio(1) } Timer{ id: delayTimer @@ -113,13 +113,13 @@ FocusScope { icon.source: AppIcons.dialer contentImageColor: checked ? DefaultStyle.main1_500_main : DefaultStyle.main2_600 hoveredImageColor: contentImageColor - width: Math.round(30 * DefaultStyle.dp) - height: Math.round(30* DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(30) + height: Utils.getSizeWithScreenRatio(30) icon.width: Utils.getSizeWithScreenRatio(24) icon.height: Utils.getSizeWithScreenRatio(24) anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - anchors.rightMargin: Math.round(20 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(20) //: "Open dialer" Accessible.name: qsTr("open_dialer_acccessibility_label") onClicked: { @@ -132,14 +132,14 @@ FocusScope { Button { id: clearTextButton visible: textField.text.length > 0 && mainItem.enabled - width: Math.round(24 * DefaultStyle.dp) - height: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(24) + height: Utils.getSizeWithScreenRatio(24) style: ButtonStyle.noBackground icon.source: AppIcons.closeX anchors.top: parent.top anchors.bottom: parent.bottom anchors.right: parent.right - anchors.rightMargin: Math.round(20 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(20) //: "Clear text input" Accessible.name: qsTr("clear_text_input_acccessibility_label") onClicked: { diff --git a/Linphone/view/Control/Input/TextArea.qml b/Linphone/view/Control/Input/TextArea.qml index 35434bdb3..19bde514f 100644 --- a/Linphone/view/Control/Input/TextArea.qml +++ b/Linphone/view/Control/Input/TextArea.qml @@ -3,6 +3,7 @@ import QtQuick.Controls.Basic as Control import QtQuick.Layouts import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils TextEdit { id: mainItem @@ -14,8 +15,8 @@ TextEdit { property alias background: background.data property bool hoverEnabled: true property bool hovered: mouseArea.hoverEnabled && mouseArea.containsMouse - topPadding: Math.round(5 * DefaultStyle.dp) - bottomPadding: Math.round(5 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(5) + bottomPadding: Utils.getSizeWithScreenRatio(5) activeFocusOnTab: true KeyNavigation.priority: KeyNavigation.BeforeItem diff --git a/Linphone/view/Control/Input/TextField.qml b/Linphone/view/Control/Input/TextField.qml index cebe5c836..d74079d83 100644 --- a/Linphone/view/Control/Input/TextField.qml +++ b/Linphone/view/Control/Input/TextField.qml @@ -9,7 +9,7 @@ import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle Control.TextField { id: mainItem property var customWidth - width: Math.round((customWidth ? customWidth - 1 : 360) * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(customWidth ? customWidth - 1 : 360) height: Utils.getSizeWithScreenRatio(49) leftPadding: Utils.getSizeWithScreenRatio(15) rightPadding: eyeButton.visible @@ -136,7 +136,7 @@ Control.TextField { cursorDelegate: Rectangle { id: cursor color: DefaultStyle.main1_500_main - width: Math.max(Utils.getSizeWithScreenRatio(1), 1) + width: Utils.getSizeWithScreenRatio(1) anchors.verticalCenter: mainItem.verticalCenter SequentialAnimation { diff --git a/Linphone/view/Control/Input/TimeComboBox.qml b/Linphone/view/Control/Input/TimeComboBox.qml index be2ae5310..d9067dd68 100644 --- a/Linphone/view/Control/Input/TimeComboBox.qml +++ b/Linphone/view/Control/Input/TimeComboBox.qml @@ -1,10 +1,11 @@ import QtQuick import Linphone -import UtilsCpp 1.0 - +import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + ComboBox { id: mainItem - indicatorRightMargin: Math.round(10 * DefaultStyle.dp) + indicatorRightMargin: Utils.getSizeWithScreenRatio(10) property var selectedDateTime onSelectedDateTimeChanged: { if (minTime != undefined) { @@ -22,10 +23,10 @@ ComboBox { property alias contentText: input property var minTime property var maxTime - popup.width: Math.round(73 * DefaultStyle.dp) + popup.width: Utils.getSizeWithScreenRatio(73) listView.model: 48 - listView.height: Math.min(Math.round(204 * DefaultStyle.dp), listView.contentHeight) - popup.height: Math.min(Math.round(204 * DefaultStyle.dp), listView.contentHeight) + listView.height: Math.min(Utils.getSizeWithScreenRatio(204), listView.contentHeight) + popup.height: Math.min(Utils.getSizeWithScreenRatio(204), listView.contentHeight) editable: true popup.closePolicy: Popup.PressOutsideParent | Popup.CloseOnPressOutside onCurrentTextChanged: input.text = currentText @@ -74,7 +75,7 @@ ComboBox { text: Qt.formatDateTime(currentDateTime, "hh:mm") width: mainItem.width visible: mainItem.minTime == undefined || UtilsCpp.timeOffset(mainItem.minTime, currentDateTime) > 0 - height: visible ? Math.round(25 * DefaultStyle.dp) : 0 + height: visible ? Utils.getSizeWithScreenRatio(25) : 0 verticalAlignment: TextInput.AlignVCenter horizontalAlignment: TextInput.AlignHCenter font { diff --git a/Linphone/view/Control/Popup/Dialog/AuthenticationDialog.qml b/Linphone/view/Control/Popup/Dialog/AuthenticationDialog.qml index 2327817fd..cd2cf2696 100644 --- a/Linphone/view/Control/Popup/Dialog/AuthenticationDialog.qml +++ b/Linphone/view/Control/Popup/Dialog/AuthenticationDialog.qml @@ -8,6 +8,7 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Dialog { id: mainItem @@ -17,11 +18,11 @@ Dialog { readonly property string password: passwordEdit.text property var callback// Define cb(var) function - topPadding:Math.round( 20 * DefaultStyle.dp) - bottomPadding:Math.round( 20 * DefaultStyle.dp) - leftPadding:Math.round( 20 * DefaultStyle.dp) - rightPadding:Math.round( 20 * DefaultStyle.dp) - width:Math.round( 637 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(20) + bottomPadding: Utils.getSizeWithScreenRatio(20) + leftPadding: Utils.getSizeWithScreenRatio(20) + rightPadding: Utils.getSizeWithScreenRatio(20) + width: Utils.getSizeWithScreenRatio(637) modal: true closePolicy: Popup.NoAutoClose @@ -33,11 +34,11 @@ Dialog { Component.onDestruction: if(callback) callback.destroy() content: ColumnLayout { - spacing:Math.round( 20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) id: contentLayout Text { Layout.fillWidth: true - Layout.preferredWidth:Math.round( 250 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(250) Layout.alignment: Qt.AlignHCenter horizontalAlignment: Text.AlignHCenter wrapMode: Text.Wrap @@ -50,13 +51,13 @@ Dialog { } Text { Layout.fillWidth: true - Layout.preferredWidth:Math.round( 250 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(250) Layout.alignment: Qt.AlignHCenter horizontalAlignment: Text.AlignHCenter wrapMode: Text.Wrap //: La connexion a échoué pour le compte %1. Vous pouvez renseigner votre mot de passe à nouveau ou bien vérifier les options de configuration de votre compte. text: qsTr("account_settings_dialog_invalid_password_message").arg(mainItem.identity) - font.pixelSize:Math.round( 16 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(16) font { pixelSize: Typography.h4.pixelSize weight: Typography.h4.weight @@ -80,7 +81,7 @@ Dialog { buttons: [ MediumButton { id: cancelButton - Layout.topMargin: Math.round( 10 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(10) //: "Annuler text: qsTr("cancel") style: ButtonStyle.secondary @@ -90,7 +91,7 @@ Dialog { }, MediumButton { id: connectButton - Layout.topMargin:Math.round( 10 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(10) //: Connexion text: qsTr("assistant_account_login") style: ButtonStyle.main diff --git a/Linphone/view/Control/Popup/Dialog/Dialog.qml b/Linphone/view/Control/Popup/Dialog/Dialog.qml index 0ee24b85d..d3a9a62f1 100644 --- a/Linphone/view/Control/Popup/Dialog/Dialog.qml +++ b/Linphone/view/Control/Popup/Dialog/Dialog.qml @@ -4,18 +4,19 @@ import QtQuick.Effects import QtQuick.Layouts import Linphone import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Popup { id: mainItem modal: true anchors.centerIn: parent closePolicy: Control.Popup.NoAutoClose - leftPadding: title.length === 0 ? Math.round(10 * DefaultStyle.dp) : Math.round(33 * DefaultStyle.dp) - rightPadding: title.length === 0 ? Math.round(10 * DefaultStyle.dp) : Math.round(33 * DefaultStyle.dp) - topPadding: title.length === 0 ? Math.round(10 * DefaultStyle.dp) : Math.round(37 * DefaultStyle.dp) - bottomPadding: title.length === 0 ? Math.round(10 * DefaultStyle.dp) : Math.round(37 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(title.length === 0 ? 10 : 33) + rightPadding: Utils.getSizeWithScreenRatio(title.length === 0 ? 10 : 33) + topPadding: Utils.getSizeWithScreenRatio(title.length === 0 ? 10 : 37) + bottomPadding: Utils.getSizeWithScreenRatio(title.length === 0 ? 10 : 37) underlineColor: DefaultStyle.main1_500_main - radius: title.length === 0 ? Math.round(16 * DefaultStyle.dp) : 0 + radius: title.length === 0 ? Utils.getSizeWithScreenRatio(16) : 0 property string title property var titleColor: DefaultStyle.main1_500_main property string text @@ -51,7 +52,7 @@ Popup { ColumnLayout { id: child anchors.fill: parent - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) Text{ id: titleText @@ -90,7 +91,7 @@ Popup { id: detailsText visible: text.length != 0 Layout.fillWidth: true - //Layout.preferredWidth: Math.round(278 * DefaultStyle.dp) + //Layout.preferredWidth: Utils.getSizeWithScreenRatio(278) Layout.alignment: Qt.AlignCenter text: mainItem.details font { @@ -111,7 +112,7 @@ Popup { RowLayout { id: buttonsLayout Layout.alignment: Qt.AlignBottom | ( titleText.visible ? Qt.AlignRight : Qt.AlignHCenter) - spacing: titleText.visible ? Math.round(20 * DefaultStyle.dp) : Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(titleText.visible ? 20 : 10) // Default buttons only visible if no other children // have been set diff --git a/Linphone/view/Control/Popup/Dialog/ZrtpAuthenticationDialog.qml b/Linphone/view/Control/Popup/Dialog/ZrtpAuthenticationDialog.qml index 22984da62..c20bcdbbe 100644 --- a/Linphone/view/Control/Popup/Dialog/ZrtpAuthenticationDialog.qml +++ b/Linphone/view/Control/Popup/Dialog/ZrtpAuthenticationDialog.qml @@ -5,15 +5,16 @@ import QtQuick.Effects import Linphone import UtilsCpp 1.0 import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= Dialog { id: mainItem - width: Math.round(436 * DefaultStyle.dp) - rightPadding: Math.round(0 * DefaultStyle.dp) - leftPadding: Math.round(0 * DefaultStyle.dp) - topPadding: Math.round(85 * DefaultStyle.dp) + Math.round(24 * DefaultStyle.dp) - bottomPadding: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(436) + rightPadding: Utils.getSizeWithScreenRatio(0) + leftPadding: Utils.getSizeWithScreenRatio(0) + topPadding: Utils.getSizeWithScreenRatio(85 + 24) + bottomPadding: Utils.getSizeWithScreenRatio(24) modal: true closePolicy: Popup.NoAutoClose @@ -39,10 +40,10 @@ Dialog { radius: mainItem.radius Layout.ColumnLayout { anchors.top: parent.top - anchors.topMargin: Math.round(18 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(18) anchors.horizontalCenter: parent.horizontalCenter Item { - // spacing: Math.round(14 * DefaultStyle.dp) + // spacing: Utils.getSizeWithScreenRatio(14) Layout.Layout.preferredWidth: childrenRect.width Layout.Layout.preferredHeight: childrenRect.height Layout.Layout.fillWidth: true @@ -50,19 +51,19 @@ Dialog { id: trustShield anchors.centerIn: parent source: AppIcons.trustedWhite - sourceSize.width: Math.round(24 * DefaultStyle.dp) - sourceSize.height: Math.round(24 * DefaultStyle.dp) - width: Math.round(24 * DefaultStyle.dp) - height: Math.round(24 * DefaultStyle.dp) + sourceSize.width: Utils.getSizeWithScreenRatio(24) + sourceSize.height: Utils.getSizeWithScreenRatio(24) + width: Utils.getSizeWithScreenRatio(24) + height: Utils.getSizeWithScreenRatio(24) } EffectImage { anchors.left: trustShield.right - anchors.leftMargin: Math.round(14 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(14) visible: mainItem.securityError imageSource: AppIcons.shieldWarning colorizationColor: DefaultStyle.main2_700 - width: Math.round(24 * DefaultStyle.dp) - height: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(24) + height: Utils.getSizeWithScreenRatio(24) } } Text { @@ -81,8 +82,8 @@ Dialog { visible: !mainItem.securityError anchors.top: parent.top anchors.right: parent.right - anchors.topMargin: Math.round(10 * DefaultStyle.dp) - anchors.rightMargin: Math.round(17 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(10) + anchors.rightMargin: Utils.getSizeWithScreenRatio(17) style: ButtonStyle.noBackground //: "Passer" text: qsTr("call_zrtp_sas_validation_skip") @@ -99,9 +100,9 @@ Dialog { Rectangle { z: 1 width: mainItem.width - height: parent.height - Math.round(85 * DefaultStyle.dp) + height: Math.round(parent.height - Utils.getSizeWithScreenRatio(85)) x: parent.x - y: parent.y + Math.round(85 * DefaultStyle.dp) + y: Math.round(parent.y + Utils.getSizeWithScreenRatio(85)) color: DefaultStyle.grey_0 radius: mainItem.radius } @@ -118,14 +119,14 @@ Dialog { content: [ Layout.ColumnLayout { visible: !mainItem.securityError - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) Layout.Layout.alignment: Qt.AlignHCenter Layout.Layout.fillWidth: true Layout.ColumnLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Layout.Layout.alignment: Qt.AlignHCenter Text { - Layout.Layout.preferredWidth: Math.round(343 * DefaultStyle.dp) + Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(343) Layout.Layout.alignment: Qt.AlignHCenter horizontalAlignment: Text.AlignHCenter text: !mainItem.isTokenVerified && mainItem.isCaseMismatch @@ -134,7 +135,7 @@ Dialog { //: "Pour garantir le chiffrement, nous avons besoin d’authentifier l’appareil de votre correspondant. Veuillez échanger vos codes : " : qsTr("call_dialog_zrtp_validate_trust_message") wrapMode: Text.WordWrap - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) } Layout.ColumnLayout { spacing: 0 @@ -144,7 +145,7 @@ Dialog { text: qsTr("call_dialog_zrtp_validate_trust_local_code_label") horizontalAlignment: Text.AlignHCenter Layout.Layout.alignment: Qt.AlignHCenter - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) } Text { text: mainItem.call && mainItem.call.core.localToken || "" @@ -160,18 +161,18 @@ Dialog { Rectangle { color: "transparent" border.color: DefaultStyle.main2_200 - border.width: Math.max(1, Math.round(1 * DefaultStyle.dp)) - radius: Math.round(15 * DefaultStyle.dp) - Layout.Layout.preferredWidth: Math.round(292 * DefaultStyle.dp) - Layout.Layout.preferredHeight: Math.round(233 * DefaultStyle.dp) + border.width: Utils.getSizeWithScreenRatio(1) + radius: Utils.getSizeWithScreenRatio(15) + Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(292) + Layout.Layout.preferredHeight: Utils.getSizeWithScreenRatio(233) Layout.Layout.alignment: Qt.AlignHCenter Layout.ColumnLayout { anchors.fill: parent - anchors.topMargin: Math.round(10 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(10) Text { //: "Code correspondant :" text: qsTr("call_dialog_zrtp_validate_trust_remote_code_label") - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) Layout.Layout.alignment: Qt.AlignHCenter } Layout.GridLayout { @@ -179,23 +180,23 @@ Dialog { Layout.Layout.alignment: Qt.AlignHCenter rows: 2 columns: 2 - rowSpacing: Math.round(32 * DefaultStyle.dp) - columnSpacing: Math.round(32 * DefaultStyle.dp) + rowSpacing: Utils.getSizeWithScreenRatio(32) + columnSpacing: Utils.getSizeWithScreenRatio(32) property var correctIndex property var modelList Repeater { model: mainItem.call && mainItem.call.core.remoteTokens || "" Button { - Layout.Layout.preferredWidth: Math.round(70 * DefaultStyle.dp) - Layout.Layout.preferredHeight: Math.round(70 * DefaultStyle.dp) - width: Math.round(70 * DefaultStyle.dp) - height: Math.round(70 * DefaultStyle.dp) + Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(70) + Layout.Layout.preferredHeight: Utils.getSizeWithScreenRatio(70) + width: Utils.getSizeWithScreenRatio(70) + height: Utils.getSizeWithScreenRatio(70) color: DefaultStyle.grey_0 - textSize: Math.round(32 * DefaultStyle.dp) - textWeight: Math.round(400 * DefaultStyle.dp) + textSize: Utils.getSizeWithScreenRatio(32) + textWeight: Utils.getSizeWithScreenRatio(400) text: modelData shadowEnabled: true - radius: Math.round(71 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(71) textColor: DefaultStyle.main2_600 onClicked: { console.log("CHECK TOKEN", modelData) @@ -212,26 +213,26 @@ Dialog { spacing: 0 Text { - width: Math.round(303 * DefaultStyle.dp) - // Layout.Layout.preferredWidth: Math.round(343 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(303) + // Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(343) Layout.Layout.alignment: Qt.AlignHCenter Layout.Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter //: "Le code fourni ne correspond pas." text: qsTr("call_dialog_zrtp_validate_trust_letters_do_not_match_text") wrapMode: Text.WordWrap - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) } Text { - width: Math.round(303 * DefaultStyle.dp) - // Layout.Layout.preferredWidth: Math.round(343 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(303) + // Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(343) Layout.Layout.alignment: Qt.AlignHCenter Layout.Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter //: "La confidentialité de votre appel peut être compromise !" text: qsTr("call_dialog_zrtp_security_alert_message") wrapMode: Text.WordWrap - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) } } ] @@ -240,7 +241,7 @@ Dialog { Layout.Layout.alignment: Qt.AlignHCenter MediumButton { Layout.Layout.alignment: Qt.AlignHCenter - Layout.Layout.preferredWidth: Math.round(247 * DefaultStyle.dp) + Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(247) //: "Aucune correspondance" text: qsTr("call_dialog_zrtp_validate_trust_letters_do_not_match") color: DefaultStyle.grey_0 @@ -252,12 +253,12 @@ Dialog { } } MediumButton { - Layout.Layout.preferredWidth: Math.round(247 * DefaultStyle.dp) + Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(247) Layout.Layout.alignment: Qt.AlignHCenter visible: mainItem.securityError style: ButtonStyle.phoneRed onClicked: mainItem.call.core.lTerminate() - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) //: "Raccrocher" text: qsTr("call_action_hang_up") } diff --git a/Linphone/view/Control/Popup/InformationPopup.qml b/Linphone/view/Control/Popup/InformationPopup.qml index 72ec9986b..84f6d2c03 100644 --- a/Linphone/view/Control/Popup/InformationPopup.qml +++ b/Linphone/view/Control/Popup/InformationPopup.qml @@ -3,6 +3,7 @@ import QtQuick.Layouts import QtQuick.Controls.Basic import Linphone import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Popup { id: mainItem @@ -18,9 +19,9 @@ Popup { closePolicy: Popup.NoAutoClose x : parent.x + parent.width - width // y : parent.y + parent.height - height - rightMargin: Math.round(20 * DefaultStyle.dp) - bottomMargin: Math.round(20 * DefaultStyle.dp) - padding: Math.round(20 * DefaultStyle.dp) + rightMargin: Utils.getSizeWithScreenRatio(20) + bottomMargin: Utils.getSizeWithScreenRatio(20) + padding: Utils.getSizeWithScreenRatio(20) underlineColor: mainItem.isSuccess ? DefaultStyle.success_500_main : DefaultStyle.danger_500_main radius: 0 focus: true @@ -37,24 +38,24 @@ Popup { } } contentItem: RowLayout { - spacing: Math.round(24 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(24) Accessible.role: Accessible.AlertMessage Accessible.name: "%1, %2".arg(mainItem.title).arg(mainItem.description) EffectImage { imageSource: mainItem.isSuccess ? AppIcons.smiley : AppIcons.smileySad colorizationColor: mainItem.isSuccess ? DefaultStyle.success_500_main : DefaultStyle.danger_500_main - Layout.preferredWidth: Math.round(32 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(32 * DefaultStyle.dp) - width: Math.round(32 * DefaultStyle.dp) - height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) + width: Utils.getSizeWithScreenRatio(32) + height: Utils.getSizeWithScreenRatio(32) } Rectangle { - Layout.preferredWidth: Math.max(Math.round(1 * DefaultStyle.dp), 1) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(1) Layout.preferredHeight: parent.height color: DefaultStyle.main2_200 } ColumnLayout { - spacing: Math.round(2 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(2) RowLayout { spacing: 0 Text { @@ -67,10 +68,10 @@ Popup { } } Button { - Layout.preferredWidth: Math.round(20 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(20 * DefaultStyle.dp) - icon.width: Math.round(20 * DefaultStyle.dp) - icon.height: Math.round(20 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + icon.width: Utils.getSizeWithScreenRatio(20) + icon.height: Utils.getSizeWithScreenRatio(20) Layout.alignment: Qt.AlignTop | Qt.AlignRight visible: mainItem.hovered || hovered style: ButtonStyle.noBackground @@ -81,13 +82,13 @@ Popup { Text { Layout.alignment: Qt.AlignHCenter Layout.fillWidth: true - Layout.maximumWidth: Math.round(300 * DefaultStyle.dp) + Layout.maximumWidth: Utils.getSizeWithScreenRatio(300) text: mainItem.description wrapMode: Text.WordWrap color: DefaultStyle.main2_500_main font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } diff --git a/Linphone/view/Control/Popup/Loading/LoadingPopup.qml b/Linphone/view/Control/Popup/Loading/LoadingPopup.qml index b7a7c24e8..ded7f22e1 100644 --- a/Linphone/view/Control/Popup/Loading/LoadingPopup.qml +++ b/Linphone/view/Control/Popup/Loading/LoadingPopup.qml @@ -3,6 +3,7 @@ import QtQuick.Layouts import QtQuick.Controls.Basic import Linphone import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Popup { id: mainItem @@ -12,18 +13,18 @@ Popup { modal: true closePolicy: Control.Popup.NoAutoClose anchors.centerIn: parent - padding: Math.round(20 * DefaultStyle.dp) + padding: Utils.getSizeWithScreenRatio(20) underlineColor: DefaultStyle.main1_500_main - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) // onAboutToShow: width = contentText.implicitWidth contentItem: ColumnLayout { - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) // width: childrenRect.width // height: childrenRect.height BusyIndicator{ Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: Math.round(33 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(33 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(33) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(33) } Text { id: contentText @@ -31,7 +32,7 @@ Popup { Layout.fillWidth: true Layout.fillHeight: true text: mainItem.text - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) } MediumButton { visible: mainItem.cancelButtonVisible diff --git a/Linphone/view/Control/Popup/Notification/Notification.qml b/Linphone/view/Control/Popup/Notification/Notification.qml index b7b4bd700..c18fd5dbf 100644 --- a/Linphone/view/Control/Popup/Notification/Notification.qml +++ b/Linphone/view/Control/Popup/Notification/Notification.qml @@ -1,6 +1,7 @@ import QtQuick import QtQuick.Effects import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= @@ -11,8 +12,8 @@ DesktopPopup { property var notificationData: ({ timelineModel : null }) - property real overriddenHeight: Math.round(120 * DefaultStyle.dp) - property real overriddenWidth: Math.round(300 * DefaultStyle.dp) + property real overriddenHeight: Utils.getSizeWithScreenRatio(120) + property real overriddenWidth: Utils.getSizeWithScreenRatio(300) property double radius: 0 property color backgroundColor: DefaultStyle.grey_0 property double backgroundOpacity: 1 @@ -56,7 +57,7 @@ DesktopPopup { opacity: mainItem.backgroundOpacity // border { // color: DefaultStyle.grey_400 - // width: Math.round(1 * DefaultStyle.dp) + // width: Utils.getSizeWithScreenRatio(1) // } } MultiEffect { diff --git a/Linphone/view/Control/Popup/Notification/NotificationReceivedCall.qml b/Linphone/view/Control/Popup/Notification/NotificationReceivedCall.qml index d5966ded6..94b00a46a 100644 --- a/Linphone/view/Control/Popup/Notification/NotificationReceivedCall.qml +++ b/Linphone/view/Control/Popup/Notification/NotificationReceivedCall.qml @@ -3,15 +3,16 @@ import QtQuick.Layouts import Linphone import UtilsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= Notification { id: mainItem - radius: Math.round(10 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(10) backgroundColor: DefaultStyle.grey_600 backgroundOpacity: 0.8 - overriddenWidth: Math.round(400 * DefaultStyle.dp) + overriddenWidth: Utils.getSizeWithScreenRatio(400) overriddenHeight: content.height readonly property var call: notificationData && notificationData.call @@ -32,41 +33,41 @@ Notification { Popup { id: content visible: mainItem.visible - leftPadding: Math.round(32 * DefaultStyle.dp) - rightPadding: Math.round(32 * DefaultStyle.dp) - topPadding: Math.round(9 * DefaultStyle.dp) - bottomPadding: Math.round(18 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(32) + rightPadding: Utils.getSizeWithScreenRatio(32) + topPadding: Utils.getSizeWithScreenRatio(9) + bottomPadding: Utils.getSizeWithScreenRatio(18) anchors.centerIn: parent background: Item{} contentItem: ColumnLayout { anchors.verticalCenter: parent.verticalCenter - spacing: Math.round(9 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(9) RowLayout { - spacing: Math.round(4 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(4) Layout.alignment: Qt.AlignHCenter Image { - Layout.preferredWidth: Math.round(12 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(12 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(12) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(12) source: AppIcons.logo } Text { text: "Linphone" color: DefaultStyle.grey_0 font { - pixelSize: Math.round(12 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) weight: Typography.b3.weight capitalization: Font.Capitalize } } } ColumnLayout { - spacing: Math.round(17 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(17) ColumnLayout { - spacing: Math.round(14 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(14) Layout.alignment: Qt.AlignHCenter Avatar { - Layout.preferredWidth: Math.round(60 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(60 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(60) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(60) Layout.alignment: Qt.AlignHCenter call: mainItem.call displayNameVal: mainItem.displayName @@ -84,7 +85,7 @@ Notification { maximumLineCount: 1 color: DefaultStyle.grey_0 font { - pixelSize: Math.round(20 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(20) weight: Typography.b3.weight capitalization: Font.Capitalize } @@ -95,8 +96,8 @@ Notification { Layout.alignment: Qt.AlignHCenter color: DefaultStyle.grey_0 font { - pixelSize: Math.round(14 * DefaultStyle.dp) - weight: Math.round(500 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(14) + weight: Utils.getSizeWithScreenRatio(500) } } } @@ -104,19 +105,19 @@ Notification { RowLayout { Layout.alignment: Qt.AlignHCenter Layout.fillWidth: true - spacing: Math.round(26 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(26) Button { - spacing: Math.round(6 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(6) style: ButtonStyle.phoneGreen - Layout.preferredWidth: Math.round(118 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(118) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) asynchronous: false - icon.width: Math.round(19 * DefaultStyle.dp) - icon.height: Math.round(19 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(19) + icon.height: Utils.getSizeWithScreenRatio(19) //: "Accepter" text: qsTr("dialog_accept") - textSize: Math.round(14 * DefaultStyle.dp) - textWeight: Math.round(500 * DefaultStyle.dp) + textSize: Utils.getSizeWithScreenRatio(14) + textWeight: Utils.getSizeWithScreenRatio(500) onClicked: { console.debug("[NotificationReceivedCall] Accept click") UtilsCpp.openCallsWindow(mainItem.call) @@ -124,17 +125,17 @@ Notification { } } Button { - spacing: Math.round(6 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(6) style: ButtonStyle.phoneRed - Layout.preferredWidth: Math.round(118 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(118) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) asynchronous: false - icon.width: Math.round(19 * DefaultStyle.dp) - icon.height: Math.round(19 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(19) + icon.height: Utils.getSizeWithScreenRatio(19) //: "Refuser text: qsTr("dialog_deny") - textSize: Math.round(14 * DefaultStyle.dp) - textWeight: Math.round(500 * DefaultStyle.dp) + textSize: Utils.getSizeWithScreenRatio(14) + textWeight: Utils.getSizeWithScreenRatio(500) onClicked: { console.debug("[NotificationReceivedCall] Decline click") mainItem.call.core.lDecline() diff --git a/Linphone/view/Control/Popup/Notification/NotificationReceivedMessage.qml b/Linphone/view/Control/Popup/Notification/NotificationReceivedMessage.qml index 9b248b3e5..a5a8a5484 100644 --- a/Linphone/view/Control/Popup/Notification/NotificationReceivedMessage.qml +++ b/Linphone/view/Control/Popup/Notification/NotificationReceivedMessage.qml @@ -4,15 +4,16 @@ import Linphone import UtilsCpp import QtQuick.Controls as Control import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= Notification { id: mainItem - radius: Math.round(10 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(10) backgroundColor: DefaultStyle.grey_600 backgroundOpacity: 0.8 - overriddenWidth: Math.round(400 * DefaultStyle.dp) + overriddenWidth: Utils.getSizeWithScreenRatio(400) overriddenHeight: content.height property var chat: notificationData ? notificationData.chat : null @@ -35,27 +36,27 @@ Notification { id: content visible: mainItem.visible width: parent.width - leftPadding: Math.round(18 * DefaultStyle.dp) - rightPadding: Math.round(18 * DefaultStyle.dp) - topPadding: Math.round(32 * DefaultStyle.dp) - bottomPadding: Math.round(18 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(18) + rightPadding: Utils.getSizeWithScreenRatio(18) + topPadding: Utils.getSizeWithScreenRatio(32) + bottomPadding: Utils.getSizeWithScreenRatio(18) background: Item { anchors.fill: parent RowLayout { anchors.top: parent.top - anchors.topMargin: Math.round(9 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(9) anchors.horizontalCenter: parent.horizontalCenter - spacing: Math.round(4 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(4) Image { - Layout.preferredWidth: Math.round(12 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(12 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(12) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(12) source: AppIcons.logo } Text { text: "Linphone" color: DefaultStyle.grey_0 font { - pixelSize: Math.round(12 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) weight: Typography.b3.weight capitalization: Font.Capitalize } @@ -64,16 +65,16 @@ Notification { Button { anchors.top: parent.top anchors.right: parent.right - anchors.topMargin: Math.round(9 * DefaultStyle.dp) - anchors.rightMargin: Math.round(12 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(9) + anchors.rightMargin: Utils.getSizeWithScreenRatio(12) padding: 0 z: mousearea.z + 1 background: Item{anchors.fill: parent} icon.source: AppIcons.closeX - width: Math.round(14 * DefaultStyle.dp) - height: Math.round(14 * DefaultStyle.dp) - icon.width: Math.round(14 * DefaultStyle.dp) - icon.height: Math.round(14 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(14) + height: Utils.getSizeWithScreenRatio(14) + icon.width: Utils.getSizeWithScreenRatio(14) + icon.height: Utils.getSizeWithScreenRatio(14) contentImageColor: DefaultStyle.grey_0 onPressed: { mainItem.close() @@ -89,12 +90,12 @@ Notification { } } contentItem: ColumnLayout { - spacing: Math.round(9 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(9) RowLayout { - spacing: Math.round(14 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(14) Avatar { - Layout.preferredWidth: Math.round(60 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(60 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(60) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(60) // Layout.alignment: Qt.AlignHCenter property var contactObj: UtilsCpp.findFriendByAddress(mainItem.remoteAddress) contact: contactObj?.value || null diff --git a/Linphone/view/Control/Popup/Notification/TemporaryNotification.qml b/Linphone/view/Control/Popup/Notification/TemporaryNotification.qml index b1581a7ec..adff66bb5 100644 --- a/Linphone/view/Control/Popup/Notification/TemporaryNotification.qml +++ b/Linphone/view/Control/Popup/Notification/TemporaryNotification.qml @@ -1,16 +1,17 @@ import QtQuick import QtQuick.Effects import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.Control { id: mainItem - // width: Math.round(269 * DefaultStyle.dp) + // width: Utils.getSizeWithScreenRatio(269) y: -height z: 1 - topPadding: Math.round(8 * DefaultStyle.dp) - bottomPadding: Math.round(8 * DefaultStyle.dp) - leftPadding: Math.round(37 * DefaultStyle.dp) - rightPadding: Math.round(37 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(8) + bottomPadding: Utils.getSizeWithScreenRatio(8) + leftPadding: Utils.getSizeWithScreenRatio(37) + rightPadding: Utils.getSizeWithScreenRatio(37) anchors.horizontalCenter: parent.horizontalCenter clip: true @@ -41,15 +42,15 @@ Control.Control { anchors.fill: parent color: DefaultStyle.grey_0 border.color: mainItem.contentColor - border.width: Math.max(Math.round(1 * DefaultStyle.dp), 1) - radius: Math.round(50 * DefaultStyle.dp) + border.width: Utils.getSizeWithScreenRatio(1) + radius: Utils.getSizeWithScreenRatio(50) } contentItem: RowLayout { Image { visible: mainItem.imageSource != undefined source: mainItem.imageSource - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) fillMode: Image.PreserveAspectFit Layout.fillWidth: true } @@ -58,7 +59,7 @@ Control.Control { text: mainItem.text Layout.fillWidth: true font { - pixelSize: Math.round(14 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(14) } } } diff --git a/Linphone/view/Control/Popup/NumericPadPopup.qml b/Linphone/view/Control/Popup/NumericPadPopup.qml index 428e53bd4..65fce495e 100644 --- a/Linphone/view/Control/Popup/NumericPadPopup.qml +++ b/Linphone/view/Control/Popup/NumericPadPopup.qml @@ -5,14 +5,15 @@ import QtQuick.Effects import Linphone import UtilsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.Popup { id: mainItem closePolicy: Control.Popup.CloseOnEscape - leftPadding: Math.round(72 * DefaultStyle.dp) - rightPadding: Math.round(72 * DefaultStyle.dp) - topPadding: Math.round(41 * DefaultStyle.dp) - bottomPadding: Math.round(18 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(72) + rightPadding: Utils.getSizeWithScreenRatio(72) + topPadding: Utils.getSizeWithScreenRatio(41) + bottomPadding: Utils.getSizeWithScreenRatio(18) property bool closeButtonVisible: true property bool roundedBottom: false property bool lastRowVisible: true @@ -29,7 +30,7 @@ Control.Popup { width: parent.width height: parent.height color: DefaultStyle.grey_100 - radius: Math.round(20 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(20) } MultiEffect { id: effect @@ -57,11 +58,11 @@ Control.Popup { visible: mainItem.closeButtonVisible anchors.top: parent.top anchors.right: parent.right - anchors.topMargin: Math.round(10 * DefaultStyle.dp) - anchors.rightMargin: Math.round(10 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(10) + anchors.rightMargin: Utils.getSizeWithScreenRatio(10) icon.source: AppIcons.closeX - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) style: ButtonStyle.noBackground onClicked: mainItem.close() } diff --git a/Linphone/view/Control/Popup/Popup.qml b/Linphone/view/Control/Popup/Popup.qml index 658f3ff45..20cd4f665 100644 --- a/Linphone/view/Control/Popup/Popup.qml +++ b/Linphone/view/Control/Popup/Popup.qml @@ -3,12 +3,13 @@ import QtQuick.Controls.Basic as Control import QtQuick.Effects import Linphone import CustomControls 1.0 +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.Popup{ id: mainItem padding: 0 property color underlineColor : DefaultStyle.main1_500_main - property real radius: Math.round(16 * DefaultStyle.dp) + property real radius: Utils.getSizeWithScreenRatio(16) property bool hovered: mouseArea.containsMouse property bool keyboardFocus: FocusHelper.keyboardFocus @@ -16,7 +17,7 @@ Control.Popup{ Rectangle { visible: mainItem.underlineColor != undefined width: mainItem.width - height: mainItem.height + Math.round(2 * DefaultStyle.dp) + height: mainItem.height +Utils.getSizeWithScreenRatio(2) color: mainItem.underlineColor radius: mainItem.radius } diff --git a/Linphone/view/Control/Tool/Helper/utils.js b/Linphone/view/Control/Tool/Helper/utils.js index d1c1d0cd5..79011e8a7 100644 --- a/Linphone/view/Control/Tool/Helper/utils.js +++ b/Linphone/view/Control/Tool/Helper/utils.js @@ -871,10 +871,9 @@ function codepointFromFilename(filename) { // ----------------------------------------------------------------------------- function getSizeWithScreenRatio(size){ - if (size == 0) { - return size; - } - return size > 0 - ? Math.max(Math.round(size * Linphone.DefaultStyle.dp), 1) - : Math.min(Math.round(size * Linphone.DefaultStyle.dp), -1); + return (size == 0) + ? 0 + : size > 0 + ? Math.max(Math.round(size * Linphone.DefaultStyle.dp), 1) + : Math.min(Math.round(size * Linphone.DefaultStyle.dp), -1); } \ No newline at end of file diff --git a/Linphone/view/Control/Tool/Prototype/CallPrototype.qml b/Linphone/view/Control/Tool/Prototype/CallPrototype.qml index f6a31244b..5553271db 100644 --- a/Linphone/view/Control/Tool/Prototype/CallPrototype.qml +++ b/Linphone/view/Control/Tool/Prototype/CallPrototype.qml @@ -3,6 +3,7 @@ import QtQuick.Layouts import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // Snippet Window { @@ -129,7 +130,7 @@ Window { TextField { id: usernameToCall label: "Username to call" - Layout.preferredWidth: Math.round(250 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(250) } Button{ text: 'Call' diff --git a/Linphone/view/Page/Form/Chat/SelectedChatView.qml b/Linphone/view/Page/Form/Chat/SelectedChatView.qml index b3ef4e6a1..ab8826e3e 100644 --- a/Linphone/view/Page/Form/Chat/SelectedChatView.qml +++ b/Linphone/view/Page/Form/Chat/SelectedChatView.qml @@ -8,6 +8,7 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils FocusScope { id: mainItem @@ -70,27 +71,27 @@ FocusScope { panelColor: DefaultStyle.grey_0 header.visible: !mainItem.call clip: true - header.leftPadding: Math.round(32 * DefaultStyle.dp) - header.rightPadding: Math.round(32 * DefaultStyle.dp) - header.topPadding: Math.round(6 * DefaultStyle.dp) - header.bottomPadding: searchBarLayout.visible ? Math.round(3 * DefaultStyle.dp) : Math.round(6 * DefaultStyle.dp) + header.leftPadding: Utils.getSizeWithScreenRatio(32) + header.rightPadding: Utils.getSizeWithScreenRatio(32) + header.topPadding: Utils.getSizeWithScreenRatio(6) + header.bottomPadding: Utils.getSizeWithScreenRatio(searchBarLayout.visible ? 3 : 6) header.contentItem: ColumnLayout { Layout.fillWidth: true - Layout.leftMargin: mainItem.call ? 0 : Math.round(31 * DefaultStyle.dp) - Layout.rightMargin: Math.round(41 * DefaultStyle.dp) - spacing: searchBarLayout.visible ? Math.round(9 * DefaultStyle.dp) : 0 + Layout.leftMargin: mainItem.call ? 0 : Utils.getSizeWithScreenRatio(31) + Layout.rightMargin: Utils.getSizeWithScreenRatio(41) + spacing: searchBarLayout.visible ? Utils.getSizeWithScreenRatio(9) : 0 RowLayout { RowLayout { id: chatHeader - spacing: Math.round(12 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(12) Avatar { property var contactObj: mainItem.chat ? UtilsCpp.findFriendByAddress(mainItem.chat?.core.peerAddress) : null contact: contactObj?.value || null displayNameVal: mainItem.chat?.core.avatarUri secured: mainItem.chat && mainItem.chat.core.isSecured - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) } Text { text: mainItem.chat?.core.title || "" @@ -98,16 +99,16 @@ FocusScope { maximumLineCount: 1 font { pixelSize: Typography.h4.pixelSize - weight: Math.round(400 * DefaultStyle.dp) + weight: Utils.getSizeWithScreenRatio(400) capitalization: Font.Capitalize } } RowLayout { visible: mainItem.chat != undefined && mainItem.chat.core.isBasic - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { - Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 - Layout.preferredHeight: 14 * DefaultStyle.dp + Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) colorizationColor: DefaultStyle.warning_700 imageSource: AppIcons.lockSimpleOpen } @@ -124,16 +125,16 @@ FocusScope { } EffectImage { visible: mainItem.chat?.core.muted || false - Layout.preferredWidth: 20 * DefaultStyle.dp + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) Layout.alignment: Qt.AlignVCenter - Layout.preferredHeight: 20 * DefaultStyle.dp + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) colorizationColor: DefaultStyle.main1_500_main imageSource: AppIcons.bellSlash } } Item{Layout.fillWidth: true} RowLayout { - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) RoundButton { visible: !mainItem.call style: ButtonStyle.noBackground @@ -185,8 +186,8 @@ FocusScope { if(!visible) chatMessagesSearchBar.clearText() else chatMessagesSearchBar.forceActiveFocus() } - spacing: Math.round(50 * DefaultStyle.dp) - height: Math.round(65 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(50) + height: Utils.getSizeWithScreenRatio(65) Connections { target: mainItem function onChatChanged() {searchBarLayout.visible = false} @@ -194,7 +195,7 @@ FocusScope { SearchBar { id: chatMessagesSearchBar Layout.fillWidth: true - Layout.rightMargin: Math.round(10 * DefaultStyle.dp) + Layout.rightMargin: Utils.getSizeWithScreenRatio(10) property ChatMessageGui messageFound delaySearch: false Keys.onPressed: (event) => { @@ -217,7 +218,7 @@ FocusScope { } } RowLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) RoundButton { icon.source: AppIcons.upArrow style: ButtonStyle.noBackground @@ -241,7 +242,7 @@ FocusScope { } RoundButton { icon.source: AppIcons.closeX - Layout.rightMargin: Math.round(20 * DefaultStyle.dp) + Layout.rightMargin: Utils.getSizeWithScreenRatio(20) onClicked: { chatMessagesListView.filterText = "" searchBarLayout.visible = false @@ -257,7 +258,7 @@ FocusScope { handle: Rectangle { visible: !mainItem.chat?.core.isReadOnly enabled: visible - implicitHeight: Math.round(8 * DefaultStyle.dp) + implicitHeight: Utils.getSizeWithScreenRatio(8) color: Control.SplitHandle.hovered ? DefaultStyle.grey_200 : DefaultStyle.grey_100 } ColumnLayout { @@ -273,8 +274,8 @@ FocusScope { width: parent.width - anchors.leftMargin - anchors.rightMargin chat: mainItem.chat anchors.fill: parent - anchors.leftMargin: Math.round(18 * DefaultStyle.dp) - anchors.rightMargin: Math.round(18 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(18) + anchors.rightMargin: Utils.getSizeWithScreenRatio(18) Control.ScrollBar.vertical: scrollbar onShowReactionsForMessageRequested: (chatMessage) => { mainItem.chatMessage = chatMessage @@ -303,13 +304,13 @@ FocusScope { anchors.top: chatMessagesListView.top anchors.bottom: chatMessagesListView.bottom anchors.right: parent.right - anchors.rightMargin: Math.round(5 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(5) policy: Control.ScrollBar.AsNeeded } Control.Control { id: participantListPopup width: parent.width - height: Math.min(participantInfoList.height, Math.round(200 * DefaultStyle.dp)) + height: Math.min(participantInfoList.height, Utils.getSizeWithScreenRatio(200)) visible: false anchors.bottom: chatMessagesListView.bottom anchors.left: chatMessagesListView.left @@ -323,7 +324,7 @@ FocusScope { anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top - radius: Math.round(20 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(20) height: parent.height } MultiEffect { @@ -360,10 +361,10 @@ FocusScope { visible: selectedFiles.count > 0 || mainItem.replyingToMessage Layout.fillWidth: true Layout.preferredHeight: implicitHeight - topPadding: Math.round(12 * DefaultStyle.dp) - bottomPadding: Math.round(12 * DefaultStyle.dp) - leftPadding: Math.round(19 * DefaultStyle.dp) - rightPadding: Math.round(19 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(12) + bottomPadding: Utils.getSizeWithScreenRatio(12) + leftPadding: Utils.getSizeWithScreenRatio(19) + rightPadding: Utils.getSizeWithScreenRatio(19) Button { anchors.top: parent.top @@ -382,7 +383,7 @@ FocusScope { Rectangle { color: DefaultStyle.grey_0 border.color: DefaultStyle.main2_100 - border.width: Math.round(2 * DefaultStyle.dp) + border.width: Utils.getSizeWithScreenRatio(2) height: parent.height / 2 anchors.top: parent.top anchors.left: parent.left @@ -396,7 +397,7 @@ FocusScope { } } contentItem: ColumnLayout { - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) ColumnLayout { id: replyLayout spacing: 0 @@ -425,38 +426,38 @@ FocusScope { Layout.fillWidth: true visible: replyLayout.visible && selectedFiles.visible color: DefaultStyle.main2_300 - Layout.preferredHeight: Math.max(1, Math.round(1 * DefaultStyle.dp)) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) } ListView { id: selectedFiles orientation: ListView.Horizontal visible: count > 0 - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) Layout.fillWidth: true - Layout.preferredHeight: Math.round(104 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(104) model: ChatMessageContentProxy { id: contents filterType: ChatMessageContentProxy.FilterContentType.File } delegate: Item { - width: Math.round(80 * DefaultStyle.dp) - height: Math.round(80 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(80) + height: Utils.getSizeWithScreenRatio(80) FileView { contentGui: modelData anchors.left: parent.left anchors.bottom: parent.bottom - width: Math.round(69 * DefaultStyle.dp) - height: Math.round(69 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(69) + height: Utils.getSizeWithScreenRatio(69) } RoundButton { icon.source: AppIcons.closeX - icon.width: Math.round(12 * DefaultStyle.dp) - icon.height: Math.round(12 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(12) + icon.height: Utils.getSizeWithScreenRatio(12) anchors.top: parent.top anchors.right: parent.right style: ButtonStyle.numericPad shadowEnabled: true - padding: Math.round(3 * DefaultStyle.dp) + padding: Utils.getSizeWithScreenRatio(3) onClicked: contents.removeContent(modelData) } } @@ -475,7 +476,7 @@ FocusScope { ChatDroppableTextArea { id: messageSender Control.SplitView.preferredHeight: mainItem.chat?.core.isReadOnly ? 0 : height - Control.SplitView.minimumHeight: mainItem.chat?.core.isReadOnly ? 0 : Math.round(79 * DefaultStyle.dp) + Control.SplitView.minimumHeight: mainItem.chat?.core.isReadOnly ? 0 : Utils.getSizeWithScreenRatio(79) chat: mainItem.chat selectedFilesCount: contents.count callOngoing: mainItem.call != null @@ -511,14 +512,14 @@ FocusScope { Rectangle { visible: detailsPanel.visible color: DefaultStyle.main2_200 - Layout.preferredWidth: Math.round(1 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(1) Layout.fillHeight: true } Control.Control { id: detailsPanel visible: false Layout.fillHeight: true - Layout.preferredWidth: Math.round(387 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(387) onVisibleChanged: if(!visible) { contentLoader.panelType = SelectedChatView.PanelType.None } @@ -533,8 +534,8 @@ FocusScope { property int panelType: SelectedChatView.PanelType.None // anchors.top: parent.top anchors.fill: parent - anchors.topMargin: Math.round(39 * DefaultStyle.dp) - anchors.rightMargin: Math.round(15 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(39) + anchors.rightMargin: Utils.getSizeWithScreenRatio(15) sourceComponent: panelType === SelectedChatView.PanelType.EphemeralSettings ? ephemeralSettingsComponent : panelType === SelectedChatView.PanelType.MessageReactions @@ -643,7 +644,7 @@ FocusScope { mainItem.chatMessage = null } content: ColumnLayout { - spacing: Math.round(31 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(31) SearchBar { id: forwardSearchBar Layout.fillWidth: true @@ -655,7 +656,7 @@ FocusScope { // width: parent.width // Control.ScrollBar.vertical: ScrollBar { // id: scrollbar - // topPadding: Math.round(24 * DefaultStyle.dp) // Avoid to be on top of collapse button + // topPadding: Utils.getSizeWithScreenRatio(24) // Avoid to be on top of collapse button // active: true // interactive: true // visible: parent.contentHeight > parent.height @@ -664,8 +665,8 @@ FocusScope { ColumnLayout { anchors.left: parent.left anchors.right: parent.right - spacing: Math.round(8 * DefaultStyle.dp) - // width: parent.width //- scrollbar.width - Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) + // width: parent.width //- scrollbar.width - Utils.getSizeWithScreenRatio(5) RowLayout { Text { //: Conversations diff --git a/Linphone/view/Page/Form/Contact/ContactDescription.qml b/Linphone/view/Page/Form/Contact/ContactDescription.qml index 3259d301b..c98cf0d52 100644 --- a/Linphone/view/Page/Form/Contact/ContactDescription.qml +++ b/Linphone/view/Page/Form/Contact/ContactDescription.qml @@ -5,6 +5,7 @@ import QtQuick.Controls.Basic import Linphone import UtilsCpp import SettingsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout{ id: mainItem @@ -33,8 +34,8 @@ ColumnLayout{ Layout.fillWidth: true verticalAlignment: (topTextItem.visible?Text.AlignTop:Text.AlignVCenter) visible: text != '' - font.weight: Math.round(300 * DefaultStyle.dp) - font.pixelSize: Math.round(12 * DefaultStyle.dp) + font.weight: Utils.getSizeWithScreenRatio(300) + font.pixelSize: Utils.getSizeWithScreenRatio(12) color: DefaultStyle.main2_400 text: mainItem.bottomText maximumLineCount: 1 diff --git a/Linphone/view/Page/Form/Contact/ContactEdition.qml b/Linphone/view/Page/Form/Contact/ContactEdition.qml index bc529b4c1..a80f1cab0 100644 --- a/Linphone/view/Page/Form/Contact/ContactEdition.qml +++ b/Linphone/view/Page/Form/Contact/ContactEdition.qml @@ -173,7 +173,7 @@ MainRightPanel { ] content: Flickable { id: editionLayout - contentWidth: Math.round(Math.min(parent.width, 421 * DefaultStyle.dp)) + contentWidth: Math.min(parent.width, Utils.getSizeWithScreenRatio(421)) width: parent.width contentY: 0 diff --git a/Linphone/view/Page/Form/Login/LoginPage.qml b/Linphone/view/Page/Form/Login/LoginPage.qml index e5eb9ec69..e7debe115 100644 --- a/Linphone/view/Page/Form/Login/LoginPage.qml +++ b/Linphone/view/Page/Form/Login/LoginPage.qml @@ -55,7 +55,7 @@ LoginLayout { RowLayout { visible: !SettingsCpp.assistantHideCreateAccount spacing: Utils.getSizeWithScreenRatio(20) - Layout.rightMargin: Math.round(Math.max(10 * DefaultStyle.dp, (51 - ((51/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))) * DefaultStyle.dp)) + Layout.rightMargin: Math.max(Utils.getSizeWithScreenRatio(10), Utils.getSizeWithScreenRatio(51 - ((51/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width)))) Text { Layout.rightMargin: Utils.getSizeWithScreenRatio(15) diff --git a/Linphone/view/Page/Form/Login/SIPLoginPage.qml b/Linphone/view/Page/Form/Login/SIPLoginPage.qml index ebae25dc3..b97c23f63 100644 --- a/Linphone/view/Page/Form/Login/SIPLoginPage.qml +++ b/Linphone/view/Page/Form/Login/SIPLoginPage.qml @@ -15,14 +15,14 @@ LoginLayout { titleContent: [ RowLayout { - Layout.leftMargin: Math.round(119 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(119) visible: !SettingsCpp.assistantHideThirdPartyAccount - spacing: Math.round(21 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(21) Button { id: backButton visible: mainItem.showBackButton - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) icon.source: AppIcons.leftArrow style: ButtonStyle.noBackground onClicked: { @@ -35,8 +35,8 @@ LoginLayout { EffectImage { fillMode: Image.PreserveAspectFit imageSource: AppIcons.profile - Layout.preferredHeight: Math.round(34 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(34 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) colorizationColor: DefaultStyle.main2_600 } Text { @@ -54,10 +54,10 @@ LoginLayout { }, RowLayout { visible: !SettingsCpp.assistantHideCreateAccount - Layout.rightMargin: Math.round(51 * DefaultStyle.dp) - spacing: Math.round(20 * DefaultStyle.dp) + Layout.rightMargin: Utils.getSizeWithScreenRatio(51) + spacing: Utils.getSizeWithScreenRatio(20) Text { - Layout.rightMargin: Math.round(15 * DefaultStyle.dp) + Layout.rightMargin: Utils.getSizeWithScreenRatio(15) //: Pas encore de compte ? text: qsTr("assistant_no_account_yet") font { @@ -81,7 +81,7 @@ LoginLayout { Component { id: firstItem Flickable { - width: Math.round(361 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(361) contentWidth: content.implicitWidth contentHeight: content.implicitHeight clip: true @@ -93,11 +93,11 @@ LoginLayout { id: content // rightMargin is negative margin width: parent.width - scrollbar.width*2 - spacing: Math.round(85 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(85) ColumnLayout { spacing: 0 ColumnLayout { - spacing: Math.round(28 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(28) Text { Layout.fillWidth: true Layout.preferredWidth: rootStackView.width @@ -113,7 +113,7 @@ LoginLayout { SmallButton { id: openLinkButton Layout.alignment: Qt.AlignCenter - Layout.topMargin: Math.round(18 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(18) text: "linphone.org/contact" style: ButtonStyle.secondary onClicked: { @@ -124,7 +124,7 @@ LoginLayout { } } ColumnLayout { - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) BigButton { id: createAccountButton style: ButtonStyle.secondary @@ -160,7 +160,7 @@ LoginLayout { id: secondItem Flickable { id: formFlickable - width: Math.round(770 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(770) contentWidth: content.implicitWidth contentHeight: content.implicitHeight clip: true @@ -171,19 +171,19 @@ LoginLayout { RowLayout { id: content width: formFlickable.width - scrollbar.width*2 - spacing: Math.round(50 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(50) ColumnLayout { - spacing: Math.round(2 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(2) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) Layout.fillHeight: true ColumnLayout { - spacing: Math.round(22 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(22) // alignment item Item { Layout.preferredHeight: advancedParametersTitle.implicitHeight } ColumnLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) FormItemLayout { id: username //: "Nom d'utilisateur" @@ -194,7 +194,7 @@ LoginLayout { contentItem: TextField { id: usernameEdit isError: username.errorTextVisible || (LoginPageCpp.badIds && errorText.isVisible) - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) KeyNavigation.down: passwordEdit //: "%1 mandatory" Accessible.name: qsTr("mandatory_field_accessible_name").arg(qsTr("username")) @@ -210,7 +210,7 @@ LoginLayout { id: passwordEdit isError: password.errorTextVisible || (LoginPageCpp.badIds && errorText.isVisible) hidden: true - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) KeyNavigation.up: usernameEdit KeyNavigation.down: domainEdit Accessible.name: qsTr("password") @@ -227,7 +227,7 @@ LoginLayout { id: domainEdit isError: domain.errorTextVisible initialText: SettingsCpp.assistantThirdPartySipAccountDomain - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) KeyNavigation.up: passwordEdit KeyNavigation.down: displayName //: "%1 mandatory" @@ -246,7 +246,7 @@ LoginLayout { Layout.fillWidth: true contentItem: TextField { id: displayName - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) KeyNavigation.up: domainEdit KeyNavigation.down: transportCbox Accessible.name: qsTr("sip_address_display_name") @@ -258,8 +258,8 @@ LoginLayout { Layout.fillWidth: true contentItem: ComboBox { id: transportCbox - height: Math.round(49 * DefaultStyle.dp) - width: Math.round(360 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(49) + width: Utils.getSizeWithScreenRatio(360) textRole: "text" valueRole: "value" model: [ @@ -292,7 +292,7 @@ LoginLayout { BigButton { id: connectionButton - Layout.topMargin: Math.round(15 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(15) style: ButtonStyle.main property Item tabTarget Accessible.name: qsTr("assistant_account_login") @@ -315,7 +315,7 @@ LoginLayout { implicitHeight: parent.height Layout.alignment: Qt.AlignCenter indicatorColor: DefaultStyle.grey_0 - indicatorWidth: Math.round(25 * DefaultStyle.dp) + indicatorWidth: Utils.getSizeWithScreenRatio(25) } Connections { target: LoginPageCpp @@ -373,9 +373,9 @@ LoginLayout { } } ColumnLayout { - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) Layout.fillHeight: true - spacing: Math.round(22 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(22) Text { id: advancedParametersTitle //: Advanced parameters @@ -383,7 +383,7 @@ LoginLayout { font: Typography.h3m } ColumnLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) FormItemLayout { id: outboundProxyUri //: "Outbound SIP Proxy URI" @@ -393,7 +393,7 @@ LoginLayout { Layout.fillWidth: true contentItem: TextField { id: outboundProxyUriEdit - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) Accessible.name: qsTr("login_proxy_server_url") KeyNavigation.up: transportCbox KeyNavigation.down: registrarUriEdit @@ -406,7 +406,7 @@ LoginLayout { Layout.fillWidth: true contentItem: TextField { id: registrarUriEdit - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) Accessible.name: qsTr("login_registrar_uri") KeyNavigation.up: outboundProxyUriEdit KeyNavigation.down: connectionIdEdit @@ -419,7 +419,7 @@ LoginLayout { Layout.fillWidth: true contentItem: TextField { id: connectionIdEdit - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) KeyNavigation.up: registrarUriEdit Accessible.name: qsTr("login_id") } @@ -444,9 +444,9 @@ LoginLayout { anchors.top: parent.top anchors.bottom: parent.bottom anchors.right: parent.right - // Layout.leftMargin: Math.round(119 * DefaultStyle.dp) - // anchors.leftMargin: Math.round(119 * DefaultStyle.dp) - // anchors.rightMargin: -8 * DefaultStyle.dp + // Layout.leftMargin: Utils.getSizeWithScreenRatio(119) + // anchors.leftMargin: Utils.getSizeWithScreenRatio(119) + // anchors.rightMargin: - Utils.getSizeWithScreenRatio(8) }, Control.StackView { id: rootStackView @@ -454,24 +454,24 @@ LoginLayout { anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom - anchors.leftMargin: Math.round(127 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(127) width: currentItem ? currentItem.width : 0 }, // Item { // id: sipItem - // // spacing: Math.round(8 * Defaultstyle.dp) + // // spacing: Utils.getSizeWithScreenRatio(8) // anchors.fill: parent - // anchors.rightMargin: Math.round(50 * DefaultStyle.dp) + image.width + // anchors.rightMargin: Utils.getSizeWithScreenRatio(50) + image.width // }, Image { id: image z: -1 anchors.top: parent.top anchors.right: parent.right - anchors.topMargin: Math.round(129 * DefaultStyle.dp) - anchors.rightMargin: Math.round(127 * DefaultStyle.dp) - width: Math.round(395 * DefaultStyle.dp) - height: Math.round(350 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(129) + anchors.rightMargin: Utils.getSizeWithScreenRatio(127) + width: Utils.getSizeWithScreenRatio(395) + height: Utils.getSizeWithScreenRatio(350) fillMode: Image.PreserveAspectFit source: AppIcons.loginImage } diff --git a/Linphone/view/Page/Form/Meeting/AddParticipantsForm.qml b/Linphone/view/Page/Form/Meeting/AddParticipantsForm.qml index 9f1e495dd..d808f991b 100644 --- a/Linphone/view/Page/Form/Meeting/AddParticipantsForm.qml +++ b/Linphone/view/Page/Form/Meeting/AddParticipantsForm.qml @@ -34,7 +34,7 @@ FocusScope { Layout.preferredHeight: contentHeight Layout.maximumHeight: mainItem.height / 3 width: mainItem.width - cellWidth: Math.round((50 + 18) * DefaultStyle.dp) + cellWidth: Utils.getSizeWithScreenRatio((50 + 18)) cellHeight: Utils.getSizeWithScreenRatio(80) // columnCount: Math.floor(width/cellWidth) model: mainItem.selectedParticipants diff --git a/Linphone/view/Page/Form/Meeting/MeetingForm.qml b/Linphone/view/Page/Form/Meeting/MeetingForm.qml index 1c0534544..b50d307f5 100644 --- a/Linphone/view/Page/Form/Meeting/MeetingForm.qml +++ b/Linphone/view/Page/Form/Meeting/MeetingForm.qml @@ -6,6 +6,7 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils FocusScope { id: mainItem @@ -16,7 +17,7 @@ FocusScope { ColumnLayout { id: formLayout - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top @@ -29,14 +30,14 @@ FocusScope { RowLayout { visible: mainItem.isCreation && !SettingsCpp.disableBroadcastFeature - Layout.topMargin: Math.round(20 * DefaultStyle.dp) - Layout.bottomMargin: Math.round(20 * DefaultStyle.dp) - spacing: Math.round(18 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(20) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(18) CheckableButton { - Layout.preferredWidth: Math.round(151 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(151) icon.source: AppIcons.usersThree - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) enabled: false //: "Réunion" text: qsTr("meeting_schedule_meeting_label") @@ -45,11 +46,11 @@ FocusScope { style: ButtonStyle.secondary } CheckableButton { - Layout.preferredWidth: Math.round(151 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(151) enabled: false icon.source: AppIcons.slide - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) //: "Webinar" text: qsTr("meeting_schedule_broadcast_label") autoExclusive: true @@ -60,14 +61,14 @@ FocusScope { visible: mainItem.isCreation spacing: formLayout.spacing content: RowLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.usersThree colorizationColor: DefaultStyle.main2_600 - width: Math.round(24 * DefaultStyle.dp) - height: Math.round(24 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(24) + height: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } TextInput { id: confTitle @@ -79,7 +80,7 @@ FocusScope { text: conferenceInfoGui.core.subject ? conferenceInfoGui.core.subject : "" color: DefaultStyle.main2_600 font { - pixelSize: Math.round(20 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(20) weight: Typography.h3.weight } focus: true @@ -100,16 +101,16 @@ FocusScope { EffectImage { imageSource: AppIcons.clock colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } CalendarComboBox { id: startDate background.visible: mainItem.isCreation indicator.visible: mainItem.isCreation - contentText.font.weight: Math.min(Math.round((isCreation ? 700 : 400) * DefaultStyle.dp), 1000) + contentText.font.weight: Math.min(Utils.getSizeWithScreenRatio(isCreation ? 700 : 400), 1000) Layout.fillWidth: true - Layout.preferredHeight: Math.round(30 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) KeyNavigation.up: confTitle KeyNavigation.down: startHour onSelectedDateChanged: { @@ -123,17 +124,17 @@ FocusScope { }, RowLayout { Item { - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } RowLayout { TimeComboBox { id: startHour // indicator.visible: mainItem.isCreation - Layout.preferredWidth: Math.round(94 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(30 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(94) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) background.visible: mainItem.isCreation - contentText.font.weight: Math.min(Math.round((isCreation ? 700 : 400) * DefaultStyle.dp), 1000) + contentText.font.weight: Math.min(Utils.getSizeWithScreenRatio(isCreation ? 700 : 400), 1000) KeyNavigation.up: startDate KeyNavigation.down: timeZoneCbox KeyNavigation.left: endHour @@ -150,10 +151,10 @@ FocusScope { TimeComboBox { id: endHour // indicator.visible: mainItem.isCreation - Layout.preferredWidth: Math.round(94 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(30 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(94) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) background.visible: mainItem.isCreation - contentText.font.weight: Math.min(Math.round((isCreation ? 700 : 400) * DefaultStyle.dp), 1000) + contentText.font.weight: Math.min(Utils.getSizeWithScreenRatio(isCreation ? 700 : 400), 1000) onSelectedDateTimeChanged: mainItem.conferenceInfoGui.core.endDateTime = selectedDateTime KeyNavigation.up: startDate KeyNavigation.down: timeZoneCbox @@ -179,10 +180,10 @@ FocusScope { ComboBox { id: timeZoneCbox Layout.fillWidth: true - Layout.preferredHeight: Math.round(30 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) hoverEnabled: true oneLine: true - listView.implicitHeight: Math.round(250 * DefaultStyle.dp) + listView.implicitHeight: Utils.getSizeWithScreenRatio(250) constantImageSource: AppIcons.globe weight: Typography.p2l.weight leftMargin: 0 @@ -206,20 +207,20 @@ FocusScope { Section { spacing: formLayout.spacing content: RowLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.note colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } TextArea { id: descriptionEdit Layout.fillWidth: true - Layout.preferredWidth: Math.round(275 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(275) Layout.preferredHeight: contentHeight - leftPadding: Math.round(8 * DefaultStyle.dp) - rightPadding: Math.round(8 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(8) + rightPadding: Utils.getSizeWithScreenRatio(8) //: "Ajouter une description" placeholderText: qsTr("meeting_schedule_description_hint") placeholderTextColor: DefaultStyle.main2_600 @@ -243,7 +244,7 @@ FocusScope { background: Rectangle { anchors.fill: parent color: descriptionEdit.hovered || descriptionEdit.activeFocus ? DefaultStyle.grey_100 : "transparent" - radius: Math.round(4 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(4) } } } @@ -254,20 +255,20 @@ FocusScope { Button { id: addParticipantsButton Layout.fillWidth: true - Layout.preferredHeight: Math.round(30 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) leftPadding: 0 background: Rectangle { anchors.fill: parent color: addParticipantsButton.hovered || addParticipantsButton.activeFocus ? DefaultStyle.grey_100 : "transparent" - radius: Math.round(4 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(4) } contentItem: RowLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.usersThree colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } Text { Layout.fillWidth: true @@ -285,7 +286,7 @@ FocusScope { id: participantList Layout.fillWidth: true Layout.preferredHeight: contentHeight - Layout.maximumHeight: Math.round(250 * DefaultStyle.dp) + Layout.maximumHeight: Utils.getSizeWithScreenRatio(250) clip: true model: mainItem.conferenceInfoGui.core.participants Control.ScrollBar.vertical: ScrollBar { @@ -296,14 +297,14 @@ FocusScope { visible: participantList.height < participantList.contentHeight } delegate: Item { - height: Math.round(56 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(56) width: participantList.width - participantScrollBar.width RowLayout { anchors.fill: parent - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) Avatar { - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) _address: modelData.address secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified shadowEnabled: false @@ -311,18 +312,18 @@ FocusScope { Text { property var displayNameObj: UtilsCpp.getDisplayName(modelData.address) text: displayNameObj?.value || "" - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) font.capitalization: Font.Capitalize } Item { Layout.fillWidth: true } Button { - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) - Layout.rightMargin: Math.round(10 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) + Layout.rightMargin: Utils.getSizeWithScreenRatio(10) icon.source: AppIcons.closeX style: ButtonStyle.noBackgroundOrange onClicked: mainItem.conferenceInfoGui.core.removeParticipant(index) @@ -341,7 +342,7 @@ FocusScope { } Item { Layout.fillHeight: true - Layout.minimumHeight: Math.max(Math.round(1 * DefaultStyle.dp), 1) + Layout.minimumHeight: Utils.getSizeWithScreenRatio(1) } } } diff --git a/Linphone/view/Page/Form/Register/RegisterCheckingPage.qml b/Linphone/view/Page/Form/Register/RegisterCheckingPage.qml index ea24aaecb..437a0a0f2 100644 --- a/Linphone/view/Page/Form/Register/RegisterCheckingPage.qml +++ b/Linphone/view/Page/Form/Register/RegisterCheckingPage.qml @@ -4,6 +4,7 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils LoginLayout { id: mainItem @@ -17,11 +18,11 @@ LoginLayout { onCtrlIsPressedChanged: console.log("ctrl is pressed", ctrlIsPressed) titleContent: [ RowLayout { - spacing: Math.round(21 * DefaultStyle.dp) - Layout.leftMargin: Math.round(119 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(21) + Layout.leftMargin: Utils.getSizeWithScreenRatio(119) Button { - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) icon.source: AppIcons.leftArrow style: ButtonStyle.noBackground onClicked: { @@ -32,8 +33,8 @@ LoginLayout { EffectImage { fillMode: Image.PreserveAspectFit imageSource: AppIcons.profile - Layout.preferredHeight: Math.round(34 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(34 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) colorizationColor: DefaultStyle.main2_600 } Text { @@ -62,8 +63,8 @@ LoginLayout { ColumnLayout { anchors.left: parent.left anchors.top: parent.top - anchors.leftMargin: Math.round(127 * DefaultStyle.dp) - spacing: Math.round(104 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(127) + spacing: Utils.getSizeWithScreenRatio(104) Text { font { bold: true @@ -78,7 +79,7 @@ LoginLayout { } } RowLayout { - spacing: Math.round(45 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(45) Repeater { model: 4 id: repeater @@ -143,7 +144,7 @@ LoginLayout { } } RowLayout { - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) Text { //: "Vous n'avez pas reçu le code ?" text: qsTr("assistant_account_creation_confirmation_did_not_receive_code") @@ -164,10 +165,10 @@ LoginLayout { Image { anchors.top: parent.top anchors.right: parent.right - anchors.topMargin: Math.round(140 * DefaultStyle.dp) - anchors.rightMargin: Math.round(97 * DefaultStyle.dp) - width: Math.round(477 * DefaultStyle.dp) - height: Math.round(345 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(140) + anchors.rightMargin: Utils.getSizeWithScreenRatio(97) + width: Utils.getSizeWithScreenRatio(477) + height: Utils.getSizeWithScreenRatio(345) fillMode: Image.PreserveAspectFit source: AppIcons.verif_page_image } diff --git a/Linphone/view/Page/Form/Register/RegisterPage.qml b/Linphone/view/Page/Form/Register/RegisterPage.qml index b42fac98b..1dc83c687 100644 --- a/Linphone/view/Page/Form/Register/RegisterPage.qml +++ b/Linphone/view/Page/Form/Register/RegisterPage.qml @@ -69,7 +69,7 @@ LoginLayout { }, RowLayout { spacing: Utils.getSizeWithScreenRatio(20) - Layout.rightMargin: Math.round(Math.max(10 * DefaultStyle.dp,(51 - ((51/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))) * DefaultStyle.dp)) + Layout.rightMargin: Math.max(Utils.getSizeWithScreenRatio(10), Utils.getSizeWithScreenRatio(51 - ((51/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width)))) Text { Layout.rightMargin: Utils.getSizeWithScreenRatio(15) color: DefaultStyle.main2_700 @@ -102,7 +102,7 @@ LoginLayout { Layout.fillWidth: true id: bar spacing: Utils.getSizeWithScreenRatio(40) - Layout.rightMargin: Math.round(Math.max(5 * DefaultStyle.dp,(127 - ((127/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))) * DefaultStyle.dp)) + Layout.rightMargin: Math.max(Utils.getSizeWithScreenRatio(5), Utils.getSizeWithScreenRatio(127 - ((127/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width)))) // "S'inscrire avec un numéro de téléphone" model: [qsTr("assistant_account_register_with_phone_number"), // "S'inscrire avec un email" @@ -122,7 +122,7 @@ LoginLayout { interactive: true visible: parent.contentHeight > parent.height policy: Control.ScrollBar.AsNeeded - anchors.rightMargin: 8 * DefaultStyle.dp + anchors.rightMargin: Utils.getSizeWithScreenRatio(8) anchors.right: parent.right } diff --git a/Linphone/view/Page/Form/Security/SecurityModePage.qml b/Linphone/view/Page/Form/Security/SecurityModePage.qml index 90555720e..065322fc1 100644 --- a/Linphone/view/Page/Form/Security/SecurityModePage.qml +++ b/Linphone/view/Page/Form/Security/SecurityModePage.qml @@ -3,6 +3,7 @@ import QtQuick.Layouts import QtQuick.Controls.Basic as Control import Linphone import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils LoginLayout { id: mainItem @@ -13,8 +14,8 @@ LoginLayout { fillMode: Image.PreserveAspectFit imageSource: AppIcons.profile colorizationColor: DefaultStyle.main2_600 - Layout.preferredHeight: Math.round(34 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(34 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) } ColumnLayout { Text { @@ -38,12 +39,12 @@ LoginLayout { } centerContent: ColumnLayout { - spacing: Math.round(80 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(80) RowLayout { id: radioButtonsLayout Layout.fillWidth: true Layout.alignment: Qt.AlignHCenter - spacing: Math.round(70 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(70) Repeater { model: [ //: "Chiffrement de bout en bout" @@ -71,7 +72,7 @@ LoginLayout { id: continueButton property int selectedIndex: 0 Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: Math.round(360 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) //: "Continuer" text: qsTr("dialog_continue") style: ButtonStyle.main diff --git a/Linphone/view/Page/Layout/Chat/ChatInfoActionsGroup.qml b/Linphone/view/Page/Layout/Chat/ChatInfoActionsGroup.qml index a0343f41a..5d4698db5 100644 --- a/Linphone/view/Page/Layout/Chat/ChatInfoActionsGroup.qml +++ b/Linphone/view/Page/Layout/Chat/ChatInfoActionsGroup.qml @@ -8,6 +8,7 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { @@ -18,17 +19,17 @@ ColumnLayout { font: Typography.h4 color: DefaultStyle.main2_600 text: title - Layout.topMargin: Math.round(5 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(5) } Control.Control { Layout.fillWidth: true Layout.preferredHeight: implicitHeight - Layout.topMargin: Math.round(9 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(9) background: Rectangle { anchors.fill: parent color: DefaultStyle.grey_100 - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) } contentItem: ColumnLayout { @@ -45,21 +46,21 @@ ColumnLayout { Item { Layout.fillWidth: true - Layout.preferredHeight: visible ? Math.round(56 * DefaultStyle.dp) : 0 + Layout.preferredHeight: visible ? Utils.getSizeWithScreenRatio(56) : 0 visible: modelData.visible RowLayout { anchors.fill: parent - spacing: Math.round(8 * DefaultStyle.dp) - anchors.leftMargin: Math.round(17 * DefaultStyle.dp) - anchors.rightMargin: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) + anchors.leftMargin: Utils.getSizeWithScreenRatio(17) + anchors.rightMargin: Utils.getSizeWithScreenRatio(10) EffectImage { fillMode: Image.PreserveAspectFit imageSource: modelData.icon colorizationColor: modelData.color - Layout.preferredHeight: Math.round(20 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(20 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) } Text { @@ -75,8 +76,8 @@ ColumnLayout { fillMode: Image.PreserveAspectFit imageSource: AppIcons.rightArrow colorizationColor: modelData.color - Layout.preferredHeight: Math.round(20 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(20 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) } } @@ -93,9 +94,9 @@ ColumnLayout { Rectangle { visible: index < entries.length - 1 color: DefaultStyle.main2_200 - height: Math.round(1 * DefaultStyle.dp) - width: parent.width - Math.round(30 * DefaultStyle.dp) - Layout.leftMargin: Math.round(17 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(1) + width: parent.width - Utils.getSizeWithScreenRatio(30) + Layout.leftMargin: Utils.getSizeWithScreenRatio(17) } } } diff --git a/Linphone/view/Page/Layout/Chat/ConversationInfos.qml b/Linphone/view/Page/Layout/Chat/ConversationInfos.qml index fdf479eaf..eddad7739 100644 --- a/Linphone/view/Page/Layout/Chat/ConversationInfos.qml +++ b/Linphone/view/Page/Layout/Chat/ConversationInfos.qml @@ -8,6 +8,7 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem @@ -30,8 +31,8 @@ ColumnLayout { contact: mainItem.contact displayNameVal: mainItem.chatCore.avatarUri secured: mainItem.chatGui && mainItem.chatGui.core.isSecured - Layout.preferredWidth: Math.round(100 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(100 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(100) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(100) PopupButton { id: debugButton z: parent.z + 1 @@ -77,17 +78,17 @@ ColumnLayout { Item { visible: titleMainItem.canEditSubject - Layout.preferredWidth: Math.round(18 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(18) } Rectangle { color: "transparent" border.color: titleMainItem.isEditingSubject ? DefaultStyle.main1_500_main : "transparent" border.width: 1 - radius: Math.round(4 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(150 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(4) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(150) Layout.preferredHeight: title.contentHeight - anchors.margins: Math.round(2 * DefaultStyle.dp) + anchors.margins: Utils.getSizeWithScreenRatio(2) TextEdit { id: title @@ -111,8 +112,8 @@ ColumnLayout { Item { visible: titleMainItem.canEditSubject Layout.alignment: Qt.AlignVCenter - Layout.preferredWidth: Math.round(18 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(18 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(18) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(18) EffectImage { anchors.fill: parent @@ -148,7 +149,7 @@ ColumnLayout { Loader { id: titleLayout Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Math.round(11 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(11) sourceComponent: mainItem.isGroup ? groupTitleContent : oneOneTitleContent } @@ -157,7 +158,7 @@ ColumnLayout { color: DefaultStyle.main2_700 text: mainItem.chatCore.peerAddress Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Math.round(5 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(5) } Text { @@ -166,24 +167,24 @@ ColumnLayout { color: mainItem.contact ? mainItem.contact.core.presenceColor : "transparent" text: mainItem.contact ? mainItem.contact.core.presenceStatus : "" Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Math.round(5 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(5) } RowLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Math.round(30 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(110 * DefaultStyle.dp) - Layout.minimumHeight: Math.round(110 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(110) + Layout.minimumHeight: Utils.getSizeWithScreenRatio(110) LabelButton { text.Layout.fillWidth: true text.horizontalAlignment: Text.AlignHCenter text.wrapMode: Text.Wrap Layout.alignment: Qt.AlignTop - Layout.preferredWidth: Math.round(130 * DefaultStyle.dp) - Layout.maximumWidth: Math.round(130 * DefaultStyle.dp) - button.icon.width: Math.round(24 * DefaultStyle.dp) - button.icon.height: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(130) + Layout.maximumWidth: Utils.getSizeWithScreenRatio(130) + button.icon.width: Utils.getSizeWithScreenRatio(24) + button.icon.height: Utils.getSizeWithScreenRatio(24) button.icon.source: AppIcons.phone //: "Appel" label: qsTr("one_one_infos_call") @@ -194,10 +195,10 @@ ColumnLayout { text.horizontalAlignment: Text.AlignHCenter text.wrapMode: Text.Wrap Layout.alignment: Qt.AlignTop - Layout.preferredWidth: Math.round(130 * DefaultStyle.dp) - Layout.maximumWidth: Math.round(130 * DefaultStyle.dp) - button.icon.width: Math.round(24 * DefaultStyle.dp) - button.icon.height: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(130) + Layout.maximumWidth: Utils.getSizeWithScreenRatio(130) + button.icon.width: Utils.getSizeWithScreenRatio(24) + button.icon.height: Utils.getSizeWithScreenRatio(24) button.icon.source: mainItem.chatCore.muted ? AppIcons.bell : AppIcons.bellSlash //: "Sourdine" label: mainItem.chatCore.muted ? qsTr("one_one_infos_unmute") : qsTr("one_one_infos_mute") @@ -211,10 +212,10 @@ ColumnLayout { text.horizontalAlignment: Text.AlignHCenter text.wrapMode: Text.Wrap Layout.alignment: Qt.AlignTop - Layout.preferredWidth: Math.round(130 * DefaultStyle.dp) - Layout.maximumWidth: Math.round(130 * DefaultStyle.dp) - button.icon.width: Math.round(24 * DefaultStyle.dp) - button.icon.height: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(130) + Layout.maximumWidth: Utils.getSizeWithScreenRatio(130) + button.icon.width: Utils.getSizeWithScreenRatio(24) + button.icon.height: Utils.getSizeWithScreenRatio(24) button.icon.source: mainItem.isGroup ? AppIcons.videoconference : mainItem.isAppFriend @@ -245,9 +246,9 @@ ColumnLayout { id: scrollView Layout.fillHeight: true Layout.fillWidth: true - Layout.topMargin: Math.round(30 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(30) clip: true - Layout.leftMargin: Math.round(15 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(15) Control.ScrollBar.vertical: ScrollBar { id: scrollbar @@ -259,7 +260,7 @@ ColumnLayout { ColumnLayout { spacing: 0 - width: scrollView.width - scrollbar.width - Math.round(5 * DefaultStyle.dp) + width: scrollView.width - scrollbar.width - Utils.getSizeWithScreenRatio(5) Loader { id: participantLoader @@ -282,7 +283,7 @@ ColumnLayout { } ChatInfoActionsGroup { - Layout.topMargin: Math.round(30 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(30) //: Medias & documents title: qsTr("group_infos_media_docs") entries: [ @@ -312,7 +313,7 @@ ColumnLayout { } ChatInfoActionsGroup { - Layout.topMargin: Math.round(17 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(17) //: Other actions title: qsTr("group_infos_other_actions") entries: mainItem.isGroup @@ -405,6 +406,6 @@ ColumnLayout { Item { Layout.fillHeight: true - Layout.preferredHeight: Math.round(50 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) } } diff --git a/Linphone/view/Page/Layout/Chat/EphemeralSettings.qml b/Linphone/view/Page/Layout/Chat/EphemeralSettings.qml index 10269bb4b..0bfa7e2f5 100644 --- a/Linphone/view/Page/Layout/Chat/EphemeralSettings.qml +++ b/Linphone/view/Page/Layout/Chat/EphemeralSettings.qml @@ -8,13 +8,14 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem property ChatGui chatGui property int selectedLifetime: chatGui.core.ephemeralLifetime - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) signal done() property var model: [ @@ -40,7 +41,7 @@ ColumnLayout { RowLayout { id: manageParticipantsButtons - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) BigButton { id: manageParticipantsBackButton @@ -63,9 +64,9 @@ ColumnLayout { } Image { - Layout.preferredWidth: 130 * DefaultStyle.dp - Layout.preferredHeight: 112 * DefaultStyle.dp - Layout.topMargin: Math.round(31 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(130) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(112) + Layout.topMargin: Utils.getSizeWithScreenRatio(31) Layout.alignment: Qt.AlignHCenter source: AppIcons.ephemeralSettings fillMode: Image.PreserveAspectFit @@ -80,48 +81,47 @@ ColumnLayout { color: DefaultStyle.main2_600 Layout.fillWidth: true Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Math.round(31 * DefaultStyle.dp) - Layout.leftMargin: Math.round(15 * DefaultStyle.dp) - Layout.rightMargin: Math.round(15 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(31) + Layout.leftMargin: Utils.getSizeWithScreenRatio(15) + Layout.rightMargin: Utils.getSizeWithScreenRatio(15) } RoundedPane { id: pane Layout.fillWidth: true backgroundColor: DefaultStyle.grey_100 - Layout.leftMargin: Math.round(15 * DefaultStyle.dp) - Layout.rightMargin: Math.round(15 * DefaultStyle.dp) - Layout.topMargin: Math.round(31 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(15) + Layout.rightMargin: Utils.getSizeWithScreenRatio(15) + Layout.topMargin: Utils.getSizeWithScreenRatio(31) contentItem: ColumnLayout { spacing: 0 Repeater { model: mainItem.model delegate: ColumnLayout { Layout.fillWidth: true - Layout.leftMargin: Math.round(8 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(8) RadioButton { color: DefaultStyle.main1_500_main enabled: modelData.disabled !== true opacity: modelData.disabled !== true ? 1.0 : 0.5 checked: modelData.lifetime === mainItem.selectedLifetime onClicked: mainItem.selectedLifetime = modelData.lifetime - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) contentItem: Text { id: label text: modelData.title color: DefaultStyle.main2_600 font: Typography.p1 - leftPadding: Math.round(20 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(20) wrapMode: Text.NoWrap elide: Text.ElideRight - anchors.left: ico.right } } Rectangle { //visible: index < (model.count - 1) color: DefaultStyle.main2_200 - height: Math.round(1 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(1) Layout.fillWidth: true } } diff --git a/Linphone/view/Page/Layout/Chat/GroupChatInfoParticipants.qml b/Linphone/view/Page/Layout/Chat/GroupChatInfoParticipants.qml index 9be955b4b..8eb72692e 100644 --- a/Linphone/view/Page/Layout/Chat/GroupChatInfoParticipants.qml +++ b/Linphone/view/Page/Layout/Chat/GroupChatInfoParticipants.qml @@ -8,6 +8,7 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { @@ -26,7 +27,7 @@ ColumnLayout { font: Typography.h4 color: DefaultStyle.main2_600 text: title - Layout.topMargin: Math.round(5 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(5) } Item{Layout.fillWidth: true} BigButton { @@ -41,30 +42,30 @@ ColumnLayout { Control.Control { visible: expandButton.checked Layout.fillWidth: true - Layout.topMargin: Math.round(9 * DefaultStyle.dp) - height: Math.min(contentColumn.implicitHeight, Math.round(90 * DefaultStyle.dp)) - bottomPadding: Math.round(15 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(9) + height: Math.min(contentColumn.implicitHeight,Utils.getSizeWithScreenRatio(90)) + bottomPadding: Utils.getSizeWithScreenRatio(15) background: Rectangle { color: DefaultStyle.grey_100 - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) } contentItem: ColumnLayout { id: contentColumn - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) Item { - Layout.topMargin: Math.round(7 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(7) } Repeater { model: participants delegate: RowLayout { width: parent.width - Layout.leftMargin: Math.round(17 * DefaultStyle.dp) - Layout.rightMargin: Math.round(10 * DefaultStyle.dp) - spacing: Math.round(10 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(17) + Layout.rightMargin: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) property var participantGui: modelData property var participantCore: participantGui.core property var contactObj: UtilsCpp.findFriendByAddress(participantCore.sipAddress) @@ -72,15 +73,15 @@ ColumnLayout { Avatar { contact: contactObj?.value || null displayNameVal: participantCore.displayName - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) } ColumnLayout { Layout.fillWidth: true - Layout.preferredHeight: Math.round(56 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(56) ColumnLayout { - spacing: Math.round(2 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(2) Layout.alignment: Qt.AlignVCenter Text { @@ -127,8 +128,8 @@ ColumnLayout { icon.source: (contact && contact.core && contact.core.isAppFriend) ? AppIcons.adressBook : AppIcons.plusCircle - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) onClicked: { detailOptions.close() if (contact && contact.core.isAppFriend) @@ -142,8 +143,8 @@ ColumnLayout { Layout.fillWidth: true text: participantCore.isAdmin ? qsTr("group_infos_remove_admin_rights") : qsTr("group_infos_give_admin_rights") icon.source: AppIcons.profile - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) onClicked: { detailOptions.close() mainItem.chatCore.lToggleParticipantAdminStatusAtIndex(index) @@ -154,8 +155,8 @@ ColumnLayout { Layout.fillWidth: true text: qsTr("group_infos_copy_sip_address") icon.source: AppIcons.copy - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) onClicked: { detailOptions.close() UtilsCpp.copyToClipboard(participantCore.sipAddress) @@ -165,17 +166,17 @@ ColumnLayout { visible: mainItem.isGroupEditable() color: DefaultStyle.main2_200 Layout.fillWidth: true - height: Math.round(1 * DefaultStyle.dp) - width: parent.width - Math.round(30 * DefaultStyle.dp) - Layout.leftMargin: Math.round(17 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(1) + width: parent.width - Utils.getSizeWithScreenRatio(30) + Layout.leftMargin: Utils.getSizeWithScreenRatio(17) } IconLabelButton { visible: mainItem.isGroupEditable() Layout.fillWidth: true text: qsTr("group_infos_remove_participant") icon.source: AppIcons.trashCan - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) style: ButtonStyle.hoveredBackgroundRed onClicked: { detailOptions.close() @@ -199,10 +200,10 @@ ColumnLayout { MediumButton { id: manageParticipants visible: mainItem.isGroupEditable() - height: Math.round(40 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(40) icon.source: AppIcons.plusCircle - icon.width: Math.round(16 * DefaultStyle.dp) - icon.height: Math.round(16 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(16) + icon.height: Utils.getSizeWithScreenRatio(16) //: "Gérer des participants" text: qsTr("group_infos_manage_participants_title") style: ButtonStyle.secondary diff --git a/Linphone/view/Page/Layout/Chat/ManageParticipants.qml b/Linphone/view/Page/Layout/Chat/ManageParticipants.qml index ea00dd505..eec1eb062 100644 --- a/Linphone/view/Page/Layout/Chat/ManageParticipants.qml +++ b/Linphone/view/Page/Layout/Chat/ManageParticipants.qml @@ -8,16 +8,17 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + Rectangle { id: mainItem property ChatGui chatGui property var chatCore: chatGui.core Layout.fillHeight: true Layout.fillWidth: true - Layout.topMargin: Math.round(9 * DefaultStyle.dp) - Layout.leftMargin: Math.round(17 * DefaultStyle.dp) - Layout.rightMargin: Math.round(10 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(9) + Layout.leftMargin: Utils.getSizeWithScreenRatio(17) + Layout.rightMargin: Utils.getSizeWithScreenRatio(10) color: DefaultStyle.grey_0 height: participantAddColumn.implicitHeight signal done() @@ -25,12 +26,12 @@ Rectangle { ColumnLayout { id: participantAddColumn anchors.fill: parent - anchors.leftMargin: Math.round(17 * DefaultStyle.dp) - anchors.rightMargin: Math.round(10 * DefaultStyle.dp) - anchors.topMargin: Math.round(17 * DefaultStyle.dp) - spacing: Math.round(5 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(17) + anchors.rightMargin: Utils.getSizeWithScreenRatio(10) + anchors.topMargin: Utils.getSizeWithScreenRatio(17) + spacing: Utils.getSizeWithScreenRatio(5) RowLayout { - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) BigButton { id: manageParticipantsBackButton style: ButtonStyle.noBackground @@ -52,8 +53,8 @@ Rectangle { id: manageParticipantsLayout Layout.fillWidth: true Layout.fillHeight: true - Layout.topMargin: Math.round(9 * DefaultStyle.dp) - Layout.bottomMargin: Math.round(17 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(9) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(17) Layout.alignment: Qt.AlignVCenter selectedParticipants: mainItem.chatCore.participantsAddresses focus: true diff --git a/Linphone/view/Page/Layout/Chat/MessageImdnStatusInfos.qml b/Linphone/view/Page/Layout/Chat/MessageImdnStatusInfos.qml index 362b91dc9..adf362129 100644 --- a/Linphone/view/Page/Layout/Chat/MessageImdnStatusInfos.qml +++ b/Linphone/view/Page/Layout/Chat/MessageImdnStatusInfos.qml @@ -3,10 +3,11 @@ import QtQuick import QtQuick.Layouts import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils MessageInfosLayout { id: mainItem - spacing: Math.round(25 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(25) //: Message status title: qsTr("message_details_status_title") tabbarModel: chatMessageGui ? chatMessageGui.core.imdnStatusListAsString : [] @@ -28,13 +29,13 @@ MessageInfosLayout { RowLayout { id: delegateIn anchors.fill: parent - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) Avatar { Layout.alignment: Qt.AlignHCenter contact: listDelegate.contact _address: modelData.address - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) } ColumnLayout { spacing: 0 diff --git a/Linphone/view/Page/Layout/Chat/MessageInfosLayout.qml b/Linphone/view/Page/Layout/Chat/MessageInfosLayout.qml index c26066c41..4c40fffd9 100644 --- a/Linphone/view/Page/Layout/Chat/MessageInfosLayout.qml +++ b/Linphone/view/Page/Layout/Chat/MessageInfosLayout.qml @@ -8,6 +8,7 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem @@ -22,7 +23,7 @@ ColumnLayout { property var parentView property alias content: contentLayout.children - spacing: Math.round(25 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(25) signal goBackRequested() @@ -40,9 +41,9 @@ ColumnLayout { ColumnLayout { id: contentLayout - Layout.leftMargin: Math.round(16 * DefaultStyle.dp) - Layout.rightMargin: Math.round(16 * DefaultStyle.dp) - spacing: Math.round(21 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(16) + Layout.rightMargin: Utils.getSizeWithScreenRatio(16) + spacing: Utils.getSizeWithScreenRatio(21) TabBar { id: tabbar visible: mainItem.tabbarModel !== undefined @@ -51,7 +52,7 @@ ColumnLayout { model: mainItem.tabbarModel pixelSize: Typography.h4.pixelSize textWeight: Typography.h4.weight - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) } ListView { @@ -59,7 +60,7 @@ ColumnLayout { visible: mainItem.listModel !== undefined Layout.fillWidth: true Layout.fillHeight: true - spacing: Math.round(11 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(11) model: mainItem.listModel } } diff --git a/Linphone/view/Page/Layout/Chat/MessageReactionsInfos.qml b/Linphone/view/Page/Layout/Chat/MessageReactionsInfos.qml index 3b9bb6f92..99eb3f1b9 100644 --- a/Linphone/view/Page/Layout/Chat/MessageReactionsInfos.qml +++ b/Linphone/view/Page/Layout/Chat/MessageReactionsInfos.qml @@ -3,10 +3,11 @@ import QtQuick import QtQuick.Layouts import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils MessageInfosLayout { id: mainItem - spacing: Math.round(25 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(25) //: Reactions title: qsTr("message_details_reactions_title") @@ -33,13 +34,13 @@ MessageInfosLayout { RowLayout { id: delegateIn anchors.fill: parent - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) Avatar { Layout.alignment: Qt.AlignHCenter contact: contactObj?.value || null _address: modelData.address - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) } ColumnLayout { Text { diff --git a/Linphone/view/Page/Layout/Chat/MessageSharedFilesInfos.qml b/Linphone/view/Page/Layout/Chat/MessageSharedFilesInfos.qml index cca6fd975..73d872202 100644 --- a/Linphone/view/Page/Layout/Chat/MessageSharedFilesInfos.qml +++ b/Linphone/view/Page/Layout/Chat/MessageSharedFilesInfos.qml @@ -3,10 +3,11 @@ import QtQuick import QtQuick.Layouts import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils MessageInfosLayout { id: mainItem - spacing: Math.round(25 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(25) property ChatGui chatGui property int filter tabbar.visible: false @@ -17,8 +18,8 @@ MessageInfosLayout { Layout.fillWidth: true Layout.fillHeight: true Layout.preferredHeight: contentHeight - cellWidth: mainItem.filter === ChatMessageFileProxy.FilterContentType.Documents ? width : width / 4 - cellHeight: mainItem.filter === ChatMessageFileProxy.FilterContentType.Documents ? Math.round(69 * DefaultStyle.dp) : width / 4 + cellWidth: mainItem.filter === ChatMessageFileProxy.FilterContentType.Documents ? width : Math.round(width / 4) + cellHeight: mainItem.filter === ChatMessageFileProxy.FilterContentType.Documents ? Utils.getSizeWithScreenRatio(69) : Math.round(width / 4) property bool loading: true model: ChatMessageFileProxy { chat: mainItem.chatGui @@ -43,8 +44,8 @@ MessageInfosLayout { delegate: FileView { contentGui: modelData showAsSquare: false - width: gridView.cellWidth - Math.round(2 * DefaultStyle.dp) - height: gridView.cellHeight - Math.round(2 * DefaultStyle.dp) + width: gridView.cellWidth - Utils.getSizeWithScreenRatio(2) + height: gridView.cellHeight - Utils.getSizeWithScreenRatio(2) } }, Item{Layout.fillHeight: true} diff --git a/Linphone/view/Page/Layout/Login/LoginLayout.qml b/Linphone/view/Page/Layout/Login/LoginLayout.qml index d0f6a66e1..b539dd4a1 100644 --- a/Linphone/view/Page/Layout/Login/LoginLayout.qml +++ b/Linphone/view/Page/Layout/Login/LoginLayout.qml @@ -128,8 +128,8 @@ Rectangle { spacing: 0 RowLayout { Layout.fillWidth: true - Layout.topMargin: Math.round(Math.max(5 * DefaultStyle.dp,(25 - ((25/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height))) * DefaultStyle.dp)) - Layout.rightMargin: Math.round(Math.max(5 * DefaultStyle.dp,(42 - ((42/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))) * DefaultStyle.dp)) + Layout.topMargin: Math.max(Utils.getSizeWithScreenRatio(5), Utils.getSizeWithScreenRatio(25 - ((25/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height)))) + Layout.rightMargin: Math.max(Utils.getSizeWithScreenRatio(5), Utils.getSizeWithScreenRatio(42 - ((42/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width)))) spacing: 0 Item { Layout.fillWidth: true @@ -150,14 +150,14 @@ Rectangle { RowLayout { id: titleLayout Layout.fillWidth: true - Layout.topMargin: Math.round(Math.max(10 * DefaultStyle.dp,(40 - ((40/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height))) * DefaultStyle.dp)) + Layout.topMargin: Math.max(Utils.getSizeWithScreenRatio(10), Utils.getSizeWithScreenRatio(40 - ((40/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height)))) spacing: 0 } Item { id: centerLayout Layout.fillHeight: true Layout.fillWidth: true - Layout.topMargin: Math.round(Math.max(15 * DefaultStyle.dp,(70 - ((70/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height))) * DefaultStyle.dp)) + Layout.topMargin: Math.max(Utils.getSizeWithScreenRatio(15), Utils.getSizeWithScreenRatio(70 - ((70/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height)))) Layout.alignment: Qt.AlignBottom } diff --git a/Linphone/view/Page/Layout/Main/MainLayout.qml b/Linphone/view/Page/Layout/Main/MainLayout.qml index 64a30fded..bd31603fe 100644 --- a/Linphone/view/Page/Layout/Main/MainLayout.qml +++ b/Linphone/view/Page/Layout/Main/MainLayout.qml @@ -252,7 +252,7 @@ Item { y: magicSearchBar.height // closePolicy: Popup.CloseOnEscape topPadding: Utils.getSizeWithScreenRatio(20) - bottomPadding: Math.round((contactList.haveContacts ? 20 : 10) * DefaultStyle.dp) + bottomPadding: Utils.getSizeWithScreenRatio(contactList.haveContacts ? 20 : 10) rightPadding: Utils.getSizeWithScreenRatio(8) leftPadding: Utils.getSizeWithScreenRatio(20) visible: magicSearchBar.text.length != 0 @@ -541,7 +541,7 @@ Item { } Rectangle { Layout.fillWidth: true - Layout.preferredHeight: Math.max(Utils.getSizeWithScreenRatio(1), 1) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) visible: addAccountButton.visible color: DefaultStyle.main2_400 } diff --git a/Linphone/view/Page/Layout/Settings/AbstractSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/AbstractSettingsLayout.qml index f14203d05..bf995d01f 100644 --- a/Linphone/view/Page/Layout/Settings/AbstractSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AbstractSettingsLayout.qml @@ -95,7 +95,7 @@ Rectangle { } Rectangle { Layout.fillWidth: true - height: Math.max(Utils.getSizeWithScreenRatio(1), 1) + height: Utils.getSizeWithScreenRatio(1) color: DefaultStyle.main2_500_main } } @@ -141,10 +141,10 @@ Rectangle { width: contentListView.width Rectangle { visible: index !== 0 - Layout.topMargin: Math.round((modelData.hideTopSeparator ? 0 : 16) * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(modelData.hideTopSeparator ? 0 : 16) Layout.bottomMargin: Utils.getSizeWithScreenRatio(16) Layout.fillWidth: true - height: Math.max(Utils.getSizeWithScreenRatio(1), 1) + height: Utils.getSizeWithScreenRatio(1) color: modelData.hideTopSeparator ? 'transparent' : DefaultStyle.main2_500_main } GridLayout { @@ -152,7 +152,7 @@ Rectangle { columns: mainItem.useVerticalLayout ? 1 : 2 Layout.fillWidth: true // Layout.preferredWidth: parent.width - rowSpacing: Math.round((modelData.title.length > 0 || modelData.subTitle.length > 0 ? 20 : 0) * DefaultStyle.dp) + rowSpacing: modelData.title.length > 0 || modelData.subTitle.length > 0 ? Utils.getSizeWithScreenRatio(20) : 0 columnSpacing: Utils.getSizeWithScreenRatio(47) ColumnLayout { Layout.preferredWidth: Utils.getSizeWithScreenRatio(341) @@ -179,10 +179,10 @@ Rectangle { } } RowLayout { - Layout.topMargin: Math.round((modelData.hideTopMargin ? 0 : (mainItem.useVerticalLayout ? 10 : 21)) * DefaultStyle.dp) + Layout.topMargin: modelData.hideTopMargin ? 0 : Utils.getSizeWithScreenRatio(mainItem.useVerticalLayout ? 10 : 21) Layout.bottomMargin: Utils.getSizeWithScreenRatio(21) Layout.leftMargin: mainItem.useVerticalLayout ? 0 : Utils.getSizeWithScreenRatio(17) - Layout.preferredWidth: Math.round((modelData.customWidth > 0 ? modelData.customWidth : 545) * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(modelData.customWidth > 0 ? modelData.customWidth : 545) Layout.alignment: Qt.AlignRight Loader { id: contentLoader @@ -190,7 +190,7 @@ Rectangle { sourceComponent: modelData.contentComponent } Item { - Layout.preferredWidth: Math.round((modelData.customRightMargin > 0 ? modelData.customRightMargin : 17) * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(modelData.customRightMargin > 0 ? modelData.customRightMargin : 17) } } } diff --git a/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml b/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml index 5d53d37ea..8f70da2df 100644 --- a/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml @@ -7,6 +7,7 @@ import Linphone import SettingsCpp import UtilsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { id: mainItem @@ -40,21 +41,21 @@ AbstractSettingsLayout { id: accountParametersComponent ColumnLayout { Layout.fillWidth: true - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) Avatar { id: avatar account: model displayPresence: false - Layout.preferredWidth: Math.round(100 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(100 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(100) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(100) Layout.alignment: Qt.AlignHCenter } IconLabelButton { visible: model.core.pictureUri.length === 0 Layout.preferredWidth: width icon.source: AppIcons.camera - icon.width: Math.round(17 * DefaultStyle.dp) - icon.height: Math.round(17 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(17) + icon.height: Utils.getSizeWithScreenRatio(17) //: "Ajouter une image" text: qsTr("manage_account_add_picture") style: ButtonStyle.noBackground @@ -64,12 +65,12 @@ AbstractSettingsLayout { RowLayout { visible: model.core.pictureUri.length > 0 Layout.alignment: Qt.AlignHCenter - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) IconLabelButton { Layout.preferredWidth: width icon.source: AppIcons.pencil - icon.width: Math.round(17 * DefaultStyle.dp) - icon.height: Math.round(17 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(17) + icon.height: Utils.getSizeWithScreenRatio(17) //: "Modifier l'image" text: qsTr("manage_account_edit_picture") style: ButtonStyle.noBackground @@ -78,8 +79,8 @@ AbstractSettingsLayout { IconLabelButton { Layout.preferredWidth: width icon.source: AppIcons.trashCan - icon.width: Math.round(17 * DefaultStyle.dp) - icon.height: Math.round(17 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(17) + icon.height: Utils.getSizeWithScreenRatio(17) //: "Supprimer l'image" text: qsTr("manage_account_remove_picture") style: ButtonStyle.noBackground @@ -99,7 +100,7 @@ AbstractSettingsLayout { } RowLayout { Layout.fillWidth: true - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) Text { Layout.alignment: Qt.AlignLeft text: "%1 :".arg(qsTr("sip_address")) @@ -123,7 +124,7 @@ AbstractSettingsLayout { } } ColumnLayout { - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) Layout.alignment: Qt.AlignLeft Text { //: "Nom d'affichage @@ -141,7 +142,7 @@ AbstractSettingsLayout { TextField { Layout.alignment: Qt.AlignLeft Layout.fillWidth: true - Layout.preferredHeight: Math.round(49 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) initialText: model.core.displayName backgroundColor: DefaultStyle.grey_100 onEditingFinished: { @@ -157,7 +158,7 @@ AbstractSettingsLayout { } ComboSetting { Layout.fillWidth: true - Layout.topMargin: -Math.round(15 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(15) entries: account.core.dialPlans propertyName: "dialPlan" propertyOwnerGui: account @@ -172,9 +173,9 @@ AbstractSettingsLayout { } RowLayout { id:mainItem - spacing : Math.round(20 * DefaultStyle.dp) + spacing : Utils.getSizeWithScreenRatio(20) ColumnLayout { - spacing : Math.round(5 * DefaultStyle.dp) + spacing : Utils.getSizeWithScreenRatio(5) Text { //: "Déconnecter mon compte" text: qsTr("manage_account_delete") @@ -198,7 +199,7 @@ AbstractSettingsLayout { BigButton { style: ButtonStyle.noBackgroundRed Layout.alignment: Qt.AlignRight - Layout.rightMargin: Math.round(5 * DefaultStyle.dp) + Layout.rightMargin: Utils.getSizeWithScreenRatio(5) icon.source: AppIcons.trashCan onClicked: { var mainWin = UtilsCpp.getMainWindow() @@ -228,25 +229,25 @@ AbstractSettingsLayout { RoundedPane { Layout.fillWidth: true Layout.fillHeight: true - // Layout.minimumHeight: account.core.devices.length * Math.round(133 * DefaultStyle.dp) + (account.core.devices.length - 1) * Math.round(15 * DefaultStyle.dp) + 2 * Math.round(21 * DefaultStyle.dp) - Layout.rightMargin: Math.round(30 * DefaultStyle.dp) - Layout.topMargin: Math.round(20 * DefaultStyle.dp) - Layout.bottomMargin: Math.round(4 * DefaultStyle.dp) - Layout.leftMargin: Math.round(44 * DefaultStyle.dp) - topPadding: Math.round(21 * DefaultStyle.dp) - bottomPadding: Math.round(21 * DefaultStyle.dp) - leftPadding: Math.round(17 * DefaultStyle.dp) - rightPadding: Math.round(17 * DefaultStyle.dp) + // Layout.minimumHeight: account.core.devices.length *Utils.getSizeWithScreenRatio(133) + (account.core.devices.length - 1) *Utils.getSizeWithScreenRatio(15) + 2 *Utils.getSizeWithScreenRatio(21) + Layout.rightMargin: Utils.getSizeWithScreenRatio(30) + Layout.topMargin: Utils.getSizeWithScreenRatio(20) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(4) + Layout.leftMargin: Utils.getSizeWithScreenRatio(44) + topPadding: Utils.getSizeWithScreenRatio(21) + bottomPadding: Utils.getSizeWithScreenRatio(21) + leftPadding: Utils.getSizeWithScreenRatio(17) + rightPadding: Utils.getSizeWithScreenRatio(17) background: Rectangle { anchors.fill: parent color: DefaultStyle.grey_100 - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) } contentItem: ColumnLayout { - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) BusyIndicator { - Layout.preferredWidth: Math.round(60 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(60 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(60) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(60) Layout.alignment: Qt.AlignHCenter visible: devices.loading } @@ -268,24 +269,24 @@ AbstractSettingsLayout { } Control.Control { Layout.fillWidth: true - height: Math.round(133 * DefaultStyle.dp) - topPadding: Math.round(26 * DefaultStyle.dp) - bottomPadding: Math.round(26 * DefaultStyle.dp) - rightPadding: Math.round(36 * DefaultStyle.dp) - leftPadding: Math.round(33 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(133) + topPadding: Utils.getSizeWithScreenRatio(26) + bottomPadding: Utils.getSizeWithScreenRatio(26) + rightPadding: Utils.getSizeWithScreenRatio(36) + leftPadding: Utils.getSizeWithScreenRatio(33) background: Rectangle { anchors.fill: parent color: DefaultStyle.grey_0 - radius: Math.round(10 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(10) } contentItem: ColumnLayout { width: parent.width - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) RowLayout { - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) EffectImage { - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) fillMode: Image.PreserveAspectFit colorizationColor: DefaultStyle.main2_600 imageSource: modelData.core.userAgent.toLowerCase().includes('ios') | modelData.core.userAgent.toLowerCase().includes('android') ? AppIcons.mobile : AppIcons.desktop @@ -303,8 +304,8 @@ AbstractSettingsLayout { //: "Supprimer" text: qsTr("manage_account_device_remove") icon.source: AppIcons.trashCan - icon.width: Math.round(16 * DefaultStyle.dp) - icon.height: Math.round(16 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(16) + icon.height: Utils.getSizeWithScreenRatio(16) style: ButtonStyle.tertiary onClicked: { var mainWin = UtilsCpp.getMainWindow() @@ -321,7 +322,7 @@ AbstractSettingsLayout { } } RowLayout { - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) Text { //: "Dernière connexion:" text: qsTr("manage_account_device_last_connection") @@ -330,8 +331,8 @@ AbstractSettingsLayout { } EffectImage { visible: dateText.lastDate != "" - Layout.preferredWidth: Math.round(20 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(20 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) imageSource: AppIcons.calendarBlank colorizationColor: DefaultStyle.main2_600 fillMode: Image.PreserveAspectFit @@ -348,8 +349,8 @@ AbstractSettingsLayout { } EffectImage { visible: dateText.lastDate != "" - Layout.preferredWidth: Math.round(20 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(20 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) imageSource: AppIcons.clock colorizationColor: DefaultStyle.main2_600 fillMode: Image.PreserveAspectFit diff --git a/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml b/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml index 075f82412..17b26e9e8 100644 --- a/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml @@ -7,6 +7,7 @@ import Linphone import SettingsCpp 1.0 import UtilsCpp import ConstantsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { id: mainItem @@ -65,7 +66,7 @@ AbstractSettingsLayout { ColumnLayout { id: column Layout.fillWidth: true - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) DecoratedTextField { id: mwiServerAddressField propertyName: "mwiServerAddress" @@ -114,7 +115,7 @@ AbstractSettingsLayout { id: advancedParametersComponent ColumnLayout { Layout.fillWidth: true - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) Text { //: "Transport" text: qsTr("account_settings_transport_title") diff --git a/Linphone/view/Page/Layout/Settings/AdvancedSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/AdvancedSettingsLayout.qml index c11fe3060..e61474910 100644 --- a/Linphone/view/Page/Layout/Settings/AdvancedSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AdvancedSettingsLayout.qml @@ -60,7 +60,7 @@ AbstractSettingsLayout { Component { id: systemComponent ColumnLayout { - spacing: Math.round(40 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(40) SwitchSetting { Layout.fillWidth: true //: Auto start %1 @@ -77,7 +77,7 @@ AbstractSettingsLayout { Component { id: remoteProvisioningComponent ColumnLayout { - spacing: Math.round(6 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(6) DecoratedTextField { Layout.fillWidth: true id: configUri @@ -86,7 +86,7 @@ AbstractSettingsLayout { toValidate: true } SmallButton { - Layout.topMargin: -Math.round(20 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(-20) Layout.alignment: Qt.AlignRight //: Download and apply text: qsTr("settings_advanced_download_apply_remote_provisioning") @@ -108,9 +108,9 @@ AbstractSettingsLayout { Component { id: securityComponent ColumnLayout { - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) ColumnLayout { - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) Text { //: Media encryption text: qsTr("settings_advanced_media_encryption_title") @@ -155,13 +155,13 @@ AbstractSettingsLayout { ListView { Layout.preferredHeight: contentHeight Layout.fillWidth: true - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) model: PayloadTypeProxy { filterType: PayloadTypeProxy.Audio | PayloadTypeProxy.NotDownloadable } delegate: SwitchSetting { width: parent.width - height: Math.round(32 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(32) titleText: Utils.capitalizeFirstLetter(modelData.core.mimeType) subTitleText: modelData.core.clockRate + " Hz" propertyName: "enabled" @@ -177,18 +177,18 @@ AbstractSettingsLayout { Component { id: videoCodecsComponent ColumnLayout { - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) ListView { Layout.preferredHeight: contentHeight Layout.fillWidth: true - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) model: PayloadTypeProxy { id: videoPayloadTypeProxy filterType: PayloadTypeProxy.Video | PayloadTypeProxy.NotDownloadable } delegate: SwitchSetting { width: parent.width - height: Math.round(32 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(32) titleText: Utils.capitalizeFirstLetter(modelData.core.mimeType) subTitleText: modelData.core.encoderDescription propertyName: "enabled" @@ -198,14 +198,14 @@ AbstractSettingsLayout { ListView { Layout.preferredHeight: contentHeight Layout.fillWidth: true - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) model: PayloadTypeProxy { id: downloadableVideoPayloadTypeProxy filterType: PayloadTypeProxy.Video | PayloadTypeProxy.Downloadable } delegate: SwitchSetting { width: parent.width - height: Math.round(32 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(32) titleText: Utils.capitalizeFirstLetter(modelData.core.mimeType) subTitleText: modelData.core.encoderDescription onCheckedChanged: Utils.openCodecOnlineInstallerDialog( @@ -232,7 +232,7 @@ AbstractSettingsLayout { Component { id: hideFpsComponent ColumnLayout { - spacing: Math.round(40 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(40) SwitchSetting { //:"Cacher les FPS" titleText:qsTr("settings_advanced_hide_fps_title") diff --git a/Linphone/view/Page/Layout/Settings/CallForwardSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/CallForwardSettingsLayout.qml index 03c812bc2..b53b90d07 100644 --- a/Linphone/view/Page/Layout/Settings/CallForwardSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/CallForwardSettingsLayout.qml @@ -5,6 +5,7 @@ import QtQuick.Controls.Basic as Control import Linphone import SettingsCpp 1.0 import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { id: mainItem @@ -67,7 +68,7 @@ AbstractSettingsLayout { Component { id: parametersComponent ColumnLayout { - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) SwitchSetting { //: "Forward calls" titleText: qsTr("settings_call_forward_activate_title") @@ -89,7 +90,7 @@ AbstractSettingsLayout { id: forwardDestination visible: mainItem.enableCallForward Layout.fillWidth: true - Layout.preferredHeight: Math.round(49 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) model: [ {text: qsTr("settings_call_forward_to_voicemail")}, {text: qsTr("settings_call_forward_to_sipaddress")} diff --git a/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml index 89838878d..444426e07 100644 --- a/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml @@ -48,7 +48,7 @@ AbstractSettingsLayout { Component { id: genericParametersComponent ColumnLayout { - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) SwitchSetting { //: "Annulateur d'écho" titleText: qsTr("settings_calls_echo_canceller_title") @@ -99,7 +99,7 @@ AbstractSettingsLayout { Layout.fillWidth: true } RowLayout { - spacing: Math.round(3 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(3) Text { //: Current ringtone : text: qsTr("settings_calls_current_ringtone_filename") @@ -141,7 +141,7 @@ AbstractSettingsLayout { MultimediaSettings { ringerDevicesVisible: true backgroundVisible: false - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) } } } diff --git a/Linphone/view/Page/Layout/Settings/CarddavSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/CarddavSettingsLayout.qml index bdf9f40a3..b2e966a84 100644 --- a/Linphone/view/Page/Layout/Settings/CarddavSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/CarddavSettingsLayout.qml @@ -7,6 +7,7 @@ import Linphone import SettingsCpp 1.0 import UtilsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { id: mainItem @@ -48,12 +49,12 @@ AbstractSettingsLayout { Component { id: topBar RowLayout { - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) BigButton { style: ButtonStyle.noBackground icon.source: AppIcons.trashCan - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) visible: !isNew onClicked: { var mainWin = UtilsCpp.getMainWindow() @@ -77,10 +78,10 @@ AbstractSettingsLayout { id: cardDavParametersComponent ColumnLayout { Layout.fillWidth: true - spacing: Math.round(20 * DefaultStyle.dp) - Layout.rightMargin: Math.round(44 * DefaultStyle.dp) - Layout.topMargin: Math.round(20 * DefaultStyle.dp) - Layout.leftMargin: Math.round(64 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) + Layout.rightMargin: Utils.getSizeWithScreenRatio(44) + Layout.topMargin: Utils.getSizeWithScreenRatio(20) + Layout.leftMargin: Utils.getSizeWithScreenRatio(64) DecoratedTextField { propertyName: "displayName" propertyOwnerGui: carddavGui diff --git a/Linphone/view/Page/Layout/Settings/DebugSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/DebugSettingsLayout.qml index 46b227b88..ac0883c66 100644 --- a/Linphone/view/Page/Layout/Settings/DebugSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/DebugSettingsLayout.qml @@ -7,6 +7,7 @@ import Linphone import SettingsCpp 1.0 import UtilsCpp 1.0 import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { Layout.fillWidth: true @@ -74,7 +75,7 @@ AbstractSettingsLayout { Component { id: logContent ColumnLayout { - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) SwitchSetting { //: "Activer les traces de débogage" titleText: qsTr("settings_debug_enable_logs_title") @@ -88,7 +89,7 @@ AbstractSettingsLayout { propertyOwner: SettingsCpp } RowLayout { - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) Layout.alignment: Qt.AlignRight MediumButton { style: ButtonStyle.tertiary @@ -116,15 +117,15 @@ AbstractSettingsLayout { Component { id: versionContent ColumnLayout { - spacing: Math.round(20 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(20) RowLayout { EffectImage { imageSource: AppIcons.appWindow colorizationColor: DefaultStyle.main1_500_main - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) - imageWidth: Math.round(24 * DefaultStyle.dp) - imageHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + imageWidth: Utils.getSizeWithScreenRatio(24) + imageHeight: Utils.getSizeWithScreenRatio(24) Layout.alignment: Qt.AlignTop } ColumnLayout { @@ -150,10 +151,10 @@ AbstractSettingsLayout { EffectImage { imageSource: AppIcons.resourcePackage colorizationColor: DefaultStyle.main1_500_main - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) - imageWidth: Math.round(24 * DefaultStyle.dp) - imageHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + imageWidth: Utils.getSizeWithScreenRatio(24) + imageHeight: Utils.getSizeWithScreenRatio(24) Layout.alignment: Qt.AlignTop } ColumnLayout { diff --git a/Linphone/view/Page/Layout/Settings/MeetingsSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/MeetingsSettingsLayout.qml index 0bb694f18..ab6d50df5 100644 --- a/Linphone/view/Page/Layout/Settings/MeetingsSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/MeetingsSettingsLayout.qml @@ -5,6 +5,7 @@ import QtQuick.Controls.Basic as Control import SettingsCpp 1.0 import UtilsCpp import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { id: mainItem @@ -27,7 +28,7 @@ AbstractSettingsLayout { Component { id: confDisplayParametersComponent ColumnLayout { - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) Text { //: "Mode d’affichage par défaut" text: qsTr("settings_meetings_default_layout_title") @@ -46,7 +47,7 @@ AbstractSettingsLayout { } ComboSetting { Layout.fillWidth: true - Layout.topMargin: Math.round(12 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(12) Layout.preferredWidth: parent.width entries: SettingsCpp.conferenceLayouts propertyName: "conferenceLayout" diff --git a/Linphone/view/Page/Layout/Settings/NetworkSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/NetworkSettingsLayout.qml index 268046f64..eb59f77de 100644 --- a/Linphone/view/Page/Layout/Settings/NetworkSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/NetworkSettingsLayout.qml @@ -5,6 +5,7 @@ import QtQuick.Controls.Basic as Control import SettingsCpp 1.0 import Linphone import UtilsCpp +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { width: parent?.width @@ -24,7 +25,7 @@ AbstractSettingsLayout { Component { id: content ColumnLayout { - spacing: Math.round(40 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(40) SwitchSetting { Layout.fillWidth: true //: "Autoriser l'IPv6" diff --git a/Linphone/view/Page/Layout/Settings/SecuritySettingsLayout.qml b/Linphone/view/Page/Layout/Settings/SecuritySettingsLayout.qml index 5a0710f76..fa7def9a0 100644 --- a/Linphone/view/Page/Layout/Settings/SecuritySettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/SecuritySettingsLayout.qml @@ -4,6 +4,7 @@ import QtQuick.Layouts import QtQuick.Controls.Basic as Control import SettingsCpp 1.0 import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { width: parent?.width @@ -22,7 +23,7 @@ AbstractSettingsLayout { Component { id: content ColumnLayout { - spacing: Math.round(40 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(40) SwitchSetting { //: "Chiffrer tous les fichiers" titleText: qsTr("settings_security_enable_vfs_title") diff --git a/Linphone/view/Page/Main/AbstractMainPage.qml b/Linphone/view/Page/Main/AbstractMainPage.qml index 3c0ac1515..282184a84 100644 --- a/Linphone/view/Page/Main/AbstractMainPage.qml +++ b/Linphone/view/Page/Main/AbstractMainPage.qml @@ -9,6 +9,7 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils FocusScope { id: mainItem @@ -25,16 +26,16 @@ FocusScope { // Control.SplitView { // id: splitView // anchors.fill: parent - // anchors.topMargin: Math.round(10 * DefaultStyle.dp) + // anchors.topMargin: Utils.getSizeWithScreenRatio(10) // handle: Rectangle { - // implicitWidth: Math.round(8 * DefaultStyle.dp) + // implicitWidth: Utils.getSizeWithScreenRatio(8) // color: Control.SplitHandle.hovered ? DefaultStyle.grey_200 : DefaultStyle.grey_100 // } // ColumnLayout { // id: leftPanel - // Control.SplitView.preferredWidth: Math.round(350 * DefaultStyle.dp) - // Control.SplitView.minimumWidth: Math.round(350 * DefaultStyle.dp) + // Control.SplitView.preferredWidth: Utils.getSizeWithScreenRatio(350) + // Control.SplitView.minimumWidth: Utils.getSizeWithScreenRatio(350) // } // Rectangle { // id: rightPanel @@ -56,23 +57,23 @@ FocusScope { // Layout.fillWidth: true // } // ColumnLayout { - // spacing: Math.round(30 * DefaultStyle.dp) + // spacing: Utils.getSizeWithScreenRatio(30) // Item { // Layout.fillHeight: true // } // Image { // Layout.alignment: Qt.AlignHCenter // source: AppIcons.noItemImage - // Layout.preferredWidth: Math.round(359 * DefaultStyle.dp) - // Layout.preferredHeight: Math.round(314 * DefaultStyle.dp) + // Layout.preferredWidth: Utils.getSizeWithScreenRatio(359) + // Layout.preferredHeight: Utils.getSizeWithScreenRatio(314) // fillMode: Image.PreserveAspectFit // } // Text { // text: mainItem.emptyListText // Layout.alignment: Qt.AlignHCenter // font { - // pixelSize: Math.round(22 * DefaultStyle.dp) - // weight: Math.round(800 * DefaultStyle.dp) + // pixelSize: Utils.getSizeWithScreenRatio(22) + // weight: Utils.getSizeWithScreenRatio(800) // } // } // Button { @@ -82,8 +83,8 @@ FocusScope { // EffectImage { // colorizationColor: DefaultStyle.grey_0 // source: mainItem.newItemIconSource - // width: Math.round(24 * DefaultStyle.dp) - // height: Math.round(24 * DefaultStyle.dp) + // width: Utils.getSizeWithScreenRatio(24) + // height: Utils.getSizeWithScreenRatio(24) // fillMode: Image.PreserveAspectFit // } // Text { @@ -91,8 +92,8 @@ FocusScope { // wrapMode: Text.WordWrap // color: DefaultStyle.grey_0 // font { - // weight: Math.round(600 * DefaultStyle.dp) - // pixelSize: Math.round(18 * DefaultStyle.dp) + // weight: Utils.getSizeWithScreenRatio(600) + // pixelSize: Utils.getSizeWithScreenRatio(18) // family: DefaultStyle.defaultFont // } // } @@ -123,13 +124,13 @@ FocusScope { spacing: 0 ColumnLayout { id: leftPanel - Layout.preferredWidth: Math.round(404 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(404) Layout.fillWidth:false spacing:0 } Rectangle { Layout.fillHeight: true - Layout.preferredWidth: Math.max(Math.round(1 * DefaultStyle.dp), 1) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(1) color: DefaultStyle.main2_200 } Rectangle { @@ -151,15 +152,15 @@ FocusScope { Layout.fillWidth: true } ColumnLayout { - spacing: Math.round(30 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(30) Item { Layout.fillHeight: true } Image { Layout.alignment: Qt.AlignHCenter source: AppIcons.noItemImage - Layout.preferredWidth: Math.round(359 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(314 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(359) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(314) fillMode: Image.PreserveAspectFit } Text { @@ -175,7 +176,7 @@ FocusScope { icon.source: mainItem.newItemIconSource style: ButtonStyle.main text: mainItem.noItemButtonText - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) onPressed: mainItem.noItemButtonPressed() } Item { diff --git a/Linphone/view/Page/Main/Call/CallPage.qml b/Linphone/view/Page/Main/Call/CallPage.qml index 211af2f5b..77b2fff86 100644 --- a/Linphone/view/Page/Main/Call/CallPage.qml +++ b/Linphone/view/Page/Main/Call/CallPage.qml @@ -228,13 +228,13 @@ AbstractMainPage { Layout.topMargin: Utils.getSizeWithScreenRatio(18) Layout.rightMargin: Utils.getSizeWithScreenRatio(39) color: "transparent" - radius: 25 * DefaultStyle.dp + radius: Utils.getSizeWithScreenRatio(25) border.color: DefaultStyle.warning_500_main - border.width: 2 * DefaultStyle.dp + border.width: Utils.getSizeWithScreenRatio(2) RowLayout { anchors.centerIn: parent - spacing: 10 * DefaultStyle.dp + spacing: Utils.getSizeWithScreenRatio(10) EffectImage { fillMode: Image.PreserveAspectFit imageSource: AppIcons.callForward diff --git a/Linphone/view/Page/Main/Call/CallSettingsPanel.qml b/Linphone/view/Page/Main/Call/CallSettingsPanel.qml index 034d21e9e..27671a2df 100644 --- a/Linphone/view/Page/Main/Call/CallSettingsPanel.qml +++ b/Linphone/view/Page/Main/Call/CallSettingsPanel.qml @@ -22,30 +22,30 @@ Control.Page { signal returnRequested() signal validateRequested() - topPadding: Math.round(20 * DefaultStyle.dp) - bottomPadding: Math.round(20 * DefaultStyle.dp) - leftPadding: Math.round(17 * DefaultStyle.dp) - rightPadding: Math.round(5 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(20) + bottomPadding: Utils.getSizeWithScreenRatio(20) + leftPadding: Utils.getSizeWithScreenRatio(17) + rightPadding: Utils.getSizeWithScreenRatio(5) background: Rectangle { width: mainItem.width height: mainItem.height color: DefaultStyle.grey_100 - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) } header: Control.Control { id: pageHeader width: mainItem.width - height: Math.round(67 * DefaultStyle.dp) - leftPadding: Math.round(10 * DefaultStyle.dp) - rightPadding: Math.round(10 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(67) + leftPadding: Utils.getSizeWithScreenRatio(10) + rightPadding: Utils.getSizeWithScreenRatio(10) background: Rectangle { id: headerBackground width: pageHeader.width height: pageHeader.height color: DefaultStyle.grey_0 - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) Rectangle { y: pageHeader.height/2 height: pageHeader.height/2 @@ -56,7 +56,7 @@ Control.Page { id: headerStack RowLayout { Layout.alignment: Qt.AlignVCenter - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Text { text: mainItem.headerTitleText Layout.fillWidth: true @@ -87,12 +87,12 @@ Control.Page { } RowLayout { Layout.alignment: Qt.AlignVCenter - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Button { style: ButtonStyle.noBackgroundOrange icon.source: AppIcons.leftArrow - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) onClicked: mainItem.returnRequested() } ColumnLayout { @@ -114,8 +114,8 @@ Control.Page { text: mainItem.headerSubtitleText color: DefaultStyle.main2_500_main font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } @@ -145,7 +145,7 @@ Control.Page { Control.ScrollBar.horizontal.policy: ScrollBar.AlwaysOff Control.Control { id: contentControl - rightPadding: Math.round(scrollbar.width + 10 * DefaultStyle.dp) + rightPadding: scrollbar.width + Utils.getSizeWithScreenRatio(10) anchors.left: scrollview.left anchors.right: scrollview.right width: scrollview.width diff --git a/Linphone/view/Page/Main/Call/WaitingRoom.qml b/Linphone/view/Page/Main/Call/WaitingRoom.qml index aed19b13c..97911d01e 100644 --- a/Linphone/view/Page/Main/Call/WaitingRoom.qml +++ b/Linphone/view/Page/Main/Call/WaitingRoom.qml @@ -6,6 +6,7 @@ import Linphone import UtilsCpp import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils RowLayout { id: mainItem @@ -19,15 +20,15 @@ RowLayout { RowLayout { Layout.fillWidth: false Layout.fillHeight: false - spacing: Math.round(100 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(100) Layout.alignment: Qt.AlignCenter ColumnLayout { - spacing: Math.round(31 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(31) Sticker { id: preview previewEnabled: true - Layout.preferredHeight: Math.round(330 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(558 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(330) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(558) qmlName: "WP" displayAll: false displayPresence: false @@ -40,47 +41,47 @@ RowLayout { } RowLayout { Layout.alignment: Qt.AlignHCenter - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) CheckableButton { id: videoButton visible: SettingsCpp.videoEnabled iconUrl: AppIcons.videoCamera checkedIconUrl: AppIcons.videoCameraSlash checked: !mainItem.localVideoEnabled - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) onClicked: mainItem.localVideoEnabled = !mainItem.localVideoEnabled } CheckableButton { id: microButton iconUrl: AppIcons.microphone checkedIconUrl: AppIcons.microphoneSlash - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) onCheckedChanged: mainItem.microEnabled = !mainItem.microEnabled } CheckableButton { id: settingsButton visible: stackLayout.currentIndex === 0 icon.source: AppIcons.verticalDots - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) } CheckableButton { id: speakerButton visible: stackLayout.currentIndex === 1 iconUrl: AppIcons.speaker checkedIconUrl: AppIcons.speakerSlash - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) } } } @@ -88,9 +89,9 @@ RowLayout { id: stackLayout currentIndex: 0 ColumnLayout { - spacing: Math.round(93 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(93) ColumnLayout { - Layout.topMargin: Math.round(54 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(54) spacing: 0 Text { Layout.fillWidth: true @@ -98,8 +99,8 @@ RowLayout { text: qsTr("meeting_waiting_room_title") color: DefaultStyle.grey_0 font { - pixelSize: Math.round(30 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(30) + weight: Utils.getSizeWithScreenRatio(300) } } Text { @@ -107,15 +108,15 @@ RowLayout { text: mainItem.conferenceInfo && mainItem.conferenceInfo.core.subject color: DefaultStyle.grey_0 font { - pixelSize: Math.round(30 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(30) + weight: Utils.getSizeWithScreenRatio(300) } } } ColumnLayout { - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) BigButton { - Layout.preferredWidth: Math.round(292 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(292) //: "Rejoindre" text: qsTr("meeting_waiting_room_join") style: ButtonStyle.main @@ -126,7 +127,7 @@ RowLayout { } } BigButton { - Layout.preferredWidth: Math.round(292 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(292) style: ButtonStyle.secondary text: qsTr("cancel") onClicked: { @@ -136,17 +137,17 @@ RowLayout { } } ColumnLayout { - spacing: Math.round(37 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(37) ColumnLayout { - spacing: Math.round(13 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(13) Text { Layout.fillWidth: true //: "Connexion à la réunion" text: qsTr("meeting_waiting_room_joining_title") color: DefaultStyle.grey_0 font { - pixelSize: Math.round(30 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(30) + weight: Utils.getSizeWithScreenRatio(300) } } Text { @@ -163,11 +164,11 @@ RowLayout { BusyIndicator { indicatorColor: DefaultStyle.main1_500_main Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: Math.round(48 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(48 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(48) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(48) } BigButton { - Layout.preferredWidth: Math.round(292 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(292) Layout.alignment: Qt.AlignHCenter style: ButtonStyle.main //: Cancel diff --git a/Linphone/view/Page/Main/Chat/ChatPage.qml b/Linphone/view/Page/Main/Chat/ChatPage.qml index 89b25087d..982298782 100644 --- a/Linphone/view/Page/Main/Chat/ChatPage.qml +++ b/Linphone/view/Page/Main/Chat/ChatPage.qml @@ -64,7 +64,7 @@ AbstractMainPage { Dialog { id: deleteChatPopup - width: Math.round(637 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(637) //: Supprimer la conversation ? title: qsTr("chat_dialog_delete_chat_title") //: "La conversation et tous ses messages seront supprimés." @@ -75,7 +75,7 @@ AbstractMainPage { id: listStackView Layout.fillWidth: true Layout.fillHeight: true - Layout.leftMargin: Math.round(45 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(45) clip: true initialItem: chatListItem focus: true @@ -93,7 +93,7 @@ AbstractMainPage { anchors.fill: parent spacing: 0 RowLayout { - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) Text { Layout.fillWidth: true //: "Conversations" @@ -107,8 +107,8 @@ AbstractMainPage { } PopupButton { id: chatListMenu - width: Math.round(24 * DefaultStyle.dp) - height: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(24) + height: Utils.getSizeWithScreenRatio(24) focus: true popup.x: 0 KeyNavigation.right: newChatButton @@ -131,11 +131,11 @@ AbstractMainPage { id: newChatButton style: ButtonStyle.noBackground icon.source: AppIcons.plusCircle - Layout.preferredWidth: Math.round(28 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(28 * DefaultStyle.dp) - Layout.rightMargin: Math.round(39 * DefaultStyle.dp) - icon.width: Math.round(28 * DefaultStyle.dp) - icon.height: Math.round(28 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(28) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) + Layout.rightMargin: Utils.getSizeWithScreenRatio(39) + icon.width: Utils.getSizeWithScreenRatio(28) + icon.height: Utils.getSizeWithScreenRatio(28) KeyNavigation.down: searchBar onClicked: { console.debug("[ChatPage]User: create new chat") @@ -146,8 +146,8 @@ AbstractMainPage { SearchBar { id: searchBar Layout.fillWidth: true - Layout.topMargin: Math.round(18 * DefaultStyle.dp) - Layout.rightMargin: Math.round(39 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(18) + Layout.rightMargin: Utils.getSizeWithScreenRatio(39) //: "Rechercher une conversation" placeholderText: qsTr("chat_search_in_history") visible: chatListView.count !== 0 || text.length !== 0 @@ -166,11 +166,11 @@ AbstractMainPage { Layout.fillHeight: true ColumnLayout { anchors.fill: parent - anchors.rightMargin: Math.round(39 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(39) Text { visible: chatListView.count === 0 && chatListView.loading === false Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Math.round(137 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(137) //: "Aucun résultat…" text: searchBar.text.length != 0 ? qsTr("list_filter_no_result_found") //: "Aucune conversation dans votre historique" @@ -184,7 +184,7 @@ AbstractMainPage { id: chatListView Layout.fillWidth: true Layout.fillHeight: true - Layout.topMargin: Math.round(39 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(39) searchBar: searchBar Control.ScrollBar.vertical: scrollbar @@ -210,7 +210,7 @@ AbstractMainPage { anchors.top: parent.top anchors.bottom: parent.bottom anchors.right: parent.right - anchors.rightMargin: Math.round(8 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(8) policy: Control.ScrollBar.AsNeeded } } @@ -228,10 +228,10 @@ AbstractMainPage { anchors.fill: parent spacing: 0 RowLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Button { - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) style: ButtonStyle.noBackground icon.source: AppIcons.leftArrow focus: true @@ -259,8 +259,8 @@ AbstractMainPage { id: newChatForm Layout.fillWidth: true Layout.fillHeight: true - Layout.rightMargin: Math.round(8 * DefaultStyle.dp) - Layout.topMargin: Math.round(18 * DefaultStyle.dp) + Layout.rightMargin: Utils.getSizeWithScreenRatio(8) + Layout.topMargin: Utils.getSizeWithScreenRatio(18) onGroupCreationRequested: { console.log("groupe call requetsed") listStackView.push(groupChatItem) @@ -350,8 +350,8 @@ AbstractMainPage { BusyIndicator { anchors.centerIn: parent visible: selectedChatView.chat && !selectedChatView.visible - indicatorHeight: visible ? Math.round(60 * DefaultStyle.dp) : 0 - indicatorWidth: Math.round(60 * DefaultStyle.dp) + indicatorHeight: visible ? Utils.getSizeWithScreenRatio(60) : 0 + indicatorWidth: Utils.getSizeWithScreenRatio(60) indicatorColor: DefaultStyle.main1_500_main } SelectedChatView { diff --git a/Linphone/view/Page/Main/Contact/ContactPage.qml b/Linphone/view/Page/Main/Contact/ContactPage.qml index e72c386ea..989a514d6 100644 --- a/Linphone/view/Page/Main/Contact/ContactPage.qml +++ b/Linphone/view/Page/Main/Contact/ContactPage.qml @@ -7,6 +7,7 @@ import UtilsCpp import EnumsToStringCpp import SettingsCpp import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractMainPage { id: mainItem @@ -116,8 +117,8 @@ FriendGui{ id: verifyDevicePopup property string deviceName property string deviceAddress - padding: Math.round(30 * DefaultStyle.dp) - width: Math.round(637 * DefaultStyle.dp) + padding: Utils.getSizeWithScreenRatio(30) + width: Utils.getSizeWithScreenRatio(637) anchors.centerIn: parent closePolicy: Control.Popup.CloseOnEscape modal: true @@ -128,14 +129,14 @@ FriendGui{ text: qsTr("contact_dialog_devices_trust_popup_message").arg(verifyDevicePopup.deviceName) buttons: RowLayout { RowLayout { - spacing: Math.round(7 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(7) CheckBox { id: neverDisplayAgainCheckbox } Text { //: Ne plus afficher text: qsTr("popup_do_not_show_again") - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) MouseArea { anchors.fill: parent onClicked: neverDisplayAgainCheckbox.toggle() @@ -146,7 +147,7 @@ FriendGui{ Layout.fillWidth: true } RowLayout { - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) BigButton { style: ButtonStyle.secondary text: qsTr("cancel") @@ -170,45 +171,45 @@ FriendGui{ } Dialog { id: trustInfoDialog - width: Math.round(637 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(637) //: "Niveau de confiance" title: qsTr("contact_dialog_devices_trust_help_title") //: "Vérifiez les appareils de votre contact pour confirmer que vos communications seront sécurisées et sans compromission.
Quand tous seront vérifiés, vous atteindrez le niveau de confiance maximal." text: qsTr("contact_dialog_devices_trust_help_message") content: RowLayout { - spacing: Math.round(50 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(50) Avatar { displayNameVal: "A C" - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) } EffectImage { imageSource: AppIcons.arrowRight colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) } Avatar { displayNameVal: "A C" secured: true - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) } } buttons: Button { //: "Ok" text: qsTr("dialog_ok") style: ButtonStyle.main - leftPadding: Math.round(30 * DefaultStyle.dp) - rightPadding: Math.round(30 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(30) + rightPadding: Utils.getSizeWithScreenRatio(30) onClicked: trustInfoDialog.close() } } leftPanelContent: FocusScope { id: leftPanel - property real leftMargin: Math.round(45 * DefaultStyle.dp) - property real rightMargin: Math.round(39 * DefaultStyle.dp) + property real leftMargin: Utils.getSizeWithScreenRatio(45) + property real rightMargin: Utils.getSizeWithScreenRatio(39) Layout.fillHeight: true Layout.fillWidth: true @@ -237,10 +238,10 @@ FriendGui{ || rightPanelStackView.currentItem.objectName !== "contactEdition" style: ButtonStyle.noBackground icon.source: AppIcons.plusCircle - Layout.preferredWidth: Math.round(28 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(28 * DefaultStyle.dp) - icon.width: Math.round(28 * DefaultStyle.dp) - icon.height: Math.round(28 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(28) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) + icon.width: Utils.getSizeWithScreenRatio(28) + icon.height: Utils.getSizeWithScreenRatio(28) onClicked: { mainItem.createContact("", "") } @@ -257,12 +258,12 @@ FriendGui{ anchors.leftMargin: leftPanel.leftMargin anchors.bottom: leftPanel.bottom enabled: mainItem.leftPanelEnabled - spacing: Math.round(38 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(38) SearchBar { id: searchBar visible: contactList.haveContacts || text.length !== 0 Layout.rightMargin: leftPanel.rightMargin - Layout.topMargin: Math.round(18 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(18) Layout.fillWidth: true //: Rechercher un contact placeholderText: qsTr("search_bar_look_for_contact_text") @@ -271,11 +272,11 @@ FriendGui{ } ColumnLayout { id: content - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) Text { visible: !contactList.loading && !contactList.haveContacts Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Math.round(137 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(137) //: Aucun résultat… text: searchBar.text.length !== 0 ? qsTr("list_filter_no_result_found") //: Aucun contact pour le moment @@ -289,7 +290,7 @@ FriendGui{ id: contactList Layout.fillWidth: true Layout.fillHeight: true - Layout.rightMargin: Math.round(8 * DefaultStyle.dp) + Layout.rightMargin: Utils.getSizeWithScreenRatio(8) searchBarText: searchBar.text hideSuggestions: true sourceFlags: LinphoneEnums.MagicSearchSource.Friends @@ -321,13 +322,13 @@ FriendGui{ property string objectName: "contactDetail" component ContactDetailLayout: ColumnLayout { id: contactDetailLayout - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) property string label property var icon property alias content: contentControl.contentItem signal titleIconClicked RowLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Text { text: contactDetailLayout.label color: DefaultStyle.main1_500_main @@ -366,10 +367,10 @@ FriendGui{ id: contentControl visible: expandButton.checked Layout.fillWidth: true - leftPadding: Math.round(20 * DefaultStyle.dp) - rightPadding: Math.round(20 * DefaultStyle.dp) - topPadding: Math.round(17 * DefaultStyle.dp) - bottomPadding: Math.round(17 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(20) + rightPadding: Utils.getSizeWithScreenRatio(20) + topPadding: Utils.getSizeWithScreenRatio(17) + bottomPadding: Utils.getSizeWithScreenRatio(17) } } ContactLayout { @@ -388,15 +389,15 @@ FriendGui{ property string computedContactName: computedContactNameObj ? computedContactNameObj.value : "" property string contactName: contact ? contact.core.fullName : computedContactName component ActionsButtons: RowLayout { - spacing: Math.round(58 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(58) LabelButton { button.icon.source: AppIcons.phone //: "Appel" label: qsTr("contact_call_action") - width: Math.round(56 * DefaultStyle.dp) - height: Math.round(56 * DefaultStyle.dp) - button.icon.width: Math.round(24 * DefaultStyle.dp) - button.icon.height: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(56) + height: Utils.getSizeWithScreenRatio(56) + button.icon.width: Utils.getSizeWithScreenRatio(24) + button.icon.height: Utils.getSizeWithScreenRatio(24) button.onClicked: mainWindow.startCallWithContact(contactDetail.contact, false, mainItem) } LabelButton { @@ -404,10 +405,10 @@ FriendGui{ visible: !SettingsCpp.disableChatFeature //: "Message" label: qsTr("contact_message_action") - width: Math.round(56 * DefaultStyle.dp) - height: Math.round(56 * DefaultStyle.dp) - button.icon.width: Math.round(24 * DefaultStyle.dp) - button.icon.height: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(56) + height: Utils.getSizeWithScreenRatio(56) + button.icon.width: Utils.getSizeWithScreenRatio(24) + button.icon.height: Utils.getSizeWithScreenRatio(24) button.onClicked: { console.debug("[ContactLayout.qml] Open conversation") mainWindow.sendMessageToContact(contactDetail.contact) @@ -418,10 +419,10 @@ FriendGui{ button.icon.source: AppIcons.videoCamera //: "Appel vidéo" label: qsTr("contact_video_call_action") - width: Math.round(56 * DefaultStyle.dp) - height: Math.round(56 * DefaultStyle.dp) - button.icon.width: Math.round(24 * DefaultStyle.dp) - button.icon.height: Math.round(24 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(56) + height: Utils.getSizeWithScreenRatio(56) + button.icon.width: Utils.getSizeWithScreenRatio(24) + button.icon.height: Utils.getSizeWithScreenRatio(24) button.onClicked: mainWindow.startCallWithContact(contactDetail.contact, true, mainItem) } } @@ -444,7 +445,7 @@ FriendGui{ Layout.fillWidth: true text: contactDetail.contact ? contactDetail.contact.core.presenceStatus : "" color: contactDetail.contact ? contactDetail.contact.core.presenceColor : 'transparent' - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) } }, ActionsButtons { @@ -455,11 +456,11 @@ FriendGui{ content: Flickable { contentWidth: parent.width ColumnLayout { - spacing: Math.round(32 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(32) anchors.left: parent.left anchors.right: parent.right ColumnLayout { - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) Layout.fillWidth: true ContactDetailLayout { id: infoLayout @@ -472,24 +473,24 @@ FriendGui{ implicitHeight: contentHeight width: parent.width clip: true - spacing: Math.round(9 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(9) model: VariantList { model: (mainItem.selectedContact ? UtilsCpp.append(mainItem.selectedContact.core.addresses, mainItem.selectedContact.core.phoneNumbers) : []) } delegate: Item { property var listViewModelData: modelData width: addrList.width - height: Math.round(46 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(46) ColumnLayout { anchors.fill: parent - // anchors.topMargin: Math.round(5 * DefaultStyle.dp) + // anchors.topMargin: Utils.getSizeWithScreenRatio(5) RowLayout { Layout.fillWidth: true // Layout.fillHeight: true // Layout.alignment: Qt.AlignVCenter - // Layout.topMargin: Math.round(10 * DefaultStyle.dp) - // Layout.bottomMargin: Math.round(10 * DefaultStyle.dp) + // Layout.topMargin: Utils.getSizeWithScreenRatio(10) + // Layout.bottomMargin: Utils.getSizeWithScreenRatio(10) ColumnLayout { Layout.fillWidth: true Text { @@ -528,9 +529,9 @@ FriendGui{ Rectangle { visible: index != addrList.model.count - 1 Layout.fillWidth: true - Layout.preferredHeight: Math.max(Math.round(1 * DefaultStyle.dp), 1) - Layout.rightMargin: Math.round(3 * DefaultStyle.dp) - Layout.leftMargin: Math.round(3 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) + Layout.rightMargin: Utils.getSizeWithScreenRatio(3) + Layout.leftMargin: Utils.getSizeWithScreenRatio(3) color: DefaultStyle.main2_200 clip: true } @@ -543,14 +544,14 @@ FriendGui{ && companyText.text.length != 0 || jobText.text.length != 0 Layout.fillWidth: true - topPadding: Math.round(17 * DefaultStyle.dp) - bottomPadding: Math.round(17 * DefaultStyle.dp) - leftPadding: Math.round(20 * DefaultStyle.dp) - rightPadding: Math.round(20 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(17) + bottomPadding: Utils.getSizeWithScreenRatio(17) + leftPadding: Utils.getSizeWithScreenRatio(20) + rightPadding: Utils.getSizeWithScreenRatio(20) contentItem: ColumnLayout { RowLayout { - height: Math.round(50 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(50) visible: companyText.text.length != 0 Text { //: "Société :" @@ -571,7 +572,7 @@ FriendGui{ } } RowLayout { - height: Math.round(50 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(50) visible: jobText.text.length != 0 Text { //: "Poste :" @@ -603,8 +604,8 @@ FriendGui{ style: ButtonStyle.noBackground contentItem: RowLayout { EffectImage { - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) imageSource: AppIcons.shareNetwork colorizationColor: DefaultStyle.main2_600 } @@ -620,8 +621,8 @@ FriendGui{ Layout.fillWidth: true } EffectImage { - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) imageSource: AppIcons.rightArrow colorizationColor: DefaultStyle.main2_600 } @@ -638,7 +639,7 @@ FriendGui{ icon: AppIcons.question onTitleIconClicked: trustInfoDialog.open() content: ColumnLayout { - spacing: Math.round(13 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(13) Text { //: "Niveau de confiance - Appareils vérifiés" text: qsTr("contact_dialog_devices_trust_title") @@ -655,22 +656,22 @@ FriendGui{ ProgressBar { visible: deviceList.count > 0 Layout.fillWidth: true - Layout.preferredHeight: Math.round(28 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) value: mainItem.selectedContact ? mainItem.selectedContact.core.verifiedDeviceCount / deviceList.count : 0 } ListView { id: deviceList Layout.fillWidth: true Layout.preferredHeight: Math.min( - Math.round(200 * DefaultStyle.dp), + Utils.getSizeWithScreenRatio(200), contentHeight) clip: true model: mainItem.selectedContact ? mainItem.selectedContact.core.devices : [] - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) delegate: RowLayout { id: deviceDelegate width: deviceList.width - height: Math.round(30 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(30) property var listViewModelData: modelData property var callObj property CallGui deviceCall: callObj ? callObj.value : null @@ -678,7 +679,7 @@ FriendGui{ property string deviceName: listViewModelData.name.length != 0 ? listViewModelData.name : qsTr("contact_device_without_name") Text { text: deviceDelegate.deviceName - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) } Item { Layout.fillWidth: true @@ -686,12 +687,12 @@ FriendGui{ EffectImage { visible: listViewModelData.securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified imageSource: AppIcons.trusted - Layout.preferredWidth: Math.round(22 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(22 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(22) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(22) } SmallButton { - // Layout.preferredHeight: Math.round(30 * DefaultStyle.dp) + // Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) visible: listViewModelData.securityLevel != LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified icon.source: AppIcons.warningCircle style: ButtonStyle.tertiary @@ -726,12 +727,12 @@ FriendGui{ //: "Autres actions" label: qsTr("contact_details_actions_title") content: ColumnLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) ColumnLayout { visible: mainItem.selectedContact && mainItem.selectedContact.core.isStored && !mainItem.selectedContact.core.readOnly IconLabelButton { Layout.fillWidth: true - Layout.preferredHeight: Math.round(50 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) icon.source: AppIcons.pencil //: "Éditer" text: qsTr("contact_details_edit") @@ -740,7 +741,7 @@ FriendGui{ } Rectangle { Layout.fillWidth: true - Layout.preferredHeight: Math.max(Math.round(1 * DefaultStyle.dp), 1) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) color: DefaultStyle.main2_200 } } @@ -748,7 +749,7 @@ FriendGui{ visible: mainItem.selectedContact && mainItem.selectedContact.core.isStored && !mainItem.selectedContact.core.readOnly IconLabelButton { Layout.fillWidth: true - Layout.preferredHeight: Math.round(50 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) icon.source: mainItem.selectedContact && mainItem.selectedContact.core.starred ? AppIcons.heartFill : AppIcons.heart text: mainItem.selectedContact @@ -764,13 +765,13 @@ FriendGui{ } Rectangle { Layout.fillWidth: true - Layout.preferredHeight: Math.max(Math.round(1 * DefaultStyle.dp), 1) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) color: DefaultStyle.main2_200 } } IconLabelButton { Layout.fillWidth: true - Layout.preferredHeight: Math.round(50 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) icon.source: AppIcons.shareNetwork //: "Partager" text: qsTr("contact_details_share") @@ -803,38 +804,38 @@ FriendGui{ } // IconLabelButton { // Layout.fillWidth: true - // Layout.preferredHeight: Math.round(50 * DefaultStyle.dp) + // Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) // icon.source: AppIcons.bellSlash // text: qsTr("Mettre en sourdine") // onClicked: console.log("TODO : mute contact") // } // Rectangle { // Layout.fillWidth: true - // Layout.preferredHeight: Math.max(Math.round(1 * DefaultStyle.dp), 1) + // Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) // color: DefaultStyle.main2_200 // } // IconLabelButton { // Layout.fillWidth: true - // Layout.preferredHeight: Math.round(50 * DefaultStyle.dp) + // Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) // icon.source: AppIcons.empty // text: qsTr("Bloquer") // onClicked: console.log("TODO : block contact") // } // Rectangle { // Layout.fillWidth: true - // Layout.preferredHeight: Math.max(Math.round(1 * DefaultStyle.dp), 1) + // Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) // color: DefaultStyle.main2_200 // } ColumnLayout { visible: mainItem.selectedContact && mainItem.selectedContact.core.isStored && !mainItem.selectedContact.core.readOnly Rectangle { Layout.fillWidth: true - Layout.preferredHeight: Math.max(Math.round(1 * DefaultStyle.dp), 1) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) color: DefaultStyle.main2_200 } IconLabelButton { Layout.fillWidth: true - Layout.preferredHeight: Math.round(50 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) icon.source: AppIcons.trashCan //: "Supprimer ce contact" text: qsTr("contact_details_delete") diff --git a/Linphone/view/Page/Main/Help/HelpPage.qml b/Linphone/view/Page/Main/Help/HelpPage.qml index 3f4a061c2..a9defedc0 100644 --- a/Linphone/view/Page/Main/Help/HelpPage.qml +++ b/Linphone/view/Page/Main/Help/HelpPage.qml @@ -3,10 +3,12 @@ import QtQuick.Effects import QtQuick.Layouts import QtQuick.Controls.Basic as Control import Linphone -import UtilsCpp 1.0 -import ConstantsCpp 1.0 -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import UtilsCpp +import ConstantsCpp import SettingsCpp +import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + AbstractMainPage { @@ -19,18 +21,18 @@ AbstractMainPage { id: leftPanel Layout.fillWidth: true Layout.fillHeight: true - property real sideMargin: Math.round(45 * DefaultStyle.dp) - spacing: Math.round(5 * DefaultStyle.dp) + property real sideMargin: Utils.getSizeWithScreenRatio(45) + spacing: Utils.getSizeWithScreenRatio(5) RowLayout { Layout.fillWidth: true Layout.leftMargin: leftPanel.sideMargin Layout.rightMargin: leftPanel.sideMargin - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) Button { icon.source: AppIcons.leftArrow style: ButtonStyle.noBackground - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) onClicked: { mainItem.goBack() } @@ -48,10 +50,10 @@ AbstractMainPage { Image { id: aboutImage Layout.fillWidth: true - Layout.preferredHeight: Math.round(100 * DefaultStyle.dp) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(100) Layout.leftMargin: leftPanel.sideMargin Layout.rightMargin: leftPanel.sideMargin - Layout.topMargin: Math.round(41 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(41) fillMode: Image.PreserveAspectFit source: SettingsCpp.themeAboutPictureUrl visible: source !== "" && status === Image.Ready @@ -64,7 +66,7 @@ AbstractMainPage { Text { Layout.leftMargin: leftPanel.sideMargin Layout.rightMargin: leftPanel.sideMargin - Layout.topMargin: Math.round((aboutImage.visible ? 41 : 24) * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(aboutImage.visible ? 41 : 24) Layout.fillWidth: true //: "À propos de %1" text: qsTr("help_about_title").arg(applicationName) @@ -75,8 +77,8 @@ AbstractMainPage { Layout.fillWidth: true Layout.leftMargin: leftPanel.sideMargin Layout.rightMargin: leftPanel.sideMargin - Layout.topMargin: Math.round(24 * DefaultStyle.dp) - spacing: Math.round(32 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(24) + spacing: Utils.getSizeWithScreenRatio(32) HelpIconLabelButton { Layout.fillWidth: true iconSource: AppIcons.detective @@ -122,7 +124,7 @@ AbstractMainPage { Text { Layout.leftMargin: leftPanel.sideMargin Layout.rightMargin: leftPanel.sideMargin - Layout.topMargin: Math.round(32 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(32) Layout.fillWidth: true //: "À propos de %1" text: qsTr("help_about_title").arg(applicationName) @@ -134,7 +136,7 @@ AbstractMainPage { Layout.fillWidth: true Layout.leftMargin: leftPanel.sideMargin Layout.rightMargin: leftPanel.sideMargin - Layout.topMargin: Math.round(24 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(24) iconSource: AppIcons.debug //: "Dépannage" title: qsTr("help_troubleshooting_title") diff --git a/Linphone/view/Page/Main/Meeting/MeetingPage.qml b/Linphone/view/Page/Main/Meeting/MeetingPage.qml index 06e0b169f..5b93e49c7 100644 --- a/Linphone/view/Page/Main/Meeting/MeetingPage.qml +++ b/Linphone/view/Page/Main/Meeting/MeetingPage.qml @@ -5,6 +5,7 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // TODO : spacing AbstractMainPage { @@ -74,7 +75,7 @@ AbstractMainPage { id: leftPanelStackView Layout.fillWidth: true Layout.fillHeight: true - Layout.leftMargin: Math.round(45 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(45) initialItem: listLayout clip: true } @@ -84,7 +85,7 @@ AbstractMainPage { property ConferenceInfoGui confInfoToDelete property bool cancel: false signal cancelRequested() - // width: Math.round(278 * DefaultStyle.dp) + // width: Utils.getSizeWithScreenRatio(278) //: "Souhaitez-vous annuler et supprimer cette réunion ?" text: cancel ? qsTr("meeting_schedule_cancel_dialog_message") //: Souhaitez-vous supprimer cette réunion ? @@ -133,11 +134,11 @@ AbstractMainPage { Control.ScrollView { id: overridenRightPanel - width: Math.round((393 + 10) * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(393 + 10) anchors.top: parent.top anchors.bottom: parent.bottom - anchors.topMargin: Math.round(58 * DefaultStyle.dp) - anchors.bottomMargin: Math.round(30 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(58) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(30) height: parent.height - anchors.topMargin anchors.horizontalCenter: parent.horizontalCenter contentWidth: width @@ -150,8 +151,8 @@ AbstractMainPage { } ColumnLayout { anchors.fill: parent - anchors.rightMargin: Math.round(10 * DefaultStyle.dp) - width: Math.round(393 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(10) + width: Utils.getSizeWithScreenRatio(393) Control.StackView { id: overridenRightPanelStackView Layout.fillWidth: true @@ -177,7 +178,7 @@ AbstractMainPage { anchors.fill: parent spacing: 0 RowLayout { - Layout.rightMargin: Math.round(38 * DefaultStyle.dp) + Layout.rightMargin: Utils.getSizeWithScreenRatio(38) Layout.alignment: Qt.AlignTop Layout.fillWidth: true spacing: 0 @@ -194,10 +195,10 @@ AbstractMainPage { id: newConfButton style: ButtonStyle.noBackground icon.source: AppIcons.plusCircle - Layout.preferredWidth: Math.round(28 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(28 * DefaultStyle.dp) - icon.width: Math.round(28 * DefaultStyle.dp) - icon.height: Math.round(28 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(28) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) + icon.width: Utils.getSizeWithScreenRatio(28) + icon.height: Utils.getSizeWithScreenRatio(28) KeyNavigation.down: scrollToCurrentDateButton onClicked: { mainItem.editConference() @@ -206,15 +207,15 @@ AbstractMainPage { } RowLayout { visible: conferenceList.count !== 0 || searchBar.text.length !== 0 - spacing: Math.round(11 * DefaultStyle.dp) - Layout.topMargin: Math.round(18 * DefaultStyle.dp) - Layout.rightMargin: Math.round(38 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(11) + Layout.topMargin: Utils.getSizeWithScreenRatio(18) + Layout.rightMargin: Utils.getSizeWithScreenRatio(38) KeyNavigation.up: newConfButton KeyNavigation.down: searchBar Button { id: scrollToCurrentDateButton - Layout.preferredWidth: Math.round(32 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) icon.source: AppIcons.calendar style: ButtonStyle.noBackground onClicked: conferenceList.scrollToCurrentDate() @@ -236,7 +237,7 @@ AbstractMainPage { } Text { visible: conferenceList.count === 0 && !conferenceList.loading - Layout.topMargin: Math.round(137 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(137) Layout.fillHeight: true Layout.alignment: Qt.AlignHCenter //: "Aucun résultat…" @@ -251,7 +252,7 @@ AbstractMainPage { MeetingListView { id: conferenceList // Remove 24 from first section padding because we cannot know that it is the first section. 24 is the margins between sections. - Layout.topMargin: Math.round(38 * DefaultStyle.dp) - Math.round(24 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(38 - 24) Layout.fillWidth: true Layout.fillHeight: true @@ -296,18 +297,18 @@ AbstractMainPage { objectName: "createConf" property ConferenceInfoGui conferenceInfoGui ColumnLayout { - spacing: Math.round(33 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(33) anchors.fill: parent RowLayout { - spacing: Math.round(5 * DefaultStyle.dp) - Layout.rightMargin: Math.round(35 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) + Layout.rightMargin: Utils.getSizeWithScreenRatio(35) Button { id: backButton style: ButtonStyle.noBackground icon.source: AppIcons.leftArrow focus: true - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) KeyNavigation.right: createButton KeyNavigation.down: meetingSetup onClicked: { @@ -362,7 +363,7 @@ AbstractMainPage { anchors.top: parent.top anchors.bottom: parent.bottom anchors.right: parent.right - anchors.rightMargin: Math.round(8 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(8) } MeetingForm { id: meetingSetup @@ -370,7 +371,7 @@ AbstractMainPage { isCreation: true anchors.left: parent.left anchors.right: parent.right - anchors.rightMargin: Math.round(35 * DefaultStyle.dp) + anchors.rightMargin: Utils.getSizeWithScreenRatio(35) Connections { target: meetingSetup.conferenceInfoGui ? meetingSetup.conferenceInfoGui.core : null function onConferenceSchedulerStateChanged() { @@ -436,13 +437,13 @@ AbstractMainPage { Section { Layout.fillWidth: true content: RowLayout { - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) Layout.preferredWidth: overridenRightPanelStackView.width Button { id: backButton icon.source: AppIcons.leftArrow - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) style: ButtonStyle.noBackground KeyNavigation.left: saveButton KeyNavigation.right: titleText @@ -454,12 +455,12 @@ AbstractMainPage { } } RowLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage{ imageSource: AppIcons.usersThree colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } TextInput { id: titleText @@ -467,7 +468,7 @@ AbstractMainPage { color: DefaultStyle.main2_600 clip: true font { - pixelSize: Math.round(20 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(20) weight: Typography.h4.weight } KeyNavigation.left: backButton @@ -562,8 +563,8 @@ AbstractMainPage { property ConferenceInfoGui conferenceInfoGui ColumnLayout { id: addParticipantsLayout - spacing: Math.round(18 * DefaultStyle.dp) - anchors.rightMargin: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(18) + anchors.rightMargin: Utils.getSizeWithScreenRatio(8) anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top @@ -572,16 +573,16 @@ AbstractMainPage { id: title Layout.fillWidth: true Layout.preferredHeight: childrenRect.height - spacing: Math.round(4 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(4) RowLayout { id: addParticipantsButtons - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Button { id: addParticipantsBackButton style: ButtonStyle.noBackgroundOrange icon.source: AppIcons.leftArrow - icon.width: Math.round(24 * DefaultStyle.dp) - icon.height: Math.round(24 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) KeyNavigation.right: addButton KeyNavigation.down: addParticipantLayout onClicked: container.pop() @@ -592,7 +593,7 @@ AbstractMainPage { color: DefaultStyle.main1_500_main maximumLineCount: 1 font { - pixelSize: Math.round(18 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(18) weight: Typography.h4.weight } Layout.fillWidth: true @@ -617,8 +618,8 @@ AbstractMainPage { Layout.leftMargin: addParticipantsBackButton.width + addParticipantsButtons.spacing maximumLineCount: 1 font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } Layout.fillWidth: true } @@ -647,24 +648,24 @@ AbstractMainPage { anchors.top: parent.top // anchors.fill: parent visible: mainItem.selectedConference - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) Section { visible: mainItem.selectedConference Layout.fillWidth: true content: RowLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.usersThree colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } Text { Layout.fillWidth: true text: mainItem.selectedConference && mainItem.selectedConference.core? mainItem.selectedConference.core.subject : "" maximumLineCount: 1 font { - pixelSize: Math.round(20 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(20) weight: Typography.h4.weight } } @@ -681,13 +682,13 @@ AbstractMainPage { KeyNavigation.right: deletePopup KeyNavigation.up: joinButton KeyNavigation.down: shareNetworkButton - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) onClicked: mainItem.editConference(mainItem.selectedConference) } PopupButton { id: deletePopup - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) contentImageColor: DefaultStyle.main1_500_main KeyNavigation.left: editButton.visible ? editButton : leftPanelStackView.currentItem KeyNavigation.right: leftPanelStackView.currentItem @@ -716,14 +717,14 @@ AbstractMainPage { } Section { content: ColumnLayout { - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) width: parent.width RowLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) Layout.fillWidth: true EffectImage { - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) colorizationColor: DefaultStyle.main2_600 imageSource: AppIcons.videoCamera } @@ -767,10 +768,10 @@ AbstractMainPage { } } RowLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) imageSource: AppIcons.clock colorizationColor: DefaultStyle.main2_600 } @@ -782,16 +783,16 @@ AbstractMainPage { + UtilsCpp.toDateHourString(mainItem.selectedConference.core.endDateTime) : '' font { - pixelSize: Math.round(14 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(14) capitalization: Font.Capitalize } } } RowLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) imageSource: AppIcons.globe colorizationColor: DefaultStyle.main2_600 } @@ -800,7 +801,7 @@ AbstractMainPage { //: "Fuseau horaire" text: "%1: %2".arg(qsTr("meeting_schedule_timezone_title")).arg(mainItem.selectedConference && mainItem.selectedConference.core ? (mainItem.selectedConference.core.timeZoneModel.displayName + ", " + mainItem.selectedConference.core.timeZoneModel.countryName) : "") font { - pixelSize: Math.round(14 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(14) capitalization: Font.Capitalize } } @@ -810,10 +811,10 @@ AbstractMainPage { Section { visible: mainItem.selectedConference && mainItem.selectedConference.core?.description.length != 0 content: RowLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) imageSource: AppIcons.note colorizationColor: DefaultStyle.main2_600 } @@ -821,30 +822,30 @@ AbstractMainPage { text: mainItem.selectedConference && mainItem.selectedConference.core ? mainItem.selectedConference.core.description : "" Layout.fillWidth: true font { - pixelSize: Math.round(14 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(14) } } } } Section { content: RowLayout { - spacing: Math.round(8 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) imageSource: AppIcons.userRectangle colorizationColor: DefaultStyle.main2_600 } Avatar { - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) _address: mainItem.selectedConference && mainItem.selectedConference.core ? mainItem.selectedConference.core.organizerAddress : "" secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified } Text { text: mainItem.selectedConference && mainItem.selectedConference.core ? mainItem.selectedConference.core.organizerName : "" font { - pixelSize: Math.round(14 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(14) capitalization: Font.Capitalize } } @@ -854,13 +855,13 @@ AbstractMainPage { visible: participantList.count > 0 content: RowLayout { Layout.preferredHeight: participantList.contentHeight - width: Math.round(393 * DefaultStyle.dp) - spacing: Math.round(8 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(393) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) Layout.alignment: Qt.AlignLeft | Qt.AlignTop - Layout.topMargin: Math.round(20 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(20) imageSource: AppIcons.usersTwo colorizationColor: DefaultStyle.main2_600 } @@ -878,11 +879,11 @@ AbstractMainPage { visible: participantList.height < participantList.contentHeight } delegate: RowLayout { - height: Math.round(56 * DefaultStyle.dp) - width: participantList.width - participantScrollBar.width - Math.round(5 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(56) + width: participantList.width - participantScrollBar.width - Utils.getSizeWithScreenRatio(5) Avatar { - Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) _address: modelData.address secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified shadowEnabled: false @@ -893,7 +894,7 @@ AbstractMainPage { maximumLineCount: 1 Layout.fillWidth: true font { - pixelSize: Math.round(14 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(14) capitalization: Font.Capitalize } } @@ -903,8 +904,8 @@ AbstractMainPage { visible: mainItem.selectedConference && mainItem.selectedConference.core?.organizerAddress === modelData.address color: DefaultStyle.main2_400 font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } @@ -916,7 +917,7 @@ AbstractMainPage { visible: mainItem.selectedConference && mainItem.selectedConference.core?.state !== LinphoneEnums.ConferenceInfoState.Cancelled Layout.fillWidth: true Layout.preferredHeight: implicitHeight - Layout.bottomMargin: Math.round(5 * DefaultStyle.dp) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(5) //: "Rejoindre la réunion" text: qsTr("meeting_info_join_title") focus: true diff --git a/Linphone/view/Page/Main/Start/WelcomePage.qml b/Linphone/view/Page/Main/Start/WelcomePage.qml index 716c2f52e..811e71694 100644 --- a/Linphone/view/Page/Main/Start/WelcomePage.qml +++ b/Linphone/view/Page/Main/Start/WelcomePage.qml @@ -4,6 +4,7 @@ import QtQuick.Controls.Basic as Control import Linphone import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils LoginLayout { id: mainItem @@ -15,18 +16,18 @@ LoginLayout { //: "Bienvenue" text: qsTr("welcome_page_title") Layout.alignment: Qt.AlignVCenter - Layout.leftMargin: Math.round(132 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(132) color: DefaultStyle.main2_800 font { - pixelSize: Math.round(96 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(96) weight: Typography.h4.weight } scaleLettersFactor: 1.1 }, Text { Layout.alignment: Qt.AlignBottom - Layout.leftMargin: Math.round(29 * DefaultStyle.dp) - Layout.bottomMargin: Math.round(19 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(29) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(19) color: DefaultStyle.main2_800 //: "sur %1" text: qsTr("welcome_page_subtitle").arg(applicationName) @@ -42,7 +43,7 @@ LoginLayout { SmallButton { visible: carousel.currentIndex < (carousel.itemsCount - 1) flat: true - Layout.rightMargin: Math.round(50 * DefaultStyle.dp) + Layout.rightMargin: Utils.getSizeWithScreenRatio(50) Layout.alignment: Qt.AlignVCenter | Layout.AlignRight style: ButtonStyle.noBackground //: "Passer" @@ -55,26 +56,26 @@ LoginLayout { } ] centerContent: ColumnLayout { - spacing: Math.round(76 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(76) anchors.left: parent.left anchors.top: parent.top - anchors.leftMargin: Math.round(308 * DefaultStyle.dp) - anchors.topMargin: Math.round(166 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(308) + anchors.topMargin: Utils.getSizeWithScreenRatio(166) RowLayout { id: carouselLayout - spacing: Math.round(76 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(76) Image { id: carouselImg - // Layout.rightMargin: Math.round(40 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(153.22 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(155.9 * DefaultStyle.dp) + // Layout.rightMargin: Utils.getSizeWithScreenRatio(40) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(153) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(156) fillMode: Image.PreserveAspectFit source: carousel.currentIndex == 0 ? AppIcons.welcomeLinphoneLogo : carousel.currentIndex == 1 ? AppIcons.welcomeLock : AppIcons.welcomeOpenSource } Carousel { id: carousel - Layout.leftMargin: Math.round(75.78 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(76) itemsCount: slideRepeater.count itemsList: Repeater { id: slideRepeater @@ -91,7 +92,7 @@ LoginLayout { text: qsTr("welcome_page_3_message")} ] ColumnLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Text { id: title text: modelData.title @@ -102,7 +103,7 @@ LoginLayout { } Text { id: txt - Layout.maximumWidth: Math.round(361 * DefaultStyle.dp) + Layout.maximumWidth: Utils.getSizeWithScreenRatio(361) wrapMode: Text.WordWrap font { pixelSize: Typography.p1.pixelSize @@ -116,7 +117,7 @@ LoginLayout { } BigButton { - Layout.leftMargin: Math.round(509 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(509) style: ButtonStyle.main //: "Suivant" text: carousel.currentIndex < (carousel.itemsCount - 1) ? qsTr("next") diff --git a/Linphone/view/Page/Window/AbstractWindow.qml b/Linphone/view/Page/Window/AbstractWindow.qml index f7d9594ed..5f24c8126 100644 --- a/Linphone/view/Page/Window/AbstractWindow.qml +++ b/Linphone/view/Page/Window/AbstractWindow.qml @@ -7,13 +7,14 @@ import UtilsCpp import SettingsCpp import DesktopToolsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ApplicationWindow { id: mainWindow x: 0 y: 0 - width: Math.min(Math.round(1512 * DefaultStyle.dp), Screen.desktopAvailableWidth) - height: Math.min(Math.round(982 * DefaultStyle.dp), Screen.desktopAvailableHeight) + width: Math.min(Utils.getSizeWithScreenRatio(1512), Screen.desktopAvailableWidth) + height: Math.min(Utils.getSizeWithScreenRatio(982), Screen.desktopAvailableHeight) onActiveChanged: UtilsCpp.setLastActiveWindow(this) @@ -47,7 +48,7 @@ ApplicationWindow { // For C++, requestDialog need to be call directly onAccepted: requestDialog ? requestDialog.result(1) : callback(1) onRejected: requestDialog ? requestDialog.result(0) : callback(0) - width: title.length === 0 ? Math.round(278 * DefaultStyle.dp) : Math.round(637 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(title.length === 0 ? 278 : 637) } } @@ -59,16 +60,16 @@ ApplicationWindow { signal addressChosen(string address) underlineColor: DefaultStyle.main1_500_main anchors.centerIn: parent - width: Math.round(370 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(370) modal: true - leftPadding: Math.round(15 * DefaultStyle.dp) - rightPadding: Math.round(15 * DefaultStyle.dp) - topPadding: Math.round(20 * DefaultStyle.dp) - bottomPadding: Math.round(25 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(15) + rightPadding: Utils.getSizeWithScreenRatio(15) + topPadding: Utils.getSizeWithScreenRatio(20) + bottomPadding: Utils.getSizeWithScreenRatio(25) contentItem: ColumnLayout { - spacing: Math.round(16 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(16) RowLayout { - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) width: addressChooserPopup.width Text { //: "Choisissez un numéro ou adresse SIP" @@ -83,8 +84,8 @@ ApplicationWindow { RoundButton { Layout.alignment: Qt.AlignVCenter style: ButtonStyle.noBackground - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) icon.source:AppIcons.closeX onClicked: addressChooserPopup.close() } @@ -96,18 +97,18 @@ ApplicationWindow { } Layout.fillWidth: true Layout.preferredHeight: contentHeight - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) delegate: Item { width: popuplist.width - height: Math.round(56 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(56) ColumnLayout { width: popuplist.width anchors.verticalCenter: parent.verticalCenter - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) ColumnLayout { - spacing: Math.round(7 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(7) Text { - Layout.leftMargin: Math.round(5 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(5) text: modelData.label + " :" font { pixelSize: Typography.p2.pixelSize @@ -115,7 +116,7 @@ ApplicationWindow { } } Text { - Layout.leftMargin: Math.round(5 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(5) text: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(modelData.address) : modelData.address font { pixelSize: Typography.p1.pixelSize @@ -126,7 +127,7 @@ ApplicationWindow { Rectangle { visible: index != popuplist.model.count - 1 Layout.fillWidth: true - Layout.preferredHeight: Math.max(Math.round(1 * DefaultStyle.dp), 1) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) color: DefaultStyle.main2_200 } } @@ -263,7 +264,7 @@ ApplicationWindow { property real nextY: mainWindow.height property list popupList property int popupCount: popupList.length - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) onPopupCountChanged: { nextY = mainWindow.height for(var i = 0; i < popupCount; ++i) { @@ -282,9 +283,9 @@ ApplicationWindow { modal: true closePolicy: Popup.NoAutoClose anchors.centerIn: parent - padding: Math.round(20 * DefaultStyle.dp) + padding: Utils.getSizeWithScreenRatio(20) underlineColor: DefaultStyle.main1_500_main - radius: Math.round(15 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(15) } FPSCounter{ anchors.top: parent.top @@ -297,7 +298,7 @@ ApplicationWindow { id: fpsText font.bold: true font.italic: true - font.pixelSize: Math.round(14 * DefaultStyle.dp) + font.pixelSize: Utils.getSizeWithScreenRatio(14) // "%1 FPS" text: qsTr("fps_counter").arg(parent.fps) color: parent.fps < 30 ? DefaultStyle.danger_500_main : DefaultStyle.main2_900 diff --git a/Linphone/view/Page/Window/Call/CallsWindow.qml b/Linphone/view/Page/Window/Call/CallsWindow.qml index 5b9fef840..51a242b8b 100644 --- a/Linphone/view/Page/Window/Call/CallsWindow.qml +++ b/Linphone/view/Page/Window/Call/CallsWindow.qml @@ -13,8 +13,8 @@ import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle AbstractWindow { id: mainWindow flags: Qt.Window - minimumWidth: Math.round(1020 * DefaultStyle.dp) - minimumHeight: Math.round(700 * DefaultStyle.dp) + minimumWidth: Utils.getSizeWithScreenRatio(1020) + minimumHeight: Utils.getSizeWithScreenRatio(700) // modality: Qt.WindowModal property CallGui call @@ -200,7 +200,7 @@ AbstractWindow { mainWindow.callTerminatedByUser = true call.core.lTerminateAllCalls() } - width: Math.round(278 * DefaultStyle.dp) + width: Utils.getSizeWithScreenRatio(278) //: "Terminer tous les appels en cours ?" title: qsTr("call_close_window_dialog_title") //: "La fenêtre est sur le point d'être fermée. Cela terminera tous les appels en cours." @@ -237,12 +237,12 @@ AbstractWindow { background: Rectangle { anchors.fill: parent color: bottomButton.enabled ? disabledIcon ? DefaultStyle.grey_500 : bottomButton.pressed || bottomButton.checked ? DefaultStyle.main2_400 : DefaultStyle.grey_500 : DefaultStyle.grey_600 - radius: Math.round(71 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(71) } icon.source: disabledIcon && bottomButton.checked ? disabledIcon : enabledIcon - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) contentImageColor: DefaultStyle.grey_0 } ZrtpAuthenticationDialog { @@ -260,13 +260,13 @@ AbstractWindow { } Control.Control { id: zrtpValidationToast - // width: Math.round(269 * DefaultStyle.dp) + // width: Utils.getSizeWithScreenRatio(269) y: -height * 2 z: 1 - topPadding: Math.round(8 * DefaultStyle.dp) - bottomPadding: Math.round(8 * DefaultStyle.dp) - leftPadding: Math.round(50 * DefaultStyle.dp) - rightPadding: Math.round(50 * DefaultStyle.dp) + topPadding: Utils.getSizeWithScreenRatio(8) + bottomPadding: Utils.getSizeWithScreenRatio(8) + leftPadding: Utils.getSizeWithScreenRatio(50) + rightPadding: Utils.getSizeWithScreenRatio(50) anchors.horizontalCenter: parent.horizontalCenter clip: true function open() { @@ -284,15 +284,15 @@ AbstractWindow { anchors.fill: parent color: DefaultStyle.grey_0 border.color: DefaultStyle.info_500_main - border.width: Math.max(Math.round(1 * DefaultStyle.dp), 1) - radius: Math.round(50 * DefaultStyle.dp) + border.width: Utils.getSizeWithScreenRatio(1) + radius: Utils.getSizeWithScreenRatio(50) } contentItem: RowLayout { // anchors.centerIn: parent Image { source: AppIcons.trusted - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) fillMode: Image.PreserveAspectFit Layout.fillWidth: true } @@ -302,7 +302,7 @@ AbstractWindow { text: qsTr("call_can_be_trusted_toast") Layout.fillWidth: true font { - pixelSize: Math.round(14 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(14) } } } @@ -319,26 +319,26 @@ AbstractWindow { ColumnLayout { anchors.fill: parent - spacing: Math.round(10 * DefaultStyle.dp) - anchors.bottomMargin: Math.round(10 * DefaultStyle.dp) - anchors.topMargin: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(10) + anchors.topMargin: Utils.getSizeWithScreenRatio(10) Item { id: headerItem - Layout.margins: Math.round(10 * DefaultStyle.dp) - Layout.leftMargin: Math.round(20 * DefaultStyle.dp) + Layout.margins: Utils.getSizeWithScreenRatio(10) + Layout.leftMargin: Utils.getSizeWithScreenRatio(20) Layout.fillWidth: true - Layout.minimumHeight: Math.round(25 * DefaultStyle.dp) + Layout.minimumHeight: Utils.getSizeWithScreenRatio(25) RowLayout { anchors.left: parent.left anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) RowLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) EffectImage { id: callStatusIcon - Layout.preferredWidth: Math.round(30 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(30 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) // TODO : change with broadcast or meeting icon when available imageSource: !mainWindow.call ? AppIcons.meeting : (mainWindow.callState === LinphoneEnums.CallState.End || mainWindow.callState === LinphoneEnums.CallState.Released) ? AppIcons.endCall : (mainWindow.callState === LinphoneEnums.CallState.Paused || mainWindow.callState === LinphoneEnums.CallState.PausedByRemote) ? AppIcons.pause : mainWindow.conference ? AppIcons.usersThree : mainWindow.call.core.dir === LinphoneEnums.CallDir.Outgoing ? AppIcons.arrowUpRight : AppIcons.arrowDownLeft colorizationColor: !mainWindow.call @@ -358,9 +358,9 @@ AbstractWindow { } } ColumnLayout { - spacing: Math.round(6 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(6) RowLayout { - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) Text { id: callStatusText property string remoteName: mainWindow.call ? qsTr("call_dir").arg(EnumsToStringCpp.dirToString(mainWindow.call.core.dir)) : "" @@ -400,9 +400,9 @@ AbstractWindow { || mainWindow.callState === LinphoneEnums.CallState.StreamsRunning) Layout.fillHeight: true - Layout.topMargin: Math.round(10 * DefaultStyle.dp) - Layout.bottomMargin: Math.round(2 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(2 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(10) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(2) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(2) color: DefaultStyle.grey_0 } Text { @@ -418,7 +418,7 @@ AbstractWindow { === LinphoneEnums.CallState.StreamsRunning } Text { - Layout.leftMargin: Math.round(14 * DefaultStyle.dp) + Layout.leftMargin: Utils.getSizeWithScreenRatio(14) id: conferenceDate text: mainWindow.conferenceInfo ? mainWindow.conferenceInfo.core.getStartEndDateString() : "" color: DefaultStyle.grey_0 @@ -431,7 +431,7 @@ AbstractWindow { } RowLayout { id: securityStateLayout - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) visible: false Connections { target: mainWindow @@ -449,13 +449,13 @@ AbstractWindow { BusyIndicator { //: Waiting for encryption visible: encryptionStatusText.text === qsTr("call_waiting_for_encryption_info") - Layout.preferredWidth: Math.round(15 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(15 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(15) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(15) indicatorColor: DefaultStyle.grey_0 } EffectImage { - Layout.preferredWidth: Math.round(15 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(15 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(15) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(15) colorizationColor: mainWindow.call ? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp ? DefaultStyle.info_500_main @@ -505,8 +505,8 @@ AbstractWindow { : DefaultStyle.grey_0 : DefaultStyle.grey_0 font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(400 * DefaultStyle.dp) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(400) } MouseArea { anchors.fill: parent @@ -538,11 +538,11 @@ AbstractWindow { Button{ id: openStatisticPanelButton property int quality: mainWindow.call ? mainWindow.call.core.quality : 0 - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(40 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(40 * DefaultStyle.dp) - Layout.rightMargin: Math.round(30 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(40) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(40) + Layout.rightMargin: Utils.getSizeWithScreenRatio(30) icon.source: quality >= 4 ? AppIcons.cellSignalFull : quality >= 3 ? AppIcons.cellSignalMedium : quality >= 2 ? AppIcons.cellSignalLow : AppIcons.cellSignalNone colorizationColor: DefaultStyle.grey_0 style: ButtonStyle.noBackgroundLightBorder @@ -572,19 +572,19 @@ AbstractWindow { : (mainWindow.call.core.recording || mainWindow.call.core.remoteRecording) : false anchors.centerIn: parent - leftPadding: Math.round(14 * DefaultStyle.dp) - rightPadding: Math.round(14 * DefaultStyle.dp) - topPadding: Math.round(6 * DefaultStyle.dp) - bottomPadding: Math.round(6 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(14) + rightPadding: Utils.getSizeWithScreenRatio(14) + topPadding: Utils.getSizeWithScreenRatio(6) + bottomPadding: Utils.getSizeWithScreenRatio(6) background: Rectangle { anchors.fill: parent color: DefaultStyle.grey_500 - radius: Math.round(10 * DefaultStyle.dp) + radius: Utils.getSizeWithScreenRatio(10) } contentItem: RowLayout { - spacing: Math.round(85 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(85) RowLayout { - spacing: Math.round(15 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(15) EffectImage { imageSource: screenSharingOrRecordBanner.isScreenSharing ? AppIcons.screencast @@ -592,8 +592,8 @@ AbstractWindow { colorizationColor: screenSharingOrRecordBanner.isScreenSharing ? DefaultStyle.grey_0 : DefaultStyle.danger_500_main - Layout.preferredWidth: Math.round(24 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(24 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } Text { color: screenSharingOrRecordBanner.isScreenSharing @@ -645,7 +645,7 @@ AbstractWindow { RowLayout { Layout.fillWidth: true Layout.fillHeight: true - spacing: Math.round(23 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(23) Control.StackView { id: middleItemStackView initialItem: inCallItem @@ -655,9 +655,9 @@ AbstractWindow { CallSettingsPanel { id: rightPanel Layout.fillHeight: true - Layout.rightMargin: Math.round(20 * DefaultStyle.dp) - Layout.preferredWidth: Math.round(393 * DefaultStyle.dp) - Layout.topMargin: Math.round(10 * DefaultStyle.dp) + Layout.rightMargin: Utils.getSizeWithScreenRatio(20) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(393) + Layout.topMargin: Utils.getSizeWithScreenRatio(10) property int currentIndex: 0 visible: false onVisibleChanged: if(!visible) contentLoader.sourceComponent = null @@ -749,7 +749,7 @@ AbstractWindow { // Binding on rightPadding { // when: rightPanel.contentLoader.item && rightPanel.contentLoader.item.objectName == "participantListView" - // value: Math.round(10 * DefaultStyle.dp) + // value: Utils.getSizeWithScreenRatio(10) // restoreMode: Binding.RestoreBindingOrValue // } @@ -814,10 +814,10 @@ AbstractWindow { roundedBottom: true lastRowVisible: false visible: false - leftPadding: Math.round(40 * DefaultStyle.dp) - rightPadding: Math.round(40 * DefaultStyle.dp) - topPadding: Math.round(41 * DefaultStyle.dp) - bottomPadding: Math.round(18 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(40) + rightPadding: Utils.getSizeWithScreenRatio(40) + topPadding: Utils.getSizeWithScreenRatio(41) + bottomPadding: Utils.getSizeWithScreenRatio(18) Component.onCompleted: parent.height = height } } @@ -854,10 +854,10 @@ AbstractWindow { parent: numericPadContainer roundedBottom: true visible: newCallForm.searchBar.numericPadButton.checked - leftPadding: Math.round(40 * DefaultStyle.dp) - rightPadding: Math.round(40 * DefaultStyle.dp) - topPadding: Math.round(41 * DefaultStyle.dp) - bottomPadding: Math.round(18 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(40) + rightPadding: Utils.getSizeWithScreenRatio(40) + topPadding: Utils.getSizeWithScreenRatio(41) + bottomPadding: Utils.getSizeWithScreenRatio(18) onLaunchCall: { rightPanel.visible = false UtilsCpp.createCall(newCallForm.searchBar.text) @@ -882,11 +882,11 @@ AbstractWindow { height: rightPanel.contentItemHeight ColumnLayout { anchors.fill: parent - spacing: Math.round(41 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(41) Item{Layout.fillHeight: true} SearchBar { id: searchBar - height: Math.round(45 * DefaultStyle.dp) + height: Utils.getSizeWithScreenRatio(45) magnifierVisible: false color: DefaultStyle.grey_0 borderColor: DefaultStyle.grey_200 @@ -898,7 +898,7 @@ AbstractWindow { NumericPad { id: numPad Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - Layout.bottomMargin: Math.round(18 * DefaultStyle.dp) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(18) currentCall: callsModel.currentCall lastRowVisible: false onLaunchCall: { @@ -941,11 +941,11 @@ AbstractWindow { id: popupbutton popup.contentItem: IconLabelButton { icon.source: AppIcons.arrowsMerge - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) //: call_action_merge_calls text: qsTr("Merger tous les appels") - textSize: Math.round(14 * DefaultStyle.dp) + textSize: Utils.getSizeWithScreenRatio(14) onClicked: { callsModel.lMergeAll() popupbutton.close() @@ -957,15 +957,15 @@ AbstractWindow { Layout.fillWidth: true Layout.maximumHeight: rightPanel.height visible: callList.contentHeight > 0 - leftPadding: Math.round(16 * DefaultStyle.dp) - rightPadding: Math.round(6 * DefaultStyle.dp) - topPadding: Math.round(15 * DefaultStyle.dp) - bottomPadding: Math.round(16 * DefaultStyle.dp) + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(6) + topPadding: Utils.getSizeWithScreenRatio(15) + bottomPadding: Utils.getSizeWithScreenRatio(16) - Layout.topMargin: Math.round(15 * DefaultStyle.dp) - Layout.bottomMargin: Math.round(16 * DefaultStyle.dp) - Layout.leftMargin: Math.round(16 * DefaultStyle.dp) - Layout.rightMargin: Math.round(16 * DefaultStyle.dp) + Layout.topMargin: Utils.getSizeWithScreenRatio(15) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(16) + Layout.leftMargin: Utils.getSizeWithScreenRatio(16) + Layout.rightMargin: Utils.getSizeWithScreenRatio(16) contentItem: CallListView { id: callList @@ -1036,7 +1036,7 @@ AbstractWindow { } contentItem: ScreencastSettings { id: screencastsettings - anchors.topMargin: Math.round(16 * DefaultStyle.dp) + anchors.topMargin: Utils.getSizeWithScreenRatio(16) width: parent.width call: mainWindow.call onIsLocalScreenSharingChanged: if (isLocalScreenSharing) rightPanel.visible = false @@ -1057,9 +1057,9 @@ AbstractWindow { width: parent.width height: rightPanel.contentItemHeight // anchors.fill: parent - // anchors.bottomMargin: Math.round(16 * DefaultStyle.dp) - // anchors.leftMargin: Math.round(17 * DefaultStyle.dp) - // anchors.rightMargin: Math.round(17 * DefaultStyle.dp) + // anchors.bottomMargin: Utils.getSizeWithScreenRatio(16) + // anchors.leftMargin: Utils.getSizeWithScreenRatio(17) + // anchors.rightMargin: Utils.getSizeWithScreenRatio(17) initialItem: participantListComp onCurrentItemChanged: rightPanel.headerStack.currentIndex = currentItem.Control.StackView.index property list selectedParticipants @@ -1232,9 +1232,9 @@ AbstractWindow { sourceComponent: Item { CallLayout { anchors.fill: parent - anchors.leftMargin: Math.round(20 * DefaultStyle.dp) - anchors.rightMargin: rightPanel.visible ? 0 : Math.round(10 * DefaultStyle.dp) // Grid and AS have 10 in right margin (so apply -10 here) - anchors.topMargin: Math.round(10 * DefaultStyle.dp) + anchors.leftMargin: Utils.getSizeWithScreenRatio(20) + anchors.rightMargin: rightPanel.visible ? 0 : Utils.getSizeWithScreenRatio(10) // Grid and AS have 10 in right margin (so apply -10 here) + anchors.topMargin: Utils.getSizeWithScreenRatio(10) call: mainWindow.call callTerminatedByUser: mainWindow.callTerminatedByUser } @@ -1249,7 +1249,7 @@ AbstractWindow { RowLayout { id: bottomButtonsLayout Layout.alignment: Qt.AlignHCenter - spacing: Math.round(58 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(58) visible: middleItemStackView.currentItem.objectName == "inCallItem" property bool moreOptionsButtonVisibility: true @@ -1287,14 +1287,14 @@ AbstractWindow { BigButton { id: endCallButton Layout.row: 0 - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) //: "Terminer l'appel" ToolTip.text: qsTr("call_action_end_call") Accessible.name: qsTr("call_action_end_call") - Layout.preferredWidth: Math.round(75 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - radius: Math.round(71 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(75) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + radius: Utils.getSizeWithScreenRatio(71) style: ButtonStyle.phoneRedLightBorder Layout.column: mainWindow.startingCall ? 0 : bottomButtonsLayout.columns - 1 KeyNavigation.tab: mainWindow.startingCall ? (videoCameraButton.visible && videoCameraButton.enabled ? videoCameraButton : audioMicrophoneButton) : openStatisticPanelButton @@ -1313,15 +1313,15 @@ AbstractWindow { visible: false Layout.row: 0 Layout.column: 1 - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) // Pause call button CheckableButton { id: pauseButton - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) //: "Reprendre l'appel" ToolTip.text: checked ? qsTr("call_action_resume_call") //: "Mettre l'appel en pause" @@ -1352,10 +1352,10 @@ AbstractWindow { id: transferCallButton visible: !mainWindow.conference icon.source: AppIcons.transferCall - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) contentImageColor: DefaultStyle.grey_0 //: "Transférer l'appel" ToolTip.text: qsTr("call_action_transfer_call") @@ -1376,10 +1376,10 @@ AbstractWindow { id: newCallButton checkable: true icon.source: AppIcons.newCall - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) //: "Initier un nouvel appel" ToolTip.text: qsTr("call_action_start_new_call_hint") Accessible.name: qsTr("call_action_start_new_call_hint") @@ -1397,12 +1397,12 @@ AbstractWindow { // Call list button CheckableButton { id: callListButton - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) checkable: true icon.source: AppIcons.callList - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) //: "Afficher la liste d'appels" ToolTip.text: qsTr("call_display_call_list_hint") Accessible.name: qsTr("call_display_call_list_hint") @@ -1425,7 +1425,7 @@ AbstractWindow { id: controlCallButtons Layout.row: 0 Layout.column: mainWindow.startingCall ? bottomButtonsLayout.columns - 1 : 0 - spacing: Math.round(10 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(10) // Video camera button CheckableButton { @@ -1442,10 +1442,10 @@ AbstractWindow { ToolTip.text: mainWindow.localVideoEnabled ? qsTr("call_deactivate_video_hint") : qsTr("call_activate_video_hint") Accessible.name: mainWindow.localVideoEnabled ? qsTr("call_deactivate_video_hint") : qsTr("call_activate_video_hint") checked: !mainWindow.localVideoEnabled - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) onClicked: mainWindow.call.core.lSetLocalVideoEnabled( !mainWindow.call.core.localVideoEnabled) } @@ -1462,10 +1462,10 @@ AbstractWindow { : qsTr("call_deactivate_microphone") Accessible.name: mainWindow.call && mainWindow.call.core.microphoneMuted ? qsTr("call_activate_microphone") : qsTr("call_deactivate_microphone") checked: mainWindow.call && mainWindow.call.core.microphoneMuted - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) onClicked: mainWindow.call.core.lSetMicrophoneMuted( !mainWindow.call.core.microphoneMuted) KeyNavigation.backtab: videoCameraButton.visible && videoCameraButton.enabled ? videoCameraButton : nextItemInFocusChain(false) @@ -1479,10 +1479,10 @@ AbstractWindow { //: Partager l'écran… ToolTip.text: qsTr("call_share_screen_hint") Accessible.name: qsTr("call_share_screen_hint") - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) onToggled: { if (checked) { rightPanel.visible = true @@ -1500,10 +1500,10 @@ AbstractWindow { //: Open chat… ToolTip.text: qsTr("call_open_chat_hint") Accessible.name: qsTr("call_open_chat_hint") - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) onToggled: { if (checked) { rightPanel.visible = true @@ -1523,10 +1523,10 @@ AbstractWindow { //: "Lever la main" ToolTip.text: qsTr("call_rise_hand_hint") Accessible.name: qsTr("call_rise_hand_hint") - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) } // Reaction button @@ -1537,10 +1537,10 @@ AbstractWindow { //: "Envoyer une réaction" ToolTip.text: qsTr("call_send_reaction_hint") Accessible.name: qsTr("call_send_reaction_hint") - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) } // Participant list button @@ -1551,10 +1551,10 @@ AbstractWindow { Accessible.name: qsTr("call_manage_participants_hint") visible: mainWindow.conference iconUrl: AppIcons.usersTwo - Layout.preferredWidth: Math.round(55 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(55 * DefaultStyle.dp) - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) onToggled: { if (checked) { rightPanel.visible = true @@ -1571,15 +1571,15 @@ AbstractWindow { //: "Plus d'options…" ToolTip.text: qsTr("call_more_options_hint") popUpTitle: qsTr("call_more_options_hint") - implicitWidth: Math.round(55 * DefaultStyle.dp) - implicitHeight: Math.round(55 * DefaultStyle.dp) - popup.topPadding: Math.round(20 * DefaultStyle.dp) - popup.bottomPadding: Math.round(20 * DefaultStyle.dp) - popup.leftPadding: Math.round(10 * DefaultStyle.dp) - popup.rightPadding: Math.round(10 * DefaultStyle.dp) + implicitWidth: Utils.getSizeWithScreenRatio(55) + implicitHeight: Utils.getSizeWithScreenRatio(55) + popup.topPadding: Utils.getSizeWithScreenRatio(20) + popup.bottomPadding: Utils.getSizeWithScreenRatio(20) + popup.leftPadding: Utils.getSizeWithScreenRatio(10) + popup.rightPadding: Utils.getSizeWithScreenRatio(10) style: ButtonStyle.checkable - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) KeyNavigation.tab: connectedCallButtons.visible ? pauseButton : nextItemInFocusChain() visible: bottomButtonsLayout.moreOptionsButtonVisibility @@ -1592,14 +1592,14 @@ AbstractWindow { } popup.contentItem: ColumnLayout { id: optionsList - spacing: Math.round(5 * DefaultStyle.dp) + spacing: Utils.getSizeWithScreenRatio(5) IconLabelButton { Layout.fillWidth: true visible: mainWindow.conference icon.source: AppIcons.layout - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) //: "Modifier la disposition" text: qsTr("call_action_change_conference_layout") style: ButtonStyle.noBackground @@ -1616,8 +1616,8 @@ AbstractWindow { icon.source: AppIcons.fullscreen //: "Mode Plein écran" text: qsTr("call_action_full_screen") - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) checkable: true style: ButtonStyle.noBackground Binding on checked { @@ -1638,8 +1638,8 @@ AbstractWindow { Layout.fillWidth: true icon.source: AppIcons.dialer text: qsTr("call_action_show_dialer") - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) style: ButtonStyle.noBackground onClicked: { rightPanel.visible = true @@ -1653,8 +1653,8 @@ AbstractWindow { Layout.fillWidth: true checkable: true style: ButtonStyle.noBackground - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) visible: mainWindow.call && !mainWindow.conference && !SettingsCpp.disableCallRecordings @@ -1689,8 +1689,8 @@ AbstractWindow { Layout.fillWidth: true checkable: true style: ButtonStyle.noBackground - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) icon.source: !mainWindow.call || mainWindow.call.core.speakerMuted ? AppIcons.speakerSlash : AppIcons.speaker contentImageColor: mainWindow.call @@ -1715,8 +1715,8 @@ AbstractWindow { IconLabelButton { Layout.fillWidth: true icon.source: AppIcons.settings - icon.width: Math.round(32 * DefaultStyle.dp) - icon.height: Math.round(32 * DefaultStyle.dp) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) //: "Paramètres" text: qsTr("call_action_go_to_settings") style: ButtonStyle.noBackground diff --git a/Linphone/view/Page/Window/Main/MainWindow.qml b/Linphone/view/Page/Window/Main/MainWindow.qml index e0e592687..ebaf215ff 100644 --- a/Linphone/view/Page/Window/Main/MainWindow.qml +++ b/Linphone/view/Page/Window/Main/MainWindow.qml @@ -9,7 +9,7 @@ import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils AbstractWindow { id: mainWindow - // height: Math.round(982 * DefaultStyle.dp) + // height: Utils.getSizeWithScreenRatio(982) title: applicationName // TODO : handle this bool when security mode is implemented property bool firstConnection: true @@ -21,8 +21,8 @@ AbstractWindow { } color: DefaultStyle.grey_0 - minimumWidth: Math.round(1020 * DefaultStyle.dp) - minimumHeight: Math.round(700 * DefaultStyle.dp) + minimumWidth: Utils.getSizeWithScreenRatio(1020) + minimumHeight: Utils.getSizeWithScreenRatio(700) signal callCreated() property var accountProxy @@ -31,7 +31,7 @@ AbstractWindow { flags: Qt.Window // menuBar: Rectangle { // width: parent.width - // height: Math.round(40 * DefaultStyle.dp) + // height: Utils.getSizeWithScreenRatio(40) // color: DefaultStyle.grey_100 // } @@ -165,10 +165,10 @@ AbstractWindow { Image { anchors.centerIn: parent source: AppIcons.splashscreenLogo - sourceSize.width: Math.round(395 * DefaultStyle.dp) - sourceSize.height: Math.round(395 * DefaultStyle.dp) - width: Math.round(395 * DefaultStyle.dp) - height: Math.round(395 * DefaultStyle.dp) + sourceSize.width: Utils.getSizeWithScreenRatio(395) + sourceSize.height: Utils.getSizeWithScreenRatio(395) + width: Utils.getSizeWithScreenRatio(395) + height: Utils.getSizeWithScreenRatio(395) } } } diff --git a/Linphone/view/Style/FileViewStyle.qml b/Linphone/view/Style/FileViewStyle.qml index 699b3bf5c..f8d604fe5 100644 --- a/Linphone/view/Style/FileViewStyle.qml +++ b/Linphone/view/Style/FileViewStyle.qml @@ -2,6 +2,7 @@ pragma Singleton import QtQml import Linphone +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= @@ -16,13 +17,13 @@ QtObject { property int width: 100 property QtObject name: QtObject{ - property int pointSize: Math.round(DefaultStyle.dp * 7) + property int pointSize: Utils.getSizeWithScreenRatio(7) } property QtObject download: QtObject{ property string icon: AppIcons.download property int height: 20 - property int pointSize: Math.round(DefaultStyle.dp * 8) + property int pointSize: Utils.getSizeWithScreenRatio(8) property int iconSize: 30 } property QtObject thumbnailVideoIcon: QtObject { @@ -41,7 +42,7 @@ QtObject { property string imageIcon: AppIcons.fileImage property int iconSize: 60 property int internalSize: 37 - property int radius: Math.round(5 * DefaultStyle.dp) + property int radius: Utils.getSizeWithScreenRatio(5) property QtObject background: QtObject { property var color: DefaultStyle.grey_0 @@ -50,7 +51,7 @@ QtObject { property QtObject text: QtObject { property var color: DefaultStyle.grey_0 - property int pointSize: Math.round(DefaultStyle.dp * 9) + property int pointSize: Utils.getSizeWithScreenRatio(9) } } diff --git a/Linphone/view/Style/Typography.qml b/Linphone/view/Style/Typography.qml index f46efe65b..c132cba6d 100644 --- a/Linphone/view/Style/Typography.qml +++ b/Linphone/view/Style/Typography.qml @@ -1,138 +1,139 @@ pragma Singleton import QtQuick +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils QtObject { // Title/H4 - Bloc title property font h4: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(16 * DefaultStyle.dp), - weight: Math.min(Math.round(800 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(16), + weight: Math.min(Utils.getSizeWithScreenRatio(800), 1000) }) // Title/H3M - Bloc title property font h3m: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(16 * DefaultStyle.dp), - weight: Math.min(Math.round(700 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(16), + weight: Math.min(Utils.getSizeWithScreenRatio(700), 1000) }) // Title/H3 - Bloc title property font h3: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(22 * DefaultStyle.dp), - weight: Math.min(Math.round(800 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(22), + weight: Math.min(Utils.getSizeWithScreenRatio(800), 1000) }) // Title/H2M - Large bloc title property font h2m: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(20 * DefaultStyle.dp), - weight: Math.min(Math.round(800 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(20), + weight: Math.min(Utils.getSizeWithScreenRatio(800), 1000) }) // Title/H2 - Large bloc title property font h2: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(29 * DefaultStyle.dp), - weight: Math.min(Math.round(800 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(29), + weight: Math.min(Utils.getSizeWithScreenRatio(800), 1000) }) // Title/H1 - Large bloc title property font h1: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(36 * DefaultStyle.dp), - weight: Math.min(Math.round(800 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(36), + weight: Math.min(Utils.getSizeWithScreenRatio(800), 1000) }) // Text/P4 - Xsmall paragraph text property font p4: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(10 * DefaultStyle.dp), - weight: Math.min(Math.round(300 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(10), + weight: Math.min(Utils.getSizeWithScreenRatio(300), 1000) }) // Text/P3 - Reduced paragraph text property font p3: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(12 * DefaultStyle.dp), - weight: Math.min(Math.round(300 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(12), + weight: Math.min(Utils.getSizeWithScreenRatio(300), 1000) }) // Text/P2 - Bold, reduced paragraph text property font p2: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(13 * DefaultStyle.dp), - weight: Math.min(Math.round(700 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(13), + weight: Math.min(Utils.getSizeWithScreenRatio(700), 1000) }) // Text/P2l - Large Bold, reduced paragraph text property font p2l: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(14 * DefaultStyle.dp), - weight: Math.min(Math.round(700 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(14), + weight: Math.min(Utils.getSizeWithScreenRatio(700), 1000) }) // Text/P1 - Paragraph text property font p1: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(14 * DefaultStyle.dp), - weight: Math.min(Math.round(400 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(14), + weight: Math.min(Utils.getSizeWithScreenRatio(400), 1000) }) // Text/P1s - Paragraph text property font p1s: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(13 * DefaultStyle.dp), - weight: Math.min(Math.round(400 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(13), + weight: Math.min(Utils.getSizeWithScreenRatio(400), 1000) }) // Text/P1 - Paragraph text property font p1b: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(15 * DefaultStyle.dp), - weight: Math.min(Math.round(400 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(15), + weight: Math.min(Utils.getSizeWithScreenRatio(400), 1000) }) // Button/B1 - Big Button property font b1: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(18 * DefaultStyle.dp), - weight: Math.min(Math.round(600 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(18), + weight: Math.min(Utils.getSizeWithScreenRatio(600), 1000) }) // Button/B2 - Medium Button property font b2: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(15 * DefaultStyle.dp), - weight: Math.min(Math.round(600 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(15), + weight: Math.min(Utils.getSizeWithScreenRatio(600), 1000) }) // Button/B3 - Small Button property font b3: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(13 * DefaultStyle.dp), - weight: Math.min(Math.round(600 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(13), + weight: Math.min(Utils.getSizeWithScreenRatio(600), 1000) }) // FileView/F1 - File View name text property font f1: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(11 * DefaultStyle.dp), - weight: Math.min(Math.round(700 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(11), + weight: Math.min(Utils.getSizeWithScreenRatio(700), 1000) }) // FileView/F1light - File View size text property font f1l: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(10 * DefaultStyle.dp), - weight: Math.min(Math.round(500 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(10), + weight: Math.min(Utils.getSizeWithScreenRatio(500), 1000) }) // FileView/F1light - Duration text property font d1: Qt.font( { family: DefaultStyle.defaultFont, - pixelSize: Math.round(8 * DefaultStyle.dp), - weight: Math.min(Math.round(600 * DefaultStyle.dp), 1000) + pixelSize: Utils.getSizeWithScreenRatio(8), + weight: Math.min(Utils.getSizeWithScreenRatio(600), 1000) }) }