diff --git a/Linphone/view/Control/Button/BigButton.qml b/Linphone/view/Control/Button/BigButton.qml index d20a90a18..603ceccbc 100644 --- a/Linphone/view/Control/Button/BigButton.qml +++ b/Linphone/view/Control/Button/BigButton.qml @@ -9,10 +9,10 @@ Button { id: mainItem textSize: Typography.b1.pixelSize textWeight: Typography.b1.weight - 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) + 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/Button.qml b/Linphone/view/Control/Button/Button.qml index e6007dff9..50bd8a75a 100644 --- a/Linphone/view/Control/Button/Button.qml +++ b/Linphone/view/Control/Button/Button.qml @@ -5,39 +5,33 @@ import QtQuick.Layouts import QtQml import Linphone import CustomControls 1.0 -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle Control.Button { id: mainItem property var style - property bool asynchronous: false + property bool asynchronous: false hoverEnabled: enabled activeFocusOnTab: true - property color disabledFilterColor: color.hslLightness > 0.5 - ? DefaultStyle.grey_0 - : DefaultStyle.grey_400 + property color disabledFilterColor: color.hslLightness > 0.5 ? DefaultStyle.grey_0 : DefaultStyle.grey_400 property bool hasNavigationFocus: enabled && (activeFocus || hovered) property bool keyboardFocus: FocusHelper.keyboardFocus // Background properties property color color: style?.color?.normal || DefaultStyle.main1_500_main property color hoveredColor: style?.color?.hovered || Qt.darker(color, 1.05) - property color pressedColor: style?.color?.pressed || Qt.darker(color, 1.1) - property color checkedColor: style?.color?.checked || style?.color?.pressed || Qt.darker(color, 1.1) + property color pressedColor: style?.color?.pressed || Qt.darker(color, 1.1) + property color checkedColor: style?.color?.checked || style?.color?.pressed || Qt.darker(color, 1.1) property bool shadowEnabled: false property int capitalization - property color backgroundColor: mainItem.checkable && mainItem.checked - ? mainItem.checkedColor || mainItem.pressedColor - : mainItem.pressed - ? mainItem.pressedColor - : mainItem.hovered - ? mainItem.hoveredColor - : mainItem.color + property color backgroundColor: mainItem.checkable && mainItem.checked ? mainItem.checkedColor + || mainItem.pressedColor : mainItem.pressed ? mainItem.pressedColor : mainItem.hovered + ? mainItem.hoveredColor : mainItem.color // Text properties property bool underline: false - property real textSize: Utils.getSizeWithScreenRatio(18) - property real textWeight: Typography.b1.weight - property color textColor: style?.text?.normal || DefaultStyle.grey_0 + property real textSize: Utils.getSizeWithScreenRatio(18) + property real textWeight: Typography.b1.weight + property color textColor: style?.text?.normal || DefaultStyle.grey_0 property color hoveredTextColor: style?.text?.hovered || Qt.darker(textColor, 1.05) property color pressedTextColor: style?.text?.pressed || Qt.darker(textColor, 1.1) property var textFormat: Text.AutoText @@ -51,21 +45,19 @@ Control.Button { property real borderWidth: Utils.getSizeWithScreenRatio(1) property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3) // Image properties - property var contentImageColor: style?.image? style.image.normal : DefaultStyle.main2_600 - property var hoveredImageColor: style && style.image && style.image.hovered ? style.image.hovered : Qt.darker(contentImageColor, 1.05) - property var checkedImageColor: style && style.image && style.image.checked ? style.image.checked : Qt.darker(contentImageColor, 1.1) - property var pressedImageColor: style && style.image && style.image.pressed ? style.image.pressed : Qt.darker(contentImageColor, 1.1) + property var contentImageColor: style?.image ? style.image.normal : DefaultStyle.main2_600 + property var hoveredImageColor: style && style.image && style.image.hovered ? style.image.hovered : Qt.darker( + contentImageColor, 1.05) + property var checkedImageColor: style && style.image && style.image.checked ? style.image.checked : Qt.darker( + contentImageColor, 1.1) + property var pressedImageColor: style && style.image && style.image.pressed ? style.image.pressed : Qt.darker( + contentImageColor, 1.1) icon.source: style?.iconSource || "" - property color colorizationColor: checkable && checked - ? checkedImageColor - : pressed - ? pressedImageColor - : hovered - ? hoveredImageColor - : contentImageColor + property color colorizationColor: checkable && checked ? checkedImageColor : pressed ? pressedImageColor : hovered + ? hoveredImageColor : contentImageColor // Size properties spacing: Utils.getSizeWithScreenRatio(5) - property real radius: Math.ceil(height / 2) + property real radius: Math.ceil(height / 2) MouseArea { id: mouseArea @@ -75,27 +67,27 @@ Control.Button { cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor acceptedButtons: Qt.NoButton } - - background: Loader{ + + background: Loader { asynchronous: mainItem.asynchronous anchors.fill: parent - + sourceComponent: Item { width: mainItem.width height: mainItem.height Rectangle { id: buttonBackground anchors.fill: parent - color: mainItem.backgroundColor + color: mainItem.backgroundColor radius: mainItem.radius border.color: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.borderColor - border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth + border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth } MultiEffect { enabled: mainItem.shadowEnabled anchors.fill: buttonBackground source: buttonBackground - visible: mainItem.shadowEnabled + visible: mainItem.shadowEnabled // Crash : https://bugreports.qt.io/browse/QTBUG-124730 shadowEnabled: true shadowColor: DefaultStyle.grey_1000 @@ -116,7 +108,7 @@ Control.Button { width: mainItem.width height: mainItem.height } - + component ButtonText: Text { id: buttonText horizontalAlignment: mainItem.textHAlignment @@ -126,18 +118,16 @@ Control.Button { text: mainItem.text textFormat: mainItem.textFormat maximumLineCount: 1 - color: mainItem.checkable && mainItem.checked || mainItem.pressed - ? mainItem.pressedTextColor - : mainItem.hovered - ? mainItem.hoveredTextColor - : mainItem.textColor + color: mainItem.checkable && mainItem.checked || mainItem.pressed ? mainItem.pressedTextColor : mainItem.hovered + ? mainItem.hoveredTextColor : mainItem.textColor font { pixelSize: mainItem.textSize weight: mainItem.textWeight family: DefaultStyle.defaultFont capitalization: mainItem.capitalization underline: mainItem.underline - bold: (mainItem.style === ButtonStyle.noBackground || mainItem.style === ButtonStyle.noBackgroundRed) && (mainItem.hovered || mainItem.pressed) + bold: (mainItem.style === ButtonStyle.noBackground || mainItem.style === ButtonStyle.noBackgroundRed) && ( + mainItem.hovered || mainItem.pressed) } ToolTip { parent: mainItem @@ -151,46 +141,51 @@ Control.Button { font.bold: true } } - + component ButtonImage: EffectImage { imageSource: mainItem.icon.source imageWidth: mainItem.icon.width imageHeight: mainItem.icon.height - colorizationColor: mainItem.colorizationColor + colorizationColor: mainItem.colorizationColor } - - contentItem: Control.StackView{ + + contentItem: Control.StackView { id: stacklayout - function updateComponent(){ - var item - var component = mainItem.text.length != 0 && mainItem.icon.source.toString().length != 0 - ? imageTextComponent - : mainItem.text.length != 0 - ? textComponent - : mainItem.icon.source.toString().length != 0 - ? imageComponent - : emptyComponent - if( stacklayout.depth == 0) - item = stacklayout.push(component, Control.StackView.Immediate) - else if( component != stacklayout.get(0)) - item = stacklayout.replace(component, Control.StackView.Immediate) - if(item){// Workaround for Qt bug : set from the item and not from the contentItem which seems to be lost - implicitHeight = Qt.binding(function() { return item.implicitHeight}) - implicitWidth = Qt.binding(function() { return item.implicitWidth}) + function updateComponent() { + var item; + var component = mainItem.text.length != 0 && mainItem.icon.source.toString().length != 0 ? imageTextComponent : + mainItem.text.length != 0 ? textComponent : mainItem.icon.source.toString().length != 0 + ? imageComponent : emptyComponent; + if (stacklayout.depth == 0) + item = stacklayout.push(component, Control.StackView.Immediate); + else if (component != stacklayout.get(0)) + item = stacklayout.replace(component, Control.StackView.Immediate); + if (item) { + // Workaround for Qt bug : set from the item and not from the contentItem which seems to be lost + implicitHeight = Qt.binding(function () { + return item.implicitHeight; + }); + implicitWidth = Qt.binding(function () { + return item.implicitWidth; + }); } } - + Component.onCompleted: { - updateComponent() + updateComponent(); } - - Connections{ + + Connections { target: mainItem - function onTextChanged(){stacklayout.updateComponent()} - function onIconChanged(){stacklayout.updateComponent()} + function onTextChanged() { + stacklayout.updateComponent(); + } + function onIconChanged() { + stacklayout.updateComponent(); + } } - - Component{ + + Component { id: imageTextComponent // Workaround for centering the content when its // width is smaller than the button width @@ -201,25 +196,26 @@ Control.Button { id: content spacing: mainItem.spacing anchors.centerIn: parent - ButtonImage{ + ButtonImage { Layout.preferredWidth: mainItem.icon.width Layout.preferredHeight: mainItem.icon.height } - ButtonText { - } + ButtonText {} } } } - Component{ + Component { id: textComponent ButtonText { width: stacklayout.width height: stacklayout.height // Hack for StackView binding loop - onImplicitHeightChanged: {implicitHeight} + onImplicitHeightChanged: { + implicitHeight; + } } } - Component{ + Component { id: imageComponent Item { width: stacklayout.width @@ -237,7 +233,7 @@ Control.Button { } } } - Component{ + Component { id: emptyComponent Item { width: stacklayout.width @@ -247,29 +243,29 @@ Control.Button { } /* contentItem: StackLayout { - id: stacklayout - currentIndex: mainItem.text.length != 0 && mainItem.icon.source.toString().length != 0 - ? 0 - : mainItem.text.length != 0 - ? 1 - : mainItem.icon.source.toString().length != 0 - ? 2 - : 3 - - width: mainItem.width - RowLayout { - spacing: mainItem.spacing - ButtonImage{ - Layout.preferredWidth: mainItem.icon.width - Layout.preferredHeight: mainItem.icon.height - } - ButtonText{} - } - ButtonText {} - ButtonImage{} - Item { - Layout.fillWidth: true - Layout.fillHeight: true - } + id: stacklayout + currentIndex: mainItem.text.length != 0 && mainItem.icon.source.toString().length != 0 + ? 0 + : mainItem.text.length != 0 + ? 1 + : mainItem.icon.source.toString().length != 0 + ? 2 + : 3 + + width: mainItem.width + RowLayout { + spacing: mainItem.spacing + ButtonImage{ + Layout.preferredWidth: mainItem.icon.width + Layout.preferredHeight: mainItem.icon.height + } + ButtonText{} + } + ButtonText {} + ButtonImage{} + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } }*/ } diff --git a/Linphone/view/Control/Button/CalendarComboBox.qml b/Linphone/view/Control/Button/CalendarComboBox.qml index f2d3a7d46..b449f9a5e 100644 --- a/Linphone/view/Control/Button/CalendarComboBox.qml +++ b/Linphone/view/Control/Button/CalendarComboBox.qml @@ -16,24 +16,24 @@ ComboBox { id: contentText text: calendar.selectedDate ? UtilsCpp.formatDate(calendar.selectedDate, false, true, "ddd d, MMMM") : "" anchors.fill: parent - anchors.leftMargin: Utils.getSizeWithScreenRatio(15) + anchors.leftMargin: Utils.getSizeWithScreenRatio(15) anchors.verticalCenter: parent.verticalCenter verticalAlignment: Text.AlignVCenter font { - pixelSize: Utils.getSizeWithScreenRatio(14) - weight: Font.Bold + pixelSize: Utils.getSizeWithScreenRatio(14) + weight: Font.Bold } } popup: Control.Popup { id: popupItem y: mainItem.height - width: Utils.getSizeWithScreenRatio(321) - height: Utils.getSizeWithScreenRatio(270) + width: Utils.getSizeWithScreenRatio(321) + height: Utils.getSizeWithScreenRatio(270) closePolicy: Popup.NoAutoClose - topPadding: Utils.getSizeWithScreenRatio(25) - bottomPadding: Utils.getSizeWithScreenRatio(24) - leftPadding: Utils.getSizeWithScreenRatio(21) - rightPadding: Utils.getSizeWithScreenRatio(19) + topPadding: Utils.getSizeWithScreenRatio(25) + bottomPadding: Utils.getSizeWithScreenRatio(24) + leftPadding: Utils.getSizeWithScreenRatio(21) + rightPadding: Utils.getSizeWithScreenRatio(19) onOpened: calendar.forceActiveFocus() background: Item { anchors.fill: parent @@ -41,9 +41,9 @@ ComboBox { id: calendarBg anchors.fill: parent color: DefaultStyle.grey_0 - radius: Utils.getSizeWithScreenRatio(16) + radius: Utils.getSizeWithScreenRatio(16) border.color: DefaultStyle.main1_500_main - border.width: calendar.activeFocus? 1 : 0 + border.width: calendar.activeFocus ? 1 : 0 } MultiEffect { anchors.fill: calendarBg diff --git a/Linphone/view/Control/Button/CheckBox.qml b/Linphone/view/Control/Button/CheckBox.qml index 33f7db758..aa5b10b2b 100644 --- a/Linphone/view/Control/Button/CheckBox.qml +++ b/Linphone/view/Control/Button/CheckBox.qml @@ -7,17 +7,17 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.CheckBox { id: mainItem hoverEnabled: enabled - indicator: Item{ - implicitWidth: Utils.getSizeWithScreenRatio(20) - implicitHeight: Utils.getSizeWithScreenRatio(20) + indicator: Item { + 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: Utils.getSizeWithScreenRatio(3) + anchors.fill: parent + radius: Utils.getSizeWithScreenRatio(3) border.color: mainItem.hovered || mainItem.activeFocus ? DefaultStyle.main1_600 : DefaultStyle.main1_500_main - border.width: Utils.getSizeWithScreenRatio(2) + border.width: Utils.getSizeWithScreenRatio(2) color: mainItem.checked ? DefaultStyle.main1_500_main : "transparent" EffectImage { visible: mainItem.checked diff --git a/Linphone/view/Control/Button/CheckableButton.qml b/Linphone/view/Control/Button/CheckableButton.qml index 5f14658ee..87f85375e 100644 --- a/Linphone/view/Control/Button/CheckableButton.qml +++ b/Linphone/view/Control/Button/CheckableButton.qml @@ -4,7 +4,7 @@ import QtQuick.Layouts import QtQuick.Effects 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/Style/buttonStyle.js" as ButtonStyle Button { id: mainItem @@ -14,11 +14,7 @@ Button { color: style?.color?.normal || DefaultStyle.grey_500 pressedColor: checkedIconUrl ? color : style?.color?.pressed || DefaultStyle.grey_500 hoveredColor: checked ? Qt.darker(pressedColor, 1.05) : style?.color?.hovered || DefaultStyle.grey_500 - property color backgroundColor: hovered - ? hoveredColor - : checked - ? pressedColor - : color + property color backgroundColor: hovered ? hoveredColor : checked ? pressedColor : color checkable: true Accessible.role: Accessible.Button icon.source: checkedIconUrl && mainItem.checked ? checkedIconUrl : iconUrl diff --git a/Linphone/view/Control/Button/ComboBox.qml b/Linphone/view/Control/Button/ComboBox.qml index 5175ffc3d..6a9a0b66b 100644 --- a/Linphone/view/Control/Button/ComboBox.qml +++ b/Linphone/view/Control/Button/ComboBox.qml @@ -7,264 +7,272 @@ import CustomControls 1.0 import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.ComboBox { - id: mainItem - // Usage : each item of the model list must be {text: …, img: …} - // If string list, only text part of the delegate will be filled - // readonly property string currentText: selectedItemText.text - property alias listView: listView - property string constantImageSource - property real pixelSize: Typography.p1.pixelSize - property real weight: Typography.p1.weight - property real leftMargin: Utils.getSizeWithScreenRatio(10) - property bool oneLine: false - property bool shadowEnabled: mainItem.activeFocus || mainItem.hovered - property string flagRole // Specific case if flag is shown (special font) - property var indicatorColor: DefaultStyle.main2_600 - property int indicatorRightMargin: Utils.getSizeWithScreenRatio(20) - leftPadding: Utils.getSizeWithScreenRatio(10) - rightPadding: indicImage.width + indicatorRightMargin - property bool keyboardFocus: FocusHelper.keyboardFocus - // Text properties - property color textColor: DefaultStyle.main2_600 - property color disabledTextColor: DefaultStyle.grey_400 - // Border properties - property color borderColor: DefaultStyle.grey_200 - property color disabledBorderColor: DefaultStyle.grey_400 - property color activeFocusedBorderColor: DefaultStyle.main1_500_main - property color keyboardFocusedBorderColor: DefaultStyle.main2_900 - property real borderWidth: Utils.getSizeWithScreenRatio(1) - property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3) - // Background properties - property color color: DefaultStyle.grey_100 - property color disabledColor: DefaultStyle.grey_200 + id: mainItem + // Usage : each item of the model list must be {text: …, img: …} + // If string list, only text part of the delegate will be filled + // readonly property string currentText: selectedItemText.text + property alias listView: listView + property string constantImageSource + property real pixelSize: Typography.p1.pixelSize + property real weight: Typography.p1.weight + property real leftMargin: Utils.getSizeWithScreenRatio(10) + property bool oneLine: false + property bool shadowEnabled: mainItem.activeFocus || mainItem.hovered + property string flagRole // Specific case if flag is shown (special font) + property var indicatorColor: DefaultStyle.main2_600 + property int indicatorRightMargin: Utils.getSizeWithScreenRatio(20) + leftPadding: Utils.getSizeWithScreenRatio(10) + rightPadding: indicImage.width + indicatorRightMargin + property bool keyboardFocus: FocusHelper.keyboardFocus + // Text properties + property color textColor: DefaultStyle.main2_600 + property color disabledTextColor: DefaultStyle.grey_400 + // Border properties + property color borderColor: DefaultStyle.grey_200 + property color disabledBorderColor: DefaultStyle.grey_400 + property color activeFocusedBorderColor: DefaultStyle.main1_500_main + property color keyboardFocusedBorderColor: DefaultStyle.main2_900 + property real borderWidth: Utils.getSizeWithScreenRatio(1) + property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3) + // Background properties + property color color: DefaultStyle.grey_100 + property color disabledColor: DefaultStyle.grey_200 - onConstantImageSourceChanged: if (constantImageSource) - selectedItemImg.imageSource = constantImageSource - onCurrentIndexChanged: { - var item = model[currentIndex]; - if (!item) - item = model.getAt(currentIndex); - if (!item) - return; - selectedItemText.text = mainItem.textRole ? item[mainItem.textRole] : item.text ? item.text : item ? item : ""; - if (mainItem.flagRole) - selectedItemFlag.text = item[mainItem.flagRole]; - selectedItemImg.imageSource = constantImageSource ? constantImageSource : item.img ? item.img : ""; - } + onConstantImageSourceChanged: if (constantImageSource) + selectedItemImg.imageSource = constantImageSource + onCurrentIndexChanged: { + var item = model[currentIndex]; + if (!item) + item = model.getAt(currentIndex); + if (!item) + return; + selectedItemText.text = mainItem.textRole ? item[mainItem.textRole] : item.text ? item.text : item ? item : ""; + if (mainItem.flagRole) + selectedItemFlag.text = item[mainItem.flagRole]; + selectedItemImg.imageSource = constantImageSource ? constantImageSource : item.img ? item.img : ""; + } - Keys.onPressed: event => { - if (!mainItem.contentItem.activeFocus && (event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key == Qt.Key_Return)) { - mainItem.popup.open(); - event.accepted = true; - } - } + Keys.onPressed: event => { + if (!mainItem.contentItem.activeFocus && (event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key + == Qt.Key_Return)) { + mainItem.popup.open(); + event.accepted = true; + } + } - background: Item { - Rectangle { - id: buttonBackground - anchors.fill: parent - radius: Math.round(mainItem.height / 2) - color: mainItem.enabled ? mainItem.color : mainItem.disabledColor - border.color: !mainItem.enabled ? mainItem.disabledBorderColor : mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.activeFocus || mainItem.popup.opened ? mainItem.activeFocusedBorderColor : mainItem.borderColor - border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth - } - MultiEffect { - enabled: mainItem.shadowEnabled - anchors.fill: buttonBackground - source: buttonBackground - visible: mainItem.shadowEnabled - // Crash : https://bugreports.qt.io/browse/QTBUG-124730 - shadowEnabled: true //mainItem.shadowEnabled - shadowColor: DefaultStyle.grey_1000 - shadowBlur: 0.5 - shadowOpacity: mainItem.shadowEnabled ? 0.1 : 0.0 - } - } - contentItem: RowLayout { - spacing: Utils.getSizeWithScreenRatio(5) - EffectImage { - id: selectedItemImg - Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(24) : 0 - Layout.preferredHeight: visible ? Utils.getSizeWithScreenRatio(24) : 0 - Layout.leftMargin: mainItem.leftMargin - imageSource: mainItem.constantImageSource ? mainItem.constantImageSource : "" - colorizationColor: mainItem.enabled ? mainItem.textColor : mainItem.disabledTextColor - visible: imageSource != "" - fillMode: Image.PreserveAspectFit - } - Text { - id: selectedItemFlag - Layout.preferredWidth: implicitWidth - Layout.leftMargin: selectedItemImg.visible ? 0 : Utils.getSizeWithScreenRatio(5) - Layout.alignment: Qt.AlignCenter - color: mainItem.enabled ? mainItem.textColor : mainItem.disabledTextColor - font { - family: DefaultStyle.flagFont - pixelSize: mainItem.pixelSize - weight: mainItem.weight - } - } - Text { - id: selectedItemText - Layout.fillWidth: true - Layout.leftMargin: selectedItemImg.visible ? 0 : Utils.getSizeWithScreenRatio(5) - Layout.rightMargin: Utils.getSizeWithScreenRatio(20) - Layout.alignment: Qt.AlignCenter - color: mainItem.enabled ? mainItem.textColor : mainItem.disabledTextColor - elide: Text.ElideRight - maximumLineCount: oneLine ? 1 : 2 - wrapMode: Text.WrapAnywhere - font { - family: DefaultStyle.defaultFont - pixelSize: mainItem.pixelSize - weight: mainItem.weight - } - } - } + background: Item { + Rectangle { + id: buttonBackground + anchors.fill: parent + radius: Math.round(mainItem.height / 2) + color: mainItem.enabled ? mainItem.color : mainItem.disabledColor + border.color: !mainItem.enabled ? mainItem.disabledBorderColor : mainItem.keyboardFocus + ? mainItem.keyboardFocusedBorderColor : mainItem.activeFocus || mainItem.popup.opened + ? mainItem.activeFocusedBorderColor : mainItem.borderColor + border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth + } + MultiEffect { + enabled: mainItem.shadowEnabled + anchors.fill: buttonBackground + source: buttonBackground + visible: mainItem.shadowEnabled + // Crash : https://bugreports.qt.io/browse/QTBUG-124730 + shadowEnabled: true //mainItem.shadowEnabled + shadowColor: DefaultStyle.grey_1000 + shadowBlur: 0.5 + shadowOpacity: mainItem.shadowEnabled ? 0.1 : 0.0 + } + } + contentItem: RowLayout { + spacing: Utils.getSizeWithScreenRatio(5) + EffectImage { + id: selectedItemImg + Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(24) : 0 + Layout.preferredHeight: visible ? Utils.getSizeWithScreenRatio(24) : 0 + Layout.leftMargin: mainItem.leftMargin + imageSource: mainItem.constantImageSource ? mainItem.constantImageSource : "" + colorizationColor: mainItem.enabled ? mainItem.textColor : mainItem.disabledTextColor + visible: imageSource != "" + fillMode: Image.PreserveAspectFit + } + Text { + id: selectedItemFlag + Layout.preferredWidth: implicitWidth + Layout.leftMargin: selectedItemImg.visible ? 0 : Utils.getSizeWithScreenRatio(5) + Layout.alignment: Qt.AlignCenter + color: mainItem.enabled ? mainItem.textColor : mainItem.disabledTextColor + font { + family: DefaultStyle.flagFont + pixelSize: mainItem.pixelSize + weight: mainItem.weight + } + } + Text { + id: selectedItemText + Layout.fillWidth: true + Layout.leftMargin: selectedItemImg.visible ? 0 : Utils.getSizeWithScreenRatio(5) + Layout.rightMargin: Utils.getSizeWithScreenRatio(20) + Layout.alignment: Qt.AlignCenter + color: mainItem.enabled ? mainItem.textColor : mainItem.disabledTextColor + elide: Text.ElideRight + maximumLineCount: oneLine ? 1 : 2 + wrapMode: Text.WrapAnywhere + font { + family: DefaultStyle.defaultFont + pixelSize: mainItem.pixelSize + weight: mainItem.weight + } + } + } - indicator: EffectImage { - id: indicImage - z: 1 - anchors.right: parent.right - anchors.rightMargin: mainItem.indicatorRightMargin - anchors.verticalCenter: parent.verticalCenter - imageSource: AppIcons.downArrow - width: Utils.getSizeWithScreenRatio(15) - height: Utils.getSizeWithScreenRatio(15) - fillMode: Image.PreserveAspectFit - colorizationColor: mainItem.indicatorColor - // Rotate when popup open/close - transformOrigin: Item.Center - rotation: mainItem.popup.opened ? 180 : 0 - Behavior on rotation { - NumberAnimation { - duration: 200 - easing.type: Easing.InOutQuad - } - } - } + indicator: EffectImage { + id: indicImage + z: 1 + anchors.right: parent.right + anchors.rightMargin: mainItem.indicatorRightMargin + anchors.verticalCenter: parent.verticalCenter + imageSource: AppIcons.downArrow + width: Utils.getSizeWithScreenRatio(15) + height: Utils.getSizeWithScreenRatio(15) + fillMode: Image.PreserveAspectFit + colorizationColor: mainItem.indicatorColor + // Rotate when popup open/close + transformOrigin: Item.Center + rotation: mainItem.popup.opened ? 180 : 0 + Behavior on rotation { + NumberAnimation { + duration: 200 + easing.type: Easing.InOutQuad + } + } + } - popup: Control.Popup { - id: popup - y: mainItem.height - 1 - width: mainItem.width - implicitHeight: Math.min(contentItem.implicitHeight, mainWindow.height) - padding: Utils.getSizeWithScreenRatio(1) + popup: Control.Popup { + id: popup + y: mainItem.height - 1 + width: mainItem.width + implicitHeight: Math.min(contentItem.implicitHeight, mainWindow.height) + padding: Utils.getSizeWithScreenRatio(1) - onOpened: { - listView.positionViewAtIndex(listView.currentIndex, ListView.Center); - listView.forceActiveFocus(); - } - contentItem: ListView { - id: listView - clip: true - implicitHeight: contentHeight - height: popup.height - model: visible ? mainItem.model : [] - currentIndex: mainItem.highlightedIndex >= 0 ? mainItem.highlightedIndex : 0 - highlightFollowsCurrentItem: true - highlightMoveDuration: -1 - highlightMoveVelocity: -1 - highlight: Rectangle { - width: listView.width - color: DefaultStyle.main2_200 - radius: Utils.getSizeWithScreenRatio(15) - y: listView.currentItem ? listView.currentItem.y : 0 - } + onOpened: { + listView.positionViewAtIndex(listView.currentIndex, ListView.Center); + listView.forceActiveFocus(); + } + contentItem: ListView { + id: listView + clip: true + implicitHeight: contentHeight + height: popup.height + model: visible ? mainItem.model : [] + currentIndex: mainItem.highlightedIndex >= 0 ? mainItem.highlightedIndex : 0 + highlightFollowsCurrentItem: true + highlightMoveDuration: -1 + highlightMoveVelocity: -1 + highlight: Rectangle { + width: listView.width + color: DefaultStyle.main2_200 + radius: Utils.getSizeWithScreenRatio(15) + y: listView.currentItem ? listView.currentItem.y : 0 + } - Keys.onPressed: event => { - if (event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { - event.accepted = true; - mainItem.currentIndex = listView.currentIndex; - popup.close(); - } - } + Keys.onPressed: event => { + if (event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { + event.accepted = true; + mainItem.currentIndex = listView.currentIndex; + popup.close(); + } + } - delegate: Item { - width: mainItem.width - height: mainItem.height - // anchors.left: listView.left - // anchors.right: listView.right - Accessible.name: typeof (modelData) != "undefined" ? mainItem.textRole ? modelData[mainItem.textRole] : modelData.text ? modelData.text : modelData : $modelData ? mainItem.textRole ? $modelData[mainItem.textRole] : $modelData : "" - RowLayout { - anchors.fill: parent - EffectImage { - id: delegateImg - Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(20) : 0 - Layout.leftMargin: Utils.getSizeWithScreenRatio(10) - visible: imageSource != "" - imageWidth: Utils.getSizeWithScreenRatio(20) - imageSource: typeof (modelData) != "undefined" && modelData.img ? modelData.img : "" - fillMode: Image.PreserveAspectFit - } + delegate: Item { + width: mainItem.width + height: mainItem.height + // anchors.left: listView.left + // anchors.right: listView.right + Accessible.name: typeof (modelData) != "undefined" ? mainItem.textRole ? modelData[mainItem.textRole] : modelData.text + ? modelData.text : modelData : $modelData ? mainItem.textRole ? $modelData[mainItem.textRole] : + $modelData : "" + RowLayout { + anchors.fill: parent + EffectImage { + id: delegateImg + Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(20) : 0 + Layout.leftMargin: Utils.getSizeWithScreenRatio(10) + visible: imageSource != "" + imageWidth: Utils.getSizeWithScreenRatio(20) + imageSource: typeof (modelData) != "undefined" && modelData.img ? modelData.img : "" + fillMode: Image.PreserveAspectFit + } - Text { - id: flagItem - Layout.preferredWidth: implicitWidth - Layout.leftMargin: delegateImg.visible ? 0 : Utils.getSizeWithScreenRatio(5) - Layout.alignment: Qt.AlignCenter - visible: mainItem.flagRole - font { - family: DefaultStyle.flagFont - pixelSize: mainItem.pixelSize - weight: mainItem.weight - } - text: mainItem.flagRole ? typeof (modelData) != "undefined" ? modelData[mainItem.flagRole] : $modelData[mainItem.flagRole] : "" - } - Text { - Layout.fillWidth: true - 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 - maximumLineCount: 1 - wrapMode: Text.WrapAnywhere - font { - family: DefaultStyle.defaultFont - pixelSize: Utils.getSizeWithScreenRatio(15) - weight: Font.Normal - } - } - } + Text { + id: flagItem + Layout.preferredWidth: implicitWidth + Layout.leftMargin: delegateImg.visible ? 0 : Utils.getSizeWithScreenRatio(5) + Layout.alignment: Qt.AlignCenter + visible: mainItem.flagRole + font { + family: DefaultStyle.flagFont + pixelSize: mainItem.pixelSize + weight: mainItem.weight + } + text: mainItem.flagRole ? typeof (modelData) != "undefined" ? modelData[mainItem.flagRole] : + $modelData[mainItem.flagRole] : "" + } + Text { + Layout.fillWidth: true + 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 + maximumLineCount: 1 + wrapMode: Text.WrapAnywhere + font { + family: DefaultStyle.defaultFont + pixelSize: Utils.getSizeWithScreenRatio(15) + weight: Font.Normal + } + } + } - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - Rectangle { - anchors.fill: parent - opacity: 0.1 - radius: Utils.getSizeWithScreenRatio(15) - color: DefaultStyle.main2_500_main - visible: parent.containsMouse - } - onClicked: { - mainItem.currentIndex = index; - popup.close(); - } - } - } + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + Rectangle { + anchors.fill: parent + opacity: 0.1 + radius: Utils.getSizeWithScreenRatio(15) + color: DefaultStyle.main2_500_main + visible: parent.containsMouse + } + onClicked: { + mainItem.currentIndex = index; + popup.close(); + } + } + } - Control.ScrollIndicator.vertical: Control.ScrollIndicator {} - } + Control.ScrollIndicator.vertical: Control.ScrollIndicator {} + } - background: Item { - implicitWidth: mainItem.width - implicitHeight: Utils.getSizeWithScreenRatio(30) - Rectangle { - id: cboxBg - anchors.fill: parent - radius: Utils.getSizeWithScreenRatio(15) - } - MultiEffect { - anchors.fill: cboxBg - source: cboxBg - shadowEnabled: true - shadowColor: DefaultStyle.grey_1000 - shadowBlur: 0.1 - shadowOpacity: 0.1 - } - } - } + background: Item { + implicitWidth: mainItem.width + implicitHeight: Utils.getSizeWithScreenRatio(30) + Rectangle { + id: cboxBg + anchors.fill: parent + radius: Utils.getSizeWithScreenRatio(15) + } + MultiEffect { + anchors.fill: cboxBg + source: cboxBg + shadowEnabled: true + shadowColor: DefaultStyle.grey_1000 + shadowBlur: 0.1 + shadowOpacity: 0.1 + } + } + } } diff --git a/Linphone/view/Control/Button/CountryIndicatorCombobox.qml b/Linphone/view/Control/Button/CountryIndicatorCombobox.qml index df9b03bd1..b68c05c5d 100644 --- a/Linphone/view/Control/Button/CountryIndicatorCombobox.qml +++ b/Linphone/view/Control/Button/CountryIndicatorCombobox.qml @@ -15,9 +15,11 @@ Control.ComboBox { property color keyboardFocusedBorderColor: DefaultStyle.main2_900 property real borderWidth: Utils.getSizeWithScreenRatio(1) property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3) - property string text: combobox.model.getAt(combobox.currentIndex) ? combobox.model.getAt(combobox.currentIndex).countryCallingCode : "" - currentIndex: phoneNumberModel.count > 0 ? Math.max(0, phoneNumberModel.findIndexByCountryCallingCode(defaultCallingCode)) : -1 - Accessible.name: mainItem.Accessible.name + property string text: combobox.model.getAt(combobox.currentIndex) ? combobox.model.getAt( + combobox.currentIndex).countryCallingCode : "" + currentIndex: phoneNumberModel.count > 0 ? Math.max(0, phoneNumberModel.findIndexByCountryCallingCode( + defaultCallingCode)) : -1 + Accessible.name: mainItem.Accessible.name model: PhoneNumberProxy { id: phoneNumberModel } @@ -25,15 +27,10 @@ Control.ComboBox { anchors.fill: parent radius: Utils.getSizeWithScreenRatio(63) color: mainItem.enableBackgroundColor ? DefaultStyle.grey_100 : "transparent" - border.color: mainItem.keyboardFocus - ? mainItem.keyboardFocusedBorderColor - : mainItem.enableBackgroundColors - ? (mainItem.errorMessage.length > 0 - ? DefaultStyle.danger_500_main - : mainItem.activeFocus || textField.activeFocus - ? DefaultStyle.main1_500_main - : DefaultStyle.grey_200) - : "transparent" + border.color: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.enableBackgroundColors ? ( + mainItem.errorMessage.length > 0 ? DefaultStyle.danger_500_main : mainItem.activeFocus + || textField.activeFocus ? DefaultStyle.main1_500_main : + DefaultStyle.grey_200) : "transparent" border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth } contentItem: RowLayout { @@ -86,7 +83,7 @@ Control.ComboBox { fillMode: Image.PreserveAspectFit colorizationColor: mainItem.indicatorColor } - + popup: Control.Popup { id: listPopup y: combobox.height - 1 @@ -97,7 +94,7 @@ Control.ComboBox { id: listView clip: true anchors.fill: parent - model: PhoneNumberProxy{} + model: PhoneNumberProxy {} currentIndex: combobox.highlightedIndex >= 0 ? combobox.highlightedIndex : 0 keyNavigationEnabled: true keyNavigationWraps: true @@ -118,7 +115,7 @@ Control.ComboBox { anchors.fill: parent anchors.leftMargin: Utils.getSizeWithScreenRatio(20) spacing: Utils.getSizeWithScreenRatio(5) - + Text { id: delegateImg visible: text.length > 0 @@ -171,16 +168,16 @@ Control.ComboBox { visible: parent.containsMouse } onClicked: { - combobox.currentIndex = index - listPopup.close() + combobox.currentIndex = index; + listPopup.close(); } } } - Control.ScrollIndicator.vertical: Control.ScrollIndicator { } + Control.ScrollIndicator.vertical: Control.ScrollIndicator {} } onOpened: { - listView.positionViewAtIndex(listView.currentIndex, ListView.Center) + listView.positionViewAtIndex(listView.currentIndex, ListView.Center); } background: Item { diff --git a/Linphone/view/Control/Button/HelpIconLabelButton.qml b/Linphone/view/Control/Button/HelpIconLabelButton.qml index aa82aab57..d6f4cc148 100644 --- a/Linphone/view/Control/Button/HelpIconLabelButton.qml +++ b/Linphone/view/Control/Button/HelpIconLabelButton.qml @@ -3,14 +3,14 @@ import QtQuick.Effects import QtQuick.Layouts import Linphone import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle MouseArea { id: mainItem property string iconSource property string title property string subTitle - property real iconSize: Utils.getSizeWithScreenRatio(32) + property real iconSize: Utils.getSizeWithScreenRatio(32) property bool shadowEnabled: containsMouse || activeFocus property bool arrowImageVisible: false property alias image: image @@ -19,16 +19,16 @@ MouseArea { height: content.implicitHeight cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor activeFocusOnTab: true - Keys.onPressed: (event) => { - if(event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key == Qt.Key_Return){ - mainItem.clicked(undefined) - event.accepted = true - } - } + Keys.onPressed: event => { + if (event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { + mainItem.clicked(undefined); + event.accepted = true; + } + } RowLayout { id: content anchors.verticalCenter: parent.verticalCenter - anchors.fill:parent + anchors.fill: parent EffectImage { id: image Layout.preferredWidth: mainItem.iconSize @@ -42,7 +42,7 @@ MouseArea { width: implicitWidth Layout.preferredWidth: width height: implicitHeight - Layout.leftMargin: Utils.getSizeWithScreenRatio(16) + Layout.leftMargin: Utils.getSizeWithScreenRatio(16) Text { Layout.fillWidth: true maximumLineCount: 1 @@ -63,7 +63,9 @@ MouseArea { font: Typography.p1 } } - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } EffectImage { id: arrowImage visible: mainItem.arrowImageVisible @@ -75,7 +77,7 @@ MouseArea { enabled: mainItem.shadowEnabled anchors.fill: content source: content - visible: mainItem.shadowEnabled + visible: mainItem.shadowEnabled // Crash : https://bugreports.qt.io/browse/QTBUG-124730 shadowEnabled: true //mainItem.shadowEnabled shadowColor: DefaultStyle.grey_1000 diff --git a/Linphone/view/Control/Button/IconButton.qml b/Linphone/view/Control/Button/IconButton.qml index 2385f1186..15cabd8dc 100644 --- a/Linphone/view/Control/Button/IconButton.qml +++ b/Linphone/view/Control/Button/IconButton.qml @@ -2,41 +2,35 @@ import QtQuick 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Button { id: mainItem - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) - textSize: Typography.p1.pixelSize - textWeight: Typography.p1.weight - radius: Utils.getSizeWithScreenRatio(5) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) + textSize: Typography.p1.pixelSize + textWeight: Typography.p1.weight + radius: Utils.getSizeWithScreenRatio(5) shadowEnabled: mainItem.activeFocus || hovered style: ButtonStyle.hoveredBackground - background: Rectangle { - anchors.fill: parent - radius: mainItem.radius - color: mainItem.pressed - ? mainItem.pressedColor - : mainItem.hovered || mainItem.hasNavigationFocus - ? mainItem.hoveredColor - : mainItem.color - border.color: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.borderColor - border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth - } - - contentItem: EffectImage { - imageSource: mainItem.icon.source - imageWidth: mainItem.icon.width - imageHeight: mainItem.icon.height - colorizationColor: mainItem.pressed - ? mainItem.pressedImageColor - : mainItem.hovered - ? mainItem.hoveredImageColor - : mainItem.contentImageColor - Layout.preferredWidth: mainItem.icon.width - Layout.preferredHeight: mainItem.icon.height - } + background: Rectangle { + anchors.fill: parent + radius: mainItem.radius + color: mainItem.pressed ? mainItem.pressedColor : mainItem.hovered || mainItem.hasNavigationFocus ? mainItem.hoveredColor : + mainItem.color + border.color: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.borderColor + border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth + } + + contentItem: EffectImage { + imageSource: mainItem.icon.source + imageWidth: mainItem.icon.width + imageHeight: mainItem.icon.height + colorizationColor: mainItem.pressed ? mainItem.pressedImageColor : mainItem.hovered ? mainItem.hoveredImageColor : + mainItem.contentImageColor + Layout.preferredWidth: mainItem.icon.width + Layout.preferredHeight: mainItem.icon.height + } } diff --git a/Linphone/view/Control/Button/IconLabelButton.qml b/Linphone/view/Control/Button/IconLabelButton.qml index 0b8d6189d..cb1b72029 100644 --- a/Linphone/view/Control/Button/IconLabelButton.qml +++ b/Linphone/view/Control/Button/IconLabelButton.qml @@ -2,33 +2,30 @@ import QtQuick 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Button { id: mainItem - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) - textSize: Typography.p1.pixelSize - textWeight: Typography.p1.weight - radius: Utils.getSizeWithScreenRatio(5) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) + textSize: Typography.p1.pixelSize + textWeight: Typography.p1.weight + radius: Utils.getSizeWithScreenRatio(5) shadowEnabled: mainItem.activeFocus || hovered style: ButtonStyle.hoveredBackground property bool inverseLayout: false spacing: Utils.getSizeWithScreenRatio(5) contentItem: RowLayout { - spacing: mainItem.spacing - layoutDirection: mainItem.inverseLayout ? Qt.RightToLeft: Qt.LeftToRight + spacing: mainItem.spacing + layoutDirection: mainItem.inverseLayout ? Qt.RightToLeft : Qt.LeftToRight EffectImage { imageSource: mainItem.icon.source imageWidth: mainItem.icon.width imageHeight: mainItem.icon.height - colorizationColor: mainItem.pressed - ? mainItem.pressedImageColor - : mainItem.hovered - ? mainItem.hoveredImageColor - : mainItem.contentImageColor + colorizationColor: mainItem.pressed ? mainItem.pressedImageColor : mainItem.hovered ? mainItem.hoveredImageColor : + mainItem.contentImageColor Layout.preferredWidth: mainItem.icon.width Layout.preferredHeight: mainItem.icon.height } @@ -41,18 +38,15 @@ Button { wrapMode: Text.WrapAnywhere text: mainItem.text maximumLineCount: 1 - color: pressed - ? mainItem.pressedTextColor - : mainItem.hovered - ? mainItem.hoveredTextColor - : mainItem.textColor + color: pressed ? mainItem.pressedTextColor : mainItem.hovered ? mainItem.hoveredTextColor : mainItem.textColor font { pixelSize: mainItem.textSize weight: mainItem.textWeight family: DefaultStyle.defaultFont capitalization: mainItem.capitalization underline: mainItem.underline - bold: (mainItem.style === ButtonStyle.noBackground || mainItem.style === ButtonStyle.noBackgroundRed) && (mainItem.hovered || mainItem.pressed) + bold: (mainItem.style === ButtonStyle.noBackground || mainItem.style === ButtonStyle.noBackgroundRed) && ( + mainItem.hovered || mainItem.pressed) } } TextMetrics { @@ -67,6 +61,8 @@ Button { bold: true } } - Item {Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } } } diff --git a/Linphone/view/Control/Button/LabelButton.qml b/Linphone/view/Control/Button/LabelButton.qml index 19d7296dc..20cd4fccb 100644 --- a/Linphone/view/Control/Button/LabelButton.qml +++ b/Linphone/view/Control/Button/LabelButton.qml @@ -3,7 +3,7 @@ import QtQuick.Controls.Basic as Control 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { diff --git a/Linphone/view/Control/Button/MediumButton.qml b/Linphone/view/Control/Button/MediumButton.qml index 43a8a8793..2154b8e21 100644 --- a/Linphone/view/Control/Button/MediumButton.qml +++ b/Linphone/view/Control/Button/MediumButton.qml @@ -9,10 +9,10 @@ Button { id: mainItem textSize: Typography.b2.pixelSize textWeight: Typography.b2.weight - 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) + 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/PopupButton.qml b/Linphone/view/Control/Button/PopupButton.qml index 38d4724bd..dd1f69974 100644 --- a/Linphone/view/Control/Button/PopupButton.qml +++ b/Linphone/view/Control/Button/PopupButton.qml @@ -6,195 +6,198 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle Button { - id: mainItem - property alias popup: popup - property bool shadowEnabled: mainItem.activeFocus && !keyboardFocus || hovered - property alias popupBackgroundColor: popupBackground.color - property color backgroundColor: checked ? pressedColor : hovered || mainItem.activeFocus ? hoveredColor : color - property string popUpTitle: "" - Accessible.name: popup.visible ? - //: "Close %1 popup" - qsTr("close_popup_panel_accessible_name").arg(popUpTitle) : - //: "Open %1" popup - qsTr("open_popup_panel_accessible_name").arg(popUpTitle) - style: ButtonStyle.popupButton - checked: popup.visible - leftPadding: 0 - rightPadding: 0 - topPadding: 0 - bottomPadding: 0 - icon.source: AppIcons.verticalDots - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) - implicitWidth: Utils.getSizeWithScreenRatio(30) - implicitHeight: Utils.getSizeWithScreenRatio(30) - function close() { - popup.close(); - } - function open() { - popup.open(); - } + id: mainItem + property alias popup: popup + property bool shadowEnabled: mainItem.activeFocus && !keyboardFocus || hovered + property alias popupBackgroundColor: popupBackground.color + property color backgroundColor: checked ? pressedColor : hovered || mainItem.activeFocus ? hoveredColor : color + property string popUpTitle: "" + Accessible.name: popup.visible ? + //: "Close %1 popup" + qsTr("close_popup_panel_accessible_name").arg(popUpTitle) : + //: "Open %1" popup + qsTr("open_popup_panel_accessible_name").arg(popUpTitle) + style: ButtonStyle.popupButton + checked: popup.visible + leftPadding: 0 + rightPadding: 0 + topPadding: 0 + bottomPadding: 0 + icon.source: AppIcons.verticalDots + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) + implicitWidth: Utils.getSizeWithScreenRatio(30) + implicitHeight: Utils.getSizeWithScreenRatio(30) + function close() { + popup.close(); + } + function open() { + popup.open(); + } - function isFocusable(item) { - return item.activeFocusOnTab; - } + function isFocusable(item) { + return item.activeFocusOnTab; + } - /** - * Check if an element has at least one child that is focusable - */ - function hasFocusableChild(content) { - return content.children.some(child => isFocusable(child)); - } + /** + * Check if an element has at least one child that is focusable + */ + function hasFocusableChild(content) { + return content.children.some(child => isFocusable(child)); + } - function getPreviousItem(index) { - return _getPreviousItem(popup.contentItem instanceof FocusScope ? popup.contentItem.children[0] : popup.contentItem, index); - } + function getPreviousItem(index) { + return _getPreviousItem(popup.contentItem instanceof FocusScope ? popup.contentItem.children[0] : popup.contentItem, + index); + } - function getNextItem(index) { - return _getNextItem(popup.contentItem instanceof FocusScope ? popup.contentItem.children[0] : popup.contentItem, index); - } + function getNextItem(index) { + return _getNextItem(popup.contentItem instanceof FocusScope ? popup.contentItem.children[0] : popup.contentItem, + index); + } - function _getPreviousItem(content, index) { - if (!content.visible) return null - if (content.visibleChildren.length == 0 || !hasFocusableChild(content)) - return null; - --index; - while (index >= 0) { - if (isFocusable(content.children[index]) && content.children[index].visible) - return content.children[index]; - --index; - } - return _getPreviousItem(content, content.visibleChildren.length); - } + function _getPreviousItem(content, index) { + if (!content.visible) + return null; + if (content.visibleChildren.length == 0 || !hasFocusableChild(content)) + return null; + --index; + while (index >= 0) { + if (isFocusable(content.children[index]) && content.children[index].visible) + return content.children[index]; + --index; + } + return _getPreviousItem(content, content.visibleChildren.length); + } - function _getNextItem(content, index) { - if (content.visibleChildren.length == 0 || !hasFocusableChild(content)) - return null; - ++index; - while (index < content.children.length) { - if (isFocusable(content.children[index]) && content.children[index].visible) - return content.children[index]; - ++index; - } - return _getNextItem(content, -1); - } + function _getNextItem(content, index) { + if (content.visibleChildren.length == 0 || !hasFocusableChild(content)) + return null; + ++index; + while (index < content.children.length) { + if (isFocusable(content.children[index]) && content.children[index].visible) + return content.children[index]; + ++index; + } + return _getNextItem(content, -1); + } - Keys.onPressed: event => { - if (mainItem.checked) { - if (event.key == Qt.Key_Escape || event.key == Qt.Key_Left || event.key == Qt.Key_Space) { - mainItem.close(); - mainItem.forceActiveFocus(Qt.TabFocusReason); - event.accepted = true; - } else if (event.key == Qt.Key_Up) { - getPreviousItem(0).forceActiveFocus(Qt.TabFocusReason); - event.accepted = true; - } else if (event.key == Qt.Key_Tab || event.key == Qt.Key_Down) { - getNextItem(-1).forceActiveFocus(Qt.BacktabFocusReason); - event.accepted = true; - } - } else if (event.key == Qt.Key_Space) { - mainItem.open(); - event.accepted = true; - } - } + Keys.onPressed: event => { + if (mainItem.checked) { + if (event.key == Qt.Key_Escape || event.key == Qt.Key_Left || event.key == Qt.Key_Space) { + mainItem.close(); + mainItem.forceActiveFocus(Qt.TabFocusReason); + event.accepted = true; + } else if (event.key == Qt.Key_Up) { + getPreviousItem(0).forceActiveFocus(Qt.TabFocusReason); + event.accepted = true; + } else if (event.key == Qt.Key_Tab || event.key == Qt.Key_Down) { + getNextItem(-1).forceActiveFocus(Qt.BacktabFocusReason); + event.accepted = true; + } + } else if (event.key == Qt.Key_Space) { + mainItem.open(); + event.accepted = true; + } + } - background: Item { - anchors.fill: mainItem - Rectangle { - id: buttonBackground - anchors.fill: parent - color: mainItem.backgroundColor - radius: Utils.getSizeWithScreenRatio(40) - border.color: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.borderColor - border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth - } - MultiEffect { - enabled: mainItem.shadowEnabled - anchors.fill: buttonBackground - source: buttonBackground - visible: mainItem.shadowEnabled - // Crash : https://bugreports.qt.io/browse/QTBUG-124730 - shadowEnabled: true //mainItem.shadowEnabled - shadowColor: DefaultStyle.grey_1000 - shadowBlur: 0.1 - shadowOpacity: mainItem.shadowEnabled ? 0.5 : 0.0 - } - } - contentItem: EffectImage { - imageSource: mainItem.icon.source - imageWidth: mainItem.icon.width - imageHeight: mainItem.icon.height - colorizationColor: mainItem.contentImageColor - } - onPressed: { - if (popup.visible) - popup.close(); - else - popup.open(); - } - Control.Popup { - id: popup - x: 0 - y: mainItem.height - visible: false - closePolicy: Popup.CloseOnPressOutsideParent | Popup.CloseOnPressOutside | Popup.CloseOnEscape - padding: Utils.getSizeWithScreenRatio(10) - parent: mainItem // Explicit define for coordinates references. - function updatePosition() { - if (!visible) - return; - var popupHeight = popup.height + popup.padding; - var popupWidth = popup.width + popup.padding; - var winPosition = mainItem.Window.contentItem ? mainItem.Window.contentItem.mapToItem(mainItem, 0, 0) : { - "x": 0, - "y": 0 - }; - // Stay inside main window - y = Math.max(Math.min(winPosition.y + mainItem.Window.height - popupHeight, mainItem.height), winPosition.y); - x = Math.max(Math.min(winPosition.x + mainItem.Window.width - popupWidth, 0), winPosition.x); - // Avoid overlapping with popup button by going to the right (todo: check if left is better?) - if (y < mainItem.height && y + popupHeight > 0) { - x += mainItem.width; - } - var globalPos = mapToItem(mainItem.Window.contentItem, x, y); - if (globalPos.x + popupWidth >= mainItem.Window.width) { - x = -popupWidth; - } - } + background: Item { + anchors.fill: mainItem + Rectangle { + id: buttonBackground + anchors.fill: parent + color: mainItem.backgroundColor + radius: Utils.getSizeWithScreenRatio(40) + border.color: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.borderColor + border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth + } + MultiEffect { + enabled: mainItem.shadowEnabled + anchors.fill: buttonBackground + source: buttonBackground + visible: mainItem.shadowEnabled + // Crash : https://bugreports.qt.io/browse/QTBUG-124730 + shadowEnabled: true //mainItem.shadowEnabled + shadowColor: DefaultStyle.grey_1000 + shadowBlur: 0.1 + shadowOpacity: mainItem.shadowEnabled ? 0.5 : 0.0 + } + } + contentItem: EffectImage { + imageSource: mainItem.icon.source + imageWidth: mainItem.icon.width + imageHeight: mainItem.icon.height + colorizationColor: mainItem.contentImageColor + } + onPressed: { + if (popup.visible) + popup.close(); + else + popup.open(); + } + Control.Popup { + id: popup + x: 0 + y: mainItem.height + visible: false + closePolicy: Popup.CloseOnPressOutsideParent | Popup.CloseOnPressOutside | Popup.CloseOnEscape + padding: Utils.getSizeWithScreenRatio(10) + parent: mainItem // Explicit define for coordinates references. + function updatePosition() { + if (!visible) + return; + var popupHeight = popup.height + popup.padding; + var popupWidth = popup.width + popup.padding; + var winPosition = mainItem.Window.contentItem ? mainItem.Window.contentItem.mapToItem(mainItem, 0, 0) : { + "x": 0, + "y": 0 + }; + // Stay inside main window + y = Math.max(Math.min(winPosition.y + mainItem.Window.height - popupHeight, mainItem.height), winPosition.y); + x = Math.max(Math.min(winPosition.x + mainItem.Window.width - popupWidth, 0), winPosition.x); + // Avoid overlapping with popup button by going to the right (todo: check if left is better?) + if (y < mainItem.height && y + popupHeight > 0) { + x += mainItem.width; + } + var globalPos = mapToItem(mainItem.Window.contentItem, x, y); + if (globalPos.x + popupWidth >= mainItem.Window.width) { + x = -popupWidth; + } + } - onHeightChanged: Qt.callLater(updatePosition) - onWidthChanged: Qt.callLater(updatePosition) - onVisibleChanged: Qt.callLater(updatePosition) + onHeightChanged: Qt.callLater(updatePosition) + onWidthChanged: Qt.callLater(updatePosition) + onVisibleChanged: Qt.callLater(updatePosition) - Connections { - target: mainItem.Window - function onHeightChanged() { - Qt.callLater(popup.updatePosition); - } - function onWidthChanged() { - Qt.callLater(popup.updatePosition); - } - } + Connections { + target: mainItem.Window + function onHeightChanged() { + Qt.callLater(popup.updatePosition); + } + function onWidthChanged() { + Qt.callLater(popup.updatePosition); + } + } - background: Item { - anchors.fill: parent - Rectangle { - id: popupBackground - anchors.fill: parent - color: DefaultStyle.grey_0 - radius: Utils.getSizeWithScreenRatio(16) - } - MultiEffect { - source: popupBackground - anchors.fill: popupBackground - shadowEnabled: true - shadowBlur: 0.1 - shadowColor: DefaultStyle.grey_1000 - shadowOpacity: 0.4 - } - MouseArea { - anchors.fill: parent - } - } - } + background: Item { + anchors.fill: parent + Rectangle { + id: popupBackground + anchors.fill: parent + color: DefaultStyle.grey_0 + radius: Utils.getSizeWithScreenRatio(16) + } + MultiEffect { + source: popupBackground + anchors.fill: popupBackground + shadowEnabled: true + shadowBlur: 0.1 + shadowColor: DefaultStyle.grey_1000 + shadowOpacity: 0.4 + } + MouseArea { + anchors.fill: parent + } + } + } } diff --git a/Linphone/view/Control/Button/RadioButton.qml b/Linphone/view/Control/Button/RadioButton.qml index 2a34314e6..d412a02cb 100644 --- a/Linphone/view/Control/Button/RadioButton.qml +++ b/Linphone/view/Control/Button/RadioButton.qml @@ -12,13 +12,13 @@ Control.RadioButton { property string imgUrl property bool checkOnClick: true property color color - property real indicatorSize: Utils.getSizeWithScreenRatio(16) + property real indicatorSize: Utils.getSizeWithScreenRatio(16) property bool shadowEnabled: mainItem.activeFocus || mainItem.hovered //onClicked: if (checkOnClick && !mainItem.checked) mainItem.toggle() - MouseArea{ + MouseArea { id: mouseArea - anchors.fill:parent + anchors.fill: parent hoverEnabled: true acceptedButtons: Qt.NoButton cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor @@ -31,16 +31,16 @@ Control.RadioButton { Rectangle { id: backgroundArea anchors.fill: parent - radius: mainItem.indicatorSize/2 + radius: mainItem.indicatorSize / 2 color: "transparent" border.color: mainItem.color - border.width: Utils.getSizeWithScreenRatio(2) + border.width: Utils.getSizeWithScreenRatio(2) Rectangle { - width: parent.width/2 - height: parent.height/2 - x: parent.width/4 - y: parent.width/4 - radius: width/2 + width: parent.width / 2 + height: parent.height / 2 + x: parent.width / 4 + y: parent.width / 4 + radius: width / 2 color: mainItem.color visible: mainItem.checked } @@ -49,7 +49,7 @@ Control.RadioButton { enabled: mainItem.shadowEnabled anchors.fill: backgroundArea source: backgroundArea - visible: mainItem.shadowEnabled + visible: mainItem.shadowEnabled // Crash : https://bugreports.qt.io/browse/QTBUG-124730 shadowEnabled: true //mainItem.shadowEnabled shadowColor: DefaultStyle.grey_1000 diff --git a/Linphone/view/Control/Button/RoundButton.qml b/Linphone/view/Control/Button/RoundButton.qml index 94c10972d..f1f9b8cb2 100644 --- a/Linphone/view/Control/Button/RoundButton.qml +++ b/Linphone/view/Control/Button/RoundButton.qml @@ -9,10 +9,10 @@ Button { id: mainItem textSize: Typography.p1s.pixelSize textWeight: Typography.p1s.weight - padding: Utils.getSizeWithScreenRatio(16) - // icon.width: width - // icon.height: width - radius: width * 2 - // width: Utils.getSizeWithScreenRatio(24) - height: width + padding: Utils.getSizeWithScreenRatio(16) + // icon.width: width + // icon.height: width + radius: width * 2 + // width: Utils.getSizeWithScreenRatio(24) + height: width } diff --git a/Linphone/view/Control/Button/SecurityRadioButton.qml b/Linphone/view/Control/Button/SecurityRadioButton.qml index c83df3f7e..fce5e56df 100644 --- a/Linphone/view/Control/Button/SecurityRadioButton.qml +++ b/Linphone/view/Control/Button/SecurityRadioButton.qml @@ -16,33 +16,34 @@ Control.RadioButton { anchors.fill: parent hoverEnabled: false cursorShape: mainItem.hovered ? Qt.PointingHandCursor : Qt.ArrowCursor - onClicked: if (!mainItem.checked) mainItem.toggle() + onClicked: if (!mainItem.checked) + mainItem.toggle() } background: Rectangle { color: DefaultStyle.grey_100 border.color: mainItem.checked ? mainItem.color : "transparent" - radius: Utils.getSizeWithScreenRatio(20) + radius: Utils.getSizeWithScreenRatio(20) } indicator: RowLayout { anchors.left: parent.left - anchors.leftMargin: Utils.getSizeWithScreenRatio(13) + anchors.leftMargin: Utils.getSizeWithScreenRatio(13) anchors.top: parent.top - anchors.topMargin: Utils.getSizeWithScreenRatio(8) - spacing: Utils.getSizeWithScreenRatio(4) + anchors.topMargin: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(4) Rectangle { - implicitWidth: Utils.getSizeWithScreenRatio(16) - implicitHeight: Utils.getSizeWithScreenRatio(16) - radius: implicitWidth/2 + implicitWidth: Utils.getSizeWithScreenRatio(16) + implicitHeight: Utils.getSizeWithScreenRatio(16) + radius: implicitWidth / 2 border.color: mainItem.color Rectangle { - width: parent.width/2 - height: parent.height/2 - x: parent.width/4 - y: parent.width/4 - radius: width/2 + width: parent.width / 2 + height: parent.height / 2 + x: parent.width / 4 + y: parent.width / 4 + radius: width / 2 color: mainItem.color visible: mainItem.checked } @@ -52,7 +53,7 @@ Control.RadioButton { text: mainItem.title font.bold: true color: DefaultStyle.grey_900 - font.pixelSize: Utils.getSizeWithScreenRatio(16) + font.pixelSize: Utils.getSizeWithScreenRatio(16) } Button { padding: 0 @@ -60,41 +61,41 @@ Control.RadioButton { visible: false } icon.source: AppIcons.info - 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) + 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) } } - + contentItem: ColumnLayout { anchors.top: indicator.bottom anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right - anchors.leftMargin: Utils.getSizeWithScreenRatio(13) + anchors.leftMargin: Utils.getSizeWithScreenRatio(13) RowLayout { Layout.fillWidth: true Layout.fillHeight: true - Layout.bottomMargin: Utils.getSizeWithScreenRatio(10) - Layout.rightMargin: Utils.getSizeWithScreenRatio(10) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(10) + Layout.rightMargin: Utils.getSizeWithScreenRatio(10) Layout.alignment: Qt.AlignVCenter Text { id: innerText verticalAlignment: Text.AlignVCenter - Layout.preferredWidth: Utils.getSizeWithScreenRatio(220) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(100) - font.pixelSize: Utils.getSizeWithScreenRatio(14) + 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: Utils.getSizeWithScreenRatio(100) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(100) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(100) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(100) fillMode: Image.PreserveAspectFit source: mainItem.imgUrl } diff --git a/Linphone/view/Control/Button/Settings/ComboSetting.qml b/Linphone/view/Control/Button/Settings/ComboSetting.qml index ee82d025e..6dfe71717 100644 --- a/Linphone/view/Control/Button/Settings/ComboSetting.qml +++ b/Linphone/view/Control/Button/Settings/ComboSetting.qml @@ -2,28 +2,28 @@ import QtQuick import QtQuick.Controls.Basic import QtQuick.Layouts import Linphone -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ComboBox { id: mainItem - Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) property string propertyName - + property var propertyOwner property var propertyOwnerGui property alias entries: mainItem.model oneLine: true currentIndex: Utils.findIndex(model, function (entry) { - if(propertyOwnerGui) - return Utils.equalObject(entry,propertyOwnerGui.core[propertyName]) + if (propertyOwnerGui) + return Utils.equalObject(entry, propertyOwnerGui.core[propertyName]); else - return Utils.equalObject(entry,propertyOwner[propertyName]) + return Utils.equalObject(entry, propertyOwner[propertyName]); }) onCurrentValueChanged: { - if(propertyOwnerGui) { - binding.when = !Utils.equalObject(currentValue,propertyOwnerGui.core[propertyName]) - }else{ - binding.when = !Utils.equalObject(currentValue,propertyOwner[propertyName]) + if (propertyOwnerGui) { + binding.when = !Utils.equalObject(currentValue, propertyOwnerGui.core[propertyName]); + } else { + binding.when = !Utils.equalObject(currentValue, propertyOwner[propertyName]); } } Binding { diff --git a/Linphone/view/Control/Button/Settings/SwitchSetting.qml b/Linphone/view/Control/Button/Settings/SwitchSetting.qml index bf74d6080..d83447e4e 100644 --- a/Linphone/view/Control/Button/Settings/SwitchSetting.qml +++ b/Linphone/view/Control/Button/Settings/SwitchSetting.qml @@ -2,10 +2,10 @@ import QtQuick import QtQuick.Controls.Basic import QtQuick.Layouts import Linphone -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils RowLayout { - id:mainItem + id: mainItem property string titleText property string subTitleText property string propertyName @@ -13,13 +13,13 @@ RowLayout { property var propertyOwnerGui property bool enabled: true property alias checked: switchButton.checked - spacing : Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) - signal toggled() + signal toggled ColumnLayout { - Layout.minimumHeight: Utils.getSizeWithScreenRatio(32) - spacing: Utils.getSizeWithScreenRatio(4) + Layout.minimumHeight: Utils.getSizeWithScreenRatio(32) + spacing: Utils.getSizeWithScreenRatio(4) Text { text: titleText font: Typography.p2l @@ -39,12 +39,12 @@ RowLayout { Switch { id: switchButton Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - checked: propertyOwnerGui ? propertyOwnerGui.core[mainItem.propertyName] - : propertyOwner ? propertyOwner[mainItem.propertyName] : false + checked: propertyOwnerGui ? propertyOwnerGui.core[mainItem.propertyName] : propertyOwner + ? propertyOwner[mainItem.propertyName] : false enabled: mainItem.enabled onToggled: { - binding.when = true - mainItem.toggled() + binding.when = true; + mainItem.toggled(); } implicitHeight: Utils.getSizeWithScreenRatio(30) Accessible.name: "%1 %2".arg(mainItem.titleText).arg(mainItem.subTitleText) diff --git a/Linphone/view/Control/Button/Slider.qml b/Linphone/view/Control/Button/Slider.qml index 3335dca77..3675b2a84 100644 --- a/Linphone/view/Control/Button/Slider.qml +++ b/Linphone/view/Control/Button/Slider.qml @@ -7,65 +7,71 @@ import CustomControls 1.0 import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.Slider { - id: mainItem - property bool keyboardFocus: FocusHelper.keyboardFocus - property bool shadowEnabled: mainItem.hovered || mainItem.activeFocus && !keyboardFocus + id: mainItem + property bool keyboardFocus: FocusHelper.keyboardFocus + property bool shadowEnabled: mainItem.hovered || mainItem.activeFocus && !keyboardFocus hoverEnabled: true - // Border properties - property color borderColor: "transparent" - property color keyboardFocusedBorderColor: DefaultStyle.main2_900 - property real borderWidth: 0 - property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3) - background: Item{ + // Border properties + property color borderColor: "transparent" + property color keyboardFocusedBorderColor: DefaultStyle.main2_900 + property real borderWidth: 0 + property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3) + background: Item { x: mainItem.leftPadding y: mainItem.topPadding + mainItem.availableHeight / 2 - height / 2 - implicitWidth: Utils.getSizeWithScreenRatio(200) - implicitHeight: Utils.getSizeWithScreenRatio(4) + implicitWidth: Utils.getSizeWithScreenRatio(200) + implicitHeight: Utils.getSizeWithScreenRatio(4) width: mainItem.availableWidth height: implicitHeight Rectangle { id: sliderBackground anchors.fill: parent - radius: Math.round(height / 2) + radius: Math.round(height / 2) // TODO : change the colors when mockup indicates their names color: DefaultStyle.grey_850 - + Rectangle { width: mainItem.visualPosition * parent.width height: parent.height gradient: Gradient { orientation: Gradient.Horizontal - GradientStop { position: 0.0; color: DefaultStyle.main1_300 } - GradientStop { position: 1.0; color: DefaultStyle.main1_500_main } + GradientStop { + position: 0.0 + color: DefaultStyle.main1_300 + } + GradientStop { + position: 1.0 + color: DefaultStyle.main1_500_main + } } - radius: Math.round(height / 2) + radius: Math.round(height / 2) } } MultiEffect { enabled: mainItem.shadowEnabled anchors.fill: sliderBackground source: sliderBackground - visible: mainItem.shadowEnabled + visible: mainItem.shadowEnabled // Crash : https://bugreports.qt.io/browse/QTBUG-124730 shadowEnabled: true //mainItem.shadowEnabled shadowColor: DefaultStyle.grey_1000 shadowBlur: 0.1 shadowOpacity: mainItem.shadowEnabled ? 0.5 : 0.0 } - } + } - handle: Item { + handle: Item { x: mainItem.leftPadding + mainItem.visualPosition * (mainItem.availableWidth - width) y: mainItem.topPadding + mainItem.availableHeight / 2 - height / 2 - implicitWidth: Utils.getSizeWithScreenRatio(16) - implicitHeight: Utils.getSizeWithScreenRatio(16) + implicitWidth: Utils.getSizeWithScreenRatio(16) + implicitHeight: Utils.getSizeWithScreenRatio(16) Rectangle { id: handleRect anchors.fill: parent - radius: Math.round(height / 2) + radius: Math.round(height / 2) color: DefaultStyle.grey_0 - border.color: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.borderColor - border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth + border.color: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.borderColor + border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth } MultiEffect { source: handleRect diff --git a/Linphone/view/Control/Button/SmallButton.qml b/Linphone/view/Control/Button/SmallButton.qml index 21e9698e2..d42957f14 100644 --- a/Linphone/view/Control/Button/SmallButton.qml +++ b/Linphone/view/Control/Button/SmallButton.qml @@ -9,10 +9,10 @@ Button { id: mainItem textSize: Typography.b3.pixelSize textWeight: Typography.b3.weight - 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) + 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/Button/Switch.qml b/Linphone/view/Control/Button/Switch.qml index 45a23011c..f7fe657da 100644 --- a/Linphone/view/Control/Button/Switch.qml +++ b/Linphone/view/Control/Button/Switch.qml @@ -6,69 +6,69 @@ import CustomControls 1.0 import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.Switch { - id: mainItem - hoverEnabled: true - property bool keyboardFocus: FocusHelper.keyboardFocus - property bool shadowEnabled: mainItem.hovered || mainItem.activeFocus && !keyboardFocus - // Text properties - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } - // Border properties - property color borderColor: "transparent" - property color keyboardFocusedBorderColor: DefaultStyle.main2_900 - property real borderWidth: 0 - property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3) + id: mainItem + hoverEnabled: true + property bool keyboardFocus: FocusHelper.keyboardFocus + property bool shadowEnabled: mainItem.hovered || mainItem.activeFocus && !keyboardFocus + // Text properties + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + // Border properties + property color borderColor: "transparent" + property color keyboardFocusedBorderColor: DefaultStyle.main2_900 + property real borderWidth: 0 + property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3) - indicator: Item { - id: indicatorItem - x: mainItem.leftPadding - y: parent.height / 2 - height / 2 - // Size properties - implicitHeight: Utils.getSizeWithScreenRatio(20) - implicitWidth: Math.round(implicitHeight * 1.6) - Rectangle { - id: indicatorBackground - anchors.fill: parent - radius: Math.round(indicatorItem.height / 2) - color: mainItem.checked ? DefaultStyle.success_500_main : DefaultStyle.main2_400 - border.color: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.borderColor - border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth + indicator: Item { + id: indicatorItem + x: mainItem.leftPadding + y: parent.height / 2 - height / 2 + // Size properties + implicitHeight: Utils.getSizeWithScreenRatio(20) + implicitWidth: Math.round(implicitHeight * 1.6) + Rectangle { + id: indicatorBackground + anchors.fill: parent + radius: Math.round(indicatorItem.height / 2) + color: mainItem.checked ? DefaultStyle.success_500_main : DefaultStyle.main2_400 + border.color: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.borderColor + border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth - Rectangle { - anchors.verticalCenter: parent.verticalCenter - height: Math.round(indicatorItem.height * 0.6) - width: height - property real margin: Math.round((indicatorItem.height - height) / 2) - radius: Math.round(height / 2) - x: mainItem.checked ? parent.width - width - margin : margin - color: DefaultStyle.grey_0 - Behavior on x { - NumberAnimation { - duration: 100 - } - } - } - } - MultiEffect { - enabled: mainItem.shadowEnabled - anchors.fill: indicatorBackground - source: indicatorBackground - visible: mainItem.shadowEnabled - // Crash : https://bugreports.qt.io/browse/QTBUG-124730 - shadowEnabled: true //mainItem.shadowEnabled - shadowColor: DefaultStyle.grey_1000 - shadowBlur: 0.1 - shadowOpacity: mainItem.shadowEnabled ? 0.5 : 0.0 - } - } + Rectangle { + anchors.verticalCenter: parent.verticalCenter + height: Math.round(indicatorItem.height * 0.6) + width: height + property real margin: Math.round((indicatorItem.height - height) / 2) + radius: Math.round(height / 2) + x: mainItem.checked ? parent.width - width - margin : margin + color: DefaultStyle.grey_0 + Behavior on x { + NumberAnimation { + duration: 100 + } + } + } + } + MultiEffect { + enabled: mainItem.shadowEnabled + anchors.fill: indicatorBackground + source: indicatorBackground + visible: mainItem.shadowEnabled + // Crash : https://bugreports.qt.io/browse/QTBUG-124730 + shadowEnabled: true //mainItem.shadowEnabled + shadowColor: DefaultStyle.grey_1000 + shadowBlur: 0.1 + shadowOpacity: mainItem.shadowEnabled ? 0.5 : 0.0 + } + } - contentItem: Text { - text: mainItem.text - font: mainItem.font - opacity: enabled ? 1.0 : 0.3 - verticalAlignment: Text.AlignVCenter - leftPadding: mainItem.indicator.width + mainItem.spacing - } + contentItem: Text { + text: mainItem.text + font: mainItem.font + opacity: enabled ? 1.0 : 0.3 + verticalAlignment: Text.AlignVCenter + leftPadding: mainItem.indicator.width + mainItem.spacing + } } diff --git a/Linphone/view/Control/Container/Call/ActiveSpeakerLayout.qml b/Linphone/view/Control/Container/Call/ActiveSpeakerLayout.qml index 8599aa97b..0b6aca52c 100644 --- a/Linphone/view/Control/Container/Call/ActiveSpeakerLayout.qml +++ b/Linphone/view/Control/Container/Call/ActiveSpeakerLayout.qml @@ -16,27 +16,24 @@ Item { property alias call: allDevices.currentCall property ConferenceGui conference: call && call.core.conference || null property var callState: call && call.core.state || undefined - property string localAddress: call - ? call.conference - ? call.conference.core.me.core.sipAddress - : call.core.localAddress - : "" + property string localAddress: call ? call.conference ? call.conference.core.me.core.sipAddress : + call.core.localAddress : "" property bool sideStickersVisible: sideStickers.visible - + // currently speaking address (for hiding in list view) property string activeSpeakerAddress - property ParticipantDeviceProxy participantDevices : ParticipantDeviceProxy { + property ParticipantDeviceProxy participantDevices: ParticipantDeviceProxy { id: allDevices qmlName: "AS" - onCountChanged: console.log("Device count changed : " +count) - Component.onCompleted: console.log("Loaded : " +allDevices) + onCountChanged: console.log("Device count changed : " + count) + Component.onCompleted: console.log("Loaded : " + allDevices) } - RowLayout{ + RowLayout { anchors.fill: parent - anchors.rightMargin: Utils.getSizeWithScreenRatio(10) - spacing: Utils.getSizeWithScreenRatio(16) + anchors.rightMargin: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(16) Sticker { id: activeSpeakerSticker Layout.fillWidth: true @@ -46,7 +43,8 @@ Item { displayAll: !mainItem.conference participantDevice: mainItem.conference && mainItem.conference.core.activeSpeakerDevice property var address: participantDevice && participantDevice.core.address - videoEnabled: (participantDevice && participantDevice.core.videoEnabled) || (!participantDevice && call && call.core.remoteVideoEnabled) + videoEnabled: (participantDevice && participantDevice.core.videoEnabled) || (!participantDevice && call + && call.core.remoteVideoEnabled) qmlName: 'AS' securityBreach: !mainItem.conference && mainItem.call?.core.isMismatch || false displayPresence: false @@ -57,35 +55,37 @@ Item { when: true } } - ListView{ + ListView { id: sideStickers Layout.fillHeight: true - Layout.preferredWidth: Utils.getSizeWithScreenRatio(300) - Layout.rightMargin: Utils.getSizeWithScreenRatio(10) - Layout.bottomMargin: Utils.getSizeWithScreenRatio(10) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(300) + Layout.rightMargin: Utils.getSizeWithScreenRatio(10) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(10) visible: allDevices.count > 2 || !!mainItem.conference?.core.isScreenSharingEnabled - //spacing: Utils.getSizeWithScreenRatio(15) // 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 ? Utils.getSizeWithScreenRatio(180 + 15) : 0 - width: Utils.getSizeWithScreenRatio(300) + 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 ? Utils.getSizeWithScreenRatio(180 + 15) : 0 + width: Utils.getSizeWithScreenRatio(300) Sticker { previewEnabled: index == 0 // before anchors for priority initialization anchors.fill: parent - anchors.bottomMargin: Utils.getSizeWithScreenRatio(15)// Spacing - qmlName: 'S_'+index + anchors.bottomMargin: Utils.getSizeWithScreenRatio(15)// Spacing + qmlName: 'S_' + index visible: parent.visible - videoEnabled: (index === 0 && mainItem.call.core.cameraEnabled) - || (!previewEnabled && call && call.core.remoteVideoEnabled) - || (!previewEnabled && participantDevice && participantDevice.core.videoEnabled) + videoEnabled: (index === 0 && mainItem.call.core.cameraEnabled) || (!previewEnabled && call + && call.core.remoteVideoEnabled) || (!previewEnabled && participantDevice + && participantDevice.core.videoEnabled) participantDevice: $modelData displayAll: false displayPresence: false - Component.onCompleted: console.log(qmlName + " is " +($modelData ? $modelData.core.address : "-")) + Component.onCompleted: console.log(qmlName + " is " + ($modelData ? $modelData.core.address : "-")) } } } diff --git a/Linphone/view/Control/Container/Call/CallGridLayout.qml b/Linphone/view/Control/Container/Call/CallGridLayout.qml index 8ad0e9388..a675a75c6 100644 --- a/Linphone/view/Control/Container/Call/CallGridLayout.qml +++ b/Linphone/view/Control/Container/Call/CallGridLayout.qml @@ -14,40 +14,45 @@ Mosaic { property ConferenceGui conference: call && call.core.conference || null property bool videoEnabled: true property int participantCount: gridModel.count - + margins: 0 // On grid view, we limit the quality if there are enough participants// The vga mode has been activated from the factory rc //onParticipantCountChanged: participantCount > ConstantsCpp.maxMosaicParticipants ? SettingsModel.setLimitedMosaicQuality() : SettingsModel.setHighMosaicQuality() - delegateModel: DelegateModel{ + delegateModel: DelegateModel { id: gridModel - property ParticipantDeviceProxy participantDevices : ParticipantDeviceProxy { + property ParticipantDeviceProxy participantDevices: ParticipantDeviceProxy { id: allDevices qmlName: "G" - Component.onCompleted: console.log("Loaded : " +allDevices + " = " +allDevices.count) + Component.onCompleted: console.log("Loaded : " + allDevices + " = " + allDevices.count) } - model: grid.call && grid.call.core.isConference ? participantDevices: [0,1] - delegate: Item{ + model: grid.call && grid.call.core.isConference ? participantDevices : [0, 1] + delegate: Item { id: avatarCell - property ParticipantDeviceGui currentDevice: index >= 0 && grid.call && grid.call.core.isConference ? $modelData : null + property ParticipantDeviceGui currentDevice: index >= 0 && grid.call && grid.call.core.isConference ? $modelData : + null onCurrentDeviceChanged: { - 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) + 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 - Utils.getSizeWithScreenRatio(10) - width: grid.cellWidth - Utils.getSizeWithScreenRatio(10) + + height: grid.cellHeight - Utils.getSizeWithScreenRatio(10) + width: grid.cellWidth - Utils.getSizeWithScreenRatio(10) Sticker { id: cameraView previewEnabled: index == 0 - visible: mainItem.callState != LinphoneEnums.CallState.End && mainItem.callState != LinphoneEnums.CallState.Released + visible: mainItem.callState != LinphoneEnums.CallState.End && mainItem.callState != LinphoneEnums.CallState.Released anchors.fill: parent - qmlName: 'G_'+index + qmlName: 'G_' + index call: grid.call && !grid.call.core.isConference ? grid.call : null property var accountObj: UtilsCpp.findLocalAccountByAddress(mainItem.localAddress) account: (index == 0 && accountObj) ? accountObj.value : null displayAll: false displayPresence: false participantDevice: avatarCell.currentDevice - Component.onCompleted: console.log(qmlName + " is " +(call ? call.core.remoteAddress : currentDevice ? currentDevice.core.address : 'addr_NotDefined')) + Component.onCompleted: console.log(qmlName + " is " + (call ? call.core.remoteAddress : currentDevice + ? currentDevice.core.address : 'addr_NotDefined')) } } } diff --git a/Linphone/view/Control/Container/Call/CallHistoryLayout.qml b/Linphone/view/Control/Container/Call/CallHistoryLayout.qml index e74092dd7..8a1158006 100644 --- a/Linphone/view/Control/Container/Call/CallHistoryLayout.qml +++ b/Linphone/view/Control/Container/Call/CallHistoryLayout.qml @@ -5,12 +5,12 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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: Utils.getSizeWithScreenRatio(30) + spacing: Utils.getSizeWithScreenRatio(30) property var callHistoryGui @@ -20,35 +20,32 @@ ColumnLayout { property bool isConference: conferenceInfo != undefined && conferenceInfo != null property string contactAddress: specificAddress != "" ? specificAddress : contact && contact.core.defaultAddress || "" property var computedContactNameObj: UtilsCpp.getDisplayName(contactAddress) - property string computedContactName: computedContactNameObj ? computedContactNameObj.value: "" - property string contactName: contact - ? contact.core.fullName - : callHistoryGui - ? callHistoryGui.core.displayName - : computedContactName + property string computedContactName: computedContactNameObj ? computedContactNameObj.value : "" + property string contactName: contact ? contact.core.fullName : callHistoryGui ? callHistoryGui.core.displayName : + computedContactName - // Set this property to get the security informations + // Set this property to get the security informations // for a specific address and not for the entire contact property string specificAddress: "" property alias buttonContent: rightButton.data property alias detailContent: detailControl.data - signal conferenceChatDisplayRequested() - signal conferenceCallHistoryDisplayRequested() + signal conferenceChatDisplayRequested + signal conferenceCallHistoryDisplayRequested ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(13) + spacing: Utils.getSizeWithScreenRatio(13) Layout.alignment: Qt.AlignHCenter Item { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) Layout.preferredHeight: detailAvatar.height Layout.alignment: Qt.AlignHCenter Avatar { id: detailAvatar anchors.horizontalCenter: parent.horizontalCenter - width: Utils.getSizeWithScreenRatio(100) - height: Utils.getSizeWithScreenRatio(100) + width: Utils.getSizeWithScreenRatio(100) + height: Utils.getSizeWithScreenRatio(100) contact: mainItem.contact || null isConference: !!mainItem.conferenceInfo displayNameVal: mainItem.contactName @@ -58,18 +55,18 @@ ColumnLayout { id: rightButton anchors.right: parent.right anchors.verticalCenter: detailAvatar.verticalCenter - anchors.rightMargin: Utils.getSizeWithScreenRatio(20) - width: Utils.getSizeWithScreenRatio(30) - height: Utils.getSizeWithScreenRatio(30) + anchors.rightMargin: Utils.getSizeWithScreenRatio(20) + width: Utils.getSizeWithScreenRatio(30) + height: Utils.getSizeWithScreenRatio(30) } } ColumnLayout { Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) - spacing: Utils.getSizeWithScreenRatio(5) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) + spacing: Utils.getSizeWithScreenRatio(5) ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(2) + spacing: Utils.getSizeWithScreenRatio(2) Layout.alignment: Qt.AlignHCenter Text { Layout.preferredWidth: implicitWidth @@ -79,8 +76,8 @@ ColumnLayout { text: detailAvatar.displayNameVal maximumLineCount: 1 font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight } } Text { @@ -92,8 +89,8 @@ ColumnLayout { elide: Text.ElideMiddle maximumLineCount: 1 font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } @@ -105,8 +102,8 @@ ColumnLayout { text: contact ? contact.core.presenceStatus : "" color: contact ? contact.core.presenceColor : 'transparent' font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } @@ -119,9 +116,9 @@ ColumnLayout { style: ButtonStyle.grey onClicked: { if (mainItem.conferenceInfo) { - var callsWindow = UtilsCpp.getOrCreateCallsWindow() - callsWindow.setupConference(mainItem.conferenceInfo) - UtilsCpp.smartShowWindow(callsWindow) + var callsWindow = UtilsCpp.getOrCreateCallsWindow(); + callsWindow.setupConference(mainItem.conferenceInfo); + UtilsCpp.smartShowWindow(callsWindow); } } } @@ -129,96 +126,103 @@ ColumnLayout { id: confWithChatLayout visible: mainItem.isConference && !SettingsCpp.disableMeetingsFeature && mainItem.chatGui !== null Layout.alignment: Qt.AlignHCenter - spacing: Utils.getSizeWithScreenRatio(72) + spacing: Utils.getSizeWithScreenRatio(72) // Layout.fillWidth: true Layout.preferredHeight: childrenRect.height LabelButton { visible: !SettingsCpp.disableChatFeature - width: Utils.getSizeWithScreenRatio(56) - height: Utils.getSizeWithScreenRatio(56) - button.icon.width: Utils.getSizeWithScreenRatio(24) - button.icon.height: Utils.getSizeWithScreenRatio(24) - button.icon.source: AppIcons.videoconference - //: "Join" - label: qsTr("meeting_info_join_title") + width: Utils.getSizeWithScreenRatio(56) + height: Utils.getSizeWithScreenRatio(56) + button.icon.width: Utils.getSizeWithScreenRatio(24) + button.icon.height: Utils.getSizeWithScreenRatio(24) + button.icon.source: AppIcons.videoconference + //: "Join" + label: qsTr("meeting_info_join_title") button.onClicked: if (mainItem.conferenceInfo) { - var callsWindow = UtilsCpp.getOrCreateCallsWindow() - callsWindow.setupConference(mainItem.conferenceInfo) - UtilsCpp.smartShowWindow(callsWindow) - } - } + var callsWindow = UtilsCpp.getOrCreateCallsWindow(); + callsWindow.setupConference(mainItem.conferenceInfo); + UtilsCpp.smartShowWindow(callsWindow); + } + } LabelButton { visible: !SettingsCpp.disableChatFeature button.checkable: true - width: Utils.getSizeWithScreenRatio(56) - height: Utils.getSizeWithScreenRatio(56) - button.icon.width: Utils.getSizeWithScreenRatio(24) - button.icon.height: Utils.getSizeWithScreenRatio(24) - button.icon.source: button.checked ? AppIcons.callList : AppIcons.chatTeardropText - label: button.checked - //: "Call history" - ? qsTr("contact_call_history_action") - //: "Conversation" - : qsTr("contact_conversation_action") + width: Utils.getSizeWithScreenRatio(56) + height: Utils.getSizeWithScreenRatio(56) + button.icon.width: Utils.getSizeWithScreenRatio(24) + button.icon.height: Utils.getSizeWithScreenRatio(24) + button.icon.source: button.checked ? AppIcons.callList : AppIcons.chatTeardropText + label: button.checked ? + //: "Call history" + qsTr("contact_call_history_action") : + //: "Conversation" + qsTr("contact_conversation_action") button.onCheckedChanged: { - if (button.checked) mainItem.conferenceChatDisplayRequested() - else mainItem.conferenceCallHistoryDisplayRequested() + if (button.checked) + mainItem.conferenceChatDisplayRequested(); + else + mainItem.conferenceCallHistoryDisplayRequested(); } - } + } } RowLayout { Layout.alignment: Qt.AlignHCenter - spacing: Utils.getSizeWithScreenRatio(72) + spacing: Utils.getSizeWithScreenRatio(72) Layout.fillWidth: true Layout.preferredHeight: childrenRect.height visible: !mainItem.isConference LabelButton { - width: Utils.getSizeWithScreenRatio(56) - height: Utils.getSizeWithScreenRatio(56) - button.icon.width: Utils.getSizeWithScreenRatio(24) - button.icon.height: Utils.getSizeWithScreenRatio(24) + 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") + //: "Appel" + label: qsTr("contact_call_action") button.onClicked: { - if (mainItem.specificAddress === "") mainWindow.startCallWithContact(mainItem.contact, false, mainItem) - else UtilsCpp.createCall(mainItem.specificAddress) + if (mainItem.specificAddress === "") + mainWindow.startCallWithContact(mainItem.contact, false, mainItem); + else + UtilsCpp.createCall(mainItem.specificAddress); } } LabelButton { visible: !SettingsCpp.disableChatFeature - 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") + 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") button.onClicked: { - console.debug("[CallHistoryLayout.qml] Open conversation") + console.debug("[CallHistoryLayout.qml] Open conversation"); if (mainItem.specificAddress === "") { - mainWindow.sendMessageToContact(mainItem.contact) - } - else { - console.log("specific address", mainItem.specificAddress) - mainWindow.displayChatPage(mainItem.specificAddress) + mainWindow.sendMessageToContact(mainItem.contact); + } else { + console.log("specific address", mainItem.specificAddress); + mainWindow.displayChatPage(mainItem.specificAddress); } } - } - LabelButton { - visible: SettingsCpp.videoEnabled - 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") - button.onClicked: { - if (mainItem.specificAddress === "") mainWindow.startCallWithContact(mainItem.contact, true, mainItem) - else UtilsCpp.createCall(mainItem.specificAddress, {'localVideoEnabled': true}) - } - } + } + LabelButton { + visible: SettingsCpp.videoEnabled + 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") + button.onClicked: { + if (mainItem.specificAddress === "") + mainWindow.startCallWithContact(mainItem.contact, true, mainItem); + else + UtilsCpp.createCall(mainItem.specificAddress, { + 'localVideoEnabled': true + }); + } + } } ColumnLayout { id: detailControl @@ -226,6 +230,6 @@ ColumnLayout { Layout.fillHeight: true Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Utils.getSizeWithScreenRatio(30) + Layout.topMargin: Utils.getSizeWithScreenRatio(30) } } diff --git a/Linphone/view/Control/Container/Call/CallLayout.qml b/Linphone/view/Control/Container/Call/CallLayout.qml index 607f623b7..ddd70c104 100644 --- a/Linphone/view/Control/Container/Call/CallLayout.qml +++ b/Linphone/view/Control/Container/Call/CallLayout.qml @@ -16,106 +16,97 @@ Item { property CallGui call property ConferenceGui conference: call && call.core.conference property bool callTerminatedByUser: false - property bool callStarted: call? call.core.isStarted : false + property bool callStarted: call ? call.core.isStarted : false readonly property var callState: call?.core.state - onCallStateChanged: if (callState === LinphoneEnums.CallState.End || callState === LinphoneEnums.CallState.Released) preview.visible = false + onCallStateChanged: if (callState === LinphoneEnums.CallState.End || callState === LinphoneEnums.CallState.Released) + preview.visible = false property int conferenceLayout: call ? call.core.conferenceVideoLayout : LinphoneEnums.ConferenceLayout.ActiveSpeaker property int participantDeviceCount: conference ? conference.core.participantDeviceCount : -1 property int lastConfLayoutBeforeSharing: -1 - property string localAddress: call - ? call.conference - ? call.conference.core.me.core.sipAddress - : call.core.localAddress - : "" + property string localAddress: call ? call.conference ? call.conference.core.me.core.sipAddress : + call.core.localAddress : "" onParticipantDeviceCountChanged: { - setConferenceLayout() + setConferenceLayout(); } Component.onCompleted: setConferenceLayout() onConferenceLayoutChanged: { - console.log("CallLayout change : " +conferenceLayout) - setConferenceLayout() + console.log("CallLayout change : " + conferenceLayout); + setConferenceLayout(); } Connections { - target: mainItem.conference? mainItem.conference.core : null + target: mainItem.conference ? mainItem.conference.core : null function onIsScreenSharingEnabledChanged() { - setConferenceLayout() + setConferenceLayout(); } function onIsLocalScreenSharingChanged() { if (mainItem.conference.core.isLocalScreenSharing) { - mainItem.lastConfLayoutBeforeSharing = mainItem.conferenceLayout + mainItem.lastConfLayoutBeforeSharing = mainItem.conferenceLayout; } - setConferenceLayout() + setConferenceLayout(); } } function setConferenceLayout() { - callLayout.sourceComponent = undefined // unload old view before opening the new view to avoid conflicts in Video UI. + callLayout.sourceComponent = undefined; // unload old view before opening the new view to avoid conflicts in Video UI. // If stop sharing screen, reset conference layout to the previous one - if (mainItem.conference && !mainItem.conference.core.isLocalScreenSharing && mainItem.lastConfLayoutBeforeSharing !== -1) { - mainItem.conferenceLayout = mainItem.lastConfLayoutBeforeSharing - mainItem.lastConfLayoutBeforeSharing = -1 + if (mainItem.conference && !mainItem.conference.core.isLocalScreenSharing && mainItem.lastConfLayoutBeforeSharing !== + -1) { + mainItem.conferenceLayout = mainItem.lastConfLayoutBeforeSharing; + mainItem.lastConfLayoutBeforeSharing = -1; } - callLayout.sourceComponent = conference - ? conference.core.isScreenSharingEnabled || (mainItem.conferenceLayout == LinphoneEnums.ConferenceLayout.ActiveSpeaker && participantDeviceCount > 1) - ? activeSpeakerComponent - : participantDeviceCount <= 1 - ? waitingForOthersComponent - : gridComponent - : activeSpeakerComponent + callLayout.sourceComponent = conference ? conference.core.isScreenSharingEnabled || (mainItem.conferenceLayout + == LinphoneEnums.ConferenceLayout.ActiveSpeaker && participantDeviceCount > 1) + ? activeSpeakerComponent : participantDeviceCount <= 1 ? waitingForOthersComponent : gridComponent : + activeSpeakerComponent; } Text { id: callTerminatedText anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top - anchors.topMargin: Utils.getSizeWithScreenRatio(25) + 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 - //: "Vous avez quitté la conférence" - ? qsTr("meeting_event_conference_destroyed") - : mainItem.callTerminatedByUser - //: "Vous avez terminé l'appel" - ? qsTr("call_ended_by_user") - : mainItem.callStarted - //: "Votre correspondant a terminé l'appel" - ? qsTr("call_ended_by_remote") - : call && call.core.lastErrorMessage || "" + visible: mainItem.callState === LinphoneEnums.CallState.End || mainItem.callState === LinphoneEnums.CallState.Error + || mainItem.callState === LinphoneEnums.CallState.Released + text: mainItem.conference ? + //: "Vous avez quitté la conférence" + qsTr("meeting_event_conference_destroyed") : mainItem.callTerminatedByUser ? + //: "Vous avez terminé l'appel" + qsTr("call_ended_by_user") : mainItem.callStarted ? + //: "Votre correspondant a terminé l'appel" + qsTr("call_ended_by_remote") : call && call.core.lastErrorMessage || "" color: DefaultStyle.grey_0 font { - pixelSize: Utils.getSizeWithScreenRatio(22) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(22) + weight: Utils.getSizeWithScreenRatio(300) } } - - Loader{ + + Loader { id: callLayout anchors.fill: parent - sourceComponent: mainItem.participantDeviceCount === 0 - ? waitingForOthersComponent - : activeSpeakerComponent + sourceComponent: mainItem.participantDeviceCount === 0 ? waitingForOthersComponent : activeSpeakerComponent } Sticker { id: preview qmlName: 'P' previewEnabled: true - visible: (callLayout.sourceComponent === activeSpeakerComponent || callLayout.sourceComponent === waitingForOthersComponent) - && mainItem.callState !== LinphoneEnums.CallState.OutgoingProgress - && mainItem.callState !== LinphoneEnums.CallState.OutgoingRinging - && mainItem.callState !== LinphoneEnums.CallState.OutgoingInit - && !mainItem.conference?.core.isScreenSharingEnabled - && mainItem.participantDeviceCount <= 2 - height: Utils.getSizeWithScreenRatio(180) - width: Utils.getSizeWithScreenRatio(300) + visible: (callLayout.sourceComponent === activeSpeakerComponent || callLayout.sourceComponent + === waitingForOthersComponent) && mainItem.callState !== LinphoneEnums.CallState.OutgoingProgress + && mainItem.callState !== LinphoneEnums.CallState.OutgoingRinging && mainItem.callState + !== LinphoneEnums.CallState.OutgoingInit && !mainItem.conference?.core.isScreenSharingEnabled + && mainItem.participantDeviceCount <= 2 + height: Utils.getSizeWithScreenRatio(180) + width: Utils.getSizeWithScreenRatio(300) anchors.right: mainItem.right anchors.bottom: mainItem.bottom - anchors.rightMargin: Utils.getSizeWithScreenRatio(20) - anchors.bottomMargin: Utils.getSizeWithScreenRatio(10) - onVideoEnabledChanged: console.log("Preview : " +videoEnabled + " / " +visible +" / " +mainItem.call) + anchors.rightMargin: Utils.getSizeWithScreenRatio(20) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(10) + onVideoEnabledChanged: console.log("Preview : " + videoEnabled + " / " + visible + " / " + mainItem.call) property var accountObj: UtilsCpp.findLocalAccountByAddress(mainItem.localAddress) - account: accountObj && accountObj.value || null + account: accountObj && accountObj.value || null call: mainItem.call displayAll: false displayPresence: false @@ -124,21 +115,21 @@ Item { id: previewMouseArea anchors.fill: parent movableArea: mainItem - margin: Utils.getSizeWithScreenRatio(10) - function resetPosition(){ - preview.anchors.right = mainItem.right - preview.anchors.bottom = mainItem.bottom - preview.anchors.rightMargin = previewMouseArea.margin - preview.anchors.bottomMargin = previewMouseArea.margin - } - onVisibleChanged: if(!visible){ - resetPosition() + margin: Utils.getSizeWithScreenRatio(10) + function resetPosition() { + preview.anchors.right = mainItem.right; + preview.anchors.bottom = mainItem.bottom; + preview.anchors.rightMargin = previewMouseArea.margin; + preview.anchors.bottomMargin = previewMouseArea.margin; } + onVisibleChanged: if (!visible) { + resetPosition(); + } drag.target: preview - onDraggingChanged: if(dragging) { - preview.anchors.right = undefined - preview.anchors.bottom = undefined - } + onDraggingChanged: if (dragging) { + preview.anchors.right = undefined; + preview.anchors.bottom = undefined; + } onRequestResetPosition: resetPosition() } } @@ -147,22 +138,22 @@ Item { id: waitingForOthersComponent Rectangle { color: DefaultStyle.grey_600 - radius: Utils.getSizeWithScreenRatio(15) + radius: Utils.getSizeWithScreenRatio(15) ColumnLayout { anchors.centerIn: parent - spacing: Utils.getSizeWithScreenRatio(22) + spacing: Utils.getSizeWithScreenRatio(22) width: waitText.implicitWidth Text { id: waitText - //: "En attente d'autres participants…" - text: qsTr("conference_call_empty") - Layout.preferredHeight: Utils.getSizeWithScreenRatio(67) + //: "En attente d'autres participants…" + text: qsTr("conference_call_empty") + Layout.preferredHeight: Utils.getSizeWithScreenRatio(67) Layout.alignment: Qt.AlignHCenter horizontalAlignment: Text.AlignHCenter color: DefaultStyle.grey_0 font { - pixelSize: Utils.getSizeWithScreenRatio(30) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(30) + weight: Utils.getSizeWithScreenRatio(300) } } Item { @@ -172,16 +163,16 @@ Item { borderColor: DefaultStyle.main2_400 icon.source: AppIcons.shareNetwork contentImageColor: DefaultStyle.main2_400 - //: "Partager le lien" - text: qsTr("conference_share_link_title") + //: "Partager le lien" + text: qsTr("conference_share_link_title") anchors.centerIn: parent textColor: DefaultStyle.main2_400 onClicked: { if (mainItem.conference) { - UtilsCpp.copyToClipboard(mainItem.conference.core.uri) - showInformationPopup(qsTr("copied"), - //: Le lien de la réunion a été copié dans le presse-papier - qsTr("information_popup_meeting_address_copied_to_clipboard"), true) + UtilsCpp.copyToClipboard(mainItem.conference.core.uri); + showInformationPopup(qsTr("copied"), + //: Le lien de la réunion a été copié dans le presse-papier + qsTr("information_popup_meeting_address_copied_to_clipboard"), true); } } } @@ -189,20 +180,19 @@ Item { } } } - - Component{ + + Component { id: activeSpeakerComponent - ActiveSpeakerLayout{ + ActiveSpeakerLayout { id: activeSpeaker Layout.fillWidth: true Layout.fillHeight: true call: mainItem.call - } } - Component{ + Component { id: gridComponent - CallGridLayout{ + CallGridLayout { Layout.fillWidth: true Layout.fillHeight: true call: mainItem.call diff --git a/Linphone/view/Control/Container/Call/Mosaic.qml b/Linphone/view/Control/Container/Call/Mosaic.qml index 836ef7ab1..026f570e0 100644 --- a/Linphone/view/Control/Container/Call/Mosaic.qml +++ b/Linphone/view/Control/Container/Call/Mosaic.qml @@ -11,109 +11,110 @@ ColumnLayout { property alias cellHeight: grid.cellHeight property alias cellWidth: grid.cellWidth property alias margins: grid.margin - - function appendItem(item){ - mainLayout.delegateModel.model.append(item) + + function appendItem(item) { + mainLayout.delegateModel.model.append(item); } - - function add(item){ - if( !grid.isLayoutWillChanged()) - appendItem(item) + + function add(item) { + if (!grid.isLayoutWillChanged()) + appendItem(item); else - bufferModels.append(item) + bufferModels.append(item); } - - function remove(index){ - if(mainLayout.delegateModel.model.count > index) - mainLayout.delegateModel.model.remove( index, 1) + + function remove(index) { + if (mainLayout.delegateModel.model.count > index) + mainLayout.delegateModel.model.remove(index, 1); } - - function get(index){ - return mainLayout.delegateModel.model.get(index) + + function get(index) { + return mainLayout.delegateModel.model.get(index); } - - function tryToAdd(item){ - if( !grid.isLayoutWillChanged()) { - appendItem(item) - return true - }else - return false + + function tryToAdd(item) { + if (!grid.isLayoutWillChanged()) { + appendItem(item); + return true; + } else + return false; } - - function clear(){ - if(mainLayout.delegateModel.model.clear) { - mainLayout.delegateModel.model.clear() - bufferModels.clear() + + function clear() { + if (mainLayout.delegateModel.model.clear) { + mainLayout.delegateModel.model.clear(); + bufferModels.clear(); } } - - - property int transitionCount : 0 - property var bufferModels : ListModel{} - + + property int transitionCount: 0 + property var bufferModels: ListModel {} + onWidthChanged: grid.updateLayout() onHeightChanged: grid.updateLayout() spacing: 0 - - GridView{ + + GridView { id: grid - property real margin: Utils.getSizeWithScreenRatio(10) - property int itemCount: model.count ? model.count :( model.length ? model.length : 0) + 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 - - function getBestLayout(itemCount){ - var availableW = mainLayout.width - grid.margin - var availableH = mainLayout.height - grid.margin - var bestSize = 0 - var bestC = 1, bestR = 1 - for(var R = 1 ; R <= itemCount ; ++R){ - for(var C = itemCount ; C >= 1 ; --C){ - if( R * C >= itemCount){// This is a good layout candidate - var estimatedSize = Math.min(availableW / C, availableH / R) - if(estimatedSize > bestSize // Size is better - || (estimatedSize == bestSize && Math.abs(bestR-bestC) > Math.abs(R - C) )){// Stickers are more homogenized - bestSize = estimatedSize - bestC = C - bestR = R + + function getBestLayout(itemCount) { + var availableW = mainLayout.width - grid.margin; + var availableH = mainLayout.height - grid.margin; + var bestSize = 0; + var bestC = 1, bestR = 1; + for (var R = 1; R <= itemCount; ++R) { + for (var C = itemCount; C >= 1; --C) { + if (R * C >= itemCount) { + // This is a good layout candidate + var estimatedSize = Math.min(availableW / C, availableH / R); + if (estimatedSize > bestSize // Size is better + || (estimatedSize == bestSize && Math.abs(bestR - bestC) > Math.abs(R - C))) { + // Stickers are more homogenized + bestSize = estimatedSize; + bestC = C; + bestR = R; } } } } - return [bestR, bestC] + return [bestR, bestC]; } - - function updateLayout(){ - var bestLayout = getBestLayout(itemCount) - if( rows != bestLayout[0]) - rows = bestLayout[0] - if( columns != bestLayout[1]) - columns = bestLayout[1] + + function updateLayout() { + var bestLayout = getBestLayout(itemCount); + if (rows != bestLayout[0]) + rows = bestLayout[0]; + if (columns != bestLayout[1]) + columns = bestLayout[1]; } - function updateCells(){ - cellWidth = Math.min(computedWidth, computedHeight) - cellHeight = Math.min(computedWidth, computedHeight) + function updateCells() { + cellWidth = Math.min(computedWidth, computedHeight); + cellHeight = Math.min(computedWidth, computedHeight); } onItemCountChanged: updateLayout() - property real computedWidth: (mainLayout.width - grid.margin ) / columns - property real computedHeight: (mainLayout.height - grid.margin ) / rows + property real computedWidth: (mainLayout.width - grid.margin) / columns + property real computedHeight: (mainLayout.height - grid.margin) / rows onComputedHeightChanged: Qt.callLater(updateCells) onComputedWidthChanged: Qt.callLater(updateCells) cellWidth: Math.min(computedWidth, computedHeight) cellHeight: Math.min(computedWidth, computedHeight) - - function isLayoutWillChanged(){ - var bestLayout = getBestLayout(itemCount+1) - return rows !== bestLayout[0] || columns !== bestLayout[1] + + function isLayoutWillChanged() { + var bestLayout = getBestLayout(itemCount + 1); + return rows !== bestLayout[0] || columns !== bestLayout[1]; } - + Layout.preferredWidth: cellWidth * columns Layout.preferredHeight: cellHeight * rows Layout.alignment: Qt.AlignCenter - + interactive: false - model: DelegateModel{} - + model: DelegateModel {} + onCountChanged: grid.updateLayout() } } diff --git a/Linphone/view/Control/Container/Carousel.qml b/Linphone/view/Control/Container/Carousel.qml index 17d997ccb..bddcc54ae 100644 --- a/Linphone/view/Control/Container/Carousel.qml +++ b/Linphone/view/Control/Container/Carousel.qml @@ -13,10 +13,10 @@ ColumnLayout { required property int itemsCount property int currentIndex: carouselStackLayout.currentIndex property var currentItem: carouselButton.itemAt(currentIndex) - spacing: Utils.getSizeWithScreenRatio(61) + spacing: Utils.getSizeWithScreenRatio(61) function goToSlide(index) { - carouselStackLayout.goToSlideAtIndex(index) + carouselStackLayout.goToSlideAtIndex(index); } StackLayout { @@ -26,15 +26,18 @@ ColumnLayout { currentIndex: 0 function goToSlideAtIndex(index) { - carouselStackLayout.previousIndex = carouselStackLayout.currentIndex - carouselStackLayout.currentIndex = index + carouselStackLayout.previousIndex = carouselStackLayout.currentIndex; + carouselStackLayout.currentIndex = index; } onCurrentIndexChanged: { - var currentItem = children[currentIndex] - var crossFaderAnim = crossFader.createObject(parent, {fadeInTarget: currentItem, mirrored: (previousIndex > currentIndex)}) - crossFaderAnim.restart() - mainItem.currentIndex = currentIndex + var currentItem = children[currentIndex]; + var crossFaderAnim = crossFader.createObject(parent, { + fadeInTarget: currentItem, + mirrored: (previousIndex > currentIndex) + }); + crossFaderAnim.restart(); + mainItem.currentIndex = currentIndex; } Component { @@ -56,7 +59,7 @@ ColumnLayout { XAnimator { target: fadeInTarget - from: (mirrored ? -1 : 1) * fadeInTarget.width/3. + from: (mirrored ? -1 : 1) * fadeInTarget.width / 3. to: 0 duration: 300 easing.type: Easing.OutCubic @@ -68,40 +71,46 @@ ColumnLayout { Item { Rectangle { id: currentIndicator - width: Utils.getSizeWithScreenRatio(13) - height: Utils.getSizeWithScreenRatio(8) - radius: Utils.getSizeWithScreenRatio(30) + 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 - Behavior on x { NumberAnimation {duration: 100}} + x: mainItem.currentIndex >= 0 && mainItem.currentItem ? mainItem.currentItem.x - width / 2 + + mainItem.currentItem.width / 2 : 0 + Behavior on x { + NumberAnimation { + duration: 100 + } + } } RowLayout { id: carouselButtonsLayout - spacing: Utils.getSizeWithScreenRatio(7.5) - anchors.leftMargin: Utils.getSizeWithScreenRatio(2.5) + spacing: Utils.getSizeWithScreenRatio(7.5) + anchors.leftMargin: Utils.getSizeWithScreenRatio(2.5) Repeater { id: carouselButton model: mainItem.itemsCount delegate: Button { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(8) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(8) + 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: Utils.getSizeWithScreenRatio(30) + radius: Utils.getSizeWithScreenRatio(30) anchors.fill: parent } onClicked: { - mainItem.goToSlide(modelData) + mainItem.goToSlide(modelData); } } } - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } } } } - diff --git a/Linphone/view/Control/Container/Chat/ChatFilesGridLayout.qml b/Linphone/view/Control/Container/Chat/ChatFilesGridLayout.qml index cb518d590..ee1b7d970 100644 --- a/Linphone/view/Control/Container/Chat/ChatFilesGridLayout.qml +++ b/Linphone/view/Control/Container/Chat/ChatFilesGridLayout.qml @@ -14,11 +14,10 @@ GridLayout { property bool isHoveringFile: false property int itemCount: delModel.count property int itemWidth: Utils.getSizeWithScreenRatio(95) - // cellWidth: + // cellWidth: // cellHeight: Utils.getSizeWithScreenRatio(105) property real maxWidth: Utils.getSizeWithScreenRatio(3 * 105) columns: optimalColumns - property int optimalColumns: { let maxCols = Math.floor(maxWidth / itemWidth); @@ -30,10 +29,7 @@ GridLayout { let rows = Math.ceil(itemCount / cols); let emptySlots = cols * rows - itemCount; - if ( - rows < minRows || - (rows === minRows && emptySlots < minEmptySlots) - ) { + if (rows < minRows || (rows === minRows && emptySlots < minEmptySlots)) { bestCols = cols; minRows = rows; minEmptySlots = emptySlots; @@ -55,4 +51,4 @@ GridLayout { // onIsHoveringChanged: mainItem.isHoveringFile = isHovering } } -} \ No newline at end of file +} diff --git a/Linphone/view/Control/Container/Contact/ContactLayout.qml b/Linphone/view/Control/Container/Contact/ContactLayout.qml index 495121243..ec1e06f5e 100644 --- a/Linphone/view/Control/Container/Contact/ContactLayout.qml +++ b/Linphone/view/Control/Container/Contact/ContactLayout.qml @@ -5,12 +5,12 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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: Utils.getSizeWithScreenRatio(30) + spacing: Utils.getSizeWithScreenRatio(30) property FriendGui contact @@ -18,18 +18,18 @@ ColumnLayout { property alias content: detailLayout.data property alias bannerContent: bannerLayout.data property alias secondLineContent: verticalLayoutSecondLine.data - property real minimumWidthForSwitchintToRowLayout: Utils.getSizeWithScreenRatio(756) - property var useVerticalLayout: width < minimumWidthForSwitchintToRowLayout + property real minimumWidthForSwitchintToRowLayout: Utils.getSizeWithScreenRatio(756) + property var useVerticalLayout: width < minimumWidthForSwitchintToRowLayout GridLayout { - Layout.leftMargin: Utils.getSizeWithScreenRatio(64) - Layout.rightMargin: Utils.getSizeWithScreenRatio(64) - Layout.topMargin: Utils.getSizeWithScreenRatio(56) + 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: Utils.getSizeWithScreenRatio(49) - rowSpacing: Utils.getSizeWithScreenRatio(27) + columnSpacing: Utils.getSizeWithScreenRatio(49) + rowSpacing: Utils.getSizeWithScreenRatio(27) ColumnLayout { spacing: Utils.getSizeWithScreenRatio(16) @@ -48,13 +48,25 @@ ColumnLayout { radius: Utils.getSizeWithScreenRatio(15) borderGradient: Gradient { orientation: Gradient.Horizontal - GradientStop { position: 0.0; color: DefaultStyle.grey_100 } - GradientStop { position: 1.0; color: DefaultStyle.main2_200 } + GradientStop { + position: 0.0 + color: DefaultStyle.grey_100 + } + GradientStop { + position: 1.0 + color: DefaultStyle.main2_200 + } } gradient: Gradient { orientation: Gradient.Horizontal - GradientStop { position: 0.0; color: DefaultStyle.grey_0 } - GradientStop { position: 1.0; color: DefaultStyle.grey_100 } + GradientStop { + position: 0.0 + color: DefaultStyle.grey_0 + } + GradientStop { + position: 1.0 + color: DefaultStyle.grey_100 + } } } contentItem: RowLayout { @@ -90,7 +102,7 @@ ColumnLayout { } } Rectangle { - Layout.fillWidth:true + Layout.fillWidth: true Layout.preferredHeight: Utils.getSizeWithScreenRatio(79) color: 'transparent' visible: contact && contact.core.presenceNote.length > 0 && !mainItem.useVerticalLayout @@ -104,10 +116,10 @@ ColumnLayout { StackLayout { id: detailLayout Layout.alignment: Qt.AlignCenter - Layout.topMargin: mainItem.useVerticalLayout ? 0 : Utils.getSizeWithScreenRatio(30) - Layout.leftMargin: Utils.getSizeWithScreenRatio(64) - Layout.rightMargin: Utils.getSizeWithScreenRatio(64) - Layout.bottomMargin: Utils.getSizeWithScreenRatio(53) + 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 5d05f105f..9037d70c6 100644 --- a/Linphone/view/Control/Container/Contact/PresenceNoteLayout.qml +++ b/Linphone/view/Control/Container/Contact/PresenceNoteLayout.qml @@ -5,49 +5,49 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 FriendGui friendGui - color: DefaultStyle.grey_0 - radius: Utils.getSizeWithScreenRatio(20) - border.color: DefaultStyle.main2_200 - border.width: Utils.getSizeWithScreenRatio(2) + id: mainItem + property FriendGui friendGui + color: DefaultStyle.grey_0 + radius: Utils.getSizeWithScreenRatio(20) + border.color: DefaultStyle.main2_200 + border.width: Utils.getSizeWithScreenRatio(2) - ColumnLayout { - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: Utils.getSizeWithScreenRatio(16) - anchors.rightMargin: Utils.getSizeWithScreenRatio(16) - spacing: Utils.getSizeWithScreenRatio(8) + ColumnLayout { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: Utils.getSizeWithScreenRatio(16) + anchors.rightMargin: Utils.getSizeWithScreenRatio(16) + spacing: Utils.getSizeWithScreenRatio(8) - RowLayout { - spacing: Utils.getSizeWithScreenRatio(6) + RowLayout { + spacing: Utils.getSizeWithScreenRatio(6) - EffectImage { - fillMode: Image.PreserveAspectFit - imageSource: AppIcons.presenceNote - colorizationColor: DefaultStyle.main2_600 - Layout.preferredHeight: Utils.getSizeWithScreenRatio(17) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(17) - } + EffectImage { + fillMode: Image.PreserveAspectFit + imageSource: AppIcons.presenceNote + colorizationColor: DefaultStyle.main2_600 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(17) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(17) + } - Text { - font: Typography.p2 - color: DefaultStyle.main2_600 - text: qsTr("contact_presence_note_title") - } - } + Text { + font: Typography.p2 + color: DefaultStyle.main2_600 + text: qsTr("contact_presence_note_title") + } + } - Text { - font: Typography.p3 - color: DefaultStyle.main2_500_main - text: mainItem.friendGui?.core.presenceNote || "" - wrapMode: Text.Wrap - Layout.fillWidth: true - } - } + Text { + font: Typography.p3 + color: DefaultStyle.main2_500_main + text: mainItem.friendGui?.core.presenceNote || "" + wrapMode: Text.Wrap + Layout.fillWidth: true + } + } } diff --git a/Linphone/view/Control/Container/CreationFormLayout.qml b/Linphone/view/Control/Container/CreationFormLayout.qml index d93454cf7..a53991f9c 100644 --- a/Linphone/view/Control/Container/CreationFormLayout.qml +++ b/Linphone/view/Control/Container/CreationFormLayout.qml @@ -6,120 +6,127 @@ import QtQuick.Effects import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils FocusScope { id: mainItem property color searchBarColor: DefaultStyle.grey_100 property color searchBarBorderColor: "transparent" property alias searchBar: searchBar - property string startGroupButtonText - property bool startGroupButtonVisible: true + property string startGroupButtonText + property bool startGroupButtonVisible: true property NumericPadPopup numPadPopup - signal groupCreationRequested() + signal groupCreationRequested signal contactClicked(FriendGui contact) clip: true - property alias topContent: topLayout.data - property bool topLayoutVisible: topLayout.children.length > 0 - property int searchBarRightMaring: Utils.getSizeWithScreenRatio(39) + property alias topContent: topLayout.data + property bool topLayoutVisible: topLayout.children.length > 0 + property int searchBarRightMaring: Utils.getSizeWithScreenRatio(39) ColumnLayout { anchors.fill: parent - spacing: Utils.getSizeWithScreenRatio(22) + spacing: Utils.getSizeWithScreenRatio(22) ColumnLayout { - id: topLayout - visible: mainItem.topLayoutVisible - spacing: Utils.getSizeWithScreenRatio(18) + id: topLayout + visible: mainItem.topLayoutVisible + spacing: Utils.getSizeWithScreenRatio(18) } - ColumnLayout { - onVisibleChanged: if (!visible && mainItem.numPadPopup) mainItem.numPadPopup.close() - spacing: Utils.getSizeWithScreenRatio(38) - SearchBar { - id: searchBar - Layout.alignment: Qt.AlignTop - Layout.fillWidth: true - Layout.rightMargin: mainItem.searchBarRightMaring - focus: true - color: mainItem.searchBarColor - borderColor: mainItem.searchBarBorderColor - //: "Rechercher un contact" - placeholderText: qsTr("search_bar_look_for_contact_text") - numericPadPopup: mainItem.numPadPopup - KeyNavigation.down: groupCreationButton - } - ColumnLayout { - id: content - spacing: Utils.getSizeWithScreenRatio(32) - Button { - id: groupCreationButton - visible: mainItem.startGroupButtonVisible - Layout.preferredWidth: Utils.getSizeWithScreenRatio(320) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(44) - padding: 0 - KeyNavigation.up: searchBar - KeyNavigation.down: contactList - onClicked: mainItem.groupCreationRequested() - background: Rectangle { - anchors.fill: parent - radius: height / 2 - gradient: Gradient { - orientation: Gradient.Horizontal - GradientStop { position: 0.0; color: DefaultStyle.main2_100} - GradientStop { position: 1.0; color: DefaultStyle.grey_0} - } - // Black border for keyboard navigation - border.color: DefaultStyle.main2_900 - border.width: groupCreationButton.keyboardFocus ? Utils.getSizeWithScreenRatio(3) : 0 - } - Accessible.name: mainItem.startGroupButtonText - contentItem: RowLayout { - spacing: Utils.getSizeWithScreenRatio(16) - anchors.verticalCenter: parent.verticalCenter - Rectangle { - width: Utils.getSizeWithScreenRatio(44) - height: width - radius: width / 2 - color: DefaultStyle.main1_500_main - EffectImage { - imageSource: AppIcons.usersThreeFilled - anchors.centerIn: parent - width: Utils.getSizeWithScreenRatio(24) - height: width - fillMode: Image.PreserveAspectFit - colorizationColor: DefaultStyle.grey_0 - } - } - Text { - text: mainItem.startGroupButtonText - color: DefaultStyle.grey_1000 - font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight - } - } - Item { - Layout.fillWidth: true - } - EffectImage { - imageSource: AppIcons.rightArrow - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - colorizationColor: DefaultStyle.main2_500_main - } - } - } - AllContactListView{ - id: contactList - Layout.fillWidth: true - Layout.fillHeight: true - showContactMenu: false - searchBarText: searchBar.text - onContactSelected: (contact) => { - mainItem.contactClicked(contact) - } - } - } - } - } + ColumnLayout { + onVisibleChanged: if (!visible && mainItem.numPadPopup) + mainItem.numPadPopup.close() + spacing: Utils.getSizeWithScreenRatio(38) + SearchBar { + id: searchBar + Layout.alignment: Qt.AlignTop + Layout.fillWidth: true + Layout.rightMargin: mainItem.searchBarRightMaring + focus: true + color: mainItem.searchBarColor + borderColor: mainItem.searchBarBorderColor + //: "Rechercher un contact" + placeholderText: qsTr("search_bar_look_for_contact_text") + numericPadPopup: mainItem.numPadPopup + KeyNavigation.down: groupCreationButton + } + ColumnLayout { + id: content + spacing: Utils.getSizeWithScreenRatio(32) + Button { + id: groupCreationButton + visible: mainItem.startGroupButtonVisible + Layout.preferredWidth: Utils.getSizeWithScreenRatio(320) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(44) + padding: 0 + KeyNavigation.up: searchBar + KeyNavigation.down: contactList + onClicked: mainItem.groupCreationRequested() + background: Rectangle { + anchors.fill: parent + radius: height / 2 + gradient: Gradient { + orientation: Gradient.Horizontal + GradientStop { + position: 0.0 + color: DefaultStyle.main2_100 + } + GradientStop { + position: 1.0 + color: DefaultStyle.grey_0 + } + } + // Black border for keyboard navigation + border.color: DefaultStyle.main2_900 + border.width: groupCreationButton.keyboardFocus ? Utils.getSizeWithScreenRatio(3) : 0 + } + Accessible.name: mainItem.startGroupButtonText + contentItem: RowLayout { + spacing: Utils.getSizeWithScreenRatio(16) + anchors.verticalCenter: parent.verticalCenter + Rectangle { + width: Utils.getSizeWithScreenRatio(44) + height: width + radius: width / 2 + color: DefaultStyle.main1_500_main + EffectImage { + imageSource: AppIcons.usersThreeFilled + anchors.centerIn: parent + width: Utils.getSizeWithScreenRatio(24) + height: width + fillMode: Image.PreserveAspectFit + colorizationColor: DefaultStyle.grey_0 + } + } + Text { + text: mainItem.startGroupButtonText + color: DefaultStyle.grey_1000 + font { + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight + } + } + Item { + Layout.fillWidth: true + } + EffectImage { + imageSource: AppIcons.rightArrow + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + colorizationColor: DefaultStyle.main2_500_main + } + } + } + AllContactListView { + id: contactList + Layout.fillWidth: true + Layout.fillHeight: true + showContactMenu: false + searchBarText: searchBar.text + onContactSelected: contact => { + mainItem.contactClicked(contact); + } + } + } + } + } } diff --git a/Linphone/view/Control/Container/DetailLayout.qml b/Linphone/view/Control/Container/DetailLayout.qml index 69ced935e..2cad4fcb1 100644 --- a/Linphone/view/Control/Container/DetailLayout.qml +++ b/Linphone/view/Control/Container/DetailLayout.qml @@ -5,51 +5,51 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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: Utils.getSizeWithScreenRatio(15) - property string label - property var icon - property alias content: contentControl.contentItem - signal titleIconClicked - RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) - Text { - text: mainItem.label - color: DefaultStyle.main1_500_main - font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight - } - } - RoundButton { - visible: mainItem.icon != undefined - icon.source: mainItem.icon - style: ButtonStyle.noBackgroundOrange - onClicked: mainItem.titleIconClicked() - } - Item { - Layout.fillWidth: true - } - RoundButton { - id: expandButton - style: ButtonStyle.noBackground - checkable: true - checked: true - icon.source: checked ? AppIcons.upArrow : AppIcons.downArrow - KeyNavigation.down: contentControl - } - } - RoundedPane { - id: contentControl - visible: expandButton.checked - Layout.fillWidth: true - leftPadding: Utils.getSizeWithScreenRatio(20) - rightPadding: Utils.getSizeWithScreenRatio(20) - topPadding: Utils.getSizeWithScreenRatio(17) - bottomPadding: Utils.getSizeWithScreenRatio(17) - } -} \ No newline at end of file + id: mainItem + spacing: Utils.getSizeWithScreenRatio(15) + property string label + property var icon + property alias content: contentControl.contentItem + signal titleIconClicked + RowLayout { + spacing: Utils.getSizeWithScreenRatio(10) + Text { + text: mainItem.label + color: DefaultStyle.main1_500_main + font { + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight + } + } + RoundButton { + visible: mainItem.icon != undefined + icon.source: mainItem.icon + style: ButtonStyle.noBackgroundOrange + onClicked: mainItem.titleIconClicked() + } + Item { + Layout.fillWidth: true + } + RoundButton { + id: expandButton + style: ButtonStyle.noBackground + checkable: true + checked: true + icon.source: checked ? AppIcons.upArrow : AppIcons.downArrow + KeyNavigation.down: contentControl + } + } + RoundedPane { + id: contentControl + visible: expandButton.checked + Layout.fillWidth: true + leftPadding: Utils.getSizeWithScreenRatio(20) + rightPadding: Utils.getSizeWithScreenRatio(20) + topPadding: Utils.getSizeWithScreenRatio(17) + bottomPadding: Utils.getSizeWithScreenRatio(17) + } +} diff --git a/Linphone/view/Control/Container/FormItemLayout.qml b/Linphone/view/Control/Container/FormItemLayout.qml index 6997d3c53..8d1ed806b 100644 --- a/Linphone/view/Control/Container/FormItemLayout.qml +++ b/Linphone/view/Control/Container/FormItemLayout.qml @@ -5,7 +5,7 @@ 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{ +FocusScope { id: mainItem property alias contentItem: contentItem.data property string label: "" @@ -21,33 +21,32 @@ FocusScope{ implicitHeight: layout.implicitHeight function clearErrorText() { - errorText.clear() + errorText.clear(); } onErrorMessageChanged: if (errorMessage.length > 0) { - var item = mainItem - do { - var parentItem = item.parent - if (parentItem.contentItem) { - var itemPosInParent = mainItem.mapToItem(parentItem.contentItem, mainItem.x, mainItem.y) - if (parentItem.contentY > itemPosInParent.y) { - parentItem.contentY = itemPosInParent.y; - } - else if (parentItem.contentY+parentItem.height < itemPosInParent.y+mainItem.height) { - parentItem.contentY = itemPosInParent.y + mainItem.height - height; - } - } - item = parentItem - } while(item.parent != undefined && parentItem.contentItem === undefined) - } + var item = mainItem; + do { + var parentItem = item.parent; + if (parentItem.contentItem) { + var itemPosInParent = mainItem.mapToItem(parentItem.contentItem, mainItem.x, mainItem.y); + if (parentItem.contentY > itemPosInParent.y) { + parentItem.contentY = itemPosInParent.y; + } else if (parentItem.contentY + parentItem.height < itemPosInParent.y + mainItem.height) { + parentItem.contentY = itemPosInParent.y + mainItem.height - height; + } + } + item = parentItem; + } while (item.parent != undefined && parentItem.contentItem === undefined) + } ColumnLayout { id: layout - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) anchors.left: parent.left anchors.right: parent.right RowLayout { - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) Text { visible: label.length > 0 verticalAlignment: Text.AlignVCenter @@ -57,13 +56,15 @@ FocusScope{ wrapMode: Text.Wrap maximumLineCount: 1 textFormat: Text.RichText - + font { pixelSize: Typography.p2.pixelSize weight: Typography.p2.weight } } - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } PopupButton { visible: mainItem.tooltip !== "" Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) @@ -78,11 +79,11 @@ FocusScope{ Text { visible: mainItem.labelIndication !== undefined font.pixelSize: Utils.getSizeWithScreenRatio(12) - font.weight: Utils.getSizeWithScreenRatio(300) - text: mainItem.labelIndication + font.weight: Utils.getSizeWithScreenRatio(300) + text: mainItem.labelIndication } } - + Item { Layout.preferredHeight: childrenRect.height Layout.fillWidth: true @@ -99,6 +100,5 @@ FocusScope{ color: DefaultStyle.danger_500_main } } - } } diff --git a/Linphone/view/Control/Container/GroupCreationFormLayout.qml b/Linphone/view/Control/Container/GroupCreationFormLayout.qml index 930549284..882db980d 100644 --- a/Linphone/view/Control/Container/GroupCreationFormLayout.qml +++ b/Linphone/view/Control/Container/GroupCreationFormLayout.qml @@ -6,94 +6,93 @@ import QtQuick.Effects import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle FocusScope { - id: mainItem - property alias addParticipantsLayout: addParticipantsLayout - property alias groupNameItem: groupNameItem - property alias groupName: groupName - property string formTitle - property string createGroupButtonText - property int selectedParticipantsCount - signal returnRequested() - signal groupCreationRequested() - - ColumnLayout { - spacing: 0 - anchors.fill: parent - RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) - Button { - id: backGroupCallButton - style: ButtonStyle.noBackgroundOrange - icon.source: AppIcons.leftArrow - Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) - KeyNavigation.down: groupName - KeyNavigation.right: groupCallButton - KeyNavigation.left: groupCallButton - //: Return - Accessible.name: qsTr("return_accessible_name") - onClicked: { - mainItem.returnRequested() - } - } - Text { - text: mainItem.formTitle - color: DefaultStyle.main1_500_main - maximumLineCount: 1 - font { - pixelSize: Utils.getSizeWithScreenRatio(18) - weight: Typography.h4.weight - } - Layout.fillWidth: true - } - SmallButton { - id: groupCallButton - enabled: mainItem.selectedParticipantsCount.length != 0 - Layout.rightMargin: Utils.getSizeWithScreenRatio(21) - text: mainItem.createGroupButtonText - style: ButtonStyle.main - KeyNavigation.down: addParticipantsLayout - KeyNavigation.left: backGroupCallButton - KeyNavigation.right: backGroupCallButton - onClicked: { - mainItem.groupCreationRequested() - } - } - } - FormItemLayout { - id: groupNameItem - enableErrorText: true - Layout.fillWidth: true - Layout.topMargin: Utils.getSizeWithScreenRatio(18) - Layout.rightMargin: Utils.getSizeWithScreenRatio(38) - //: "Nom du groupe" - label: qsTr("group_start_dialog_subject_hint") - //: "Requis" - labelIndication: qsTr("required") - contentItem: TextField { - id: groupName - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) - focus: true - isError: groupNameItem.errorMessage !== "" - KeyNavigation.down: addParticipantsLayout //participantList.count > 0 ? participantList : searchbar - Accessible.name: qsTr("group_start_dialog_subject_hint") - } - } - AddParticipantsForm { - id: addParticipantsLayout - Layout.fillWidth: true - Layout.fillHeight: true - Layout.topMargin: Utils.getSizeWithScreenRatio(15) - onSelectedParticipantsCountChanged: mainItem.selectedParticipantsCount = selectedParticipantsCount - focus: true - - } - } + id: mainItem + property alias addParticipantsLayout: addParticipantsLayout + property alias groupNameItem: groupNameItem + property alias groupName: groupName + property string formTitle + property string createGroupButtonText + property int selectedParticipantsCount + signal returnRequested + signal groupCreationRequested + + ColumnLayout { + spacing: 0 + anchors.fill: parent + RowLayout { + spacing: Utils.getSizeWithScreenRatio(10) + Button { + id: backGroupCallButton + style: ButtonStyle.noBackgroundOrange + icon.source: AppIcons.leftArrow + Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) + KeyNavigation.down: groupName + KeyNavigation.right: groupCallButton + KeyNavigation.left: groupCallButton + //: Return + Accessible.name: qsTr("return_accessible_name") + onClicked: { + mainItem.returnRequested(); + } + } + Text { + text: mainItem.formTitle + color: DefaultStyle.main1_500_main + maximumLineCount: 1 + font { + pixelSize: Utils.getSizeWithScreenRatio(18) + weight: Typography.h4.weight + } + Layout.fillWidth: true + } + SmallButton { + id: groupCallButton + enabled: mainItem.selectedParticipantsCount.length != 0 + Layout.rightMargin: Utils.getSizeWithScreenRatio(21) + text: mainItem.createGroupButtonText + style: ButtonStyle.main + KeyNavigation.down: addParticipantsLayout + KeyNavigation.left: backGroupCallButton + KeyNavigation.right: backGroupCallButton + onClicked: { + mainItem.groupCreationRequested(); + } + } + } + FormItemLayout { + id: groupNameItem + enableErrorText: true + Layout.fillWidth: true + Layout.topMargin: Utils.getSizeWithScreenRatio(18) + Layout.rightMargin: Utils.getSizeWithScreenRatio(38) + //: "Nom du groupe" + label: qsTr("group_start_dialog_subject_hint") + //: "Requis" + labelIndication: qsTr("required") + contentItem: TextField { + id: groupName + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + focus: true + isError: groupNameItem.errorMessage !== "" + KeyNavigation.down: addParticipantsLayout //participantList.count > 0 ? participantList : searchbar + Accessible.name: qsTr("group_start_dialog_subject_hint") + } + } + AddParticipantsForm { + id: addParticipantsLayout + Layout.fillWidth: true + Layout.fillHeight: true + Layout.topMargin: Utils.getSizeWithScreenRatio(15) + onSelectedParticipantsCountChanged: mainItem.selectedParticipantsCount = selectedParticipantsCount + focus: true + } + } } diff --git a/Linphone/view/Control/Container/Main/MainRightPanel.qml b/Linphone/view/Control/Container/Main/MainRightPanel.qml index 7f63c27aa..8aff672fb 100644 --- a/Linphone/view/Control/Container/Main/MainRightPanel.qml +++ b/Linphone/view/Control/Container/Main/MainRightPanel.qml @@ -46,11 +46,11 @@ ColumnLayout { color: mainItem.panelColor Layout.fillWidth: true Layout.fillHeight: true - MouseArea { - anchors.fill: parent - onClicked: { - rightPanelContent.forceActiveFocus() - } - } + MouseArea { + anchors.fill: parent + onClicked: { + rightPanelContent.forceActiveFocus(); + } + } } } diff --git a/Linphone/view/Control/Container/ScrollBar.qml b/Linphone/view/Control/Container/ScrollBar.qml index 50dde610b..d298940df 100644 --- a/Linphone/view/Control/Container/ScrollBar.qml +++ b/Linphone/view/Control/Container/ScrollBar.qml @@ -8,10 +8,10 @@ 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 + property color color: DefaultStyle.grey_850 contentItem: Rectangle { - implicitWidth: Utils.getSizeWithScreenRatio(6) - radius: Utils.getSizeWithScreenRatio(32) - color: mainItem.color + 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 55763f98d..fc399f8f5 100644 --- a/Linphone/view/Control/Container/Section.qml +++ b/Linphone/view/Control/Container/Section.qml @@ -9,22 +9,22 @@ Layout with line separator used in several views */ ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(15) + spacing: Utils.getSizeWithScreenRatio(15) property alias content: contentLayout.data property alias contentLayout: contentLayout ColumnLayout { id: contentLayout - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) // width: parent.width // Layout.fillWidth: true // Layout.preferredHeight: childrenRect.height // Layout.preferredWidth: parent.width - // Layout.leftMargin: Utils.getSizeWithScreenRatio(8) + // Layout.leftMargin: Utils.getSizeWithScreenRatio(8) } Rectangle { color: DefaultStyle.main2_200 - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) width: parent.width } } diff --git a/Linphone/view/Control/Container/TabBar.qml b/Linphone/view/Control/Container/TabBar.qml index 99a7acb7a..805eeabbb 100644 --- a/Linphone/view/Control/Container/TabBar.qml +++ b/Linphone/view/Control/Container/TabBar.qml @@ -4,16 +4,14 @@ 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 - +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils + Control.TabBar { id: mainItem property var model - readonly property int originX: count > 0 - ? itemAt(0).x - : 0 - property real pixelSize: Typography.h3.pixelSize - property real textWeight: Typography.h3.weight + readonly property int originX: count > 0 ? itemAt(0).x : 0 + property real pixelSize: Typography.h3.pixelSize + property real textWeight: Typography.h3.weight property int capitalization: Font.Capitalize wheelEnabled: true background: Item { @@ -22,7 +20,7 @@ Control.TabBar { Rectangle { id: barBG - height: Utils.getSizeWithScreenRatio(4) + height: Utils.getSizeWithScreenRatio(4) color: DefaultStyle.grey_200 anchors.bottom: parent.bottom width: parent.width @@ -34,7 +32,7 @@ Control.TabBar { // anchors.bottom: parent.bottom // // anchors.left: mainItem.currentItem.left // // anchors.right: mainItem.currentItem.right - // x: mainItem.currentItem + // x: mainItem.currentItem // ? mainItem.currentItem.x - mainItem.originX // : 0 // width: mainItem.currentItem ? mainItem.currentItem.width : 0 @@ -61,9 +59,9 @@ Control.TabBar { delay: 1000 text: modelData } - MouseArea{ + MouseArea { anchors.fill: parent - cursorShape: tabButton.hovered ? Qt.PointingHandCursor: Qt.ArrowCursor + cursorShape: tabButton.hovered ? Qt.PointingHandCursor : Qt.ArrowCursor acceptedButtons: Qt.NoButton } @@ -72,7 +70,7 @@ Control.TabBar { Rectangle { id: tabBackground visible: mainItem.currentIndex === index || tabButton.hovered - height: Utils.getSizeWithScreenRatio(5) + height: Utils.getSizeWithScreenRatio(5) color: mainItem.currentIndex === index ? DefaultStyle.main1_500_main : DefaultStyle.main2_400 anchors.bottom: parent.bottom anchors.left: parent.left @@ -89,7 +87,7 @@ Control.TabBar { shadowBlur: 0.1 shadowOpacity: tabButton.shadowEnabled ? 0.5 : 0.0 } - Rectangle{ + Rectangle { id: borderBackground visible: tabButton.keyboardFocus height: tabButton.height @@ -113,7 +111,7 @@ Control.TabBar { elide: Text.ElideRight maximumLineCount: 1 text: modelData - bottomPadding: Utils.getSizeWithScreenRatio(5) + bottomPadding: Utils.getSizeWithScreenRatio(5) } } } diff --git a/Linphone/view/Control/Container/VerticalTabBar.qml b/Linphone/view/Control/Container/VerticalTabBar.qml index 20dbedf65..7b1d107c2 100644 --- a/Linphone/view/Control/Container/VerticalTabBar.qml +++ b/Linphone/view/Control/Container/VerticalTabBar.qml @@ -5,12 +5,12 @@ import QtQuick.Effects import Linphone import SettingsCpp import CustomControls 1.0 -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.TabBar { id: mainItem - //spacing: Utils.getSizeWithScreenRatio(32) - topPadding: Utils.getSizeWithScreenRatio(36) + //spacing: Utils.getSizeWithScreenRatio(32) + topPadding: Utils.getSizeWithScreenRatio(36) property var model readonly property alias cornerRadius: bottomLeftCorner.radius @@ -19,49 +19,51 @@ Control.TabBar { property int visibleCount: 0 - signal enterPressed() - signal spacePressed() - + signal enterPressed + signal spacePressed + // Call it after model is ready. If done before, Repeater will not be updated - function initButtons(){ - actionsRepeater.model = mainItem.model + function initButtons() { + actionsRepeater.model = mainItem.model; } function updateVisibleCount() { - mainItem.visibleCount = 0 + mainItem.visibleCount = 0; contentChildren.forEach(child => { - if (child.visible) mainItem.visibleCount = mainItem.visibleCount + 1 - }) + if (child.visible) + mainItem.visibleCount = mainItem.visibleCount + 1; + }); } - + onDefaultAccountChanged: { - if (defaultAccount) defaultAccount.core?.lRefreshNotifications() + if (defaultAccount) + defaultAccount.core?.lRefreshNotifications(); } - Connections { - target: SettingsCpp - function onDisableMeetingsFeatureChanged() { - initButtons() - } - function onDisableChatFeatureChanged() { - initButtons() - } - } - - contentItem: ListView { - model: mainItem.contentModel - currentIndex: mainItem.currentIndex + Connections { + target: SettingsCpp + function onDisableMeetingsFeatureChanged() { + initButtons(); + } + function onDisableChatFeatureChanged() { + initButtons(); + } + } - spacing: mainItem.spacing - orientation: ListView.Vertical - // boundsBehavior: Flickable.StopAtBounds - flickableDirection: Flickable.AutoFlickIfNeeded - // snapMode: ListView.SnapToItem + contentItem: ListView { + model: mainItem.contentModel + currentIndex: mainItem.currentIndex - // highlightMoveDuration: 0 - // highlightRangeMode: ListView.ApplyRange - // preferredHighlightBegin: 40 - // preferredHighlightEnd: width - 40 - } + spacing: mainItem.spacing + orientation: ListView.Vertical + // boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.AutoFlickIfNeeded + // snapMode: ListView.SnapToItem + + // highlightMoveDuration: 0 + // highlightRangeMode: ListView.ApplyRange + // preferredHighlightBegin: 40 + // preferredHighlightEnd: width - 40 + } background: Item { id: background @@ -70,30 +72,30 @@ Control.TabBar { id: bottomLeftCorner anchors.fill: parent color: DefaultStyle.main1_500_main - radius: Utils.getSizeWithScreenRatio(25) + radius: Utils.getSizeWithScreenRatio(25) } Rectangle { color: DefaultStyle.main1_500_main anchors.left: parent.left anchors.top: parent.top - width: parent.width/2 - height: parent.height/2 + width: parent.width / 2 + height: parent.height / 2 } Rectangle { color: DefaultStyle.main1_500_main - y: parent.y + parent.height/2 + y: parent.y + parent.height / 2 width: parent.width - height: parent.height/2 + height: parent.height / 2 } } - - Repeater { + + Repeater { id: actionsRepeater Control.TabButton { id: tabButton width: mainItem.width - bottomInset: Utils.getSizeWithScreenRatio(32) - topInset: Utils.getSizeWithScreenRatio(32) + bottomInset: Utils.getSizeWithScreenRatio(32) + topInset: Utils.getSizeWithScreenRatio(32) hoverEnabled: true visible: modelData?.visible != undefined ? modelData.visible : true onVisibleChanged: mainItem.updateVisibleCount() @@ -102,23 +104,18 @@ Control.TabBar { focusPolicy: Qt.StrongFocus activeFocusOnTab: true UnreadNotification { - unread: !defaultAccount - ? -1 - : index === 0 - ? defaultAccount.core?.unreadCallNotifications || -1 - : index === 2 - ? defaultAccount.core?.unreadMessageNotifications || -1 - : 0 + unread: !defaultAccount ? -1 : index === 0 ? defaultAccount.core?.unreadCallNotifications || -1 : index === 2 + ? defaultAccount.core?.unreadMessageNotifications || -1 : 0 anchors.right: parent.right - anchors.rightMargin: Utils.getSizeWithScreenRatio(15) + anchors.rightMargin: Utils.getSizeWithScreenRatio(15) anchors.top: parent.top } MouseArea { anchors.fill: tabButton cursorShape: tabButton.hovered ? Qt.PointingHandCursor : Qt.ArrowCursor - acceptedButtons: Qt.NoButton + acceptedButtons: Qt.NoButton } - background: Rectangle{ + background: Rectangle { // Black border for keyboard navigation visible: tabButton.keyboardFocus color: "transparent" @@ -130,7 +127,8 @@ Control.TabBar { contentItem: ColumnLayout { EffectImage { id: buttonIcon - property real buttonSize: Utils.getSizeWithScreenRatio(mainItem.currentIndex !== index && tabButton.hovered ? 26 : 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 @@ -138,18 +136,16 @@ Control.TabBar { fillMode: Image.PreserveAspectFit colorizationColor: DefaultStyle.grey_0 useColor: !modelData.colored - onStatusChanged: if (status === Image.Ready && !buttonText.visible) buttonText.visible = true + onStatusChanged: if (status === Image.Ready && !buttonText.visible) + buttonText.visible = true } Text { id: buttonText text: modelData.label visible: false font { - weight: mainItem.currentIndex === index - ? Utils.getSizeWithScreenRatio(800) - : tabButton.hovered - ? Utils.getSizeWithScreenRatio(600) - : Utils.getSizeWithScreenRatio(400) + weight: mainItem.currentIndex === index ? Utils.getSizeWithScreenRatio(800) : tabButton.hovered + ? Utils.getSizeWithScreenRatio(600) : Utils.getSizeWithScreenRatio(400) pixelSize: Utils.getSizeWithScreenRatio(11) } color: DefaultStyle.grey_0 @@ -166,29 +162,29 @@ Control.TabBar { text: modelData.label font: buttonText.font Component.onCompleted: { - font.weight = Utils.getSizeWithScreenRatio(800) - mainItem.implicitWidth = Math.max(mainItem.implicitWidth, advanceWidth + buttonIcon.buttonSize) + font.weight = Utils.getSizeWithScreenRatio(800); + mainItem.implicitWidth = Math.max(mainItem.implicitWidth, advanceWidth + buttonIcon.buttonSize); } } Keys.onPressed: event => { - if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { - mainItem.enterPressed() - } else if(event.key === Qt.Key_Space){ - mainItem.spacePressed() - } else if(event.key === Qt.Key_Down){ - event.accepted = true; - if(TabBar.index >= mainItem.visibleCount - 1) - return; - tabButton.nextItemInFocusChain(true).forceActiveFocus(Qt.TabFocusReason) - } else if(event.key === Qt.Key_Up){ - event.accepted = true; - if(TabBar.index <= 0) - return; - tabButton.nextItemInFocusChain(false).forceActiveFocus(Qt.BacktabFocusReason) - } - } + if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { + mainItem.enterPressed(); + } else if (event.key === Qt.Key_Space) { + mainItem.spacePressed(); + } else if (event.key === Qt.Key_Down) { + event.accepted = true; + if (TabBar.index >= mainItem.visibleCount - 1) + return; + tabButton.nextItemInFocusChain(true).forceActiveFocus(Qt.TabFocusReason); + } else if (event.key === Qt.Key_Up) { + event.accepted = true; + if (TabBar.index <= 0) + return; + tabButton.nextItemInFocusChain(false).forceActiveFocus(Qt.BacktabFocusReason); + } + } onClicked: { - mainItem.setCurrentIndex(TabBar.index) + mainItem.setCurrentIndex(TabBar.index); } } } diff --git a/Linphone/view/Control/Display/Call/CallHistoryListView.qml b/Linphone/view/Control/Display/Call/CallHistoryListView.qml index 6ac875503..80e98ffc8 100644 --- a/Linphone/view/Control/Display/Call/CallHistoryListView.qml +++ b/Linphone/view/Control/Display/Call/CallHistoryListView.qml @@ -10,289 +10,281 @@ 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 - clip: true - keyNavigationEnabled: false // We will reimplement the keyNavigation - activeFocusOnTab: true + id: mainItem + clip: true + keyNavigationEnabled: false // We will reimplement the keyNavigation + activeFocusOnTab: true - property SearchBar searchBar - property bool loading: false - property string searchText: searchBar?.text - property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) - property bool keyboardFocus: FocusHelper.keyboardFocus - property bool lastFocusByNavigationKeyboard: false // Workaround to get the correct focusReason + property SearchBar searchBar + property bool loading: false + property string searchText: searchBar?.text + property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) + property bool keyboardFocus: FocusHelper.keyboardFocus + property bool lastFocusByNavigationKeyboard: false // Workaround to get the correct focusReason - signal resultsReceived + signal resultsReceived - onResultsReceived: { - loading = false - } + onResultsReceived: { + loading = false; + } - model: CallHistoryProxy { - id: callHistoryProxy - onListAboutToBeReset: loading = true - filterText: mainItem.searchText - onFilterTextChanged: maxDisplayItems = initialDisplayItems - initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(56))) - displayItemsStep: 3 * initialDisplayItems / 2 - onModelAboutToBeReset: loading = true - onModelReset: { - mainItem.resultsReceived() - } - } - flickDeceleration: 10000 - spacing: Utils.getSizeWithScreenRatio(10) + model: CallHistoryProxy { + id: callHistoryProxy + onListAboutToBeReset: loading = true + filterText: mainItem.searchText + onFilterTextChanged: maxDisplayItems = initialDisplayItems + initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(56))) + displayItemsStep: 3 * initialDisplayItems / 2 + onModelAboutToBeReset: loading = true + onModelReset: { + mainItem.resultsReceived(); + } + } + flickDeceleration: 10000 + spacing: Utils.getSizeWithScreenRatio(10) - Keys.onPressed: event => { - if (event.key == Qt.Key_Escape) { - console.log("Back") - searchBar.forceActiveFocus(Qt.BacktabFocusReason) - event.accepted = true - } + Keys.onPressed: event => { + if (event.key == Qt.Key_Escape) { + console.log("Back"); + searchBar.forceActiveFocus(Qt.BacktabFocusReason); + event.accepted = true; + } else - // Re-implement key navigation to have Qt.TabFocusReason and Qt.BacktabFocusReason instead of Qt.OtherFocusReason when using arrows to navigate in listView - else if (event.key === Qt.Key_Up) { - if(currentIndex === 0){ - searchBar.forceActiveFocus(Qt.BacktabFocusReason) - lastFocusByNavigationKeyboard = false - }else{ - decrementCurrentIndex() - currentItem.forceActiveFocus(Qt.BacktabFocusReason) // The focusReason is created by QT later, need to create a workaround - lastFocusByNavigationKeyboard = true - } - event.accepted = true - } - else if(event.key === Qt.Key_Down){ - incrementCurrentIndex() - currentItem.forceActiveFocus(Qt.TabFocusReason) // The focusReason is created by QT later, need to create a workaround - lastFocusByNavigationKeyboard = true - event.accepted = true - } - } + // Re-implement key navigation to have Qt.TabFocusReason and Qt.BacktabFocusReason instead of Qt.OtherFocusReason when using arrows to navigate in listView + if (event.key === Qt.Key_Up) { + if (currentIndex === 0) { + searchBar.forceActiveFocus(Qt.BacktabFocusReason); + lastFocusByNavigationKeyboard = false; + } else { + decrementCurrentIndex(); + currentItem.forceActiveFocus( + Qt.BacktabFocusReason); // The focusReason is created by QT later, need to create a workaround + lastFocusByNavigationKeyboard = true; + } + event.accepted = true; + } else if (event.key === Qt.Key_Down) { + incrementCurrentIndex(); + currentItem.forceActiveFocus( + Qt.TabFocusReason); // The focusReason is created by QT later, need to create a workaround + lastFocusByNavigationKeyboard = true; + event.accepted = true; + } + } - Component.onCompleted: cacheBuffer = Math.max(mainItem.height,0) //contentHeight>0 ? contentHeight : 0// cache all items - // remove binding loop - // onContentHeightChanged: Qt.callLater(function () { - // if (mainItem) - // mainItem.cacheBuffer = Math?.max(contentHeight, 0) || 0 - // }) + Component.onCompleted: cacheBuffer = Math.max(mainItem.height, + 0) //contentHeight>0 ? contentHeight : 0// cache all items + // remove binding loop + // onContentHeightChanged: Qt.callLater(function () { + // if (mainItem) + // mainItem.cacheBuffer = Math?.max(contentHeight, 0) || 0 + // }) - onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0) currentIndex = 0 - onCountChanged: { - if (currentIndex < 0 && count > 0) { - mainItem.currentIndex = 0 // Select first item after loading model - } - if (atYBeginning) - positionViewAtBeginning() // Stay at beginning - } - Connections { - target: deleteHistoryPopup - function onAccepted() { - mainItem.model.removeAllEntries() - } - } + onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0) + currentIndex = 0 + onCountChanged: { + if (currentIndex < 0 && count > 0) { + mainItem.currentIndex = 0; // Select first item after loading model + } + if (atYBeginning) + positionViewAtBeginning(); // Stay at beginning + } + Connections { + target: deleteHistoryPopup + function onAccepted() { + mainItem.model.removeAllEntries(); + } + } - onAtYEndChanged: { - if (atYEnd && count > 0) { - callHistoryProxy.displayMore() - } - } - //---------------------------------------------------------------- - function moveToCurrentItem() { - if (mainItem.currentIndex >= 0) - Utils.updatePosition(mainItem, mainItem) - } - onCurrentItemChanged: { - moveToCurrentItem() - } - // Update position only if we are moving to current item and its position is changing. - property var _currentItemY: currentItem?.y - on_CurrentItemYChanged: if (_currentItemY && moveAnimation.running) { - moveToCurrentItem() - } - Behavior on contentY { - NumberAnimation { - id: moveAnimation - duration: 500 - easing.type: Easing.OutExpo - alwaysRunToEnd: true - } - } + onAtYEndChanged: { + if (atYEnd && count > 0) { + callHistoryProxy.displayMore(); + } + } + //---------------------------------------------------------------- + function moveToCurrentItem() { + if (mainItem.currentIndex >= 0) + Utils.updatePosition(mainItem, mainItem); + } + onCurrentItemChanged: { + moveToCurrentItem(); + } + // Update position only if we are moving to current item and its position is changing. + property var _currentItemY: currentItem?.y + on_CurrentItemYChanged: if (_currentItemY && moveAnimation.running) { + moveToCurrentItem(); + } + Behavior on contentY { + NumberAnimation { + id: moveAnimation + duration: 500 + easing.type: Easing.OutExpo + alwaysRunToEnd: true + } + } - //---------------------------------------------------------------- + //---------------------------------------------------------------- - BusyIndicator { - anchors.horizontalCenter: mainItem.horizontalCenter - visible: mainItem.loading - height: visible ? mainItem.busyIndicatorSize : 0 - width: mainItem.busyIndicatorSize - indicatorHeight: mainItem.busyIndicatorSize - indicatorWidth: mainItem.busyIndicatorSize - indicatorColor: DefaultStyle.main1_500_main - } + BusyIndicator { + anchors.horizontalCenter: mainItem.horizontalCenter + visible: mainItem.loading + height: visible ? mainItem.busyIndicatorSize : 0 + width: mainItem.busyIndicatorSize + indicatorHeight: mainItem.busyIndicatorSize + indicatorWidth: mainItem.busyIndicatorSize + indicatorColor: DefaultStyle.main1_500_main + } - // Qt bug: sometimes, containsMouse may not be send and update on each MouseArea. - // So we need to use this variable to switch off all hovered items. - property int lastMouseContainsIndex: -1 - delegate: FocusScope { - width: mainItem.width - height: Utils.getSizeWithScreenRatio(56) - Accessible.role: Accessible.ListItem + // Qt bug: sometimes, containsMouse may not be send and update on each MouseArea. + // So we need to use this variable to switch off all hovered items. + property int lastMouseContainsIndex: -1 + delegate: FocusScope { + width: mainItem.width + height: Utils.getSizeWithScreenRatio(56) + Accessible.role: Accessible.ListItem - RowLayout { - z: 1 - anchors.fill: parent - anchors.leftMargin: Utils.getSizeWithScreenRatio(10) - spacing: Utils.getSizeWithScreenRatio(10) - Avatar { - id: historyAvatar - property var contactObj: UtilsCpp.findFriendByAddress(modelData.core.remoteAddress) - contact: contactObj?.value || null - displayNameVal: modelData.core.displayName - secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified - width: Utils.getSizeWithScreenRatio(45) - height: Utils.getSizeWithScreenRatio(45) - isConference: modelData.core.isConference - shadowEnabled: false - asynchronous: false - } - ColumnLayout { - Layout.fillHeight: true - Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(5) - Text { - Layout.fillWidth: true - maximumLineCount: 1 - text: modelData.core.displayName - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } - } - RowLayout { - spacing: Utils.getSizeWithScreenRatio(6) - EffectImage { - id: statusIcon - imageSource: modelData.core.status === LinphoneEnums.CallStatus.Declined - || modelData.core.status - === LinphoneEnums.CallStatus.DeclinedElsewhere - || modelData.core.status === LinphoneEnums.CallStatus.Aborted - || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted ? AppIcons.arrowElbow : modelData.core.isOutgoing ? AppIcons.arrowUpRight : AppIcons.arrowDownLeft - colorizationColor: modelData.core.status - === LinphoneEnums.CallStatus.Declined - || modelData.core.status - === LinphoneEnums.CallStatus.DeclinedElsewhere - || modelData.core.status - === LinphoneEnums.CallStatus.Aborted - || modelData.core.status - === LinphoneEnums.CallStatus.EarlyAborted - || modelData.core.status === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500_main : modelData.core.isOutgoing ? DefaultStyle.info_500_main : DefaultStyle.success_500_main - Layout.preferredWidth: Utils.getSizeWithScreenRatio(12) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(12) - transform: Rotation { - angle: modelData.core.isOutgoing - && (modelData.core.status === LinphoneEnums.CallStatus.Declined - || modelData.core.status - === LinphoneEnums.CallStatus.DeclinedElsewhere - || modelData.core.status === LinphoneEnums.CallStatus.Aborted - || modelData.core.status - === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0 - origin { - x: statusIcon.width / 2 - y: statusIcon.height / 2 - } - } - } - Text { - // text: modelData.core.date - text: UtilsCpp.formatDate(modelData.core.date) - font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(300) - } - } - } - } - BigButton { - id: callButton - visible: !modelData.core.isConference || !SettingsCpp.disableMeetingsFeature - style: ButtonStyle.noBackground - icon.source: AppIcons.phone - focus: false - activeFocusOnTab: false - asynchronous: false - - //: Call %1 - Accessible.name: qsTr("call_name_accessible_button").arg(historyAvatar.displayNameVal) - onClicked: { - if (modelData.core.isConference) { - var callsWindow = UtilsCpp.getOrCreateCallsWindow() - callsWindow.setupConference( - modelData.core.conferenceInfo) - UtilsCpp.smartShowWindow(callsWindow) - } else { - UtilsCpp.createCall(modelData.core.remoteAddress) - } - } - Keys.onPressed: event => { - if (event.key === Qt.Key_Left){ - backgroundMouseArea.forceActiveFocus(Qt.BacktabFocusReason) - lastFocusByNavigationKeyboard = true; - } - } - onActiveFocusChanged: { - if (!activeFocus) { - console.log("Unfocus button"); - callButton.focus = false // Make sure to be unfocusable (could be when called by forceActiveFocus) - backgroundMouseArea.focus = true - } - } - } - } - MouseArea { - id: backgroundMouseArea - hoverEnabled: true - anchors.fill: parent - focus: true - property bool keyboardFocus: FocusHelper.keyboardFocus || activeFocus && lastFocusByNavigationKeyboard + RowLayout { + z: 1 + anchors.fill: parent + anchors.leftMargin: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) + Avatar { + id: historyAvatar + property var contactObj: UtilsCpp.findFriendByAddress(modelData.core.remoteAddress) + contact: contactObj?.value || null + displayNameVal: modelData.core.displayName + secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified + width: Utils.getSizeWithScreenRatio(45) + height: Utils.getSizeWithScreenRatio(45) + isConference: modelData.core.isConference + shadowEnabled: false + asynchronous: false + } + ColumnLayout { + Layout.fillHeight: true + Layout.fillWidth: true + spacing: Utils.getSizeWithScreenRatio(5) + Text { + Layout.fillWidth: true + maximumLineCount: 1 + text: modelData.core.displayName + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + } + RowLayout { + spacing: Utils.getSizeWithScreenRatio(6) + EffectImage { + id: statusIcon + imageSource: modelData.core.status === LinphoneEnums.CallStatus.Declined || modelData.core.status + === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.Aborted + || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted ? AppIcons.arrowElbow : + modelData.core.isOutgoing ? AppIcons.arrowUpRight : AppIcons.arrowDownLeft + colorizationColor: modelData.core.status === LinphoneEnums.CallStatus.Declined || modelData.core.status + === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status + === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted + || modelData.core.status === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500_main : + modelData.core.isOutgoing ? DefaultStyle.info_500_main : DefaultStyle.success_500_main + Layout.preferredWidth: Utils.getSizeWithScreenRatio(12) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(12) + transform: Rotation { + angle: modelData.core.isOutgoing && (modelData.core.status === LinphoneEnums.CallStatus.Declined + || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status + === LinphoneEnums.CallStatus.Aborted || modelData.core.status + === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0 + origin { + x: statusIcon.width / 2 + y: statusIcon.height / 2 + } + } + } + Text { + // text: modelData.core.date + text: UtilsCpp.formatDate(modelData.core.date) + font { + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) + } + } + } + } + BigButton { + id: callButton + visible: !modelData.core.isConference || !SettingsCpp.disableMeetingsFeature + style: ButtonStyle.noBackground + icon.source: AppIcons.phone + focus: false + activeFocusOnTab: false + asynchronous: false - //: %1 - %2 - %3 - right arrow for call-back button - Accessible.name: qsTr("call_history_entry_accessible_name").arg( - //: "Appel manqué" - modelData.core.status === LinphoneEnums.CallStatus.Missed ? qsTr("notification_missed_call_title") - //: "Appel sortant" - : modelData.core.isOutgoing ? qsTr("call_outgoing") - //: "Appel entrant" - : qsTr("call_audio_incoming") - ).arg(historyAvatar.displayNameVal).arg(UtilsCpp.formatDate(modelData.core.date)) - - onContainsMouseChanged: { - if (containsMouse) - mainItem.lastMouseContainsIndex = index - else if (mainItem.lastMouseContainsIndex == index) - mainItem.lastMouseContainsIndex = -1 - } - Rectangle { - anchors.fill: parent - opacity: 0.7 - radius: Utils.getSizeWithScreenRatio(8) - color: mainItem.currentIndex - === index ? DefaultStyle.main2_200 : DefaultStyle.main2_100 + //: Call %1 + Accessible.name: qsTr("call_name_accessible_button").arg(historyAvatar.displayNameVal) + onClicked: { + if (modelData.core.isConference) { + var callsWindow = UtilsCpp.getOrCreateCallsWindow(); + callsWindow.setupConference(modelData.core.conferenceInfo); + UtilsCpp.smartShowWindow(callsWindow); + } else { + UtilsCpp.createCall(modelData.core.remoteAddress); + } + } + Keys.onPressed: event => { + if (event.key === Qt.Key_Left) { + backgroundMouseArea.forceActiveFocus(Qt.BacktabFocusReason); + lastFocusByNavigationKeyboard = true; + } + } + onActiveFocusChanged: { + if (!activeFocus) { + console.log("Unfocus button"); + callButton.focus = false; // Make sure to be unfocusable (could be when called by forceActiveFocus) + backgroundMouseArea.focus = true; + } + } + } + } + MouseArea { + id: backgroundMouseArea + hoverEnabled: true + anchors.fill: parent + focus: true + property bool keyboardFocus: FocusHelper.keyboardFocus || activeFocus && lastFocusByNavigationKeyboard + + //: %1 - %2 - %3 - right arrow for call-back button + Accessible.name: qsTr("call_history_entry_accessible_name").arg( + //: "Appel manqué" + modelData.core.status === LinphoneEnums.CallStatus.Missed ? qsTr("notification_missed_call_title") : + //: "Appel sortant" + modelData.core.isOutgoing ? qsTr("call_outgoing") : + //: "Appel entrant" + qsTr("call_audio_incoming")).arg(historyAvatar.displayNameVal).arg(UtilsCpp.formatDate( + modelData.core.date)) + + onContainsMouseChanged: { + if (containsMouse) + mainItem.lastMouseContainsIndex = index; + else if (mainItem.lastMouseContainsIndex == index) + mainItem.lastMouseContainsIndex = -1; + } + Rectangle { + anchors.fill: parent + opacity: 0.7 + radius: Utils.getSizeWithScreenRatio(8) + color: mainItem.currentIndex === index ? DefaultStyle.main2_200 : DefaultStyle.main2_100 border.color: backgroundMouseArea.keyboardFocus ? DefaultStyle.main2_900 : "transparent" border.width: backgroundMouseArea.keyboardFocus ? Utils.getSizeWithScreenRatio(3) : 0 - visible: mainItem.lastMouseContainsIndex === index - || mainItem.currentIndex === index - } - onPressed: { - mainItem.currentIndex = model.index - mainItem.forceActiveFocus() - mainItem.lastFocusByNavigationKeyboard = false - } - Keys.onPressed: event => { - if(event.key === Qt.Key_Right){ - callButton.forceActiveFocus(Qt.TabFocusReason) - } - } - } - } + visible: mainItem.lastMouseContainsIndex === index || mainItem.currentIndex === index + } + onPressed: { + mainItem.currentIndex = model.index; + mainItem.forceActiveFocus(); + mainItem.lastFocusByNavigationKeyboard = false; + } + Keys.onPressed: event => { + if (event.key === Qt.Key_Right) { + callButton.forceActiveFocus(Qt.TabFocusReason); + } + } + } + } } diff --git a/Linphone/view/Control/Display/Call/CallListView.qml b/Linphone/view/Control/Display/Call/CallListView.qml index 37313ece8..125397ce1 100644 --- a/Linphone/view/Control/Display/Call/CallListView.qml +++ b/Linphone/view/Control/Display/Call/CallListView.qml @@ -6,42 +6,39 @@ import Linphone 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ListView { id: mainItem implicitHeight: contentHeight - spacing: Utils.getSizeWithScreenRatio(15) + spacing: Utils.getSizeWithScreenRatio(15) clip: true property bool isTransferList: false - property string currentRemoteAddress: AppCpp.calls.currentCall ? AppCpp.calls.currentCall.core.remoteAddress : "" + property string currentRemoteAddress: AppCpp.calls.currentCall ? AppCpp.calls.currentCall.core.remoteAddress : "" signal transferCallToAnotherRequested(CallGui dest) - + onCountChanged: forceLayout() model: CallProxy { id: callProxy sourceModel: AppCpp.calls showCurrentCall: !mainItem.isTransferList - } + } delegate: RowLayout { id: callInformationItem - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) width: mainItem.width - height: Utils.getSizeWithScreenRatio(45) + 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 - : remoteNameObj - ? remoteNameObj.value - : "" + property var callName: (modelData && !SettingsCpp.disableMeetingsFeature && modelData.core.isConference) + ? modelData.core.conference.core.subject : remoteNameObj ? remoteNameObj.value : "" Avatar { id: delegateAvatar - Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) _address: modelData.core.remoteAddress secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified isConference: modelData.core.isConference @@ -52,48 +49,48 @@ ListView { Text { id: delegateName text: callInformationItem.callName - font.pixelSize: Utils.getSizeWithScreenRatio(14) + font.pixelSize: Utils.getSizeWithScreenRatio(14) Layout.fillWidth: true maximumLineCount: 1 } Text { id: callStateText - //: "Réunion - property string type: modelData.core.isConference ? qsTr("meeting") - //: "Appel" - : qsTr("call") - Layout.rightMargin: Utils.getSizeWithScreenRatio(2) - text: modelData.core.state === LinphoneEnums.CallState.Paused - || modelData.core.state === LinphoneEnums.CallState.PausedByRemote - //: "%1 en pause" - ? qsTr("paused_call_or_meeting").arg(type) - //: "%1 en cours" - : qsTr("ongoing_call_or_meeting").arg(type) + //: "Réunion + property string type: modelData.core.isConference ? qsTr("meeting") : + //: "Appel" + qsTr("call") + Layout.rightMargin: Utils.getSizeWithScreenRatio(2) + text: modelData.core.state === LinphoneEnums.CallState.Paused || modelData.core.state + === LinphoneEnums.CallState.PausedByRemote ? + //: "%1 en pause" + qsTr("paused_call_or_meeting").arg(type) : + //: "%1 en cours" + qsTr("ongoing_call_or_meeting").arg(type) font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } Button { id: transferButton - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) Layout.alignment: Qt.AlignVCenter - visible: mainItem.isTransferList - && (mainItem.currentRemoteAddress !== modelData.core.remoteAddress) - && modelData.core.state !== LinphoneEnums.CallState.IncomingReceived - && modelData.core.state !== LinphoneEnums.CallState.PushIncomingReceived - && modelData.core.state !== LinphoneEnums.CallState.OutgoingInit - && modelData.core.state !== LinphoneEnums.CallState.OutgoingProgress - && modelData.core.state !== LinphoneEnums.CallState.OutgoingRinging - && modelData.core.state !== LinphoneEnums.CallState.OutgoingEarlyMedia - && modelData.core.state !== LinphoneEnums.CallState.IncomingEarlyMedia + visible: mainItem.isTransferList && (mainItem.currentRemoteAddress !== modelData.core.remoteAddress) + && modelData.core.state !== LinphoneEnums.CallState.IncomingReceived && modelData.core.state + !== LinphoneEnums.CallState.PushIncomingReceived && modelData.core.state !== LinphoneEnums.CallState.OutgoingInit + && modelData.core.state !== LinphoneEnums.CallState.OutgoingProgress && modelData.core.state + !== LinphoneEnums.CallState.OutgoingRinging && modelData.core.state + !== LinphoneEnums.CallState.OutgoingEarlyMedia && modelData.core.state + !== LinphoneEnums.CallState.IncomingEarlyMedia icon.source: AppIcons.transferCall style: ButtonStyle.noBackground onClicked: { - mainItem.transferCallToAnotherRequested(modelData) + mainItem.transferCallToAnotherRequested(modelData); } //: Transfer call %1 Accessible.name: qsTr("transfer_call_name_accessible_name").arg(callInformationItem.callName) @@ -101,21 +98,21 @@ ListView { Button { id: pausingButton enabled: !(modelData.core.state === LinphoneEnums.CallState.PausedByRemote) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(28) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(28) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) Layout.alignment: Qt.AlignVCenter - leftPadding: Utils.getSizeWithScreenRatio(5) - rightPadding: Utils.getSizeWithScreenRatio(5) - topPadding: Utils.getSizeWithScreenRatio(5) - bottomPadding: Utils.getSizeWithScreenRatio(5) + 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: Utils.getSizeWithScreenRatio(18) - icon.height: Utils.getSizeWithScreenRatio(18) + icon.width: Utils.getSizeWithScreenRatio(18) + icon.height: Utils.getSizeWithScreenRatio(18) onClicked: modelData.core.lSetPaused(!modelData.core.paused) TextMetrics { id: pauseMeter @@ -123,25 +120,24 @@ ListView { font.bold: true } Accessible.name: (pausedByUser ? - //: Resume %1 call - qsTr("resume_call_name_accessible_name") : - //: Pause %1 call - qsTr("pause_call_name_accessible_name") - ).arg(callInformationItem.callName) + //: Resume %1 call + qsTr("resume_call_name_accessible_name") : + //: Pause %1 call + qsTr("pause_call_name_accessible_name")).arg(callInformationItem.callName) } SmallButton { id: endCallButton - Layout.preferredWidth: Utils.getSizeWithScreenRatio(38) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) + 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: Utils.getSizeWithScreenRatio(18) - icon.height: Utils.getSizeWithScreenRatio(18) + icon.width: Utils.getSizeWithScreenRatio(18) + icon.height: Utils.getSizeWithScreenRatio(18) onClicked: { - mainWindow.callTerminatedByUser = true - mainWindow.endCall(modelData) + mainWindow.callTerminatedByUser = true; + mainWindow.endCall(modelData); } TextMetrics { id: endMeter diff --git a/Linphone/view/Control/Display/Call/CallStatistics.qml b/Linphone/view/Control/Display/Call/CallStatistics.qml index a07965b1c..34ca9cb6a 100644 --- a/Linphone/view/Control/Display/Call/CallStatistics.qml +++ b/Linphone/view/Control/Display/Call/CallStatistics.qml @@ -9,64 +9,64 @@ ColumnLayout { id: mainItem property var call property string objectName: "statsPanel" - spacing: Utils.getSizeWithScreenRatio(20) - + spacing: Utils.getSizeWithScreenRatio(20) + RoundedPane { Layout.fillWidth: true - leftPadding: Utils.getSizeWithScreenRatio(16) - rightPadding: Utils.getSizeWithScreenRatio(16) - topPadding: Utils.getSizeWithScreenRatio(13) - bottomPadding: Utils.getSizeWithScreenRatio(13) + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(16) + topPadding: Utils.getSizeWithScreenRatio(13) + bottomPadding: Utils.getSizeWithScreenRatio(13) + + Layout.topMargin: Utils.getSizeWithScreenRatio(13) + Layout.leftMargin: Utils.getSizeWithScreenRatio(16) + Layout.rightMargin: Utils.getSizeWithScreenRatio(16) - Layout.topMargin: Utils.getSizeWithScreenRatio(13) - Layout.leftMargin: Utils.getSizeWithScreenRatio(16) - Layout.rightMargin: Utils.getSizeWithScreenRatio(16) - contentItem: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(12) + spacing: Utils.getSizeWithScreenRatio(12) Layout.alignment: Qt.AlignHCenter Text { - //: "Audio" - text: qsTr("call_stats_audio_title") + //: "Audio" + text: qsTr("call_stats_audio_title") Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Typography.p2.weight + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Typography.p2.weight } } ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) Layout.alignment: Qt.AlignHCenter Text { text: mainItem.call ? mainItem.call.core.audioStats.codec : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.audioStats.bandwidth : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.audioStats.lossRate : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.audioStats.jitterBufferSize : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } } @@ -74,73 +74,75 @@ ColumnLayout { } RoundedPane { Layout.fillWidth: true - leftPadding: Utils.getSizeWithScreenRatio(16) - rightPadding: Utils.getSizeWithScreenRatio(16) - topPadding: Utils.getSizeWithScreenRatio(13) - bottomPadding: Utils.getSizeWithScreenRatio(13) + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(16) + topPadding: Utils.getSizeWithScreenRatio(13) + bottomPadding: Utils.getSizeWithScreenRatio(13) - Layout.leftMargin: Utils.getSizeWithScreenRatio(16) - Layout.rightMargin: Utils.getSizeWithScreenRatio(16) + Layout.leftMargin: Utils.getSizeWithScreenRatio(16) + Layout.rightMargin: Utils.getSizeWithScreenRatio(16) visible: mainItem.call && (mainItem.call.core.localVideoEnabled || mainItem.call.core.remoteVideoEnabled) contentItem: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(12) + spacing: Utils.getSizeWithScreenRatio(12) Layout.alignment: Qt.AlignHCenter Text { - //: "Vidéo" - text: qsTr("call_stats_video_title") + //: "Vidéo" + text: qsTr("call_stats_video_title") Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Typography.p2.weight + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Typography.p2.weight } } ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) Layout.alignment: Qt.AlignHCenter Text { text: mainItem.call ? mainItem.call.core.videoStats.codec : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.videoStats.bandwidth : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.videoStats.lossRate : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.videoStats.resolution : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { text: mainItem.call ? mainItem.call.core.videoStats.fps : "" Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } } } } - Item{Layout.fillHeight: true} + Item { + Layout.fillHeight: true + } } diff --git a/Linphone/view/Control/Display/Chat/AnimatedImageFileView.qml b/Linphone/view/Control/Display/Chat/AnimatedImageFileView.qml index a867711f3..44be371f8 100644 --- a/Linphone/view/Control/Display/Chat/AnimatedImageFileView.qml +++ b/Linphone/view/Control/Display/Chat/AnimatedImageFileView.qml @@ -4,11 +4,10 @@ import QtQuick.Layouts import Linphone import UtilsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= - // --------------------------------------------------------------------- // Separated file to show a single image bigger in chat message // The FileView file does not allow that as it is a Loader and the image @@ -23,7 +22,7 @@ AnimatedImage { mipmap: false//SettingsModel.mipmapEnabled autoTransform: true fillMode: Image.PreserveAspectFit - source: contentGui && UtilsCpp.isAnimatedImage(contentGui.core.filePath) ? ('file:/'+ contentGui.core.filePath) : "" + source: contentGui && UtilsCpp.isAnimatedImage(contentGui.core.filePath) ? ('file:/' + contentGui.core.filePath) : "" // sourceSize.width: implicitWidth // sourceSize.height: implicitHeight states: State { @@ -38,19 +37,21 @@ AnimatedImage { // Changing cursor in MouseArea seems not to work with the Loader // Use override cursor for this case onContainsMouseChanged: { - if (containsMouse) UtilsCpp.setGlobalCursor(Qt.PointingHandCursor) - else UtilsCpp.restoreGlobalCursor() - mainItem.state = containsMouse ? 'hovered' : '' - } - onPressed: (mouse) => { - mouse.accepted = true - // if(SettingsModel.isVfsEncrypted){ - // window.attachVirtualWindow(Utils.buildCommonDialogUri('FileViewDialog'), { - // contentGui: mainItem.contentGui, - // }, function (status) { - // }) - // }else - mainItem.contentGui.core.lOpenFile() + if (containsMouse) + UtilsCpp.setGlobalCursor(Qt.PointingHandCursor); + else + UtilsCpp.restoreGlobalCursor(); + mainItem.state = containsMouse ? 'hovered' : ''; } + onPressed: mouse => { + mouse.accepted = true; + // if(SettingsModel.isVfsEncrypted){ + // window.attachVirtualWindow(Utils.buildCommonDialogUri('FileViewDialog'), { + // contentGui: mainItem.contentGui, + // }, function (status) { + // }) + // }else + mainItem.contentGui.core.lOpenFile(); + } } -} \ No newline at end of file +} diff --git a/Linphone/view/Control/Display/Chat/ChatAudioContent.qml b/Linphone/view/Control/Display/Chat/ChatAudioContent.qml index d56dedba8..b37d41924 100644 --- a/Linphone/view/Control/Display/Chat/ChatAudioContent.qml +++ b/Linphone/view/Control/Display/Chat/ChatAudioContent.qml @@ -13,76 +13,77 @@ Item { // used for creating a voice recording message property var chatMessageObj property ChatMessageGui chatMessage: chatMessageObj && chatMessageObj.value || null - property bool isPlaying : soudPlayerLoader.item && soudPlayerLoader.item.core.playbackState === LinphoneEnums.PlaybackState.PlayingState + property bool isPlaying: soudPlayerLoader.item && soudPlayerLoader.item.core.playbackState + === LinphoneEnums.PlaybackState.PlayingState onIsPlayingChanged: isPlaying ? mediaProgressBar.resume() : mediaProgressBar.stop() property bool recording: false property RecorderGui recorderGui: recorderLoader.item || null signal voiceRecordingMessageCreationRequested(RecorderGui recorderGui) - signal stopRecording() - signal endOfFileReached() + signal stopRecording + signal endOfFileReached // auto play if follows a voice recording function requestPlaying() { - if(soudPlayerLoader.item) { - soudPlayerLoader.item.play(true) + if (soudPlayerLoader.item) { + soudPlayerLoader.item.play(true); } } - + function createVoiceMessageInChat(chat) { if (recorderLoader.item) { - mainItem.chatMessageObj = UtilsCpp.createVoiceRecordingMessage(recorderLoader.item, chat) + mainItem.chatMessageObj = UtilsCpp.createVoiceRecordingMessage(recorderLoader.item, chat); } else { //: Error UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: Failed to create voice message : error in recorder - qsTr("information_popup_voice_message_error_message"), false) + //: Failed to create voice message : error in recorder + qsTr("information_popup_voice_message_error_message"), false); } } Loader { id: soudPlayerLoader - property int duration: mainItem.chatMessageContentGui - ? mainItem.chatMessageContentGui.core.fileDuration - : item - ? item.core.duration - : 0 + property int duration: mainItem.chatMessageContentGui ? mainItem.chatMessageContentGui.core.fileDuration : item + ? item.core.duration : 0 property int position: item?.core.position || 0 active: mainItem.chatMessageContentGui && mainItem.chatMessageContentGui.core.isVoiceRecording sourceComponent: SoundPlayerGui { id: soundPlayerGui source: mainItem.chatMessageContentGui && mainItem.chatMessageContentGui.core.filePath - function play(restartIfPlaying){ - if(mainItem.isPlaying && (restartIfPlaying === undefined || !restartIfPlaying)){// Pause the play - soundPlayerGui.core.lPause() - } else if (restartIfPlaying) { //Play from scratch - soundPlayerGui.core.lRestart() - } else {// Play the audio - soundPlayerGui.core.lPlay() + function play(restartIfPlaying) { + if (mainItem.isPlaying && (restartIfPlaying === undefined || !restartIfPlaying)) { + // Pause the play + soundPlayerGui.core.lPause(); + } else if (restartIfPlaying) { + //Play from scratch + soundPlayerGui.core.lRestart(); + } else { + // Play the audio + soundPlayerGui.core.lPlay(); } } onStopped: { - mediaProgressBar.value = 101 + mediaProgressBar.value = 101; } onPositionChanged: { - mediaProgressBar.progressPosition = soudPlayerLoader.position - mediaProgressBar.value = 100 * ( mediaProgressBar.progressPosition / soudPlayerLoader.duration) + mediaProgressBar.progressPosition = soudPlayerLoader.position; + mediaProgressBar.value = 100 * (mediaProgressBar.progressPosition / soudPlayerLoader.duration); } onSourceChanged: if (source != "") { - core.lOpen() // Open the file and allow seeking - mediaProgressBar.value = 0 - mediaProgressBar.refresh() - } - onErrorChanged: (error) => { - //: Error - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), error, false) - } + core.lOpen(); // Open the file and allow seeking + mediaProgressBar.value = 0; + mediaProgressBar.refresh(); + } + onErrorChanged: error => { + //: Error + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), error, false); + } onEofReached: { - mainItem.endOfFileReached() + mainItem.endOfFileReached(); } } } - + Loader { id: recorderLoader active: mainItem.recording && !mainItem.chatMessageContentGui @@ -93,57 +94,55 @@ Item { Connections { target: mainItem function onStopRecording() { - recorderLoader.item.core.lStop() + recorderLoader.item.core.lStop(); } } sourceComponent: RecorderGui { id: recorderGui onReady: core.lStart() - onStateChanged: (state) => { - if (state === LinphoneEnums.RecorderState.Running) mediaProgressBar.start() - if (state === LinphoneEnums.RecorderState.Closed) { - mediaProgressBar.stop() - mainItem.voiceRecordingMessageCreationRequested(recorderGui) - } - } + onStateChanged: state => { + if (state === LinphoneEnums.RecorderState.Running) + mediaProgressBar.start(); + if (state === LinphoneEnums.RecorderState.Closed) { + mediaProgressBar.stop(); + mainItem.voiceRecordingMessageCreationRequested(recorderGui); + } + } } } - MediaProgressBar{ + MediaProgressBar { id: mediaProgressBar anchors.fill: parent - progressDuration: soudPlayerLoader.active - ? soudPlayerLoader.duration - : recorderLoader - ? recorderLoader.duration - : chatMessageContentGui.core.fileDuration + progressDuration: soudPlayerLoader.active ? soudPlayerLoader.duration : recorderLoader ? recorderLoader.duration : + chatMessageContentGui.core.fileDuration progressPosition: 0 value: 0 recording: recorderLoader.state === LinphoneEnums.RecorderState.Running - function refresh(){ - if(soudPlayerLoader.item){ - soudPlayerLoader.item.core.lRefreshPosition() + function refresh() { + if (soudPlayerLoader.item) { + soudPlayerLoader.item.core.lRefreshPosition(); } else if (recorderLoader.item) { - recorderLoader.item.core.lRefresh() + recorderLoader.item.core.lRefresh(); } } - onEndReached:{ - if(soudPlayerLoader.item) - soudPlayerLoader.item.core.lStop() + onEndReached: { + if (soudPlayerLoader.item) + soudPlayerLoader.item.core.lStop(); } onPlayStopButtonToggled: { - if(soudPlayerLoader.item) { - soudPlayerLoader.item.play() + if (soudPlayerLoader.item) { + soudPlayerLoader.item.play(); } else if (recorderLoader.item) { - recorderLoader.item.core.lStop() + recorderLoader.item.core.lStop(); } } onRefreshPositionRequested: refresh() - onSeekRequested: (ms) => { - if(soudPlayerLoader.active) { - soudPlayerLoader.item.core.lSeek(ms) - } - } + onSeekRequested: ms => { + if (soudPlayerLoader.active) { + soudPlayerLoader.item.core.lSeek(ms); + } + } } -} \ No newline at end of file +} diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index 33f72dc68..f344209f4 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -9,235 +9,241 @@ 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 - clip: true + id: mainItem + clip: true - property SearchBar searchBar - property bool loading: false - property string searchText: searchBar?.text - property alias chatProxy: chatProxy - property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) + property SearchBar searchBar + property bool loading: false + property string searchText: searchBar?.text + property alias chatProxy: chatProxy + property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) - property ChatGui currentChatGui: model.getAt(currentIndex) || null - onCurrentChatGuiChanged: positionViewAtIndex(currentIndex, ListView.Center) - property ChatGui chatToSelect: null - property ChatGui chatToSelectLater: null - onChatToSelectChanged: { - if (chatToSelect) { - // first clear the chatToSelect property in case we need to - // force adding the chat to the list and the layout changes - var toselect = chatToSelect - chatToSelect = null - selectChat(toselect, true) - } - } + property ChatGui currentChatGui: model.getAt(currentIndex) || null + onCurrentChatGuiChanged: positionViewAtIndex(currentIndex, ListView.Center) + property ChatGui chatToSelect: null + property ChatGui chatToSelectLater: null + onChatToSelectChanged: { + if (chatToSelect) { + // first clear the chatToSelect property in case we need to + // force adding the chat to the list and the layout changes + var toselect = chatToSelect; + chatToSelect = null; + selectChat(toselect, true); + } + } - onChatClicked: (chat) => {selectChat(chat)} - - signal markAllAsRead() - signal chatClicked(ChatGui chat) + onChatClicked: chat => { + selectChat(chat); + } - model: ChatProxy { - id: chatProxy - filterText: mainItem.searchText - onFilterTextChanged: { - chatToSelectLater = currentChatGui - } - onModelAboutToBeReset: { - loading = true - } - onModelReset: { - loading = false - if (mainItem.chatToSelectLater) { - selectChat(mainItem.chatToSelectLater) - mainItem.chatToSelectLater = null - } - else if (mainItem.chatToSelect) { - selectChat(mainItem.chatToSelect) - mainItem.chatToSelect = null - } else { - selectChat(mainItem.currentChatGui) - } - } - onChatAdded: (chat) => { - mainItem.chatToSelect = chat - } - onRowsRemoved: { - var index = mainItem.currentIndex - mainItem.currentIndex = -1 - mainItem.currentIndex = index - } - onLayoutChanged: { - loading = false - if (mainItem.chatToSelectLater) { - selectChat(mainItem.chatToSelectLater) - mainItem.chatToSelectLater = null - } - else if (mainItem.chatToSelect) { - selectChat(mainItem.chatToSelect) - mainItem.chatToSelect = null - } - else { - selectChat(mainItem.currentChatGui) - } - } - } - // flickDeceleration: 10000 - spacing: Utils.getSizeWithScreenRatio(10) + signal markAllAsRead + signal chatClicked(ChatGui chat) - function selectChat(chatGui, force) { - var index = chatProxy.findChatIndex(chatGui) - // force adding chat to list if it already exists - // but has not been added to the list yet because - // it is empty and hide_empty_chatrooms is set - if (index === -1 && force === true && chatGui) { - if (chatProxy.addChatInList(chatGui)) { - var index = chatProxy.findChatIndex(chatGui) - } - } - mainItem.currentIndex = index - } + model: ChatProxy { + id: chatProxy + filterText: mainItem.searchText + onFilterTextChanged: { + chatToSelectLater = currentChatGui; + } + onModelAboutToBeReset: { + loading = true; + } + onModelReset: { + loading = false; + if (mainItem.chatToSelectLater) { + selectChat(mainItem.chatToSelectLater); + mainItem.chatToSelectLater = null; + } else if (mainItem.chatToSelect) { + selectChat(mainItem.chatToSelect); + mainItem.chatToSelect = null; + } else { + selectChat(mainItem.currentChatGui); + } + } + onChatAdded: chat => { + mainItem.chatToSelect = chat; + } + onRowsRemoved: { + var index = mainItem.currentIndex; + mainItem.currentIndex = -1; + mainItem.currentIndex = index; + } + onLayoutChanged: { + loading = false; + if (mainItem.chatToSelectLater) { + selectChat(mainItem.chatToSelectLater); + mainItem.chatToSelectLater = null; + } else if (mainItem.chatToSelect) { + selectChat(mainItem.chatToSelect); + mainItem.chatToSelect = null; + } else { + selectChat(mainItem.currentChatGui); + } + } + } + // flickDeceleration: 10000 + spacing: Utils.getSizeWithScreenRatio(10) - // remove binding loop - onContentHeightChanged: Qt.callLater(function () { - if (mainItem) - mainItem.cacheBuffer = Math?.max(contentHeight, 0) || 0 - }) + function selectChat(chatGui, force) { + var index = chatProxy.findChatIndex(chatGui); + // force adding chat to list if it already exists + // but has not been added to the list yet because + // it is empty and hide_empty_chatrooms is set + if (index === -1 && force === true && chatGui) { + if (chatProxy.addChatInList(chatGui)) { + var index = chatProxy.findChatIndex(chatGui); + } + } + mainItem.currentIndex = index; + } - onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0) - currentIndex = 0 + // remove binding loop + onContentHeightChanged: Qt.callLater(function () { + if (mainItem) + mainItem.cacheBuffer = Math?.max(contentHeight, 0) || 0; + }) -//---------------------------------------------------------------- - function moveToCurrentItem() { - if (mainItem.currentIndex >= 0) - Utils.updatePosition(mainItem, mainItem) - } - onCurrentItemChanged: { - moveToCurrentItem() - } - // Update position only if we are moving to current item and its position is changing. - property var _currentItemY: currentItem?.y - on_CurrentItemYChanged: if (_currentItemY && moveAnimation.running) { - moveToCurrentItem() - } - Behavior on contentY { - NumberAnimation { - id: moveAnimation - duration: 500 - easing.type: Easing.OutExpo - alwaysRunToEnd: true - } - } + onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0) + currentIndex = 0 -// //---------------------------------------------------------------- + //---------------------------------------------------------------- + function moveToCurrentItem() { + if (mainItem.currentIndex >= 0) + Utils.updatePosition(mainItem, mainItem); + } + onCurrentItemChanged: { + moveToCurrentItem(); + } + // Update position only if we are moving to current item and its position is changing. + property var _currentItemY: currentItem?.y + on_CurrentItemYChanged: if (_currentItemY && moveAnimation.running) { + moveToCurrentItem(); + } + Behavior on contentY { + NumberAnimation { + id: moveAnimation + duration: 500 + easing.type: Easing.OutExpo + alwaysRunToEnd: true + } + } - BusyIndicator { - anchors.horizontalCenter: mainItem.horizontalCenter - visible: mainItem.loading - height: visible ? mainItem.busyIndicatorSize : 0 - width: mainItem.busyIndicatorSize - indicatorHeight: mainItem.busyIndicatorSize - indicatorWidth: mainItem.busyIndicatorSize - indicatorColor: DefaultStyle.main1_500_main - } + // //---------------------------------------------------------------- - // Qt bug: sometimes, containsMouse may not be send and update on each MouseArea. - // So we need to use this variable to switch off all hovered items. - property int lastMouseContainsIndex: -1 + BusyIndicator { + anchors.horizontalCenter: mainItem.horizontalCenter + visible: mainItem.loading + height: visible ? mainItem.busyIndicatorSize : 0 + width: mainItem.busyIndicatorSize + indicatorHeight: mainItem.busyIndicatorSize + indicatorWidth: mainItem.busyIndicatorSize + indicatorColor: DefaultStyle.main1_500_main + } - delegate: FocusScope { - visible: !mainItem.loading - width: mainItem.width - height: Utils.getSizeWithScreenRatio(63) - Connections { - target: mainItem - function onMarkAllAsRead() {modelData.core.lMarkAsRead()} - } - RowLayout { - z: 1 - anchors.fill: parent - 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: Utils.getSizeWithScreenRatio(45) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - // isConference: modelData.core.isConference - shadowEnabled: false - asynchronous: false - } - ColumnLayout { - Layout.fillHeight: true - Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(5) - Text { - id: friendAddress - Layout.fillWidth: true - maximumLineCount: 1 - text: modelData ? modelData.core.title : "" - textFormat: Text.PlainText - color: DefaultStyle.main2_800 - font { - pixelSize: Typography.p1.pixelSize - weight: unreadCount.unread > 0 ? Typography.p2.weight : Typography.p1.weight - } - } - - RowLayout { - spacing: Utils.getSizeWithScreenRatio(5) + // Qt bug: sometimes, containsMouse may not be send and update on each MouseArea. + // So we need to use this variable to switch off all hovered items. + property int lastMouseContainsIndex: -1 + + delegate: FocusScope { + visible: !mainItem.loading + width: mainItem.width + height: Utils.getSizeWithScreenRatio(63) + Connections { + target: mainItem + function onMarkAllAsRead() { + modelData.core.lMarkAsRead(); + } + } + RowLayout { + z: 1 + anchors.fill: parent + 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: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + // isConference: modelData.core.isConference + shadowEnabled: false + asynchronous: false + } + ColumnLayout { + Layout.fillHeight: true + Layout.fillWidth: true + spacing: Utils.getSizeWithScreenRatio(5) + Text { + id: friendAddress Layout.fillWidth: true - + maximumLineCount: 1 + text: modelData ? modelData.core.title : "" + textFormat: Text.PlainText + color: DefaultStyle.main2_800 + font { + pixelSize: Typography.p1.pixelSize + weight: unreadCount.unread > 0 ? Typography.p2.weight : Typography.p1.weight + } + } + + RowLayout { + spacing: Utils.getSizeWithScreenRatio(5) + Layout.fillWidth: true + EffectImage { - visible: modelData != undefined && modelData.core.lastMessage && modelData.core.lastMessage.core.isReply && !remoteComposingInfo.visible + visible: modelData != undefined && modelData.core.lastMessage && modelData.core.lastMessage.core.isReply && + !remoteComposingInfo.visible fillMode: Image.PreserveAspectFit imageSource: AppIcons.reply - colorizationColor: DefaultStyle.main2_500 + colorizationColor: DefaultStyle.main2_500 Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) } - + EffectImage { - visible: modelData != undefined && modelData.core.lastMessage && modelData.core.lastMessage.core.isForward && !remoteComposingInfo.visible + visible: modelData != undefined && modelData.core.lastMessage && modelData.core.lastMessage.core.isForward && + !remoteComposingInfo.visible fillMode: Image.PreserveAspectFit imageSource: AppIcons.forward colorizationColor: DefaultStyle.main2_500 Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) } - + EffectImage { - visible: modelData != undefined && modelData.core.lastMessage && modelData.core.lastMessage.core.hasFileContent && !remoteComposingInfo.visible + visible: modelData != undefined && modelData.core.lastMessage && modelData.core.lastMessage.core.hasFileContent + && !remoteComposingInfo.visible fillMode: Image.PreserveAspectFit imageSource: AppIcons.paperclip colorizationColor: DefaultStyle.main2_500 Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) } - + EffectImage { - visible: modelData != undefined && modelData.core.lastMessage && modelData.core.lastMessage.core.isVoiceRecording && !remoteComposingInfo.visible + visible: modelData != undefined && modelData.core.lastMessage && modelData.core.lastMessage.core.isVoiceRecording + && !remoteComposingInfo.visible fillMode: Image.PreserveAspectFit imageSource: AppIcons.waveform colorizationColor: DefaultStyle.main2_500 Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) } - + EffectImage { - visible: modelData != undefined && modelData.core.lastMessage && modelData.core.lastMessage.core.isCalendarInvite && !remoteComposingInfo.visible + visible: modelData != undefined && modelData.core.lastMessage && modelData.core.lastMessage.core.isCalendarInvite + && !remoteComposingInfo.visible fillMode: Image.PreserveAspectFit imageSource: AppIcons.calendarBlank colorizationColor: DefaultStyle.main2_500 Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) } - + Text { id: lastMessageText Layout.fillWidth: true @@ -258,207 +264,195 @@ ListView { font { pixelSize: Typography.p3.pixelSize weight: Typography.p3.weight - italic: modelData?.core.sendingText !== "" + italic: modelData?.core.sendingText !== "" } //: %1 is writing… - text: modelData - ? modelData.core.composingName !== "" - ? qsTr("chat_message_is_writing_info").arg(modelData.core.composingName) - : modelData.core.sendingText !== "" - ? qsTr("chat_message_draft_sending_text").arg(modelData.core.sendingText) - : "" - : "" + text: modelData ? modelData.core.composingName !== "" ? qsTr("chat_message_is_writing_info").arg( + modelData.core.composingName) : modelData.core.sendingText !== "" ? qsTr( + "chat_message_draft_sending_text").arg(modelData.core.sendingText) : "" : "" } - } - } - ColumnLayout { - Layout.alignment: Qt.AlignRight - RowLayout { - Item{Layout.fillWidth: true} - Text { - color: DefaultStyle.main2_500_main - property string format: modelData && UtilsCpp.isCurrentYear(modelData.core.lastUpdatedTime) ? "dd/MM" : "dd/MM/yy" - text: modelData ? UtilsCpp.formatDate(modelData.core.lastUpdatedTime, true, false, format) : "" - font { - pixelSize: Typography.p3.pixelSize - weight: Typography.p3.weight - capitalization: Font.Capitalize - } - } - } + } + } + ColumnLayout { + Layout.alignment: Qt.AlignRight + RowLayout { + Item { + Layout.fillWidth: true + } + Text { + color: DefaultStyle.main2_500_main + property string format: modelData && UtilsCpp.isCurrentYear(modelData.core.lastUpdatedTime) ? "dd/MM" : "dd/MM/yy" + text: modelData ? UtilsCpp.formatDate(modelData.core.lastUpdatedTime, true, false, format) : "" + font { + pixelSize: Typography.p3.pixelSize + weight: Typography.p3.weight + capitalization: Font.Capitalize + } + } + } - RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) - Item {Layout.fillWidth: true} + RowLayout { + spacing: Utils.getSizeWithScreenRatio(10) + Item { + Layout.fillWidth: true + } EffectImage { visible: modelData?.core.ephemeralEnabled || false - Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 - Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) - colorizationColor: DefaultStyle.main2_400 - imageSource: AppIcons.clockCountDown - } + 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.isEncrypted && AppCpp.currentAccount + && AppCpp.currentAccount.core.limeServerUrl !== "" && AppCpp.currentAccount.core.conferenceFactoryAddress + !== "" + 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.isEncrypted && AppCpp.currentAccount && AppCpp.currentAccount.core.limeServerUrl !== "" && AppCpp.currentAccount.core.conferenceFactoryAddress !== "" - 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 ? Utils.getSizeWithScreenRatio(14) : 0 - Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) - colorizationColor: DefaultStyle.main2_400 - imageSource: AppIcons.bellSlash - } + Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) + colorizationColor: DefaultStyle.main2_400 + imageSource: AppIcons.bellSlash + } UnreadNotification { - id: unreadCount - Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) - unread: modelData?.core.unreadMessagesCount || false - } - EffectImage { - visible: modelData?.core.lastMessage && modelData?.core.lastMessageState !== LinphoneEnums.ChatMessageState.StateIdle - && !modelData.core.lastMessage.core.isRemoteMessage || false - 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 - ? AppIcons.envelope - : modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDeliveredToUser - ? AppIcons.check - : modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateNotDelivered - ? AppIcons.warningCircle - : modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDisplayed - ? AppIcons.checks - : "" - : "" - } - } - } - PopupButton { - id: chatroomPopup - // z: 1 - popup.x: 0 - popup.padding: Utils.getSizeWithScreenRatio(10) - visible: mouseArea.containsMouse || hovered || popup.opened - enabled: visible - popup.contentItem: ColumnLayout { + id: unreadCount + Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) + unread: modelData?.core.unreadMessagesCount || false + } + EffectImage { + visible: modelData?.core.lastMessage && modelData?.core.lastMessageState + !== LinphoneEnums.ChatMessageState.StateIdle && !modelData.core.lastMessage.core.isRemoteMessage || false + 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 + ? AppIcons.envelope : modelData.core.lastMessageState + === LinphoneEnums.ChatMessageState.StateDeliveredToUser ? AppIcons.check : + modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateNotDelivered + ? AppIcons.warningCircle : modelData.core.lastMessageState + === LinphoneEnums.ChatMessageState.StateDisplayed ? AppIcons.checks : "" : "" + } + } + } + PopupButton { + id: chatroomPopup + // z: 1 + popup.x: 0 + popup.padding: Utils.getSizeWithScreenRatio(10) + visible: mouseArea.containsMouse || hovered || popup.opened + enabled: visible + popup.contentItem: ColumnLayout { IconLabelButton { - //: "Mute" - text: modelData - ? modelData.core.muted - ? qsTr("chat_room_unmute") - : qsTr("chat_room_mute") - : "" + //: "Mute" + text: modelData ? modelData.core.muted ? qsTr("chat_room_unmute") : qsTr("chat_room_mute") : "" icon.source: modelData ? modelData.core.muted ? AppIcons.bell : AppIcons.bellSlash : "" - spacing: Utils.getSizeWithScreenRatio(10) - Layout.fillWidth: true - onClicked: { - modelData.core.muted = !modelData.core.muted - chatroomPopup.close() + spacing: Utils.getSizeWithScreenRatio(10) + Layout.fillWidth: true + onClicked: { + modelData.core.muted = !modelData.core.muted; + chatroomPopup.close(); } - } - IconLabelButton { - visible: modelData && modelData.core.unreadMessagesCount !== 0 || false - //: "Mark as read" - text: qsTr("chat_room_mark_as_read") - icon.source: AppIcons.checks - spacing: Utils.getSizeWithScreenRatio(10) - Layout.fillWidth: true - onClicked: { - modelData.core.lMarkAsRead() - chatroomPopup.close() - } - } - ColumnLayout { - spacing: parent.spacing - visible: modelData && !modelData.core.isReadOnly && modelData.core.isGroupChat || false - Rectangle { - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) - color: DefaultStyle.main2_400 - } - IconLabelButton { - //: "leave" - text: qsTr("chat_room_leave") - icon.source: AppIcons.trashCan - spacing: Utils.getSizeWithScreenRatio(10) - Layout.fillWidth: true - onClicked: { - //: leave the conversation ? - mainWindow.showConfirmationLambdaPopup(qsTr("chat_list_leave_chat_popup_title"), - //: You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? - qsTr("chat_list_leave_chat_popup_message"), - "", - function(confirmed) { - if (confirmed) { - modelData.core.lLeave() - chatroomPopup.close() - } - }) - } - style: ButtonStyle.hoveredBackground - } - } - Rectangle { - visible: deleteButton.visible - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) - color: DefaultStyle.main2_400 - } - IconLabelButton { - id: deleteButton - //: "Delete" - text: qsTr("chat_room_delete") - icon.source: AppIcons.trashCan - spacing: Utils.getSizeWithScreenRatio(10) - Layout.fillWidth: true - onClicked: { - //: Delete the conversation ? - mainWindow.showConfirmationLambdaPopup(qsTr("chat_list_delete_chat_popup_title"), - //: This conversation and all its messages will be deleted. Do You want to continue ? - qsTr("chat_list_delete_chat_popup_message"), - "", - function(confirmed) { - if (confirmed) { - modelData.core.lDelete() - chatroomPopup.close() - } - }) - } - style: ButtonStyle.hoveredBackgroundRed - } - } - } - - } - MouseArea { - id: mouseArea - hoverEnabled: true - anchors.fill: parent - acceptedButtons: Qt.RightButton | Qt.LeftButton - onContainsMouseChanged: { - if (containsMouse) - mainItem.lastMouseContainsIndex = index - else if (mainItem.lastMouseContainsIndex == index) - mainItem.lastMouseContainsIndex = -1 - } - Rectangle { - anchors.fill: parent - opacity: 0.7 - radius: Utils.getSizeWithScreenRatio(8) - color: mainItem.currentIndex === index ? DefaultStyle.main2_200 : DefaultStyle.main2_100 - visible: mainItem.lastMouseContainsIndex === index || mainItem.currentIndex === index - } - onPressed: { - if (pressedButtons & Qt.RightButton) { - chatroomPopup.open() - } else { - mainItem.chatClicked(modelData) - } - } - } - } + } + IconLabelButton { + visible: modelData && modelData.core.unreadMessagesCount !== 0 || false + //: "Mark as read" + text: qsTr("chat_room_mark_as_read") + icon.source: AppIcons.checks + spacing: Utils.getSizeWithScreenRatio(10) + Layout.fillWidth: true + onClicked: { + modelData.core.lMarkAsRead(); + chatroomPopup.close(); + } + } + ColumnLayout { + spacing: parent.spacing + visible: modelData && !modelData.core.isReadOnly && modelData.core.isGroupChat || false + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) + color: DefaultStyle.main2_400 + } + IconLabelButton { + //: "leave" + text: qsTr("chat_room_leave") + icon.source: AppIcons.trashCan + spacing: Utils.getSizeWithScreenRatio(10) + Layout.fillWidth: true + onClicked: { + //: leave the conversation ? + mainWindow.showConfirmationLambdaPopup(qsTr("chat_list_leave_chat_popup_title"), + //: You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? + qsTr("chat_list_leave_chat_popup_message"), "", function (confirmed) { + if (confirmed) { + modelData.core.lLeave(); + chatroomPopup.close(); + } + }); + } + style: ButtonStyle.hoveredBackground + } + } + Rectangle { + visible: deleteButton.visible + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) + color: DefaultStyle.main2_400 + } + IconLabelButton { + id: deleteButton + //: "Delete" + text: qsTr("chat_room_delete") + icon.source: AppIcons.trashCan + spacing: Utils.getSizeWithScreenRatio(10) + Layout.fillWidth: true + onClicked: { + //: Delete the conversation ? + mainWindow.showConfirmationLambdaPopup(qsTr("chat_list_delete_chat_popup_title"), + //: This conversation and all its messages will be deleted. Do You want to continue ? + qsTr("chat_list_delete_chat_popup_message"), "", function (confirmed) { + if (confirmed) { + modelData.core.lDelete(); + chatroomPopup.close(); + } + }); + } + style: ButtonStyle.hoveredBackgroundRed + } + } + } + } + MouseArea { + id: mouseArea + hoverEnabled: true + anchors.fill: parent + acceptedButtons: Qt.RightButton | Qt.LeftButton + onContainsMouseChanged: { + if (containsMouse) + mainItem.lastMouseContainsIndex = index; + else if (mainItem.lastMouseContainsIndex == index) + mainItem.lastMouseContainsIndex = -1; + } + Rectangle { + anchors.fill: parent + opacity: 0.7 + radius: Utils.getSizeWithScreenRatio(8) + color: mainItem.currentIndex === index ? DefaultStyle.main2_200 : DefaultStyle.main2_100 + visible: mainItem.lastMouseContainsIndex === index || mainItem.currentIndex === index + } + onPressed: { + if (pressedButtons & Qt.RightButton) { + chatroomPopup.open(); + } else { + mainItem.chatClicked(modelData); + } + } + } + } } diff --git a/Linphone/view/Control/Display/Chat/ChatMessage.qml b/Linphone/view/Control/Display/Chat/ChatMessage.qml index 5de419f2a..366204fe4 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessage.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessage.qml @@ -10,451 +10,451 @@ 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.Control { - id: mainItem - property color backgroundColor - property bool isFirstMessage + id: mainItem + property color backgroundColor + property bool isFirstMessage - property ChatMessageGui chatMessage - property ChatGui chat - property string searchedTextPart - property string ownReaction: chatMessage? chatMessage.core.ownReaction : "" - property string fromAddress: chatMessage? chatMessage.core.fromAddress : "" - property bool isRemoteMessage: chatMessage? chatMessage.core.isRemoteMessage : false - property bool isFromChatGroup: chatMessage? chatMessage.core.isFromChatGroup : false - property bool isReply: chatMessage? chatMessage.core.isReply : false - property bool isForward: chatMessage? chatMessage.core.isForward : false - property string replyText: chatMessage? chatMessage.core.replyText : "" - property string replyMessageId: chatMessage? chatMessage.core.replyMessageId : "" - property var msgState: chatMessage ? chatMessage.core.messageState : LinphoneEnums.ChatMessageState.StateIdle - hoverEnabled: true - property bool linkHovered: false - property real maxWidth: parent ? parent.width : Utils.getSizeWithScreenRatio(300) + property ChatMessageGui chatMessage + property ChatGui chat + property string searchedTextPart + property string ownReaction: chatMessage ? chatMessage.core.ownReaction : "" + property string fromAddress: chatMessage ? chatMessage.core.fromAddress : "" + property bool isRemoteMessage: chatMessage ? chatMessage.core.isRemoteMessage : false + property bool isFromChatGroup: chatMessage ? chatMessage.core.isFromChatGroup : false + property bool isReply: chatMessage ? chatMessage.core.isReply : false + property bool isForward: chatMessage ? chatMessage.core.isForward : false + property string replyText: chatMessage ? chatMessage.core.replyText : "" + property string replyMessageId: chatMessage ? chatMessage.core.replyMessageId : "" + property var msgState: chatMessage ? chatMessage.core.messageState : LinphoneEnums.ChatMessageState.StateIdle + hoverEnabled: true + property bool linkHovered: false + property real maxWidth: parent ? parent.width : Utils.getSizeWithScreenRatio(300) - leftPadding: isRemoteMessage ? Utils.getSizeWithScreenRatio(5) : 0 + leftPadding: isRemoteMessage ? Utils.getSizeWithScreenRatio(5) : 0 - signal messageDeletionRequested() - signal messageEditionRequested() + signal messageDeletionRequested + signal messageEditionRequested signal isFileHoveringChanged(bool isFileHovering) - signal showReactionsForMessageRequested() - signal showImdnStatusForMessageRequested() - signal replyToMessageRequested() - signal forwardMessageRequested() - signal endOfVoiceRecordingReached() - signal requestAutoPlayVoiceRecording() - signal searchMessageByIdRequested(string id) - onRequestAutoPlayVoiceRecording: chatBubbleContent.requestAutoPlayVoiceRecording() + signal showReactionsForMessageRequested + signal showImdnStatusForMessageRequested + signal replyToMessageRequested + signal forwardMessageRequested + signal endOfVoiceRecordingReached + signal requestAutoPlayVoiceRecording + signal searchMessageByIdRequested(string id) + onRequestAutoPlayVoiceRecording: chatBubbleContent.requestAutoPlayVoiceRecording() - Timer { - id: hightlightTimer - interval: 1000 - repeat: false - onTriggered: highlightRectangle.opacity = 0 - } - function requestHighlight() { - highlightRectangle.opacity = 0.8 - hightlightTimer.start() - } + Timer { + id: hightlightTimer + interval: 1000 + repeat: false + onTriggered: highlightRectangle.opacity = 0 + } + function requestHighlight() { + highlightRectangle.opacity = 0.8; + hightlightTimer.start(); + } - background: Item { - anchors.fill: parent - } - - function handleDefaultMouseEvent(event) { + background: Item { + anchors.fill: parent + } + + function handleDefaultMouseEvent(event) { if (event.button === Qt.RightButton) { - optionsMenu.open() + optionsMenu.open(); } } - contentItem: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(5) - Text { - id: fromNameText - Layout.alignment: Qt.AlignTop - Layout.leftMargin: mainItem.isFromChatGroup ? Utils.getSizeWithScreenRatio(9) + avatar.width : 0 - visible: mainItem.isFromChatGroup && mainItem.isRemoteMessage && mainItem.isFirstMessage && !replyLayout.visible - maximumLineCount: 1 - width: implicitWidth - x: mapToItem(this, chatBubble.x, chatBubble.y).x - text: mainItem.chatMessage.core.fromName - color: DefaultStyle.main2_500_main - font { - pixelSize: Typography.p4.pixelSize - weight: Typography.p4.weight - } - } - RowLayout { - id: forwardLayout - spacing: Utils.getSizeWithScreenRatio(8) - visible: mainItem.isForward - Layout.leftMargin: mainItem.isFromChatGroup ? Utils.getSizeWithScreenRatio(9) + avatar.width : 0 - Layout.alignment: mainItem.isRemoteMessage ? Qt.AlignLeft: Qt.AlignRight - EffectImage { - imageSource: AppIcons.forward - colorizationColor: DefaultStyle.main2_500_main - Layout.preferredWidth: Utils.getSizeWithScreenRatio(12) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(12) - } - Text { - //: Forwarded - text: qsTr("chat_message_forwarded") - color: DefaultStyle.main2_600 - font { - pixelSize: Typography.p4.pixelSize - weight: Typography.p4.weight - } - } - } - RowLayout { - id: replyLayout - visible: mainItem.isReply - Layout.leftMargin: mainItem.isFromChatGroup ? Utils.getSizeWithScreenRatio(9) + avatar.width : 0 - layoutDirection: mainItem.isRemoteMessage ? Qt.LeftToRight : Qt.RightToLeft - ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(5) - RowLayout { - id: replyLabel - spacing: Utils.getSizeWithScreenRatio(8) - Layout.fillWidth: false - Layout.alignment: mainItem.isRemoteMessage ? Qt.AlignLeft : Qt.AlignRight - EffectImage { - imageSource: AppIcons.reply - colorizationColor: DefaultStyle.main2_500_main - Layout.preferredWidth: Utils.getSizeWithScreenRatio(12) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(12) - } - Text { - Layout.alignment: mainItem.isRemoteMessage ? Qt.AlignLeft: Qt.AlignRight - text: mainItem.isRemoteMessage - ? mainItem.chatMessage.core.repliedToName !== "" - //: %1 replied to %2 - ? qsTr("chat_message_remote_replied_to").arg(mainItem.chatMessage.core.fromName).arg(mainItem.chatMessage.core.repliedToName) - //: %1 replied - : qsTr("chat_message_remote_replied").arg(mainItem.chatMessage.core.fromName) - : mainItem.chatMessage.core.repliedToName !== "" - //: You replied to %1 - ? qsTr("chat_message_user_replied_to").arg(mainItem.chatMessage.core.repliedToName) - //: You replied - : qsTr("chat_message_user_replied") - color: DefaultStyle.main2_600 - font { - pixelSize: Typography.p4.pixelSize - weight: Typography.p4.weight - } - } - } - Control.Control { - id: replyMessage - visible: mainItem.replyText !== "" - Layout.alignment: mainItem.isRemoteMessage ? Qt.AlignLeft : Qt.AlignRight - spacing: Utils.getSizeWithScreenRatio(5) - topPadding: Utils.getSizeWithScreenRatio(12) - bottomPadding: Utils.getSizeWithScreenRatio(19) - leftPadding: Utils.getSizeWithScreenRatio(18) - rightPadding: Utils.getSizeWithScreenRatio(18) - Layout.preferredWidth: Math.min(implicitWidth, mainItem.maxWidth - avatar.implicitWidth) - background: Rectangle { - anchors.fill: parent - color: DefaultStyle.grey_200 - radius: Utils.getSizeWithScreenRatio(16) - MouseArea { - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onClicked: { - mainItem.searchMessageByIdRequested(mainItem.replyMessageId) - } - } - } - contentItem: Text { - Layout.fillWidth: true - text: mainItem.replyText - color: DefaultStyle.main2_800 - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } - } - } - } - Item{Layout.fillWidth: true} - } - RowLayout { - id: bubbleLayout - z: replyLayout.z + 1 - spacing: 0 - layoutDirection: mainItem.isRemoteMessage ? Qt.LeftToRight : Qt.RightToLeft - Layout.topMargin: replyMessage.visible ? Utils.getSizeWithScreenRatio(-20) : 0 + contentItem: ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(5) + Text { + id: fromNameText + Layout.alignment: Qt.AlignTop + Layout.leftMargin: mainItem.isFromChatGroup ? Utils.getSizeWithScreenRatio(9) + avatar.width : 0 + visible: mainItem.isFromChatGroup && mainItem.isRemoteMessage && mainItem.isFirstMessage && !replyLayout.visible + maximumLineCount: 1 + width: implicitWidth + x: mapToItem(this, chatBubble.x, chatBubble.y).x + text: mainItem.chatMessage.core.fromName + color: DefaultStyle.main2_500_main + font { + pixelSize: Typography.p4.pixelSize + weight: Typography.p4.weight + } + } + RowLayout { + id: forwardLayout + spacing: Utils.getSizeWithScreenRatio(8) + visible: mainItem.isForward + Layout.leftMargin: mainItem.isFromChatGroup ? Utils.getSizeWithScreenRatio(9) + avatar.width : 0 + Layout.alignment: mainItem.isRemoteMessage ? Qt.AlignLeft : Qt.AlignRight + EffectImage { + imageSource: AppIcons.forward + colorizationColor: DefaultStyle.main2_500_main + Layout.preferredWidth: Utils.getSizeWithScreenRatio(12) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(12) + } + Text { + //: Forwarded + text: qsTr("chat_message_forwarded") + color: DefaultStyle.main2_600 + font { + pixelSize: Typography.p4.pixelSize + weight: Typography.p4.weight + } + } + } + RowLayout { + id: replyLayout + visible: mainItem.isReply + Layout.leftMargin: mainItem.isFromChatGroup ? Utils.getSizeWithScreenRatio(9) + avatar.width : 0 + layoutDirection: mainItem.isRemoteMessage ? Qt.LeftToRight : Qt.RightToLeft + ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(5) + RowLayout { + id: replyLabel + spacing: Utils.getSizeWithScreenRatio(8) + Layout.fillWidth: false + Layout.alignment: mainItem.isRemoteMessage ? Qt.AlignLeft : Qt.AlignRight + EffectImage { + imageSource: AppIcons.reply + colorizationColor: DefaultStyle.main2_500_main + Layout.preferredWidth: Utils.getSizeWithScreenRatio(12) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(12) + } + Text { + Layout.alignment: mainItem.isRemoteMessage ? Qt.AlignLeft : Qt.AlignRight + text: mainItem.isRemoteMessage ? mainItem.chatMessage.core.repliedToName !== "" ? + //: %1 replied to %2 + qsTr("chat_message_remote_replied_to").arg(mainItem.chatMessage.core.fromName).arg( + mainItem.chatMessage.core.repliedToName) : + //: %1 replied + qsTr("chat_message_remote_replied").arg(mainItem.chatMessage.core.fromName) : + mainItem.chatMessage.core.repliedToName !== "" ? + //: You replied to %1 + qsTr("chat_message_user_replied_to").arg(mainItem.chatMessage.core.repliedToName) : + //: You replied + qsTr("chat_message_user_replied") + color: DefaultStyle.main2_600 + font { + pixelSize: Typography.p4.pixelSize + weight: Typography.p4.weight + } + } + } + Control.Control { + id: replyMessage + visible: mainItem.replyText !== "" + Layout.alignment: mainItem.isRemoteMessage ? Qt.AlignLeft : Qt.AlignRight + spacing: Utils.getSizeWithScreenRatio(5) + topPadding: Utils.getSizeWithScreenRatio(12) + bottomPadding: Utils.getSizeWithScreenRatio(19) + leftPadding: Utils.getSizeWithScreenRatio(18) + rightPadding: Utils.getSizeWithScreenRatio(18) + Layout.preferredWidth: Math.min(implicitWidth, mainItem.maxWidth - avatar.implicitWidth) + background: Rectangle { + anchors.fill: parent + color: DefaultStyle.grey_200 + radius: Utils.getSizeWithScreenRatio(16) + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + mainItem.searchMessageByIdRequested(mainItem.replyMessageId); + } + } + } + contentItem: Text { + Layout.fillWidth: true + text: mainItem.replyText + color: DefaultStyle.main2_800 + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + } + } + } + Item { + Layout.fillWidth: true + } + } + RowLayout { + id: bubbleLayout + z: replyLayout.z + 1 + spacing: 0 + layoutDirection: mainItem.isRemoteMessage ? Qt.LeftToRight : Qt.RightToLeft + Layout.topMargin: replyMessage.visible ? Utils.getSizeWithScreenRatio(-20) : 0 - Avatar { - id: avatar - visible: mainItem.isFromChatGroup && mainItem.isRemoteMessage - Layout.preferredWidth: mainItem.isRemoteMessage ? 26 : 0 - Layout.preferredHeight: 26 - Layout.alignment: Qt.AlignTop - _address: chatMessage ? chatMessage.core.fromAddress : "" - } - Item { - id: bubbleContainer - // Layout.topMargin: isFirstMessage ? 16 : 0 - Layout.leftMargin: mainItem.isFromChatGroup ? Utils.getSizeWithScreenRatio(9) : 0 - Layout.preferredHeight: childrenRect.height - Layout.preferredWidth: childrenRect.width + Avatar { + id: avatar + visible: mainItem.isFromChatGroup && mainItem.isRemoteMessage + Layout.preferredWidth: mainItem.isRemoteMessage ? 26 : 0 + Layout.preferredHeight: 26 + Layout.alignment: Qt.AlignTop + _address: chatMessage ? chatMessage.core.fromAddress : "" + } + Item { + id: bubbleContainer + // Layout.topMargin: isFirstMessage ? 16 : 0 + Layout.leftMargin: mainItem.isFromChatGroup ? Utils.getSizeWithScreenRatio(9) : 0 + Layout.preferredHeight: childrenRect.height + Layout.preferredWidth: childrenRect.width - Control.Control { - id: chatBubble - spacing: Utils.getSizeWithScreenRatio(2) - topPadding: Utils.getSizeWithScreenRatio(12) - bottomPadding: Utils.getSizeWithScreenRatio(6) - leftPadding: Utils.getSizeWithScreenRatio(18) - rightPadding: Utils.getSizeWithScreenRatio(18) - width: Math.min(implicitWidth, mainItem.maxWidth - avatar.implicitWidth) + Control.Control { + id: chatBubble + spacing: Utils.getSizeWithScreenRatio(2) + topPadding: Utils.getSizeWithScreenRatio(12) + bottomPadding: Utils.getSizeWithScreenRatio(6) + leftPadding: Utils.getSizeWithScreenRatio(18) + rightPadding: Utils.getSizeWithScreenRatio(18) + width: Math.min(implicitWidth, mainItem.maxWidth - avatar.implicitWidth) - MouseArea { // Default mouse area. Each sub bubble can control the mouse and pass on to the main mouse handler. Child bubble mouse area must cover the entire bubble. - id: defaultMouseArea - // visible: invitationLoader.status !== Loader.Ready // Add other bubbles here that could control the mouse themselves, then add in bubble a signal onMouseEvent - anchors.fill: parent - acceptedButtons: Qt.RightButton - onClicked: (mouse) => mainItem.handleDefaultMouseEvent(mouse) - } - - background: Item { - anchors.fill: parent - Rectangle { - anchors.fill: parent - color: mainItem.backgroundColor - radius: Utils.getSizeWithScreenRatio(16) - } - Rectangle { - visible: mainItem.isFirstMessage && mainItem.isRemoteMessage - anchors.top: parent.top - anchors.left: parent.left - width: Utils.getSizeWithScreenRatio(parent.width / 4) - height: Utils.getSizeWithScreenRatio(parent.height / 4) - color: mainItem.backgroundColor - } - Rectangle { - visible: mainItem.isFirstMessage && !mainItem.isRemoteMessage - anchors.bottom: parent.bottom - anchors.right: parent.right - width: Utils.getSizeWithScreenRatio(parent.width / 4) - height: Utils.getSizeWithScreenRatio(parent.height / 4) - color: mainItem.backgroundColor - } - Rectangle { - id: highlightRectangle - anchors.fill: parent - radius: Utils.getSizeWithScreenRatio(16) - color: Qt.lighter(mainItem.backgroundColor, 2) - border.color: mainItem.backgroundColor - border.width: Utils.getSizeWithScreenRatio(2) - opacity: 0 - Behavior on opacity { - NumberAnimation { - duration: 300 - easing.type: Easing.InOutQuad - } - } - } - } - contentItem: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(5) - Text { - id: retractedId - visible: mainItem.chatMessage.core.isRetracted - font: Typography.p1i - color: DefaultStyle.info_800_main - Layout.fillWidth: true - Layout.fillHeight: true - text: mainItem.chatMessage.core.text - } - ChatMessageContent { - id: chatBubbleContent - Layout.fillWidth: true - Layout.fillHeight: true - chatGui: mainItem.chat - visible: !mainItem.chatMessage.core.isRetracted - searchedTextPart: mainItem.searchedTextPart - chatMessageGui: mainItem.chatMessage - maxWidth: mainItem.maxWidth - onMouseEvent: (event) => { - mainItem.handleDefaultMouseEvent(event) - } - onEndOfVoiceRecordingReached: mainItem.endOfVoiceRecordingReached() - } - RowLayout { - Layout.preferredHeight: childrenRect.height - Layout.alignment: mainItem.isRemoteMessage ? Qt.AlignLeft : Qt.AlignRight - layoutDirection: mainItem.isRemoteMessage ? Qt.RightToLeft : Qt.LeftToRight - spacing: Utils.getSizeWithScreenRatio(7) - RowLayout { - spacing: Utils.getSizeWithScreenRatio(3) - Layout.preferredHeight: childrenRect.height - Text { - id: ephemeralTime - visible: mainItem.chatMessage.core.isEphemeral - color: DefaultStyle.main2_500_main - text: UtilsCpp.formatDuration(mainItem.chatMessage.core.ephemeralDuration * 1000) - font { - pixelSize: Typography.p3.pixelSize - weight: Typography.p3.weight - } - } - EffectImage { - visible: mainItem.chatMessage.core.isEphemeral - imageSource: AppIcons.clockCountDown - colorizationColor: DefaultStyle.main2_500_main - Layout.preferredWidth: visible ? 14 : 0 - Layout.preferredHeight: visible ? 14 : 0 - } - } - RowLayout { - spacing: mainItem.isRemoteMessage && !mainItem.chatMessage.core.isEdited ? 0 : Utils.getSizeWithScreenRatio(5) - Layout.alignment: Qt.AlignVCenter - Layout.preferredHeight: childrenRect.height - Text { - Layout.alignment: Qt.AlignVCenter - text: qsTr("conversation_message_edited_label") - visible: mainItem.chatMessage.core.isEdited - color: DefaultStyle.main2_500_main - font { + MouseArea { // Default mouse area. Each sub bubble can control the mouse and pass on to the main mouse handler. Child bubble mouse area must cover the entire bubble. + id: defaultMouseArea + // visible: invitationLoader.status !== Loader.Ready // Add other bubbles here that could control the mouse themselves, then add in bubble a signal onMouseEvent + anchors.fill: parent + acceptedButtons: Qt.RightButton + onClicked: mouse => mainItem.handleDefaultMouseEvent(mouse) + } + + background: Item { + anchors.fill: parent + Rectangle { + anchors.fill: parent + color: mainItem.backgroundColor + radius: Utils.getSizeWithScreenRatio(16) + } + Rectangle { + visible: mainItem.isFirstMessage && mainItem.isRemoteMessage + anchors.top: parent.top + anchors.left: parent.left + width: Utils.getSizeWithScreenRatio(parent.width / 4) + height: Utils.getSizeWithScreenRatio(parent.height / 4) + color: mainItem.backgroundColor + } + Rectangle { + visible: mainItem.isFirstMessage && !mainItem.isRemoteMessage + anchors.bottom: parent.bottom + anchors.right: parent.right + width: Utils.getSizeWithScreenRatio(parent.width / 4) + height: Utils.getSizeWithScreenRatio(parent.height / 4) + color: mainItem.backgroundColor + } + Rectangle { + id: highlightRectangle + anchors.fill: parent + radius: Utils.getSizeWithScreenRatio(16) + color: Qt.lighter(mainItem.backgroundColor, 2) + border.color: mainItem.backgroundColor + border.width: Utils.getSizeWithScreenRatio(2) + opacity: 0 + Behavior on opacity { + NumberAnimation { + duration: 300 + easing.type: Easing.InOutQuad + } + } + } + } + contentItem: ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(5) + Text { + id: retractedId + visible: mainItem.chatMessage.core.isRetracted + font: Typography.p1i + color: DefaultStyle.info_800_main + Layout.fillWidth: true + Layout.fillHeight: true + text: mainItem.chatMessage.core.text + } + ChatMessageContent { + id: chatBubbleContent + Layout.fillWidth: true + Layout.fillHeight: true + chatGui: mainItem.chat + visible: !mainItem.chatMessage.core.isRetracted + searchedTextPart: mainItem.searchedTextPart + chatMessageGui: mainItem.chatMessage + maxWidth: mainItem.maxWidth + onMouseEvent: event => { + mainItem.handleDefaultMouseEvent(event); + } + onEndOfVoiceRecordingReached: mainItem.endOfVoiceRecordingReached() + } + RowLayout { + Layout.preferredHeight: childrenRect.height + Layout.alignment: mainItem.isRemoteMessage ? Qt.AlignLeft : Qt.AlignRight + layoutDirection: mainItem.isRemoteMessage ? Qt.RightToLeft : Qt.LeftToRight + spacing: Utils.getSizeWithScreenRatio(7) + RowLayout { + spacing: Utils.getSizeWithScreenRatio(3) + Layout.preferredHeight: childrenRect.height + Text { + id: ephemeralTime + visible: mainItem.chatMessage.core.isEphemeral + color: DefaultStyle.main2_500_main + text: UtilsCpp.formatDuration(mainItem.chatMessage.core.ephemeralDuration * 1000) + font { pixelSize: Typography.p3.pixelSize weight: Typography.p3.weight - } - } - Text { - Layout.alignment: Qt.AlignVCenter - text: UtilsCpp.formatDate(mainItem.chatMessage.core.timestamp, true, false, "dd/MM") - color: DefaultStyle.main2_500_main - font { + } + } + EffectImage { + visible: mainItem.chatMessage.core.isEphemeral + imageSource: AppIcons.clockCountDown + colorizationColor: DefaultStyle.main2_500_main + Layout.preferredWidth: visible ? 14 : 0 + Layout.preferredHeight: visible ? 14 : 0 + } + } + RowLayout { + spacing: mainItem.isRemoteMessage && !mainItem.chatMessage.core.isEdited ? 0 : Utils.getSizeWithScreenRatio(5) + Layout.alignment: Qt.AlignVCenter + Layout.preferredHeight: childrenRect.height + Text { + Layout.alignment: Qt.AlignVCenter + text: qsTr("conversation_message_edited_label") + visible: mainItem.chatMessage.core.isEdited + color: DefaultStyle.main2_500_main + font { pixelSize: Typography.p3.pixelSize weight: Typography.p3.weight - } - } - EffectImage { - // Imdn status icon - visible: !mainItem.isRemoteMessage - Layout.preferredWidth: visible ? 14 : 0 - Layout.preferredHeight: visible ? 14 : 0 - Layout.alignment: Qt.AlignVCenter - colorizationColor: DefaultStyle.main1_500_main - imageSource: mainItem.msgState === LinphoneEnums.ChatMessageState.StateDelivered - ? AppIcons.envelope - : mainItem.msgState === LinphoneEnums.ChatMessageState.StateDeliveredToUser - ? AppIcons.check - : mainItem.msgState === LinphoneEnums.ChatMessageState.StateNotDelivered - ? AppIcons.warningCircle - : mainItem.msgState === LinphoneEnums.ChatMessageState.StateDisplayed - ? AppIcons.checks - : mainItem.msgState === LinphoneEnums.ChatMessageState.StatePendingDelivery - ? AppIcons.hourglass - : "" - BusyIndicator { - anchors.fill: parent - Layout.preferredWidth: visible ? 14 : 0 - Layout.preferredHeight: visible ? 14 : 0 - visible: mainItem.msgState === LinphoneEnums.ChatMessageState.StateIdle - || mainItem.msgState === LinphoneEnums.ChatMessageState.StateInProgress - || mainItem.msgState === LinphoneEnums.ChatMessageState.StateFileTransferInProgress - } - } - } - } - } - } - Button { - id: reactionsButton - visible: reactionList.count > 0 - anchors.top: chatBubble.bottom - Binding { - target: reactionsButton - when: !mainItem.isRemoteMessage - property: "anchors.left" - value: chatBubble.left - } - Binding { - target: reactionsButton - when: mainItem.isRemoteMessage - property: "anchors.right" - value: chatBubble.right - } - onClicked: mainItem.showReactionsForMessageRequested() - anchors.topMargin: Utils.getSizeWithScreenRatio(-6) - topPadding: Utils.getSizeWithScreenRatio(8) - bottomPadding: Utils.getSizeWithScreenRatio(8) - leftPadding: Utils.getSizeWithScreenRatio(8) - rightPadding: Utils.getSizeWithScreenRatio(8) - background: Rectangle { - color: DefaultStyle.grey_100 - border.color: DefaultStyle.grey_0 - border.width: Utils.getSizeWithScreenRatio(2) - radius: Utils.getSizeWithScreenRatio(20) - } - contentItem: RowLayout { - spacing: Utils.getSizeWithScreenRatio(6) - Repeater { - id: reactionList - model: mainItem.chatMessage ? mainItem.chatMessage.core.reactionsSingleton : [] - delegate: RowLayout { - spacing: Utils.getSizeWithScreenRatio(3) - Text { - text: UtilsCpp.encodeEmojiToQmlRichFormat(modelData.body) - textFormat: Text.RichText - font { - pixelSize: Utils.getSizeWithScreenRatio(15) - weight: Utils.getSizeWithScreenRatio(400) - } - } - Text { - visible: modelData.count > 1 - text: modelData.count - verticalAlignment: Text.AlignBottom - font { - pixelSize: Typography.p4.pixelSize - weight: Typography.p4.weight - } - } - } - } - } - } - } - RowLayout { - id: actionsLayout - visible: mainItem.hovered || optionsMenu.hovered || optionsMenu.popup.opened || emojiButton.hovered || emojiButton.popup.opened - Layout.leftMargin: Utils.getSizeWithScreenRatio(8) - Layout.rightMargin: Utils.getSizeWithScreenRatio(8) - Layout.alignment: Qt.AlignVCenter - // Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(7) - layoutDirection: mainItem.isRemoteMessage ? Qt.LeftToRight : Qt.RightToLeft - PopupButton { - id: optionsMenu - popup.padding: 0 - popup.contentItem: ColumnLayout { - spacing: 0 - IconLabelButton { - visible: mainItem.msgStatev === LinphoneEnums.ChatMessageState.StateNotDelivered - inverseLayout: true - //: "Re-send" - text: qsTr("chat_message_send_again") - icon.source: AppIcons.chatTeardropText - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - onClicked: { - mainItem.chatMessage.lSend() - } - } - IconLabelButton { - inverseLayout: true - //: "Reception info" - text: qsTr("chat_message_reception_info") - icon.source: AppIcons.chatTeardropText - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - onClicked: { - mainItem.showImdnStatusForMessageRequested() - optionsMenu.close() - } - } + } + } + Text { + Layout.alignment: Qt.AlignVCenter + text: UtilsCpp.formatDate(mainItem.chatMessage.core.timestamp, true, false, "dd/MM") + color: DefaultStyle.main2_500_main + font { + pixelSize: Typography.p3.pixelSize + weight: Typography.p3.weight + } + } + EffectImage { + // Imdn status icon + visible: !mainItem.isRemoteMessage + Layout.preferredWidth: visible ? 14 : 0 + Layout.preferredHeight: visible ? 14 : 0 + Layout.alignment: Qt.AlignVCenter + colorizationColor: DefaultStyle.main1_500_main + imageSource: mainItem.msgState === LinphoneEnums.ChatMessageState.StateDelivered ? AppIcons.envelope : + mainItem.msgState === LinphoneEnums.ChatMessageState.StateDeliveredToUser + ? AppIcons.check : mainItem.msgState + === LinphoneEnums.ChatMessageState.StateNotDelivered ? AppIcons.warningCircle : + mainItem.msgState === LinphoneEnums.ChatMessageState.StateDisplayed + ? AppIcons.checks : mainItem.msgState + === LinphoneEnums.ChatMessageState.StatePendingDelivery + ? AppIcons.hourglass : "" + BusyIndicator { + anchors.fill: parent + Layout.preferredWidth: visible ? 14 : 0 + Layout.preferredHeight: visible ? 14 : 0 + visible: mainItem.msgState === LinphoneEnums.ChatMessageState.StateIdle || mainItem.msgState + === LinphoneEnums.ChatMessageState.StateInProgress || mainItem.msgState + === LinphoneEnums.ChatMessageState.StateFileTransferInProgress + } + } + } + } + } + } + Button { + id: reactionsButton + visible: reactionList.count > 0 + anchors.top: chatBubble.bottom + Binding { + target: reactionsButton + when: !mainItem.isRemoteMessage + property: "anchors.left" + value: chatBubble.left + } + Binding { + target: reactionsButton + when: mainItem.isRemoteMessage + property: "anchors.right" + value: chatBubble.right + } + onClicked: mainItem.showReactionsForMessageRequested() + anchors.topMargin: Utils.getSizeWithScreenRatio(-6) + topPadding: Utils.getSizeWithScreenRatio(8) + bottomPadding: Utils.getSizeWithScreenRatio(8) + leftPadding: Utils.getSizeWithScreenRatio(8) + rightPadding: Utils.getSizeWithScreenRatio(8) + background: Rectangle { + color: DefaultStyle.grey_100 + border.color: DefaultStyle.grey_0 + border.width: Utils.getSizeWithScreenRatio(2) + radius: Utils.getSizeWithScreenRatio(20) + } + contentItem: RowLayout { + spacing: Utils.getSizeWithScreenRatio(6) + Repeater { + id: reactionList + model: mainItem.chatMessage ? mainItem.chatMessage.core.reactionsSingleton : [] + delegate: RowLayout { + spacing: Utils.getSizeWithScreenRatio(3) + Text { + text: UtilsCpp.encodeEmojiToQmlRichFormat(modelData.body) + textFormat: Text.RichText + font { + pixelSize: Utils.getSizeWithScreenRatio(15) + weight: Utils.getSizeWithScreenRatio(400) + } + } + Text { + visible: modelData.count > 1 + text: modelData.count + verticalAlignment: Text.AlignBottom + font { + pixelSize: Typography.p4.pixelSize + weight: Typography.p4.weight + } + } + } + } + } + } + } + RowLayout { + id: actionsLayout + visible: mainItem.hovered || optionsMenu.hovered || optionsMenu.popup.opened || emojiButton.hovered + || emojiButton.popup.opened + Layout.leftMargin: Utils.getSizeWithScreenRatio(8) + Layout.rightMargin: Utils.getSizeWithScreenRatio(8) + Layout.alignment: Qt.AlignVCenter + // Layout.fillWidth: true + spacing: Utils.getSizeWithScreenRatio(7) + layoutDirection: mainItem.isRemoteMessage ? Qt.LeftToRight : Qt.RightToLeft + PopupButton { + id: optionsMenu + popup.padding: 0 + popup.contentItem: ColumnLayout { + spacing: 0 + IconLabelButton { + visible: mainItem.msgStatev === LinphoneEnums.ChatMessageState.StateNotDelivered + inverseLayout: true + //: "Re-send" + text: qsTr("chat_message_send_again") + icon.source: AppIcons.chatTeardropText + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + onClicked: { + mainItem.chatMessage.lSend(); + } + } + IconLabelButton { + inverseLayout: true + //: "Reception info" + text: qsTr("chat_message_reception_info") + icon.source: AppIcons.chatTeardropText + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + onClicked: { + mainItem.showImdnStatusForMessageRequested(); + optionsMenu.close(); + } + } IconLabelButton { inverseLayout: true //: "Edit" @@ -464,124 +464,132 @@ Control.Control { Layout.fillWidth: true Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) onClicked: { - mainItem.messageEditionRequested() - optionsMenu.close() + mainItem.messageEditionRequested(); + optionsMenu.close(); } } - IconLabelButton { - inverseLayout: true + IconLabelButton { + inverseLayout: true visible: !mainItem.chatMessage.core.isRetracted - //: Reply - text: qsTr("chat_message_reply") - icon.source: AppIcons.reply - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - onClicked: { - mainItem.replyToMessageRequested() - optionsMenu.close() - } - } - IconLabelButton { - inverseLayout: true - visible: !mainItem.chatMessage.core.isRetracted - text: chatBubbleContent.selectedText != "" - //: "Copy selection" - ? qsTr("chat_message_copy_selection") - //: "Copy" - : qsTr("chat_message_copy") - icon.source: AppIcons.copy - // spacing: Utils.getSizeWithScreenRatio(10) - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - onClicked: { - var success = UtilsCpp.copyToClipboard(chatBubbleContent.selectedText != "" ? chatBubbleContent.selectedText : mainItem.chatMessage.core.text) - //: Copied - if (success) UtilsCpp.showInformationPopup(qsTr("chat_message_copied_to_clipboard_title"), - //: "to clipboard" - qsTr("chat_message_copied_to_clipboard_toast")) - optionsMenu.close() - } - } - IconLabelButton { - inverseLayout: true - visible: !mainItem.chatMessage.core.isRetracted - //: Forward - text: qsTr("chat_message_forward") - icon.source: AppIcons.forward - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - onClicked: { - mainItem.forwardMessageRequested() - optionsMenu.close() - } - } - Rectangle { - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) - color: DefaultStyle.main2_400 - } - IconLabelButton { - inverseLayout: true - //: "Delete" - text: qsTr("chat_message_delete") - icon.source: AppIcons.trashCan - // spacing: Utils.getSizeWithScreenRatio(10) - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - onClicked: { - mainItem.messageDeletionRequested() - optionsMenu.close() - } - style: ButtonStyle.hoveredBackgroundRed - } - } - } - PopupButton { - id: emojiButton - style: ButtonStyle.noBackground - icon.source: AppIcons.smiley - popup.contentItem: RowLayout { - Repeater { - model: ConstantsCpp.reactionsList - delegate: Button { - text: UtilsCpp.encodeEmojiToQmlRichFormat(modelData) - textFormat: Text.RichText - background: Rectangle { - anchors.fill: parent - color: DefaultStyle.grey_200 - radius: parent.width * 4 - visible: mainItem.ownReaction === modelData - } - onClicked: { - if(modelData) { - if (mainItem.ownReaction === modelData) mainItem.chatMessage.core.lRemoveReaction() - else mainItem.chatMessage.core.lSendReaction(modelData) - } - emojiButton.close() - } - } - } - PopupButton { - id: emojiPickerButton - icon.source: AppIcons.plusCircle - popup.width: Utils.getSizeWithScreenRatio(393) - popup.height: Utils.getSizeWithScreenRatio(291) - popup.contentItem: EmojiPicker { - id: emojiPicker - onEmojiClicked: (emoji) => { - if (mainItem.chatMessage) { - if (mainItem.ownReaction === emoji) mainItem.chatMessage.core.lRemoveReaction() - else mainItem.chatMessage.core.lSendReaction(emoji) - } - emojiPickerButton.close() - emojiButton.close() - } - } - } - } - } - } - Item{Layout.fillWidth: true} - } - } + //: Reply + text: qsTr("chat_message_reply") + icon.source: AppIcons.reply + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + onClicked: { + mainItem.replyToMessageRequested(); + optionsMenu.close(); + } + } + IconLabelButton { + inverseLayout: true + visible: !mainItem.chatMessage.core.isRetracted + text: chatBubbleContent.selectedText != "" ? + //: "Copy selection" + qsTr("chat_message_copy_selection") : + //: "Copy" + qsTr("chat_message_copy") + icon.source: AppIcons.copy + // spacing: Utils.getSizeWithScreenRatio(10) + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + onClicked: { + var success = UtilsCpp.copyToClipboard(chatBubbleContent.selectedText != "" ? chatBubbleContent.selectedText : + mainItem.chatMessage.core.text); + //: Copied + if (success) + UtilsCpp.showInformationPopup(qsTr("chat_message_copied_to_clipboard_title"), + //: "to clipboard" + qsTr("chat_message_copied_to_clipboard_toast")); + optionsMenu.close(); + } + } + IconLabelButton { + inverseLayout: true + visible: !mainItem.chatMessage.core.isRetracted + //: Forward + text: qsTr("chat_message_forward") + icon.source: AppIcons.forward + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + onClicked: { + mainItem.forwardMessageRequested(); + optionsMenu.close(); + } + } + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) + color: DefaultStyle.main2_400 + } + IconLabelButton { + inverseLayout: true + //: "Delete" + text: qsTr("chat_message_delete") + icon.source: AppIcons.trashCan + // spacing: Utils.getSizeWithScreenRatio(10) + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + onClicked: { + mainItem.messageDeletionRequested(); + optionsMenu.close(); + } + style: ButtonStyle.hoveredBackgroundRed + } + } + } + PopupButton { + id: emojiButton + style: ButtonStyle.noBackground + icon.source: AppIcons.smiley + popup.contentItem: RowLayout { + Repeater { + model: ConstantsCpp.reactionsList + delegate: Button { + text: UtilsCpp.encodeEmojiToQmlRichFormat(modelData) + textFormat: Text.RichText + background: Rectangle { + anchors.fill: parent + color: DefaultStyle.grey_200 + radius: parent.width * 4 + visible: mainItem.ownReaction === modelData + } + onClicked: { + if (modelData) { + if (mainItem.ownReaction === modelData) + mainItem.chatMessage.core.lRemoveReaction(); + else + mainItem.chatMessage.core.lSendReaction(modelData); + } + emojiButton.close(); + } + } + } + PopupButton { + id: emojiPickerButton + icon.source: AppIcons.plusCircle + popup.width: Utils.getSizeWithScreenRatio(393) + popup.height: Utils.getSizeWithScreenRatio(291) + popup.contentItem: EmojiPicker { + id: emojiPicker + onEmojiClicked: emoji => { + if (mainItem.chatMessage) { + if (mainItem.ownReaction === emoji) + mainItem.chatMessage.core.lRemoveReaction(); + else + mainItem.chatMessage.core.lSendReaction(emoji); + } + emojiPickerButton.close(); + emojiButton.close(); + } + } + } + } + } + } + Item { + Layout.fillWidth: true + } + } + } } diff --git a/Linphone/view/Control/Display/Chat/ChatMessageContent.qml b/Linphone/view/Control/Display/Chat/ChatMessageContent.qml index 3f0b26ea1..97974498c 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessageContent.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessageContent.qml @@ -14,30 +14,30 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem property ChatMessageGui chatMessageGui: null - property bool isRemoteMessage: chatMessageGui? chatMessageGui.core.isRemoteMessage : false + property bool isRemoteMessage: chatMessageGui ? chatMessageGui.core.isRemoteMessage : false property ChatGui chatGui: null - + signal isFileHoveringChanged(bool isFileHovering) signal lastSelectedTextChanged(string selectedText) // signal conferenceIcsCopied() signal mouseEvent(MouseEvent event) - signal endOfVoiceRecordingReached() - signal requestAutoPlayVoiceRecording() + signal endOfVoiceRecordingReached + signal requestAutoPlayVoiceRecording property string selectedText - + property color textColor property string searchedTextPart - - property int fileBorderWidth : 0 + + property int fileBorderWidth: 0 property int maxWidth - + spacing: Utils.getSizeWithScreenRatio(5) property ChatMessageContentProxy filescontentProxy: ChatMessageContentProxy { filterType: ChatMessageContentProxy.FilterContentType.File chatMessageGui: mainItem.chatMessageGui } - + // VOICE MESSAGES Repeater { id: messagesVoicesList @@ -57,7 +57,7 @@ ColumnLayout { Connections { target: mainItem function onRequestAutoPlayVoiceRecording() { - audioContent.requestPlaying() + audioContent.requestPlaying(); } } // width: conferenceList.width @@ -68,14 +68,14 @@ ColumnLayout { Repeater { id: conferenceList visible: count > 0 - model: ChatMessageContentProxy{ + model: ChatMessageContentProxy { filterType: ChatMessageContentProxy.FilterContentType.Conference chatMessageGui: mainItem.chatMessageGui } delegate: ChatMessageInvitationBubble { Layout.preferredWidth: Utils.getSizeWithScreenRatio(490) conferenceInfoGui: modelData.core.conferenceInfo - onMouseEvent: (event) => mainItem.mouseEvent(event) + onMouseEvent: event => mainItem.mouseEvent(event) } } // SINGLE FILE @@ -83,9 +83,7 @@ ColumnLayout { id: singleImageFile cache: false visible: mainItem.filescontentProxy.count === 1 && source !== "" && UtilsCpp.isImage(contentGui.core.filePath) - contentGui: mainItem.filescontentProxy.count === 1 - ? mainItem.filescontentProxy.getChatMessageContentAtIndex(0) - : null + contentGui: mainItem.filescontentProxy.count === 1 ? mainItem.filescontentProxy.getChatMessageContentAtIndex(0) : null Layout.fillWidth: true Layout.alignment: Qt.AlignHCenter fillMode: Image.PreserveAspectFit @@ -93,9 +91,7 @@ ColumnLayout { AnimatedImageFileView { id: singleAnimatedImageFile visible: mainItem.filescontentProxy.count === 1 && source !== "" && UtilsCpp.isAnimatedImage(contentGui.core.filePath) - contentGui: mainItem.filescontentProxy.count === 1 - ? mainItem.filescontentProxy.getChatMessageContentAtIndex(0) - : null + contentGui: mainItem.filescontentProxy.count === 1 ? mainItem.filescontentProxy.getChatMessageContentAtIndex(0) : null Layout.fillWidth: true Layout.preferredHeight: paintedHeight Layout.alignment: Qt.AlignHCenter @@ -107,22 +103,20 @@ ColumnLayout { onStatusChanged: { if (status == Image.Ready) { if (singleAnimatedImageFile.initialization) { - initialSourceWidth = sourceSize.width - initialSourceHeight = sourceSize.height - singleAnimatedImageFile.initialization = false + initialSourceWidth = sourceSize.width; + initialSourceHeight = sourceSize.height; + singleAnimatedImageFile.initialization = false; } - var sourceW = Math.min(initialSourceWidth, mainItem.maxWidth) - sourceSize.height = Math.round((sourceW/initialSourceWidth) * initialSourceHeight) - sourceSize.width = sourceW + var sourceW = Math.min(initialSourceWidth, mainItem.maxWidth); + sourceSize.height = Math.round((sourceW / initialSourceWidth) * initialSourceHeight); + sourceSize.width = sourceW; } } } VideoFileView { id: singleVideoFile visible: mainItem.filescontentProxy.count === 1 && UtilsCpp.isVideo(contentGui.core.filePath) - contentGui: mainItem.filescontentProxy.count === 1 - ? mainItem.filescontentProxy.getChatMessageContentAtIndex(0) - : null + contentGui: mainItem.filescontentProxy.count === 1 ? mainItem.filescontentProxy.getChatMessageContentAtIndex(0) : null Layout.fillWidth: true width: Math.min(Utils.getSizeWithScreenRatio(285), mainItem.maxWidth) height: Math.min(Utils.getSizeWithScreenRatio(285), mainItem.maxWidth) @@ -135,13 +129,11 @@ ColumnLayout { // FILES ChatFilesGridLayout { id: messageFilesList - visible: mainItem.filescontentProxy.count > 0 - && !singleImageFile.visible - && !singleAnimatedImageFile.visible - && !singleVideoFile.visible + visible: mainItem.filescontentProxy.count > 0 && !singleImageFile.visible && !singleAnimatedImageFile.visible && + !singleVideoFile.visible Layout.fillWidth: visible Layout.fillHeight: visible - maxWidth: Utils.getSizeWithScreenRatio(115*3) + 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 bcddae565..728c742b1 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessageInvitationBubble.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessageInvitationBubble.qml @@ -9,16 +9,15 @@ 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 { - spacing: 0 - id: mainItem + spacing: 0 width: Utils.getSizeWithScreenRatio(490) property ConferenceInfoGui conferenceInfoGui property var conferenceInfo: conferenceInfoGui?.core property string timeRangeText: "" property bool linkHovered: false - + signal mouseEvent(MouseEvent event) function updateTimeRange() { @@ -36,9 +35,8 @@ ColumnLayout { let offsetHours = Math.floor(offsetMinutes / 60); let timeZone = "UTC" + (offsetHours >= 0 ? "+" : "") + offsetHours; - timeRangeText = - qsTr("ics_bubble_meeting_from") + startTime + - qsTr("ics_bubble_meeting_to") + endTime + " (" + timeZone + ")"; + timeRangeText = qsTr("ics_bubble_meeting_from") + startTime + qsTr("ics_bubble_meeting_to") + endTime + " (" + + timeZone + ")"; } Control.Control { @@ -56,23 +54,19 @@ ColumnLayout { } contentItem: ColumnLayout { Text { - visible: conferenceInfo.state == LinphoneEnums.ConferenceInfoState.Updated - || conferenceInfo.state == LinphoneEnums.ConferenceInfoState.Cancelled - text: conferenceInfo.state == LinphoneEnums.ConferenceInfoState.Updated - //: Meeting has been updated - ? qsTr("ics_bubble_meeting_modified") + " :" - : conferenceInfo.state == LinphoneEnums.ConferenceInfoState.Cancelled - //: Meeting has been canceled - ? qsTr("ics_bubble_meeting_cancelled") + " :" - : "" + visible: conferenceInfo.state == LinphoneEnums.ConferenceInfoState.Updated || conferenceInfo.state + == LinphoneEnums.ConferenceInfoState.Cancelled + text: conferenceInfo.state == LinphoneEnums.ConferenceInfoState.Updated ? + //: Meeting has been updated + qsTr("ics_bubble_meeting_modified") + " :" : conferenceInfo.state + == LinphoneEnums.ConferenceInfoState.Cancelled ? + //: Meeting has been canceled + qsTr("ics_bubble_meeting_cancelled") + " :" : "" font: Typography.p2 - color: conferenceInfo.state == LinphoneEnums.ConferenceInfoState.New ? - DefaultStyle.main2_600 : - conferenceInfo.state == LinphoneEnums.ConferenceInfoState.Updated ? - DefaultStyle.warning_600 : - conferenceInfo.state == LinphoneEnums.ConferenceInfoState.Cancelled ? - DefaultStyle.danger_500_main : - DefaultStyle.main2_600 + color: conferenceInfo.state == LinphoneEnums.ConferenceInfoState.New ? DefaultStyle.main2_600 : conferenceInfo.state + == LinphoneEnums.ConferenceInfoState.Updated ? DefaultStyle.warning_600 : conferenceInfo.state + == LinphoneEnums.ConferenceInfoState.Cancelled ? DefaultStyle.danger_500_main : + DefaultStyle.main2_600 } RowLayout { @@ -170,18 +164,16 @@ ColumnLayout { style: ButtonStyle.noBackground icon.source: AppIcons.calendarPlus onClicked: { - conferenceInfo.exportConferenceToICS() + conferenceInfo.exportConferenceToICS(); } } } Text { //: from %1 to %2 (UTC%3) - property string offsetFromUtc: conferenceInfo.timeZoneModel.offsetFromUtc > 0 - ? "+" + conferenceInfo.timeZoneModel.offsetFromUtc/3600 - : conferenceInfo.timeZoneModel.offsetFromUtc/3600 - text: qsTr("").arg( - conferenceInfo.dateTime.toLocaleString(Qt.locale(), "hh:mm")).arg( - conferenceInfo.endDateTime.toLocaleString(Qt.locale(), "hh:mm")).arg(offsetFromUtc) + property string offsetFromUtc: conferenceInfo.timeZoneModel.offsetFromUtc > 0 ? "+" + conferenceInfo.timeZoneModel.offsetFromUtc + / 3600 : conferenceInfo.timeZoneModel.offsetFromUtc / 3600 + text: qsTr("").arg(conferenceInfo.dateTime.toLocaleString(Qt.locale(), "hh:mm")).arg(conferenceInfo.endDateTime.toLocaleString( + Qt.locale(), "hh:mm")).arg(offsetFromUtc) color: DefaultStyle.main2_500_main font: Typography.p4 } @@ -195,8 +187,7 @@ ColumnLayout { } } } - - + Rectangle { visible: conferenceInfo.description.length > 0 || conferenceInfo.participantCount > 0 Layout.fillWidth: true @@ -225,7 +216,7 @@ ColumnLayout { MouseArea { anchors.fill: parent cursorShape: mainItem.linkHovered ? Qt.PointingHandCursor : Qt.ArrowCursor - onClicked: (mouse) => mouseEvent(mouse) + onClicked: mouse => mouseEvent(mouse) acceptedButtons: Qt.AllButtons // Send all to parent } @@ -234,7 +225,7 @@ ColumnLayout { color: DefaultStyle.grey_0 radius: Utils.getSizeWithScreenRatio(10) } - + contentItem: ColumnLayout { spacing: Utils.getSizeWithScreenRatio(10) @@ -259,14 +250,14 @@ ColumnLayout { maximumLineCount: 3 elide: Text.ElideRight visible: conferenceInfo.description.length > 0 - onLinkActivated: (link) => { - if (link.startsWith('sip')) - UtilsCpp.createCall(link) - else - Qt.openUrlExternally(link) - } + onLinkActivated: link => { + if (link.startsWith('sip')) + UtilsCpp.createCall(link); + else + Qt.openUrlExternally(link); + } onHoveredLinkChanged: { - mainItem.linkHovered = hoveredLink !== "" + mainItem.linkHovered = hoveredLink !== ""; } } } @@ -297,9 +288,9 @@ ColumnLayout { text: qsTr("ics_bubble_join") visible: !SettingsCpp.disableMeetingsFeature && conferenceInfo.state != LinphoneEnums.ConferenceInfoState.Cancelled onClicked: { - var callsWindow = UtilsCpp.getOrCreateCallsWindow() - callsWindow.setupConference(mainItem.conferenceInfoGui) - UtilsCpp.smartShowWindow(callsWindow) + var callsWindow = UtilsCpp.getOrCreateCallsWindow(); + callsWindow.setupConference(mainItem.conferenceInfoGui); + UtilsCpp.smartShowWindow(callsWindow); } } } diff --git a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml index dffc12209..556acae64 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml @@ -5,418 +5,415 @@ import QtQuick.Controls.Basic as Control 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ListView { - id: mainItem - spacing: Utils.getSizeWithScreenRatio(4) - property ChatGui chat - property color backgroundColor - property bool lastItemVisible: false - property int lastIndexFoundWithFilter: -1 - property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) - property bool loading: false - property bool isEncrypted: chat && chat.core.isEncrypted - property bool showEncryptedInfo: AppCpp.currentAccount !== null && AppCpp.currentAccount.core.limeServerUrl !== "" && AppCpp.currentAccount.core.conferenceFactoryAddress !== "" - highlightFollowsCurrentItem: true + id: mainItem + spacing: Utils.getSizeWithScreenRatio(4) + property ChatGui chat + property color backgroundColor + property bool lastItemVisible: false + property int lastIndexFoundWithFilter: -1 + property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) + property bool loading: false + property bool isEncrypted: chat && chat.core.isEncrypted + property bool showEncryptedInfo: AppCpp.currentAccount !== null && AppCpp.currentAccount.core.limeServerUrl !== "" + && AppCpp.currentAccount.core.conferenceFactoryAddress !== "" + highlightFollowsCurrentItem: true - verticalLayoutDirection: ListView.BottomToTop - signal showReactionsForMessageRequested(ChatMessageGui chatMessage) - signal showImdnStatusForMessageRequested(ChatMessageGui chatMessage) - signal replyToMessageRequested(ChatMessageGui chatMessage) - signal forwardMessageRequested(ChatMessageGui chatMessage) - signal editMessageRequested(ChatMessageGui chatMessage) - signal requestHighlight(int indexToHighlight) - signal requestAutoPlayVoiceRecording(int indexToPlay) - signal searchMessageByIdRequested(string id) - currentIndex: -1 + verticalLayoutDirection: ListView.BottomToTop + signal showReactionsForMessageRequested(ChatMessageGui chatMessage) + signal showImdnStatusForMessageRequested(ChatMessageGui chatMessage) + signal replyToMessageRequested(ChatMessageGui chatMessage) + signal forwardMessageRequested(ChatMessageGui chatMessage) + signal editMessageRequested(ChatMessageGui chatMessage) + signal requestHighlight(int indexToHighlight) + signal requestAutoPlayVoiceRecording(int indexToPlay) + signal searchMessageByIdRequested(string id) + currentIndex: -1 - property string filterText - onFilterTextChanged: { - lastIndexFoundWithFilter = -1 - if (filterText === "") return - eventLogProxy.filterText = filterText - var indexVisible = indexAt(contentX, contentY) - eventLogProxy.findIndexCorrespondingToFilter(indexVisible, true, true) - } - signal findIndexWithFilter(bool forward) - property bool searchForward: true - onFindIndexWithFilter: (forward) => { - searchForward = forward - eventLogProxy.findIndexCorrespondingToFilter(currentIndex, searchForward, false) - } - onSearchMessageByIdRequested: (id) => { - eventLogProxy.findChatMessageById(id) - } + property string filterText + onFilterTextChanged: { + lastIndexFoundWithFilter = -1; + if (filterText === "") + return; + eventLogProxy.filterText = filterText; + var indexVisible = indexAt(contentX, contentY); + eventLogProxy.findIndexCorrespondingToFilter(indexVisible, true, true); + } + signal findIndexWithFilter(bool forward) + property bool searchForward: true + onFindIndexWithFilter: forward => { + searchForward = forward; + eventLogProxy.findIndexCorrespondingToFilter(currentIndex, searchForward, false); + } + onSearchMessageByIdRequested: id => { + eventLogProxy.findChatMessageById(id); + } - Button { - visible: !mainItem.lastItemVisible - icon.source: AppIcons.downArrow - leftPadding: Utils.getSizeWithScreenRatio(20) - rightPadding: Utils.getSizeWithScreenRatio(20) - topPadding: Utils.getSizeWithScreenRatio(20) - bottomPadding: Utils.getSizeWithScreenRatio(20) - anchors.bottom: parent.bottom - style: ButtonStyle.main - anchors.right: parent.right - anchors.bottomMargin: Utils.getSizeWithScreenRatio(18) - anchors.rightMargin: Utils.getSizeWithScreenRatio(18) - onClicked: { - var index = eventLogProxy.findFirstUnreadIndex() - mainItem.positionViewAtIndex(index, ListView.Contain) - eventLogProxy.markIndexAsRead(index) - } - UnreadNotification { - anchors.top: parent.top - anchors.right: parent.right - anchors.topMargin: Utils.getSizeWithScreenRatio(-5) - anchors.rightMargin: Utils.getSizeWithScreenRatio(-5) - unread: mainItem.chat?.core.unreadMessagesCount || 0 - } - } + Button { + visible: !mainItem.lastItemVisible + icon.source: AppIcons.downArrow + leftPadding: Utils.getSizeWithScreenRatio(20) + rightPadding: Utils.getSizeWithScreenRatio(20) + topPadding: Utils.getSizeWithScreenRatio(20) + bottomPadding: Utils.getSizeWithScreenRatio(20) + anchors.bottom: parent.bottom + style: ButtonStyle.main + anchors.right: parent.right + anchors.bottomMargin: Utils.getSizeWithScreenRatio(18) + anchors.rightMargin: Utils.getSizeWithScreenRatio(18) + onClicked: { + var index = eventLogProxy.findFirstUnreadIndex(); + mainItem.positionViewAtIndex(index, ListView.Contain); + eventLogProxy.markIndexAsRead(index); + } + UnreadNotification { + anchors.top: parent.top + anchors.right: parent.right + anchors.topMargin: Utils.getSizeWithScreenRatio(-5) + anchors.rightMargin: Utils.getSizeWithScreenRatio(-5) + unread: mainItem.chat?.core.unreadMessagesCount || 0 + } + } - onAtYBeginningChanged: if (atYBeginning && count !== 0) { - eventLogProxy.displayMore() - } - onAtYEndChanged: if (atYEnd && chat && count !== 0) { - chat.core.lMarkAsRead() - } + onAtYBeginningChanged: if (atYBeginning && count !== 0) { + eventLogProxy.displayMore(); + } + onAtYEndChanged: if (atYEnd && chat && count !== 0) { + chat.core.lMarkAsRead(); + } - model: EventLogProxy { - id: eventLogProxy - chatGui: mainItem.chat - filterText: mainItem.filterText - initialDisplayItems: 20 - displayItemsStep: 20 - onModelAboutToBeReset: { - loading = true - } - onModelReset: loading = false - onModelUpdated: { - loading = false - var index = eventLogProxy.findFirstUnreadIndex() - var itemToSelect = mainItem.itemAtIndex(index) - mainItem.positionViewAtIndex(index, ListView.Beginning) - var lastMessage = itemAtIndex(0) - mainItem.lastItemVisible = lastMessage.isFullyVisible - eventLogProxy.markIndexAsRead(index) - } - onEventInsertedByUser: (index) => { - mainItem.positionViewAtIndex(index, ListView.Beginning) - } - onIndexWithFilterFound: (index) => { - if (index !== -1) { - currentIndex = index - mainItem.positionViewAtIndex(index, ListView.Center) - mainItem.requestHighlight(index) - mainItem.lastIndexFoundWithFilter = index - } else { - if (mainItem.lastIndexFoundWithFilter !== index) { - //: Find message - UtilsCpp.showInformationPopup(qsTr("popup_info_find_message_title"), - mainItem.searchForward - //: Last result reached - ? qsTr("info_popup_last_result_message") - //: First result reached - : qsTr("info_popup_first_result_message"), false) - mainItem.positionViewAtIndex(mainItem.lastIndexFoundWithFilter, ListView.Center) - mainItem.requestHighlight(mainItem.lastIndexFoundWithFilter) - } - else { - //: Find message - UtilsCpp.showInformationPopup(qsTr("popup_info_find_message_title"), - //: No result found - qsTr("info_popup_no_result_message"), false) - } - } - } - onFoundMessagById: (index) => { - if (index !== -1) { - currentIndex = index - mainItem.positionViewAtIndex(index, ListView.Center) - mainItem.requestHighlight(index) - } - } - } + model: EventLogProxy { + id: eventLogProxy + chatGui: mainItem.chat + filterText: mainItem.filterText + initialDisplayItems: 20 + displayItemsStep: 20 + onModelAboutToBeReset: { + loading = true; + } + onModelReset: loading = false + onModelUpdated: { + loading = false; + var index = eventLogProxy.findFirstUnreadIndex(); + var itemToSelect = mainItem.itemAtIndex(index); + mainItem.positionViewAtIndex(index, ListView.Beginning); + var lastMessage = itemAtIndex(0); + mainItem.lastItemVisible = lastMessage.isFullyVisible; + eventLogProxy.markIndexAsRead(index); + } + onEventInsertedByUser: index => { + mainItem.positionViewAtIndex(index, ListView.Beginning); + } + onIndexWithFilterFound: index => { + if (index !== -1) { + currentIndex = index; + mainItem.positionViewAtIndex(index, ListView.Center); + mainItem.requestHighlight(index); + mainItem.lastIndexFoundWithFilter = index; + } else { + if (mainItem.lastIndexFoundWithFilter !== index) { + //: Find message + UtilsCpp.showInformationPopup(qsTr("popup_info_find_message_title"), mainItem.searchForward ? + //: Last result reached + qsTr("info_popup_last_result_message") : + //: First result reached + qsTr("info_popup_first_result_message"), false); + mainItem.positionViewAtIndex(mainItem.lastIndexFoundWithFilter, ListView.Center); + mainItem.requestHighlight(mainItem.lastIndexFoundWithFilter); + } else { + //: Find message + UtilsCpp.showInformationPopup(qsTr("popup_info_find_message_title"), + //: No result found + qsTr("info_popup_no_result_message"), false); + } + } + } + onFoundMessagById: index => { + if (index !== -1) { + currentIndex = index; + mainItem.positionViewAtIndex(index, ListView.Center); + mainItem.requestHighlight(index); + } + } + } - footer: Item { - visible: mainItem.chat && !mainItem.loading - height: visible ? (headerMessage.height + headerMessage.topMargin + headerMessage.bottomMargin) : Utils.getSizeWithScreenRatio(30) - width: headerMessage.width - anchors.horizontalCenter: parent.horizontalCenter - Control.Control { - id: headerMessage - visible: mainItem.showEncryptedInfo - 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: Utils.getSizeWithScreenRatio(10) - background: Rectangle { - color: "transparent" - border.color: DefaultStyle.main2_200 - border.width: Utils.getSizeWithScreenRatio(2) - radius: Utils.getSizeWithScreenRatio(10) - } - contentItem: RowLayout { - EffectImage { - 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: Utils.getSizeWithScreenRatio(2) - Text { - text: mainItem.isEncrypted - //: End to end encrypted chat - ? qsTr("chat_message_list_encrypted_header_title") - //: This conversation is not encrypted ! - : qsTr("unencrypted_conversation_warning") - Layout.fillWidth: true - color: mainItem.isEncrypted ? DefaultStyle.info_500_main : DefaultStyle.warning_700 - font { - pixelSize: Typography.p2.pixelSize - weight: Typography.p2.weight - } - } - Text { - text: mainItem.isEncrypted - //: Messages in this conversation are e2e encrypted. \n Only your correspondent can decrypt them. - ? qsTr("chat_message_list_encrypted_header_message") - //: Messages are not end to end encrypted, \n may sure you don't share any sensitive information ! - : qsTr("chat_message_list_not_encrypted_header_message") - Layout.fillWidth: true - color: DefaultStyle.grey_400 - font { - pixelSize: Typography.p3.pixelSize - weight: Typography.p3.weight - } - } - } - } - } - } - footerPositioning: mainItem.contentHeight > mainItem.height ? ListView.InlineFooter : ListView.PullBackFooter - headerPositioning: ListView.OverlayHeader - header: Control.Control { - visible: composeLayout.composingName !== "" && composeLayout.composingName !== undefined - width: mainItem.width - // height: visible ? contentItem.implicitHeight + topPadding + bottomPadding : 0 - z: mainItem.z + 2 - topPadding: Utils.getSizeWithScreenRatio(5) - bottomPadding: Utils.getSizeWithScreenRatio(5) - background: Rectangle { - anchors.fill: parent - color: mainItem.backgroundColor - } - contentItem: RowLayout { - id: composeLayout - property var composingName: mainItem.chat?.core.composingName - Avatar { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) - _address: mainItem.chat?.core.composingAddress - } - Text { - Layout.fillWidth: true - font { - pixelSize: Typography.p3.pixelSize - weight: Typography.p3.weight - } - //: %1 is writing… - text: qsTr("chat_message_is_writing_info").arg(composeLayout.composingName) - } - } - } + footer: Item { + visible: mainItem.chat && !mainItem.loading + height: visible ? (headerMessage.height + headerMessage.topMargin + headerMessage.bottomMargin) : Utils.getSizeWithScreenRatio( + 30) - BusyIndicator { - anchors.horizontalCenter: mainItem.horizontalCenter - anchors.verticalCenter: mainItem.verticalCenter - visible: mainItem.loading - height: visible ? mainItem.busyIndicatorSize : 0 - width: mainItem.busyIndicatorSize - indicatorHeight: mainItem.busyIndicatorSize - indicatorWidth: mainItem.busyIndicatorSize - indicatorColor: DefaultStyle.main1_500_main - } - - - Dialog { - id: messageDeletionDialog - width: Utils.getSizeWithScreenRatio(637) - //: "Supprimer le message ?" - title: qsTr("conversation_dialog_delete_chat_message_title") - property var chatMessage - buttons: RowLayout { - id: buttonsLayout - Layout.alignment: Qt.AlignBottom | Qt.AlignRight - spacing: Utils.getSizeWithScreenRatio(20) - MediumButton { - id: firstButtonId - text: qsTr("conversation_dialog_delete_locally_label") - style: ButtonStyle.main - onClicked: { - messageDeletionDialog.chatMessage.core.lDelete() - messageDeletionDialog.close() - } - KeyNavigation.left: thirdButtonId - KeyNavigation.right: secondButtonId + width: headerMessage.width + anchors.horizontalCenter: parent.horizontalCenter + Control.Control { + id: headerMessage + visible: mainItem.showEncryptedInfo + 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: Utils.getSizeWithScreenRatio(10) + background: Rectangle { + color: "transparent" + border.color: DefaultStyle.main2_200 + border.width: Utils.getSizeWithScreenRatio(2) + radius: Utils.getSizeWithScreenRatio(10) + } + contentItem: RowLayout { + EffectImage { + 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 } - MediumButton { - id: secondButtonId - text: qsTr("conversation_dialog_delete_for_everyone_label") - style: ButtonStyle.main - onClicked: { - messageDeletionDialog.chatMessage.core.lRetract() - messageDeletionDialog.close() + ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(2) + Text { + text: mainItem.isEncrypted ? + //: End to end encrypted chat + qsTr("chat_message_list_encrypted_header_title") : + //: This conversation is not encrypted ! + qsTr("unencrypted_conversation_warning") + Layout.fillWidth: true + color: mainItem.isEncrypted ? DefaultStyle.info_500_main : DefaultStyle.warning_700 + font { + pixelSize: Typography.p2.pixelSize + weight: Typography.p2.weight + } } - KeyNavigation.left: firstButtonId - KeyNavigation.right: thirdButtonId - } - MediumButton { - id: thirdButtonId - text: qsTr("dialog_cancel") - style: ButtonStyle.secondary - onClicked: { - messageDeletionDialog.close() + Text { + text: mainItem.isEncrypted ? + //: Messages in this conversation are e2e encrypted. \n Only your correspondent can decrypt them. + qsTr("chat_message_list_encrypted_header_message") : + //: Messages are not end to end encrypted, \n may sure you don't share any sensitive information ! + qsTr("chat_message_list_not_encrypted_header_message") + Layout.fillWidth: true + color: DefaultStyle.grey_400 + font { + pixelSize: Typography.p3.pixelSize + weight: Typography.p3.weight + } } - KeyNavigation.left: secondButtonId - KeyNavigation.right: firstButtonId } } - } - - delegate: DelegateChooser { - role: "eventType" - DelegateChoice { - roleValue: "chatMessage" - delegate: ChatMessage { - id: chatMessageDelegate - visible: !mainItem.loading - property int yoff: Math.round(chatMessageDelegate.y - mainItem.contentY) - property bool isFullyVisible: (yoff > mainItem.y && yoff + height < mainItem.y + mainItem.height) - chatMessage: modelData.core.chatMessageGui - onIsFullyVisibleChanged: { - if (index === 0) { - mainItem.lastItemVisible = isFullyVisible - } - } - Component.onCompleted: { - if (index === 0) { - mainItem.lastItemVisible = isFullyVisible - } - } - chat: mainItem.chat - searchedTextPart: mainItem.filterText - maxWidth: Math.round(mainItem.width * (3/4)) - width: mainItem.width - property var previousIndex: index - 1 - property ChatMessageGui nextChatMessage: index <= 0 - ? null - : eventLogProxy.getEventAtIndex(index-1) - ? eventLogProxy.getEventAtIndex(index-1).core.chatMessageGui - : null - property var previousFromAddress: eventLogProxy.getEventAtIndex(index+1)?.core.chatMessage?.fromAddress - backgroundColor: isRemoteMessage ? DefaultStyle.main2_100 : DefaultStyle.main1_100 - isFirstMessage: !previousFromAddress || previousFromAddress !== chatMessage.core.fromAddress - anchors.right: !isRemoteMessage && parent - ? parent.right - : undefined + } + } + footerPositioning: mainItem.contentHeight > mainItem.height ? ListView.InlineFooter : ListView.PullBackFooter + headerPositioning: ListView.OverlayHeader + header: Control.Control { + visible: composeLayout.composingName !== "" && composeLayout.composingName !== undefined + width: mainItem.width + // height: visible ? contentItem.implicitHeight + topPadding + bottomPadding : 0 + z: mainItem.z + 2 + topPadding: Utils.getSizeWithScreenRatio(5) + bottomPadding: Utils.getSizeWithScreenRatio(5) + background: Rectangle { + anchors.fill: parent + color: mainItem.backgroundColor + } + contentItem: RowLayout { + id: composeLayout + property var composingName: mainItem.chat?.core.composingName + Avatar { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + _address: mainItem.chat?.core.composingAddress + } + Text { + Layout.fillWidth: true + font { + pixelSize: Typography.p3.pixelSize + weight: Typography.p3.weight + } + //: %1 is writing… + text: qsTr("chat_message_is_writing_info").arg(composeLayout.composingName) + } + } + } - onMessageDeletionRequested: { - if (chatMessage.core.isOutgoing && chatMessage.core.isRetractable && !chatMessage.core.isRetracted) { - messageDeletionDialog.chatMessage = chatMessage - messageDeletionDialog.open() - } else { - chatMessage.core.lDelete() + BusyIndicator { + anchors.horizontalCenter: mainItem.horizontalCenter + anchors.verticalCenter: mainItem.verticalCenter + visible: mainItem.loading + height: visible ? mainItem.busyIndicatorSize : 0 + width: mainItem.busyIndicatorSize + indicatorHeight: mainItem.busyIndicatorSize + indicatorWidth: mainItem.busyIndicatorSize + indicatorColor: DefaultStyle.main1_500_main + } + + Dialog { + id: messageDeletionDialog + width: Utils.getSizeWithScreenRatio(637) + //: "Supprimer le message ?" + title: qsTr("conversation_dialog_delete_chat_message_title") + property var chatMessage + buttons: RowLayout { + id: buttonsLayout + Layout.alignment: Qt.AlignBottom | Qt.AlignRight + spacing: Utils.getSizeWithScreenRatio(20) + MediumButton { + id: firstButtonId + text: qsTr("conversation_dialog_delete_locally_label") + style: ButtonStyle.main + onClicked: { + messageDeletionDialog.chatMessage.core.lDelete(); + messageDeletionDialog.close(); + } + KeyNavigation.left: thirdButtonId + KeyNavigation.right: secondButtonId + } + MediumButton { + id: secondButtonId + text: qsTr("conversation_dialog_delete_for_everyone_label") + style: ButtonStyle.main + onClicked: { + messageDeletionDialog.chatMessage.core.lRetract(); + messageDeletionDialog.close(); + } + KeyNavigation.left: firstButtonId + KeyNavigation.right: thirdButtonId + } + MediumButton { + id: thirdButtonId + text: qsTr("dialog_cancel") + style: ButtonStyle.secondary + onClicked: { + messageDeletionDialog.close(); + } + KeyNavigation.left: secondButtonId + KeyNavigation.right: firstButtonId + } + } + } + + delegate: DelegateChooser { + role: "eventType" + DelegateChoice { + roleValue: "chatMessage" + delegate: ChatMessage { + id: chatMessageDelegate + visible: !mainItem.loading + property int yoff: Math.round(chatMessageDelegate.y - mainItem.contentY) + property bool isFullyVisible: (yoff > mainItem.y && yoff + height < mainItem.y + mainItem.height) + chatMessage: modelData.core.chatMessageGui + onIsFullyVisibleChanged: { + if (index === 0) { + mainItem.lastItemVisible = isFullyVisible; } - } - onMessageEditionRequested: mainItem.editMessageRequested(chatMessage) - onShowReactionsForMessageRequested: mainItem.showReactionsForMessageRequested(chatMessage) - onShowImdnStatusForMessageRequested: mainItem.showImdnStatusForMessageRequested(chatMessage) - onReplyToMessageRequested: mainItem.replyToMessageRequested(chatMessage) - onSearchMessageByIdRequested: (id) => mainItem.searchMessageByIdRequested(id) - onForwardMessageRequested: mainItem.forwardMessageRequested(chatMessage) - onEndOfVoiceRecordingReached: { - if (nextChatMessage && nextChatMessage.core.isVoiceRecording) mainItem.requestAutoPlayVoiceRecording(index - 1) - } - Connections { - target: mainItem - function onRequestHighlight(indexToHighlight) { - if (indexToHighlight === index) { - requestHighlight() - } - } - function onRequestAutoPlayVoiceRecording(indexToPlay) { - if (indexToPlay === index) { - chatMessageDelegate.requestAutoPlayVoiceRecording() - } - } - } + } + Component.onCompleted: { + if (index === 0) { + mainItem.lastItemVisible = isFullyVisible; + } + } + chat: mainItem.chat + searchedTextPart: mainItem.filterText + maxWidth: Math.round(mainItem.width * (3 / 4)) + width: mainItem.width + property var previousIndex: index - 1 + property ChatMessageGui nextChatMessage: index <= 0 ? null : eventLogProxy.getEventAtIndex(index - 1) + ? eventLogProxy.getEventAtIndex(index - 1).core.chatMessageGui : null + property var previousFromAddress: eventLogProxy.getEventAtIndex(index + 1)?.core.chatMessage?.fromAddress + backgroundColor: isRemoteMessage ? DefaultStyle.main2_100 : DefaultStyle.main1_100 + isFirstMessage: !previousFromAddress || previousFromAddress !== chatMessage.core.fromAddress + anchors.right: !isRemoteMessage && parent ? parent.right : undefined + + onMessageDeletionRequested: { + if (chatMessage.core.isOutgoing && chatMessage.core.isRetractable && !chatMessage.core.isRetracted) { + messageDeletionDialog.chatMessage = chatMessage; + messageDeletionDialog.open(); + } else { + chatMessage.core.lDelete(); + } + } + onMessageEditionRequested: mainItem.editMessageRequested(chatMessage) + onShowReactionsForMessageRequested: mainItem.showReactionsForMessageRequested(chatMessage) + onShowImdnStatusForMessageRequested: mainItem.showImdnStatusForMessageRequested(chatMessage) + onReplyToMessageRequested: mainItem.replyToMessageRequested(chatMessage) + onSearchMessageByIdRequested: id => mainItem.searchMessageByIdRequested(id) + onForwardMessageRequested: mainItem.forwardMessageRequested(chatMessage) + onEndOfVoiceRecordingReached: { + if (nextChatMessage && nextChatMessage.core.isVoiceRecording) + mainItem.requestAutoPlayVoiceRecording(index - 1); + } + Connections { + target: mainItem + function onRequestHighlight(indexToHighlight) { + if (indexToHighlight === index) { + requestHighlight(); + } + } + function onRequestAutoPlayVoiceRecording(indexToPlay) { + if (indexToPlay === index) { + chatMessageDelegate.requestAutoPlayVoiceRecording(); + } + } + } Connections { target: chatMessage.core onIsRetractedChanged: { if (chatMessage.core.isRetracted && chatMessage.core.isOutgoing) { - UtilsCpp.showInformationPopup(qsTr("info_toast_deleted_title"), - //: The message has been deleted - qsTr("info_toast_deleted_message"), true) + UtilsCpp.showInformationPopup(qsTr("info_toast_deleted_title"), + //: The message has been deleted + qsTr("info_toast_deleted_message"), true); } } } - } - } + } + } - DelegateChoice { - roleValue: "event" - delegate: Item { - id: eventDelegate - visible: !mainItem.loading - property int yoff: Math.round(eventDelegate.y - mainItem.contentY) - property bool isFullyVisible: (yoff > mainItem.y && yoff + height < mainItem.y + mainItem.height) - onIsFullyVisibleChanged: { - if (index === 0) { - mainItem.lastItemVisible = isFullyVisible - } - } - property bool showTopMargin: !header.visible && index == 0 - width: mainItem.width - height: (showTopMargin ? Utils.getSizeWithScreenRatio(30) : 0) + eventItem.implicitHeight - Event { - id: eventItem - anchors.top: parent.top - anchors.topMargin: showTopMargin ? Utils.getSizeWithScreenRatio(30) : 0 - width: parent.width - eventLogGui: modelData - } - } - } - DelegateChoice { - roleValue: "ephemeralEvent" - delegate: Item { - id: ephemeralEventDelegate - visible: !mainItem.loading - property int yoff: Math.round(ephemeralEventDelegate.y - mainItem.contentY) - property bool isFullyVisible: (yoff > mainItem.y && yoff + height < mainItem.y + mainItem.height) - onIsFullyVisibleChanged: { - if (index === 0) { - mainItem.lastItemVisible = isFullyVisible - } - } - property bool showTopMargin: !header.visible && index == 0 - width: mainItem.width - //height: Utils.getSizeWithScreenRatio(40) - height: (showTopMargin ? Utils.getSizeWithScreenRatio(30) : 0) + ephemeralEventItem.height - EphemeralEvent { - id: ephemeralEventItem - anchors.top: parent.top - anchors.topMargin: showTopMargin ? Utils.getSizeWithScreenRatio(30) : 0 - eventLogGui: modelData - } - } - } - } + roleValue: "event" + delegate: Item { + id: eventDelegate + visible: !mainItem.loading + property int yoff: Math.round(eventDelegate.y - mainItem.contentY) + property bool isFullyVisible: (yoff > mainItem.y && yoff + height < mainItem.y + mainItem.height) + onIsFullyVisibleChanged: { + if (index === 0) { + mainItem.lastItemVisible = isFullyVisible; + } + } + property bool showTopMargin: !header.visible && index == 0 + width: mainItem.width + height: (showTopMargin ? Utils.getSizeWithScreenRatio(30) : 0) + eventItem.implicitHeight + Event { + id: eventItem + anchors.top: parent.top + anchors.topMargin: showTopMargin ? Utils.getSizeWithScreenRatio(30) : 0 + width: parent.width + eventLogGui: modelData + } + } + } + + DelegateChoice { + roleValue: "ephemeralEvent" + delegate: Item { + id: ephemeralEventDelegate + visible: !mainItem.loading + property int yoff: Math.round(ephemeralEventDelegate.y - mainItem.contentY) + property bool isFullyVisible: (yoff > mainItem.y && yoff + height < mainItem.y + mainItem.height) + onIsFullyVisibleChanged: { + if (index === 0) { + mainItem.lastItemVisible = isFullyVisible; + } + } + property bool showTopMargin: !header.visible && index == 0 + width: mainItem.width + //height: Utils.getSizeWithScreenRatio(40) + height: (showTopMargin ? Utils.getSizeWithScreenRatio(30) : 0) + ephemeralEventItem.height + EphemeralEvent { + id: ephemeralEventItem + anchors.top: parent.top + anchors.topMargin: showTopMargin ? Utils.getSizeWithScreenRatio(30) : 0 + eventLogGui: modelData + } + } + } + } } diff --git a/Linphone/view/Control/Display/Chat/ChatTextContent.qml b/Linphone/view/Control/Display/Chat/ChatTextContent.qml index e907cb0d4..fa08b47aa 100644 --- a/Linphone/view/Control/Display/Chat/ChatTextContent.qml +++ b/Linphone/view/Control/Display/Chat/ChatTextContent.qml @@ -5,84 +5,89 @@ import Linphone import UtilsCpp - // TODO : into Loader // ============================================================================= TextEdit { id: mainItem property ChatMessageContentGui contentGui property ChatGui chatGui: null - property string lastTextSelected : '' + property string lastTextSelected: '' property string searchedTextPart color: DefaultStyle.main2_700 // force restoring cursor in case we click on a mention, otherwise // the cursor stays IBeam - onVisibleChanged: if (!visible) UtilsCpp.restoreGlobalCursor() + onVisibleChanged: if (!visible) + UtilsCpp.restoreGlobalCursor() font { - pixelSize: (contentGui && UtilsCpp.isOnlyEmojis(contentGui.core.text)) ? Typography.h1.pixelSize : Typography.p1.pixelSize + pixelSize: (contentGui && UtilsCpp.isOnlyEmojis(contentGui.core.text)) ? Typography.h1.pixelSize : + Typography.p1.pixelSize weight: Typography.p1.weight - } + } // property int removeWarningFromBindingLoop : implicitWidth // Just a dummy variable to remove meaningless binding loop on implicitWidth - + visible: contentGui && contentGui.core.isText textMargin: 0 readOnly: true selectByMouse: true - + text: contentGui.core.richFormatText onSearchedTextPartChanged: { - contentGui.core.setSearchedTextPart(searchedTextPart) + contentGui.core.setSearchedTextPart(searchedTextPart); } textFormat: Text.RichText // To supports links and imgs. wrapMode: TextEdit.Wrap - - onLinkActivated: (link) => { - if (link.startsWith('sip')) - UtilsCpp.createCall(link) - else if (link.startsWith('mention:')) { - var mentionAddress = link.substring(8) // remove "mention:" - UtilsCpp.openContactAtAddress(mentionAddress); - } - else - Qt.openUrlExternally(link) - } - onSelectedTextChanged:{ - if(selectedText != '') lastTextSelected = selectedText + + onLinkActivated: link => { + if (link.startsWith('sip')) + UtilsCpp.createCall(link); + else if (link.startsWith('mention:')) { + var mentionAddress = link.substring(8); // remove "mention:" + UtilsCpp.openContactAtAddress(mentionAddress); + } else + Qt.openUrlExternally(link); + } + onSelectedTextChanged: { + if (selectedText != '') + lastTextSelected = selectedText; } onLinkHovered: { - if (hoveredLink !== "") UtilsCpp.setGlobalCursor(Qt.PointingHandCursor) - else UtilsCpp.restoreGlobalCursor() + if (hoveredLink !== "") + UtilsCpp.setGlobalCursor(Qt.PointingHandCursor); + else + UtilsCpp.restoreGlobalCursor(); } onActiveFocusChanged: { - if(activeFocus) { - lastTextSelected = '' - } - else mouseArea.keepLastSelection = false + if (activeFocus) { + lastTextSelected = ''; + } else + mouseArea.keepLastSelection = false; // deselect() } MouseArea { id: mouseArea property bool keepLastSelection: false - property int lastStartSelection:0 - property int lastEndSelection:0 + property int lastStartSelection: 0 + property int lastEndSelection: 0 anchors.fill: parent propagateComposedEvents: true hoverEnabled: true scrollGestureEnabled: false onContainsMouseChanged: { - if (containsMouse) UtilsCpp.setGlobalCursor(Qt.IBeamCursor) - else UtilsCpp.restoreGlobalCursor() + if (containsMouse) + UtilsCpp.setGlobalCursor(Qt.IBeamCursor); + else + UtilsCpp.restoreGlobalCursor(); } cursorShape: mainItem.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor acceptedButtons: Qt.LeftButton - onPressed: (mouse) => { - // if(!keepLastSelection) { - // lastStartSelection = parent.selectionStart - // lastEndSelection = parent.selectionEnd - // } - keepLastSelection = true - mouse.accepted = false - } + onPressed: mouse => { + // if(!keepLastSelection) { + // lastStartSelection = parent.selectionStart + // lastEndSelection = parent.selectionEnd + // } + keepLastSelection = true; + mouse.accepted = false; + } } } diff --git a/Linphone/view/Control/Display/Chat/Emoji/EmojiPicker.qml b/Linphone/view/Control/Display/Chat/Emoji/EmojiPicker.qml index 16566de16..6bea263e6 100644 --- a/Linphone/view/Control/Display/Chat/Emoji/EmojiPicker.qml +++ b/Linphone/view/Control/Display/Chat/Emoji/EmojiPicker.qml @@ -1,5 +1,5 @@ /* - * MIT License +* MIT License Copyright (c) 2023 AmirHosseinCH @@ -27,238 +27,241 @@ import QtQuick.Controls import QtQuick.Layouts import Linphone import UtilsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // import EmojiModel ColumnLayout { - id: mainItem - property var editor - property EmojiModel model: EmojiModel { - id: emojiModel - iconsPath: "image://emoji/emojiSvgs/" - iconsType: '.svg' - } - property var categories: ['Smileys & Emotion', 'People & Body', 'Animals & Nature', - 'Food & Drink', 'Activities', 'Travel & Places', 'Objects', 'Symbols', 'Flags'] - property var searchModel: ListModel {} - property bool searchMode: false - property int skinColor: -1 - - signal emojiClicked(string emoji) + id: mainItem + property var editor + property EmojiModel model: EmojiModel { + id: emojiModel + iconsPath: "image://emoji/emojiSvgs/" + iconsType: '.svg' + } + property var categories: ['Smileys & Emotion', 'People & Body', 'Animals & Nature', 'Food & Drink', 'Activities', + 'Travel & Places', 'Objects', 'Symbols', 'Flags'] + property var searchModel: ListModel {} + property bool searchMode: false + property int skinColor: -1 - function changeSkinColor(index) { - if (index !== skinColors.current) { - skinColors.itemAt(skinColors.current + 1).scale = 0.6 - skinColors.itemAt(index + 1).scale = 1 - skinColors.current = index - mainItem.skinColor = index - } - } - function refreshSearchModel() { - searchModel.clear() - var searchResult = model.search(searchField.text, skinColor) - for (var i = 0; i < searchResult.length; ++i) { - searchModel.append({path: searchResult[i]}) - } - } - RowLayout { - id: categoriesRow - Layout.preferredWidth: parent.width - Utils.getSizeWithScreenRatio(15) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(35) - Layout.leftMargin: Utils.getSizeWithScreenRatio(5) - Layout.alignment: Qt.AlignCenter - spacing: Utils.getSizeWithScreenRatio(searchField.widthSize > 0 ? 7 : 17) - clip: true - Image { - id: searchIcon - source: "image://emoji/icons/search.svg" - 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 - Utils.getSizeWithScreenRatio(25) - list.model = 1 - searchField.focus = true - } - } - } - Image { - id: closeIcon - source: "image://emoji/icons/close.svg" - sourceSize: Qt.size(Utils.getSizeWithScreenRatio(21),Utils.getSizeWithScreenRatio(21)) - visible: mainItem.searchMode - MouseArea { - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onClicked: { - mainItem.searchMode = false - searchField.widthSize = 0 - list.model = mainItem.categories - searchField.clear() - } - } - } - TextField { - id: searchField - property int widthSize: 0 - Layout.preferredWidth: widthSize - Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) - visible: widthSize > 0 ? true : false - placeholderText: 'Search Emoji' - Behavior on widthSize { - NumberAnimation { - duration: 400 - } - } - background: Rectangle { - radius: Utils.getSizeWithScreenRatio(10) - border.color: DefaultStyle.main1_500_main - } - onTextChanged: { - text.length > 0 ? mainItem.refreshSearchModel() : mainItem.searchModel.clear() - } - } - Repeater { - id: cateIcons - property var blackSvg: ['emoji-smiley.svg', 'emoji-people.svg', 'emoji-animal.svg', 'emoji-food.svg', - 'emoji-activity.svg', 'emoji-travel.svg', 'emoji-object.svg', 'emoji-symbol.svg', 'emoji-flag.svg'] - property var blueSvg: ['emoji-smiley-blue.svg', 'emoji-people-blue.svg', 'emoji-animal-blue.svg', - 'emoji-food-blue.svg', 'emoji-activity-blue.svg', 'emoji-travel-blue.svg', 'emoji-object-blue.svg', - 'emoji-symbol-blue.svg', 'emoji-flag-blue.svg'] - property int current: 0 - model: 9 - delegate: Image { - id: icon - source: "image://emoji/icons/" + cateIcons.blackSvg[index] - sourceSize: Qt.size(Utils.getSizeWithScreenRatio(20),Utils.getSizeWithScreenRatio(20)) - MouseArea { - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onClicked: { - if (cateIcons.current !== index) { - icon.source = "image://emoji/icons/" + cateIcons.blueSvg[index] - cateIcons.itemAt(cateIcons.current).source = "image://emoji/icons/" + cateIcons.blackSvg[cateIcons.current] - cateIcons.current = index - } - list.positionViewAtIndex(index, ListView.Beginning) - } - } - } - Component.onCompleted: { - itemAt(0).source = "image://emoji/icons/" + cateIcons.blueSvg[0] - } - } - } - ListView { - id: list - width: mainItem.width - height: Utils.getSizeWithScreenRatio(250) - Layout.fillWidth: true - Layout.fillHeight: true - model: mainItem.categories - 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 / Utils.getSizeWithScreenRatio(50)) - property int sc: grid.category === 'People & Body' ? mainItem.skinColor : -1 - columns: columnCount - width: list.width - columnSpacing: Utils.getSizeWithScreenRatio(5) - Text { - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) - text: grid.category - color: Qt.rgba(0, 0, 0, 0.5) - font.pixelSize: Utils.getSizeWithScreenRatio(15) - horizontalAlignment: Text.AlignLeft - leftPadding: Utils.getSizeWithScreenRatio(6) - Layout.columnSpan: grid.columnCount != 0 ? grid.columnCount : 1 - Layout.bottomMargin: Utils.getSizeWithScreenRatio(8) - } - Repeater { - model: mainItem.searchMode ? mainItem.searchModel : mainItem.model.count(grid.category) - delegate: Rectangle { - property alias es: emojiSvg - 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(Utils.getSizeWithScreenRatio(30),Utils.getSizeWithScreenRatio(30)) - anchors.centerIn: parent - asynchronous: true - } - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - property string imageUrl: emojiSvg.source - onClicked: { - var emojiInFont = Utils.codepointFromFilename(UtilsCpp.getFilename(emojiSvg.source)) - if (mainItem.editor) mainItem.editor.insert(mainItem.editor.cursorPosition, emojiInFont) - mainItem.emojiClicked(emojiInFont) - } - } - } - } - } - onContentYChanged: { - var index = list.indexAt(0, contentY + 15) - if (index !== -1 && index !== cateIcons.current) { - cateIcons.itemAt(index).source = "image://emoji/icons/" + cateIcons.blueSvg[index] - cateIcons.itemAt(cateIcons.current).source = "image://emoji/icons/" + cateIcons.blackSvg[cateIcons.current] - cateIcons.current = index - } - } - } - RowLayout { - Layout.preferredHeight: Utils.getSizeWithScreenRatio(35) - Layout.alignment: Qt.AlignCenter - spacing: 10 - Repeater { - id: skinColors - property var colors: ['#ffb84d', '#ffdab3', '#d2a479', '#ac7139', '#734b26', '#26190d'] - property int current: -1 - model: 6 - delegate: Rectangle { - id: colorRect - 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 { - NumberAnimation { - duration: 100 - } - } - MouseArea { - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onClicked: { - mainItem.changeSkinColor(index - 1) - if (mainItem.searchMode) { - mainItem.refreshSearchModel(); - } - } - } - } - Component.onCompleted: { - itemAt(0).scale = 1 - } - } - } + signal emojiClicked(string emoji) + + function changeSkinColor(index) { + if (index !== skinColors.current) { + skinColors.itemAt(skinColors.current + 1).scale = 0.6; + skinColors.itemAt(index + 1).scale = 1; + skinColors.current = index; + mainItem.skinColor = index; + } + } + function refreshSearchModel() { + searchModel.clear(); + var searchResult = model.search(searchField.text, skinColor); + for (var i = 0; i < searchResult.length; ++i) { + searchModel.append({ + path: searchResult[i] + }); + } + } + RowLayout { + id: categoriesRow + Layout.preferredWidth: parent.width - Utils.getSizeWithScreenRatio(15) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(35) + Layout.leftMargin: Utils.getSizeWithScreenRatio(5) + Layout.alignment: Qt.AlignCenter + spacing: Utils.getSizeWithScreenRatio(searchField.widthSize > 0 ? 7 : 17) + clip: true + Image { + id: searchIcon + source: "image://emoji/icons/search.svg" + 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 - Utils.getSizeWithScreenRatio(25); + list.model = 1; + searchField.focus = true; + } + } + } + Image { + id: closeIcon + source: "image://emoji/icons/close.svg" + sourceSize: Qt.size(Utils.getSizeWithScreenRatio(21), Utils.getSizeWithScreenRatio(21)) + visible: mainItem.searchMode + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + mainItem.searchMode = false; + searchField.widthSize = 0; + list.model = mainItem.categories; + searchField.clear(); + } + } + } + TextField { + id: searchField + property int widthSize: 0 + Layout.preferredWidth: widthSize + Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) + visible: widthSize > 0 ? true : false + placeholderText: 'Search Emoji' + Behavior on widthSize { + NumberAnimation { + duration: 400 + } + } + background: Rectangle { + radius: Utils.getSizeWithScreenRatio(10) + border.color: DefaultStyle.main1_500_main + } + onTextChanged: { + text.length > 0 ? mainItem.refreshSearchModel() : mainItem.searchModel.clear(); + } + } + Repeater { + id: cateIcons + property var blackSvg: ['emoji-smiley.svg', 'emoji-people.svg', 'emoji-animal.svg', 'emoji-food.svg', + 'emoji-activity.svg', 'emoji-travel.svg', 'emoji-object.svg', 'emoji-symbol.svg', 'emoji-flag.svg'] + property var blueSvg: ['emoji-smiley-blue.svg', 'emoji-people-blue.svg', 'emoji-animal-blue.svg', + 'emoji-food-blue.svg', 'emoji-activity-blue.svg', 'emoji-travel-blue.svg', 'emoji-object-blue.svg', + 'emoji-symbol-blue.svg', 'emoji-flag-blue.svg'] + property int current: 0 + model: 9 + delegate: Image { + id: icon + source: "image://emoji/icons/" + cateIcons.blackSvg[index] + sourceSize: Qt.size(Utils.getSizeWithScreenRatio(20), Utils.getSizeWithScreenRatio(20)) + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + if (cateIcons.current !== index) { + icon.source = "image://emoji/icons/" + cateIcons.blueSvg[index]; + cateIcons.itemAt(cateIcons.current).source = "image://emoji/icons/" + cateIcons.blackSvg[cateIcons.current]; + cateIcons.current = index; + } + list.positionViewAtIndex(index, ListView.Beginning); + } + } + } + Component.onCompleted: { + itemAt(0).source = "image://emoji/icons/" + cateIcons.blueSvg[0]; + } + } + } + ListView { + id: list + width: mainItem.width + height: Utils.getSizeWithScreenRatio(250) + Layout.fillWidth: true + Layout.fillHeight: true + model: mainItem.categories + 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 / Utils.getSizeWithScreenRatio(50)) + property int sc: grid.category === 'People & Body' ? mainItem.skinColor : -1 + columns: columnCount + width: list.width + columnSpacing: Utils.getSizeWithScreenRatio(5) + Text { + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + text: grid.category + color: Qt.rgba(0, 0, 0, 0.5) + font.pixelSize: Utils.getSizeWithScreenRatio(15) + horizontalAlignment: Text.AlignLeft + leftPadding: Utils.getSizeWithScreenRatio(6) + Layout.columnSpan: grid.columnCount != 0 ? grid.columnCount : 1 + Layout.bottomMargin: Utils.getSizeWithScreenRatio(8) + } + Repeater { + model: mainItem.searchMode ? mainItem.searchModel : mainItem.model.count(grid.category) + delegate: Rectangle { + property alias es: emojiSvg + 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(Utils.getSizeWithScreenRatio(30), Utils.getSizeWithScreenRatio(30)) + anchors.centerIn: parent + asynchronous: true + } + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + property string imageUrl: emojiSvg.source + onClicked: { + var emojiInFont = Utils.codepointFromFilename(UtilsCpp.getFilename(emojiSvg.source)); + if (mainItem.editor) + mainItem.editor.insert(mainItem.editor.cursorPosition, emojiInFont); + mainItem.emojiClicked(emojiInFont); + } + } + } + } + } + onContentYChanged: { + var index = list.indexAt(0, contentY + 15); + if (index !== -1 && index !== cateIcons.current) { + cateIcons.itemAt(index).source = "image://emoji/icons/" + cateIcons.blueSvg[index]; + cateIcons.itemAt(cateIcons.current).source = "image://emoji/icons/" + cateIcons.blackSvg[cateIcons.current]; + cateIcons.current = index; + } + } + } + RowLayout { + Layout.preferredHeight: Utils.getSizeWithScreenRatio(35) + Layout.alignment: Qt.AlignCenter + spacing: 10 + Repeater { + id: skinColors + property var colors: ['#ffb84d', '#ffdab3', '#d2a479', '#ac7139', '#734b26', '#26190d'] + property int current: -1 + model: 6 + delegate: Rectangle { + id: colorRect + 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 { + NumberAnimation { + duration: 100 + } + } + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + mainItem.changeSkinColor(index - 1); + if (mainItem.searchMode) { + mainItem.refreshSearchModel(); + } + } + } + } + Component.onCompleted: { + itemAt(0).scale = 1; + } + } + } } diff --git a/Linphone/view/Control/Display/Chat/Event.qml b/Linphone/view/Control/Display/Chat/Event.qml index f6be58be2..51f8b438c 100644 --- a/Linphone/view/Control/Display/Chat/Event.qml +++ b/Linphone/view/Control/Display/Chat/Event.qml @@ -45,4 +45,3 @@ RowLayout { color: DefaultStyle.main2_200 } } - diff --git a/Linphone/view/Control/Display/Chat/FileView.qml b/Linphone/view/Control/Display/Chat/FileView.qml index adb930908..0a0aa388a 100644 --- a/Linphone/view/Control/Display/Chat/FileView.qml +++ b/Linphone/view/Control/Display/Chat/FileView.qml @@ -4,12 +4,11 @@ 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 +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= - Item { id: mainItem property ChatMessageContentGui contentGui @@ -17,7 +16,7 @@ Item { property string name: contentGui && contentGui.core.name property string filePath: contentGui && contentGui.core.filePath property bool wasDownloaded: contentGui && contentGui.core.wasDownloaded - property bool isAnimatedImage : contentGui && contentGui.core.wasDownloaded && UtilsCpp.isAnimatedImage(filePath) + property bool isAnimatedImage: contentGui && contentGui.core.wasDownloaded && UtilsCpp.isAnimatedImage(filePath) property bool haveThumbnail: contentGui && UtilsCpp.canHaveThumbnail(filePath) && UtilsCpp.fileExists(filePath) property int fileSize: contentGui ? contentGui.core.fileSize : 0 property bool isTransferring @@ -28,29 +27,23 @@ Item { // property to change default view display property bool showAsSquare: true // default image - property var imageSource: mainItem.contentGui - ? UtilsCpp.isImage(mainItem.filePath) - ? AppIcons.fileImage - : UtilsCpp.isPdf(mainItem.filePath) - ? AppIcons.filePdf - : UtilsCpp.isText(mainItem.filePath) - ? AppIcons.fileText - : AppIcons.file - : '' + property var imageSource: mainItem.contentGui ? UtilsCpp.isImage(mainItem.filePath) ? AppIcons.fileImage : + UtilsCpp.isPdf(mainItem.filePath) ? AppIcons.filePdf : UtilsCpp.isText(mainItem.filePath) + ? AppIcons.fileText : AppIcons.file : '' property var thumbnailFillMode: Image.PreserveAspectCrop - + Connections { enabled: contentGui target: contentGui ? contentGui.core : null function onMsgStateChanged(state) { - mainItem.isTransferring = state === LinphoneEnums.ChatMessageState.StateFileTransferInProgress - || state === LinphoneEnums.ChatMessageState.StateInProgress + mainItem.isTransferring = state === LinphoneEnums.ChatMessageState.StateFileTransferInProgress || state + === LinphoneEnums.ChatMessageState.StateInProgress; } } // property bool isHovering: thumbnailProvider.state == 'hovered' property bool isOutgoing: false - + // --------------------------------------------------------------------- // Thumbnail // --------------------------------------------------------------------- @@ -107,33 +100,33 @@ Item { color: DefaultStyle.grey_1000 anchors.fill: parent // Video { - // id: videoThumbnail - // anchors.fill: parent - // position: 100 - // source: mainItem.isVideo ? "file:///" + mainItem.filePath : "" - // fillMode: playbackState === MediaPlayer.PlayingState ? VideoOutput.PreserveAspectFit : VideoOutput.PreserveAspectCrop - EffectImage { - anchors.centerIn: parent - // visible: videoThumbnail.playbackState !== MediaPlayer.PlayingState - width: Utils.getSizeWithScreenRatio(24) - height: Utils.getSizeWithScreenRatio(24) - imageSource: AppIcons.playFill - colorizationColor: DefaultStyle.main2_0 - } - // Text { - // z: parent.z + 1 - // property int timeDisplayed: videoThumbnail.playbackState === MediaPlayer.PlayingState ? videoThumbnail.position : videoThumbnail.duration - // anchors.bottom: parent.bottom - // anchors.left: parent.left - // anchors.bottomMargin: Utils.getSizeWithScreenRatio(6) - // anchors.leftMargin: Utils.getSizeWithScreenRatio(6) - // text: UtilsCpp.formatDuration(timeDisplayed) - // color: DefaultStyle.grey_0 - // font { - // pixelSize: Typography.d1.pixelSize - // weight: Typography.d1.weight - // } - // } + // id: videoThumbnail + // anchors.fill: parent + // position: 100 + // source: mainItem.isVideo ? "file:///" + mainItem.filePath : "" + // fillMode: playbackState === MediaPlayer.PlayingState ? VideoOutput.PreserveAspectFit : VideoOutput.PreserveAspectCrop + EffectImage { + anchors.centerIn: parent + // visible: videoThumbnail.playbackState !== MediaPlayer.PlayingState + width: Utils.getSizeWithScreenRatio(24) + height: Utils.getSizeWithScreenRatio(24) + imageSource: AppIcons.playFill + colorizationColor: DefaultStyle.main2_0 + } + // Text { + // z: parent.z + 1 + // property int timeDisplayed: videoThumbnail.playbackState === MediaPlayer.PlayingState ? videoThumbnail.position : videoThumbnail.duration + // anchors.bottom: parent.bottom + // anchors.left: parent.left + // anchors.bottomMargin: Utils.getSizeWithScreenRatio(6) + // anchors.leftMargin: Utils.getSizeWithScreenRatio(6) + // text: UtilsCpp.formatDuration(timeDisplayed) + // color: DefaultStyle.grey_0 + // font { + // pixelSize: Typography.d1.pixelSize + // weight: Typography.d1.weight + // } + // } // } } } @@ -143,7 +136,7 @@ Item { AnimatedImage { id: animatedImageSource mipmap: false//SettingsModel.mipmapEnabled - source: 'file:/'+ mainItem.filePath + source: 'file:/' + mainItem.filePath autoTransform: true fillMode: Image.PreserveAspectFit } @@ -165,7 +158,7 @@ Item { anchors.fill: parent color: FileViewStyle.extension.background.color radius: FileViewStyle.extension.radius - + Rectangle { color: DefaultStyle.main2_200 anchors.top: parent.top @@ -181,7 +174,7 @@ Item { } } } - + contentItem: Item { Text { id: fileName @@ -211,26 +204,29 @@ Item { id: progressBar anchors.centerIn: parent to: 100 - value: mainItem.contentGui ? (mainItem.fileSize>0 ? Math.floor(100 * mainItem.contentGui.core.fileOffset / mainItem.fileSize) : 0) : to + value: mainItem.contentGui ? (mainItem.fileSize > 0 ? Math.floor(100 * mainItem.contentGui.core.fileOffset + / mainItem.fileSize) : 0) : to visible: mainItem.isTransferring && value != 0 /* Change format? Current is % text: if(mainRow.contentGui){ - var mainItem.fileSize = Utils.formatSize(mainRow.contentGui.core.mainItem.fileSize) - return progressBar.visible - ? Utils.formatSize(mainRow.contentGui.core.fileOffset) + '/' + mainItem.fileSize - : mainItem.fileSize - }else - return '' + var mainItem.fileSize = Utils.formatSize(mainRow.contentGui.core.mainItem.fileSize) + return progressBar.visible + ? Utils.formatSize(mainRow.contentGui.core.fileOffset) + '/' + mainItem.fileSize + : mainItem.fileSize + }else + return '' */ } Rectangle { - visible: thumbnailProvider.state === 'hovered' && mainItem.contentGui && (/*!mainItem.isOutgoing &&*/ !mainItem.contentGui.core.wasDownloaded) + visible: thumbnailProvider.state === 'hovered' && mainItem.contentGui && (/*!mainItem.isOutgoing &&*/ + !mainItem.contentGui.core.wasDownloaded) color: DefaultStyle.grey_0 opacity: 0.5 anchors.fill: parent } EffectImage { - visible: thumbnailProvider.state === 'hovered' && mainItem.contentGui && (/*!mainItem.isOutgoing &&*/ !mainItem.contentGui.core.wasDownloaded) + visible: thumbnailProvider.state === 'hovered' && mainItem.contentGui && (/*!mainItem.isOutgoing &&*/ + !mainItem.contentGui.core.wasDownloaded) anchors.centerIn: parent imageSource: AppIcons.download width: Utils.getSizeWithScreenRatio(24) @@ -265,7 +261,6 @@ Item { width: parent.width / 2 height: parent.height radius: parent.radius - } EffectImage { z: parent.z + 1 @@ -302,15 +297,8 @@ Item { Loader { id: thumbnailProvider anchors.fill: parent - sourceComponent: mainItem.contentGui - ? mainItem.isAnimatedImage - ? animatedImage - : mainItem.haveThumbnail - ? thumbnailImage - : mainItem.showAsSquare - ? defaultSquareView - : defaultView - : undefined + sourceComponent: mainItem.contentGui ? mainItem.isAnimatedImage ? animatedImage : mainItem.haveThumbnail + ? thumbnailImage : mainItem.showAsSquare ? defaultSquareView : defaultView : undefined states: State { name: 'hovered' @@ -324,33 +312,34 @@ Item { // Changing cursor in MouseArea seems not to work with the Loader // Use override cursor for this case onContainsMouseChanged: { - if (containsMouse) UtilsCpp.setGlobalCursor(Qt.PointingHandCursor) - else UtilsCpp.restoreGlobalCursor() - thumbnailProvider.state = containsMouse ? 'hovered' : '' - } - onPressed: (mouse) => { - mouse.accepted = false - if(mainItem.isTransferring) { - mainItem.contentGui.core.lCancelDownloadFile() - mouse.accepted = true - } - else if(!mainItem.contentGui.core.wasDownloaded) { - mouse.accepted = true - mainItem.contentGui.core.lDownloadFile() - } else if (Utils.pointIsInItem(this, thumbnailProvider, mouse)) { - mouse.accepted = true - // if(SettingsModel.isVfsEncrypted){ - // window.attachVirtualWindow(Utils.buildCommonDialogUri('FileViewDialog'), { - // contentGui: mainItem.contentGui, - // }, function (status) { - // }) - // }else - mainItem.contentGui.core.lOpenFile() - } else if (mainItem.contentGui) { - mouse.accepted = true - mainItem.contentGui.core.lOpenFile(true)// Show directory - } + if (containsMouse) + UtilsCpp.setGlobalCursor(Qt.PointingHandCursor); + else + UtilsCpp.restoreGlobalCursor(); + thumbnailProvider.state = containsMouse ? 'hovered' : ''; } + onPressed: mouse => { + mouse.accepted = false; + if (mainItem.isTransferring) { + mainItem.contentGui.core.lCancelDownloadFile(); + mouse.accepted = true; + } else if (!mainItem.contentGui.core.wasDownloaded) { + mouse.accepted = true; + mainItem.contentGui.core.lDownloadFile(); + } else if (Utils.pointIsInItem(this, thumbnailProvider, mouse)) { + mouse.accepted = true; + // if(SettingsModel.isVfsEncrypted){ + // window.attachVirtualWindow(Utils.buildCommonDialogUri('FileViewDialog'), { + // contentGui: mainItem.contentGui, + // }, function (status) { + // }) + // }else + mainItem.contentGui.core.lOpenFile(); + } else if (mainItem.contentGui) { + mouse.accepted = true; + mainItem.contentGui.core.lOpenFile(true);// Show directory + } + } } } } diff --git a/Linphone/view/Control/Display/Chat/ImageFileView.qml b/Linphone/view/Control/Display/Chat/ImageFileView.qml index 49269386c..4e2c43b0e 100644 --- a/Linphone/view/Control/Display/Chat/ImageFileView.qml +++ b/Linphone/view/Control/Display/Chat/ImageFileView.qml @@ -4,11 +4,10 @@ import QtQuick.Layouts import Linphone import UtilsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= - // --------------------------------------------------------------------- // Separated file to show a single image bigger in chat message // The FileView file does not allow that as it is a Loader and the image @@ -33,18 +32,20 @@ Image { // Changing cursor in MouseArea seems not to work with the Loader // Use override cursor for this case onContainsMouseChanged: { - if (containsMouse) UtilsCpp.setGlobalCursor(Qt.PointingHandCursor) - else UtilsCpp.restoreGlobalCursor() - } - onPressed: (mouse) => { - mouse.accepted = true - // if(SettingsModel.isVfsEncrypted){ - // window.attachVirtualWindow(Utils.buildCommonDialogUri('FileViewDialog'), { - // contentGui: mainItem.contentGui, - // }, function (status) { - // }) - // }else - mainItem.contentGui.core.lOpenFile() + if (containsMouse) + UtilsCpp.setGlobalCursor(Qt.PointingHandCursor); + else + UtilsCpp.restoreGlobalCursor(); } + onPressed: mouse => { + mouse.accepted = true; + // if(SettingsModel.isVfsEncrypted){ + // window.attachVirtualWindow(Utils.buildCommonDialogUri('FileViewDialog'), { + // contentGui: mainItem.contentGui, + // }, function (status) { + // }) + // }else + mainItem.contentGui.core.lOpenFile(); + } } } diff --git a/Linphone/view/Control/Display/Chat/VideoFileView.qml b/Linphone/view/Control/Display/Chat/VideoFileView.qml index 6f48eb739..907d489e6 100644 --- a/Linphone/view/Control/Display/Chat/VideoFileView.qml +++ b/Linphone/view/Control/Display/Chat/VideoFileView.qml @@ -5,7 +5,7 @@ import QtQuick.Layouts import Linphone import UtilsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= Rectangle { @@ -60,13 +60,15 @@ Rectangle { // Changing cursor in MouseArea seems not to work with the Loader // Use override cursor for this case onContainsMouseChanged: { - if (containsMouse) UtilsCpp.setGlobalCursor(Qt.PointingHandCursor) - else UtilsCpp.restoreGlobalCursor() - } - onPressed: (mouse) => { - mouse.accepted = true - mainItem.contentGui.core.lOpenFile() + if (containsMouse) + UtilsCpp.setGlobalCursor(Qt.PointingHandCursor); + else + UtilsCpp.restoreGlobalCursor(); } + onPressed: mouse => { + mouse.accepted = true; + mainItem.contentGui.core.lOpenFile(); + } } EffectImage { anchors.centerIn: parent @@ -76,4 +78,4 @@ Rectangle { imageSource: AppIcons.playFill colorizationColor: DefaultStyle.main2_0 } -} \ No newline at end of file +} diff --git a/Linphone/view/Control/Display/Contact/AllContactListView.qml b/Linphone/view/Control/Display/Contact/AllContactListView.qml index f275677a8..e6074beef 100644 --- a/Linphone/view/Control/Display/Contact/AllContactListView.qml +++ b/Linphone/view/Control/Display/Contact/AllContactListView.qml @@ -9,412 +9,398 @@ import SettingsCpp import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Flickable { - id: mainItem + id: mainItem - flickableDirection: Flickable.VerticalFlick + flickableDirection: Flickable.VerticalFlick - property bool showInitials: true // Display Initials of Display name. - property bool showActions: false // Display actions layout (call buttons) - property bool showContactMenu: true // Display the dot menu for contacts. - property bool showFavorites: true // Display the favorites in the header - property bool hideSuggestions: false // Hide not stored contacts (not suggestions) - property bool showMe: true // Wether to display current account address or not (disabled for adding participants) - property string highlightText: searchText // Bold characters in Display name. - property var sourceFlags: LinphoneEnums.MagicSearchSource.All + property bool showInitials: true // Display Initials of Display name. + property bool showActions: false // Display actions layout (call buttons) + property bool showContactMenu: true // Display the dot menu for contacts. + property bool showFavorites: true // Display the favorites in the header + property bool hideSuggestions: false // Hide not stored contacts (not suggestions) + property bool showMe: true // Wether to display current account address or not (disabled for adding participants) + property string highlightText: searchText // Bold characters in Display name. + property var sourceFlags: LinphoneEnums.MagicSearchSource.All - property bool displayNameCapitalization: true // Capitalize display name. + property bool displayNameCapitalization: true // Capitalize display name. - property bool selectionEnabled: true // Contact can be selected - property bool multiSelectionEnabled: false //Multiple items can be selected. - property list selectedContacts - // List of default address on selected contacts. - //property FriendGui selectedContact//: model.getAt(currentIndex) || null - property FriendGui highlightedContact + property bool selectionEnabled: true // Contact can be selected + property bool multiSelectionEnabled: false //Multiple items can be selected. + property list selectedContacts + // List of default address on selected contacts. + //property FriendGui selectedContact//: model.getAt(currentIndex) || null + property FriendGui highlightedContact - property bool searchOnEmpty: true - property bool loading: false - property bool pauseSearch: false // true = don't search on text change + property bool searchOnEmpty: true + property bool loading: false + property bool pauseSearch: false // true = don't search on text change - // Model properties - // set searchBarText without specifying a model to bold - // matching names - property string searchBarText - property string searchText - // Binding is done on searchBarTextChanged - property ConferenceInfoGui confInfoGui + // Model properties + // set searchBarText without specifying a model to bold + // matching names + property string searchBarText + property string searchText + // Binding is done on searchBarTextChanged + property ConferenceInfoGui confInfoGui - property bool haveFavorites: false - property bool haveContacts: count > 0 - property real sectionsPixelSize: Typography.h4.pixelSize - property real sectionsWeight: Typography.h4.weight - property real sectionsSpacing: Utils.getSizeWithScreenRatio(18) - property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) + property bool haveFavorites: false + property bool haveContacts: count > 0 + property real sectionsPixelSize: Typography.h4.pixelSize + property real sectionsWeight: Typography.h4.weight + property real sectionsSpacing: Utils.getSizeWithScreenRatio(18) + property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) - property real itemsRightMargin: Utils.getSizeWithScreenRatio(39) - property int count: contactsList.count + suggestionsList.count + favoritesList.count + property real itemsRightMargin: Utils.getSizeWithScreenRatio(39) + property int count: contactsList.count + suggestionsList.count + favoritesList.count - contentHeight: contentsLayout.height - rightMargin: itemsRightMargin + contentHeight: contentsLayout.height + rightMargin: itemsRightMargin - signal contactStarredChanged - signal contactDeletionRequested(FriendGui contact) - signal contactAddedToSelection(string address) - signal contactRemovedFromSelection(string address) - signal contactSelected(FriendGui contact) + signal contactStarredChanged + signal contactDeletionRequested(FriendGui contact) + signal contactAddedToSelection(string address) + signal contactRemovedFromSelection(string address) + signal contactSelected(FriendGui contact) - function selectContact(address) { - var index = contactsProxy.loadUntil(address) // Be sure to have this address in proxy if it exists - if (index != -1) { - contactsList.selectIndex(index) - } - return index - } - function addContactToSelection(address) { - if (multiSelectionEnabled) { - var indexInSelection = selectedContacts.indexOf(address) - if (indexInSelection == -1) { - selectedContacts.push(address) - contactAddedToSelection(address) - } - } - } - function removeContactFromSelection(indexInSelection) { - var addressToRemove = selectedContacts[indexInSelection] - if (indexInSelection != -1) { - selectedContacts.splice(indexInSelection, 1) - contactRemovedFromSelection(addressToRemove) - } - } - function removeSelectedContactByAddress(address) { - var index = selectedContacts.indexOf(address) - if (index != -1) { - selectedContacts.splice(index, 1) - contactRemovedFromSelection(address) - } - } - function haveAddress(address) { - var index = magicSearchProxy.findFriendIndexByAddress(address) - return index != -1 - } + function selectContact(address) { + var index = contactsProxy.loadUntil(address); // Be sure to have this address in proxy if it exists + if (index != -1) { + contactsList.selectIndex(index); + } + return index; + } + function addContactToSelection(address) { + if (multiSelectionEnabled) { + var indexInSelection = selectedContacts.indexOf(address); + if (indexInSelection == -1) { + selectedContacts.push(address); + contactAddedToSelection(address); + } + } + } + function removeContactFromSelection(indexInSelection) { + var addressToRemove = selectedContacts[indexInSelection]; + if (indexInSelection != -1) { + selectedContacts.splice(indexInSelection, 1); + contactRemovedFromSelection(addressToRemove); + } + } + function removeSelectedContactByAddress(address) { + var index = selectedContacts.indexOf(address); + if (index != -1) { + selectedContacts.splice(index, 1); + contactRemovedFromSelection(address); + } + } + function haveAddress(address) { + var index = magicSearchProxy.findFriendIndexByAddress(address); + return index != -1; + } - function getFirstContact() { - if (mainItem.showFavorites) { - var firstContact = favoritesList.itemAtIndex(0) - if (firstContact !== null) return firstContact - } - var firstContact = contactsList.itemAtIndex(0) - if (firstContact !== null) return firstContact - if (!mainItem.hideSuggestions) { - var firstContact = suggestionsList.itemAtIndex(0) - if (firstContact !== null) return firstContact - } - return null - } + function getFirstContact() { + if (mainItem.showFavorites) { + var firstContact = favoritesList.itemAtIndex(0); + if (firstContact !== null) + return firstContact; + } + var firstContact = contactsList.itemAtIndex(0); + if (firstContact !== null) + return firstContact; + if (!mainItem.hideSuggestions) { + var firstContact = suggestionsList.itemAtIndex(0); + if (firstContact !== null) + return firstContact; + } + return null; + } - function resetSelections() { - mainItem.highlightedContact = null - favoritesList.currentIndex = -1 - contactsList.currentIndex = -1 - suggestionsList.currentIndex = -1 - } + function resetSelections() { + mainItem.highlightedContact = null; + favoritesList.currentIndex = -1; + contactsList.currentIndex = -1; + suggestionsList.currentIndex = -1; + } - function findNextList(item, count, direction) { - if (count == 3) - return null - var nextItem - switch (item) { - case suggestionsList: - nextItem = (direction > 0 ? favoritesList : contactsList) - break - case contactsList: - nextItem = (direction > 0 ? suggestionsList : favoritesList) - break - case favoritesList: - nextItem = (direction > 0 ? contactsList : suggestionsList) - break - default: - return null - } - if (nextItem.model.count > 0) - return nextItem - else - return findNextList(nextItem, count + 1, direction) - } + function findNextList(item, count, direction) { + if (count == 3) + return null; + var nextItem; + switch (item) { + case suggestionsList: + nextItem = (direction > 0 ? favoritesList : contactsList); + break; + case contactsList: + nextItem = (direction > 0 ? suggestionsList : favoritesList); + break; + case favoritesList: + nextItem = (direction > 0 ? contactsList : suggestionsList); + break; + default: + return null; + } + if (nextItem.model.count > 0) + return nextItem; + else + return findNextList(nextItem, count + 1, direction); + } - function updatePosition(list) { - Utils.updatePosition(mainItem, list) - } + function updatePosition(list) { + Utils.updatePosition(mainItem, list); + } - onHighlightedContactChanged: { - favoritesList.highlightedContact = highlightedContact - contactsList.highlightedContact = highlightedContact - suggestionsList.highlightedContact = highlightedContact - } + onHighlightedContactChanged: { + favoritesList.highlightedContact = highlightedContact; + contactsList.highlightedContact = highlightedContact; + suggestionsList.highlightedContact = highlightedContact; + } - onSearchBarTextChanged: { - if (!pauseSearch && (mainItem.searchOnEmpty || searchBarText != '')) { - searchText = searchBarText.length === 0 ? "*" : searchBarText - } - } - onPauseSearchChanged: { - if (!pauseSearch && (mainItem.searchOnEmpty || searchBarText != '')) { - searchText = searchBarText.length === 0 ? "*" : searchBarText - } - } - onSearchTextChanged: { - loading = true - } + onSearchBarTextChanged: { + if (!pauseSearch && (mainItem.searchOnEmpty || searchBarText != '')) { + searchText = searchBarText.length === 0 ? "*" : searchBarText; + } + } + onPauseSearchChanged: { + if (!pauseSearch && (mainItem.searchOnEmpty || searchBarText != '')) { + searchText = searchBarText.length === 0 ? "*" : searchBarText; + } + } + onSearchTextChanged: { + loading = true; + } - Keys.onPressed: event => { - if (!event.accepted) { - if (event.key == Qt.Key_Up - || event.key == Qt.Key_Down) { - var newItem - var direction = (event.key == Qt.Key_Up ? -1 : 1) - if (suggestionsList.activeFocus) - newItem = findNextList(suggestionsList, 0, - direction) - else if (contactsList.activeFocus) - newItem = findNextList(contactsList, 0, - direction) - else if (favoritesList.activeFocus) - newItem = findNextList(favoritesList, 0, - direction) - else - newItem = findNextList(suggestionsList, 0, - direction) - if (newItem) { - newItem.selectIndex( - direction > 0 ? -1 : newItem.model.count - 1, direction > 0 ? Qt.BacktabFocusReason : Qt.TabFocusReason) - event.accepted = true - } - } - } - } - Component.onCompleted: { - if (confInfoGui) { - for (var i = 0; i < confInfoGui.core.participants.length; ++i) { - selectedContacts.push( - confInfoGui.core.getParticipantAddressAt(i)) - } - } - } + Keys.onPressed: event => { + if (!event.accepted) { + if (event.key == Qt.Key_Up || event.key == Qt.Key_Down) { + var newItem; + var direction = (event.key == Qt.Key_Up ? -1 : 1); + if (suggestionsList.activeFocus) + newItem = findNextList(suggestionsList, 0, direction); + else if (contactsList.activeFocus) + newItem = findNextList(contactsList, 0, direction); + else if (favoritesList.activeFocus) + newItem = findNextList(favoritesList, 0, direction); + else + newItem = findNextList(suggestionsList, 0, direction); + if (newItem) { + newItem.selectIndex(direction > 0 ? -1 : newItem.model.count - 1, direction > 0 ? Qt.BacktabFocusReason : + Qt.TabFocusReason); + event.accepted = true; + } + } + } + } + Component.onCompleted: { + if (confInfoGui) { + for (var i = 0; i < confInfoGui.core.participants.length; ++i) { + selectedContacts.push(confInfoGui.core.getParticipantAddressAt(i)); + } + } + } - Connections { - target: SettingsCpp - onLdapConfigChanged: { - if (SettingsCpp.syncLdapContacts) - magicSearchProxy.forceUpdate() - } - } + Connections { + target: SettingsCpp + onLdapConfigChanged: { + if (SettingsCpp.syncLdapContacts) + magicSearchProxy.forceUpdate(); + } + } - property MagicSearchProxy mainModel: MagicSearchProxy { - id: magicSearchProxy - searchText: mainItem.searchText - aggregationFlag: LinphoneEnums.MagicSearchAggregation.Friend - sourceFlags: mainItem.sourceFlags - onModelReset: { - mainItem.resetSelections() - } - onResultsProcessed: { - mainItem.loading = false - mainItem.contentY = 0 - } + property MagicSearchProxy mainModel: MagicSearchProxy { + id: magicSearchProxy + searchText: mainItem.searchText + aggregationFlag: LinphoneEnums.MagicSearchAggregation.Friend + sourceFlags: mainItem.sourceFlags + onModelReset: { + mainItem.resetSelections(); + } + onResultsProcessed: { + mainItem.loading = false; + mainItem.contentY = 0; + } - onInitialized: { - if (mainItem.searchOnEmpty || searchText != '') { - mainItem.loading = true - forceUpdate() - } - } - } + onInitialized: { + if (mainItem.searchOnEmpty || searchText != '') { + mainItem.loading = true; + forceUpdate(); + } + } + } - onAtYEndChanged: if (atYEnd) { - if (favoritesProxy.haveMore && favoritesList.expanded && mainItem.showFavorites) - favoritesProxy.displayMore() - else if (contactsProxy.haveMore && contactsList.expanded) { - contactsProxy.displayMore() - } - else - suggestionsProxy.displayMore() - } - Behavior on contentY { - NumberAnimation { - duration: 500 - easing.type: Easing.OutExpo - } - } + onAtYEndChanged: if (atYEnd) { + if (favoritesProxy.haveMore && favoritesList.expanded && mainItem.showFavorites) + favoritesProxy.displayMore(); + else if (contactsProxy.haveMore && contactsList.expanded) { + contactsProxy.displayMore(); + } else + suggestionsProxy.displayMore(); + } + Behavior on contentY { + NumberAnimation { + duration: 500 + easing.type: Easing.OutExpo + } + } - Control.ScrollBar.vertical: ScrollBar { - id: scrollbar - z: 1 - topPadding: Utils.getSizeWithScreenRatio(24) // Avoid to be on top of collapse button - active: true - interactive: true - visible: mainItem.contentHeight > mainItem.height - policy: Control.ScrollBar.AsNeeded - } + Control.ScrollBar.vertical: ScrollBar { + id: scrollbar + z: 1 + topPadding: Utils.getSizeWithScreenRatio(24) // Avoid to be on top of collapse button + active: true + interactive: true + visible: mainItem.contentHeight > mainItem.height + policy: Control.ScrollBar.AsNeeded + } - ColumnLayout { - id: contentsLayout - width: mainItem.width - spacing: 0 + ColumnLayout { + id: contentsLayout + width: mainItem.width + spacing: 0 - BusyIndicator { - id: busyIndicator - visible: mainItem.loading - width: mainItem.busyIndicatorSize - height: mainItem.busyIndicatorSize - Layout.preferredWidth: mainItem.busyIndicatorSize - Layout.preferredHeight: mainItem.busyIndicatorSize - Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter - } + BusyIndicator { + id: busyIndicator + visible: mainItem.loading + width: mainItem.busyIndicatorSize + height: mainItem.busyIndicatorSize + Layout.preferredWidth: mainItem.busyIndicatorSize + Layout.preferredHeight: mainItem.busyIndicatorSize + Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter + } - ContactListView { - id: favoritesList - visible: contentHeight > 0 - Layout.fillWidth: true - Layout.preferredHeight: implicitHeight - sectionsWeight: mainItem.sectionsWeight - sectionsPixelSize: mainItem.sectionsPixelSize - interactive: false - highlightText: mainItem.highlightText - showActions: mainItem.showActions - showInitials: mainItem.showInitials - showContactMenu: mainItem.showContactMenu - showDefaultAddress: false - selectionEnabled: mainItem.selectionEnabled - multiSelectionEnabled: mainItem.multiSelectionEnabled - selectedContacts: mainItem.selectedContacts - //: "Favoris" - title: qsTr("car_favorites_contacts_title") - itemsRightMargin: mainItem.itemsRightMargin + ContactListView { + id: favoritesList + visible: contentHeight > 0 + Layout.fillWidth: true + Layout.preferredHeight: implicitHeight + sectionsWeight: mainItem.sectionsWeight + sectionsPixelSize: mainItem.sectionsPixelSize + interactive: false + highlightText: mainItem.highlightText + showActions: mainItem.showActions + showInitials: mainItem.showInitials + showContactMenu: mainItem.showContactMenu + showDefaultAddress: false + selectionEnabled: mainItem.selectionEnabled + multiSelectionEnabled: mainItem.multiSelectionEnabled + selectedContacts: mainItem.selectedContacts + //: "Favoris" + title: qsTr("car_favorites_contacts_title") + itemsRightMargin: mainItem.itemsRightMargin - onHighlightedContactChanged: mainItem.highlightedContact = highlightedContact - onContactSelected: contactGui => { - mainItem.contactSelected(contactGui) - } - onUpdatePosition: mainItem.updatePosition(favoritesList) - onContactDeletionRequested: contact => { - mainItem.contactDeletionRequested( - contact) - } - onAddContactToSelection: address => { - mainItem.addContactToSelection(address) - } - onRemoveContactFromSelection: index => { - mainItem.removeContactFromSelection( - index) - } + onHighlightedContactChanged: mainItem.highlightedContact = highlightedContact + onContactSelected: contactGui => { + mainItem.contactSelected(contactGui); + } + onUpdatePosition: mainItem.updatePosition(favoritesList) + onContactDeletionRequested: contact => { + mainItem.contactDeletionRequested(contact); + } + onAddContactToSelection: address => { + mainItem.addContactToSelection(address); + } + onRemoveContactFromSelection: index => { + mainItem.removeContactFromSelection(index); + } - property MagicSearchProxy proxy: MagicSearchProxy { - id: favoritesProxy - parentProxy: mainItem.mainModel - showMe: mainItem.showMe - filterType: MagicSearchProxy.FilteringTypes.Favorites - } - model: mainItem.showFavorites - && (mainItem.searchBarText == '' - || mainItem.searchBarText == '*') ? proxy : [] - } + property MagicSearchProxy proxy: MagicSearchProxy { + id: favoritesProxy + parentProxy: mainItem.mainModel + showMe: mainItem.showMe + filterType: MagicSearchProxy.FilteringTypes.Favorites + } + model: mainItem.showFavorites && (mainItem.searchBarText == '' || mainItem.searchBarText == '*') ? proxy : [] + } - ContactListView { - id: contactsList - visible: contentHeight > 0 - Layout.fillWidth: true - Layout.preferredHeight: implicitHeight - Layout.topMargin: favoritesList.height > 0 ? Utils.getSizeWithScreenRatio(4) : 0 - interactive: false - highlightText: mainItem.highlightText - showActions: mainItem.showActions - showInitials: mainItem.showInitials - showContactMenu: mainItem.showContactMenu - showDefaultAddress: false - selectionEnabled: mainItem.selectionEnabled - multiSelectionEnabled: mainItem.multiSelectionEnabled - selectedContacts: mainItem.selectedContacts - itemsRightMargin: mainItem.itemsRightMargin - //: 'Contacts' - title: qsTr("generic_address_picker_contacts_list_title") + ContactListView { + id: contactsList + visible: contentHeight > 0 + Layout.fillWidth: true + Layout.preferredHeight: implicitHeight + Layout.topMargin: favoritesList.height > 0 ? Utils.getSizeWithScreenRatio(4) : 0 + interactive: false + highlightText: mainItem.highlightText + showActions: mainItem.showActions + showInitials: mainItem.showInitials + showContactMenu: mainItem.showContactMenu + showDefaultAddress: false + selectionEnabled: mainItem.selectionEnabled + multiSelectionEnabled: mainItem.multiSelectionEnabled + selectedContacts: mainItem.selectedContacts + itemsRightMargin: mainItem.itemsRightMargin + //: 'Contacts' + title: qsTr("generic_address_picker_contacts_list_title") - onHighlightedContactChanged: mainItem.highlightedContact = highlightedContact - onContactSelected: contactGui => { - mainItem.contactSelected(contactGui) - } - onUpdatePosition: mainItem.updatePosition(contactsList) - onContactDeletionRequested: contact => { - mainItem.contactDeletionRequested( - contact) - } - onAddContactToSelection: address => { - mainItem.addContactToSelection(address) - } - onRemoveContactFromSelection: index => { - mainItem.removeContactFromSelection( - index) - } + onHighlightedContactChanged: mainItem.highlightedContact = highlightedContact + onContactSelected: contactGui => { + mainItem.contactSelected(contactGui); + } + onUpdatePosition: mainItem.updatePosition(contactsList) + onContactDeletionRequested: contact => { + mainItem.contactDeletionRequested(contact); + } + onAddContactToSelection: address => { + mainItem.addContactToSelection(address); + } + onRemoveContactFromSelection: index => { + mainItem.removeContactFromSelection(index); + } - model: MagicSearchProxy { - id: contactsProxy - parentProxy: mainItem.mainModel - filterType: MagicSearchProxy.FilteringTypes.App - | (mainItem.searchText != '*' - && mainItem.searchText != '' - || SettingsCpp.syncLdapContacts ? MagicSearchProxy.FilteringTypes.Ldap | MagicSearchProxy.FilteringTypes.CardDAV : 0) - initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(63))) - displayItemsStep: 3 * initialDisplayItems / 2 - onLocalFriendCreated: (index) => { - contactsList.selectIndex(index) - } - } - } - ContactListView { - id: suggestionsList - visible: contentHeight > 0 - Layout.fillWidth: true - Layout.preferredHeight: implicitHeight - Layout.topMargin: (contactsList.height + favoritesList.height) > 0 ? Utils.getSizeWithScreenRatio(4) : 0 - interactive: false - showInitials: false - highlightText: mainItem.highlightText - showActions: mainItem.showActions - showContactMenu: mainItem.showContactMenu - showDefaultAddress: true - showDisplayName: false - selectionEnabled: mainItem.selectionEnabled - multiSelectionEnabled: mainItem.multiSelectionEnabled - selectedContacts: mainItem.selectedContacts - //: "Suggestions" - title: qsTr("generic_address_picker_suggestions_list_title") - itemsRightMargin: mainItem.itemsRightMargin + model: MagicSearchProxy { + id: contactsProxy + parentProxy: mainItem.mainModel + filterType: MagicSearchProxy.FilteringTypes.App | (mainItem.searchText != '*' && mainItem.searchText != '' + || SettingsCpp.syncLdapContacts ? MagicSearchProxy.FilteringTypes.Ldap + | MagicSearchProxy.FilteringTypes.CardDAV : 0) + initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(63))) + displayItemsStep: 3 * initialDisplayItems / 2 + onLocalFriendCreated: index => { + contactsList.selectIndex(index); + } + } + } + ContactListView { + id: suggestionsList + visible: contentHeight > 0 + Layout.fillWidth: true + Layout.preferredHeight: implicitHeight + Layout.topMargin: (contactsList.height + favoritesList.height) > 0 ? Utils.getSizeWithScreenRatio(4) : 0 + interactive: false + showInitials: false + highlightText: mainItem.highlightText + showActions: mainItem.showActions + showContactMenu: mainItem.showContactMenu + showDefaultAddress: true + showDisplayName: false + selectionEnabled: mainItem.selectionEnabled + multiSelectionEnabled: mainItem.multiSelectionEnabled + selectedContacts: mainItem.selectedContacts + //: "Suggestions" + title: qsTr("generic_address_picker_suggestions_list_title") + itemsRightMargin: mainItem.itemsRightMargin - onHighlightedContactChanged: mainItem.highlightedContact = highlightedContact - onContactSelected: contactGui => { - mainItem.contactSelected(contactGui) - } - onUpdatePosition: mainItem.updatePosition(suggestionsList) - onContactDeletionRequested: contact => { - mainItem.contactDeletionRequested( - contact) - } - onAddContactToSelection: address => { - mainItem.addContactToSelection(address) - } - onRemoveContactFromSelection: index => { - mainItem.removeContactFromSelection( - index) - } - model: MagicSearchProxy { - id: suggestionsProxy - parentProxy: mainItem.mainModel - filterType: mainItem.hideSuggestions ? MagicSearchProxy.FilteringTypes.None : MagicSearchProxy.FilteringTypes.Other - 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 - } - } - } + onHighlightedContactChanged: mainItem.highlightedContact = highlightedContact + onContactSelected: contactGui => { + mainItem.contactSelected(contactGui); + } + onUpdatePosition: mainItem.updatePosition(suggestionsList) + onContactDeletionRequested: contact => { + mainItem.contactDeletionRequested(contact); + } + onAddContactToSelection: address => { + mainItem.addContactToSelection(address); + } + onRemoveContactFromSelection: index => { + mainItem.removeContactFromSelection(index); + } + model: MagicSearchProxy { + id: suggestionsProxy + parentProxy: mainItem.mainModel + filterType: mainItem.hideSuggestions ? MagicSearchProxy.FilteringTypes.None : MagicSearchProxy.FilteringTypes.Other + 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 14c2c68cd..971747e8a 100644 --- a/Linphone/view/Control/Display/Contact/Avatar.qml +++ b/Linphone/view/Control/Display/Contact/Avatar.qml @@ -11,34 +11,21 @@ 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. // TODO : get FriendGui from Call. -Loader{ +Loader { id: mainItem property AccountGui account: null property FriendGui contact: null property CallGui call: null property bool isConference: false property bool shadowEnabled: true - property var _address: account - ? account.core?.identityAddress || "" - : call - ? call.core.remoteAddress - : contact - ? contact.core.defaultAddress - : '' + property var _address: account ? account.core?.identityAddress || "" : call ? call.core.remoteAddress : contact + ? contact.core.defaultAddress : '' readonly property var address: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(_address) : _address property var displayNameObj: UtilsCpp.getDisplayName(_address) - property var displayNameVal: account && account.core.displayName - ? account.core.displayName - : contact && contact.core.fullName - ? contact.core.fullName - : displayNameObj - ? displayNameObj.value - : "" - property bool haveAvatar: account - ? account.core.pictureUri - : contact - ? contact.core.pictureUri - : computedAvatarUri.length != 0 + property var displayNameVal: account && account.core.displayName ? account.core.displayName : contact && contact.core.fullName + ? contact.core.fullName : displayNameObj ? displayNameObj.value : "" + property bool haveAvatar: account ? account.core.pictureUri : contact ? contact.core.pictureUri : + computedAvatarUri.length != 0 property var avatarObj: UtilsCpp.findAvatarByAddress(_address) property string computedAvatarUri: avatarObj ? avatarObj.value : '' @@ -46,25 +33,23 @@ Loader{ // override it as secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified property var friendSecurityLevelObj: UtilsCpp.getFriendSecurityLevel(_address) property var friendSecurityLevel: friendSecurityLevelObj ? securityLevelObj.value : LinphoneEnums.SecurityLevel.None - + // To get the secured property for a specific address, // override it as secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified property var securityLevelObj: UtilsCpp.getFriendAddressSecurityLevel(_address) property var securityLevel: securityLevelObj ? securityLevelObj.value : LinphoneEnums.SecurityLevel.None - property bool secured: call && call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp - ? call.core.tokenVerified - : contact - ? contact.core.devices.length != 0 && contact.core.verifiedDeviceCount === contact.core.devices.length - : false - + property bool secured: call && call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp ? call.core.tokenVerified : + contact ? contact.core.devices.length != 0 && contact.core.verifiedDeviceCount + === contact.core.devices.length : false + property bool securityBreach: securityLevel === LinphoneEnums.SecurityLevel.Unsafe property bool displayPresence: true asynchronous: true - sourceComponent: Component{ + sourceComponent: Component { Item { anchors.fill: parent - + MultiEffect { visible: mainItem.shadowEnabled enabled: mainItem.shadowEnabled @@ -77,16 +62,17 @@ Loader{ } StackView { id: stackView - + initialItem: mainItem.haveAvatar ? avatar : initials anchors.fill: parent - - Connections{ + + Connections { target: mainItem onHaveAvatarChanged: { - stackView.replace(mainItem.haveAvatar ? avatar : initials, StackView.Immediate)} + stackView.replace(mainItem.haveAvatar ? avatar : initials, StackView.Immediate); + } } - + Rectangle { visible: mainItem.secured || mainItem.securityBreach anchors.fill: stackView.currentItem @@ -94,7 +80,7 @@ Loader{ z: 1 color: "transparent" border { - width: Utils.getSizeWithScreenRatio(2) + width: Utils.getSizeWithScreenRatio(2) color: mainItem.secured ? DefaultStyle.info_500_main : DefaultStyle.danger_500_main } EffectImage { @@ -104,28 +90,22 @@ Loader{ height: width imageSource: mainItem.secured ? AppIcons.trusted : AppIcons.notTrusted fillMode: Image.PreserveAspectFit - } } - + Image { visible: mainItem.displayPresence - width: stackView.width/4.5 + width: stackView.width / 4.5 height: width sourceSize.width: width - sourceSize.height: width + sourceSize.height: width smooth: false anchors.bottom: parent.bottom anchors.right: parent.right anchors.rightMargin: stackView.width / 15 z: 1 - source: account - ? (account.core?.registrationState !== LinphoneEnums.RegistrationState.Ok - ? account.core?.registrationIcon - : account.core?.presenceIcon) - : (contact - ? contact.core?.presenceIcon - : "") + source: account ? (account.core?.registrationState !== LinphoneEnums.RegistrationState.Ok ? account.core?.registrationIcon : + account.core?.presenceIcon) : (contact ? contact.core?.presenceIcon : "") RotationAnimator on rotation { running: mainItem.account && mainItem.account.core.registrationState === LinphoneEnums.RegistrationState.Progress direction: RotationAnimator.Clockwise @@ -135,10 +115,9 @@ Loader{ duration: 10000 } } - } - - Component{ + + Component { id: initials Item { id: avatarItem @@ -146,7 +125,8 @@ Loader{ width: height Rectangle { id: initialItem - property string initials: mainItem.isConference || (mainItem.displayNameVal && mainItem.displayNameVal[0] === "+") ? "" : UtilsCpp.getInitials(mainItem.displayNameVal) + property string initials: mainItem.isConference || (mainItem.displayNameVal && mainItem.displayNameVal[0] + === "+") ? "" : UtilsCpp.getInitials(mainItem.displayNameVal) radius: width / 2 color: DefaultStyle.main2_200 height: stackView.height @@ -167,7 +147,7 @@ Loader{ EffectImage { id: initialImg visible: initialItem.initials === "" || initialItem.initials[0] === "+" - width: stackView.width/2 + width: stackView.width / 2 height: width colorizationColor: DefaultStyle.main2_600 imageSource: mainItem.isConference ? AppIcons.videoconference : AppIcons.profile @@ -188,7 +168,7 @@ Loader{ } } } - Component{ + Component { id: avatar Item { id: avatarItem @@ -204,11 +184,8 @@ Loader{ sourceSize.height: avatarItem.height fillMode: Image.PreserveAspectCrop anchors.centerIn: parent - source: mainItem.account - ? mainItem.account.core.pictureUri - : mainItem.contact - ? mainItem.contact.core.pictureUri - : computedAvatarUri + source: mainItem.account ? mainItem.account.core.pictureUri : mainItem.contact ? mainItem.contact.core.pictureUri : + computedAvatarUri mipmap: true layer.enabled: true } diff --git a/Linphone/view/Control/Display/Contact/Contact.qml b/Linphone/view/Control/Display/Contact/Contact.qml index a256bda69..d714eb432 100644 --- a/Linphone/view/Control/Display/Contact/Contact.qml +++ b/Linphone/view/Control/Display/Contact/Contact.qml @@ -4,28 +4,27 @@ import QtQuick.Effects import QtQuick.Layouts import QtQuick.Controls.Basic as Control - import Linphone import UtilsCpp import SettingsCpp import CustomControls 1.0 -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle -Control.Control{ +Control.Control { id: mainItem activeFocusOnTab: true - padding: Utils.getSizeWithScreenRatio(10) + padding: Utils.getSizeWithScreenRatio(10) property AccountGui account - leftPadding: Utils.getSizeWithScreenRatio(8) - rightPadding: Utils.getSizeWithScreenRatio(8) + leftPadding: Utils.getSizeWithScreenRatio(8) + rightPadding: Utils.getSizeWithScreenRatio(8) property var style property bool isSelected property bool keyboardFocus: FocusHelper.keyboardFocus // Background properties - readonly property color defaultBackgroundColor: style?.color?.normal ?? DefaultStyle.grey_0 + readonly property color defaultBackgroundColor: style?.color?.normal ?? DefaultStyle.grey_0 readonly property color hoveredBackgroundColor: style?.color?.hovered ?? defaultBackgroundColor readonly property color selectedBackgroundColor: style?.color?.selected ?? defaultBackgroundColor readonly property color focusedBackgroundColor: style?.color?.keybaordFocused ?? defaultBackgroundColor @@ -37,42 +36,45 @@ Control.Control{ property real borderWidth: Utils.getSizeWithScreenRatio(1) property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3) - signal avatarClicked() - signal backgroundClicked() - signal edit() + signal avatarClicked + signal backgroundClicked + signal edit background: Rectangle { - radius: Utils.getSizeWithScreenRatio(10) - color: mainItem.isSelected ? mainItem.selectedBackgroundColor : hovered ? mainItem.hoveredBackgroundColor : mainItem.defaultBackgroundColor - border.color: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.isSelected ? mainItem.selectedBorderColor : hovered ? mainItem.hoveredBorderColor : mainItem.defaultBorderColor - border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth - MouseArea{ + radius: Utils.getSizeWithScreenRatio(10) + color: mainItem.isSelected ? mainItem.selectedBackgroundColor : hovered ? mainItem.hoveredBackgroundColor : + mainItem.defaultBackgroundColor + + border.color: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.isSelected + ? mainItem.selectedBorderColor : hovered ? mainItem.hoveredBorderColor : mainItem.defaultBorderColor + border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth + MouseArea { id: mouseArea anchors.fill: parent onClicked: mainItem.backgroundClicked() } } - contentItem: RowLayout{ + contentItem: RowLayout { spacing: 0 RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) Button { id: avatarButton onClicked: mainItem.avatarClicked() Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) color: "transparent" - contentItem: Item{ + contentItem: Item { anchors.fill: parent width: avatarButton.width height: avatarButton.height - Avatar{ + Avatar { id: avatar height: avatarButton.height width: avatarButton.width account: mainItem.account } - Rectangle{ + Rectangle { // Black border for keyboard navigation visible: avatarButton.keyboardFocus width: avatarButton.width @@ -82,13 +84,13 @@ Control.Control{ border.width: Utils.getSizeWithScreenRatio(3) radius: width / 2 } - } + } } Item { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(200) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(200) Layout.fillHeight: true - Layout.rightMargin: Utils.getSizeWithScreenRatio(10) - ContactDescription{ + Layout.rightMargin: Utils.getSizeWithScreenRatio(10) + ContactDescription { id: description anchors.fill: parent account: mainItem.account @@ -97,10 +99,10 @@ Control.Control{ } Item { Layout.minimumWidth: Utils.getSizeWithScreenRatio(86) - Layout.maximumWidth: Utils.getSizeWithScreenRatio(150) + Layout.maximumWidth: Utils.getSizeWithScreenRatio(150) width: contactStatusPopup.width height: contactStatusPopup.height - ContactStatusPopup{ + ContactStatusPopup { id: contactStatusPopup visible: mainItem.account.core.publishEnabled } @@ -111,32 +113,32 @@ Control.Control{ onClicked: mainItem.account.core.lSetRegisterEnabled(true) } } - Item{ - Layout.preferredWidth: Utils.getSizeWithScreenRatio(26) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(26) + Item { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(26) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(26) Layout.fillHeight: true - Layout.leftMargin: Utils.getSizeWithScreenRatio(40) + Layout.leftMargin: Utils.getSizeWithScreenRatio(40) visible: mainItem.account.core.unreadNotifications > 0 - Rectangle{ + Rectangle { id: unreadNotifications anchors.verticalCenter: parent.verticalCenter - width: Utils.getSizeWithScreenRatio(26) - height: Utils.getSizeWithScreenRatio(26) - radius: width/2 + width: Utils.getSizeWithScreenRatio(26) + height: Utils.getSizeWithScreenRatio(26) + radius: width / 2 color: DefaultStyle.danger_500_main border.color: DefaultStyle.grey_0 - border.width: Utils.getSizeWithScreenRatio(2) - Text{ + border.width: Utils.getSizeWithScreenRatio(2) + Text { id: unreadCount anchors.fill: parent - anchors.margins: Utils.getSizeWithScreenRatio(2) + anchors.margins: Utils.getSizeWithScreenRatio(2) verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter color: DefaultStyle.grey_0 minimumPixelSize: 5 fontSizeMode: Text.Fit - font.pixelSize: Utils.getSizeWithScreenRatio(11) - font.weight: Utils.getSizeWithScreenRatio(700) + font.pixelSize: Utils.getSizeWithScreenRatio(11) + font.weight: Utils.getSizeWithScreenRatio(700) text: mainItem.account.core.unreadNotifications >= 100 ? '99+' : mainItem.account.core.unreadNotifications } } @@ -149,38 +151,40 @@ Control.Control{ } } Voicemail { - Layout.leftMargin: Utils.getSizeWithScreenRatio(18) - Layout.rightMargin: Utils.getSizeWithScreenRatio(20) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(26) + Layout.leftMargin: Utils.getSizeWithScreenRatio(18) + Layout.rightMargin: Utils.getSizeWithScreenRatio(20) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(26) scaleFactor: 0.7 showMwi: mainItem.account.core.showMwi visible: mainItem.account.core.voicemailAddress.length > 0 || mainItem.account.core.showMwi voicemailCount: mainItem.account.core.voicemailCount onClicked: { if (mainItem.account.core.voicemailAddress.length > 0) - UtilsCpp.createCall(mainItem.account.core.voicemailAddress) + UtilsCpp.createCall(mainItem.account.core.voicemailAddress); else - //: Erreur - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: L'URI de messagerie vocale n'est pas définie. - qsTr("information_popup_voicemail_address_undefined_message"), false) + //: Erreur + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: L'URI de messagerie vocale n'est pas définie. + qsTr("information_popup_voicemail_address_undefined_message"), false); } } - Item{Layout.fillWidth: true} - Button { + Item { + Layout.fillWidth: true + } + Button { id: manageAccount style: ButtonStyle.noBackground icon.source: AppIcons.manageProfile - Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) visible: !SettingsCpp.hideAccountSettings //: Account settings of %1 Accessible.name: qsTr("account_settings_name_accessible_name") onClicked: { - mainItem.edit() + mainItem.edit(); } } } diff --git a/Linphone/view/Control/Display/Contact/ContactListItem.qml b/Linphone/view/Control/Display/Contact/ContactListItem.qml index bc8458b3a..42225e58b 100644 --- a/Linphone/view/Control/Display/Contact/ContactListItem.qml +++ b/Linphone/view/Control/Display/Contact/ContactListItem.qml @@ -11,299 +11,290 @@ 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 ? 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. - property bool showDisplayName: true // Display name above address. - property bool showActions: false // Display actions layout (call buttons) - property bool showContactMenu: true // Display the dot menu for contacts. - property string highlightText - property string addressFromFilter: UtilsCpp.getAddressToDisplay(searchResultItem.core.addresses, highlightText, searchResultItem.core.defaultAddress) + id: mainItem + 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. + property bool showDisplayName: true // Display name above address. + property bool showActions: false // Display actions layout (call buttons) + property bool showContactMenu: true // Display the dot menu for contacts. + property string highlightText + property string addressFromFilter: UtilsCpp.getAddressToDisplay(searchResultItem.core.addresses, highlightText, + searchResultItem.core.defaultAddress) - // Bold characters in Display name. - property bool displayNameCapitalization: true // Capitalize display name. + // Bold characters in Display name. + property bool displayNameCapitalization: true // Capitalize display name. - property bool selectionEnabled: true // Contact can be selected - property bool multiSelectionEnabled: false //Multiple items can be selected. - property list selectedContacts - // List of default address on selected contacts. - property bool isSelected: false // selected in list => currentIndex == index - property bool isLastHovered: false + property bool selectionEnabled: true // Contact can be selected + property bool multiSelectionEnabled: false //Multiple items can be selected. + property list selectedContacts + // List of default address on selected contacts. + property bool isSelected: false // selected in list => currentIndex == index + property bool isLastHovered: false - property var previousInitial - // Use directly previous initial - property real itemsRightMargin: Utils.getSizeWithScreenRatio(39) + property var previousInitial + // Use directly previous initial + property real itemsRightMargin: Utils.getSizeWithScreenRatio(39) - property var displayName: searchResultItem? searchResultItem.core.fullName : "" - property var initial: displayName.length > 0 ? UtilsCpp.getInitials(displayName, 1).toLocaleLowerCase(AppCpp.localeAsString) : '' + property var displayName: searchResultItem ? searchResultItem.core.fullName : "" + property var initial: displayName.length > 0 ? UtilsCpp.getInitials(displayName, 1).toLocaleLowerCase(AppCpp.localeAsString) : + '' - signal clicked(var mouse) - signal contactDeletionRequested(FriendGui contact) - signal containsMouseChanged(bool containsMouse) - Accessible.name: displayName + signal clicked(var mouse) + signal contactDeletionRequested(FriendGui contact) + signal containsMouseChanged(bool containsMouse) + Accessible.name: displayName - MouseArea { - Text { - id: initialText - anchors.left: parent.left - visible: mainItem.showInitials - anchors.verticalCenter: parent.verticalCenter - anchors.rightMargin: Utils.getSizeWithScreenRatio(15) - verticalAlignment: Text.AlignVCenter - width: Utils.getSizeWithScreenRatio(20) - opacity: previousInitial != mainItem.initial ? 1 : 0 - text: mainItem.initial - textFormat: Text.RichText - color: DefaultStyle.main2_400 - font { - pixelSize: Utils.getSizeWithScreenRatio(20) - weight: Utils.getSizeWithScreenRatio(500) - capitalization: Font.AllUppercase - } - } - RowLayout { - id: contactDelegate - anchors.left: initialText.visible ? initialText.right : parent.left - anchors.right: parent.right - anchors.rightMargin: mainItem.itemsRightMargin - anchors.top: parent.top - anchors.bottom: parent.bottom - spacing: Utils.getSizeWithScreenRatio(16) - z: contactArea.z + 1 - Avatar { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - Layout.leftMargin: Utils.getSizeWithScreenRatio(5) - contact: searchResultItem - shadowEnabled: false - } - ColumnLayout { - spacing: 0 - Text { - id: displayNameText - visible: mainItem.showDisplayName - Layout.fillWidth: true - Layout.preferredHeight: visible ? implicitHeight: 0 - text: UtilsCpp.boldTextPart(UtilsCpp.encodeEmojiToQmlRichFormat((mainItem.displayName)), - mainItem.highlightText) - textFormat: Text.RichText - font { - pixelSize: mainItem.showDefaultAddress ? Typography.h4.pixelSize : Typography.p1.pixelSize - capitalization: mainItem.displayNameCapitalization ? Font.Capitalize : Font.MixedCase - weight: mainItem.showDefaultAddress ? Typography.h4.weight : Typography.p1.weight - } - maximumLineCount: 1 - } - Text { - Layout.topMargin: Utils.getSizeWithScreenRatio(2) - Layout.fillWidth: true - Layout.preferredHeight: visible ? implicitHeight: 0 - visible: mainItem.showDefaultAddress - property string address: SettingsCpp.hideSipAddresses - ? UtilsCpp.getUsername(mainItem.addressFromFilter) - : mainItem.addressFromFilter - text: UtilsCpp.boldTextPart(address, mainItem.highlightText) - textFormat: Text.AutoText - maximumLineCount: 1 - elide: Text.ElideRight - font { - weight: Utils.getSizeWithScreenRatio(300) - pixelSize: Utils.getSizeWithScreenRatio(12) - } - } - } - Item { - Layout.fillWidth: true - } - RowLayout { - id: actionsRow - z: contactArea.z + 1 - visible: mainItem.showActions || actionButtons.visible || mainItem.showContactMenu || mainItem.multiSelectionEnabled - spacing: visible ? Utils.getSizeWithScreenRatio(16) : 0 - enabled: visible - Layout.rightMargin: Utils.getSizeWithScreenRatio(5) - EffectImage { - id: isSelectedCheck - visible: mainItem.multiSelectionEnabled - && (mainItem.selectedContacts.indexOf(mainItem.addressFromFilter) != -1) - 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 ? Utils.getSizeWithScreenRatio(10) : 0 - IconButton { - id: callButton - 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: Utils.getSizeWithScreenRatio(40) - style: ButtonStyle.grey - onClicked: UtilsCpp.createCall(mainItem.addressFromFilter) - KeyNavigation.left: chatButton - KeyNavigation.right: videoCallButton - //: "Call %1" - Accessible.name: qsTr("call_with_contact_name_accessible_button").arg(mainItem.displayName) - keyboardFocus: FocusHelper.keyboardFocus || FocusHelper.otherFocus - } - IconButton { - id: videoCallButton - visible: SettingsCpp.videoEnabled - 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: Utils.getSizeWithScreenRatio(40) - style: ButtonStyle.grey - onClicked: UtilsCpp.createCall(mainItem.addressFromFilter, {"localVideoEnabled": true}) - KeyNavigation.left: callButton - KeyNavigation.right: chatButton - //: "Video call %1" - Accessible.name: qsTr("video_call_with_contact_name_accessible_button").arg(mainItem.displayName) - keyboardFocus: FocusHelper.keyboardFocus || FocusHelper.otherFocus - } - IconButton { - id: chatButton - visible: actionButtons.visible - && !SettingsCpp.disableChatFeature - 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: Utils.getSizeWithScreenRatio(40) - style: ButtonStyle.grey - KeyNavigation.left: videoCallButton - KeyNavigation.right: callButton - onClicked: { - console.debug("[ContactListItem.qml] Open conversation") - mainWindow.displayChatPage(mainItem.addressFromFilter) - } - //: "Message %1" - Accessible.name: qsTr("message_with_contact_name_accessible_button").arg(mainItem.displayName) - keyboardFocus: FocusHelper.keyboardFocus || FocusHelper.otherFocus - } - } - PopupButton { - id: friendPopup - z: contactArea.z + 1 - popup.x: 0 - popup.padding: Utils.getSizeWithScreenRatio(10) - visible: mainItem.showContactMenu && (contactArea.containsMouse || mainItem.isLastHovered || hovered || popup.opened) - enabled: visible + MouseArea { + id: contactArea + Text { + id: initialText + anchors.left: parent.left + visible: mainItem.showInitials + anchors.verticalCenter: parent.verticalCenter + anchors.rightMargin: Utils.getSizeWithScreenRatio(15) + verticalAlignment: Text.AlignVCenter + width: Utils.getSizeWithScreenRatio(20) + opacity: previousInitial != mainItem.initial ? 1 : 0 + text: mainItem.initial + textFormat: Text.RichText + color: DefaultStyle.main2_400 + font { + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Utils.getSizeWithScreenRatio(500) + capitalization: Font.AllUppercase + } + } + RowLayout { + id: contactDelegate + anchors.left: initialText.visible ? initialText.right : parent.left + anchors.right: parent.right + anchors.rightMargin: mainItem.itemsRightMargin + anchors.top: parent.top + anchors.bottom: parent.bottom + spacing: Utils.getSizeWithScreenRatio(16) + z: contactArea.z + 1 + Avatar { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + Layout.leftMargin: Utils.getSizeWithScreenRatio(5) + contact: searchResultItem + shadowEnabled: false + } + ColumnLayout { + spacing: 0 + Text { + id: displayNameText + visible: mainItem.showDisplayName + Layout.fillWidth: true + Layout.preferredHeight: visible ? implicitHeight : 0 + text: UtilsCpp.boldTextPart(UtilsCpp.encodeEmojiToQmlRichFormat((mainItem.displayName)), mainItem.highlightText) + textFormat: Text.RichText + font { + pixelSize: mainItem.showDefaultAddress ? Typography.h4.pixelSize : Typography.p1.pixelSize + capitalization: mainItem.displayNameCapitalization ? Font.Capitalize : Font.MixedCase + weight: mainItem.showDefaultAddress ? Typography.h4.weight : Typography.p1.weight + } + maximumLineCount: 1 + } + Text { + Layout.topMargin: Utils.getSizeWithScreenRatio(2) + Layout.fillWidth: true + Layout.preferredHeight: visible ? implicitHeight : 0 + visible: mainItem.showDefaultAddress + property string address: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(mainItem.addressFromFilter) : + mainItem.addressFromFilter + text: UtilsCpp.boldTextPart(address, mainItem.highlightText) + textFormat: Text.AutoText + maximumLineCount: 1 + elide: Text.ElideRight + font { + weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(12) + } + } + } + Item { + Layout.fillWidth: true + } + RowLayout { + id: actionsRow + z: contactArea.z + 1 + visible: mainItem.showActions || actionButtons.visible || mainItem.showContactMenu || mainItem.multiSelectionEnabled + spacing: visible ? Utils.getSizeWithScreenRatio(16) : 0 + enabled: visible + Layout.rightMargin: Utils.getSizeWithScreenRatio(5) + EffectImage { + id: isSelectedCheck + visible: mainItem.multiSelectionEnabled && (mainItem.selectedContacts.indexOf(mainItem.addressFromFilter) != -1) + 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 ? Utils.getSizeWithScreenRatio(10) : 0 + IconButton { + id: callButton + 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: Utils.getSizeWithScreenRatio(40) + style: ButtonStyle.grey + onClicked: UtilsCpp.createCall(mainItem.addressFromFilter) + KeyNavigation.left: chatButton + KeyNavigation.right: videoCallButton + //: "Call %1" + Accessible.name: qsTr("call_with_contact_name_accessible_button").arg(mainItem.displayName) + keyboardFocus: FocusHelper.keyboardFocus || FocusHelper.otherFocus + } + IconButton { + id: videoCallButton + visible: SettingsCpp.videoEnabled + 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: Utils.getSizeWithScreenRatio(40) + style: ButtonStyle.grey + onClicked: UtilsCpp.createCall(mainItem.addressFromFilter, { + "localVideoEnabled": true + }) + KeyNavigation.left: callButton + KeyNavigation.right: chatButton + //: "Video call %1" + Accessible.name: qsTr("video_call_with_contact_name_accessible_button").arg(mainItem.displayName) + keyboardFocus: FocusHelper.keyboardFocus || FocusHelper.otherFocus + } + IconButton { + id: chatButton + visible: actionButtons.visible && !SettingsCpp.disableChatFeature + 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: Utils.getSizeWithScreenRatio(40) + style: ButtonStyle.grey + KeyNavigation.left: videoCallButton + KeyNavigation.right: callButton + onClicked: { + console.debug("[ContactListItem.qml] Open conversation"); + mainWindow.displayChatPage(mainItem.addressFromFilter); + } + //: "Message %1" + Accessible.name: qsTr("message_with_contact_name_accessible_button").arg(mainItem.displayName) + keyboardFocus: FocusHelper.keyboardFocus || FocusHelper.otherFocus + } + } + PopupButton { + id: friendPopup + z: contactArea.z + 1 + popup.x: 0 + popup.padding: Utils.getSizeWithScreenRatio(10) + visible: mainItem.showContactMenu && (contactArea.containsMouse || mainItem.isLastHovered || hovered + || popup.opened) + enabled: visible - popup.contentItem: ColumnLayout { - IconLabelButton { - Layout.fillWidth: true - visible: searchResultItem && searchResultItem.core.isStored - && !searchResultItem.core.readOnly - //: "Enlever des favoris" - text: searchResultItem.core.starred ? qsTr("contact_details_remove_from_favourites") - //: "Ajouter aux favoris" - : qsTr("contact_details_add_to_favourites") - icon.source: searchResultItem.core.starred ? AppIcons.heartFill : AppIcons.heart - 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 - onClicked: { - searchResultItem.core.lSetStarred( - !searchResultItem.core.starred) - friendPopup.close() - } - style: ButtonStyle.noBackground - } - IconLabelButton { - text: qsTr("Partager") - Layout.fillWidth: true - icon.source: AppIcons.shareNetwork - spacing: Utils.getSizeWithScreenRatio(10) - textColor: DefaultStyle.main2_500_main - onClicked: { - var vcard = searchResultItem.core.getVCard() - var username = searchResultItem.core.givenName - + searchResultItem.core.familyName - var filepath = UtilsCpp.createVCardFile( - username, vcard) - if (filepath == "") - UtilsCpp.showInformationPopup( - qsTr("information_popup_error_title"), - //: La création du fichier vcard a échoué - qsTr("information_popup_vcard_creation_error"), - false) - else - //: VCard créée - mainWindow.showInformationPopup(qsTr("information_popup_vcard_creation_title"), - //: "VCard du contact enregistrée dans %1" - qsTr("information_popup_vcard_creation_success").arg(filepath)) - //: Partage de contact - UtilsCpp.shareByEmail(qsTr("contact_sharing_email_title"),vcard, filepath) - } - style: ButtonStyle.noBackground - } - IconLabelButton { - //: "Supprimer" - text: qsTr("contact_details_delete") - icon.source: AppIcons.trashCan - spacing: Utils.getSizeWithScreenRatio(10) - visible: searchResultItem && searchResultItem.core.isStored && !searchResultItem.core.readOnly - Layout.fillWidth: true - onClicked: { - mainItem.contactDeletionRequested(searchResultItem) - friendPopup.close() - } - style: ButtonStyle.noBackgroundRed - } - } - } - } - } - - id: contactArea - enabled: mainItem.selectionEnabled - anchors.fill: parent - //height: mainItem.height - hoverEnabled: true - acceptedButtons: Qt.AllButtons - focus: !actionButtons.visible - onContainsMouseChanged: { - mainItem.containsMouseChanged(containsMouse) - } - Rectangle { - anchors.fill: contactArea - radius: Utils.getSizeWithScreenRatio(8) - opacity: 0.7 - color: mainItem.isSelected ? DefaultStyle.main2_200 : DefaultStyle.main2_100 - visible: mainItem.isLastHovered || mainItem.isSelected || friendPopup.hovered - } - Keys.onPressed: event => { - if (event.key == Qt.Key_Space - || event.key == Qt.Key_Enter - || event.key == Qt.Key_Return) { - contactArea.clicked(undefined) - event.accepted = true - } - } - onClicked: mouse => { - forceActiveFocus() - if (mouse && mouse.button == Qt.RightButton - && mainItem.showContactMenu) { - if (friendPopup) friendPopup.open() - } else { - mainItem.clicked(mouse) - } - } - } + popup.contentItem: ColumnLayout { + IconLabelButton { + Layout.fillWidth: true + visible: searchResultItem && searchResultItem.core.isStored && !searchResultItem.core.readOnly + //: "Enlever des favoris" + text: searchResultItem.core.starred ? qsTr("contact_details_remove_from_favourites") : + //: "Ajouter aux favoris" + qsTr("contact_details_add_to_favourites") + icon.source: searchResultItem.core.starred ? AppIcons.heartFill : AppIcons.heart + 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 + onClicked: { + searchResultItem.core.lSetStarred(!searchResultItem.core.starred); + friendPopup.close(); + } + style: ButtonStyle.noBackground + } + IconLabelButton { + text: qsTr("Partager") + Layout.fillWidth: true + icon.source: AppIcons.shareNetwork + spacing: Utils.getSizeWithScreenRatio(10) + textColor: DefaultStyle.main2_500_main + onClicked: { + var vcard = searchResultItem.core.getVCard(); + var username = searchResultItem.core.givenName + searchResultItem.core.familyName; + var filepath = UtilsCpp.createVCardFile(username, vcard); + if (filepath == "") + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: La création du fichier vcard a échoué + qsTr("information_popup_vcard_creation_error"), false); + else + //: VCard créée + mainWindow.showInformationPopup(qsTr("information_popup_vcard_creation_title"), + //: "VCard du contact enregistrée dans %1" + qsTr("information_popup_vcard_creation_success").arg(filepath)); + //: Partage de contact + UtilsCpp.shareByEmail(qsTr("contact_sharing_email_title"), vcard, filepath); + } + style: ButtonStyle.noBackground + } + IconLabelButton { + //: "Supprimer" + text: qsTr("contact_details_delete") + icon.source: AppIcons.trashCan + spacing: Utils.getSizeWithScreenRatio(10) + visible: searchResultItem && searchResultItem.core.isStored && !searchResultItem.core.readOnly + Layout.fillWidth: true + onClicked: { + mainItem.contactDeletionRequested(searchResultItem); + friendPopup.close(); + } + style: ButtonStyle.noBackgroundRed + } + } + } + } + } + enabled: mainItem.selectionEnabled + anchors.fill: parent + //height: mainItem.height + hoverEnabled: true + acceptedButtons: Qt.AllButtons + focus: !actionButtons.visible + onContainsMouseChanged: { + mainItem.containsMouseChanged(containsMouse); + } + Rectangle { + anchors.fill: contactArea + radius: Utils.getSizeWithScreenRatio(8) + opacity: 0.7 + color: mainItem.isSelected ? DefaultStyle.main2_200 : DefaultStyle.main2_100 + visible: mainItem.isLastHovered || mainItem.isSelected || friendPopup.hovered + } + Keys.onPressed: event => { + if (event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { + contactArea.clicked(undefined); + event.accepted = true; + } + } + onClicked: mouse => { + forceActiveFocus(); + if (mouse && mouse.button == Qt.RightButton && mainItem.showContactMenu) { + if (friendPopup) + friendPopup.open(); + } else { + mainItem.clicked(mouse); + } + } + } } diff --git a/Linphone/view/Control/Display/Contact/ContactListView.qml b/Linphone/view/Control/Display/Contact/ContactListView.qml index d5944d301..ebcff140c 100644 --- a/Linphone/view/Control/Display/Contact/ContactListView.qml +++ b/Linphone/view/Control/Display/Contact/ContactListView.qml @@ -6,8 +6,8 @@ import Linphone import UtilsCpp 1.0 import ConstantsCpp 1.0 import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle ListView { id: mainItem @@ -15,16 +15,16 @@ ListView { property string title property bool showInitials: true // Display Initials of Display name. property bool showDefaultAddress: true // Display address below display name. - property bool showDisplayName: true // Display name above address. + property bool showDisplayName: true // Display name above address. property bool showActions: false // Display actions layout (call buttons) property bool showContactMenu: true // Display the dot menu for contacts. property bool showFavorites: true // Display the favorites in the header property bool hideSuggestions: false // Hide not stored contacts (not suggestions) property string highlightText: searchText // Bold characters in Display name. property var sourceFlags: LinphoneEnums.MagicSearchSource.All - + property bool displayNameCapitalization: true // Capitalize display name. - + property bool selectionEnabled: true // Contact can be selected property bool multiSelectionEnabled: false //Multiple items can be selected. property list selectedContacts // List of default address on selected contacts. @@ -35,126 +35,132 @@ ListView { // matching names property string searchText property ConferenceInfoGui confInfoGui - + property bool haveFavorites: false property bool haveContacts: count > 0 - property real sectionsPixelSize: Typography.h4.pixelSize - property real sectionsWeight: Typography.h4.weight - property real sectionsSpacing: Utils.getSizeWithScreenRatio(18) - - property real itemsRightMargin: Utils.getSizeWithScreenRatio(39) + property real sectionsPixelSize: Typography.h4.pixelSize + property real sectionsWeight: Typography.h4.weight + property real sectionsSpacing: Utils.getSizeWithScreenRatio(18) + + property real itemsRightMargin: Utils.getSizeWithScreenRatio(39) property bool expanded: true - property real headerHeight: headerItem?.height - + property real headerHeight: headerItem?.height + signal contactDeletionRequested(FriendGui contact) signal contactSelected(FriendGui contact) // Click/Space/Enter signal addContactToSelection(var address) signal removeContactFromSelection(var indexInSelection) - signal updatePosition() - + signal updatePosition + clip: true highlightFollowsCurrentItem: false cacheBuffer: 400 implicitHeight: contentHeight - spacing: expanded ? Utils.getSizeWithScreenRatio(4) : 0 + spacing: expanded ? Utils.getSizeWithScreenRatio(4) : 0 + + onVisibleChanged: if (visible && !expanded) + expanded = true - onVisibleChanged: if (visible && !expanded) expanded = true - onYChanged: updatePosition() - + // Qt bug: sometimes, containsMouse may not be send and update on each MouseArea. // So we need to use this variable to switch off all hovered items. property int lastMouseContainsIndex: -1 - + property bool _moveToIndex: false - - function selectIndex(index, focusReason = Qt.OtherFocusReason){ - if(mainItem.expanded && index >= 0){ - mainItem.currentIndex = index - var item = itemAtIndex(mainItem.currentIndex) - if(item){// Item is ready and available - mainItem.highlightedContact = item.searchResultItem - item.forceActiveFocus(focusReason) - updatePosition() - _moveToIndex = false - }else{// Move on the next items load. + + function selectIndex(index, focusReason = Qt.OtherFocusReason) { + if (mainItem.expanded && index >= 0) { + mainItem.currentIndex = index; + var item = itemAtIndex(mainItem.currentIndex); + if (item) { + // Item is ready and available + mainItem.highlightedContact = item.searchResultItem; + item.forceActiveFocus(focusReason); + updatePosition(); + _moveToIndex = false; + } else { + // Move on the next items load. // If visible, try to wait loading - _moveToIndex = visible + _moveToIndex = visible; } - }else{ - mainItem.currentIndex = -1 - mainItem.highlightedContact = null - if(headerItem) { - headerItem.forceActiveFocus(focusReason) + } else { + mainItem.currentIndex = -1; + mainItem.highlightedContact = null; + if (headerItem) { + headerItem.forceActiveFocus(focusReason); } - _moveToIndex = false + _moveToIndex = false; } } onContactSelected: updatePosition() - onExpandedChanged: if(!expanded) updatePosition() + onExpandedChanged: if (!expanded) + updatePosition() keyNavigationEnabled: false - Keys.onPressed: (event)=> { - if(event.key == Qt.Key_Up || event.key == Qt.Key_Down){ - if(event.key == Qt.Key_Up && !headerItem.activeFocus) { - if(currentIndex >= 0 ) { - selectIndex(mainItem.currentIndex-1, Qt.BacktabFocusReason) - event.accepted = true; - } - }else if(event.key == Qt.Key_Down && mainItem.expanded){ - if(currentIndex < model.count - 1) { - selectIndex(mainItem.currentIndex+1, Qt.TabFocusReason) - event.accepted = true; - } - } - } - } + Keys.onPressed: event => { + if (event.key == Qt.Key_Up || event.key == Qt.Key_Down) { + if (event.key == Qt.Key_Up && !headerItem.activeFocus) { + if (currentIndex >= 0) { + selectIndex(mainItem.currentIndex - 1, Qt.BacktabFocusReason); + event.accepted = true; + } + } else if (event.key == Qt.Key_Down && mainItem.expanded) { + if (currentIndex < model.count - 1) { + selectIndex(mainItem.currentIndex + 1, Qt.TabFocusReason); + event.accepted = true; + } + } + } + } Component.onCompleted: { if (confInfoGui) { - for(var i = 0; i < confInfoGui.core.participants.length; ++i) { + for (var i = 0; i < confInfoGui.core.participants.length; ++i) { selectedContacts.push(confInfoGui.core.getParticipantAddressAt(i)); } } } - + Connections { target: SettingsCpp function onLdapConfigChanged() { if (SettingsCpp.syncLdapContacts) - magicSearchProxy.forceUpdate() + magicSearchProxy.forceUpdate(); } function onCardDAVAddressBookSynchronized() { - console.log("card dav synchro update") - magicSearchProxy.forceUpdate() + console.log("card dav synchro update"); + magicSearchProxy.forceUpdate(); } } // Workaround: itemAtIndex and count are decorellated and are not enough to know when the ListView has load all its children. // So when itemAtIndex is not available, start this timer along count changed signal. - Timer{ + Timer { id: delaySelection interval: 100 running: _moveToIndex onTriggered: { - _moveToIndex = false - if(count > mainItem.currentIndex) selectIndex(mainItem.currentIndex) - else{ - _moveToIndex = true + _moveToIndex = false; + if (count > mainItem.currentIndex) + selectIndex(mainItem.currentIndex); + else { + _moveToIndex = true; } } } - - header: FocusScope{ + + header: FocusScope { id: headerItem width: mainItem.width height: headerContents.implicitHeight - + ColumnLayout { id: headerContents width: parent.width spacing: 0 - Item{// Do not use directly RowLayout : there is an issue where the layout doesn't update on visible + Item// Do not use directly RowLayout : there is an issue where the layout doesn't update on visible + { Layout.fillWidth: true Layout.preferredHeight: mainItem.count > 0 ? headerTitleLayout.implicitHeight : 0 - Layout.bottomMargin: Utils.getSizeWithScreenRatio(4) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(4) RowLayout { id: headerTitleLayout anchors.fill: parent @@ -175,28 +181,28 @@ ListView { id: headerExpandButton style: ButtonStyle.noBackground icon.source: mainItem.expanded ? AppIcons.upArrow : AppIcons.downArrow - Layout.rightMargin: mainItem.itemsRightMargin + Layout.rightMargin: mainItem.itemsRightMargin focus: true onClicked: mainItem.expanded = !mainItem.expanded Rectangle { anchors.fill: headerExpandButton - radius: headerExpandButton.width/2 + radius: headerExpandButton.width / 2 visible: headerExpandButton.activeFocus opacity: 0.5 color: DefaultStyle.main2_200 } Accessible.name: (mainItem.expanded ? - //: Shrink %1 - qsTr("shrink_accessible_name") : - //: Expand %1 - qsTr("expand_accessible_name")).arg(mainItem.title) + //: Shrink %1 + qsTr("shrink_accessible_name") : + //: Expand %1 + qsTr("expand_accessible_name")).arg(mainItem.title) } } } } } - - delegate: ContactListItem{ + + delegate: ContactListItem { id: contactItem width: mainItem.width focus: true @@ -209,41 +215,41 @@ ListView { showContactMenu: mainItem.showContactMenu && searchResultItem.core.isStored highlightText: mainItem.highlightText displayNameCapitalization: mainItem.displayNameCapitalization - + selectionEnabled: mainItem.selectionEnabled multiSelectionEnabled: mainItem.multiSelectionEnabled selectedContacts: mainItem.selectedContacts isSelected: mainItem.highlightedContact && mainItem.highlightedContact.core == searchResultItem.core isLastHovered: mainItem.lastMouseContainsIndex == index - previousInitial: mainItem.itemAtIndex(index-1)?.initial + previousInitial: mainItem.itemAtIndex(index - 1)?.initial itemsRightMargin: mainItem.itemsRightMargin - - onIsSelectedChanged: if(isSelected) mainItem.currentIndex = index - onContactDeletionRequested: (contact) => mainItem.contactDeletionRequested(contact) - onClicked: (mouse) => { - if (mouse && mouse.button == Qt.RightButton) { - friendPopup.open() - } else { - forceActiveFocus() - mainItem.highlightedContact = contactItem.searchResultItem - if (mainItem.multiSelectionEnabled) { - var indexInSelection = mainItem.selectedContacts.indexOf(searchResultItem.core.defaultAddress) - if (indexInSelection == -1) { - mainItem.addContactToSelection(searchResultItem.core.defaultAddress) - } - else { - mainItem.removeContactFromSelection(indexInSelection) - } - } - mainItem.contactSelected(searchResultItem) - } - } - onContainsMouseChanged: (containsMouse) => { - if(containsMouse) - mainItem.lastMouseContainsIndex = index - else if( mainItem.lastMouseContainsIndex == index) - mainItem.lastMouseContainsIndex = -1 - } + onIsSelectedChanged: if (isSelected) + mainItem.currentIndex = index + onContactDeletionRequested: contact => mainItem.contactDeletionRequested(contact) + + onClicked: mouse => { + if (mouse && mouse.button == Qt.RightButton) { + friendPopup.open(); + } else { + forceActiveFocus(); + mainItem.highlightedContact = contactItem.searchResultItem; + if (mainItem.multiSelectionEnabled) { + var indexInSelection = mainItem.selectedContacts.indexOf(searchResultItem.core.defaultAddress); + if (indexInSelection == -1) { + mainItem.addContactToSelection(searchResultItem.core.defaultAddress); + } else { + mainItem.removeContactFromSelection(indexInSelection); + } + } + mainItem.contactSelected(searchResultItem); + } + } + onContainsMouseChanged: containsMouse => { + if (containsMouse) + mainItem.lastMouseContainsIndex = index; + else if (mainItem.lastMouseContainsIndex == index) + mainItem.lastMouseContainsIndex = -1; + } } } diff --git a/Linphone/view/Control/Display/Contact/ContactStatusPopup.qml b/Linphone/view/Control/Display/Contact/ContactStatusPopup.qml index 6d2f0509b..105d3aaf1 100644 --- a/Linphone/view/Control/Display/Contact/ContactStatusPopup.qml +++ b/Linphone/view/Control/Display/Contact/ContactStatusPopup.qml @@ -4,93 +4,94 @@ import QtQuick.Effects import QtQuick.Layouts 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 -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle PopupButton { - id: presenceAndRegistrationItem - width: presenceOrRegistrationText.implicitWidth + Utils.getSizeWithScreenRatio(50) - height: Utils.getSizeWithScreenRatio(24) - enabled: mainItem.account && mainItem.account.core.registrationState === LinphoneEnums.RegistrationState.Ok - onEnabledChanged: if(!enabled) close() - property bool editCustomStatus : false - contentItem: Rectangle { - id: presenceBar - property bool isRegistered: mainItem.account?.core.registrationState === LinphoneEnums.RegistrationState.Ok - color: DefaultStyle.main2_200 - radius: Utils.getSizeWithScreenRatio(15) - RowLayout { - anchors.fill: parent - Image { - id: registrationImage - sourceSize.width: Utils.getSizeWithScreenRatio(11) - sourceSize.height: Utils.getSizeWithScreenRatio(11) - smooth: false - Layout.preferredWidth: Utils.getSizeWithScreenRatio(11) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(11) - source: presenceBar.isRegistered - ? mainItem.account.core.presenceIcon - : mainItem.account?.core.registrationIcon || "" - Layout.leftMargin: Utils.getSizeWithScreenRatio(8) - RotationAnimator on rotation { - running: mainItem.account && mainItem.account.core.registrationState === LinphoneEnums.RegistrationState.Progress - direction: RotationAnimator.Clockwise - from: 0 - to: 360 - loops: Animation.Infinite - duration: 10000 - } - } - Text { - id: presenceOrRegistrationText - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - visible: mainItem.account - font.weight: Utils.getSizeWithScreenRatio(300) - font.pixelSize: Utils.getSizeWithScreenRatio(12) - color: presenceBar.isRegistered ? mainItem.account.core.presenceColor : mainItem.account?.core.registrationColor - text: presenceBar.isRegistered ? mainItem.account.core.presenceStatus : mainItem.account?.core.humaneReadableRegistrationState - } - EffectImage { - fillMode: Image.PreserveAspectFit - imageSource: AppIcons.downArrow - colorizationColor: DefaultStyle.main2_600 - Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) - Layout.rightMargin: Utils.getSizeWithScreenRatio(8) - } - } - } - popup.contentItem: Rectangle { - implicitWidth: Utils.getSizeWithScreenRatio(280) - implicitHeight: Utils.getSizeWithScreenRatio(20) + (setCustomStatus.visible ? Utils.getSizeWithScreenRatio(240) : setPresence.implicitHeight) - Presence { - id: setPresence - visible: !presenceAndRegistrationItem.editCustomStatus - anchors.fill: parent - anchors.margins: Utils.getSizeWithScreenRatio(20) - accountGui: mainItem.account - onSetCustomStatusClicked: { - presenceAndRegistrationItem.editCustomStatus = true - } - onIsSet: presenceAndRegistrationItem.popup.close() - } - PresenceSetCustomStatus { - id: setCustomStatus - visible: presenceAndRegistrationItem.editCustomStatus - anchors.fill: parent - anchors.margins: Utils.getSizeWithScreenRatio(20) - accountGui: mainItem.account - onVisibleChanged: { - if (!visible) { - presenceAndRegistrationItem.editCustomStatus = false - } - } - onIsSet: presenceAndRegistrationItem.popup.close() - } - } -} \ No newline at end of file + id: presenceAndRegistrationItem + width: presenceOrRegistrationText.implicitWidth + Utils.getSizeWithScreenRatio(50) + height: Utils.getSizeWithScreenRatio(24) + enabled: mainItem.account && mainItem.account.core.registrationState === LinphoneEnums.RegistrationState.Ok + onEnabledChanged: if (!enabled) + close() + property bool editCustomStatus: false + contentItem: Rectangle { + id: presenceBar + property bool isRegistered: mainItem.account?.core.registrationState === LinphoneEnums.RegistrationState.Ok + color: DefaultStyle.main2_200 + radius: Utils.getSizeWithScreenRatio(15) + RowLayout { + anchors.fill: parent + Image { + id: registrationImage + sourceSize.width: Utils.getSizeWithScreenRatio(11) + sourceSize.height: Utils.getSizeWithScreenRatio(11) + smooth: false + Layout.preferredWidth: Utils.getSizeWithScreenRatio(11) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(11) + source: presenceBar.isRegistered ? mainItem.account.core.presenceIcon : mainItem.account?.core.registrationIcon + || "" + Layout.leftMargin: Utils.getSizeWithScreenRatio(8) + RotationAnimator on rotation { + running: mainItem.account && mainItem.account.core.registrationState === LinphoneEnums.RegistrationState.Progress + direction: RotationAnimator.Clockwise + from: 0 + to: 360 + loops: Animation.Infinite + duration: 10000 + } + } + Text { + id: presenceOrRegistrationText + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + visible: mainItem.account + font.weight: Utils.getSizeWithScreenRatio(300) + font.pixelSize: Utils.getSizeWithScreenRatio(12) + color: presenceBar.isRegistered ? mainItem.account.core.presenceColor : mainItem.account?.core.registrationColor + text: presenceBar.isRegistered ? mainItem.account.core.presenceStatus : mainItem.account + ?.core.humaneReadableRegistrationState + } + EffectImage { + fillMode: Image.PreserveAspectFit + imageSource: AppIcons.downArrow + colorizationColor: DefaultStyle.main2_600 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) + Layout.rightMargin: Utils.getSizeWithScreenRatio(8) + } + } + } + popup.contentItem: Rectangle { + implicitWidth: Utils.getSizeWithScreenRatio(280) + implicitHeight: Utils.getSizeWithScreenRatio(20) + (setCustomStatus.visible ? Utils.getSizeWithScreenRatio(240) : + setPresence.implicitHeight) + Presence { + id: setPresence + visible: !presenceAndRegistrationItem.editCustomStatus + anchors.fill: parent + anchors.margins: Utils.getSizeWithScreenRatio(20) + accountGui: mainItem.account + onSetCustomStatusClicked: { + presenceAndRegistrationItem.editCustomStatus = true; + } + onIsSet: presenceAndRegistrationItem.popup.close() + } + PresenceSetCustomStatus { + id: setCustomStatus + visible: presenceAndRegistrationItem.editCustomStatus + anchors.fill: parent + anchors.margins: Utils.getSizeWithScreenRatio(20) + accountGui: mainItem.account + onVisibleChanged: { + if (!visible) { + presenceAndRegistrationItem.editCustomStatus = false; + } + } + onIsSet: presenceAndRegistrationItem.popup.close() + } + } +} diff --git a/Linphone/view/Control/Display/Contact/Presence.qml b/Linphone/view/Control/Display/Contact/Presence.qml index feefca37f..a39bc32f0 100644 --- a/Linphone/view/Control/Display/Contact/Presence.qml +++ b/Linphone/view/Control/Display/Contact/Presence.qml @@ -2,22 +2,42 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts import Linphone -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle ColumnLayout { id: mainItem - + property var accountGui signal setCustomStatusClicked signal isSet - + spacing: Utils.getSizeWithScreenRatio(8) - PresenceStatusItem { presence: LinphoneEnums.Presence.Online; accountGui: mainItem.accountGui; onClick: mainItem.isSet()} - PresenceStatusItem { presence: LinphoneEnums.Presence.Away; accountGui: mainItem.accountGui; onClick: mainItem.isSet()} - PresenceStatusItem { presence: LinphoneEnums.Presence.Busy; accountGui: mainItem.accountGui; onClick: mainItem.isSet()} - PresenceStatusItem { presence: LinphoneEnums.Presence.DoNotDisturb; accountGui: mainItem.accountGui; onClick: mainItem.isSet()} - PresenceStatusItem { presence: LinphoneEnums.Presence.Offline; accountGui: mainItem.accountGui; onClick: mainItem.isSet()} + PresenceStatusItem { + presence: LinphoneEnums.Presence.Online + accountGui: mainItem.accountGui + onClick: mainItem.isSet() + } + PresenceStatusItem { + presence: LinphoneEnums.Presence.Away + accountGui: mainItem.accountGui + onClick: mainItem.isSet() + } + PresenceStatusItem { + presence: LinphoneEnums.Presence.Busy + accountGui: mainItem.accountGui + onClick: mainItem.isSet() + } + PresenceStatusItem { + presence: LinphoneEnums.Presence.DoNotDisturb + accountGui: mainItem.accountGui + onClick: mainItem.isSet() + } + PresenceStatusItem { + presence: LinphoneEnums.Presence.Offline + accountGui: mainItem.accountGui + onClick: mainItem.isSet() + } RowLayout { spacing: 0 @@ -31,7 +51,7 @@ ColumnLayout { color: DefaultStyle.main2_600 } Item { - Layout.fillWidth: true + Layout.fillWidth: true } Button { id: resetStatusItem @@ -53,20 +73,21 @@ ColumnLayout { Layout.alignment: Qt.AlignLeft Text { font: Typography.p1 - text: accountGui.core.presenceNote.length > 0 ? accountGui.core.presenceNote : qsTr("contact_presence_custom_status") + text: accountGui.core.presenceNote.length > 0 ? accountGui.core.presenceNote : qsTr( + "contact_presence_custom_status") color: DefaultStyle.main2_600 wrapMode: Text.WordWrap Layout.preferredWidth: Utils.getSizeWithScreenRatio(accountGui.core.presenceNote.length == 0 ? 175 : 230) } Item { - Layout.fillWidth: true + Layout.fillWidth: true } SmallButton { visible: accountGui.core.presenceNote.length == 0 style: ButtonStyle.secondary text: qsTr("contact_presence_button_set_custom_status") onClicked: { - mainItem.setCustomStatusClicked() + mainItem.setCustomStatusClicked(); } } } @@ -74,13 +95,13 @@ ColumnLayout { visible: accountGui.core.presenceNote.length > 0 spacing: Utils.getSizeWithScreenRatio(10) Item { - Layout.fillWidth: true + Layout.fillWidth: true } SmallButton { style: ButtonStyle.secondary text: qsTr("contact_presence_button_edit_custom_status") onClicked: { - mainItem.setCustomStatusClicked() + mainItem.setCustomStatusClicked(); } } SmallButton { @@ -88,7 +109,7 @@ ColumnLayout { visible: accountGui.core.presenceNote.length > 0 text: qsTr("contact_presence_button_delete_custom_status") onClicked: { - mainItem.accountGui.core.presenceNote = "" + mainItem.accountGui.core.presenceNote = ""; } } } diff --git a/Linphone/view/Control/Display/Contact/PresenceSetCustomStatus.qml b/Linphone/view/Control/Display/Contact/PresenceSetCustomStatus.qml index 9d009ed9f..19004a8d3 100644 --- a/Linphone/view/Control/Display/Contact/PresenceSetCustomStatus.qml +++ b/Linphone/view/Control/Display/Contact/PresenceSetCustomStatus.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import QtQuick.Layouts import Linphone import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 { @@ -42,15 +42,15 @@ Column { text: mainItem.accountGui.core.presenceNote onTextChanged: { if (statusMessage.text.length > accountGui.core.maxPresenceNoteSize) { - statusMessage.text = previoustext - statusMessage.cursorPosition = statusMessage.text.length + statusMessage.text = previoustext; + statusMessage.cursorPosition = statusMessage.text.length; } else { - previoustext = statusMessage.text + previoustext = statusMessage.text; } } } Item { - Layout.fillHeight: true + Layout.fillHeight: true } Text { Layout.fillWidth: true @@ -71,8 +71,8 @@ Column { text: qsTr("contact_presence_button_save_custom_status") enabled: statusMessage.text.length > 0 onClicked: { - mainItem.accountGui.core.presenceNote = statusMessage.text - mainItem.isSet() + mainItem.accountGui.core.presenceNote = statusMessage.text; + mainItem.isSet(); } } } diff --git a/Linphone/view/Control/Display/Contact/PresenceStatusItem.qml b/Linphone/view/Control/Display/Contact/PresenceStatusItem.qml index f030283a3..a0f0492ad 100644 --- a/Linphone/view/Control/Display/Contact/PresenceStatusItem.qml +++ b/Linphone/view/Control/Display/Contact/PresenceStatusItem.qml @@ -3,20 +3,19 @@ import QtQuick.Controls import QtQuick.Layouts import Linphone import UtilsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle - IconLabelButton { id: mainItem property var accountGui property var presence - signal click() - + signal click + style: ButtonStyle.hoveredBackgroundBis - height: Utils.getSizeWithScreenRatio(22) - radius: Utils.getSizeWithScreenRatio(5) + height: Utils.getSizeWithScreenRatio(22) + radius: Utils.getSizeWithScreenRatio(5) text: UtilsCpp.getPresenceStatus(presence) textSize: Typography.p1.pixelSize textColor: UtilsCpp.getPresenceColor(mainItem.presence) @@ -29,7 +28,7 @@ IconLabelButton { padding: 0 onClicked: { - mainItem.accountGui.core.presence = mainItem.presence - mainItem.click() + mainItem.accountGui.core.presence = mainItem.presence; + mainItem.click(); } } diff --git a/Linphone/view/Control/Display/Contact/Voicemail.qml b/Linphone/view/Control/Display/Contact/Voicemail.qml index aba4fe242..6571b628f 100644 --- a/Linphone/view/Control/Display/Contact/Voicemail.qml +++ b/Linphone/view/Control/Display/Contact/Voicemail.qml @@ -7,21 +7,21 @@ import UtilsCpp import SettingsCpp import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils -Rectangle{ +Rectangle { id: mainItem property int voicemailCount: 0 property bool showMwi: false - width: Utils.getSizeWithScreenRatio(42 * scaleFactor) - height: Utils.getSizeWithScreenRatio(36 * scaleFactor) + width: Utils.getSizeWithScreenRatio(42 * scaleFactor) + height: Utils.getSizeWithScreenRatio(36 * scaleFactor) property real scaleFactor: 1.0 - signal clicked() + signal clicked color: 'transparent' Button { anchors.bottom: parent.bottom anchors.left: parent.left icon.source: AppIcons.voicemail icon.color: DefaultStyle.main2_600 - width: Utils.getSizeWithScreenRatio(33 * scaleFactor) + width: Utils.getSizeWithScreenRatio(33 * scaleFactor) height: width icon.width: width icon.height: width @@ -30,17 +30,17 @@ Rectangle{ anchors.fill: parent } onClicked: { - mainItem.clicked() + mainItem.clicked(); } } Text { anchors.top: parent.top anchors.right: parent.right - width: Utils.getSizeWithScreenRatio(14 * scaleFactor) + width: Utils.getSizeWithScreenRatio(14 * scaleFactor) height: width horizontalAlignment: Text.AlignHCenter - font.weight: Typography.p2.weight - font.pixelSize: Typography.p2.pixelSize * scaleFactor + font.weight: Typography.p2.weight + font.pixelSize: Typography.p2.pixelSize * scaleFactor color: DefaultStyle.danger_500_main text: voicemailCount >= 100 ? '99+' : voicemailCount visible: showMwi && voicemailCount > 0 @@ -52,15 +52,14 @@ Rectangle{ anchors.right: parent.right color: DefaultStyle.danger_500_main visible: showMwi && voicemailCount == 0 - width: Utils.getSizeWithScreenRatio(14 * scaleFactor) + width: Utils.getSizeWithScreenRatio(14 * scaleFactor) height: width radius: width / 2 EffectImage { anchors.fill: parent - anchors.margins: Utils.getSizeWithScreenRatio(1.5 * scaleFactor) + anchors.margins: Utils.getSizeWithScreenRatio(1.5 * scaleFactor) imageSource: AppIcons.bell colorizationColor: DefaultStyle.grey_0 } } - } diff --git a/Linphone/view/Control/Display/EffectImage.qml b/Linphone/view/Control/Display/EffectImage.qml index 16bb08fd2..82e97d4cc 100644 --- a/Linphone/view/Control/Display/EffectImage.qml +++ b/Linphone/view/Control/Display/EffectImage.qml @@ -52,24 +52,24 @@ Item { source: effect maskSource: effect colorizationColor: effectEnabled && mainItem.colorizationColor ? mainItem.colorizationColor : 'black' - colorization: effectEnabled ? 1.0: 0.0 + colorization: effectEnabled ? 1.0 : 0.0 } /* Alernative to shadow for no blackcolors MultiEffect { - visible: mainItem.shadowEnabled - source: image - width: image.width - height: image.height - x: image.x - y: image.y + 6 - z: -1 - blurEnabled: true - blurMax: 12 - blur: 1.0 - contrast: -1.0 - brightness: 1.0 - colorizationColor: DefaultStyle.grey_400 - colorization: 1.0 + visible: mainItem.shadowEnabled + source: image + width: image.width + height: image.height + x: image.x + y: image.y + 6 + z: -1 + blurEnabled: true + blurMax: 12 + blur: 1.0 + contrast: -1.0 + brightness: 1.0 + colorizationColor: DefaultStyle.grey_400 + colorization: 1.0 }*/ MultiEffect { id: shadow diff --git a/Linphone/view/Control/Display/Flickable.qml b/Linphone/view/Control/Display/Flickable.qml index 9bacef8ef..2a5e2bf86 100644 --- a/Linphone/view/Control/Display/Flickable.qml +++ b/Linphone/view/Control/Display/Flickable.qml @@ -6,5 +6,5 @@ Flickable { contentWidth: contentItem.childrenRect.width contentHeight: contentItem.childrenRect.height clip: true - flickableDirection: Flickable.VerticalFlick + flickableDirection: Flickable.VerticalFlick } diff --git a/Linphone/view/Control/Display/GradientRectangle.qml b/Linphone/view/Control/Display/GradientRectangle.qml index 80dc08882..94468f7fc 100644 --- a/Linphone/view/Control/Display/GradientRectangle.qml +++ b/Linphone/view/Control/Display/GradientRectangle.qml @@ -4,25 +4,31 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Item { id: mainItem - property real borderWidth: Utils.getSizeWithScreenRatio(1) + property real borderWidth: Utils.getSizeWithScreenRatio(1) property alias borderGradient: border.gradient property alias gradient: fill.gradient property alias color: fill.color - property real radius + property real radius Rectangle { id: border radius: mainItem.radius anchors.fill: parent gradient: Gradient { orientation: Gradient.Horizontal - GradientStop { position: 0.0; color: DefaultStyle.grey_0 } - GradientStop { position: 1.0; color: DefaultStyle.grey_100 } + GradientStop { + position: 0.0 + color: DefaultStyle.grey_0 + } + GradientStop { + position: 1.0 + color: DefaultStyle.grey_100 + } } Rectangle { id: fill anchors.fill: parent anchors.margins: mainItem.borderWidth - radius: mainItem.radius + radius: mainItem.radius } } } diff --git a/Linphone/view/Control/Display/HorizontalBar.qml b/Linphone/view/Control/Display/HorizontalBar.qml index 8637823ae..d38d7aac1 100644 --- a/Linphone/view/Control/Display/HorizontalBar.qml +++ b/Linphone/view/Control/Display/HorizontalBar.qml @@ -2,10 +2,10 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls import Linphone -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils -Rectangle{ - height: 1 - Layout.fillWidth: true - color: DefaultStyle.main2_500_main -} \ No newline at end of file +Rectangle { + height: 1 + Layout.fillWidth: true + color: DefaultStyle.main2_500_main +} diff --git a/Linphone/view/Control/Display/MediaProgressBar.qml b/Linphone/view/Control/Display/MediaProgressBar.qml index c917ca0e7..212610bbf 100644 --- a/Linphone/view/Control/Display/MediaProgressBar.qml +++ b/Linphone/view/Control/Display/MediaProgressBar.qml @@ -7,14 +7,14 @@ import QtQuick.Effects import Linphone import UtilsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= ProgressBar { id: mainItem - + property bool stopAtEnd: true property bool resetAtEnd: true property int progressDuration // Max duration @@ -24,22 +24,22 @@ ProgressBar { property bool recording: false padding: 0 clip: true - - function start(){ - mainItem.value = 0 - animationTest.start() + + function start() { + mainItem.value = 0; + animationTest.start(); } - function resume(){ + function resume() { if (mainItem.value >= 100) - mainItem.value = 0 - animationTest.start() + mainItem.value = 0; + animationTest.start(); } - function stop(){ - animationTest.stop() + function stop() { + animationTest.stop(); } - signal playStopButtonToggled() - signal endReached() - signal refreshPositionRequested() + signal playStopButtonToggled + signal endReached + signal refreshPositionRequested signal seekRequested(int ms) Timer { id: animationTest @@ -49,21 +49,21 @@ ProgressBar { } to: 101 value: progressPosition * to / progressDuration - onValueChanged:{ - if(value > 100) { - if( mainItem.stopAtEnd) - stop() - if(mainItem.resetAtEnd) { - mainItem.value = 0 - progressPosition = 0 - } else if(mainItem.blockValueAtEnd){ - mainItem.value = 100// Stay at 100 - progressPosition = progressDuration + onValueChanged: { + if (value > 100) { + if (mainItem.stopAtEnd) + stop(); + if (mainItem.resetAtEnd) { + mainItem.value = 0; + progressPosition = 0; + } else if (mainItem.blockValueAtEnd) { + mainItem.value = 100;// Stay at 100 + progressPosition = progressDuration; } - mainItem.endReached() + mainItem.endReached(); } } - + background: Item { anchors.fill: parent Rectangle { @@ -71,8 +71,14 @@ ProgressBar { anchors.fill: parent gradient: Gradient { orientation: Gradient.Horizontal - GradientStop { position: 0.0; color: "#FF9E79" } - GradientStop { position: 1.0; color: "#FE5E00" } + GradientStop { + position: 0.0 + color: "#FF9E79" + } + GradientStop { + position: 1.0 + color: "#FE5E00" + } } radius: Utils.getSizeWithScreenRatio(70) } @@ -83,8 +89,8 @@ ProgressBar { radius: backgroundArea.radius } Item { - anchors.fill: parent id: progressRectangle + anchors.fill: parent visible: false Rectangle { color: DefaultStyle.grey_0 @@ -96,12 +102,10 @@ ProgressBar { ShaderEffect { id: opacityEffect anchors.fill: progressRectangle - property var source: ShaderEffectSource - { + property var source: ShaderEffectSource { sourceItem: progressRectangle } - property var maskSource: ShaderEffectSource - { + property var maskSource: ShaderEffectSource { sourceItem: mask } fragmentShader: 'qrc:/data/shaders/opacityMask.frag.qsb' @@ -109,13 +113,12 @@ ProgressBar { MouseArea { id: progression anchors.fill: parent - onClicked: (mouse) => { - mainItem.seekRequested(mouse.x * mainItem.progressDuration/width) - } + onClicked: mouse => { + mainItem.seekRequested(mouse.x * mainItem.progressDuration / width); + } } } - - + contentItem: Item { id: contentRect @@ -126,13 +129,9 @@ ProgressBar { anchors.verticalCenter: parent.verticalCenter icon.width: Utils.getSizeWithScreenRatio(14) icon.height: Utils.getSizeWithScreenRatio(14) - icon.source: animationTest.running - ? mainItem.recording - ? AppIcons.stopFill - : AppIcons.pauseFill - : AppIcons.playFill + icon.source: animationTest.running ? mainItem.recording ? AppIcons.stopFill : AppIcons.pauseFill : AppIcons.playFill onClicked: { - mainItem.playStopButtonToggled() + mainItem.playStopButtonToggled(); } style: ButtonStyle.player } @@ -160,7 +159,8 @@ ProgressBar { } Text { id: durationText - text: mainItem.progressPosition > 0 ? UtilsCpp.formatElapsedTime(mainItem.progressPosition / 1000 ) : UtilsCpp.formatElapsedTime(mainItem.progressDuration/1000) + text: mainItem.progressPosition > 0 ? UtilsCpp.formatElapsedTime(mainItem.progressPosition / 1000) : UtilsCpp.formatElapsedTime( + mainItem.progressDuration / 1000) font { pixelSize: Typography.p1.pixelSize weight: Typography.p1.weight diff --git a/Linphone/view/Control/Display/Meeting/MeetingListView.qml b/Linphone/view/Control/Display/Meeting/MeetingListView.qml index 642355aad..e5c045fca 100644 --- a/Linphone/view/Control/Display/Meeting/MeetingListView.qml +++ b/Linphone/view/Control/Display/Meeting/MeetingListView.qml @@ -7,64 +7,64 @@ import Linphone import QtQml import UtilsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle ListView { id: mainItem property string searchBarText - property bool hoverEnabled: true + property bool hoverEnabled: true property var delegateButtons property ConferenceInfoGui selectedConference property ConferenceInfoGui confToBeSelected: null property bool _moveToIndex: false - property bool loading: false - property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) + property bool loading: false + property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) clip: true - cacheBuffer: height/2 - - spacing: Utils.getSizeWithScreenRatio(8) + cacheBuffer: height / 2 + + spacing: Utils.getSizeWithScreenRatio(8) highlightFollowsCurrentItem: false - onCurrentIndexChanged: if(currentIndex === -1) { - resetSelections() - } + onCurrentIndexChanged: if (currentIndex === -1) { + resetSelections(); + } signal meetingDeletionRequested(ConferenceInfoGui confInfo, bool canCancel) - - function selectIndex(index){ - mainItem.currentIndex = index + + function selectIndex(index) { + mainItem.currentIndex = index; } - - function resetSelections(){ - mainItem.selectedConference = null - mainItem.currentIndex = -1 + + function resetSelections() { + mainItem.selectedConference = null; + mainItem.currentIndex = -1; } function scrollToCurrentDate() { - currentIndex = -1 - confInfoProxy.selectData(confInfoProxy.getCurrentDateConfInfo()) - moveToCurrentItem() + currentIndex = -1; + confInfoProxy.selectData(confInfoProxy.getCurrentDateConfInfo()); + moveToCurrentItem(); } - -//---------------------------------------------------------------- - function moveToCurrentItem(){ - if(mainItem.currentIndex >= 0) - mainItem.positionViewAtIndex(mainItem.currentIndex, ListView.Contain) + + //---------------------------------------------------------------- + function moveToCurrentItem() { + if (mainItem.currentIndex >= 0) + mainItem.positionViewAtIndex(mainItem.currentIndex, ListView.Contain); } onCurrentItemChanged: { - moveToCurrentItem() - if(currentItem) { - mainItem.selectedConference = currentItem.itemGui + moveToCurrentItem(); + if (currentItem) { + mainItem.selectedConference = currentItem.itemGui; } } // Update position only if we are moving to current item and its position is changing. property var _currentItemY: currentItem?.y - on_CurrentItemYChanged: if(_currentItemY && moveAnimation.running){ - moveToCurrentItem() - } - Behavior on contentY{ + on_CurrentItemYChanged: if (_currentItemY && moveAnimation.running) { + moveToCurrentItem(); + } + Behavior on contentY { NumberAnimation { id: moveAnimation duration: 500 @@ -72,76 +72,81 @@ ListView { alwaysRunToEnd: true } } -//---------------------------------------------------------------- - onAtYEndChanged: if(atYEnd) confInfoProxy.displayMore() + //---------------------------------------------------------------- + onAtYEndChanged: if (atYEnd) + confInfoProxy.displayMore() Component.onCompleted: { - confInfoProxy.invalidate() + confInfoProxy.invalidate(); } - - Keys.onPressed: (event)=> { - if(event.key == Qt.Key_Up) { - if(currentIndex > 0 ) { - selectIndex(mainItem.currentIndex-1) - event.accepted = true - } else { - selectIndex(model.count - 1) - event.accepted = true - } - }else if(event.key == Qt.Key_Down){ - if(currentIndex < model.count - 1) { - selectIndex(currentIndex+1) - event.accepted = true - } else { - selectIndex(0) - event.accepted = true - } - } - } - + + Keys.onPressed: event => { + if (event.key == Qt.Key_Up) { + if (currentIndex > 0) { + selectIndex(mainItem.currentIndex - 1); + event.accepted = true; + } else { + selectIndex(model.count - 1); + event.accepted = true; + } + } else if (event.key == Qt.Key_Down) { + if (currentIndex < model.count - 1) { + selectIndex(currentIndex + 1); + event.accepted = true; + } else { + selectIndex(0); + event.accepted = true; + } + } + } + // Let some space for better UI - footer: Item{height: Utils.getSizeWithScreenRatio(38)} + footer: Item { + height: Utils.getSizeWithScreenRatio(38) + } model: ConferenceInfoProxy { id: confInfoProxy filterText: searchBarText filterType: ConferenceInfoProxy.None - initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(63))) - displayItemsStep: initialDisplayItems/2 + initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(63))) + displayItemsStep: initialDisplayItems / 2 onModelAboutToBeReset: { - mainItem.confToBeSelected = mainItem.selectedConference - mainItem.loading = true - } + mainItem.confToBeSelected = mainItem.selectedConference; + mainItem.loading = true; + } onModelReset: { - mainItem.loading = false - if (mainItem.confToBeSelected) selectData(mainItem.confToBeSelected) - else selectData(getCurrentDateConfInfo()) + mainItem.loading = false; + if (mainItem.confToBeSelected) + selectData(mainItem.confToBeSelected); + else + selectData(getCurrentDateConfInfo()); } - function selectData(confInfoGui){ - mainItem.currentIndex = loadUntil(confInfoGui) - } - onConferenceInfoCreated: (confInfoGui) => { - selectData(confInfoGui) - } - onConferenceInfoUpdated: (confInfoGui) => { - selectData(confInfoGui) + function selectData(confInfoGui) { + mainItem.currentIndex = loadUntil(confInfoGui); } + onConferenceInfoCreated: confInfoGui => { + selectData(confInfoGui); + } + onConferenceInfoUpdated: confInfoGui => { + selectData(confInfoGui); + } } BusyIndicator { - anchors.horizontalCenter: mainItem.horizontalCenter - visible: mainItem.loading - height: visible ? mainItem.busyIndicatorSize : 0 - width: mainItem.busyIndicatorSize - indicatorHeight: mainItem.busyIndicatorSize - indicatorWidth: mainItem.busyIndicatorSize - indicatorColor: DefaultStyle.main1_500_main - } - + anchors.horizontalCenter: mainItem.horizontalCenter + visible: mainItem.loading + height: visible ? mainItem.busyIndicatorSize : 0 + width: mainItem.busyIndicatorSize + indicatorHeight: mainItem.busyIndicatorSize + indicatorWidth: mainItem.busyIndicatorSize + indicatorColor: DefaultStyle.main1_500_main + } + ScrollBar.vertical: ScrollBar { id: scrollbar - rightPadding: Utils.getSizeWithScreenRatio(8) - + rightPadding: Utils.getSizeWithScreenRatio(8) + active: true interactive: true policy: mainItem.contentHeight > mainItem.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff @@ -150,81 +155,82 @@ ListView { section { criteria: ViewSection.FullString delegate: Text { - topPadding: Utils.getSizeWithScreenRatio(24) - bottomPadding: Utils.getSizeWithScreenRatio(16) + topPadding: Utils.getSizeWithScreenRatio(24) + bottomPadding: Utils.getSizeWithScreenRatio(16) text: section - height: Utils.getSizeWithScreenRatio(29) + topPadding + bottomPadding + height: Utils.getSizeWithScreenRatio(29) + topPadding + bottomPadding wrapMode: Text.NoWrap font { - pixelSize: Utils.getSizeWithScreenRatio(20) - weight: Utils.getSizeWithScreenRatio(800) + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Utils.getSizeWithScreenRatio(800) capitalization: Font.Capitalize } } property: '$sectionMonth' } - + delegate: FocusScope { id: itemDelegate visible: !mainItem.loading - height: Utils.getSizeWithScreenRatio(63) + (!isFirst && dateDay.visible ? topOffset : 0) + height: Utils.getSizeWithScreenRatio(63) + (!isFirst && dateDay.visible ? topOffset : 0) width: mainItem.width enabled: haveModel - + property var itemGui: $modelData // Do not use itemAtIndex because of caching items. Using getAt ensure to have a GUI - property var previousConfInfoGui : mainItem.model.getAt(index-1) + property var previousConfInfoGui: mainItem.model.getAt(index - 1) property var dateTime: itemGui.core ? itemGui.core.dateTime : UtilsCpp.getCurrentDateTime() - property string day : UtilsCpp.toDateDayNameString(dateTime) - 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) ? Utils.getSizeWithScreenRatio(8) : 0 + property string day: UtilsCpp.toDateDayNameString(dateTime) + 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) ? 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 property bool isSelected: itemGui.core == mainItem.selectedConference?.core - - RowLayout{ + + RowLayout { id: delegateIn anchors.fill: parent anchors.topMargin: !itemDelegate.isFirst && dateDay.visible ? itemDelegate.topOffset : 0 spacing: 0 - Item{ - Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) + Item { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) visible: !dateDay.visible } ColumnLayout { id: dateDay Layout.fillWidth: false - Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) - Layout.minimumWidth: Utils.getSizeWithScreenRatio(32) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(51) + 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: Utils.getSizeWithScreenRatio(19) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(19) Layout.alignment: Qt.AlignCenter - text: day.substring(0,3) + '.' + text: day.substring(0, 3) + '.' color: DefaultStyle.main2_500_main wrapMode: Text.NoWrap elide: Text.ElideNone font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight capitalization: Font.Capitalize } } Rectangle { id: dayNum - Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) Layout.alignment: Qt.AlignCenter - radius: height/2 + radius: height / 2 property var isCurrentDay: UtilsCpp.isCurrentDay(dateTime) color: isCurrentDay ? DefaultStyle.main1_500_main : "transparent" - + Text { anchors.centerIn: parent verticalAlignment: Text.AlignVCenter @@ -233,58 +239,62 @@ ListView { color: dayNum.isCurrentDay ? DefaultStyle.grey_0 : DefaultStyle.main2_500_main wrapMode: Text.NoWrap font { - pixelSize: Utils.getSizeWithScreenRatio(20) - weight: Utils.getSizeWithScreenRatio(800) + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Utils.getSizeWithScreenRatio(800) } } } - Item{Layout.fillHeight:true;Layout.fillWidth: true} + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } } Item { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(265) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(63) - Layout.leftMargin: Utils.getSizeWithScreenRatio(23) + 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: Utils.getSizeWithScreenRatio(10) + radius: Utils.getSizeWithScreenRatio(10) visible: itemDelegate.haveModel || mainItem.currentIndex === itemDelegate.index color: itemDelegate.isSelected ? DefaultStyle.main2_200 : DefaultStyle.grey_0 // mainItem.currentIndex === index ColumnLayout { anchors.fill: parent anchors.left: parent.left - anchors.leftMargin: Utils.getSizeWithScreenRatio(16) - anchors.rightMargin: Utils.getSizeWithScreenRatio(16) - anchors.topMargin: Utils.getSizeWithScreenRatio(10) - anchors.bottomMargin: Utils.getSizeWithScreenRatio(10) - spacing: Utils.getSizeWithScreenRatio(2) + 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: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.videoconference colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } Text { - text: itemGui.core? itemGui.core.subject : "" + text: itemGui.core ? itemGui.core.subject : "" Layout.fillWidth: true maximumLineCount: 1 font { - pixelSize: Typography.p2.pixelSize - weight: Typography.p2.weight + pixelSize: Typography.p2.pixelSize + weight: Typography.p2.weight } } } Text { - //: "Réunion annulée" - text: itemDelegate.isCanceled ? qsTr("meeting_info_cancelled") : UtilsCpp.toDateHourString(dateTime) + " - " + UtilsCpp.toDateHourString(endDateTime) + //: "Réunion annulée" + text: itemDelegate.isCanceled ? qsTr("meeting_info_cancelled") : UtilsCpp.toDateHourString(dateTime) + " - " + + UtilsCpp.toDateHourString(endDateTime) color: itemDelegate.isCanceled ? DefaultStyle.danger_500_main : DefaultStyle.main2_500_main font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight } } } @@ -299,17 +309,17 @@ ListView { } Text { anchors.fill: parent - anchors.rightMargin: Utils.getSizeWithScreenRatio(5) // margin to avoid clipping shadows at right - anchors.leftMargin: Utils.getSizeWithScreenRatio(16) + 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") + //: "Aucune réunion aujourd'hui" + text: qsTr("meetings_list_no_meeting_for_today") lineHeightMode: Text.FixedHeight - lineHeight: Utils.getSizeWithScreenRatio(18) + lineHeight: Utils.getSizeWithScreenRatio(18) font { - pixelSize: Typography.p2.pixelSize - weight: Typography.p2.weight + pixelSize: Typography.p2.pixelSize + weight: Typography.p2.weight } } MouseArea { @@ -319,33 +329,33 @@ ListView { cursorShape: itemDelegate.isCanceled ? Qt.ArrowCursor : Qt.PointingHandCursor visible: itemDelegate.haveModel acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: (mouse) => { - if (mouse.button === Qt.RightButton) { - deletePopup.x = mouse.x - deletePopup.y = mouse.y - deletePopup.open() - } - else if (!itemDelegate.isCanceled) mainItem.selectIndex(index) - } + onClicked: mouse => { + if (mouse.button === Qt.RightButton) { + deletePopup.x = mouse.x; + deletePopup.y = mouse.y; + deletePopup.open(); + } else if (!itemDelegate.isCanceled) + mainItem.selectIndex(index); + } Popup { id: deletePopup parent: mouseArea - padding: Utils.getSizeWithScreenRatio(10) - closePolicy: Popup.CloseOnPressOutsideParent | Popup.CloseOnPressOutside | Popup.CloseOnEscape + padding: Utils.getSizeWithScreenRatio(10) + closePolicy: Popup.CloseOnPressOutsideParent | Popup.CloseOnPressOutside | Popup.CloseOnEscape contentItem: IconLabelButton { style: ButtonStyle.hoveredBackgroundRed property var isMeObj: UtilsCpp.isMe(itemDelegate.itemGui?.core?.organizerAddress) - property bool canCancel: isMeObj && isMeObj.value - && itemDelegate.itemGui?.core?.state !== LinphoneEnums.ConferenceInfoState.Cancelled - && UtilsCpp.daysOffset(new Date(), itemDelegate.itemGui?.core?.endDateTime) >= 0 + property bool canCancel: isMeObj && isMeObj.value && itemDelegate.itemGui?.core?.state + !== LinphoneEnums.ConferenceInfoState.Cancelled && UtilsCpp.daysOffset(new Date(), itemDelegate.itemGui + ?.core?.endDateTime) >= 0 icon.source: AppIcons.trashCan //: "Supprimer la réunion" text: qsTr("meeting_info_delete") - + onClicked: { if (itemDelegate.itemGui) { - mainItem.meetingDeletionRequested(itemDelegate.itemGui, canCancel) - deletePopup.close() + mainItem.meetingDeletionRequested(itemDelegate.itemGui, canCancel); + deletePopup.close(); } } } diff --git a/Linphone/view/Control/Display/Participant/ParticipantDeviceListView.qml b/Linphone/view/Control/Display/Participant/ParticipantDeviceListView.qml index 5c53064b7..b97ee2b7a 100644 --- a/Linphone/view/Control/Display/Participant/ParticipantDeviceListView.qml +++ b/Linphone/view/Control/Display/Participant/ParticipantDeviceListView.qml @@ -11,8 +11,8 @@ ListView { height: contentHeight visible: contentHeight > 0 clip: true - rightMargin: Utils.getSizeWithScreenRatio(5) - spacing: Utils.getSizeWithScreenRatio(5) + rightMargin: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) property string searchBarText @@ -32,28 +32,28 @@ ListView { } delegate: Item { - height: Utils.getSizeWithScreenRatio(56) + height: Utils.getSizeWithScreenRatio(56) width: mainItem.width - + RowLayout { id: participantDelegate anchors.left: parent.left - anchors.leftMargin: Utils.getSizeWithScreenRatio(10) + anchors.leftMargin: Utils.getSizeWithScreenRatio(10) anchors.right: parent.right - anchors.rightMargin: Utils.getSizeWithScreenRatio(10) + anchors.rightMargin: Utils.getSizeWithScreenRatio(10) anchors.verticalCenter: parent.verticalCenter - spacing: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) z: 1 Avatar { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + 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: Utils.getSizeWithScreenRatio(14) + 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 57d47627a..ccf28a9b7 100644 --- a/Linphone/view/Control/Display/Participant/ParticipantInfoListView.qml +++ b/Linphone/view/Control/Display/Participant/ParticipantInfoListView.qml @@ -8,7 +8,7 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ListView { id: mainItem clip: true - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) property bool hoverEnabled: true property bool displayNameCapitalization: true @@ -48,7 +48,9 @@ ListView { maximumLineCount: 1 Layout.fillWidth: true } - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } } MouseArea { id: mousearea diff --git a/Linphone/view/Control/Display/Participant/ParticipantListView.qml b/Linphone/view/Control/Display/Participant/ParticipantListView.qml index fd3fb8bc7..bd6a6f872 100644 --- a/Linphone/view/Control/Display/Participant/ParticipantListView.qml +++ b/Linphone/view/Control/Display/Participant/ParticipantListView.qml @@ -4,15 +4,15 @@ 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/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: Utils.getSizeWithScreenRatio(5) - spacing: Utils.getSizeWithScreenRatio(8) + rightMargin: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(8) property string searchBarText @@ -26,7 +26,7 @@ ListView { property ConferenceInfoGui confInfoGui - signal addParticipantRequested() + signal addParticipantRequested Control.ScrollBar.vertical: ScrollBar { id: scrollbar @@ -44,37 +44,40 @@ ListView { } delegate: Item { - height: Utils.getSizeWithScreenRatio(56) + height: Utils.getSizeWithScreenRatio(56) width: mainItem.width - + RowLayout { id: participantDelegate anchors.fill: parent anchors.rightMargin: (scrollbar.width + Utils.getSizeWithScreenRatio(5)) - spacing: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) z: 1 Avatar { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + 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: Utils.getSizeWithScreenRatio(14) + font.pixelSize: Utils.getSizeWithScreenRatio(14) font.capitalization: mainItem.displayNameCapitalization ? Font.Capitalize : Font.MixedCase maximumLineCount: 1 Layout.fillWidth: true } - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } RowLayout { Layout.alignment: Qt.AlignRight property bool isMe: modelData.core.isMe - onIsMeChanged: if (isMe) mainItem.me = modelData - spacing: Utils.getSizeWithScreenRatio(26) + onIsMeChanged: if (isMe) + mainItem.me = modelData + spacing: Utils.getSizeWithScreenRatio(26) RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) Text { visible: mainItem.isMeAdmin || modelData.core.isAdmin Layout.alignment: Qt.AlignRight @@ -88,20 +91,21 @@ ListView { } Switch { opacity: mainItem.isMeAdmin && !modelData.core.isMe ? 1 : 0 - Component.onCompleted: if (modelData.core.isAdmin) toggle() + Component.onCompleted: if (modelData.core.isAdmin) + toggle() //TODO : Utilser checked et onToggled (pas compris) onToggled: participantModel.setParticipantAdminStatus(modelData.core, position === 1) } } SmallButton { opacity: mainItem.isMeAdmin && !modelData.core.isMe ? 1 : 0 - Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) color: DefaultStyle.main2_100 - leftPadding: Utils.getSizeWithScreenRatio(3) - rightPadding: Utils.getSizeWithScreenRatio(3) - topPadding: Utils.getSizeWithScreenRatio(3) - bottomPadding: Utils.getSizeWithScreenRatio(3) + 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 4334c71ff..44a11a7f8 100644 --- a/Linphone/view/Control/Display/ProgressBar.qml +++ b/Linphone/view/Control/Display/ProgressBar.qml @@ -6,29 +6,29 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.ProgressBar { id: mainItem - padding: Utils.getSizeWithScreenRatio(3) - + padding: Utils.getSizeWithScreenRatio(3) + property color backgroundColor: DefaultStyle.main2_100 property color innerColor: DefaultStyle.info_500_main property color innerTextColor: centeredText ? DefaultStyle.info_500_main : DefaultStyle.grey_0 property bool innerTextVisible: true - property string innerText: Number.parseFloat(value*100).toFixed(0) + "%" - property real barWidth: mainItem.visualPosition * mainItem.width + property string innerText: Number.parseFloat(value * 100).toFixed(0) + "%" + property real barWidth: mainItem.visualPosition * mainItem.width property bool centeredText: textSize.width >= barWidth - TextMetrics{ - id: textSize - text: mainItem.innerText - font { - pixelSize: Utils.getSizeWithScreenRatio(10) - weight: Utils.getSizeWithScreenRatio(700) + TextMetrics { + id: textSize + text: mainItem.innerText + font { + pixelSize: Utils.getSizeWithScreenRatio(10) + weight: Utils.getSizeWithScreenRatio(700) bold: true - } - } + } + } background: Rectangle { color: mainItem.backgroundColor - radius: Utils.getSizeWithScreenRatio(50) + radius: Utils.getSizeWithScreenRatio(50) anchors.fill: mainItem width: mainItem.width height: mainItem.height @@ -38,7 +38,7 @@ Control.ProgressBar { Rectangle { id: bar color: mainItem.innerColor - radius: Utils.getSizeWithScreenRatio(50) + radius: Utils.getSizeWithScreenRatio(50) width: mainItem.barWidth height: parent.height } @@ -52,9 +52,9 @@ Control.ProgressBar { color: mainItem.innerTextColor maximumLineCount: 1 font { - pixelSize: Utils.getSizeWithScreenRatio(10) - weight: Utils.getSizeWithScreenRatio(700) - } + 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 d88029619..1d3039145 100644 --- a/Linphone/view/Control/Display/RoundProgressBar.qml +++ b/Linphone/view/Control/Display/RoundProgressBar.qml @@ -4,7 +4,7 @@ import QtQuick.Shapes import Linphone import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils -ProgressBar{ +ProgressBar { id: mainItem property string text: value + '%' implicitHeight: 35 @@ -12,32 +12,33 @@ ProgressBar{ to: 100 value: 0 background: Item {} - Timer{ + Timer { id: animationTest repeat: true onTriggered: value = (value + 1) % to interval: 5 } - contentItem: Item{ + contentItem: Item { Shape { id: shape anchors.fill: parent anchors.margins: Utils.getSizeWithScreenRatio(2) - - property real progressionRadius : Math.round(Math.min(shape.width / 2, shape.height / 2) - Utils.getSizeWithScreenRatio(3) / 2) - + + property real progressionRadius: Math.round(Math.min(shape.width / 2, shape.height / 2) + - Utils.getSizeWithScreenRatio(3) / 2) + layer.enabled: true layer.samples: 8 layer.smooth: true vendorExtensionsEnabled: false - + ShapePath { id: pathDial strokeColor: DefaultStyle.main1_100 fillColor: 'transparent' strokeWidth: Utils.getSizeWithScreenRatio(3) capStyle: Qt.RoundCap - + PathAngleArc { radiusX: shape.progressionRadius radiusY: shape.progressionRadius @@ -47,25 +48,25 @@ ProgressBar{ sweepAngle: 360 } } - + ShapePath { id: pathProgress strokeColor: DefaultStyle.main1_500_main fillColor: 'transparent' strokeWidth: Utils.getSizeWithScreenRatio(3) capStyle: Qt.RoundCap - + PathAngleArc { radiusX: shape.progressionRadius radiusY: shape.progressionRadius centerX: Math.round(shape.width / 2) centerY: Math.round(shape.height / 2) startAngle: -90 // top start - sweepAngle: (360/ mainItem.to * mainItem.value) + sweepAngle: (360 / mainItem.to * mainItem.value) } } } - Text{ + Text { anchors.centerIn: parent text: mainItem.text color: DefaultStyle.main1_500_main diff --git a/Linphone/view/Control/Display/RoundedPane.qml b/Linphone/view/Control/Display/RoundedPane.qml index 4b8f3f61a..98890e4df 100644 --- a/Linphone/view/Control/Display/RoundedPane.qml +++ b/Linphone/view/Control/Display/RoundedPane.qml @@ -5,12 +5,12 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.Control { id: mainItem - // width: Utils.getSizeWithScreenRatio(360) + // width: Utils.getSizeWithScreenRatio(360) property color backgroundColor: DefaultStyle.grey_0 - padding: Utils.getSizeWithScreenRatio(10) + padding: Utils.getSizeWithScreenRatio(10) background: Rectangle { anchors.fill: parent - radius: Utils.getSizeWithScreenRatio(15) + radius: Utils.getSizeWithScreenRatio(15) color: mainItem.backgroundColor } } diff --git a/Linphone/view/Control/Display/Settings/SettingsMenuItem.qml b/Linphone/view/Control/Display/Settings/SettingsMenuItem.qml index e953b0f49..40691dc0a 100644 --- a/Linphone/view/Control/Display/Settings/SettingsMenuItem.qml +++ b/Linphone/view/Control/Display/Settings/SettingsMenuItem.qml @@ -4,29 +4,29 @@ import QtQuick.Layouts import QtQuick.Effects import Linphone import CustomControls 1.0 -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Item { id: mainItem - height: visible ? Utils.getSizeWithScreenRatio(50) : 0 + height: visible ? Utils.getSizeWithScreenRatio(50) : 0 anchors.right: parent.right anchors.left: parent.left property bool keyboardOtherFocus: FocusHelper.keyboardFocus || FocusHelper.otherFocus property string titleText property bool isSelected: false - - signal selected() + + signal selected //: %1 settings Accessible.name: qsTr("setting_tab_accessible_name").arg(titleText) Accessible.role: Accessible.ListItem - - Keys.onPressed: (event)=>{ - if(event.key == Qt.Key_Space || event.key == Qt.Key_Return || event.key == Qt.Key_Enter){ - mainItem.selected() - } - } + + Keys.onPressed: event => { + if (event.key == Qt.Key_Space || event.key == Qt.Key_Return || event.key == Qt.Key_Enter) { + mainItem.selected(); + } + } MouseArea { id: mouseArea hoverEnabled: true @@ -35,7 +35,7 @@ Item { id: background anchors.fill: parent color: mainItem.isSelected ? DefaultStyle.main2_200 : parent.containsMouse ? DefaultStyle.main2_100 : "transparent" - radius: mainItem.height / 2 + radius: mainItem.height / 2 bottomRightRadius: 0 topRightRadius: 0 visible: parent.containsMouse || mainItem.isSelected || mainItem.keyboardOtherFocus @@ -43,7 +43,7 @@ Item { border.width: mainItem.keyboardOtherFocus ? Utils.getSizeWithScreenRatio(3) : 0 } onClicked: { - mainItem.selected() + mainItem.selected(); } } Text { @@ -54,5 +54,4 @@ Item { text: mainItem.titleText font: Typography.h4 } - } diff --git a/Linphone/view/Control/Display/Sticker.qml b/Linphone/view/Control/Display/Sticker.qml index 0a1dd10e1..eb620c859 100644 --- a/Linphone/view/Control/Display/Sticker.qml +++ b/Linphone/view/Control/Display/Sticker.qml @@ -23,51 +23,30 @@ Item { property var callState: call && call.core.state || undefined property AccountGui account: null property ParticipantDeviceGui participantDevice: null - property bool displayBorder : participantDevice && participantDevice.core.isSpeaking || false + property bool displayBorder: participantDevice && participantDevice.core.isSpeaking || false property alias displayPresence: avatar.displayPresence property color color: DefaultStyle.grey_600 - property real radius: Utils.getSizeWithScreenRatio(15) - property bool remoteIsPaused: participantDevice - ? participantDevice.core.isPaused - : previewEnabled - ? callState === LinphoneEnums.CallState.Paused - : callState === LinphoneEnums.CallState.PausedByRemote + property real radius: Utils.getSizeWithScreenRatio(15) + property bool remoteIsPaused: participantDevice ? participantDevice.core.isPaused : previewEnabled ? callState + === LinphoneEnums.CallState.Paused : callState === LinphoneEnums.CallState.PausedByRemote - property string remoteAddress: account - ? account.core.identityAddress - : participantDevice - ? participantDevice.core.address - : call - ? call.core.remoteAddress - : "" - property var localNameObj: previewEnabled && call - ? UtilsCpp.getDisplayName(call.core.localAddress) - : null + property string remoteAddress: account ? account.core.identityAddress : participantDevice + ? participantDevice.core.address : call ? call.core.remoteAddress : "" + property var localNameObj: previewEnabled && call ? UtilsCpp.getDisplayName(call.core.localAddress) : null property string localName: localNameObj ? localNameObj.value : "" - property string displayName: account - ? account.core.displayName - : participantDevice - ? participantDevice.core.displayName - : call - ? previewEnabled - ? localName - : call.core.remoteName - : "" + property string displayName: account ? account.core.displayName : participantDevice + ? participantDevice.core.displayName : call ? previewEnabled ? localName : call.core.remoteName : "" property var contactObj: call ? UtilsCpp.findFriendByAddress(call.core.remoteAddress) : null property var contact: contactObj && contactObj.value || null - + property var identityAddress: account ? UtilsCpp.getDisplayName(account.core.identityAddress) : null - property bool videoEnabled: (previewEnabled && call && call.core.cameraEnabled) - || (!previewEnabled && call && call.core.remoteVideoEnabled) - || (participantDevice && participantDevice.core.videoEnabled) + property bool videoEnabled: (previewEnabled && call && call.core.cameraEnabled) || (!previewEnabled && call + && call.core.remoteVideoEnabled) || (participantDevice && participantDevice.core.videoEnabled) property string qmlName - property bool displayAll : !!mainItem.call - property bool mutedStatus: participantDevice - ? participantDevice.core.isMuted - : account && call - ? call.core.conference && call.core.microphoneMuted - : false + property bool displayAll: !!mainItem.call + property bool mutedStatus: participantDevice ? participantDevice.core.isMuted : account && call ? call.core.conference + && call.core.microphoneMuted : false clip: false Rectangle { id: background @@ -75,78 +54,79 @@ Item { radius: mainItem.radius anchors.fill: parent border.color: DefaultStyle.main2_200 - border.width: mainItem.displayBorder ? Utils.getSizeWithScreenRatio(3) : 0 - property real minSize: Math.min(height, width) + border.width: mainItem.displayBorder ? Utils.getSizeWithScreenRatio(3) : 0 + property real minSize: Math.min(height, width) Item { id: noCameraLayout anchors.fill: parent visible: !cameraLoader.active || cameraLoader.status != Loader.Ready || !cameraLoader.item.isReady ColumnLayout { anchors.top: parent.top - anchors.topMargin: Utils.getSizeWithScreenRatio(81) + anchors.topMargin: Utils.getSizeWithScreenRatio(81) anchors.horizontalCenter: parent.horizontalCenter // Layout.alignment: Qt.AlignHCenter |Qt.AlignTop spacing: 0 - visible: !mainItem.account && (mainItem.callState === LinphoneEnums.CallState.OutgoingInit - || mainItem.callState === LinphoneEnums.CallState.OutgoingProgress - || mainItem.callState === LinphoneEnums.CallState.OutgoingRinging - || mainItem.callState === LinphoneEnums.CallState.OutgoingEarlyMedia - || mainItem.callState === LinphoneEnums.CallState.IncomingReceived) + visible: !mainItem.account && (mainItem.callState === LinphoneEnums.CallState.OutgoingInit || mainItem.callState + === LinphoneEnums.CallState.OutgoingProgress || mainItem.callState + === LinphoneEnums.CallState.OutgoingRinging || mainItem.callState + === LinphoneEnums.CallState.OutgoingEarlyMedia || mainItem.callState + === LinphoneEnums.CallState.IncomingReceived) BusyIndicator { indicatorColor: DefaultStyle.main2_100 Layout.alignment: Qt.AlignHCenter - indicatorHeight: Utils.getSizeWithScreenRatio(42) - indicatorWidth: Utils.getSizeWithScreenRatio(42) + indicatorHeight: Utils.getSizeWithScreenRatio(42) + indicatorWidth: Utils.getSizeWithScreenRatio(42) } } - Item{ + Item { id: centerItem visible: !mainItem.remoteIsPaused anchors.centerIn: parent - height: mainItem.conference - ? background.minSize * 142 / 372 - : Utils.getSizeWithScreenRatio(120) + height: mainItem.conference ? background.minSize * 142 / 372 : Utils.getSizeWithScreenRatio(120) width: height - Avatar{ + Avatar { id: avatar anchors.fill: parent visible: !joiningView.visible account: mainItem.account call: !mainItem.previewEnabled ? mainItem.call : null displayNameVal: mainItem.displayName - securityBreach: mainItem.securityBreach ? mainItem.securityBreach : securityLevel === LinphoneEnums.SecurityLevel.Unsafe + securityBreach: mainItem.securityBreach ? mainItem.securityBreach : securityLevel + === LinphoneEnums.SecurityLevel.Unsafe secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified } - ColumnLayout{ + ColumnLayout { id: joiningView anchors.centerIn: parent spacing: 0 - visible: mainItem.participantDevice && (mainItem.participantDevice.core.state == LinphoneEnums.ParticipantDeviceState.Joining || mainItem.participantDevice.core.state == LinphoneEnums.ParticipantDeviceState.Alerting) || false + visible: mainItem.participantDevice && (mainItem.participantDevice.core.state + == LinphoneEnums.ParticipantDeviceState.Joining || mainItem.participantDevice.core.state + == LinphoneEnums.ParticipantDeviceState.Alerting) || false BusyIndicator { - Layout.preferredHeight: Utils.getSizeWithScreenRatio(42) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(42) indicatorColor: DefaultStyle.main2_100 Layout.alignment: Qt.AlignHCenter - indicatorHeight: Utils.getSizeWithScreenRatio(42) - indicatorWidth: Utils.getSizeWithScreenRatio(42) + indicatorHeight: Utils.getSizeWithScreenRatio(42) + indicatorWidth: Utils.getSizeWithScreenRatio(42) } Text { - Layout.preferredHeight: Utils.getSizeWithScreenRatio(27) - Layout.topMargin: Utils.getSizeWithScreenRatio(15) // (84-27)-42 - //: "rejoint…" - text: qsTr("conference_participant_joining_text") + 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: Utils.getSizeWithScreenRatio(20) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Utils.getSizeWithScreenRatio(500) } } } } ColumnLayout { anchors.centerIn: parent - spacing: Utils.getSizeWithScreenRatio(12) + spacing: Utils.getSizeWithScreenRatio(12) visible: mainItem.remoteIsPaused EffectImage { imageSource: AppIcons.pause @@ -158,11 +138,11 @@ Item { Text { color: DefaultStyle.grey_0 Layout.alignment: Qt.AlignHCenter - //: "En pause" - text: qsTr("conference_participant_paused_text") + //: "En pause" + text: qsTr("conference_participant_paused_text") font { - pixelSize: Utils.getSizeWithScreenRatio(20) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Utils.getSizeWithScreenRatio(500) } } } @@ -170,7 +150,7 @@ Item { spacing: 0 visible: mainItem.displayAll && !mainItem.remoteIsPaused && !mainItem.conference anchors.top: centerItem.bottom - anchors.topMargin: Utils.getSizeWithScreenRatio(21) + anchors.topMargin: Utils.getSizeWithScreenRatio(21) anchors.left: parent.left anchors.right: parent.right @@ -180,8 +160,8 @@ Item { text: mainItem.displayName color: DefaultStyle.grey_0 font { - pixelSize: Utils.getSizeWithScreenRatio(22) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(22) + weight: Utils.getSizeWithScreenRatio(300) capitalization: Font.Capitalize } } @@ -192,37 +172,37 @@ Item { text: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(_text) : _text color: DefaultStyle.grey_0 font { - pixelSize: Utils.getSizeWithScreenRatio(14) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(14) + weight: Utils.getSizeWithScreenRatio(300) } } } } - Loader{ + Loader { id: cameraLoader anchors.fill: parent property bool reset: false - Timer{ + Timer { id: resetTimer interval: 1 triggeredOnStart: true - onTriggered: {cameraLoader.reset = !cameraLoader.reset} + onTriggered: { + cameraLoader.reset = !cameraLoader.reset; + } } - active: mainItem.visible && !mainItem.remoteIsPaused - && mainItem.videoEnabled - && mainItem.callState !== LinphoneEnums.CallState.End - && mainItem.callState !== LinphoneEnums.CallState.Released - && !cameraLoader.reset - onActiveChanged: console.log("("+mainItem.qmlName+") Camera active " + active +", visible="+mainItem.visible +", videoEnabled="+mainItem.videoEnabled +", reset="+cameraLoader.reset) + active: mainItem.visible && !mainItem.remoteIsPaused && mainItem.videoEnabled && mainItem.callState + !== LinphoneEnums.CallState.End && mainItem.callState !== LinphoneEnums.CallState.Released && !cameraLoader.reset + onActiveChanged: console.log("(" + mainItem.qmlName + ") Camera active " + active + ", visible=" + mainItem.visible + + ", videoEnabled=" + mainItem.videoEnabled + ", reset=" + cameraLoader.reset) sourceComponent: cameraComponent } - Component{ + Component { id: cameraComponent Item { height: cameraLoader.height width: cameraLoader.width property alias isReady: cameraItem.isReady - CameraGui{ + CameraGui { id: cameraItem anchors.fill: parent visible: false @@ -230,10 +210,10 @@ Item { isPreview: mainItem.previewEnabled call: mainItem.call participantDevice: mainItem.participantDevice - + onRequestNewRenderer: { - console.log("Request new renderer for " +mainItem.qmlName) - resetTimer.restart() + console.log("Request new renderer for " + mainItem.qmlName); + resetTimer.restart(); } layer.enabled: true } @@ -256,21 +236,18 @@ Item { anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - anchors.leftMargin: Utils.getSizeWithScreenRatio(10) - anchors.rightMargin: Utils.getSizeWithScreenRatio(10) - anchors.bottomMargin: Utils.getSizeWithScreenRatio(10) + anchors.leftMargin: Utils.getSizeWithScreenRatio(10) + anchors.rightMargin: Utils.getSizeWithScreenRatio(10) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(10) width: implicitWidth maximumLineCount: 1 - property string _text: mainItem.displayName != '' - ? mainItem.displayName - : mainItem.account && mainItem.identityAddress - ? mainItem.identityAddress.value - : "" + property string _text: mainItem.displayName != '' ? mainItem.displayName : mainItem.account + && mainItem.identityAddress ? mainItem.identityAddress.value : "" text: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(_text) : _text color: DefaultStyle.grey_0 font { - pixelSize: Utils.getSizeWithScreenRatio(14) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(14) + weight: Utils.getSizeWithScreenRatio(500) } } } @@ -284,25 +261,25 @@ Item { shadowScale: 1.05 shadowOpacity: 0.5 } - RowLayout{ + RowLayout { anchors.right: parent.right anchors.top: parent.top - anchors.rightMargin: Utils.getSizeWithScreenRatio(8) - anchors.topMargin: Utils.getSizeWithScreenRatio(8) - - height: Utils.getSizeWithScreenRatio(18) + anchors.rightMargin: Utils.getSizeWithScreenRatio(8) + anchors.topMargin: Utils.getSizeWithScreenRatio(8) + + height: Utils.getSizeWithScreenRatio(18) spacing: 0 Rectangle { id: muteIcon - Layout.preferredWidth: Math.min(Math.round(mainItem.width / 16), Utils.getSizeWithScreenRatio(20)) - Layout.preferredHeight: Math.min(Math.round(mainItem.width / 16), Utils.getSizeWithScreenRatio(20)) + 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 + radius: width / 2 EffectImage { anchors.centerIn: parent - imageWidth: Math.min(Math.round(mainItem.width / 16),Utils.getSizeWithScreenRatio(20)) - imageHeight: Math.min(Math.round(mainItem.width / 16),Utils.getSizeWithScreenRatio(20)) + 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/TemporaryText.qml b/Linphone/view/Control/Display/TemporaryText.qml index f93ecf8b5..674ef98b7 100644 --- a/Linphone/view/Control/Display/TemporaryText.qml +++ b/Linphone/view/Control/Display/TemporaryText.qml @@ -9,27 +9,28 @@ Text { color: DefaultStyle.danger_500_main property bool isVisible: text.length > 0 function clear() { - autoHideErrorMessage.stop() - text = "" + autoHideErrorMessage.stop(); + text = ""; } function setText(text) { if (text.length === 0) { - clear() + clear(); } else { - mainItem.text = text + mainItem.text = text; } } font { - pixelSize: Typography.b3.pixelSize - weight: Typography.b3.weight + pixelSize: Typography.b3.pixelSize + weight: Typography.b3.weight } Timer { id: autoHideErrorMessage interval: 5000 onTriggered: { - mainItem.clear() + mainItem.clear(); } } - onTextChanged: if (mainItem.text.length > 0) autoHideErrorMessage.restart() + onTextChanged: if (mainItem.text.length > 0) + autoHideErrorMessage.restart() } diff --git a/Linphone/view/Control/Display/Text.qml b/Linphone/view/Control/Display/Text.qml index 4674088bd..a61cb664c 100644 --- a/Linphone/view/Control/Display/Text.qml +++ b/Linphone/view/Control/Display/Text.qml @@ -9,7 +9,7 @@ Quick.Text { width: txtMeter.advanceWidth property alias tooltip: tooltip property alias mouseArea: mouseArea - Quick.MouseArea { + Quick.MouseArea { id: mouseArea anchors.fill: parent acceptedButtons: Qt.NoButton @@ -23,15 +23,15 @@ Quick.Text { } font { family: DefaultStyle.defaultFont - pixelSize: Utils.getSizeWithScreenRatio(10) - weight: Typography.p1.weight + pixelSize: Utils.getSizeWithScreenRatio(10) + weight: Typography.p1.weight } color: DefaultStyle.main2_600 textFormat: Text.PlainText wrapMode: Quick.Text.Wrap elide: Quick.Text.ElideRight transformOrigin: Quick.Item.TopLeft - transform: Quick.Scale { + transform: Quick.Scale { yScale: scaleLettersFactor } diff --git a/Linphone/view/Control/Display/ToolTip.qml b/Linphone/view/Control/Display/ToolTip.qml index d0bafcbd4..cc926911a 100644 --- a/Linphone/view/Control/Display/ToolTip.qml +++ b/Linphone/view/Control/Display/ToolTip.qml @@ -11,7 +11,7 @@ Control.ToolTip { id: tooltipBackground opacity: 0.7 color: DefaultStyle.main2_200 - radius: Utils.getSizeWithScreenRatio(15) + radius: Utils.getSizeWithScreenRatio(15) } contentItem: Quick.Text { text: mainItem.text diff --git a/Linphone/view/Control/Display/UnreadNotification.qml b/Linphone/view/Control/Display/UnreadNotification.qml index a99c6ab0c..dcdbbc127 100644 --- a/Linphone/view/Control/Display/UnreadNotification.qml +++ b/Linphone/view/Control/Display/UnreadNotification.qml @@ -5,38 +5,38 @@ import QtQuick.Effects import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.Control { - id: mainItem - property int unread: 0 - width: Utils.getSizeWithScreenRatio(14) - height: Utils.getSizeWithScreenRatio(14) - visible: unread > 0 - background: Item { - anchors.fill: parent - Rectangle { - id: background - anchors.fill: parent - radius: width/2 - color: DefaultStyle.danger_500_main - } - MultiEffect { - id: shadow - anchors.fill: background - source: background - // Crash : https://bugreports.qt.io/browse/QTBUG-124730? - shadowEnabled: true - shadowColor: DefaultStyle.grey_1000 - shadowBlur: 1 - shadowOpacity: 0.15 - z: mainItem.z - 1 - } - } - contentItem: Text { - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - color: DefaultStyle.grey_0 - fontSizeMode: Text.Fit - font.pixelSize: Utils.getSizeWithScreenRatio(10) - text: mainItem.unread > 100 ? '99+' : mainItem.unread - } -} \ No newline at end of file + id: mainItem + property int unread: 0 + width: Utils.getSizeWithScreenRatio(14) + height: Utils.getSizeWithScreenRatio(14) + visible: unread > 0 + background: Item { + anchors.fill: parent + Rectangle { + id: background + anchors.fill: parent + radius: width / 2 + color: DefaultStyle.danger_500_main + } + MultiEffect { + id: shadow + anchors.fill: background + source: background + // Crash : https://bugreports.qt.io/browse/QTBUG-124730? + shadowEnabled: true + shadowColor: DefaultStyle.grey_1000 + shadowBlur: 1 + shadowOpacity: 0.15 + z: mainItem.z - 1 + } + } + contentItem: Text { + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + color: DefaultStyle.grey_0 + fontSizeMode: Text.Fit + font.pixelSize: Utils.getSizeWithScreenRatio(10) + text: mainItem.unread > 100 ? '99+' : mainItem.unread + } +} diff --git a/Linphone/view/Control/Form/Call/ChangeLayoutForm.qml b/Linphone/view/Control/Form/Call/ChangeLayoutForm.qml index d3c8887ea..049d4a570 100644 --- a/Linphone/view/Control/Form/Call/ChangeLayoutForm.qml +++ b/Linphone/view/Control/Form/Call/ChangeLayoutForm.qml @@ -13,11 +13,11 @@ FocusScope { ColumnLayout { anchors.fill: parent - anchors.topMargin: Utils.getSizeWithScreenRatio(16) - anchors.bottomMargin: Utils.getSizeWithScreenRatio(16) - anchors.leftMargin: Utils.getSizeWithScreenRatio(17) - anchors.rightMargin: Utils.getSizeWithScreenRatio(17) - spacing: Utils.getSizeWithScreenRatio(12) + 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 @@ -25,32 +25,40 @@ FocusScope { spacing: 0 Repeater { model: [ - {text: qsTr("conference_layout_grid"), imgUrl: AppIcons.layout}, - {text: qsTr("conference_layout_active_speaker"), imgUrl: AppIcons.pip}, - {text: qsTr("conference_layout_audio_only"), imgUrl: AppIcons.waveform} + { + text: qsTr("conference_layout_grid"), + imgUrl: AppIcons.layout + }, + { + text: qsTr("conference_layout_active_speaker"), + imgUrl: AppIcons.pip + }, + { + text: qsTr("conference_layout_audio_only"), + imgUrl: AppIcons.waveform + } ] RadioButton { id: radiobutton enabled: mainItem.call && !mainItem.call.core.paused checkOnClick: false color: DefaultStyle.main1_500_main - indicatorSize: Utils.getSizeWithScreenRatio(20) + indicatorSize: Utils.getSizeWithScreenRatio(20) leftPadding: indicator.width + spacing - 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 - : index == 1 - ? mainItem.conferenceLayout === LinphoneEnums.ConferenceLayout.ActiveSpeaker - : mainItem.conferenceLayout === LinphoneEnums.ConferenceLayout.AudioOnly + 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 : index == 1 + ? mainItem.conferenceLayout === LinphoneEnums.ConferenceLayout.ActiveSpeaker : mainItem.conferenceLayout + === LinphoneEnums.ConferenceLayout.AudioOnly onClicked: mainItem.changeLayoutRequested(index) contentItem: RowLayout { - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) EffectImage { id: radioButtonImg - Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) imageSource: modelData.imgUrl colorizationColor: DefaultStyle.main2_500_main } @@ -58,7 +66,7 @@ FocusScope { text: modelData.text color: DefaultStyle.main2_500_main verticalAlignment: Text.AlignVCenter - font.pixelSize: Utils.getSizeWithScreenRatio(14) + font.pixelSize: Utils.getSizeWithScreenRatio(14) Layout.fillWidth: true } } @@ -66,6 +74,8 @@ FocusScope { } } } - Item {Layout.fillHeight: true} + Item { + Layout.fillHeight: true + } } } diff --git a/Linphone/view/Control/Form/Login/LoginForm.qml b/Linphone/view/Control/Form/Login/LoginForm.qml index d4300a57b..6388dcd4b 100644 --- a/Linphone/view/Control/Form/Login/LoginForm.qml +++ b/Linphone/view/Control/Form/Login/LoginForm.qml @@ -3,24 +3,24 @@ import QtQuick.Layouts import QtQuick.Controls.Basic as Control import Linphone import ConstantsCpp 1.0 -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle ColumnLayout { id: mainItem - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) FormItemLayout { id: username - Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) - //: Nom d'utilisateur : username - label: qsTr("username") + Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) + //: Nom d'utilisateur : username + label: qsTr("username") mandatory: true enableErrorText: true contentItem: TextField { id: usernameEdit - Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) isError: username.errorTextVisible || (errorText.isVisible && text.length > 0) onAccepted: passwordEdit.forceActiveFocus() //: "%1 mandatory" @@ -31,15 +31,15 @@ ColumnLayout { Layout.preferredHeight: password.implicitHeight FormItemLayout { id: password - width: Utils.getSizeWithScreenRatio(346) - //: Mot de passe - label: qsTr("password") + width: Utils.getSizeWithScreenRatio(346) + //: Mot de passe + label: qsTr("password") mandatory: true enableErrorText: true contentItem: TextField { id: passwordEdit - Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) isError: password.errorTextVisible || (errorText.isVisible && text.length > 0) hidden: true onAccepted: connectionButton.trigger() @@ -52,32 +52,31 @@ ColumnLayout { target: LoginPageCpp function onErrorMessageChanged() { if (passwordEdit.text.length > 0 || usernameEdit.text.length > 0) - errorText.setText(LoginPageCpp.errorMessage) + errorText.setText(LoginPageCpp.errorMessage); } } } } - } RowLayout { - Layout.topMargin: Utils.getSizeWithScreenRatio(7) - spacing: Utils.getSizeWithScreenRatio(29) + Layout.topMargin: Utils.getSizeWithScreenRatio(7) + spacing: Utils.getSizeWithScreenRatio(29) BigButton { id: connectionButton style: ButtonStyle.main - Accessible.name: qsTr("assistant_account_login") + Accessible.name: qsTr("assistant_account_login") contentItem: StackLayout { id: connectionButtonContent currentIndex: 0 Text { - //: "Connexion" - text: qsTr("assistant_account_login") + //: "Connexion" + text: qsTr("assistant_account_login") horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font { - pixelSize: Typography.b1.pixelSize - weight: Typography.b1.weight + pixelSize: Typography.b1.pixelSize + weight: Typography.b1.weight } color: DefaultStyle.grey_0 } @@ -92,34 +91,34 @@ ColumnLayout { target: LoginPageCpp function onRegistrationStateChanged() { if (LoginPageCpp.registrationState != LinphoneEnums.RegistrationState.Progress) { - connectionButton.enabled = true - connectionButtonContent.currentIndex = 0 + connectionButton.enabled = true; + connectionButtonContent.currentIndex = 0; } } function onErrorMessageChanged() { - connectionButton.enabled = true - connectionButtonContent.currentIndex = 0 + connectionButton.enabled = true; + connectionButtonContent.currentIndex = 0; } } } function trigger() { - username.errorMessage = "" - password.errorMessage = "" - errorText.text = "" + username.errorMessage = ""; + password.errorMessage = ""; + errorText.text = ""; if (usernameEdit.text.length == 0 || passwordEdit.text.length == 0) { if (usernameEdit.text.length == 0) - //: "Veuillez saisir un nom d'utilisateur" - username.errorMessage = qsTr("assistant_account_login_missing_username") + //: "Veuillez saisir un nom d'utilisateur" + username.errorMessage = qsTr("assistant_account_login_missing_username"); if (passwordEdit.text.length == 0) - //: "Veuillez saisir un mot de passe" - password.errorMessage = qsTr("assistant_account_login_missing_password") - return + //: "Veuillez saisir un mot de passe" + password.errorMessage = qsTr("assistant_account_login_missing_password"); + return; } - LoginPageCpp.login(usernameEdit.text, passwordEdit.text) - connectionButton.enabled = false - connectionButtonContent.currentIndex = 1 + LoginPageCpp.login(usernameEdit.text, passwordEdit.text); + connectionButton.enabled = false; + connectionButtonContent.currentIndex = 1; } onPressed: connectionButton.trigger() @@ -127,11 +126,10 @@ ColumnLayout { SmallButton { id: forgottenButton style: ButtonStyle.noBackground - //: "Mot de passe oublié ?" - text: qsTr("assistant_forgotten_password") + //: "Mot de passe oublié ?" + text: qsTr("assistant_forgotten_password") underline: true onClicked: Qt.openUrlExternally(ConstantsCpp.PasswordRecoveryUrl) } - } } diff --git a/Linphone/view/Control/Form/Settings/EncryptionSettings.qml b/Linphone/view/Control/Form/Settings/EncryptionSettings.qml index 6a61a17cd..e0dfe34d3 100644 --- a/Linphone/view/Control/Form/Settings/EncryptionSettings.qml +++ b/Linphone/view/Control/Form/Settings/EncryptionSettings.qml @@ -3,104 +3,110 @@ import QtQuick.Controls.Basic as Control 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem - signal encryptionValidationRequested() + signal encryptionValidationRequested property var call RoundedPane { Layout.fillWidth: true - leftPadding: Utils.getSizeWithScreenRatio(16) - rightPadding: Utils.getSizeWithScreenRatio(16) - topPadding: Utils.getSizeWithScreenRatio(13) - bottomPadding: Utils.getSizeWithScreenRatio(13) + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(16) + topPadding: Utils.getSizeWithScreenRatio(13) + bottomPadding: Utils.getSizeWithScreenRatio(13) contentItem: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(12) + spacing: Utils.getSizeWithScreenRatio(12) Text { - //: "Encryption :" - text: qsTr("call_stats_media_encryption_title") + //: "Encryption :" + text: qsTr("call_stats_media_encryption_title") Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Typography.p2.weight + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Typography.p2.weight } } ColumnLayout { Layout.alignment: Qt.AlignHCenter - spacing: Utils.getSizeWithScreenRatio(7) + 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) + 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: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } ColumnLayout { visible: mainItem.call && mainItem.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp Text { - //: "Algorithme de chiffrement : %1" - text: qsTr("call_stats_zrtp_cipher_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.cipherAlgo) + //: "Algorithme de chiffrement : %1" + text: qsTr("call_stats_zrtp_cipher_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.cipherAlgo) Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { - //: "Algorithme d'accord de clé : %1" - text: qsTr("call_stats_zrtp_key_agreement_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.keyAgreementAlgo) + //: "Algorithme d'accord de clé : %1" + text: qsTr("call_stats_zrtp_key_agreement_algo").arg(mainItem.call + && mainItem.call.core.zrtpStats.keyAgreementAlgo) Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { - //: "Algorithme de hachage : %1" - text: qsTr("call_stats_zrtp_hash_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.hashAlgo) + //: "Algorithme de hachage : %1" + text: qsTr("call_stats_zrtp_hash_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.hashAlgo) Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { - //: "Algorithme d'authentification : %1" - text: qsTr("call_stats_zrtp_auth_tag_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.authenticationAlgo) + //: "Algorithme d'authentification : %1" + text: qsTr("call_stats_zrtp_auth_tag_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.authenticationAlgo) Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } Text { - //: "Algorithme SAS : %1" - text: qsTr("call_stats_zrtp_sas_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.sasAlgo) + //: "Algorithme SAS : %1" + text: qsTr("call_stats_zrtp_sas_algo").arg(mainItem.call && mainItem.call.core.zrtpStats.sasAlgo) Layout.alignment: Qt.AlignHCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(500) } } } } } } - Item{Layout.fillHeight: true} + Item { + Layout.fillHeight: true + } Button { - visible: mainItem.call && !mainItem.call.core.conference && mainItem.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp + visible: mainItem.call && !mainItem.call.core.conference && mainItem.call.core.encryption + === LinphoneEnums.MediaEncryption.Zrtp + Layout.fillWidth: true - //: "Validation chiffrement" - text: qsTr("call_zrtp_validation_button_label") + //: "Validation chiffrement" + text: qsTr("call_zrtp_validation_button_label") onClicked: mainItem.encryptionValidationRequested() - Layout.bottomMargin: Utils.getSizeWithScreenRatio(13) - Layout.leftMargin: Utils.getSizeWithScreenRatio(16) - Layout.rightMargin: Utils.getSizeWithScreenRatio(16) + 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/MultimediaSettings.qml b/Linphone/view/Control/Form/Settings/MultimediaSettings.qml index e81d9d2c5..cb1352236 100644 --- a/Linphone/view/Control/Form/Settings/MultimediaSettings.qml +++ b/Linphone/view/Control/Form/Settings/MultimediaSettings.qml @@ -3,7 +3,7 @@ import QtQuick.Controls.Basic as Control import QtQuick.Layouts import Linphone import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { id: mainItem @@ -14,35 +14,35 @@ ColumnLayout { property string microDevice: inputAudioDeviceCBox.currentText property bool ringerDevicesVisible: false property bool backgroundVisible: true - spacing: Utils.getSizeWithScreenRatio(40) + spacing: Utils.getSizeWithScreenRatio(40) RoundedPane { background.visible: mainItem.backgroundVisible Layout.alignment: Qt.AlignHCenter height: contentItem.implicitHeight + topPadding + bottomPadding Layout.fillWidth: true - topPadding: background.visible ? Utils.getSizeWithScreenRatio(25) : 0 - bottomPadding: background.visible ? Utils.getSizeWithScreenRatio(25) : 0 - leftPadding: background.visible ? Utils.getSizeWithScreenRatio(25) : 0 - rightPadding: background.visible ? Utils.getSizeWithScreenRatio(25) : 0 + topPadding: background.visible ? Utils.getSizeWithScreenRatio(25) : 0 + bottomPadding: background.visible ? Utils.getSizeWithScreenRatio(25) : 0 + leftPadding: background.visible ? Utils.getSizeWithScreenRatio(25) : 0 + rightPadding: background.visible ? Utils.getSizeWithScreenRatio(25) : 0 contentItem: ColumnLayout { spacing: mainItem.spacing ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(12) + spacing: Utils.getSizeWithScreenRatio(12) visible: mainItem.ringerDevicesVisible RowLayout { - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.bellRinger colorizationColor: DefaultStyle.main1_500_main - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - imageWidth: Utils.getSizeWithScreenRatio(24) - imageHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + imageWidth: Utils.getSizeWithScreenRatio(24) + imageHeight: Utils.getSizeWithScreenRatio(24) } Text { - //: Ringtone - Incoming calls - text: qsTr("multimedia_settings_ringer_title") + //: Ringtone - Incoming calls + text: qsTr("multimedia_settings_ringer_title") font: Typography.p2l color: DefaultStyle.main2_600 Layout.fillWidth: true @@ -50,7 +50,7 @@ ColumnLayout { } ComboSetting { Layout.fillWidth: true - Layout.topMargin: Utils.getSizeWithScreenRatio(12) + Layout.topMargin: Utils.getSizeWithScreenRatio(12) Layout.preferredWidth: parent.width entries: SettingsCpp.ringerDevices propertyName: "ringerDevice" @@ -64,20 +64,20 @@ ColumnLayout { } } ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(12) + spacing: Utils.getSizeWithScreenRatio(12) RowLayout { - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.speaker colorizationColor: DefaultStyle.main1_500_main - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - imageWidth: Utils.getSizeWithScreenRatio(24) - imageHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + imageWidth: Utils.getSizeWithScreenRatio(24) + imageHeight: Utils.getSizeWithScreenRatio(24) } Text { - //: "Haut-parleurs" - text: qsTr("multimedia_settings_speaker_title") + //: "Haut-parleurs" + text: qsTr("multimedia_settings_speaker_title") font: Typography.p2l Layout.fillWidth: true } @@ -86,7 +86,7 @@ ColumnLayout { id: outputAudioDeviceCBox Layout.fillWidth: true Layout.preferredWidth: parent.width - Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) entries: SettingsCpp.playbackDevices propertyName: "playbackDevice" propertyOwner: SettingsCpp @@ -95,7 +95,7 @@ ColumnLayout { enabled: mainItem.call target: outputAudioDeviceCBox function onCurrentValueChanged() { - SettingsCpp.lSetPlaybackDevice(outputAudioDeviceCBox.currentValue) + SettingsCpp.lSetPlaybackDevice(outputAudioDeviceCBox.currentValue); } } Accessible.name: qsTr("choose_something_accessible_name").arg(qsTr("multimedia_settings_speaker_title")) @@ -107,28 +107,30 @@ ColumnLayout { to: 1.0 value: SettingsCpp.playbackGain onMoved: { - if (mainItem.call) SettingsCpp.lSetPlaybackGain(value) - else SettingsCpp.playbackGain = value + if (mainItem.call) + SettingsCpp.lSetPlaybackGain(value); + else + SettingsCpp.playbackGain = value; } //: %1 volume Accessible.name: qsTr("device_volume_accessible_name").arg(qsTr("multimedia_settings_speaker_title")) } } ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(12) + spacing: Utils.getSizeWithScreenRatio(12) RowLayout { - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.microphone colorizationColor: DefaultStyle.main1_500_main - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - imageWidth: Utils.getSizeWithScreenRatio(24) - imageHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + imageWidth: Utils.getSizeWithScreenRatio(24) + imageHeight: Utils.getSizeWithScreenRatio(24) } Text { - //: "Microphone" - text: qsTr("multimedia_settings_microphone_title") + //: "Microphone" + text: qsTr("multimedia_settings_microphone_title") font: Typography.p2l Layout.fillWidth: true } @@ -137,7 +139,7 @@ ColumnLayout { id: inputAudioDeviceCBox Layout.fillWidth: true Layout.preferredWidth: parent.width - Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) entries: SettingsCpp.captureDevices propertyName: "captureDevice" propertyOwner: SettingsCpp @@ -146,7 +148,7 @@ ColumnLayout { enabled: mainItem.call target: inputAudioDeviceCBox function onCurrentValueChanged() { - SettingsCpp.lSetCaptureDevice(inputAudioDeviceCBox.currentValue) + SettingsCpp.lSetCaptureDevice(inputAudioDeviceCBox.currentValue); } } Accessible.name: qsTr("choose_something_accessible_name").arg(qsTr("multimedia_settings_microphone_title")) @@ -158,8 +160,10 @@ ColumnLayout { to: 1.0 value: SettingsCpp.captureGain onMoved: { - if (mainItem.call) SettingsCpp.lSetCaptureGain(value) - else SettingsCpp.captureGain = value + if (mainItem.call) + SettingsCpp.lSetCaptureGain(value); + else + SettingsCpp.captureGain = value; } //: %1 volume Accessible.name: qsTr("device_volume_accessible_name").arg(qsTr("multimedia_settings_microphone_title")) @@ -170,23 +174,23 @@ ColumnLayout { repeat: true running: false onTriggered: { - SettingsCpp.updateMicVolume() + SettingsCpp.updateMicVolume(); } } Slider { id: audioTestSlider Layout.fillWidth: true enabled: false - Layout.preferredHeight: Utils.getSizeWithScreenRatio(10) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(10) background: Rectangle { x: audioTestSlider.leftPadding y: audioTestSlider.topPadding + audioTestSlider.availableHeight / 2 - height / 2 - implicitWidth: Utils.getSizeWithScreenRatio(200) - implicitHeight: Utils.getSizeWithScreenRatio(10) + implicitWidth: Utils.getSizeWithScreenRatio(200) + implicitHeight: Utils.getSizeWithScreenRatio(10) width: audioTestSlider.availableWidth height: implicitHeight - radius: Utils.getSizeWithScreenRatio(2) + radius: Utils.getSizeWithScreenRatio(2) color: DefaultStyle.grey_850 Rectangle { @@ -194,40 +198,48 @@ ColumnLayout { height: parent.height gradient: Gradient { orientation: Gradient.Horizontal - GradientStop { position: 0.0; color: DefaultStyle.vue_meter_light_green } - GradientStop { position: 1.0; color: DefaultStyle.vue_meter_dark_green} + GradientStop { + position: 0.0 + color: DefaultStyle.vue_meter_light_green + } + GradientStop { + position: 1.0 + color: DefaultStyle.vue_meter_dark_green + } } - radius: Utils.getSizeWithScreenRatio(2) + radius: Utils.getSizeWithScreenRatio(2) } } - handle: Item {visible: false} + handle: Item { + visible: false + } } } - ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(12) - visible: SettingsCpp.videoEnabled - RowLayout { - spacing: Utils.getSizeWithScreenRatio(8) - EffectImage { - imageSource: AppIcons.videoCamera - colorizationColor: DefaultStyle.main1_500_main - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - imageWidth: Utils.getSizeWithScreenRatio(24) - imageHeight: Utils.getSizeWithScreenRatio(24) - } - Text { - //: "Caméra" - text: qsTr("multimedia_settings_camera_title") - font: Typography.p2l - Layout.fillWidth: true - } - } + ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(12) + visible: SettingsCpp.videoEnabled + RowLayout { + spacing: Utils.getSizeWithScreenRatio(8) + EffectImage { + imageSource: AppIcons.videoCamera + colorizationColor: DefaultStyle.main1_500_main + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + imageWidth: Utils.getSizeWithScreenRatio(24) + imageHeight: Utils.getSizeWithScreenRatio(24) + } + Text { + //: "Caméra" + text: qsTr("multimedia_settings_camera_title") + font: Typography.p2l + Layout.fillWidth: true + } + } ComboSetting { id: videoDevicesCbox Layout.fillWidth: true Layout.preferredWidth: parent.width - Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) entries: SettingsCpp.videoDevices propertyName: "videoDevice" propertyOwner: SettingsCpp @@ -235,7 +247,7 @@ ColumnLayout { enabled: mainItem.call target: videoDevicesCbox function onCurrentValueChanged() { - SettingsCpp.lSetVideoDevice(videoDevicesCbox.currentValue) + SettingsCpp.lSetVideoDevice(videoDevicesCbox.currentValue); } } Accessible.name: qsTr("choose_something_accessible_name").arg(qsTr("multimedia_settings_camera_title")) @@ -243,17 +255,17 @@ ColumnLayout { } Connections { target: SettingsCpp - onMicVolumeChanged: (value) => { - audioTestSlider.value = value - } + onMicVolumeChanged: value => { + audioTestSlider.value = value; + } } Component.onCompleted: { - SettingsCpp.accessCallSettings() - audioTestSliderTimer.running = true + SettingsCpp.accessCallSettings(); + audioTestSliderTimer.running = true; } Component.onDestruction: { - audioTestSliderTimer.running = false - SettingsCpp.closeCallSettings() + audioTestSliderTimer.running = false; + SettingsCpp.closeCallSettings(); } } } diff --git a/Linphone/view/Control/Form/Settings/ScreencastSettings.qml b/Linphone/view/Control/Form/Settings/ScreencastSettings.qml index 340c834dd..e4e8ee013 100644 --- a/Linphone/view/Control/Form/Settings/ScreencastSettings.qml +++ b/Linphone/view/Control/Form/Settings/ScreencastSettings.qml @@ -4,7 +4,7 @@ import QtQuick.Effects 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ColumnLayout { @@ -12,88 +12,91 @@ ColumnLayout { property CallGui call property ConferenceGui conference: call.core.conference property var desc: call.core.videoSourceDescriptor - property bool isLocalScreenSharing : conference?.core.isLocalScreenSharing || false + property bool isLocalScreenSharing: conference?.core.isLocalScreenSharing || false property bool screenSharingAvailable: !!conference && (!conference.core.isScreenSharingEnabled || isLocalScreenSharing) - spacing: Utils.getSizeWithScreenRatio(12) + spacing: Utils.getSizeWithScreenRatio(12) - onIsLocalScreenSharingChanged: {if(isLocalScreenSharing) mainItem.call.core.videoSourceDescriptor = mainItem.desc } + 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: Utils.getSizeWithScreenRatio(14) + //: "Veuillez choisir l’écran ou la fenêtre que vous souihaitez partager au autres participants" + text: qsTr("screencast_settings_choose_window_text") + font.pixelSize: Utils.getSizeWithScreenRatio(14) color: DefaultStyle.main2_500_main } TabBar { - Layout.fillWidth: true id: bar - spacing: Utils.getSizeWithScreenRatio(40) - pixelSize: Utils.getSizeWithScreenRatio(16) - //: "Ecran entier" - model: [qsTr("screencast_settings_all_screen_label"), - //: "Fenêtre" - qsTr("screencast_settings_one_window_label")] + Layout.fillWidth: true + spacing: Utils.getSizeWithScreenRatio(40) + pixelSize: Utils.getSizeWithScreenRatio(16) + //: "Ecran entier" + model: [qsTr("screencast_settings_all_screen_label"), + //: "Fenêtre" + qsTr("screencast_settings_one_window_label")] } component ScreenPreviewLayout: Control.Control { id: screenPreview - signal clicked() + signal clicked property var screenSource property int screenIndex property bool selected: false - property bool displayScreen: true - property real horizontalMargin: 0 - leftPadding: Utils.getSizeWithScreenRatio(18) - rightPadding: Utils.getSizeWithScreenRatio(18) - topPadding: Utils.getSizeWithScreenRatio(13) - bottomPadding: Utils.getSizeWithScreenRatio(13) + property bool displayScreen: true + property real horizontalMargin: 0 + 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: Utils.getSizeWithScreenRatio(2) + border.width: Utils.getSizeWithScreenRatio(2) border.color: screenPreview.selected ? DefaultStyle.main2_400 : DefaultStyle.main2_200 - radius: Utils.getSizeWithScreenRatio(10) + radius: Utils.getSizeWithScreenRatio(10) MouseArea { anchors.fill: parent onClicked: { - screenPreview.clicked() + screenPreview.clicked(); } } } contentItem: ColumnLayout { spacing: 0 - Item{ + Item { Layout.fillWidth: true Layout.fillHeight: true Image { anchors.centerIn: parent - //Layout.preferredHeight: Utils.getSizeWithScreenRatio(170) - source: $modelData?.windowId ? "image://window/"+ $modelData.windowId : "image://screen/"+ $modelData.screenIndex + //Layout.preferredHeight: Utils.getSizeWithScreenRatio(170) + source: $modelData?.windowId ? "image://window/" + $modelData.windowId : "image://screen/" + $modelData.screenIndex sourceSize.width: parent.width sourceSize.height: parent.height cache: false } } - RowLayout{ - Layout.topMargin: Utils.getSizeWithScreenRatio(6) - spacing: Utils.getSizeWithScreenRatio(5) - Image{ - Layout.preferredHeight: Utils.getSizeWithScreenRatio(15) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(15) + RowLayout { + Layout.topMargin: Utils.getSizeWithScreenRatio(6) + spacing: Utils.getSizeWithScreenRatio(5) + Image { + Layout.preferredHeight: Utils.getSizeWithScreenRatio(15) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(15) visible: !!$modelData?.windowId - source: visible ? "image://window_icon/"+ $modelData.windowId : '' + source: visible ? "image://window_icon/" + $modelData.windowId : '' sourceSize.width: width sourceSize.height: height cache: false } Text { Layout.fillWidth: true - //: "Ecran %1" - text: !!$modelData?.windowId ? $modelData.name : qsTr("screencast_settings_screen").arg(screenIndex+1) + //: "Ecran %1" + text: !!$modelData?.windowId ? $modelData.name : qsTr("screencast_settings_screen").arg(screenIndex + 1) horizontalAlignment: Text.AlignHCenter - font.pixelSize: Utils.getSizeWithScreenRatio(displayScreen ? 14 : 10) + font.pixelSize: Utils.getSizeWithScreenRatio(displayScreen ? 14 : 10) elide: Text.ElideRight maximumLineCount: 1 } @@ -103,52 +106,57 @@ ColumnLayout { StackLayout { id: stacklayout currentIndex: bar.currentIndex - ListView{ + ListView { id: screensLayout - spacing: Utils.getSizeWithScreenRatio(16) + spacing: Utils.getSizeWithScreenRatio(16) clip: true Layout.fillWidth: true height: visible ? contentHeight : 0 currentIndex: -1 - model: ScreenProxy{ + model: ScreenProxy { id: screensList mode: ScreenList.SCREENS } onVisibleChanged: { - if(visible) screensList.update() - else currentIndex = -1 + if (visible) + screensList.update(); + else + currentIndex = -1; } delegate: ScreenPreviewLayout { - horizontalMargin: Utils.getSizeWithScreenRatio(28 - 20 ) // 20 coming from CallsWindow panel + horizontalMargin: Utils.getSizeWithScreenRatio(28 - 20) // 20 coming from CallsWindow panel width: screensLayout.width height: Utils.getSizeWithScreenRatio(219) screenIndex: index - onClicked: {//screensLayout.selectedIndex = index - screensLayout.currentIndex = index - mainItem.desc.core.screenSharingIndex = index - if( mainItem.conference.core.isLocalScreenSharing) - mainItem.call.core.videoSourceDescriptor = mainItem.desc + onClicked: { + //screensLayout.selectedIndex = index + screensLayout.currentIndex = index; + mainItem.desc.core.screenSharingIndex = index; + if (mainItem.conference.core.isLocalScreenSharing) + mainItem.call.core.videoSourceDescriptor = mainItem.desc; } selected: mainItem.desc.core.screenSharingIndex === index } } - GridView{ + GridView { id: windowsLayout //property int selectedIndex Layout.preferredHeight: visible ? contentHeight : 0 Layout.fillWidth: true - model: ScreenProxy{ + model: ScreenProxy { id: windowsList mode: ScreenList.WINDOWS } currentIndex: -1 onVisibleChanged: { - if(visible) windowsList.update() - else currentIndex = -1 + if (visible) + windowsList.update(); + else + currentIndex = -1; } cellWidth: width / 2 - cellHeight: Utils.getSizeWithScreenRatio(112 + 15) + cellHeight: Utils.getSizeWithScreenRatio(112 + 15) clip: true delegate: Item { width: windowsLayout.cellWidth @@ -159,10 +167,10 @@ ColumnLayout { displayScreen: false screenIndex: index onClicked: { - windowsLayout.currentIndex = index - mainItem.desc.core.windowId = $modelData.windowId - if( mainItem.conference.core.isLocalScreenSharing) - mainItem.call.core.videoSourceDescriptor = mainItem.desc + windowsLayout.currentIndex = index; + mainItem.desc.core.windowId = $modelData.windowId; + if (mainItem.conference.core.isLocalScreenSharing) + mainItem.call.core.videoSourceDescriptor = mainItem.desc; } selected: mainItem.desc.core.windowId == $modelData.windowId } @@ -172,15 +180,15 @@ ColumnLayout { BigButton { Layout.preferredHeight: height height: implicitHeight - visible: mainItem.screenSharingAvailable$ + visible: mainItem.screenSharingAvailable$ enabled: mainItem.isLocalScreenSharing || windowsLayout.currentIndex !== -1 || screensLayout.currentIndex !== -1 - text: mainItem.conference && mainItem.conference.core.isLocalScreenSharing - //: "Stop - ? qsTr("stop") - //: "Partager" - : qsTr("share") + text: mainItem.conference && mainItem.conference.core.isLocalScreenSharing ? + //: "Stop + qsTr("stop") : + //: "Partager" + qsTr("share") onClicked: { - mainItem.conference.core.lToggleScreenSharing() + mainItem.conference.core.lToggleScreenSharing(); } style: ButtonStyle.main } diff --git a/Linphone/view/Control/Input/Calendar.qml b/Linphone/view/Control/Input/Calendar.qml index 6b0bc2d66..741240a81 100644 --- a/Linphone/view/Control/Input/Calendar.qml +++ b/Linphone/view/Control/Input/Calendar.qml @@ -6,7 +6,7 @@ import QtQuick.Effects 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ListView { @@ -32,24 +32,27 @@ ListView { from: new Date() to: UtilsCpp.addYears(new Date(), 5) } - - delegate: FocusScope{ + + delegate: FocusScope { width: mainItem.width height: mainItem.height property bool isCurrentIndex: index == mainItem.currentIndex - onIsCurrentIndexChanged: if( isCurrentIndex) monthGrid.forceActiveFocus() + onIsCurrentIndexChanged: if (isCurrentIndex) + monthGrid.forceActiveFocus() ColumnLayout { anchors.fill: parent property int currentMonth: model.month - spacing: Utils.getSizeWithScreenRatio(18) + spacing: Utils.getSizeWithScreenRatio(18) RowLayout { Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(38) + 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 + text: UtilsCpp.toDateMonthAndYearString(new Date(model.year, model.month, + 15))// 15 because of timezones that can change the date for localeString + font { - pixelSize: Typography.p2l.pixelSize - weight: Typography.p2l.weight + pixelSize: Typography.p2l.pixelSize + weight: Typography.p2l.weight capitalization: Font.Capitalize } } @@ -58,28 +61,30 @@ ListView { } Button { id: previousButton - Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) icon.width: width icon.height: height style: ButtonStyle.noBackground icon.source: AppIcons.leftArrow - onClicked: if (mainItem.currentIndex > 0) mainItem.currentIndex = mainItem.currentIndex - 1 + onClicked: if (mainItem.currentIndex > 0) + mainItem.currentIndex = mainItem.currentIndex - 1 } Button { id: nextButton - Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) icon.width: width icon.height: height style: ButtonStyle.noBackground icon.source: AppIcons.rightArrow - onClicked: if (mainItem.currentIndex < mainItem.count) mainItem.currentIndex = mainItem.currentIndex + 1 + onClicked: if (mainItem.currentIndex < mainItem.count) + mainItem.currentIndex = mainItem.currentIndex + 1 } } - + ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(12) + spacing: Utils.getSizeWithScreenRatio(12) Control.DayOfWeekRow { locale: monthGrid.locale Layout.column: 1 @@ -90,12 +95,12 @@ ListView { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } - + Control.MonthGrid { id: monthGrid Layout.fillWidth: true @@ -106,73 +111,71 @@ ListView { locale: Qt.locale(ConstantsCpp.DefaultLocale) delegate: FocusScope { id: focusDay - property bool isSelectedDay: mainItem.selectedDate ? UtilsCpp.datesAreEqual(mainItem.selectedDate, model.date) : false + property bool isSelectedDay: mainItem.selectedDate ? UtilsCpp.datesAreEqual(mainItem.selectedDate, model.date) : + false property var d: model.date objectName: 'focusDay' activeFocusOnTab: true focus: UtilsCpp.isCurrentMonth(model.date) && UtilsCpp.isCurrentDay(model.date) || index == 0 - Keys.onPressed: (event)=> { - if (event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { - monthGrid.clicked(model.date) - event.accepted = true; - }else if(event.key == Qt.Key_Left){ - var previous = nextItemInFocusChain(false) - if( previous.objectName != 'focusDay'){ - previousButton.clicked(undefined) - }else{ - if (UtilsCpp.daysOffset(new Date(), model.date) >= 0) previous.forceActiveFocus() - } - }else if(event.key == Qt.Key_Right){ - var next = nextItemInFocusChain() - if( next.objectName != 'focusDay'){ - nextButton.clicked(undefined) - } else { - next.forceActiveFocus() - } - } - } - - MouseArea{ + Keys.onPressed: event => { + if (event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { + monthGrid.clicked(model.date); + event.accepted = true; + } else if (event.key == Qt.Key_Left) { + var previous = nextItemInFocusChain(false); + if (previous.objectName != 'focusDay') { + previousButton.clicked(undefined); + } else { + if (UtilsCpp.daysOffset(new Date(), model.date) >= 0) + previous.forceActiveFocus(); + } + } else if (event.key == Qt.Key_Right) { + var next = nextItemInFocusChain(); + if (next.objectName != 'focusDay') { + nextButton.clicked(undefined); + } else { + next.forceActiveFocus(); + } + } + } + + MouseArea { id: hoveringArea anchors.fill: parent hoverEnabled: true cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor acceptedButtons: Qt.LeftButton // onEntered: focusDay.forceActiveFocus() - onPressed: (event) =>{ - focusDay.forceActiveFocus() - event.accepted = false - } + onPressed: event => { + focusDay.forceActiveFocus(); + event.accepted = false; + } } - + Rectangle { anchors.centerIn: parent - width: Utils.getSizeWithScreenRatio(30) - height: Utils.getSizeWithScreenRatio(30) - radius: Utils.getSizeWithScreenRatio(50) + 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 - } Text { anchors.centerIn: parent text: UtilsCpp.toDateDayString(model.date) - color: isSelectedDay - ? DefaultStyle.grey_0 - : UtilsCpp.isCurrentDay(model.date) - ? DefaultStyle.main1_500_main - : UtilsCpp.dateisInMonth(model.date, mainItem.currentMonth, mainItem.currentYear) - ? DefaultStyle.main2_700 - : DefaultStyle.main2_400 + color: isSelectedDay ? DefaultStyle.grey_0 : UtilsCpp.isCurrentDay(model.date) ? DefaultStyle.main1_500_main : UtilsCpp.dateisInMonth( + model.date, mainItem.currentMonth, mainItem.currentYear) ? DefaultStyle.main2_700 : + DefaultStyle.main2_400 font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } - onClicked: (date) => { - if (UtilsCpp.daysOffset(new Date(), date) >= 0) mainItem.selectedDate = date - } + onClicked: date => { + if (UtilsCpp.daysOffset(new Date(), date) >= 0) + mainItem.selectedDate = date; + } } } } diff --git a/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml b/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml index ff8bf46d6..ec103f2d2 100644 --- a/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml +++ b/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml @@ -5,51 +5,51 @@ 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 +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.Control { id: mainItem - + // property alias placeholderText: sendingTextArea.placeholderText property string text property var textArea property int selectedFilesCount: 0 // property alias cursorPosition: sendingTextArea.cursorPosition - + property bool dropEnabled: true - property bool isEphemeral : false + property bool isEphemeral: false property bool emojiVisible: false // disable record button if call ongoing property bool callOngoing: false property bool isEditing: false - property ChatGui chat + property ChatGui chat - signal focusTextArea() - - // --------------------------------------------------------------------------- - - signal dropped (var files) - signal validText (string text) - signal sendMessage() - signal emojiClicked() - signal composing() + signal focusTextArea // --------------------------------------------------------------------------- - - function _emitFiles (files) { + + signal dropped(var files) + signal validText(string text) + signal sendMessage + signal emojiClicked + signal composing + + // --------------------------------------------------------------------------- + + function _emitFiles(files) { // Filtering files, other urls are forbidden. files = files.reduce(function (files, file) { if (file.toString().startsWith("file:")) { - files.push(Utils.getSystemPathFromUri(file)) + files.push(Utils.getSystemPathFromUri(file)); } - - return files - }, []) + + return files; + }, []); if (files.length > 0) { - dropped(files) + dropped(files); } } @@ -65,7 +65,7 @@ Control.Control { rightPadding: Utils.getSizeWithScreenRatio(15) topPadding: Utils.getSizeWithScreenRatio(16) bottomPadding: Utils.getSizeWithScreenRatio(16) - + background: Rectangle { anchors.fill: parent color: DefaultStyle.grey_100 @@ -74,7 +74,7 @@ Control.Control { id: sendingAreaStackView initialItem: textAreaComp onHeightChanged: { - mainItem.height = height + mainItem.topPadding + mainItem.bottomPadding + mainItem.height = height + mainItem.topPadding + mainItem.bottomPadding; } Component { id: textAreaComp @@ -95,7 +95,7 @@ Control.Control { style: ButtonStyle.noBackground icon.source: AppIcons.paperclip onClicked: { - fileDialog.open() + fileDialog.open(); } } Control.Control { @@ -129,21 +129,23 @@ Control.Control { contentWidth: width onContentHeightChanged: { - if (sendingTextArea.contentHeight > mainItem.height - (mainItem.topPadding + mainItem.bottomPadding + sendingControl.topPadding + sendingControl.bottomPadding) - && sendingTextArea.contentHeight < Utils.getSizeWithScreenRatio(100)) { - mainItem.height = sendingTextArea.contentHeight + mainItem.topPadding + mainItem.bottomPadding + sendingControl.topPadding + sendingControl.bottomPadding + if (sendingTextArea.contentHeight > mainItem.height - (mainItem.topPadding + mainItem.bottomPadding + + sendingControl.topPadding + sendingControl.bottomPadding) && sendingTextArea.contentHeight + < Utils.getSizeWithScreenRatio(100)) { + mainItem.height = sendingTextArea.contentHeight + mainItem.topPadding + mainItem.bottomPadding + + sendingControl.topPadding + sendingControl.bottomPadding; } } function ensureVisible(r) { if (contentX >= r.x) contentX = r.x; - else if (contentX+width <= r.x+r.width) - contentX = r.x+r.width-width; + else if (contentX + width <= r.x + r.width) + contentX = r.x + r.width - width; if (contentY >= r.y) contentY = r.y; - else if (contentY+height <= r.y+r.height) - contentY = r.y+r.height-height; + else if (contentY + height <= r.y + r.height) + contentY = r.y + r.height - height; } TextArea { @@ -152,12 +154,12 @@ Control.Control { height: implicitHeight// sendingAreaFlickable.height textFormat: TextEdit.PlainText onTextChanged: { - mainItem.text = text + mainItem.text = text; } - + Component.onCompleted: { - mainItem.textArea = sendingTextArea - sendingTextArea.text = mainItem.text + mainItem.textArea = sendingTextArea; + sendingTextArea.text = mainItem.text; } //: Say something… : placeholder text for sending message text area placeholderText: qsTr("chat_view_send_area_placeholder_text") @@ -170,23 +172,23 @@ Control.Control { onCursorRectangleChanged: sendingAreaFlickable.ensureVisible(cursorRectangle) wrapMode: TextEdit.WordWrap KeyNavigation.tab: recordButton.visible ? recordButton : sendMessageButton - Keys.onPressed: (event) => { - if ((event.key == Qt.Key_Enter || event.key == Qt.Key_Return)) - if(!(event.modifiers & Qt.ShiftModifier)) { - mainItem.sendMessage() - event.accepted = true - } - } + Keys.onPressed: event => { + if ((event.key == Qt.Key_Enter || event.key == Qt.Key_Return)) + if (!(event.modifiers & Qt.ShiftModifier)) { + mainItem.sendMessage(); + event.accepted = true; + } + } Connections { target: mainItem function onTextChanged() { - sendingTextArea.text = mainItem.text + sendingTextArea.text = mainItem.text; } function onSendMessage() { - sendingTextArea.clear() + sendingTextArea.clear(); } function onFocusTextArea() { - sendingTextArea.forceActiveFocus() + sendingTextArea.forceActiveFocus(); } } } @@ -201,12 +203,13 @@ Control.Control { //: Cannot record a message while a call is ongoing ToolTip.text: qsTr("cannot_record_while_in_call_tooltip") enabled: !mainItem.callOngoing - visible: !mainItem.callOngoing && sendingTextArea.text.length === 0 && mainItem.selectedFilesCount === 0 && !mainItem.isEditing + visible: !mainItem.callOngoing && sendingTextArea.text.length === 0 && mainItem.selectedFilesCount === 0 && + !mainItem.isEditing style: ButtonStyle.noBackground hoverEnabled: true icon.source: AppIcons.microphone onClicked: { - sendingAreaStackView.push(voiceMessageRecordComp) + sendingAreaStackView.push(voiceMessageRecordComp); } } BigButton { @@ -216,7 +219,7 @@ Control.Control { style: ButtonStyle.noBackgroundOrange icon.source: mainItem.isEditing ? AppIcons.pencil : AppIcons.paperPlaneRight onClicked: { - mainItem.sendMessage() + mainItem.sendMessage(); } } } @@ -239,22 +242,23 @@ Control.Control { Layout.preferredWidth: width Layout.preferredHeight: height onClicked: { - if (voiceMessage.chatMessage) mainItem.chat.core.lDeleteMessage(voiceMessage.chatMessage) - sendingAreaStackView.pop() + if (voiceMessage.chatMessage) + mainItem.chat.core.lDeleteMessage(voiceMessage.chatMessage); + sendingAreaStackView.pop(); } } ChatAudioContent { id: voiceMessage onHeightChanged: { - sendingAreaStackView.height = height + sendingAreaStackView.height = height; } recording: true Layout.fillWidth: true Layout.preferredHeight: Utils.getSizeWithScreenRatio(48) chatMessageContentGui: chatMessage ? chatMessage.core.getVoiceRecordingContent() : null - onVoiceRecordingMessageCreationRequested: (recorderGui) => { - chatMessageObj = UtilsCpp.createVoiceRecordingMessage(recorderGui, mainItem.chat) - } + onVoiceRecordingMessageCreationRequested: recorderGui => { + chatMessageObj = UtilsCpp.createVoiceRecordingMessage(recorderGui, mainItem.chat); + } } BigButton { id: sendButton @@ -267,21 +271,20 @@ Control.Control { property bool sendVoiceRecordingOnCreated: false onClicked: { if (voiceMessage.chatMessage) { - voiceMessage.chatMessage.core.lSend() - sendingAreaStackView.pop() - } - else { - sendVoiceRecordingOnCreated = true - voiceMessage.stopRecording() + voiceMessage.chatMessage.core.lSend(); + sendingAreaStackView.pop(); + } else { + sendVoiceRecordingOnCreated = true; + voiceMessage.stopRecording(); } } Connections { target: voiceMessage function onChatMessageChanged() { if (sendButton.sendVoiceRecordingOnCreated) { - voiceMessage.chatMessage.core.lSend() - sendButton.sendVoiceRecordingOnCreated = false - sendingAreaStackView.pop() + voiceMessage.chatMessage.core.lSend(); + sendButton.sendVoiceRecordingOnCreated = false; + sendingAreaStackView.pop(); } } } @@ -316,21 +319,24 @@ Control.Control { } DropArea { anchors.fill: parent - keys: [ 'text/uri-list' ] + keys: ['text/uri-list'] visible: mainItem.dropEnabled - - onDropped: (drop) => { - state = '' - if (drop.hasUrls) { - _emitFiles(drop.urls) - } - } + + onDropped: drop => { + state = ''; + if (drop.hasUrls) { + _emitFiles(drop.urls); + } + } onEntered: state = 'hover' onExited: state = '' - + states: State { name: 'hover' - PropertyChanges { target: hoverContent; visible: true } + PropertyChanges { + target: hoverContent + visible: true + } } } } diff --git a/Linphone/view/Control/Input/DecoratedTextField.qml b/Linphone/view/Control/Input/DecoratedTextField.qml index ddb2945dd..15c5dc4c7 100644 --- a/Linphone/view/Control/Input/DecoratedTextField.qml +++ b/Linphone/view/Control/Input/DecoratedTextField.qml @@ -20,33 +20,34 @@ FormItemLayout { property bool canBeEmpty: true property bool toValidate: false property alias text: textField.text - + property var value: propertyOwnerGui ? propertyOwnerGui.core[propertyName] : propertyOwner[propertyName] function value() { - return propertyOwnerGui ? propertyOwnerGui.core[propertyName] : propertyOwner[propertyName] + return propertyOwnerGui ? propertyOwnerGui.core[propertyName] : propertyOwner[propertyName]; } - - property alias hidden: textField.hidden + + property alias hidden: textField.hidden property alias validator: textField.validator property alias customButtonIcon: textField.customButtonIcon - property alias customCallback: textField.customCallback - property alias customButtonAccessibleName: textField.customButtonAccessibleName + property alias customCallback: textField.customCallback + property alias customButtonAccessibleName: textField.customButtonAccessibleName - property var isValid: function(text) { - return true - } - - function empty() { - textField.text = "" + property var isValid: function (text) { + return true; } - + + function empty() { + textField.text = ""; + } + contentItem: TextField { id: textField - Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) placeholderText: useTitleAsPlaceHolder ? mainItem.title : mainItem.placeHolder - initialText: (mainItem.propertyOwnerGui ? mainItem.propertyOwnerGui.core[mainItem.propertyName] : mainItem.propertyOwner[mainItem.propertyName]) || '' + initialText: (mainItem.propertyOwnerGui ? mainItem.propertyOwnerGui.core[mainItem.propertyName] : + mainItem.propertyOwner[mainItem.propertyName]) || '' customWidth: mainItem.parent.width propertyName: mainItem.propertyName propertyOwner: mainItem.propertyOwner @@ -54,18 +55,18 @@ FormItemLayout { canBeEmpty: mainItem.canBeEmpty isValid: mainItem.isValid toValidate: mainItem.toValidate - onValidationChecked: (isValid) => { - if (isValid) return - if (!canBeEmpty && empty) { - //: "ne peut être vide" - mainItem.errorMessage = qsTr("textfield_error_message_cannot_be_empty") - } else { - //: "Format non reconnu" - mainItem.errorMessage = qsTr("textfield_error_message_unknown_format") - } - } + onValidationChecked: isValid => { + if (isValid) + return; + if (!canBeEmpty && empty) { + //: "ne peut être vide" + mainItem.errorMessage = qsTr("textfield_error_message_cannot_be_empty"); + } else { + //: "Format non reconnu" + mainItem.errorMessage = qsTr("textfield_error_message_unknown_format"); + } + } onTextChanged: mainItem.clearErrorText() Accessible.name: mainItem.title } } - diff --git a/Linphone/view/Control/Input/DigitInput.qml b/Linphone/view/Control/Input/DigitInput.qml index 93e583c5b..6efa1895a 100644 --- a/Linphone/view/Control/Input/DigitInput.qml +++ b/Linphone/view/Control/Input/DigitInput.qml @@ -5,10 +5,13 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Control.TextField { id: mainItem - property real inputSize: Utils.getSizeWithScreenRatio(100) + property real inputSize: Utils.getSizeWithScreenRatio(100) property bool isError: false color: activeFocus ? DefaultStyle.main1_500_main : DefaultStyle.main2_500_main - validator: IntValidator{bottom: 0; top: 9} + validator: IntValidator { + bottom: 0 + top: 9 + } width: inputSize * 0.9 height: inputSize @@ -21,12 +24,12 @@ Control.TextField { placeholderTextColor: "transparent" // cursorVisible is overwritten on focus change so useless to hide the cursor - cursorDelegate: Item{} + cursorDelegate: Item {} // horizontalAlignment: Control.TextField.AlignHCenter font.family: DefaultStyle.defaultFont font.pixelSize: inputSize / 2 - font.weight: Utils.getSizeWithScreenRatio(300) + font.weight: Utils.getSizeWithScreenRatio(300) background: Item { anchors.fill: parent @@ -34,12 +37,9 @@ Control.TextField { // height: mainItem.inputSize Rectangle { id: background - border.width: Utils.getSizeWithScreenRatio(1) - border.color: mainItem.isError - ? DefaultStyle.danger_500_main - : mainItem.activeFocus - ? DefaultStyle.main1_500_main - : DefaultStyle.main2_500_main + border.width: Utils.getSizeWithScreenRatio(1) + border.color: mainItem.isError ? DefaultStyle.danger_500_main : mainItem.activeFocus ? DefaultStyle.main1_500_main : + DefaultStyle.main2_500_main radius: mainItem.inputSize * 0.15 width: mainItem.inputSize * 0.9 height: mainItem.inputSize @@ -48,11 +48,11 @@ Control.TextField { id: indicator visible: mainItem.activeFocus color: DefaultStyle.main1_500_main - height : Utils.getSizeWithScreenRatio(1) + height: Utils.getSizeWithScreenRatio(1) width: mainItem.inputSize * 0.67 anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom - anchors.bottomMargin: Utils.getSizeWithScreenRatio(mainItem.inputSize / 8) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(mainItem.inputSize / 8) } } } diff --git a/Linphone/view/Control/Input/NumericPad.qml b/Linphone/view/Control/Input/NumericPad.qml index c5fb1b5dc..1da1d2b8a 100644 --- a/Linphone/view/Control/Input/NumericPad.qml +++ b/Linphone/view/Control/Input/NumericPad.qml @@ -4,7 +4,7 @@ import QtQuick.Layouts as Layout import QtQuick.Effects import Linphone import UtilsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 { @@ -15,19 +15,21 @@ FocusScope { property var currentCall property bool lastRowVisible: true - onButtonPressed: (text) => { - if (currentCall) currentCall.core.lSendDtmf(text) - else UtilsCpp.playDtmf(text) - } + onButtonPressed: text => { + if (currentCall) + currentCall.core.lSendDtmf(text); + else + UtilsCpp.playDtmf(text); + } signal buttonPressed(string text) - signal launchCall() - signal wipe() + signal launchCall + signal wipe function keypadKeyPressedAtIndex(index) { - var button = numPadGrid.getButtonAt(index) - button.shadowEnabled = true - button.clicked() - removeButtonsShadow.restart() + var button = numPadGrid.getButtonAt(index); + button.shadowEnabled = true; + button.clicked(); + removeButtonsShadow.restart(); } Timer { @@ -36,93 +38,93 @@ FocusScope { repeat: false onTriggered: { for (var i = 0; i < 12; i++) { - numPadGrid.getButtonAt(i).shadowEnabled = false + numPadGrid.getButtonAt(i).shadowEnabled = false; } } } function handleKeyPadEvent(event) { if (event.key === Qt.Key_0) { - keypadKeyPressedAtIndex(10) - event.accepted = true + keypadKeyPressedAtIndex(10); + event.accepted = true; } if (event.key === Qt.Key_1) { - keypadKeyPressedAtIndex(0) - event.accepted = true + keypadKeyPressedAtIndex(0); + event.accepted = true; } if (event.key === Qt.Key_2) { - keypadKeyPressedAtIndex(1) - event.accepted = true + keypadKeyPressedAtIndex(1); + event.accepted = true; } if (event.key === Qt.Key_3) { - keypadKeyPressedAtIndex(2) - event.accepted = true + keypadKeyPressedAtIndex(2); + event.accepted = true; } if (event.key === Qt.Key_4) { - keypadKeyPressedAtIndex(3) - event.accepted = true + keypadKeyPressedAtIndex(3); + event.accepted = true; } if (event.key === Qt.Key_5) { - keypadKeyPressedAtIndex(4) - event.accepted = true + keypadKeyPressedAtIndex(4); + event.accepted = true; } if (event.key === Qt.Key_6) { - keypadKeyPressedAtIndex(5) - event.accepted = true + keypadKeyPressedAtIndex(5); + event.accepted = true; } if (event.key === Qt.Key_7) { - keypadKeyPressedAtIndex(6) - event.accepted = true + keypadKeyPressedAtIndex(6); + event.accepted = true; } if (event.key === Qt.Key_8) { - keypadKeyPressedAtIndex(7) - event.accepted = true + keypadKeyPressedAtIndex(7); + event.accepted = true; } if (event.key === Qt.Key_9) { - keypadKeyPressedAtIndex(8) - event.accepted = true + keypadKeyPressedAtIndex(8); + event.accepted = true; } if (event.key === Qt.Key_Asterisk) { - keypadKeyPressedAtIndex(9) - event.accepted = true + keypadKeyPressedAtIndex(9); + event.accepted = true; } if (event.key === Qt.Key_Plus) { - mainItem.buttonPressed("+") - event.accepted = true + mainItem.buttonPressed("+"); + event.accepted = true; } if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { - mainItem.launchCall() - event.accepted = true + mainItem.launchCall(); + event.accepted = true; } } - Keys.onPressed: (event) => { - event.accepted = false - if (event.modifiers & Qt.KeypadModifier || event.key === Qt.Key_Return) { - handleKeyPadEvent(event) - } - if (event.key === Qt.Key_Backspace) { - mainItem.wipe() - event.accepted = true - } - } + Keys.onPressed: event => { + event.accepted = false; + if (event.modifiers & Qt.KeypadModifier || event.key === Qt.Key_Return) { + handleKeyPadEvent(event); + } + if (event.key === Qt.Key_Backspace) { + mainItem.wipe(); + event.accepted = true; + } + } Layout.GridLayout { id: numPadGrid columns: 3 - columnSpacing: Utils.getSizeWithScreenRatio(40) - rowSpacing: Utils.getSizeWithScreenRatio(10) - function getButtonAt(index){ - index = (index+15) % 15 - if(index >= 0){ - if( index < 9){ - return numPadRepeater.itemAt(index) - }else if( index < 12){ - return digitRepeater.itemAt(index-9) - }else if (index < 14){ - return launchCallButton - }else if( index < 15){ - return eraseButton + columnSpacing: Utils.getSizeWithScreenRatio(40) + rowSpacing: Utils.getSizeWithScreenRatio(10) + function getButtonAt(index) { + index = (index + 15) % 15; + if (index >= 0) { + if (index < 9) { + return numPadRepeater.itemAt(index); + } else if (index < 12) { + return digitRepeater.itemAt(index - 9); + } else if (index < 14) { + return launchCallButton; + } else if (index < 15) { + return eraseButton; } } } @@ -133,47 +135,55 @@ FocusScope { id: numPadButton Layout.Layout.alignment: Qt.AlignHCenter required property int index - implicitWidth: Utils.getSizeWithScreenRatio(60) - implicitHeight: Utils.getSizeWithScreenRatio(60) + implicitWidth: Utils.getSizeWithScreenRatio(60) + implicitHeight: Utils.getSizeWithScreenRatio(60) onClicked: { - mainItem.buttonPressed(text) + mainItem.buttonPressed(text); } KeyNavigation.left: numPadGrid.getButtonAt(index - 1) KeyNavigation.right: numPadGrid.getButtonAt(index + 1) KeyNavigation.up: numPadGrid.getButtonAt(index - 3) KeyNavigation.down: numPadGrid.getButtonAt(index + 3) style: ButtonStyle.numericPad - radius: Utils.getSizeWithScreenRatio(71) + radius: Utils.getSizeWithScreenRatio(71) text: index + 1 - textSize: Utils.getSizeWithScreenRatio(32) - textWeight: Utils.getSizeWithScreenRatio(400) + textSize: Utils.getSizeWithScreenRatio(32) + textWeight: Utils.getSizeWithScreenRatio(400) } } Repeater { id: digitRepeater model: [ - {pressText: "*"}, - {pressText: "0", longPressText: "+"}, - {pressText: "#"} + { + pressText: "*" + }, + { + pressText: "0", + longPressText: "+" + }, + { + pressText: "#" + } ] BigButton { id: digitButton Layout.Layout.alignment: Qt.AlignHCenter - implicitWidth: Utils.getSizeWithScreenRatio(60) - implicitHeight: Utils.getSizeWithScreenRatio(60) - + implicitWidth: Utils.getSizeWithScreenRatio(60) + implicitHeight: Utils.getSizeWithScreenRatio(60) + onClicked: mainItem.buttonPressed(pressText.text) onPressAndHold: mainItem.buttonPressed(longPressText.text) - - KeyNavigation.left: numPadGrid.getButtonAt((index - 1)+9) - KeyNavigation.right: numPadGrid.getButtonAt((index + 1)+9) - KeyNavigation.up: numPadGrid.getButtonAt((index - 3)+9) - KeyNavigation.down: numPadGrid.getButtonAt((index + 3)+9) - radius: Utils.getSizeWithScreenRatio(71) + + KeyNavigation.left: numPadGrid.getButtonAt((index - 1) + 9) + KeyNavigation.right: numPadGrid.getButtonAt((index + 1) + 9) + KeyNavigation.up: numPadGrid.getButtonAt((index - 3) + 9) + KeyNavigation.down: numPadGrid.getButtonAt((index + 3) + 9) + radius: Utils.getSizeWithScreenRatio(71) style: ButtonStyle.numericPad //: %1 longpress %2 - Accessible.name: longPressText.text ? qsTr("numpad_longpress_accessible_name").arg(pressText.text).arg(longPressText.text) : pressText.text + Accessible.name: longPressText.text ? qsTr("numpad_longpress_accessible_name").arg(pressText.text).arg( + longPressText.text) : pressText.text contentItem: Item { anchors.fill: parent @@ -184,9 +194,12 @@ FocusScope { anchors.left: parent.left anchors.right: parent.right horizontalAlignment: Text.AlignHCenter - Component.onCompleted: {if (modelData.longPressText === undefined) anchors.centerIn= parent} + Component.onCompleted: { + if (modelData.longPressText === undefined) + anchors.centerIn = parent; + } text: modelData.pressText - font.pixelSize: Utils.getSizeWithScreenRatio(32) + font.pixelSize: Utils.getSizeWithScreenRatio(32) } Text { id: longPressText @@ -194,11 +207,11 @@ FocusScope { anchors.left: parent.left anchors.right: parent.right color: digitButton.pressed ? digitButton.pressedTextColor : digitButton.textColor - y: digitButton.height/2 + y: digitButton.height / 2 horizontalAlignment: Text.AlignHCenter visible: modelData.longPressText ? modelData.longPressText.length > 0 : false text: modelData.longPressText ? modelData.longPressText : "" - font.pixelSize: Utils.getSizeWithScreenRatio(22) + font.pixelSize: Utils.getSizeWithScreenRatio(22) } } } @@ -210,19 +223,19 @@ FocusScope { Button { id: launchCallButton visible: mainItem.lastRowVisible - implicitWidth: Utils.getSizeWithScreenRatio(75) - implicitHeight: Utils.getSizeWithScreenRatio(55) + implicitWidth: Utils.getSizeWithScreenRatio(75) + implicitHeight: Utils.getSizeWithScreenRatio(55) Layout.Layout.alignment: Qt.AlignHCenter - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - radius: Utils.getSizeWithScreenRatio(71) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + radius: Utils.getSizeWithScreenRatio(71) style: ButtonStyle.phoneGreen - //: Call + //: Call Accessible.name: qsTr("call_accessible_name") onClicked: mainItem.launchCall() - + KeyNavigation.left: eraseButton KeyNavigation.right: eraseButton KeyNavigation.up: numPadGrid.getButtonAt(10) @@ -231,35 +244,35 @@ FocusScope { Button { id: eraseButton visible: mainItem.lastRowVisible - leftPadding: Utils.getSizeWithScreenRatio(5) - rightPadding: Utils.getSizeWithScreenRatio(5) - topPadding: Utils.getSizeWithScreenRatio(5) - bottomPadding: Utils.getSizeWithScreenRatio(5) + 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: Utils.getSizeWithScreenRatio(38) - icon.height: Utils.getSizeWithScreenRatio(38) - Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(38) - Layout.Layout.preferredHeight: Utils.getSizeWithScreenRatio(38) - + icon.width: Utils.getSizeWithScreenRatio(38) + icon.height: Utils.getSizeWithScreenRatio(38) + Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(38) + Layout.Layout.preferredHeight: Utils.getSizeWithScreenRatio(38) + //: Erase Accessible.name: qsTr("erase_accessible_name") onClicked: mainItem.wipe() - + KeyNavigation.left: launchCallButton KeyNavigation.right: launchCallButton KeyNavigation.up: numPadGrid.getButtonAt(11) KeyNavigation.down: numPadGrid.getButtonAt(1) - + background: Rectangle { width: eraseButton.width height: eraseButton.height - color: "transparent" + color: "transparent" border.color: eraseButton.keyboardFocus ? eraseButton.keyboardFocusedBorderColor : "transparent" - border.width: eraseButton.keyboardFocus ? eraseButton.keyboardFocusedBorderWidth : eraseButton.borderWidth + border.width: eraseButton.keyboardFocus ? eraseButton.keyboardFocusedBorderWidth : eraseButton.borderWidth } } } diff --git a/Linphone/view/Control/Input/PhoneNumberInput.qml b/Linphone/view/Control/Input/PhoneNumberInput.qml index 72be8086e..76e576214 100644 --- a/Linphone/view/Control/Input/PhoneNumberInput.qml +++ b/Linphone/view/Control/Input/PhoneNumberInput.qml @@ -10,10 +10,10 @@ ColumnLayout { property string label: "" property alias errorMessage: errorText.text - property string placeholderText : "" + property string placeholderText: "" property bool mandatory: false property bool enableErrorText: true - property real textInputWidth: width + property real textInputWidth: width property string initialPhoneNumber readonly property string phoneNumber: textField.text readonly property string countryCode: combobox.text @@ -31,8 +31,8 @@ ColumnLayout { text: mainItem.label + (mainItem.mandatory ? "*" : "") color: (combobox.activeFocus || textField.activeFocus) ? DefaultStyle.main1_500_main : DefaultStyle.main2_600 font { - pixelSize: Typography.p2.pixelSize - weight: Typography.p2.weight + pixelSize: Typography.p2.pixelSize + weight: Typography.p2.weight } } @@ -42,14 +42,11 @@ ColumnLayout { background: Rectangle { id: contentBackground anchors.fill: parent - radius: Utils.getSizeWithScreenRatio(63) + radius: Utils.getSizeWithScreenRatio(63) color: DefaultStyle.grey_100 - border.color: mainItem.errorMessage.length > 0 - ? DefaultStyle.danger_500_main - : (textField.activeFocus || combobox.activeFocus) - ? DefaultStyle.main1_500_main - : DefaultStyle.grey_200 - border.width: mainItem.borderWidth + border.color: mainItem.errorMessage.length > 0 ? DefaultStyle.danger_500_main : (textField.activeFocus + || combobox.activeFocus) ? DefaultStyle.main1_500_main : DefaultStyle.grey_200 + border.width: mainItem.borderWidth } contentItem: RowLayout { CountryIndicatorCombobox { @@ -74,13 +71,15 @@ ColumnLayout { placeholderText: mainItem.placeholderText background: Rectangle { visible: textField.keyboardFocus - radius: Utils.getSizeWithScreenRatio(63) + radius: Utils.getSizeWithScreenRatio(63) color: "transparent" border.color: mainItem.keyboardFocusedBorderColor - border.width: mainItem.keyboardFocusedBorderWidth + border.width: mainItem.keyboardFocusedBorderWidth } initialText: initialPhoneNumber - validator: RegularExpressionValidator{ regularExpression: /[0-9]+/} + validator: RegularExpressionValidator { + regularExpression: /[0-9]+/ + } //: %1 number Accessible.name: qsTr("number_phone_number_accessible_name").arg(mainItem.Accessible.name) } diff --git a/Linphone/view/Control/Input/SearchBar.qml b/Linphone/view/Control/Input/SearchBar.qml index 7a923c294..b220ff9ac 100644 --- a/Linphone/view/Control/Input/SearchBar.qml +++ b/Linphone/view/Control/Input/SearchBar.qml @@ -3,20 +3,20 @@ 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 -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle FocusScope { id: mainItem property bool magnifierVisible: true - property var validator: RegularExpressionValidator{} + property var validator: RegularExpressionValidator {} property var numericPadPopup property alias numericPadButton: dialerButton readonly property bool hasActiveFocus: textField.activeFocus property alias color: backgroundItem.color property bool delaySearch: true // Wait some idle time after typing to start searching property bool handleNumericPadPopupButtonsPressed: true - // Border properties + // Border properties property color borderColor: "transparent" property color focusedBorderColor: DefaultStyle.main2_500_main property color keyboardFocusedBorderColor: DefaultStyle.main2_900 @@ -24,35 +24,37 @@ FocusScope { property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3) // Text properties property string placeholderText: "" - property color placeholderTextColor: DefaultStyle.main2_400 - property real textInputWidth: Utils.getSizeWithScreenRatio(350) + property color placeholderTextColor: DefaultStyle.main2_400 + property real textInputWidth: Utils.getSizeWithScreenRatio(350) property string text: textField.searchText - - signal openNumericPadRequested()// Useful for redirection before displaying numeric pad. - + + signal openNumericPadRequested// Useful for redirection before displaying numeric pad. + function clearText() { - textField.text = "" + textField.text = ""; } Connections { enabled: numericPadPopup != undefined && handleNumericPadPopupButtonsPressed target: numericPadPopup ? numericPadPopup : null function onButtonPressed(text) { - textField.text += text + textField.text += text; + } + function onWipe() { + textField.text = textField.text.slice(0, -1); } - function onWipe(){ textField.text = textField.text.slice(0, -1)} } - implicitWidth: mainItem.textInputWidth - implicitHeight: Utils.getSizeWithScreenRatio(50) - - Rectangle{ + implicitHeight: Utils.getSizeWithScreenRatio(50) + + Rectangle { id: backgroundItem anchors.fill: parent - radius: Utils.getSizeWithScreenRatio(28) + radius: Utils.getSizeWithScreenRatio(28) color: DefaultStyle.grey_100 - border.color: textField.keyboardFocus ? mainItem.keyboardFocusedBorderColor : textField.activeFocus ? mainItem.focusedBorderColor : mainItem.borderColor + border.color: textField.keyboardFocus ? mainItem.keyboardFocusedBorderColor : textField.activeFocus + ? mainItem.focusedBorderColor : mainItem.borderColor border.width: textField.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth } EffectImage { @@ -61,19 +63,19 @@ FocusScope { colorizationColor: DefaultStyle.main2_500_main anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: Utils.getSizeWithScreenRatio(10) + anchors.leftMargin: Utils.getSizeWithScreenRatio(10) imageSource: AppIcons.magnifier - width: Utils.getSizeWithScreenRatio(20) - height: Utils.getSizeWithScreenRatio(20) + 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 : Utils.getSizeWithScreenRatio(10) + anchors.leftMargin: magnifier.visible ? 0 : Utils.getSizeWithScreenRatio(10) anchors.right: clearTextButton.left anchors.verticalCenter: parent.verticalCenter property bool keyboardFocus: FocusHelper.keyboardFocus - + property string searchText focus: true @@ -82,8 +84,8 @@ FocusScope { width: mainItem.width - dialerButton.width echoMode: (mainItem.hidden && !dialerButton.checked) ? TextInput.Password : TextInput.Normal font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight family: DefaultStyle.defaultFont } color: DefaultStyle.main2_600 @@ -96,21 +98,22 @@ FocusScope { cursorDelegate: Rectangle { visible: textField.cursorVisible color: DefaultStyle.main2_500_main - width: Utils.getSizeWithScreenRatio(1) + width: Utils.getSizeWithScreenRatio(1) } - Timer{ + Timer { id: delayTimer interval: 300 repeat: false onTriggered: textField.searchText = textField.text } - Keys.onPressed: (event) => { - event.accepted = false - if (mainItem.numericPadPopup && mainItem.numericPadPopup.opened && (event.modifiers & Qt.KeypadModifier || event.key === Qt.Key_Return)) { - mainItem.numericPadPopup.keyPadKeyPressed(event) - event.accepted = true - } - } + Keys.onPressed: event => { + event.accepted = false; + if (mainItem.numericPadPopup && mainItem.numericPadPopup.opened && (event.modifiers & Qt.KeypadModifier + || event.key === Qt.Key_Return)) { + mainItem.numericPadPopup.keyPadKeyPressed(event); + event.accepted = true; + } + } } Button { id: dialerButton @@ -118,39 +121,40 @@ FocusScope { checked: numericPadPopup?.visible || false style: ButtonStyle.noBackground icon.source: AppIcons.dialer - contentImageColor: checked ? DefaultStyle.main1_500_main : DefaultStyle.main2_600 + contentImageColor: checked ? DefaultStyle.main1_500_main : DefaultStyle.main2_600 hoveredImageColor: contentImageColor - width: Utils.getSizeWithScreenRatio(30) - height: Utils.getSizeWithScreenRatio(30) + width: Utils.getSizeWithScreenRatio(30) + height: Utils.getSizeWithScreenRatio(30) icon.width: Utils.getSizeWithScreenRatio(24) icon.height: Utils.getSizeWithScreenRatio(24) - anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - anchors.rightMargin: Utils.getSizeWithScreenRatio(20) + anchors.rightMargin: Utils.getSizeWithScreenRatio(20) //: "Open dialer" Accessible.name: qsTr("open_dialer_acccessibility_label") onClicked: { - if(!checked){ - mainItem.openNumericPadRequested() - mainItem.numericPadPopup.open() - } else mainItem.numericPadPopup.close() + if (!checked) { + mainItem.openNumericPadRequested(); + mainItem.numericPadPopup.open(); + } else + mainItem.numericPadPopup.close(); } } Button { id: clearTextButton visible: textField.text.length > 0 && mainItem.enabled - width: Utils.getSizeWithScreenRatio(24) - height: Utils.getSizeWithScreenRatio(24) + 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: Utils.getSizeWithScreenRatio(20) + anchors.rightMargin: Utils.getSizeWithScreenRatio(20) //: "Clear text input" Accessible.name: qsTr("clear_text_input_acccessibility_label") onClicked: { - textField.clear() + textField.clear(); } } } diff --git a/Linphone/view/Control/Input/TextArea.qml b/Linphone/view/Control/Input/TextArea.qml index 19bde514f..81dba8bd8 100644 --- a/Linphone/view/Control/Input/TextArea.qml +++ b/Linphone/view/Control/Input/TextArea.qml @@ -7,33 +7,32 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils TextEdit { id: mainItem - + property string placeholderText - property real placeholderPixelSize: Typography.p1.pixelSize - property real placeholderWeight: Typography.p1.weight + property real placeholderPixelSize: Typography.p1.pixelSize + property real placeholderWeight: Typography.p1.weight property color placeholderTextColor: color property alias background: background.data property bool hoverEnabled: true property bool hovered: mouseArea.hoverEnabled && mouseArea.containsMouse - topPadding: Utils.getSizeWithScreenRatio(5) - bottomPadding: Utils.getSizeWithScreenRatio(5) + topPadding: Utils.getSizeWithScreenRatio(5) + bottomPadding: Utils.getSizeWithScreenRatio(5) activeFocusOnTab: true - KeyNavigation.priority: KeyNavigation.BeforeItem + KeyNavigation.priority: KeyNavigation.BeforeItem property bool displayAsRichText: false property var encodeTextObj: UtilsCpp.encodeTextToQmlRichFormat(text) property string richFormatText: encodeTextObj && encodeTextObj.value || "" property color textAreaColor - Component.onCompleted: { - mainItem.textAreaColor = mainItem.color // backup original color + mainItem.textAreaColor = mainItem.color; // backup original color if (displayAsRichText) - mainItem.color = 'transparent' + mainItem.color = 'transparent'; } onTextChanged: { - encodeTextObj = UtilsCpp.encodeTextToQmlRichFormat(text) + encodeTextObj = UtilsCpp.encodeTextToQmlRichFormat(text); } MouseArea { @@ -62,7 +61,7 @@ TextEdit { weight: mainItem.placeholderWeight } } - Text { + Text { id: formattedText visible: mainItem.displayAsRichText && mainItem.richFormatText !== "" text: mainItem.richFormatText @@ -75,13 +74,13 @@ TextEdit { anchors.fill: parent focus: false onHoveredLinkChanged: { - mainItem.hovered = mainItem.displayAsRichText && hoveredLink !== "" + mainItem.hovered = mainItem.displayAsRichText && hoveredLink !== ""; } onLinkActivated: { if (link.startsWith('sip')) - UtilsCpp.createCall(link) + UtilsCpp.createCall(link); else - Qt.openUrlExternally(link) + Qt.openUrlExternally(link); } - } + } } diff --git a/Linphone/view/Control/Input/TextField.qml b/Linphone/view/Control/Input/TextField.qml index ad4be16dc..b2a46bcef 100644 --- a/Linphone/view/Control/Input/TextField.qml +++ b/Linphone/view/Control/Input/TextField.qml @@ -3,232 +3,230 @@ 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 +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle Control.TextField { - id: mainItem - property var customWidth - width: Utils.getSizeWithScreenRatio(customWidth ? customWidth - 1 : 360) - height: Utils.getSizeWithScreenRatio(49) - leftPadding: Utils.getSizeWithScreenRatio(15) - rightPadding: eyeButton.visible - ? Utils.getSizeWithScreenRatio(5) + eyeButton.width + eyeButton.rightMargin - : Utils.getSizeWithScreenRatio(15) - echoMode: (hidden && !eyeButton.checked) ? TextInput.Password : TextInput.Normal + id: mainItem + property var customWidth + width: Utils.getSizeWithScreenRatio(customWidth ? customWidth - 1 : 360) + height: Utils.getSizeWithScreenRatio(49) + leftPadding: Utils.getSizeWithScreenRatio(15) + rightPadding: eyeButton.visible ? Utils.getSizeWithScreenRatio(5) + eyeButton.width + eyeButton.rightMargin : + Utils.getSizeWithScreenRatio(15) + echoMode: (hidden && !eyeButton.checked) ? TextInput.Password : TextInput.Normal - // Workaround for Windows slowness when first typing a password - // due to Qt not initializing the Password echo mode before the first letter is typed - Component.onCompleted: { - text = "workaround" - resetText() - } + // Workaround for Windows slowness when first typing a password + // due to Qt not initializing the Password echo mode before the first letter is typed + Component.onCompleted: { + text = "workaround"; + resetText(); + } - verticalAlignment: TextInput.AlignVCenter - color: isError ? DefaultStyle.danger_500_main : DefaultStyle.main2_600 - placeholderTextColor: DefaultStyle.placeholders - font { - family: DefaultStyle.defaultFont - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } - selectByMouse: true - activeFocusOnTab: true - KeyNavigation.right: eyeButton - text: initialText + verticalAlignment: TextInput.AlignVCenter + color: isError ? DefaultStyle.danger_500_main : DefaultStyle.main2_600 + placeholderTextColor: DefaultStyle.placeholders + font { + family: DefaultStyle.defaultFont + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + selectByMouse: true + activeFocusOnTab: true + KeyNavigation.right: eyeButton + text: initialText - property bool controlIsDown: false - property bool hidden: false - property bool isError: false + property bool controlIsDown: false + property bool hidden: false + property bool isError: false property bool keyboardFocus: FocusHelper.keyboardFocus - // Background properties - property bool backgroundVisible: true - property color backgroundColor: DefaultStyle.grey_100 - property color disabledBackgroundColor: DefaultStyle.grey_200 - // Border properties - property color backgroundBorderColor: DefaultStyle.grey_200 - property color activeBorderColor: DefaultStyle.main1_500_main + // Background properties + property bool backgroundVisible: true + property color backgroundColor: DefaultStyle.grey_100 + property color disabledBackgroundColor: DefaultStyle.grey_200 + // Border properties + property color backgroundBorderColor: DefaultStyle.grey_200 + property color activeBorderColor: DefaultStyle.main1_500_main property color keyboardFocusedBorderColor: DefaultStyle.main2_900 property color errorBorderColor: DefaultStyle.danger_500_main property real borderWidth: Utils.getSizeWithScreenRatio(1) property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3) - // Text properties - property string initialText - property real pixelSize: Typography.p1.pixelSize - property real weight: Typography.p1.weight + // Text properties + property string initialText + property real pixelSize: Typography.p1.pixelSize + property real weight: Typography.p1.weight - // Custom button on the right - property string customButtonIcon - property var customCallback - property string customButtonAccessibleName + // Custom button on the right + property string customButtonIcon + property var customCallback + property string customButtonAccessibleName - // fill propertyName and propertyOwner to check text validity - property string propertyName - property var propertyOwner - property var propertyOwnerGui - property var initialReading: true - property var isValid: function (text) { - return true - } - property bool toValidate: false - property int idleTimeOut: 200 - property bool empty: propertyOwnerGui - ? mainItem.propertyOwnerGui.core != undefined && mainItem.propertyOwnerGui.core[mainItem.propertyName]?.length == 0 - : mainItem.propertyOwner != undefined && mainItem.propertyOwner[mainItem.propertyName]?.length == 0 - property bool canBeEmpty: true + // fill propertyName and propertyOwner to check text validity + property string propertyName + property var propertyOwner + property var propertyOwnerGui + property var initialReading: true + property var isValid: function (text) { + return true; + } + property bool toValidate: false + property int idleTimeOut: 200 + property bool empty: propertyOwnerGui ? mainItem.propertyOwnerGui.core != undefined + && mainItem.propertyOwnerGui.core[mainItem.propertyName]?.length == 0 : mainItem.propertyOwner != undefined + && mainItem.propertyOwner[mainItem.propertyName]?.length == 0 + property bool canBeEmpty: true - signal validationChecked(bool valid) + signal validationChecked(bool valid) - function resetText() { - text = initialText - } + function resetText() { + text = initialText; + } - signal enterPressed + signal enterPressed - onAccepted: { - // No need to process changing focus because of TextEdited callback. - idleTimer.stop() - updateText() - } - onTextChanged: { - if (mainItem.toValidate) { - idleTimer.restart() - } - } - function updateText() { - mainItem.empty = text.length == 0 - if (initialReading) { - initialReading = false - } - if (mainItem.empty && !mainItem.canBeEmpty) { - mainItem.validationChecked(false) - return - } - if (mainItem.propertyName && isValid(text)) { - if (mainItem.propertyOwnerGui) { - if (mainItem.propertyOwnerGui.core[mainItem.propertyName] != text) { - mainItem.propertyOwnerGui.core[mainItem.propertyName] = text - } - } else { - if (mainItem.propertyOwner[mainItem.propertyName] != text) - mainItem.propertyOwner[mainItem.propertyName] = text - } - mainItem.validationChecked(true) - } else - mainItem.validationChecked(false) - } - // Validation textfield functions - Timer { - id: idleTimer - running: false - interval: mainItem.idleTimeOut - repeat: false - onTriggered: { - mainItem.accepted() - } - } + onAccepted: { + // No need to process changing focus because of TextEdited callback. + idleTimer.stop(); + updateText(); + } + onTextChanged: { + if (mainItem.toValidate) { + idleTimer.restart(); + } + } + function updateText() { + mainItem.empty = text.length == 0; + if (initialReading) { + initialReading = false; + } + if (mainItem.empty && !mainItem.canBeEmpty) { + mainItem.validationChecked(false); + return; + } + if (mainItem.propertyName && isValid(text)) { + if (mainItem.propertyOwnerGui) { + if (mainItem.propertyOwnerGui.core[mainItem.propertyName] != text) { + mainItem.propertyOwnerGui.core[mainItem.propertyName] = text; + } + } else { + if (mainItem.propertyOwner[mainItem.propertyName] != text) + mainItem.propertyOwner[mainItem.propertyName] = text; + } + mainItem.validationChecked(true); + } else + mainItem.validationChecked(false); + } + // Validation textfield functions + Timer { + id: idleTimer + running: false + interval: mainItem.idleTimeOut + repeat: false + onTriggered: { + mainItem.accepted(); + } + } - background: Rectangle { - id: inputBackground - visible: mainItem.backgroundVisible - anchors.fill: parent - radius: Utils.getSizeWithScreenRatio(79) - color: mainItem.enabled ? mainItem.backgroundColor : mainItem.disabledBackgroundColor - border.color: mainItem.isError ? mainItem.errorBorderColor : mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderColor : mainItem.activeFocus ? mainItem.activeBorderColor : mainItem.backgroundBorderColor - border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth - } + background: Rectangle { + id: inputBackground + visible: mainItem.backgroundVisible + anchors.fill: parent + radius: Utils.getSizeWithScreenRatio(79) + color: mainItem.enabled ? mainItem.backgroundColor : mainItem.disabledBackgroundColor + border.color: mainItem.isError ? mainItem.errorBorderColor : mainItem.keyboardFocus + ? mainItem.keyboardFocusedBorderColor : mainItem.activeFocus ? mainItem.activeBorderColor : + mainItem.backgroundBorderColor + border.width: mainItem.keyboardFocus ? mainItem.keyboardFocusedBorderWidth : mainItem.borderWidth + } - cursorDelegate: Rectangle { - id: cursor - color: DefaultStyle.main1_500_main - width: Utils.getSizeWithScreenRatio(1) - anchors.verticalCenter: mainItem.verticalCenter + cursorDelegate: Rectangle { + id: cursor + color: DefaultStyle.main1_500_main + width: Utils.getSizeWithScreenRatio(1) + anchors.verticalCenter: mainItem.verticalCenter - SequentialAnimation { - loops: Animation.Infinite - running: mainItem.cursorVisible + SequentialAnimation { + loops: Animation.Infinite + running: mainItem.cursorVisible - PropertyAction { - target: cursor - property: 'visible' - value: true - } + PropertyAction { + target: cursor + property: 'visible' + value: true + } - PauseAnimation { - duration: 600 - } + PauseAnimation { + duration: 600 + } - PropertyAction { - target: cursor - property: 'visible' - value: false - } + PropertyAction { + target: cursor + property: 'visible' + value: false + } - PauseAnimation { - duration: 600 - } + PauseAnimation { + duration: 600 + } - onStopped: { - cursor.visible = false - } - } - } - Keys.onPressed: event => { - if (event.key == Qt.Key_Control) - mainItem.controlIsDown = true - if (event.key === Qt.Key_Enter - || event.key === Qt.Key_Return) { - enterPressed() - if (mainItem.controlIsDown) { + onStopped: { + cursor.visible = false; + } + } + } + Keys.onPressed: event => { + if (event.key == Qt.Key_Control) + mainItem.controlIsDown = true; + if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { + enterPressed(); + if (mainItem.controlIsDown) {} + } + } + Keys.onReleased: event => { + if (event.jey == Qt.Key_Control) + mainItem.controlIsDown = false; + } - } - } - } - Keys.onReleased: event => { - if (event.jey == Qt.Key_Control) - mainItem.controlIsDown = false - } + Button { + id: eyeButton + KeyNavigation.left: mainItem + property real rightMargin: Utils.getSizeWithScreenRatio(15) + z: 1 + visible: mainItem.hidden + checkable: true + style: ButtonStyle.noBackground + icon.source: eyeButton.checked ? AppIcons.eyeShow : AppIcons.eyeHide + width: Utils.getSizeWithScreenRatio(20) + height: Utils.getSizeWithScreenRatio(20) + icon.width: width + icon.height: height + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: rightMargin - Button { - id: eyeButton - KeyNavigation.left: mainItem - property real rightMargin: Utils.getSizeWithScreenRatio(15) - z: 1 - visible: mainItem.hidden - checkable: true - style: ButtonStyle.noBackground - icon.source: eyeButton.checked ? AppIcons.eyeShow : AppIcons.eyeHide - width: Utils.getSizeWithScreenRatio(20) - height: Utils.getSizeWithScreenRatio(20) - icon.width: width - icon.height: height - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: rightMargin - - Accessible.name: (eyeButton.checked ? - //: Hide %1 - qsTr("hide_accessible_name") : - //: Show %1 - qsTr("show_accessible_name") - ).arg(mainItem.Accessible.name) - } - Button { - id: customButton - KeyNavigation.left: mainItem - z: 1 - visible: mainItem.customButtonIcon !== undefined && mainItem.customButtonIcon !== "" - style: ButtonStyle.noBackground - icon.source: mainItem.customButtonIcon - width: visible ? Utils.getSizeWithScreenRatio(20) : 0 - height: Utils.getSizeWithScreenRatio(20) - icon.width: width - icon.height: height - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: Utils.getSizeWithScreenRatio(15) - onClicked: mainItem.customCallback() - //: %1 button of %2 - Accessible.name: qsTr("textfield_custom_button_accessible_name").arg(mainItem.customButtonAccessibleName).arg(mainItem.Accessible.name) - } + Accessible.name: (eyeButton.checked ? + //: Hide %1 + qsTr("hide_accessible_name") : + //: Show %1 + qsTr("show_accessible_name")).arg(mainItem.Accessible.name) + } + Button { + id: customButton + KeyNavigation.left: mainItem + z: 1 + visible: mainItem.customButtonIcon !== undefined && mainItem.customButtonIcon !== "" + style: ButtonStyle.noBackground + icon.source: mainItem.customButtonIcon + width: visible ? Utils.getSizeWithScreenRatio(20) : 0 + height: Utils.getSizeWithScreenRatio(20) + icon.width: width + icon.height: height + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: Utils.getSizeWithScreenRatio(15) + onClicked: mainItem.customCallback() + //: %1 button of %2 + Accessible.name: qsTr("textfield_custom_button_accessible_name").arg(mainItem.customButtonAccessibleName).arg( + mainItem.Accessible.name) + } } diff --git a/Linphone/view/Control/Input/TimeComboBox.qml b/Linphone/view/Control/Input/TimeComboBox.qml index d9067dd68..8d01270ec 100644 --- a/Linphone/view/Control/Input/TimeComboBox.qml +++ b/Linphone/view/Control/Input/TimeComboBox.qml @@ -10,33 +10,33 @@ ComboBox { onSelectedDateTimeChanged: { if (minTime != undefined) { if (UtilsCpp.timeOffset(minTime, selectedDateTime) < 0) - selectedDateTime = minTime + selectedDateTime = minTime; } if (maxTime != undefined) { if (UtilsCpp.timeOffset(maxTime, selectedDateTime) > 0) - selectedDateTime = maxTime + selectedDateTime = maxTime; } } readonly property string selectedTimeString: Qt.formatDateTime(selectedDateTime, "hh:mm") - property int selectedHour: input.hour*1 - property int selectedMin: input.min*1 + property int selectedHour: input.hour * 1 + property int selectedMin: input.min * 1 property alias contentText: input property var minTime property var maxTime - popup.width: Utils.getSizeWithScreenRatio(73) + popup.width: Utils.getSizeWithScreenRatio(73) listView.model: 48 - listView.height: Math.min(Utils.getSizeWithScreenRatio(204), listView.contentHeight) - popup.height: Math.min(Utils.getSizeWithScreenRatio(204), 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 popup.onOpened: { - input.forceActiveFocus() + input.forceActiveFocus(); } contentItem: TextInput { id: input - validator: IntValidator{} + validator: IntValidator {} // activeFocusOnPress: false inputMask: "00:00" verticalAlignment: TextInput.AlignVCenter @@ -46,41 +46,41 @@ ComboBox { color: DefaultStyle.main2_600 onActiveFocusChanged: { if (activeFocus) { - selectAll() + selectAll(); } else { - listView.currentIndex = -1 - mainItem.selectedDateTime = UtilsCpp.createDateTime(mainItem.selectedDateTime, hour, min) + listView.currentIndex = -1; + mainItem.selectedDateTime = UtilsCpp.createDateTime(mainItem.selectedDateTime, hour, min); } } font { - pixelSize: Typography.p2l.pixelSize - weight: Typography.p2l.weight + pixelSize: Typography.p2l.pixelSize + weight: Typography.p2l.weight } text: mainItem.selectedTimeString - Keys.onPressed: (event) => { - if (event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { - focus = false - } - } + Keys.onPressed: event => { + if (event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { + focus = false; + } + } onFocusChanged: if (!focus) { - mainItem.selectedDateTime = UtilsCpp.createDateTime(mainItem.selectedDateTime, hour, min) - console.log("set time", hour, min) - } + mainItem.selectedDateTime = UtilsCpp.createDateTime(mainItem.selectedDateTime, hour, min); + console.log("set time", hour, min); + } } listView.delegate: Text { id: hourDelegate - property int hour: modelData /2 - property int min: modelData%2 === 0 ? 0 : 30 + property int hour: modelData / 2 + property int min: modelData % 2 === 0 ? 0 : 30 property var currentDateTime: UtilsCpp.createDateTime(new Date(), hour, min) text: Qt.formatDateTime(currentDateTime, "hh:mm") width: mainItem.width visible: mainItem.minTime == undefined || UtilsCpp.timeOffset(mainItem.minTime, currentDateTime) > 0 - height: visible ? Utils.getSizeWithScreenRatio(25) : 0 + height: visible ? Utils.getSizeWithScreenRatio(25) : 0 verticalAlignment: TextInput.AlignVCenter horizontalAlignment: TextInput.AlignHCenter font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight } MouseArea { anchors.fill: parent @@ -88,9 +88,9 @@ ComboBox { cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor onClicked: { // mainItem.text = parent.text - mainItem.listView.currentIndex = index - mainItem.selectedDateTime = UtilsCpp.createDateTime(mainItem.selectedDateTime, hour, min) - mainItem.popup.close() + mainItem.listView.currentIndex = index; + mainItem.selectedDateTime = UtilsCpp.createDateTime(mainItem.selectedDateTime, hour, min); + mainItem.popup.close(); } Rectangle { visible: parent.containsMouse diff --git a/Linphone/view/Control/Popup/DesktopPopup.qml b/Linphone/view/Control/Popup/DesktopPopup.qml index 32fcc123d..3a957b8f8 100644 --- a/Linphone/view/Control/Popup/DesktopPopup.qml +++ b/Linphone/view/Control/Popup/DesktopPopup.qml @@ -6,84 +6,84 @@ import QtQuick.Layouts import Qt.labs.platform Window { - id: mainItem + id: mainItem // --------------------------------------------------------------------------- color: "transparent" - + property bool requestActivate: false //property int flags: Qt.SplashScreen default property alias _content: content.data property bool _isOpen: false - signal isOpened() - signal isClosed() - signal dataChanged() + signal isOpened + signal isClosed + signal dataChanged on_ContentChanged: dataChanged(_content) // --------------------------------------------------------------------------- - function open () { + function open() { _isOpen = true; isOpened(); } /* function close () { - _isOpen = false - isClosed() + _isOpen = false + isClosed() } */ // --------------------------------------------------------------------------- objectName: '__internalWindow' - property bool showAsTool : false + property bool showAsTool: false // Don't use Popup for flags : it could lead to error in geometry. On Mac, Using Tool ensure to have the Window on Top and fullscreen independant // flags: Qt.WindowDoesNotAcceptFocus | Qt.BypassWindowManagerHint | (showAsTool?Qt.Tool:Qt.WindowStaysOnTopHint) | Qt.Window | Qt.FramelessWindowHint; - flags: Qt.SplashScreen | Qt.WindowDoesNotAcceptFocus | Qt.FramelessWindowHint // | Qt.WindowStaysOnTopHint + flags: Qt.SplashScreen | Qt.WindowDoesNotAcceptFocus | Qt.FramelessWindowHint // | Qt.WindowStaysOnTopHint opacity: 1.0 height: _content[0] != null ? _content[0].height : 0 width: _content[0] != null ? _content[0].width : 0 - visible:true + visible: true Item { id: content - anchors.fill:parent + anchors.fill: parent focus: false property var $parent: mainItem } - // --------------------------------------------------------------------------- -/* - states: State { - name: 'opening' - when: _isOpen + // --------------------------------------------------------------------------- + /* + states: State { + name: 'opening' + when: _isOpen - PropertyChanges { - opacity: 1.0 - target: window - } - } + PropertyChanges { + opacity: 1.0 + target: window + } + } - transitions: [ - Transition { - from: '' - to: 'opening' - ScriptAction { - script: { - if (wrapper.requestActivate) { - window.requestActivate() - } - } - } - }, - Transition { - from: '*' - to: '' - ScriptAction { - script: window.close() - } - } - ] - */ + transitions: [ + Transition { + from: '' + to: 'opening' + ScriptAction { + script: { + if (wrapper.requestActivate) { + window.requestActivate() + } + } + } + }, + Transition { + from: '*' + to: '' + ScriptAction { + script: window.close() + } + } + ] + */ } diff --git a/Linphone/view/Control/Popup/Dialog/AuthenticationDialog.qml b/Linphone/view/Control/Popup/Dialog/AuthenticationDialog.qml index 74484fd24..3439f3a82 100644 --- a/Linphone/view/Control/Popup/Dialog/AuthenticationDialog.qml +++ b/Linphone/view/Control/Popup/Dialog/AuthenticationDialog.qml @@ -7,84 +7,86 @@ import QtQuick.Dialogs import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 - + property string identity property string domain readonly property string password: passwordEdit.text property var callback// Define cb(var) function - - topPadding: Utils.getSizeWithScreenRatio(20) - bottomPadding: Utils.getSizeWithScreenRatio(20) - leftPadding: Utils.getSizeWithScreenRatio(20) - rightPadding: Utils.getSizeWithScreenRatio(20) - width: Utils.getSizeWithScreenRatio(637) + + 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 - + onAccepted: { - if( callback) callback.cb(password) - close() + if (callback) + callback.cb(password); + close(); } onRejected: close() - Component.onDestruction: if(callback) callback.destroy() - + Component.onDestruction: if (callback) + callback.destroy() + content: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(20) id: contentLayout - Text { - Layout.fillWidth: true - Layout.preferredWidth: Utils.getSizeWithScreenRatio(250) - Layout.alignment: Qt.AlignHCenter - horizontalAlignment: Text.AlignHCenter - wrapMode: Text.Wrap - font { - pixelSize: Typography.h3.pixelSize - weight: Typography.h3.weight - } - //: "Authentification requise" - text: qsTr("account_settings_dialog_invalid_password_title") - } + spacing: Utils.getSizeWithScreenRatio(20) Text { Layout.fillWidth: true - Layout.preferredWidth: Utils.getSizeWithScreenRatio(250) + 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: Utils.getSizeWithScreenRatio(16) - font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight - } + font { + pixelSize: Typography.h3.pixelSize + weight: Typography.h3.weight + } + //: "Authentification requise" + text: qsTr("account_settings_dialog_invalid_password_title") + } + Text { + Layout.fillWidth: true + 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: Utils.getSizeWithScreenRatio(16) + font { + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight + } + } + FormItemLayout { + id: passwordItem + Layout.fillWidth: true + label: qsTr("password") + enableErrorText: true + mandatory: true + contentItem: TextField { + id: passwordEdit + hidden: true + width: parent.width + isError: passwordItem.errorTextVisible + KeyNavigation.down: cancelButton + } } - FormItemLayout { - id: passwordItem - Layout.fillWidth: true - label: qsTr("password") - enableErrorText: true - mandatory: true - contentItem: TextField { - id: passwordEdit - hidden: true - width: parent.width - isError: passwordItem.errorTextVisible - KeyNavigation.down: cancelButton - } - } } buttons: [ MediumButton { id: cancelButton - Layout.topMargin: Utils.getSizeWithScreenRatio(10) - //: "Annuler - text: qsTr("cancel") + Layout.topMargin: Utils.getSizeWithScreenRatio(10) + //: "Annuler + text: qsTr("cancel") style: ButtonStyle.secondary onClicked: mainItem.rejected() KeyNavigation.up: passwordEdit @@ -92,20 +94,20 @@ Dialog { }, MediumButton { id: connectButton - Layout.topMargin: Utils.getSizeWithScreenRatio(10) - //: Connexion - text: qsTr("assistant_account_login") + Layout.topMargin: Utils.getSizeWithScreenRatio(10) + //: Connexion + text: qsTr("assistant_account_login") style: ButtonStyle.main KeyNavigation.up: passwordEdit KeyNavigation.right: cancelButton onClicked: { - passwordItem.errorMessage = "" - if (passwordEdit.text.length == 0) { - //: Veuillez saisir un mot de passe - passwordItem.errorMessage = qsTr("assistant_account_login_missing_password") - return + passwordItem.errorMessage = ""; + if (passwordEdit.text.length == 0) { + //: Veuillez saisir un mot de passe + passwordItem.errorMessage = qsTr("assistant_account_login_missing_password"); + return; } - mainItem.accepted() + mainItem.accepted(); } } ] diff --git a/Linphone/view/Control/Popup/Dialog/Dialog.qml b/Linphone/view/Control/Popup/Dialog/Dialog.qml index d3a9a62f1..25ac1d6e2 100644 --- a/Linphone/view/Control/Popup/Dialog/Dialog.qml +++ b/Linphone/view/Control/Popup/Dialog/Dialog.qml @@ -3,7 +3,7 @@ import QtQuick.Controls.Basic as Control 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Popup { @@ -11,69 +11,69 @@ Popup { modal: true anchors.centerIn: parent closePolicy: Control.Popup.NoAutoClose - 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) + 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 ? Utils.getSizeWithScreenRatio(16) : 0 + radius: title.length === 0 ? Utils.getSizeWithScreenRatio(16) : 0 property string title property var titleColor: DefaultStyle.main1_500_main property string text property string details - //: "Confirmer" - property string firstButtonText: firstButtonAccept ? qsTr("dialog_confirm") - //: "Annuler" - : qsTr("dialog_cancel") - property string secondButtonText: secondButtonAccept ? qsTr("dialog_confirm") - : qsTr("dialog_cancel") - property alias content: contentLayout.data - property alias buttons: buttonsLayout.data + //: "Confirmer" + property string firstButtonText: firstButtonAccept ? qsTr("dialog_confirm") : + //: "Annuler" + qsTr("dialog_cancel") + property string secondButtonText: secondButtonAccept ? qsTr("dialog_confirm") : qsTr("dialog_cancel") + property alias content: contentLayout.data + property alias buttons: buttonsLayout.data property alias firstButton: firstButtonId property alias secondButton: secondButtonId property bool firstButtonAccept: true property bool secondButtonAccept: false - signal accepted() - signal rejected() + signal accepted + signal rejected contentItem: FocusScope { implicitWidth: child.implicitWidth implicitHeight: child.implicitHeight onVisibleChanged: { - if(visible) forceActiveFocus() - } - Keys.onPressed: (event) => { - if(visible && event.key == Qt.Key_Escape){ - mainItem.close() - event.accepted = true - } + if (visible) + forceActiveFocus(); } + Keys.onPressed: event => { + if (visible && event.key == Qt.Key_Escape) { + mainItem.close(); + event.accepted = true; + } + } ColumnLayout { id: child anchors.fill: parent - spacing: Utils.getSizeWithScreenRatio(15) - - Text{ + spacing: Utils.getSizeWithScreenRatio(15) + + Text { id: titleText Layout.fillWidth: true visible: text.length != 0 text: mainItem.title color: mainItem.titleColor font { - pixelSize: Typography.h3.pixelSize - weight: Typography.h3.weight + pixelSize: Typography.h3.pixelSize + weight: Typography.h3.weight } wrapMode: Text.Wrap horizontalAlignment: Text.AlignLeft } - Rectangle{ + Rectangle { Layout.fillWidth: true Layout.preferredHeight: 1 color: DefaultStyle.main2_400 visible: titleText.visible } - + Text { id: defaultText visible: text.length != 0 @@ -81,53 +81,53 @@ Popup { Layout.alignment: Qt.AlignCenter text: mainItem.text font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight } wrapMode: Text.Wrap - horizontalAlignment: titleText.visible ? Text.AlignLeft : Text.AlignHCenter + horizontalAlignment: titleText.visible ? Text.AlignLeft : Text.AlignHCenter } Text { id: detailsText visible: text.length != 0 Layout.fillWidth: true - //Layout.preferredWidth: Utils.getSizeWithScreenRatio(278) + //Layout.preferredWidth: Utils.getSizeWithScreenRatio(278) Layout.alignment: Qt.AlignCenter text: mainItem.details font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight italic: true } wrapMode: Text.Wrap horizontalAlignment: Text.AlignHCenter } - + ColumnLayout { id: contentLayout Layout.alignment: Qt.AlignHCenter Layout.fillHeight: false } - + RowLayout { id: buttonsLayout - Layout.alignment: Qt.AlignBottom | ( titleText.visible ? Qt.AlignRight : Qt.AlignHCenter) - spacing: Utils.getSizeWithScreenRatio(titleText.visible ? 20 : 10) - + Layout.alignment: Qt.AlignBottom | (titleText.visible ? Qt.AlignRight : Qt.AlignHCenter) + spacing: Utils.getSizeWithScreenRatio(titleText.visible ? 20 : 10) + // Default buttons only visible if no other children // have been set MediumButton { - id:firstButtonId + id: firstButtonId visible: mainItem.buttons.length === 2 text: mainItem.firstButtonText style: mainItem.firstButtonAccept ? ButtonStyle.main : ButtonStyle.secondary focus: !mainItem.firstButtonAccept onClicked: { - if(mainItem.firstButtonAccept) - mainItem.accepted() + if (mainItem.firstButtonAccept) + mainItem.accepted(); else - mainItem.rejected() - mainItem.close() + mainItem.rejected(); + mainItem.close(); } KeyNavigation.left: secondButtonId KeyNavigation.right: secondButtonId @@ -139,11 +139,11 @@ Popup { style: mainItem.firstButtonAccept ? ButtonStyle.secondary : ButtonStyle.main focus: !mainItem.secondButtonAccept onClicked: { - if(mainItem.secondButtonAccept) - mainItem.accepted() + if (mainItem.secondButtonAccept) + mainItem.accepted(); else - mainItem.rejected() - mainItem.close() + mainItem.rejected(); + mainItem.close(); } KeyNavigation.left: firstButtonId KeyNavigation.right: firstButtonId diff --git a/Linphone/view/Control/Popup/Dialog/ZrtpAuthenticationDialog.qml b/Linphone/view/Control/Popup/Dialog/ZrtpAuthenticationDialog.qml index c20bcdbbe..e299d107f 100644 --- a/Linphone/view/Control/Popup/Dialog/ZrtpAuthenticationDialog.qml +++ b/Linphone/view/Control/Popup/Dialog/ZrtpAuthenticationDialog.qml @@ -4,22 +4,23 @@ 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= Dialog { id: mainItem - width: Utils.getSizeWithScreenRatio(436) - rightPadding: Utils.getSizeWithScreenRatio(0) - leftPadding: Utils.getSizeWithScreenRatio(0) - topPadding: Utils.getSizeWithScreenRatio(85 + 24) - bottomPadding: Utils.getSizeWithScreenRatio(24) + 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 property var call - onCallChanged: if(!call) close() + onCallChanged: if (!call) + close() property bool isTokenVerified: call && call.core.tokenVerified || false property bool isCaseMismatch: call && call.core.isMismatch || false property bool securityError: false @@ -32,18 +33,16 @@ Dialog { anchors.fill: parent width: mainItem.width height: mainItem.implicitHeight - color: mainItem.securityError - ? DefaultStyle.danger_500_main - : mainItem.isCaseMismatch - ? DefaultStyle.warning_600 - : DefaultStyle.info_500_main + color: mainItem.securityError ? DefaultStyle.danger_500_main : mainItem.isCaseMismatch ? DefaultStyle.warning_600 : + DefaultStyle.info_500_main + radius: mainItem.radius Layout.ColumnLayout { anchors.top: parent.top - anchors.topMargin: Utils.getSizeWithScreenRatio(18) + anchors.topMargin: Utils.getSizeWithScreenRatio(18) anchors.horizontalCenter: parent.horizontalCenter Item { - // spacing: Utils.getSizeWithScreenRatio(14) + // spacing: Utils.getSizeWithScreenRatio(14) Layout.Layout.preferredWidth: childrenRect.width Layout.Layout.preferredHeight: childrenRect.height Layout.Layout.fillWidth: true @@ -51,58 +50,60 @@ Dialog { id: trustShield anchors.centerIn: parent source: AppIcons.trustedWhite - sourceSize.width: Utils.getSizeWithScreenRatio(24) - sourceSize.height: Utils.getSizeWithScreenRatio(24) - width: Utils.getSizeWithScreenRatio(24) - height: Utils.getSizeWithScreenRatio(24) + 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: Utils.getSizeWithScreenRatio(14) + anchors.leftMargin: Utils.getSizeWithScreenRatio(14) visible: mainItem.securityError imageSource: AppIcons.shieldWarning colorizationColor: DefaultStyle.main2_700 - width: Utils.getSizeWithScreenRatio(24) - height: Utils.getSizeWithScreenRatio(24) + width: Utils.getSizeWithScreenRatio(24) + height: Utils.getSizeWithScreenRatio(24) } } Text { - //: Vérification de sécurité - text: qsTr("call_dialog_zrtp_validate_trust_title") + //: Vérification de sécurité + text: qsTr("call_dialog_zrtp_validate_trust_title") color: DefaultStyle.grey_0 Layout.Layout.alignment: Qt.AlignHCenter font { - pixelSize: Typography.p2l.pixelSize - weight: Typography.p2l.weight + pixelSize: Typography.p2l.pixelSize + weight: Typography.p2l.weight } } - Item{Layout.Layout.fillHeight: true} + Item { + Layout.Layout.fillHeight: true + } } SmallButton { visible: !mainItem.securityError anchors.top: parent.top anchors.right: parent.right - anchors.topMargin: Utils.getSizeWithScreenRatio(10) - anchors.rightMargin: Utils.getSizeWithScreenRatio(17) + anchors.topMargin: Utils.getSizeWithScreenRatio(10) + anchors.rightMargin: Utils.getSizeWithScreenRatio(17) style: ButtonStyle.noBackground - //: "Passer" - text: qsTr("call_zrtp_sas_validation_skip") + //: "Passer" + text: qsTr("call_zrtp_sas_validation_skip") textColor: DefaultStyle.grey_0 hoveredTextColor: DefaultStyle.grey_100 pressedTextColor: DefaultStyle.grey_200 underline: true onClicked: { - call.core.lSkipZrtpAuthentication() - mainItem.close() + call.core.lSkipZrtpAuthentication(); + mainItem.close(); } } } Rectangle { z: 1 width: mainItem.width - height: Math.round(parent.height - Utils.getSizeWithScreenRatio(85)) + height: Math.round(parent.height - Utils.getSizeWithScreenRatio(85)) x: parent.x - y: Math.round(parent.y + Utils.getSizeWithScreenRatio(85)) + y: Math.round(parent.y + Utils.getSizeWithScreenRatio(85)) color: DefaultStyle.grey_0 radius: mainItem.radius } @@ -119,41 +120,41 @@ Dialog { content: [ Layout.ColumnLayout { visible: !mainItem.securityError - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) Layout.Layout.alignment: Qt.AlignHCenter Layout.Layout.fillWidth: true Layout.ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) Layout.Layout.alignment: Qt.AlignHCenter Text { - Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(343) + Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(343) Layout.Layout.alignment: Qt.AlignHCenter horizontalAlignment: Text.AlignHCenter - text: !mainItem.isTokenVerified && mainItem.isCaseMismatch - //: "Pour garantir le chiffrement, nous avons besoin de réauthentifier l’appareil de votre correspondant. Echangez vos codes :" - ? qsTr("call_dialog_zrtp_validate_trust_warning_message") - //: "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") + text: !mainItem.isTokenVerified && mainItem.isCaseMismatch ? + //: "Pour garantir le chiffrement, nous avons besoin de réauthentifier l’appareil de votre correspondant. Echangez vos codes :" + qsTr("call_dialog_zrtp_validate_trust_warning_message") : + //: "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: Utils.getSizeWithScreenRatio(14) + font.pixelSize: Utils.getSizeWithScreenRatio(14) } Layout.ColumnLayout { spacing: 0 Layout.Layout.alignment: Qt.AlignHCenter Text { - //: "Votre code :" - text: qsTr("call_dialog_zrtp_validate_trust_local_code_label") + //: "Votre code :" + text: qsTr("call_dialog_zrtp_validate_trust_local_code_label") horizontalAlignment: Text.AlignHCenter Layout.Layout.alignment: Qt.AlignHCenter - font.pixelSize: Utils.getSizeWithScreenRatio(14) + font.pixelSize: Utils.getSizeWithScreenRatio(14) } Text { text: mainItem.call && mainItem.call.core.localToken || "" horizontalAlignment: Text.AlignHCenter Layout.Layout.alignment: Qt.AlignHCenter font { - pixelSize: Typography.b1.pixelSize - weight: Typography.b1.weight + pixelSize: Typography.b1.pixelSize + weight: Typography.b1.weight } } } @@ -161,18 +162,18 @@ Dialog { Rectangle { color: "transparent" border.color: DefaultStyle.main2_200 - border.width: Utils.getSizeWithScreenRatio(1) - radius: Utils.getSizeWithScreenRatio(15) - Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(292) - Layout.Layout.preferredHeight: Utils.getSizeWithScreenRatio(233) + 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: Utils.getSizeWithScreenRatio(10) + anchors.topMargin: Utils.getSizeWithScreenRatio(10) Text { - //: "Code correspondant :" - text: qsTr("call_dialog_zrtp_validate_trust_remote_code_label") - font.pixelSize: Utils.getSizeWithScreenRatio(14) + //: "Code correspondant :" + text: qsTr("call_dialog_zrtp_validate_trust_remote_code_label") + font.pixelSize: Utils.getSizeWithScreenRatio(14) Layout.Layout.alignment: Qt.AlignHCenter } Layout.GridLayout { @@ -180,27 +181,28 @@ Dialog { Layout.Layout.alignment: Qt.AlignHCenter rows: 2 columns: 2 - rowSpacing: Utils.getSizeWithScreenRatio(32) - columnSpacing: Utils.getSizeWithScreenRatio(32) + 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: Utils.getSizeWithScreenRatio(70) - Layout.Layout.preferredHeight: Utils.getSizeWithScreenRatio(70) - width: Utils.getSizeWithScreenRatio(70) - height: Utils.getSizeWithScreenRatio(70) + 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: Utils.getSizeWithScreenRatio(32) - textWeight: Utils.getSizeWithScreenRatio(400) + textSize: Utils.getSizeWithScreenRatio(32) + textWeight: Utils.getSizeWithScreenRatio(400) text: modelData - shadowEnabled: true - radius: Utils.getSizeWithScreenRatio(71) + shadowEnabled: true + radius: Utils.getSizeWithScreenRatio(71) textColor: DefaultStyle.main2_600 onClicked: { - console.log("CHECK TOKEN", modelData) - if(mainItem.call) mainItem.call.core.lCheckAuthenticationTokenSelected(modelData) + console.log("CHECK TOKEN", modelData); + if (mainItem.call) + mainItem.call.core.lCheckAuthenticationTokenSelected(modelData); } } } @@ -213,26 +215,26 @@ Dialog { spacing: 0 Text { - width: Utils.getSizeWithScreenRatio(303) - // Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(343) + 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") + //: "Le code fourni ne correspond pas." + text: qsTr("call_dialog_zrtp_validate_trust_letters_do_not_match_text") wrapMode: Text.WordWrap - font.pixelSize: Utils.getSizeWithScreenRatio(14) + font.pixelSize: Utils.getSizeWithScreenRatio(14) } Text { - width: Utils.getSizeWithScreenRatio(303) - // Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(343) + 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") + //: "La confidentialité de votre appel peut être compromise !" + text: qsTr("call_dialog_zrtp_security_alert_message") wrapMode: Text.WordWrap - font.pixelSize: Utils.getSizeWithScreenRatio(14) + font.pixelSize: Utils.getSizeWithScreenRatio(14) } } ] @@ -241,26 +243,27 @@ Dialog { Layout.Layout.alignment: Qt.AlignHCenter MediumButton { Layout.Layout.alignment: Qt.AlignHCenter - Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(247) - //: "Aucune correspondance" - text: qsTr("call_dialog_zrtp_validate_trust_letters_do_not_match") + Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(247) + //: "Aucune correspondance" + text: qsTr("call_dialog_zrtp_validate_trust_letters_do_not_match") color: DefaultStyle.grey_0 borderColor: DefaultStyle.danger_500_main textColor: DefaultStyle.danger_500_main visible: !mainItem.securityError onClicked: { - if(mainItem.call) mainItem.call.core.lCheckAuthenticationTokenSelected(" ") + if (mainItem.call) + mainItem.call.core.lCheckAuthenticationTokenSelected(" "); } } MediumButton { - Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(247) + Layout.Layout.preferredWidth: Utils.getSizeWithScreenRatio(247) Layout.Layout.alignment: Qt.AlignHCenter visible: mainItem.securityError style: ButtonStyle.phoneRed onClicked: mainItem.call.core.lTerminate() - spacing: Utils.getSizeWithScreenRatio(15) - //: "Raccrocher" - text: qsTr("call_action_hang_up") + 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 7d407da8b..a4e792a43 100644 --- a/Linphone/view/Control/Popup/InformationPopup.qml +++ b/Linphone/view/Control/Popup/InformationPopup.qml @@ -2,7 +2,7 @@ import QtQuick 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Popup { @@ -14,48 +14,50 @@ Popup { signal closePopup(int index) onClosed: closePopup(index) onAboutToShow: { - autoClosePopup.restart() + autoClosePopup.restart(); } closePolicy: Popup.NoAutoClose - x : parent.x + parent.width - width + x: parent.x + parent.width - width // y : parent.y + parent.height - height - rightMargin: Utils.getSizeWithScreenRatio(20) - bottomMargin: Utils.getSizeWithScreenRatio(20) - padding: Utils.getSizeWithScreenRatio(20) + 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 onHoveredChanged: { - if (hovered) autoClosePopup.stop() - else autoClosePopup.restart() + if (hovered) + autoClosePopup.stop(); + else + autoClosePopup.restart(); } Timer { id: autoClosePopup interval: 5000 onTriggered: { - mainItem.close() - } + mainItem.close(); + } } contentItem: RowLayout { - spacing: Utils.getSizeWithScreenRatio(24) + 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: Utils.getSizeWithScreenRatio(32) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) - width: Utils.getSizeWithScreenRatio(32) - height: Utils.getSizeWithScreenRatio(32) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) + width: Utils.getSizeWithScreenRatio(32) + height: Utils.getSizeWithScreenRatio(32) } Rectangle { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(1) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(1) Layout.preferredHeight: parent.height color: DefaultStyle.main2_200 } ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(2) + spacing: Utils.getSizeWithScreenRatio(2) RowLayout { spacing: 0 Text { @@ -63,15 +65,15 @@ Popup { text: mainItem.title color: mainItem.isSuccess ? DefaultStyle.success_500_main : DefaultStyle.danger_500_main font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight } } Button { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) - icon.width: Utils.getSizeWithScreenRatio(20) - icon.height: Utils.getSizeWithScreenRatio(20) + 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 @@ -82,15 +84,15 @@ Popup { Text { Layout.alignment: Qt.AlignHCenter Layout.fillWidth: true - Layout.maximumWidth: Utils.getSizeWithScreenRatio(300) + Layout.maximumWidth: Utils.getSizeWithScreenRatio(300) text: mainItem.description textFormat: Text.RichText wrapMode: Text.WordWrap color: DefaultStyle.main2_500_main onLinkActivated: Qt.openUrlExternally(link) font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(300) + 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 560310aa8..cc7b4759b 100644 --- a/Linphone/view/Control/Popup/Loading/LoadingPopup.qml +++ b/Linphone/view/Control/Popup/Loading/LoadingPopup.qml @@ -2,7 +2,7 @@ import QtQuick 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils Popup { @@ -13,20 +13,20 @@ Popup { modal: true closePolicy: Control.Popup.NoAutoClose anchors.centerIn: parent - padding: Utils.getSizeWithScreenRatio(20) + padding: Utils.getSizeWithScreenRatio(20) underlineColor: DefaultStyle.main1_500_main - radius: Utils.getSizeWithScreenRatio(15) + radius: Utils.getSizeWithScreenRatio(15) // onAboutToShow: width = contentText.implicitWidth contentItem: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(15) + spacing: Utils.getSizeWithScreenRatio(15) // width: childrenRect.width // height: childrenRect.height - BusyIndicator{ + BusyIndicator { Layout.alignment: Qt.AlignHCenter width: Utils.getSizeWithScreenRatio(33) height: width - Layout.preferredWidth: width - Layout.preferredHeight: width + Layout.preferredWidth: width + Layout.preferredHeight: width } Text { id: contentText @@ -34,16 +34,17 @@ Popup { Layout.fillWidth: true Layout.fillHeight: true text: mainItem.text - font.pixelSize: Utils.getSizeWithScreenRatio(14) + font.pixelSize: Utils.getSizeWithScreenRatio(14) } MediumButton { visible: mainItem.cancelButtonVisible Layout.alignment: Qt.AlignHCenter - text: qsTr("cancel") + text: qsTr("cancel") style: ButtonStyle.main onClicked: { - if (callback) mainItem.callback() - mainItem.close() + if (callback) + mainItem.callback(); + mainItem.close(); } } } diff --git a/Linphone/view/Control/Popup/Notification/Notification.qml b/Linphone/view/Control/Popup/Notification/Notification.qml index 375f08342..77c293d5e 100644 --- a/Linphone/view/Control/Popup/Notification/Notification.qml +++ b/Linphone/view/Control/Popup/Notification/Notification.qml @@ -7,29 +7,28 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils DesktopPopup { id: mainItem - - + property var notificationData: ({ - timelineModel : null + timelineModel: null }) - property real overriddenHeight: Utils.getSizeWithScreenRatio(120) - property real overriddenWidth: Utils.getSizeWithScreenRatio(300) + 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 - - signal deleteNotification (var notification) + + signal deleteNotification(var notification) width: mainItem.overriddenWidth height: mainItem.overriddenHeight - + // Use as an intermediate between signal/slot without propagate the notification var : last signal parameter will be the last notification instance - function deleteNotificationSlot(){ - deleteNotification(mainItem) + function deleteNotificationSlot() { + deleteNotification(mainItem); } - - function _close (cb) { + + function _close(cb) { if (cb) { - cb() + cb(); } deleteNotificationSlot(); } @@ -40,11 +39,11 @@ DesktopPopup { radius: mainItem.radius opacity: mainItem.backgroundOpacity } - - Loader{ + + Loader { id: backgroundLoader asynchronous: true - sourceComponent: Item{ + sourceComponent: Item { width: mainItem.overriddenWidth height: mainItem.overriddenHeight Rectangle { @@ -56,7 +55,7 @@ DesktopPopup { opacity: mainItem.backgroundOpacity // border { // color: DefaultStyle.grey_400 - // width: Utils.getSizeWithScreenRatio(1) + // width: Utils.getSizeWithScreenRatio(1) // } } MultiEffect { diff --git a/Linphone/view/Control/Popup/Notification/NotificationReceivedCall.qml b/Linphone/view/Control/Popup/Notification/NotificationReceivedCall.qml index 94b00a46a..97ab24e10 100644 --- a/Linphone/view/Control/Popup/Notification/NotificationReceivedCall.qml +++ b/Linphone/view/Control/Popup/Notification/NotificationReceivedCall.qml @@ -2,72 +2,72 @@ import QtQuick import QtQuick.Layouts import Linphone import UtilsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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: Utils.getSizeWithScreenRatio(10) + radius: Utils.getSizeWithScreenRatio(10) backgroundColor: DefaultStyle.grey_600 backgroundOpacity: 0.8 - overriddenWidth: Utils.getSizeWithScreenRatio(400) + overriddenWidth: Utils.getSizeWithScreenRatio(400) overriddenHeight: content.height - + readonly property var call: notificationData && notificationData.call readonly property var displayName: notificationData && notificationData.displayName property var state: call.core.state property var status: call.core.status property var conference: call.core.conference - onStateChanged:{ - if (state != LinphoneEnums.CallState.IncomingReceived){ - close() + onStateChanged: { + if (state != LinphoneEnums.CallState.IncomingReceived) { + close(); } } - onStatusChanged:{ - console.log("status", status) + onStatusChanged: { + console.log("status", status); } - + Popup { id: content visible: mainItem.visible - leftPadding: Utils.getSizeWithScreenRatio(32) - rightPadding: Utils.getSizeWithScreenRatio(32) - topPadding: Utils.getSizeWithScreenRatio(9) - bottomPadding: Utils.getSizeWithScreenRatio(18) + leftPadding: Utils.getSizeWithScreenRatio(32) + rightPadding: Utils.getSizeWithScreenRatio(32) + topPadding: Utils.getSizeWithScreenRatio(9) + bottomPadding: Utils.getSizeWithScreenRatio(18) anchors.centerIn: parent - background: Item{} + background: Item {} contentItem: ColumnLayout { anchors.verticalCenter: parent.verticalCenter - spacing: Utils.getSizeWithScreenRatio(9) + spacing: Utils.getSizeWithScreenRatio(9) RowLayout { - spacing: Utils.getSizeWithScreenRatio(4) + spacing: Utils.getSizeWithScreenRatio(4) Layout.alignment: Qt.AlignHCenter Image { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(12) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(12) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(12) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(12) source: AppIcons.logo } Text { text: "Linphone" color: DefaultStyle.grey_0 font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Typography.b3.weight + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Typography.b3.weight capitalization: Font.Capitalize } } } ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(17) + spacing: Utils.getSizeWithScreenRatio(17) ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(14) + spacing: Utils.getSizeWithScreenRatio(14) Layout.alignment: Qt.AlignHCenter Avatar { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(60) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(60) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(60) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(60) Layout.alignment: Qt.AlignHCenter call: mainItem.call displayNameVal: mainItem.displayName @@ -79,25 +79,25 @@ Notification { Text { text: displayName Layout.fillWidth: true - Layout.maximumWidth: mainItem.width - content.leftPadding - content.rightPadding + Layout.maximumWidth: mainItem.width - content.leftPadding - content.rightPadding Layout.alignment: Qt.AlignHCenter horizontalAlignment: Text.AlignHCenter maximumLineCount: 1 color: DefaultStyle.grey_0 font { - pixelSize: Utils.getSizeWithScreenRatio(20) - weight: Typography.b3.weight + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Typography.b3.weight capitalization: Font.Capitalize } } Text { - //: "Appel entrant" - text: qsTr("call_audio_incoming") + //: "Appel entrant" + text: qsTr("call_audio_incoming") Layout.alignment: Qt.AlignHCenter color: DefaultStyle.grey_0 font { - pixelSize: Utils.getSizeWithScreenRatio(14) - weight: Utils.getSizeWithScreenRatio(500) + pixelSize: Utils.getSizeWithScreenRatio(14) + weight: Utils.getSizeWithScreenRatio(500) } } } @@ -105,45 +105,44 @@ Notification { RowLayout { Layout.alignment: Qt.AlignHCenter Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(26) + spacing: Utils.getSizeWithScreenRatio(26) Button { - spacing: Utils.getSizeWithScreenRatio(6) + spacing: Utils.getSizeWithScreenRatio(6) style: ButtonStyle.phoneGreen - Layout.preferredWidth: Utils.getSizeWithScreenRatio(118) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(118) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) asynchronous: false - icon.width: Utils.getSizeWithScreenRatio(19) - icon.height: Utils.getSizeWithScreenRatio(19) - //: "Accepter" - text: qsTr("dialog_accept") - textSize: Utils.getSizeWithScreenRatio(14) - textWeight: Utils.getSizeWithScreenRatio(500) + icon.width: Utils.getSizeWithScreenRatio(19) + icon.height: Utils.getSizeWithScreenRatio(19) + //: "Accepter" + text: qsTr("dialog_accept") + textSize: Utils.getSizeWithScreenRatio(14) + textWeight: Utils.getSizeWithScreenRatio(500) onClicked: { - console.debug("[NotificationReceivedCall] Accept click") - UtilsCpp.openCallsWindow(mainItem.call) - mainItem.call.core.lAccept(false) + console.debug("[NotificationReceivedCall] Accept click"); + UtilsCpp.openCallsWindow(mainItem.call); + mainItem.call.core.lAccept(false); } } Button { - spacing: Utils.getSizeWithScreenRatio(6) + spacing: Utils.getSizeWithScreenRatio(6) style: ButtonStyle.phoneRed - Layout.preferredWidth: Utils.getSizeWithScreenRatio(118) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(118) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) asynchronous: false - icon.width: Utils.getSizeWithScreenRatio(19) - icon.height: Utils.getSizeWithScreenRatio(19) - //: "Refuser - text: qsTr("dialog_deny") - textSize: Utils.getSizeWithScreenRatio(14) - textWeight: Utils.getSizeWithScreenRatio(500) + icon.width: Utils.getSizeWithScreenRatio(19) + icon.height: Utils.getSizeWithScreenRatio(19) + //: "Refuser + text: qsTr("dialog_deny") + textSize: Utils.getSizeWithScreenRatio(14) + textWeight: Utils.getSizeWithScreenRatio(500) onClicked: { - console.debug("[NotificationReceivedCall] Decline click") - mainItem.call.core.lDecline() + 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 a5a8a5484..3b0fd262d 100644 --- a/Linphone/view/Control/Popup/Notification/NotificationReceivedMessage.qml +++ b/Linphone/view/Control/Popup/Notification/NotificationReceivedMessage.qml @@ -3,21 +3,21 @@ import QtQuick.Layouts 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= Notification { id: mainItem - radius: Utils.getSizeWithScreenRatio(10) + radius: Utils.getSizeWithScreenRatio(10) backgroundColor: DefaultStyle.grey_600 backgroundOpacity: 0.8 - overriddenWidth: Utils.getSizeWithScreenRatio(400) + overriddenWidth: Utils.getSizeWithScreenRatio(400) overriddenHeight: content.height property var chat: notificationData ? notificationData.chat : null - + property string avatarUri: notificationData?.avatarUri property string chatRoomName: notificationData?.chatRoomName ? notificationData.chatRoomName : "" property string remoteAddress: notificationData?.remoteAddress ? notificationData.remoteAddress : "" @@ -28,36 +28,36 @@ Notification { enabled: chat target: chat ? chat.core : null function onMessageOpen() { - close() + close(); } } - + Popup { id: content visible: mainItem.visible width: parent.width - leftPadding: Utils.getSizeWithScreenRatio(18) - rightPadding: Utils.getSizeWithScreenRatio(18) - topPadding: Utils.getSizeWithScreenRatio(32) - bottomPadding: Utils.getSizeWithScreenRatio(18) + 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: Utils.getSizeWithScreenRatio(9) anchors.horizontalCenter: parent.horizontalCenter - spacing: Utils.getSizeWithScreenRatio(4) + spacing: Utils.getSizeWithScreenRatio(4) Image { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(12) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(12) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(12) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(12) source: AppIcons.logo } Text { text: "Linphone" color: DefaultStyle.grey_0 font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Typography.b3.weight + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Typography.b3.weight capitalization: Font.Capitalize } } @@ -69,7 +69,9 @@ Notification { anchors.rightMargin: Utils.getSizeWithScreenRatio(12) padding: 0 z: mousearea.z + 1 - background: Item{anchors.fill: parent} + background: Item { + anchors.fill: parent + } icon.source: AppIcons.closeX width: Utils.getSizeWithScreenRatio(14) height: Utils.getSizeWithScreenRatio(14) @@ -77,20 +79,20 @@ Notification { icon.height: Utils.getSizeWithScreenRatio(14) contentImageColor: DefaultStyle.grey_0 onPressed: { - mainItem.close() + mainItem.close(); } } MouseArea { id: mousearea anchors.fill: parent onClicked: { - UtilsCpp.openChat(mainItem.chat) - mainItem.close() + UtilsCpp.openChat(mainItem.chat); + mainItem.close(); } } } contentItem: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(9) + spacing: Utils.getSizeWithScreenRatio(9) RowLayout { spacing: Utils.getSizeWithScreenRatio(14) Avatar { @@ -139,5 +141,4 @@ Notification { } } } - } diff --git a/Linphone/view/Control/Popup/NumericPadPopup.qml b/Linphone/view/Control/Popup/NumericPadPopup.qml index 529448e99..c6c431d65 100644 --- a/Linphone/view/Control/Popup/NumericPadPopup.qml +++ b/Linphone/view/Control/Popup/NumericPadPopup.qml @@ -4,16 +4,16 @@ import QtQuick.Layouts as Layout import QtQuick.Effects import Linphone import UtilsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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: Utils.getSizeWithScreenRatio(72) - rightPadding: Utils.getSizeWithScreenRatio(72) - topPadding: Utils.getSizeWithScreenRatio(41) - bottomPadding: Utils.getSizeWithScreenRatio(18) + 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 @@ -21,11 +21,11 @@ Control.Popup { onOpened: numPad.forceActiveFocus() signal buttonPressed(string text) signal keyPadKeyPressed(KeyEvent event) - onKeyPadKeyPressed: (event) => { - numPad.handleKeyPadEvent(event) - } - signal launchCall() - signal wipe() + onKeyPadKeyPressed: event => { + numPad.handleKeyPadEvent(event); + } + signal launchCall + signal wipe background: Item { anchors.fill: parent @@ -34,7 +34,7 @@ Control.Popup { width: parent.width height: parent.height color: DefaultStyle.grey_100 - radius: Utils.getSizeWithScreenRatio(20) + radius: Utils.getSizeWithScreenRatio(20) } MultiEffect { id: effect @@ -62,24 +62,24 @@ Control.Popup { visible: mainItem.closeButtonVisible anchors.top: parent.top anchors.right: parent.right - anchors.topMargin: Utils.getSizeWithScreenRatio(10) - anchors.rightMargin: Utils.getSizeWithScreenRatio(10) + anchors.topMargin: Utils.getSizeWithScreenRatio(10) + anchors.rightMargin: Utils.getSizeWithScreenRatio(10) icon.source: AppIcons.closeX - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) style: ButtonStyle.noBackground onClicked: mainItem.close() //: Close numeric pad Accessible.name: qsTr("close_numeric_pad_accessible_name") } } - contentItem: NumericPad{ + contentItem: NumericPad { id: numPad lastRowVisible: mainItem.lastRowVisible currentCall: mainItem.currentCall - onButtonPressed: (text) => { - mainItem.buttonPressed(text) - } + onButtonPressed: text => { + mainItem.buttonPressed(text); + } onLaunchCall: mainItem.launchCall() onWipe: mainItem.wipe() } diff --git a/Linphone/view/Control/Popup/Popup.qml b/Linphone/view/Control/Popup/Popup.qml index 20cd4f665..89c9ab1ab 100644 --- a/Linphone/view/Control/Popup/Popup.qml +++ b/Linphone/view/Control/Popup/Popup.qml @@ -5,23 +5,23 @@ import Linphone import CustomControls 1.0 import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils -Control.Popup{ +Control.Popup { id: mainItem padding: 0 - property color underlineColor : DefaultStyle.main1_500_main - property real radius: Utils.getSizeWithScreenRatio(16) + property color underlineColor: DefaultStyle.main1_500_main + property real radius: Utils.getSizeWithScreenRatio(16) property bool hovered: mouseArea.containsMouse property bool keyboardFocus: FocusHelper.keyboardFocus - background: Item{ + background: Item { Rectangle { visible: mainItem.underlineColor != undefined width: mainItem.width - height: mainItem.height +Utils.getSizeWithScreenRatio(2) + height: mainItem.height + Utils.getSizeWithScreenRatio(2) color: mainItem.underlineColor radius: mainItem.radius } - Rectangle{ + Rectangle { id: backgroundItem width: mainItem.width height: mainItem.height diff --git a/Linphone/view/Control/Tool/Helper/utils.js b/Linphone/view/Control/Tool/Helper/utils.js index e7e99ed42..45f3d8129 100644 --- a/Linphone/view/Control/Tool/Helper/utils.js +++ b/Linphone/view/Control/Tool/Helper/utils.js @@ -1,180 +1,177 @@ +.pragma library +.import QtQuick as QtQuick +.import Linphone as Linphone + /* - * Copyright (c) 2010-2024 Belledonne Communications SARL. - * - * This file is part of linphone-desktop - * (see https://www.linphone.org). - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +* Copyright (c) 2010-2024 Belledonne Communications SARL. +* +* This file is part of linphone-desktop +* (see https://www.linphone.org). +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ // ============================================================================= // Contains many common helpers. // ============================================================================= -.pragma library - -.import QtQuick as QtQuick -.import Linphone as Linphone - // ============================================================================= // Constants. // ============================================================================= - -var SCHEME_REGEX = new RegExp('^[^:]+:') +var SCHEME_REGEX = new RegExp('^[^:]+:'); // ============================================================================= // QML helpers. // ============================================================================= -function buildCommonDialogUri (component) { - return 'qrc:/ui/modules/Common/Dialog/' + component + '.qml' +function buildCommonDialogUri(component) { + return 'qrc:/ui/modules/Common/Dialog/' + component + '.qml'; } -function buildCommonUri (component, subComponent) { - return 'qrc:/ui/modules/Common/'+subComponent+'/' + component + '.qml' +function buildCommonUri(component, subComponent) { + return 'qrc:/ui/modules/Common/' + subComponent + '/' + component + '.qml'; } -function buildLinphoneDialogUri (component) { - return 'qrc:/ui/modules/Linphone/Dialog/' + component + '.qml' +function buildLinphoneDialogUri(component) { + return 'qrc:/ui/modules/Linphone/Dialog/' + component + '.qml'; } -function buildAppDialogUri (component) { - return 'qrc:/ui/views/App/Dialog/' + component + '.qml' +function buildAppDialogUri(component) { + return 'qrc:/ui/views/App/Dialog/' + component + '.qml'; } // ----------------------------------------------------------------------------- // Destroy timeout. -function clearTimeout (timer) { - timer.stop() // NECESSARY. - timer.destroy() +function clearTimeout(timer) { + timer.stop(); // NECESSARY. + timer.destroy(); } // ----------------------------------------------------------------------------- -function createObject (source, parent, options) { - if (options && options.isString) { - var object = Qt.createQmlObject(source, parent) +function createObject(source, parent, options) { + if (options && options.isString) { + var object = Qt.createQmlObject(source, parent); - var properties = options && options.properties - if (properties) { - for (var key in properties) { - object[key] = properties[key] - } - } + var properties = options && options.properties; + if (properties) { + for (var key in properties) { + object[key] = properties[key]; + } + } - return object - } + return object; + } - var component = Qt.createComponent(source) - if (component.status !== QtQuick.Component.Ready) { - console.debug('Component not ready.') - if (component.status === QtQuick.Component.Error) { - console.debug('Error: ' + component.errorString()) - } - return // Error. - } + var component = Qt.createComponent(source); + if (component.status !== QtQuick.Component.Ready) { + console.debug('Component not ready.'); + if (component.status === QtQuick.Component.Error) { + console.debug('Error: ' + component.errorString()); + } // Error. + return; + } - var object = component.createObject(parent, (options && options.properties) || {}) - if (!object) { - console.debug('Error: unable to create dynamic object.') - } + var object = component.createObject(parent, (options && options.properties) || {}); + if (!object) { + console.debug('Error: unable to create dynamic object.'); + } - return object + return object; } // ----------------------------------------------------------------------------- -function getSystemPathFromUri (uri) { - var str = uri.toString() - if (startsWith(str, 'file://')) { - str = str.substring(7) +function getSystemPathFromUri(uri) { + var str = uri.toString(); + if (startsWith(str, 'file://')) { + str = str.substring(7); - // Absolute path. - if (str.charAt(0) === '/') { - return runOnWindows() ? str.substring(1) : str - } - } + // Absolute path. + if (str.charAt(0) === '/') { + return runOnWindows() ? str.substring(1) : str; + } + } - return str + return str; } -function getUriFromSystemPath (path) { - if (path.startsWith('file://')) { - return path - } +function getUriFromSystemPath(path) { + if (path.startsWith('file://')) { + return path; + } - if (runOnWindows()) { - return 'file://' + (/^\w:/.exec(path) ? '/' : '') + path - } + if (runOnWindows()) { + return 'file://' + (/^\w:/.exec(path) ? '/' : '') + path; + } - return 'file://' + path + return 'file://' + path; } // ----------------------------------------------------------------------------- // Returns the top (root) parent of one object. -function getTopParent (object, useFakeParent) { - function _getTopParent (object, useFakeParent) { - return (useFakeParent && object.$parent) || object.parent - } +function getTopParent(object, useFakeParent) { + function _getTopParent(object, useFakeParent) { + return (useFakeParent && object.$parent) || object.parent; + } - var parent = _getTopParent(object, useFakeParent) - var p - while ((p = _getTopParent(parent, useFakeParent)) != null) { - parent = p - } + var parent = _getTopParent(object, useFakeParent); + var p; + while ((p = _getTopParent(parent, useFakeParent)) != null) { + parent = p; + } - return parent + return parent; } - // ----------------------------------------------------------------------------- // Check that an item is descendant of another one function isDescendant(child, parent) { - var current = child.parent - while (current) { - if (current === parent) - return true - current = current.parent - } - return false + var current = child.parent; + while (current) { + if (current === parent) + return true; + current = current.parent; + } + return false; } // ----------------------------------------------------------------------------- // Retrieve first focusable item of an Item. If no item found, return undefined function getFirstFocusableItemInItem(item) { - var next = item.nextItemInFocusChain(); - if (next && isDescendant(next, item)){ - return next; - } - return undefined; + var next = item.nextItemInFocusChain(); + if (next && isDescendant(next, item)) { + return next; + } + return undefined; } // Retrieve last focusable item of an Item. If no item found, return undefined function getLastFocusableItemInItem(item) { - var next = item.nextItemInFocusChain(); - if(next && !isDescendant(next, item)){ - return undefined; - } - var current - do{ - current = next; - next = current.nextItemInFocusChain(); - } while(isDescendant(next, item) && next.visible && next !== current) - return current; + var next = item.nextItemInFocusChain(); + if (next && !isDescendant(next, item)) { + return undefined; + } + var current; + do { + current = next; + next = current.nextItemInFocusChain(); + } while (isDescendant(next, item) && next.visible && next !== current) + return current; } // ----------------------------------------------------------------------------- @@ -186,43 +183,42 @@ function getLastFocusableItemInItem(item) { // Supported options: isString, exitHandler, properties. // // If exitHandler is used, window must implement exitStatus signal. -function openWindow (window, parent, options, fullscreen) { - var object = createObject(window, parent, options) +function openWindow(window, parent, options, fullscreen) { + var object = createObject(window, parent, options); - object.closing.connect(object.destroy.bind(object)) + object.closing.connect(object.destroy.bind(object)); - if (options && options.exitHandler) { - object.exitStatus.connect( - // Bind to access parent properties. - options.exitHandler.bind(parent) - ) - } - if( runOnWindows()){ - object.show() // Needed for Windows : Show the window in all case. Allow to graphically locate the window before going to fullscreen. - if(fullscreen) - object.showFullScreen()// Should be equivalent to changing visibility - }else if(fullscreen) - object.showFullScreen()// Should be equivalent to changing visibility - else - object.show() - return object + if (options && options.exitHandler) { + object.exitStatus.connect( + // Bind to access parent properties. + options.exitHandler.bind(parent)); + } + if (runOnWindows()) { + object.show( + ); // Needed for Windows : Show the window in all case. Allow to graphically locate the window before going to fullscreen. + if (fullscreen) + object.showFullScreen();// Should be equivalent to changing visibility + } else if (fullscreen) + object.showFullScreen(); + // Should be equivalent to changing visibility + else + object.show(); + return object; } // ----------------------------------------------------------------------------- -function resolveImageUri (name) { - return name - //? 'image://internal/' + removeScheme(Qt.resolvedUrl('/assets/images/' + name + '.svg')) - ? 'image://internal/' + name - : '' +function resolveImageUri(name) { + return name ? + //? 'image://internal/' + removeScheme(Qt.resolvedUrl('/assets/images/' + name + '.svg')) + 'image://internal/' + name : ''; } // ----------------------------------------------------------------------------- - -function runOnWindows () { - var os = Qt.platform.os - return os === 'windows' || os === 'winrt' +function runOnWindows() { + var os = Qt.platform.os; + return os === 'windows' || os === 'winrt'; } // ----------------------------------------------------------------------------- @@ -232,15 +228,11 @@ function runOnWindows () { // `source` is the item that generated the point. // `target` is the item to test. // `point` is the point to test. -function pointIsInItem (source, target, point) { - point = source.mapToItem(target.parent, point.x, point.y) +function pointIsInItem(source, target, point) { + point = source.mapToItem(target.parent, point.x, point.y); - return ( - point.x >= target.x && - point.y >= target.y && - point.x < target.x + target.width && - point.y < target.y + target.height - ) + return (point.x >= target.x && point.y >= target.y && point.x < target.x + target.width && point.y < target.y + + target.height); } // ----------------------------------------------------------------------------- @@ -251,316 +243,309 @@ function pointIsInItem (source, target, point) { // // So, if you want to use it on a specific `className`, please to add // a test in `test_qmlTypeof_data` of `utils.spec.qml`. -function qmlTypeof (object, className) { - var str = object.toString() +function qmlTypeof(object, className) { + var str = object.toString(); - return ( - str.indexOf(className + '(') == 0 || - str.indexOf(className + '_QML') == 0 - ) + return (str.indexOf(className + '(') == 0 || str.indexOf(className + '_QML') == 0); } // ----------------------------------------------------------------------------- -function removeScheme (url) { - return url.toString().replace(SCHEME_REGEX, '') +function removeScheme(url) { + return url.toString().replace(SCHEME_REGEX, ''); } // ----------------------------------------------------------------------------- // A copy of `Window.setTimeout` from js. // delay is in milliseconds. -function setTimeout (parent, delay, cb) { - var timer = new (function (parent) { - return Qt.createQmlObject('import QtQml 2.2; Timer { }', parent) - })(parent) +function setTimeout(parent, delay, cb) { + var timer = new (function (parent) { + return Qt.createQmlObject('import QtQml 2.2; Timer { }', parent); + })(parent); - timer.interval = delay - timer.repeat = false - timer.triggered.connect(cb) - timer.start() + timer.interval = delay; + timer.repeat = false; + timer.triggered.connect(cb); + timer.start(); - return timer + return timer; } // ============================================================================= // GENERIC. // ============================================================================= -function _computeOptimizedCb (func, context) { - return context - ? (function () { - return func.apply(context, arguments) - }) : func +function _computeOptimizedCb(func, context) { + return context ? (function () { + return func.apply(context, arguments); + }) : func; } -function _indexFinder (array, cb, context) { - var length = array.length +function _indexFinder(array, cb, context) { + var length = array.length; - for (var i = 0; i < length; i++) { - if (cb( (array.getAt ? array.getAt(i) : array[i]), i, array)) { - return i - } - } + for (var i = 0; i < length; i++) { + if (cb((array.getAt ? array.getAt(i) : array[i]), i, array)) { + return i; + } + } - return -1 + return -1; } -function _keyFinder (obj, cb, context) { - var keys = Object.keys(obj) - var length = keys.length +function _keyFinder(obj, cb, context) { + var keys = Object.keys(obj); + var length = keys.length; - for (var i = 0; i < length; i++) { - var key = keys[i] - if (cb(obj[key], key, obj)) { - return key - } - } + for (var i = 0; i < length; i++) { + var key = keys[i]; + if (cb(obj[key], key, obj)) { + return key; + } + } } // ----------------------------------------------------------------------------- // Basic assert function. -function assert (condition, message) { - if (!condition) { - throw new Error('Assert: ' + message) - } +function assert(condition, message) { + if (!condition) { + throw new Error('Assert: ' + message); + } } // ----------------------------------------------------------------------------- -function basename (str) { - if (!str) { - return '' - } +function basename(str) { + if (!str) { + return ''; + } - if (runOnWindows()) { - str = str.replace(/\\/g, '/') - } + if (runOnWindows()) { + str = str.replace(/\\/g, '/'); + } - var str2 = str - var length = str2.length - 1 + var str2 = str; + var length = str2.length - 1; - if (str2[length] === '/') { - str2 = str2.substring(0, length) - } + if (str2[length] === '/') { + str2 = str2.substring(0, length); + } - return str2.slice(str2.lastIndexOf('/') + 1) + return str2.slice(str2.lastIndexOf('/') + 1); } // ----------------------------------------------------------------------------- -function capitalizeFirstLetter (str) { - return str.charAt(0).toUpperCase() + str.slice(1) +function capitalizeFirstLetter(str) { + return str.charAt(0).toUpperCase() + str.slice(1); } // ----------------------------------------------------------------------------- -function dirname (str) { - if (!str) { - return '' - } +function dirname(str) { + if (!str) { + return ''; + } - if (runOnWindows()) { - str = str.replace(/\\/g, '/') - } + if (runOnWindows()) { + str = str.replace(/\\/g, '/'); + } - var str2 = str - var length = str2.length - 1 + var str2 = str; + var length = str2.length - 1; - if (str2[length] === '/') { - str2 = str2.substring(0, length) - } + if (str2[length] === '/') { + str2 = str2.substring(0, length); + } - return str2.slice(0, str2.lastIndexOf('/') + 1) + return str2.slice(0, str2.lastIndexOf('/') + 1); } // ----------------------------------------------------------------------------- -function extractProperties (obj, pattern) { - if (!pattern) { - return {} - } +function extractProperties(obj, pattern) { + if (!pattern) { + return {}; + } - var obj2 = {} - pattern.forEach(function (property) { - obj2[property] = obj[property] - }) + var obj2 = {}; + pattern.forEach(function (property) { + obj2[property] = obj[property]; + }); - return obj2 + return obj2; } // ----------------------------------------------------------------------------- // Returns an array from an `object` or `array` argument. -function ensureArray (obj) { - if (isArray(obj)) { - return obj - } +function ensureArray(obj) { + if (isArray(obj)) { + return obj; + } - var keys = Object.keys(obj) - var length = keys.length - var values = Array(length) + var keys = Object.keys(obj); + var length = keys.length; + var values = Array(length); - for (var i = 0; i < length; i++) { - values[i] = obj[keys[i]] - } + for (var i = 0; i < length; i++) { + values[i] = obj[keys[i]]; + } - return values + return values; } // ----------------------------------------------------------------------------- -function escapeQuotes (str) { - return str != null - ? str.replace(/([^'\\]*(?:\\.[^'\\]*)*)'/g, '$1\\\'') - : '' +function escapeQuotes(str) { + return str != null ? str.replace(/([^'\\]*(?:\\.[^'\\]*)*)'/g, '$1\\\'') : ''; } -function decode(str){ - return decodeURIComponent(escape(str.replace(/%([0-9A-Fa-f]{2})/g, function() { - return String.fromCharCode(parseInt(arguments[1], 16)); - }))); +function decode(str) { + return decodeURIComponent(escape(str.replace(/%([0-9A-Fa-f]{2})/g, function () { + return String.fromCharCode(parseInt(arguments[1], 16)); + }))); } // ----------------------------------------------------------------------------- // Get the first matching value in a array or object. // The matching value is obtained if `cb` returns true. -function find (obj, cb, context) { - cb = _computeOptimizedCb(cb, context) +function find(obj, cb, context) { + cb = _computeOptimizedCb(cb, context); - var finder = isArray(obj) ? _indexFinder : _keyFinder - var key = finder(obj, cb, context) + var finder = isArray(obj) ? _indexFinder : _keyFinder; + var key = finder(obj, cb, context); - return key != null && key !== -1 ? obj[key] : null + return key != null && key !== -1 ? obj[key] : null; } // ----------------------------------------------------------------------------- -function findIndex (array, cb, context) { - cb = _computeOptimizedCb(cb, context) +function findIndex(array, cb, context) { + cb = _computeOptimizedCb(cb, context); - var key = _indexFinder(array, cb, context) - return key != null ? key : -1 + var key = _indexFinder(array, cb, context); + return key != null ? key : -1; } // ----------------------------------------------------------------------------- -function formatElapsedTime (seconds) { - seconds = parseInt(seconds, 10) -//s, m, h, d, W, M, Y -//1, 60, 3600, 86400, 604800, 2592000, 31104000 - var y = Math.floor(seconds / 31104000) - if(y > 0) - return y+ ' years' - var M = Math.floor(seconds / 2592000) - if(M > 0) - return M+' months' - var w = Math.floor(seconds / 604800) - if(w>0) - return w+' week'; - var d = Math.floor(seconds / 86400) - if(d>0) - return d+' days' - var h = Math.floor(seconds / 3600) - var m = Math.floor((seconds - h * 3600) / 60) - var s = seconds - h * 3600 - m * 60 - +function formatElapsedTime(seconds) { + seconds = parseInt(seconds, 10); + //s, m, h, d, W, M, Y + //1, 60, 3600, 86400, 604800, 2592000, 31104000 + var y = Math.floor(seconds / 31104000); + if (y > 0) + return y + ' years'; + var M = Math.floor(seconds / 2592000); + if (M > 0) + return M + ' months'; + var w = Math.floor(seconds / 604800); + if (w > 0) + return w + ' week'; + var d = Math.floor(seconds / 86400); + if (d > 0) + return d + ' days'; + var h = Math.floor(seconds / 3600); + var m = Math.floor((seconds - h * 3600) / 60); + var s = seconds - h * 3600 - m * 60; + if (h < 10 && h > 0) { - h = '0' + h + h = '0' + h; } - + if (m < 10) { - m = '0' + m + m = '0' + m; } - + if (s < 10) { - s = '0' + s + s = '0' + s; } - - return (h === 0 ? '' : h + ':') + m + ':' + s + + return (h === 0 ? '' : h + ':') + m + ':' + s; } -function formatDuration (seconds) { - seconds = parseInt(seconds, 10) -//s, m, h, d, W, M, Y -//1, 60, 3600, 86400, 604800, 2592000, 31104000 - var y = Math.floor(seconds / 31104000) - if(y > 0) - //: '%1 year' - return qsTr('formatYears', '', y).arg(y) - var M = Math.floor(seconds / 2592000) - if(M > 0) +function formatDuration(seconds) { + seconds = parseInt(seconds, 10); + //s, m, h, d, W, M, Y + //1, 60, 3600, 86400, 604800, 2592000, 31104000 + var y = Math.floor(seconds / 31104000); + if (y > 0) + //: '%1 year' + return qsTr('formatYears', '', y).arg(y); + var M = Math.floor(seconds / 2592000); + if (M > 0) //: '%1 month' - return qsTr('formatMonths', '', M).arg(M) - var w = Math.floor(seconds / 604800) - if(w>0) + return qsTr('formatMonths', '', M).arg(M); + var w = Math.floor(seconds / 604800); + if (w > 0) //: '%1 week' - return qsTr('formatWeeks', '', w).arg(w) - var d = Math.floor(seconds / 86400) - if(d>0) + return qsTr('formatWeeks', '', w).arg(w); + var d = Math.floor(seconds / 86400); + if (d > 0) //: '%1 day' - return qsTr('formatDays', '', d).arg(d) - var h = Math.floor(seconds / 3600) - var m = Math.floor((seconds - h * 3600) / 60) - var s = seconds - h * 3600 - m * 60 - + return qsTr('formatDays', '', d).arg(d); + var h = Math.floor(seconds / 3600); + var m = Math.floor((seconds - h * 3600) / 60); + var s = seconds - h * 3600 - m * 60; + //: '%1 hour' - return (h > 0 ? qsTr('formatHours', '', h).arg(h): '') - //: '%1 minute' - + (m > 0 ? (h > 0 ? ', ' : '') +qsTr('formatMinutes', '', m).arg(m): '') - //: '%1 second' - + (s > 0 ? (h> 0 || m > 0 ? ', ' : '') +qsTr('formatSeconds', '', s).arg(s): '') + return (h > 0 ? qsTr('formatHours', '', h).arg(h) : '') + + //: '%1 minute' + (m > 0 ? (h > 0 ? ', ' : '') + qsTr('formatMinutes', '', m).arg(m) : '') + + //: '%1 second' + (s > 0 ? (h > 0 || m > 0 ? ', ' : '') + qsTr('formatSeconds', '', s).arg(s) : ''); } -function buildDate(date, time){ - var dateTime = new Date() - dateTime.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()) - dateTime.setHours(time.getHours()) - dateTime.setMinutes(time.getMinutes()) - dateTime.setSeconds(time.getSeconds()) - return dateTime +function buildDate(date, time) { + var dateTime = new Date(); + dateTime.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); + dateTime.setHours(time.getHours()); + dateTime.setMinutes(time.getMinutes()); + dateTime.setSeconds(time.getSeconds()); + return dateTime; } -function equalDate(date1, date2){ - return date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() == date2.getDate() +function equalDate(date1, date2) { + return date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() + == date2.getDate(); } -function fromUTC(date){ - return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), - date.getUTCDate(), date.getUTCHours(), - date.getUTCMinutes(), date.getUTCSeconds())); +function fromUTC(date) { + return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes( + ), date.getUTCSeconds())); } // ----------------------------------------------------------------------------- -function formatSize (size) { - var units = ['KB', 'MB', 'GB', 'TB'] - var unit = 'B' +function formatSize(size) { + var units = ['KB', 'MB', 'GB', 'TB']; + var unit = 'B'; - if (size == null) { - size = 0 - } + if (size == null) { + size = 0; + } - var length = units.length - for (var i = 0; size >= 1024 && i < length; i++) { - unit = units[i] - size /= 1024 - } + var length = units.length; + for (var i = 0; size >= 1024 && i < length; i++) { + unit = units[i]; + size /= 1024; + } - return parseFloat(size.toFixed(2)) + unit + return parseFloat(size.toFixed(2)) + unit; } // ----------------------------------------------------------------------------- // Generate a random number in the [min, max[ interval. // Uniform distrib. -function genRandomNumber (min, max) { - return Math.random() * (max - min) + min +function genRandomNumber(min, max) { + return Math.random() * (max - min) + min; } -function genRandomColor(){ - return '#'+ Math.floor(Math.random()*255).toString(16) - +Math.floor(Math.random()*255).toString(16) - +Math.floor(Math.random()*255).toString(16) +function genRandomColor() { + return '#' + Math.floor(Math.random() * 255).toString(16) + Math.floor(Math.random() * 255).toString(16) + Math.floor( + Math.random() * 255).toString(16); } // ----------------------------------------------------------------------------- @@ -568,265 +553,265 @@ function genRandomColor(){ // Generate a random number between a set of intervals. // The `intervals` param must be orderer like this: // `[ [ 1, 4 ], [ 8, 16 ], [ 22, 25 ] ]` -function genRandomNumberBetweenIntervals (intervals) { - if (intervals.length === 1) { - return genRandomNumber(intervals[0][0], intervals[0][1]) - } +function genRandomNumberBetweenIntervals(intervals) { + if (intervals.length === 1) { + return genRandomNumber(intervals[0][0], intervals[0][1]); + } - // Compute the intervals size. - var size = 0 - intervals.forEach(function (interval) { - size += interval[1] - interval[0] - }) + // Compute the intervals size. + var size = 0; + intervals.forEach(function (interval) { + size += interval[1] - interval[0]; + }); - // Generate a value in the interval: `[0, size[` - var n = genRandomNumber(0, size) + // Generate a value in the interval: `[0, size[` + var n = genRandomNumber(0, size); - // Map the value in the right interval. - n += intervals[0][0] - for (var i = 0; i < intervals.length - 1; i++) { - if (n < intervals[i][1]) { - break - } + // Map the value in the right interval. + n += intervals[0][0]; + for (var i = 0; i < intervals.length - 1; i++) { + if (n < intervals[i][1]) { + break; + } - n += intervals[i + 1][0] - intervals[i][1] - } + n += intervals[i + 1][0] - intervals[i][1]; + } - return n + return n; } // ----------------------------------------------------------------------------- // Returns the extension of a filename. -function getExtension (str) { - var index = str.lastIndexOf('.') +function getExtension(str) { + var index = str.lastIndexOf('.'); - if (index === -1) { - return '' - } + if (index === -1) { + return ''; + } - return str.slice(index + 1) + return str.slice(index + 1); } // ----------------------------------------------------------------------------- // Test if a value is included in an array or object. -function includes (obj, value, startIndex) { - obj = ensureArray(obj) - if (startIndex == null) { - startIndex = 0 - } - var length = obj.length +function includes(obj, value, startIndex) { + obj = ensureArray(obj); + if (startIndex == null) { + startIndex = 0; + } + var length = obj.length; - for (var i = startIndex; i < length; i++) { - if ( - value == obj[i] || - // Check `NaN`. - (value !== value && obj[i] !== obj[i]) - ) { - return true - } - } - return false + for (var i = startIndex; i < length; i++) { + if (value == obj[i] || + // Check `NaN`. + (value !== value && obj[i] !== obj[i])) { + return true; + } + } + return false; } // ----------------------------------------------------------------------------- -function isArray (array) { - return (array instanceof Array) +function isArray(array) { + return (array instanceof Array); } // ----------------------------------------------------------------------------- -function isFunction (func) { - return typeof func === 'function' +function isFunction(func) { + return typeof func === 'function'; } // ----------------------------------------------------------------------------- -function isInteger (integer) { - return integer === parseInt(integer, 10) +function isInteger(integer) { + return integer === parseInt(integer, 10); } // ----------------------------------------------------------------------------- -function isObject (object) { - return object !== null && typeof object === 'object' +function isObject(object) { + return object !== null && typeof object === 'object'; } // ----------------------------------------------------------------------------- -function isString (string) { - return typeof string === 'string' || string instanceof String +function isString(string) { + return typeof string === 'string' || string instanceof String; } // ----------------------------------------------------------------------------- // Convert a snake_case string to a lowerCamelCase string. -function snakeToCamel (s) { - return s.replace(/(\_\w)/g, function (matches) { - return matches[1].toUpperCase() - }) +function snakeToCamel(s) { + return s.replace(/(\_\w)/g, function (matches) { + return matches[1].toUpperCase(); + }); } // ----------------------------------------------------------------------------- // Test if a string starts by a given string. -function startsWith (str, searchStr) { - if (searchStr == null) { - searchStr = '' - } +function startsWith(str, searchStr) { + if (searchStr == null) { + searchStr = ''; + } - return str.slice(0, searchStr.length) === searchStr + return str.slice(0, searchStr.length) === searchStr; } // ----------------------------------------------------------------------------- // Invoke a `cb` function with each value of the interval: `[0, n[`. // Return a mapped array created with the returned values of `cb`. -function times (n, cb, context) { - var arr = Array(Math.max(0, n)) - cb = _computeOptimizedCb(cb, context, 1) +function times(n, cb, context) { + var arr = Array(Math.max(0, n)); + cb = _computeOptimizedCb(cb, context, 1); - for (var i = 0; i < n; i++) { - arr[i] = cb(i) - } + for (var i = 0; i < n; i++) { + arr[i] = cb(i); + } - return arr + return arr; } // ----------------------------------------------------------------------------- -function unscapeHtml (str) { - return str.replace(/&/g, '&') - .replace(//g, '\u2063>') - .replace(/"/g, '"') - .replace(/'/g, ''') +function unscapeHtml(str) { + return str.replace(/&/g, '&').replace(//g, '\u2063>').replace(/"/g, '"').replace(/'/g, + '''); } // ----------------------------------------------------------------------------- -function write (fileName, text) { - // TODO: Deal with async. - var request = new XMLHttpRequest() - request.open('PUT', getUriFromSystemPath(fileName), false) - request.send(text) +function write(fileName, text) { + // TODO: Deal with async. + var request = new XMLHttpRequest(); + request.open('PUT', getUriFromSystemPath(fileName), false); + request.send(text); } -function computeAvatarSize (container, maxSize, ratio) { - var height = container.height * ratio - var width = container.width * ratio - var size = height < maxSize && height > 0 ? height : maxSize - return size < width ? size : width +function computeAvatarSize(container, maxSize, ratio) { + var height = container.height * ratio; + var width = container.width * ratio; + var size = height < maxSize && height > 0 ? height : maxSize; + return size < width ? size : width; } // ----------------------------------------------------------------------------- -function openCodecOnlineInstallerDialog (mainWindow, coreObject, cancelCallBack, successCallBack, errorCallBack) { +function openCodecOnlineInstallerDialog(mainWindow, coreObject, cancelCallBack, successCallBack, errorCallBack) { mainWindow.showConfirmationLambdaPopup("", - //: "Installation de codec" - qsTr("codec_install"), - //: "Télécharger le codec %1 (%2) ?" - qsTr("download_codec").arg(capitalizeFirstLetter(coreObject.mimeType)).arg(coreObject.encoderDescription), - function (confirmed) { - if (confirmed) { - coreObject.loaded.connect(function(success) { - mainWindow.closeLoadingPopup() - if (success) { - //: "Succès" - mainWindow.showInformationPopup(qsTr("information_popup_success_title"), - //: "Le codec a été installé avec succès." - qsTr("information_popup_codec_install_success_text"), true) - if (successCallBack) - successCallBack() - } else { - mainWindow.showInformationPopup(qsTr("information_popup_error_title"), - //: "Le codec n'a pas pu être installé." - qsTr("information_popup_codec_install_error_text"), false) - if (errorCallBack) - errorCallBack() - } - }) - coreObject.extractError.connect(function() { - mainWindow.closeLoadingPopup() - mainWindow.showInformationPopup(qsTr("information_popup_error_title"), - //: "Le codec n'a pas pu être sauvegardé." - qsTr("information_popup_codec_save_error_text"), false) - if (errorCallBack) - errorCallBack() - }) - coreObject.downloadError.connect(function() { - mainWindow.closeLoadingPopup() - mainWindow.showInformationPopup(qsTr("information_popup_error_title"), - //: "Le codec n'a pas pu être téléchargé." - qsTr("information_popup_codec_download_error_text"), false) - if (errorCallBack) - errorCallBack() - }) + //: "Installation de codec" + qsTr("codec_install"), + //: "Télécharger le codec %1 (%2) ?" + qsTr("download_codec").arg(capitalizeFirstLetter(coreObject.mimeType)).arg(coreObject.encoderDescription), + function (confirmed) { + if (confirmed) { + coreObject.loaded.connect(function (success) { + mainWindow.closeLoadingPopup(); + if (success) { + //: "Succès" + mainWindow.showInformationPopup(qsTr("information_popup_success_title"), + //: "Le codec a été installé avec succès." + qsTr("information_popup_codec_install_success_text"), true); + if (successCallBack) + successCallBack(); + } else { + mainWindow.showInformationPopup(qsTr("information_popup_error_title"), + //: "Le codec n'a pas pu être installé." + qsTr("information_popup_codec_install_error_text"), false); + if (errorCallBack) + errorCallBack(); + } + }); + coreObject.extractError.connect(function () { + mainWindow.closeLoadingPopup(); + mainWindow.showInformationPopup(qsTr("information_popup_error_title"), + //: "Le codec n'a pas pu être sauvegardé." + qsTr("information_popup_codec_save_error_text"), false); + if (errorCallBack) + errorCallBack(); + }); + coreObject.downloadError.connect(function () { + mainWindow.closeLoadingPopup(); + mainWindow.showInformationPopup(qsTr("information_popup_error_title"), + //: "Le codec n'a pas pu être téléchargé." + qsTr("information_popup_codec_download_error_text"), false); + if (errorCallBack) + errorCallBack(); + }); - //: "Téléchargement en cours …" - mainWindow.showLoadingPopup(qsTr("loading_popup_codec_install_progress")) - coreObject.downloadAndExtract() - } else - if (cancelCallBack) - cancelCallBack() - } - ) + //: "Téléchargement en cours …" + mainWindow.showLoadingPopup(qsTr("loading_popup_codec_install_progress")); + coreObject.downloadAndExtract(); + } else if (cancelCallBack) + cancelCallBack(); + }); } function printObject(o) { - var out = ''; - for (var p in o) { - out += p + ': ' + o[p] + '\n'; - } - if(!o) - return 'Empty' - else - return out; + var out = ''; + for (var p in o) { + out += p + ': ' + o[p] + '\n'; + } + if (!o) + return 'Empty'; + else + return out; } function equalObject(a, b) { var countA = 0, countB = 0; - if(a == b) return true // operator could be performed - for (var i in a) {// Check for all members - if(a[i] != b[i]) return false - else ++countA + if (a == b) + return true; // operator could be performed + for (var i in a) { + // Check for all members + if (a[i] != b[i]) + return false; + else + ++countA; } - for (var j in b) {// Check count - ++countB + for (var j in b) { + // Check count + ++countB; } - return countB == countA && countA > 0 // if count=0; then the first '==' should already worked + return countB == countA && countA > 0; // if count=0; then the first '==' should already worked } function infoDialog(window, message) { window.attachVirtualWindow(buildCommonDialogUri('ConfirmDialog'), { - buttonTexts : ['',qsTr('okButton')], - descriptionText: message, - showButtonOnly: 1 - }, function (status) {}) + buttonTexts: ['', qsTr('okButton')], + descriptionText: message, + showButtonOnly: 1 + }, function (status) {}); } // Ensure that the item is visible in the view -function ensureVisibleY(item, view){ - const itemPosition = item.mapToItem(view, 0, 0) +function ensureVisibleY(item, view) { + const itemPosition = item.mapToItem(view, 0, 0); - if (itemPosition.y < 0){ - view.contentY = view.contentY + itemPosition.y - } else if (itemPosition.y + item.height > view.height){ - view.contentY = itemPosition.y + view.contentY + item.height - view.height - } + if (itemPosition.y < 0) { + view.contentY = view.contentY + itemPosition.y; + } else if (itemPosition.y + item.height > view.height) { + view.contentY = itemPosition.y + view.contentY + item.height - view.height; + } } // Set position of list.currentItem into the scrollItem -function updatePosition(scrollItem, list){ - if(scrollItem.height == 0) return; - var item = list.itemAtIndex(list.currentIndex) - var centerItemPos = 0 - var topItemPos = 0 - var bottomItemPos = 0 - if(!item) item = list.currentItem - if( item && (list.expanded || list.expanded == undefined)){ +function updatePosition(scrollItem, list) { + if (scrollItem.height == 0) + return; + var item = list.itemAtIndex(list.currentIndex); + var centerItemPos = 0; + var topItemPos = 0; + var bottomItemPos = 0; + if (!item) + item = list.currentItem; + if (item && (list.expanded || list.expanded == undefined)) { // For debugging just in case //var listPosition = item.mapToItem(favoriteList, item.x, item.y) //var newPosition = favoriteList.mapToItem(mainItem, listPosition.x, listPosition.y) @@ -842,49 +827,46 @@ function updatePosition(scrollItem, list){ // Middle position //centerItemPos = item.y + list.y + item.height/2 //if( list.headerHeight) centerItemPos += list.headerHeight - topItemPos = item.y - if( list != scrollItem) topItemPos += list.y - if( list.headerHeight) topItemPos += list.headerHeight - bottomItemPos = topItemPos +item.height + topItemPos = item.y; + if (list != scrollItem) + topItemPos += list.y; + if (list.headerHeight) + topItemPos += list.headerHeight; + bottomItemPos = topItemPos + item.height; } - if(item){ + if (item) { // Middle position //var centerPos = centerItemPos - scrollItem.height/2 //scrollItem.contentY = Math.max(0, Math.min(centerPos, scrollItem.height, scrollItem.contentHeight-scrollItem.height)) // Visible position - if( topItemPos < scrollItem.contentY){ + if (topItemPos < scrollItem.contentY) { // Display item at the beginning - scrollItem.contentY = topItemPos + scrollItem.contentY = topItemPos; //console.debug("Set to top", scrollItem.contentY,topItemPos, item.height) - }else if(bottomItemPos > scrollItem.contentY + scrollItem.height){ + } else if (bottomItemPos > scrollItem.contentY + scrollItem.height) { // Display item at the end - scrollItem.contentY = bottomItemPos - scrollItem.height + scrollItem.contentY = bottomItemPos - scrollItem.height; //console.debug("Set to bottom",scrollItem.contentY,list.y,list.headerHeight, topItemPos, bottomItemPos, scrollItem.height, bottomItemPos - scrollItem.height, item.height) - }else{ + } else //console.debug("Inside, do not move", topItemPos, bottomItemPos, scrollItem.contentY, (scrollItem.contentY + scrollItem.height)) - } - - }else{ - // console.debug("Item is null") - } + {} + } else + // console.debug("Item is null") + {} } // Transform svg file to unicode emoji function codepointFromFilename(filename) { - let baseName = filename.split('.')[0]; - let parts = baseName.replace(/_/g, '-').split('-'); - let codePoints = parts.map(hex => parseInt(hex, 16)); - var unicode = String.fromCodePoint(...codePoints); - return unicode; + let baseName = filename.split('.')[0]; + let parts = baseName.replace(/_/g, '-').split('-'); + let codePoints = parts.map(hex => parseInt(hex, 16)); + var unicode = String.fromCodePoint(...codePoints); + return unicode; } - // ----------------------------------------------------------------------------- -function getSizeWithScreenRatio(size){ - return (size == 0) - ? 0 - : size > 0 - ? Math.max(Math.round(size * Linphone.DefaultStyle.dp), 1) - : Math.min(Math.round(size * Linphone.DefaultStyle.dp), -1); +function getSizeWithScreenRatio(size) { + return (size == 0) ? 0 : size > 0 ? Math.max(Math.round(size * Linphone.DefaultStyle.dp), 1) : Math.min(Math.round( + size * Linphone.DefaultStyle.dp), -1); } diff --git a/Linphone/view/Control/Tool/MovableMouseArea.qml b/Linphone/view/Control/Tool/MovableMouseArea.qml index 71ba801e3..4525a080f 100644 --- a/Linphone/view/Control/Tool/MovableMouseArea.qml +++ b/Linphone/view/Control/Tool/MovableMouseArea.qml @@ -1,80 +1,83 @@ import QtQuick -MouseArea{ +MouseArea { id: mainItem property var movableArea: mainItem.Window.contentItem - - signal requestResetPosition() - + + signal requestResetPosition + property bool dragging: drag.active onDraggingChanged: { - if(dragging){ - xClicked = mouseX - yClicked = mouseY + if (dragging) { + xClicked = mouseX; + yClicked = mouseY; } } - property real margin: 0 -// Position buffer - property int xClicked : 0 - property int yClicked : 0 -// Scaling buffer + property real margin: 0 + // Position buffer + property int xClicked: 0 + property int yClicked: 0 + // Scaling buffer property int heightOrigin property int widthOrigin property double startTime: 0 // For acceleration computation to avoid excessive wheel scrolling property double mScale: 1.0 // Using scale reduce quality. Apply our factor. - property bool scaled : false // Zoom state : -for storing origin state ; -for resetting scale on right click. In this case, second click lead to emit reset signal instead of first.. - + property bool scaled: + false // Zoom state : -for storing origin state ; -for resetting scale on right click. In this case, second click lead to emit reset signal instead of first.. + acceptedButtons: Qt.LeftButton | Qt.RightButton // Left is for Dragging. Right is for resetting. Wheel will scale. cursorShape: dragging ? Qt.DragMoveCursor : undefined preventStealing: true propagateComposedEvents: true hoverEnabled: true - - function updateScale(){// Avoid scaling if leading outside movableArea. - drag.target.height = Math.max(0, Math.min(movableArea.height, heightOrigin * mScale)) - drag.target.width = Math.max(0, Math.min(movableArea.width, widthOrigin * mScale)) - updatePosition(0,0) + + function updateScale() {// Avoid scaling if leading outside movableArea. + drag.target.height = Math.max(0, Math.min(movableArea.height, heightOrigin * mScale)); + drag.target.width = Math.max(0, Math.min(movableArea.width, widthOrigin * mScale)); + updatePosition(0, 0); } - function updatePosition(x, y){// Avoid moving outside movableArea. + function updatePosition(x, y) {// Avoid moving outside movableArea. var parentTLBounds = drag.target.parent.mapFromItem(movableArea, 0, 0); var parentBRBounds = drag.target.parent.mapFromItem(movableArea, movableArea.width, movableArea.height); - drag.target.x = Math.max(parentTLBounds.x + margin, Math.min(parentBRBounds.x - drag.target.width - margin, drag.target.x + x - margin)) - drag.target.y = Math.max(parentTLBounds.y + margin, Math.min(parentBRBounds.y - drag.target.height - margin, drag.target.y + y - margin)) + drag.target.x = Math.max(parentTLBounds.x + margin, Math.min(parentBRBounds.x - drag.target.width - margin, + drag.target.x + x - margin)); + drag.target.y = Math.max(parentTLBounds.y + margin, Math.min(parentBRBounds.y - drag.target.height - margin, + drag.target.y + y - margin)); } onMScaleChanged: updateScale() - onPositionChanged: (mouse) => { - if(dragging){ - updatePosition(mouse.x - xClicked, mouse.y - yClicked) - } - mouse.accepted = false - } - onWheel: (wheel) => { - if(!scaled){ - scaled = true - heightOrigin = drag.target.height - widthOrigin = drag.target.width - } - var acceleration = 0.01; // Try to make smoother the scaling from wheel - if(startTime == 0){ - startTime = new Date().getTime(); - }else{ - var delay = new Date().getTime() - startTime; - if(delay > 0) - acceleration = Math.max(0.01, Math.min(1, 4/delay)); - else - acceleration = 1 - } - mScale = Math.max(0.5 , mScale * ( 1 + acceleration*(wheel.angleDelta.y >0 ? 1 : -1) )); - startTime = new Date().getTime(); - } - onClicked: (mouse) => { - if(mouse.button == Qt.RightButton){ - if(scaled) { - scaled = false - mScale = 1.0 - }else - requestResetPosition() - } - mouse.accepted = false - } + onPositionChanged: mouse => { + if (dragging) { + updatePosition(mouse.x - xClicked, mouse.y - yClicked); + } + mouse.accepted = false; + } + onWheel: wheel => { + if (!scaled) { + scaled = true; + heightOrigin = drag.target.height; + widthOrigin = drag.target.width; + } + var acceleration = 0.01; // Try to make smoother the scaling from wheel + if (startTime == 0) { + startTime = new Date().getTime(); + } else { + var delay = new Date().getTime() - startTime; + if (delay > 0) + acceleration = Math.max(0.01, Math.min(1, 4 / delay)); + else + acceleration = 1; + } + mScale = Math.max(0.5, mScale * (1 + acceleration * (wheel.angleDelta.y > 0 ? 1 : -1))); + startTime = new Date().getTime(); + } + onClicked: mouse => { + if (mouse.button == Qt.RightButton) { + if (scaled) { + scaled = false; + mScale = 1.0; + } else + requestResetPosition(); + } + mouse.accepted = false; + } } diff --git a/Linphone/view/Control/Tool/Prototype/AccountsPrototype.qml b/Linphone/view/Control/Tool/Prototype/AccountsPrototype.qml index 7bf2e69d6..b9f5fea0d 100644 --- a/Linphone/view/Control/Tool/Prototype/AccountsPrototype.qml +++ b/Linphone/view/Control/Tool/Prototype/AccountsPrototype.qml @@ -6,64 +6,61 @@ import UtilsCpp 1.0 // Snippet -ListView{ +ListView { id: mainItem model: AccountProxy {} function printObject(o) { - var out = ''; - for (var p in o) { - out += p + ': ' + o[p] + '\n'; - } - if(!o) - return 'Empty' - else - return out; -} + var out = ''; + for (var p in o) { + out += p + ': ' + o[p] + '\n'; + } + if (!o) + return 'Empty'; + else + return out; + } - delegate: Rectangle{ + delegate: Rectangle { height: 50 width: mainItem.width - RowLayout{ + RowLayout { anchors.fill: parent - Rectangle{ + Rectangle { Layout.preferredHeight: 50 Layout.preferredWidth: 50 //color: '#111111' - Image{ + Image { id: avatar anchors.fill: parent source: $modelData.pictureUri } } - Text{ + Text { // Store the VariantObject and use value on this object. Do not use value in one line because of looping signals. property var displayName: UtilsCpp.getDisplayName($modelData.identityAddress) text: displayName ? displayName.value : "" - onTextChanged: console.log("[ProtoAccounts] Async account displayName: " +$modelData.identityAddress + " => " +text) + onTextChanged: console.log("[ProtoAccounts] Async account displayName: " + $modelData.identityAddress + " => " + + text) } - Text{ - text: $modelData.registrationState == LinphoneEnums.RegistrationState.Ok - ? 'Online' - : $modelData.registrationState == LinphoneEnums.RegistrationState.Failed - ? 'Error' - : $modelData.registrationState == LinphoneEnums.RegistrationState.Progress || $modelData.registrationState == LinphoneEnums.RegistrationState.Refreshing - ? 'Connecting' - : 'Offline' - + Text { + text: $modelData.registrationState == LinphoneEnums.RegistrationState.Ok ? 'Online' : $modelData.registrationState + == LinphoneEnums.RegistrationState.Failed ? 'Error' : $modelData.registrationState + == LinphoneEnums.RegistrationState.Progress || $modelData.registrationState + == LinphoneEnums.RegistrationState.Refreshing ? 'Connecting' : 'Offline' } } - MouseArea{ + MouseArea { anchors.fill: parent - property int clickCount : 0 + property int clickCount: 0 onClicked: { - if(++clickCount % 2 == 0) + if (++clickCount % 2 == 0) $modelData.pictureUri = AppIcons.loginImage; else $modelData.pictureUri = AppIcons.eyeShow; - console.log(printObject($modelData)) - console.debug("[ProtoAccounts] Account Select: " +$modelData.contactAddress +" / "+$modelData.identityAddress + " / " +$modelData.pictureUri + " / " +$modelData.registrationState) + console.log(printObject($modelData)); + console.debug("[ProtoAccounts] Account Select: " + $modelData.contactAddress + " / " + $modelData.identityAddress + + " / " + $modelData.pictureUri + " / " + $modelData.registrationState); } } } } - diff --git a/Linphone/view/Control/Tool/Prototype/CallPrototype.qml b/Linphone/view/Control/Tool/Prototype/CallPrototype.qml index 95b902a01..06a14b4de 100644 --- a/Linphone/view/Control/Tool/Prototype/CallPrototype.qml +++ b/Linphone/view/Control/Tool/Prototype/CallPrototype.qml @@ -14,172 +14,170 @@ Window { property var call property var callState: call && call.core.state onCallStateChanged: { - console.log("State:" +callState) - if(callState == LinphoneEnums.CallState.Released) - callVarObject = undefined - } + console.log("State:" + callState); + if (callState == LinphoneEnums.CallState.Released) + callVarObject = undefined; + } visible: true - onCallChanged: console.log('New Call:' +call) + onCallChanged: console.log('New Call:' + call) onClosing: { - accountStatus.defaultAccount = accountStatus - gc() + accountStatus.defaultAccount = accountStatus; + gc(); } Component.onDestruction: gc() - Connections{ + Connections { target: call && call.core || null - function onLastErrorMessageChanged() { if(mainItem.call) errorMessageText.text=mainItem.call.core.lastErrorMessage} + function onLastErrorMessageChanged() { + if (mainItem.call) + errorMessageText.text = mainItem.call.core.lastErrorMessage; + } } - RowLayout{ + RowLayout { anchors.fill: parent - Rectangle{ + Rectangle { Layout.fillHeight: true Layout.preferredWidth: 200 color: 'gray' opacity: 0.2 - ListView{ + ListView { id: callList anchors.fill: parent model: CallProxy { id: callProxy - onCountChanged: console.log("count:"+count) + onCountChanged: console.log("count:" + count) } - delegate: RectangleTest{ + delegate: RectangleTest { height: 40 width: callList.width - Text{ + Text { id: addressText anchors.fill: parent text: modelData.core.remoteAddress onTextChanged: console.log(addressText.text) Component.onCompleted: console.log(addressText.text) } - MouseArea{ + MouseArea { anchors.fill: parent onClicked: { //modelData.core.lSetPaused(false) - callProxy.currentCall = modelData + callProxy.currentCall = modelData; } } } } } - ColumnLayout{ + ColumnLayout { Layout.fillWidth: true Layout.fillHeight: true RowLayout { id: accountLayout Layout.fillWidth: true - property AccountProxy accounts: AccountProxy {id: accountProxy} + property AccountProxy accounts: AccountProxy { + id: accountProxy + } property var haveAccountVar: UtilsCpp.haveAccount() property var haveAccount: haveAccountVar ? haveAccountVar.value : false onHaveAccountChanged: { - console.log("HaveAccount: " +haveAccount) - logStack.replace(haveAccount ? accountListComponent : loginComponent) + console.log("HaveAccount: " + haveAccount); + logStack.replace(haveAccount ? accountListComponent : loginComponent); } - Control.StackView{ + Control.StackView { id: logStack Layout.preferredHeight: 250 Layout.preferredWidth: 250 //initialItem: loginComponent } - Component{ - id: accountListComponent - ListView{ - id: accountList - Layout.fillHeight: true - model: AccountProxy {} - delegate:Rectangle{ - color: "#11111111" - height: 20 - width: accountList.width - Text{ - text: modelData.core.identityAddress - } + Component { + id: accountListComponent + ListView { + id: accountList + Layout.fillHeight: true + model: AccountProxy {} + delegate: Rectangle { + color: "#11111111" + height: 20 + width: accountList.width + Text { + text: modelData.core.identityAddress } } } - Component{ - id: loginComponent - LoginForm{} - } - Rectangle{ + } + Component { + id: loginComponent + LoginForm {} + } + Rectangle { id: accountStatus Layout.preferredWidth: 50 Layout.preferredHeight: 50 property int accountCount: accountProxy.count - onAccountCountChanged: console.log("AccountCount:"+accountCount) + onAccountCountChanged: console.log("AccountCount:" + accountCount) property var defaultAccount: accountProxy.defaultAccount - onDefaultAccountChanged: console.log("DefaultAccount:"+defaultAccount) - property var state: accountProxy.count > 0 && defaultAccount? defaultAccount.core.registrationState : LoginPageCpp.registrationState - onStateChanged: console.log("State:"+state) - - color: state === LinphoneEnums.RegistrationState.Ok - ? 'green' - : state === LinphoneEnums.RegistrationState.Failed || state === LinphoneEnums.RegistrationState.None - ? 'red' - : 'orange' - MouseArea{ + onDefaultAccountChanged: console.log("DefaultAccount:" + defaultAccount) + property var state: accountProxy.count > 0 && defaultAccount ? defaultAccount.core.registrationState : + LoginPageCpp.registrationState + onStateChanged: console.log("State:" + state) + + color: state === LinphoneEnums.RegistrationState.Ok ? 'green' : state === LinphoneEnums.RegistrationState.Failed + || state === LinphoneEnums.RegistrationState.None ? 'red' : 'orange' + MouseArea { anchors.fill: parent - onClicked:{ - logStack.replace(loginComponent) - gc() + onClicked: { + logStack.replace(loginComponent); + gc(); } } } TextField { id: usernameToCall label: "Username to call" - Layout.preferredWidth: Utils.getSizeWithScreenRatio(250) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(250) } - Button{ + Button { text: 'Call' onClicked: { - var address = usernameToCall.text + "@sip.linphone.org" - console.log("Calling "+address) - UtilsCpp.createCall(address) - proto.component1 = comp + var address = usernameToCall.text + "@sip.linphone.org"; + console.log("Calling " + address); + UtilsCpp.createCall(address); + proto.component1 = comp; } } } - - Rectangle{ + + Rectangle { Layout.fillWidth: true Layout.preferredHeight: 50 - color: call - ? call.core.state === LinphoneEnums.CallState.StreamsRunning - ? 'green' - : call.core.state === LinphoneEnums.CallState.Released - ? 'pink' - : 'orange' - : 'red' - Rectangle{ + color: call ? call.core.state === LinphoneEnums.CallState.StreamsRunning ? 'green' : call.core.state + === LinphoneEnums.CallState.Released ? 'pink' : 'orange' : 'red' + Rectangle { anchors.centerIn: parent color: 'white' width: stateText.contentWidth height: stateText.contentHeight - Text{ + Text { id: stateText - text: "State:"+(mainItem.callState ? mainItem.callState : 'None') + text: "State:" + (mainItem.callState ? mainItem.callState : 'None') } } } - Text{ + Text { id: errorMessageText color: 'red' } - ItemPrototype{ + ItemPrototype { id: proto Layout.fillHeight: true Layout.fillWidth: true } - Item{ + Item { Layout.fillHeight: true Layout.fillWidth: true } } - Component{ + Component { id: comp - Rectangle{ + Rectangle { width: 100 height: width color: 'pink' @@ -187,4 +185,3 @@ Window { } } } - diff --git a/Linphone/view/Control/Tool/Prototype/CameraPrototype.qml b/Linphone/view/Control/Tool/Prototype/CameraPrototype.qml index f6b29d821..eee19a6f8 100644 --- a/Linphone/view/Control/Tool/Prototype/CameraPrototype.qml +++ b/Linphone/view/Control/Tool/Prototype/CameraPrototype.qml @@ -4,76 +4,79 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp 1.0 -Window{ +Window { id: mainItem height: 400 width: 800 visible: true - Rectangle{ + Rectangle { anchors.centerIn: parent height: 300 width: 200 color: 'gray' - Avatar{ + Avatar { anchors.centerIn: parent height: 100 width: height _address: 'sip:jul@toto.com' } - Loader{ + Loader { id: cameraLoader anchors.fill: parent - Timer{ + Timer { id: resetTimer interval: 1 - onTriggered: {cameraLoader.active=false; cameraLoader.active=true;} + onTriggered: { + cameraLoader.active = false; + cameraLoader.active = true; + } } active: true sourceComponent: cameraComponent } - Component{ + Component { id: cameraComponent - Rectangle{ + Rectangle { height: cameraLoader.height width: cameraLoader.width color: 'red' - CameraGui{ + CameraGui { id: cameraItem anchors.fill: parent visible: isReady - onVisibleChanged: console.log('Ready?'+visible) - + onVisibleChanged: console.log('Ready?' + visible) + onRequestNewRenderer: { - console.log("Request new renderer") - resetTimer.restart() + console.log("Request new renderer"); + resetTimer.restart(); } } } } } - + /* Control.StackView{ - id: stackView - anchors.fill: parent - initialItem: cameraComponent - - Component{ - id: avatarComponent - Avatar{ - } - } - Component{ - id: cameraComponent - CameraGui{ - id: cameraItem - onRequestNewRenderer: { - console.log("Request new renderer") - stackView.replace(cameraComponent, Control.StackView.Immediate) - - } - } - } + id: stackView + anchors.fill: parent + initialItem: cameraComponent + + Component{ + id: avatarComponent + Avatar{ + } + } + Component{ + id: cameraComponent + CameraGui{ + id: cameraItem + onRequestNewRenderer: { + console.log("Request new renderer") + stackView.replace(cameraComponent, Control.StackView.Immediate) + + } + } + } } */ } diff --git a/Linphone/view/Control/Tool/Prototype/CanvasCircle.qml b/Linphone/view/Control/Tool/Prototype/CanvasCircle.qml index 922160c20..0e460f929 100644 --- a/Linphone/view/Control/Tool/Prototype/CanvasCircle.qml +++ b/Linphone/view/Control/Tool/Prototype/CanvasCircle.qml @@ -1,56 +1,57 @@ import QtQuick Item { - id: root - property real size: 150 - property color borderColor - property color innerColor - width: size - height: size + id: root + property real size: 150 + property color borderColor + property color innerColor + width: size + height: size onBorderColorChanged: c.requestPaint() function requestPaint(animated) { - c.animated = animated - if (animated) animationTimer.restart() + c.animated = animated; + if (animated) + animationTimer.restart(); else { - animationTimer.stop() - c.requestPaint() + animationTimer.stop(); + c.requestPaint(); } } - Canvas { - id: c + Canvas { + id: c property bool animated: false - property real offset: 0 - anchors.fill: parent - antialiasing: true - onOffsetChanged: requestPaint() + property real offset: 0 + anchors.fill: parent + antialiasing: true + onOffsetChanged: requestPaint() Timer { id: animationTimer interval: 200 repeat: true - onTriggered: c.offset = (c.offset + 1)%360 + onTriggered: c.offset = (c.offset + 1) % 360 } - onPaint: { - var ctx = getContext("2d"); - ctx.reset() + onPaint: { + var ctx = getContext("2d"); + ctx.reset(); ctx.setLineDash([3, 2]); ctx.lineWidth = 2; ctx.lineDashOffset = offset; - var x = root.width / 2; - var y = root.height / 2; + var x = root.width / 2; + var y = root.height / 2; - var radius = root.size / 2 - var startAngle = (Math.PI / 180) * 270; - var fullAngle = (Math.PI / 180) * (270 + 360); + var radius = root.size / 2; + var startAngle = (Math.PI / 180) * 270; + var fullAngle = (Math.PI / 180) * (270 + 360); - ctx.strokeStyle = root.borderColor; - ctx.fillStyle = root.innerColor; - ctx.beginPath(); + ctx.strokeStyle = root.borderColor; + ctx.fillStyle = root.innerColor; + ctx.beginPath(); ctx.arc(x, y, radius - 1, 0, 2 * Math.PI); ctx.fill(); if (animated) { diff --git a/Linphone/view/Control/Tool/Prototype/FriendPrototype.qml b/Linphone/view/Control/Tool/Prototype/FriendPrototype.qml index 01a284580..a833f5b00 100644 --- a/Linphone/view/Control/Tool/Prototype/FriendPrototype.qml +++ b/Linphone/view/Control/Tool/Prototype/FriendPrototype.qml @@ -5,23 +5,23 @@ import Linphone import UtilsCpp 1.0 // Snippet -Window{ +Window { id: mainItem height: 800 width: 1000 visible: true - ColumnLayout{ + ColumnLayout { anchors.fill: parent - RowLayout{ - FriendGui{ + RowLayout { + FriendGui { id: contact } - TextField{ + TextField { placeholderText: 'Name' initialText: contact.core.givenName - onTextChanged: contact.core.givenName = text + onTextChanged: contact.core.givenName = text } - TextField{ + TextField { placeholderText: 'Address' initialText: contact.core.address onTextChanged: contact.core.address = text @@ -29,61 +29,61 @@ Window{ Button { text: 'Create' onClicked: { - contact.core.save() + contact.core.save(); } } Text { - text: 'IsSaved:'+contact.core.isSaved + text: 'IsSaved:' + contact.core.isSaved } } - ListView{ + ListView { id: friends Layout.fillHeight: true Layout.fillWidth: true onCountChanged: console.log("count changed", count) - - model: MagicSearchProxy{ + + model: MagicSearchProxy { id: search filterText: '' } - delegate: Rectangle{ + delegate: Rectangle { height: 50 width: friends.width - RowLayout{ + RowLayout { anchors.fill: parent - Text{ + Text { text: modelData.core.presenceStatus color: modelData.core.presenceColor } Button { text: 'X' onClicked: { - modelData.core.remove() + modelData.core.remove(); } } - Text{ + Text { text: modelData.core.address } - TextField{ + TextField { initialText: modelData.core.address - onTextChanged: if(modelData.core.address != text){ - modelData.core.address = text - resetText() - } + onTextChanged: if (modelData.core.address != text) { + modelData.core.address = text; + resetText(); + } } - Text{ - text: 'IsSaved:'+modelData.core.isSaved + Text { + text: 'IsSaved:' + modelData.core.isSaved } Button { text: 'Revert' onClicked: { - modelData.core.undo() + modelData.core.undo(); } } Button { text: 'Save' onClicked: { - modelData.core.save() + modelData.core.save(); } } } @@ -93,10 +93,8 @@ Window{ text: 'Get' Layout.rightMargin: 20 onClicked: { - search.filterText = '*' + search.filterText = '*'; } } } - } - diff --git a/Linphone/view/Control/Tool/Prototype/ItemPrototype.qml b/Linphone/view/Control/Tool/Prototype/ItemPrototype.qml index b634af798..dd538287c 100644 --- a/Linphone/view/Control/Tool/Prototype/ItemPrototype.qml +++ b/Linphone/view/Control/Tool/Prototype/ItemPrototype.qml @@ -4,23 +4,23 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp 1.0 -Rectangle{ +Rectangle { id: mainItem property Component component1: comp1 property Component component2: comp2 property bool step: false color: 'black' onStepChanged: { - stack.replace(step ? component1 : component2) + stack.replace(step ? component1 : component2); } - Timer{ + Timer { id: delay interval: 1000 onTriggered: mainItem.step = !mainItem.step repeat: true running: true } - Control.StackView{ + Control.StackView { id: stack anchors.fill: parent /* @@ -30,22 +30,24 @@ Rectangle{ anchors.left: parent.left anchors.leftMargin: parent.width/2 anchors.bottom: parent.bottom*/ - initialItem : Rectangle{width: 100 + initialItem: Rectangle { + width: 100 height: width - color: 'orange'} + color: 'orange' + } } - Component{ + Component { id: comp1 - Rectangle{ + Rectangle { width: 100 height: width color: 'red' } } - - Component{ + + Component { id: comp2 - Rectangle{ + Rectangle { width: 100 height: width color: 'green' diff --git a/Linphone/view/Control/Tool/Prototype/PhoneNumberPrototype.qml b/Linphone/view/Control/Tool/Prototype/PhoneNumberPrototype.qml index 848872670..77ad18a46 100644 --- a/Linphone/view/Control/Tool/Prototype/PhoneNumberPrototype.qml +++ b/Linphone/view/Control/Tool/Prototype/PhoneNumberPrototype.qml @@ -2,28 +2,30 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls.Basic as Control import Linphone + // Snippet -ListView{ +ListView { id: mainItem - model: PhoneNumberProxy{} - delegate: Rectangle{ + model: PhoneNumberProxy {} + delegate: Rectangle { height: 20 width: mainItem.width - RowLayout{ + RowLayout { anchors.fill: parent - Text{ + Text { text: $modelData.flag font.family: DefaultStyle.emojiFont } - Text{ + Text { text: $modelData.country } } - MouseArea{ + MouseArea { anchors.fill: parent - onClicked: console.debug("[ProtoPhoneNumber] Phone number Select: " +$modelData.flag + " / " +$modelData.nationalNumberLength + " / "+$modelData.countryCallingCode + " / " +$modelData.isoCountryCode + " / " +$modelData.internationalCallPrefix + " / " +$modelData.country ) + onClicked: console.debug("[ProtoPhoneNumber] Phone number Select: " + $modelData.flag + " / " + + $modelData.nationalNumberLength + " / " + $modelData.countryCallingCode + " / " + $modelData.isoCountryCode + + " / " + $modelData.internationalCallPrefix + " / " + $modelData.country) } } } - diff --git a/Linphone/view/Page/Form/Call/NewCallForm.qml b/Linphone/view/Page/Form/Call/NewCallForm.qml index cbbd9ae6c..0913baa1a 100644 --- a/Linphone/view/Page/Form/Call/NewCallForm.qml +++ b/Linphone/view/Page/Form/Call/NewCallForm.qml @@ -13,39 +13,39 @@ CreationFormLayout { property bool displayCurrentCalls: false signal transferCallToAnotherRequested(CallGui dest) - //: Appel de groupe - startGroupButtonText: qsTr("call_start_group_call_title") - startGroupButtonVisible: !SettingsCpp.disableMeetingsFeature + //: Appel de groupe + startGroupButtonText: qsTr("call_start_group_call_title") + startGroupButtonVisible: !SettingsCpp.disableMeetingsFeature - topLayoutVisible: mainItem.displayCurrentCalls && callList.count > 0 - topContent: [ - Text { - visible: callList.count > 0 - //: "Appels en cours" - text: qsTr("call_transfer_active_calls_label") - font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight - } - }, - Flickable { - Layout.fillWidth: true - Layout.preferredHeight: callListBackground.height - Layout.maximumHeight: mainItem.height/2 - contentHeight: callListBackground.height - contentWidth: width - RoundedPane { - id: callListBackground - anchors.left: parent.left - anchors.right: parent.right - contentItem: CallListView { - id: callList - isTransferList: true - onTransferCallToAnotherRequested: (dest) => { - mainItem.transferCallToAnotherRequested(dest) - } - } - } - } - ] + topLayoutVisible: mainItem.displayCurrentCalls && callList.count > 0 + topContent: [ + Text { + visible: callList.count > 0 + //: "Appels en cours" + text: qsTr("call_transfer_active_calls_label") + font { + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight + } + }, + Flickable { + Layout.fillWidth: true + Layout.preferredHeight: callListBackground.height + Layout.maximumHeight: mainItem.height / 2 + contentHeight: callListBackground.height + contentWidth: width + RoundedPane { + id: callListBackground + anchors.left: parent.left + anchors.right: parent.right + contentItem: CallListView { + id: callList + isTransferList: true + onTransferCallToAnotherRequested: dest => { + mainItem.transferCallToAnotherRequested(dest); + } + } + } + } + ] } diff --git a/Linphone/view/Page/Form/Chat/NewChatForm.qml b/Linphone/view/Page/Form/Chat/NewChatForm.qml index 6a6facc5a..5649f1f96 100644 --- a/Linphone/view/Page/Form/Chat/NewChatForm.qml +++ b/Linphone/view/Page/Form/Chat/NewChatForm.qml @@ -10,6 +10,6 @@ import SettingsCpp CreationFormLayout { id: mainItem - //: Nouveau groupe - startGroupButtonText: qsTr("chat_start_group_chat_title") + //: Nouveau groupe + startGroupButtonText: qsTr("chat_start_group_chat_title") } diff --git a/Linphone/view/Page/Form/Chat/SelectedChatView.qml b/Linphone/view/Page/Form/Chat/SelectedChatView.qml index b74b14629..ff66fe89f 100644 --- a/Linphone/view/Page/Form/Chat/SelectedChatView.qml +++ b/Linphone/view/Page/Form/Chat/SelectedChatView.qml @@ -7,802 +7,829 @@ import QtQuick.Layouts import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 - property ChatGui chat - // used to show chat message reactions in details panel - property ChatMessageGui chatMessage - property var contactObj: chat ? UtilsCpp.findFriendByAddress(mainItem.chat.core.peerAddress) : null - property var contact: contactObj?.value || null - property alias messagesLoading: chatMessagesListView.loading - property CallGui call - property alias callHeaderContent: splitPanel.header.contentItem - property bool replyingToMessage: false - property bool editingMessage: false - property string lastChar - property AccountGui currentAccount: AppCpp.currentAccount - property bool showEncryptedInfo: currentAccount && currentAccount.core.limeServerUrl !== "" && currentAccount.core.conferenceFactoryAddress !== "" - enum PanelType { MessageReactions, SharedFiles, Medias, ImdnStatus, ForwardToList, ManageParticipants, EphemeralSettings, None} - - signal oneOneCall(bool video) - signal groupCall() + id: mainItem + property ChatGui chat + // used to show chat message reactions in details panel + property ChatMessageGui chatMessage + property var contactObj: chat ? UtilsCpp.findFriendByAddress(mainItem.chat.core.peerAddress) : null + property var contact: contactObj?.value || null + property alias messagesLoading: chatMessagesListView.loading + property CallGui call + property alias callHeaderContent: splitPanel.header.contentItem + property bool replyingToMessage: false + property bool editingMessage: false + property string lastChar + property AccountGui currentAccount: AppCpp.currentAccount + property bool showEncryptedInfo: currentAccount && currentAccount.core.limeServerUrl !== "" + && currentAccount.core.conferenceFactoryAddress !== "" + enum PanelType { + MessageReactions, + SharedFiles, + Medias, + ImdnStatus, + ForwardToList, + ManageParticipants, + EphemeralSettings, + None + } - onActiveFocusChanged: if(activeFocus) { - if (chatMessagesListView.lastItemVisible) chat.core.lMarkAsRead() - } - MouseArea{ - anchors.fill: parent - onPressed: { - forceActiveFocus() - } - } + signal oneOneCall(bool video) + signal groupCall - onOneOneCall: { - if (contact) - mainWindow.startCallWithContact(contact, video, mainItem) - else - UtilsCpp.createCall(mainItem.chat?.core.peerAddress, {'localVideoEnabled':video}) - } - - onGroupCall: { - mainWindow.showConfirmationLambdaPopup("", - qsTr("chat_view_group_call_toast_message"), - "", - function(confirmed) { - if (confirmed) { - const sourceList = mainItem.chat?.core.participants - let addresses = []; - for (let i = 0; i < sourceList.length; ++i) { - const participantGui = sourceList[i] - addresses.push(participantGui.core.sipAddress) - } - UtilsCpp.createGroupCall(mainItem.chat?.core.title, addresses) - } - }) - } + onActiveFocusChanged: if (activeFocus) { + if (chatMessagesListView.lastItemVisible) + chat.core.lMarkAsRead(); + } + MouseArea { + anchors.fill: parent + onPressed: { + forceActiveFocus(); + } + } - Keys.onPressed: (event) => { - event.accepted = false - if (event.modifiers & Qt.ControlModifier && event.key === Qt.Key_F) { - searchBarLayout.visible = true - event.accepted = true - } - } + onOneOneCall: { + if (contact) + mainWindow.startCallWithContact(contact, video, mainItem); + else + UtilsCpp.createCall(mainItem.chat?.core.peerAddress, { + 'localVideoEnabled': video + }); + } + onGroupCall: { + mainWindow.showConfirmationLambdaPopup("", qsTr("chat_view_group_call_toast_message"), "", function (confirmed) { + if (confirmed) { + const sourceList = mainItem.chat?.core.participants; + let addresses = []; + for (let i = 0; i < sourceList.length; ++i) { + const participantGui = sourceList[i]; + addresses.push(participantGui.core.sipAddress); + } + UtilsCpp.createGroupCall(mainItem.chat?.core.title, addresses); + } + }); + } - RowLayout { - anchors.fill: parent - spacing: 0 + Keys.onPressed: event => { + event.accepted = false; + if (event.modifiers & Qt.ControlModifier && event.key === Qt.Key_F) { + searchBarLayout.visible = true; + event.accepted = true; + } + } - MainRightPanel { - id: splitPanel - Layout.fillWidth: true - Layout.fillHeight: true - panelColor: DefaultStyle.grey_0 - header.visible: !mainItem.call - clip: true - header.leftPadding: Utils.getSizeWithScreenRatio(32) - header.rightPadding: Utils.getSizeWithScreenRatio(32) - header.topPadding: Utils.getSizeWithScreenRatio(6) - header.bottomPadding: Utils.getSizeWithScreenRatio(searchBarLayout.visible ? 3 : 6) + RowLayout { + anchors.fill: parent + spacing: 0 - header.contentItem: ColumnLayout { - id: chatHeader - Layout.fillWidth: true - Layout.leftMargin: mainItem.call ? 0 : Utils.getSizeWithScreenRatio(31) - Layout.rightMargin: Utils.getSizeWithScreenRatio(41) - spacing: searchBarLayout.visible ? Utils.getSizeWithScreenRatio(9) : 0 - property real minimumWidthForSwitchintToRowLayout: headerInfos.implicitWidth + headerActionButtons.implicitWidth - property var useVerticalLayout: width < minimumWidthForSwitchintToRowLayout - GridLayout { - columns: chatHeader.useVerticalLayout ? 1 : children.length - rows: 1 - RowLayout { - id: headerInfos - spacing: Utils.getSizeWithScreenRatio(12) - // property int childrenWidth: - 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: Utils.getSizeWithScreenRatio(45) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - } - ColumnLayout { - Text { - Layout.fillWidth: true - Component.onCompleted: console.log(text, "width", width, "implicitWidth", implicitWidth, "advance", advance, contentWidth) - text: UtilsCpp.encodeEmojiToQmlRichFormat(mainItem.chat?.core.title) || "" - color: DefaultStyle.main2_600 - maximumLineCount: 1 - font { - pixelSize: Typography.h4.pixelSize - weight: Utils.getSizeWithScreenRatio(400) - } - } - RowLayout { - visible: mainItem.chat?.core.ephemeralEnabled || false - EffectImage { - colorizationColor: DefaultStyle.main1_500_main - Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 - Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) - imageSource: AppIcons.clockCountDown - } - Text { - text: mainItem.chat ? UtilsCpp.getEphemeralFormatedTime(mainItem.chat.core.ephemeralLifetime) : "" - } - } - } - RowLayout { - visible: mainItem.showEncryptedInfo && mainItem.chat != undefined && !mainItem.chat.core.isEncrypted - spacing: Utils.getSizeWithScreenRatio(8) - EffectImage { - Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 - Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) - colorizationColor: DefaultStyle.warning_700 - imageSource: AppIcons.lockSimpleOpen - } - // Text { - // // hiding text if in call cause te view - // // has smaller width - // visible: !mainItem.call - // Layout.fillWidth: true - // color: DefaultStyle.warning_700 - // //: This conversation is not encrypted ! - // text: qsTr("unencrypted_conversation_warning") - // font: Typography.p2 - // } - } + MainRightPanel { + id: splitPanel + Layout.fillWidth: true + Layout.fillHeight: true + panelColor: DefaultStyle.grey_0 + header.visible: !mainItem.call + clip: true + header.leftPadding: Utils.getSizeWithScreenRatio(32) + header.rightPadding: Utils.getSizeWithScreenRatio(32) + header.topPadding: Utils.getSizeWithScreenRatio(6) + header.bottomPadding: Utils.getSizeWithScreenRatio(searchBarLayout.visible ? 3 : 6) - EffectImage { - visible: mainItem.chat?.core.muted || false - Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) - Layout.alignment: Qt.AlignVCenter - Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) - colorizationColor: DefaultStyle.main1_500_main - imageSource: AppIcons.bellSlash - } - } - Item{Layout.fillWidth: true} - RowLayout { - id: headerActionButtons - spacing: Utils.getSizeWithScreenRatio(16) - RoundButton { - visible: !mainItem.call && !mainItem.chat?.core.isReadOnly - style: ButtonStyle.noBackground - icon.source: AppIcons.phone - onPressed: { - if (mainItem.chat.core.isGroupChat) { - mainItem.groupCall() - } else { - mainItem.oneOneCall(false) - } - } - } - RoundButton { - id: searchInHistoryButton - style: ButtonStyle.noBackground - icon.source: AppIcons.search - checkable: true - checkedImageColor: DefaultStyle.main1_500_main - onCheckedChanged: searchBarLayout.visible = checked - Connections { - target: searchBarLayout - function onVisibleChanged() {searchInHistoryButton.checked = searchBarLayout.visible} - } - } - RoundButton { - style: ButtonStyle.noBackground - icon.source: AppIcons.videoCamera - visible: !mainItem.chat?.core.isGroupChat && !mainItem.call - onPressed: mainItem.oneOneCall(true) - } - RoundButton { - id: detailsPanelButton - visible: !mainItem.call - style: ButtonStyle.noBackground - checkable: true - Layout.preferredWidth: width - checkedImageColor: DefaultStyle.main1_500_main - icon.source: AppIcons.info - checked: detailsPanel.visible - onCheckedChanged: { - detailsPanel.visible = checked - } - Connections { - target: detailsPanel - function onVisibleChanged() { - if (!detailsPanel.visible) detailsPanelButton.checked = false - } - } - } - } - } - RowLayout { - id: searchBarLayout - onVisibleChanged: { - if(!visible) chatMessagesSearchBar.clearText() - else chatMessagesSearchBar.forceActiveFocus() - } - spacing: Utils.getSizeWithScreenRatio(50) - height: Utils.getSizeWithScreenRatio(65) - Connections { - target: mainItem - function onChatChanged() {searchBarLayout.visible = false} - } - SearchBar { - id: chatMessagesSearchBar - Layout.fillWidth: true - Layout.rightMargin: Utils.getSizeWithScreenRatio(10) - property ChatMessageGui messageFound - delaySearch: false - Keys.onPressed: (event) => { - event.accepted = false - if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { - if (chatMessagesListView.filterText !== text) { - chatMessagesListView.filterText = text - } else { - if (event.modifiers & Qt.ShiftModifier) { - chatMessagesListView.findIndexWithFilter(false) - } else { - chatMessagesListView.findIndexWithFilter(true) - } - } - event.accepted = true - } else if (event.key === Qt.Key_Escape) { - searchBarLayout.visible = false - event.accepted = true - } - } - } - RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) - RoundButton { - icon.source: AppIcons.upArrow - style: ButtonStyle.noBackground - onClicked: { - if (chatMessagesListView.filterText !== chatMessagesSearchBar.text) - chatMessagesListView.filterText = chatMessagesSearchBar.text - else - chatMessagesListView.findIndexWithFilter(false) - } - } - RoundButton { - icon.source: AppIcons.downArrow - style: ButtonStyle.noBackground - onClicked: { - if (chatMessagesListView.filterText !== chatMessagesSearchBar.text) - chatMessagesListView.filterText = chatMessagesSearchBar.text - else - chatMessagesListView.findIndexWithFilter(true) - } - } - } - RoundButton { - icon.source: AppIcons.closeX - Layout.rightMargin: Utils.getSizeWithScreenRatio(20) - onClicked: { - chatMessagesListView.filterText = "" - searchBarLayout.visible = false - } - style: ButtonStyle.noBackground - } - } - } - - content: Control.SplitView { - anchors.fill: parent - orientation: Qt.Vertical - handle: Rectangle { - id: splitViewHandle - visible: !mainItem.chat?.core.isReadOnly || false - // Hack for keeping handle unvisible in call history chat - // (It somehow becomes visible when switching from call history to chat - // history even if chat is read only) - onVisibleChanged: { - visible = !mainItem.chat?.core.isReadOnly || false - } - enabled: visible - implicitHeight: Utils.getSizeWithScreenRatio(8) - color: Control.SplitHandle.hovered ? DefaultStyle.grey_200 : DefaultStyle.grey_100 - } - ColumnLayout { - spacing: 0 - Control.SplitView.fillHeight: true - Item { - Layout.fillWidth: true - Layout.fillHeight: true - ChatMessagesListView { - id: chatMessagesListView - clip: true - backgroundColor: splitPanel.panelColor - width: parent.width - anchors.leftMargin - anchors.rightMargin - chat: mainItem.chat - anchors.fill: parent - anchors.leftMargin: Utils.getSizeWithScreenRatio(18) - anchors.rightMargin: Utils.getSizeWithScreenRatio(18) - Control.ScrollBar.vertical: scrollbar - onShowReactionsForMessageRequested: (chatMessage) => { - mainItem.chatMessage = chatMessage - contentLoader.panelType = SelectedChatView.PanelType.MessageReactions - detailsPanel.visible = true - } - onShowImdnStatusForMessageRequested: (chatMessage) => { - mainItem.chatMessage = chatMessage - contentLoader.panelType = SelectedChatView.PanelType.ImdnStatus - detailsPanel.visible = true - } - onReplyToMessageRequested: (chatMessage) => { - mainItem.chatMessage = chatMessage - mainItem.replyingToMessage = true - if (mainItem.editingMessage) mainItem.editingMessage = false - } - onForwardMessageRequested: (chatMessage) => { - mainItem.chatMessage = chatMessage - contentLoader.panelType = SelectedChatView.PanelType.ForwardToList - detailsPanel.visible = true - if (mainItem.editingMessage) mainItem.editingMessage = false - } - onEditMessageRequested: (chatMessage) => { - mainItem.chatMessage = chatMessage - mainItem.editingMessage = true - if (mainItem.replyingToMessage) mainItem.replyingToMessage = false - messageSender.text = chatMessage.core.text - } - } - ScrollBar { - id: scrollbar - visible: chatMessagesListView.contentHeight > parent.height - active: visible - anchors.top: chatMessagesListView.top - anchors.bottom: chatMessagesListView.bottom - anchors.right: parent.right - anchors.rightMargin: Utils.getSizeWithScreenRatio(5) - policy: Control.ScrollBar.AsNeeded - } - Control.Control { - id: participantListPopup - width: parent.width - height: Math.min(participantInfoList.height, Utils.getSizeWithScreenRatio(200)) - visible: mainItem.lastChar === "@" - onVisibleChanged: console.log("participant list visible changed", visible, height) - anchors.bottom: chatMessagesListView.bottom - anchors.left: chatMessagesListView.left - anchors.right: chatMessagesListView.right - - background: Item { - anchors.fill: parent - Rectangle { - id: participantBg - color: DefaultStyle.grey_0 - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - radius: Utils.getSizeWithScreenRatio(20) - height: parent.height - } - MultiEffect { - anchors.fill: participantBg - source: participantBg - shadowEnabled: true - shadowBlur: 0.5 - shadowColor: DefaultStyle.grey_1000 - shadowOpacity: 0.3 - } - Rectangle { - id: bg - color: DefaultStyle.grey_0 - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: parent.height/2 - } - } - contentItem: ParticipantInfoListView { - id: participantInfoList - height: contentHeight - width: participantListPopup.width - chatGui: mainItem.chat - delegateHoverRectangleRadius: Utils.getSizeWithScreenRatio(20) - onParticipantClicked: (username) => { - messageSender.text = messageSender.text + username + " " - messageSender.textArea.cursorPosition = messageSender.text.length - } - } - } - } - Control.Control { - id: selectedFilesArea - visible: selectedFiles.count > 0 || mainItem.replyingToMessage || mainItem.editingMessage - Layout.fillWidth: true - Layout.preferredHeight: implicitHeight - topPadding: Utils.getSizeWithScreenRatio(12) - bottomPadding: Utils.getSizeWithScreenRatio(12) - leftPadding: Utils.getSizeWithScreenRatio(19) - rightPadding: Utils.getSizeWithScreenRatio(19) - - Button { - anchors.top: parent.top - anchors.right: parent.right - anchors.topMargin: selectedFilesArea.topPadding - anchors.rightMargin: selectedFilesArea.rightPadding - icon.source: AppIcons.closeX - style: ButtonStyle.noBackground - onClicked: { - contents.clear() - if (mainItem.replyingToMessage) - mainItem.replyingToMessage = false - else if (mainItem.editingMessage) { - mainItem.editingMessage = false - messageSender.text = "" + header.contentItem: ColumnLayout { + id: chatHeader + Layout.fillWidth: true + Layout.leftMargin: mainItem.call ? 0 : Utils.getSizeWithScreenRatio(31) + Layout.rightMargin: Utils.getSizeWithScreenRatio(41) + spacing: searchBarLayout.visible ? Utils.getSizeWithScreenRatio(9) : 0 + property real minimumWidthForSwitchintToRowLayout: headerInfos.implicitWidth + headerActionButtons.implicitWidth + property var useVerticalLayout: width < minimumWidthForSwitchintToRowLayout + GridLayout { + columns: chatHeader.useVerticalLayout ? 1 : children.length + rows: 1 + RowLayout { + id: headerInfos + spacing: Utils.getSizeWithScreenRatio(12) + // property int childrenWidth: + 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: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + } + ColumnLayout { + Text { + Layout.fillWidth: true + Component.onCompleted: console.log(text, "width", width, "implicitWidth", implicitWidth, "advance", advance, + contentWidth) + text: UtilsCpp.encodeEmojiToQmlRichFormat(mainItem.chat?.core.title) || "" + color: DefaultStyle.main2_600 + maximumLineCount: 1 + font { + pixelSize: Typography.h4.pixelSize + weight: Utils.getSizeWithScreenRatio(400) } - } - } - background: Item{ - anchors.fill: parent - Rectangle { - color: DefaultStyle.grey_0 - border.color: DefaultStyle.main2_100 - border.width: Utils.getSizeWithScreenRatio(2) - height: parent.height / 2 - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - } - Rectangle { - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - height: 2 * parent.height / 3 - } - } - contentItem: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(5) - ColumnLayout { - id: replyLayout - spacing: 0 - visible: mainItem.chatMessage && (mainItem.replyingToMessage || mainItem.editingMessage) - Text { - Layout.fillWidth: true - //: Reply to %1 - text: mainItem.replyingToMessage ? - (mainItem.chatMessage ? qsTr("reply_to_label").arg(UtilsCpp.boldTextPart(mainItem.chatMessage.core.fromName, mainItem.chatMessage.core.fromName)) : "") - : qsTr("conversation_editing_message_title") - color: DefaultStyle.main2_500_main - textFormat: Text.RichText - font { - pixelSize: Typography.p3.pixelSize - weight: Typography.p3.weight - } - } - Text { - Layout.fillWidth: true - text: mainItem.chatMessage ? mainItem.chatMessage.core.text : "" - color: DefaultStyle.main2_400 - font { - pixelSize: Typography.p3.pixelSize - weight: Typography.p3.weight - } - } - } - Rectangle { - Layout.fillWidth: true - visible: replyLayout.visible && selectedFiles.visible - color: DefaultStyle.main2_300 - Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) - } - ListView { - id: selectedFiles - orientation: ListView.Horizontal - visible: count > 0 - spacing: Utils.getSizeWithScreenRatio(16) - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(104) - model: ChatMessageContentProxy { - id: contents - filterType: ChatMessageContentProxy.FilterContentType.File - } - delegate: Item { - width: Utils.getSizeWithScreenRatio(80) - height: Utils.getSizeWithScreenRatio(80) - FileView { - contentGui: modelData - anchors.left: parent.left - anchors.bottom: parent.bottom - width: Utils.getSizeWithScreenRatio(69) - height: Utils.getSizeWithScreenRatio(69) - } - RoundButton { - icon.source: AppIcons.closeX - icon.width: Utils.getSizeWithScreenRatio(12) - icon.height: Utils.getSizeWithScreenRatio(12) - anchors.top: parent.top - anchors.right: parent.right - style: ButtonStyle.numericPad - shadowEnabled: true - padding: Utils.getSizeWithScreenRatio(3) - onClicked: contents.removeContent(modelData) - } - } - Control.ScrollBar.horizontal: selectedFilesScrollbar - } - } - ScrollBar { - id: selectedFilesScrollbar - active: true - anchors.bottom: selectedFilesArea.bottom - anchors.left: selectedFilesArea.left - anchors.right: selectedFilesArea.right - } - } - } - ChatDroppableTextArea { - id: messageSender - Control.SplitView.preferredHeight: mainItem.chat?.core.isReadOnly ? 0 : height - Control.SplitView.fillHeight: true - Control.SplitView.minimumHeight: mainItem.chat?.core.isReadOnly ? 0 : Utils.getSizeWithScreenRatio(79) - chat: mainItem.chat - selectedFilesCount: contents.count - callOngoing: mainItem.call != null - isEditing: mainItem.editingMessage - onChatChanged: { - if (chat) messageSender.text = mainItem.chat.core.sendingText - } - onTextChanged: { - if (text !== "") { - mainItem.chat.core.lCompose() - } - mainItem.lastChar = text.slice(-1) - mainItem.chat.core.sendingText = text - } - onSendMessage: { - var filesContents = contents.getAll() - if (mainItem.replyingToMessage) { - mainItem.replyingToMessage = false - UtilsCpp.sendReplyMessage(mainItem.chatMessage, mainItem.chat, text, filesContents) - } - else if (mainItem.editingMessage) { - UtilsCpp.sendReplaceMessage(mainItem.chatMessage, mainItem.chat, text, filesContents) - mainItem.editingMessage = false - } - else if (filesContents.length === 0) - mainItem.chat.core.lSendTextMessage(text) - else mainItem.chat.core.lSendMessage(text, filesContents) - contents.clear() - } - onDropped: (files) => { - contents.addFiles(files) - } - Connections { - target: mainItem - function onReplyingToMessageChanged() { - if (mainItem.replyingToMessage) messageSender.focusTextArea() - } - function onChatChanged() {messageSender.focusTextArea()} - } - } - } - } - Rectangle { - visible: detailsPanel.visible && detailsPanel.width < mainItem.width - color: DefaultStyle.main2_200 - Layout.preferredWidth: Utils.getSizeWithScreenRatio(1) - Layout.fillHeight: true - } - Control.Control { - id: detailsPanel - visible: false - Layout.fillHeight: true - Layout.preferredWidth: Math.min(Utils.getSizeWithScreenRatio(387), mainItem.width) - onVisibleChanged: if(!visible) { - contentLoader.panelType = SelectedChatView.PanelType.None - } + } + RowLayout { + visible: mainItem.chat?.core.ephemeralEnabled || false + EffectImage { + colorizationColor: DefaultStyle.main1_500_main + Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) + imageSource: AppIcons.clockCountDown + } + Text { + text: mainItem.chat ? UtilsCpp.getEphemeralFormatedTime(mainItem.chat.core.ephemeralLifetime) : "" + } + } + } + RowLayout { + visible: mainItem.showEncryptedInfo && mainItem.chat != undefined && !mainItem.chat.core.isEncrypted + spacing: Utils.getSizeWithScreenRatio(8) + EffectImage { + Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) + colorizationColor: DefaultStyle.warning_700 + imageSource: AppIcons.lockSimpleOpen + } + // Text { + // // hiding text if in call cause te view + // // has smaller width + // visible: !mainItem.call + // Layout.fillWidth: true + // color: DefaultStyle.warning_700 + // //: This conversation is not encrypted ! + // text: qsTr("unencrypted_conversation_warning") + // font: Typography.p2 + // } + } - background: Rectangle { - color: DefaultStyle.grey_0 - anchors.fill: parent - RoundButton { - style: ButtonStyle.noBackgroundOrange - icon.source: AppIcons.leftArrow - onClicked: detailsPanel.visible = false - } - } + EffectImage { + visible: mainItem.chat?.core.muted || false + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.alignment: Qt.AlignVCenter + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + colorizationColor: DefaultStyle.main1_500_main + imageSource: AppIcons.bellSlash + } + } + Item { + Layout.fillWidth: true + } + RowLayout { + id: headerActionButtons + spacing: Utils.getSizeWithScreenRatio(16) + RoundButton { + visible: !mainItem.call && !mainItem.chat?.core.isReadOnly + style: ButtonStyle.noBackground + icon.source: AppIcons.phone + onPressed: { + if (mainItem.chat.core.isGroupChat) { + mainItem.groupCall(); + } else { + mainItem.oneOneCall(false); + } + } + } + RoundButton { + id: searchInHistoryButton + style: ButtonStyle.noBackground + icon.source: AppIcons.search + checkable: true + checkedImageColor: DefaultStyle.main1_500_main + onCheckedChanged: searchBarLayout.visible = checked + Connections { + target: searchBarLayout + function onVisibleChanged() { + searchInHistoryButton.checked = searchBarLayout.visible; + } + } + } + RoundButton { + style: ButtonStyle.noBackground + icon.source: AppIcons.videoCamera + visible: !mainItem.chat?.core.isGroupChat && !mainItem.call + onPressed: mainItem.oneOneCall(true) + } + RoundButton { + id: detailsPanelButton + visible: !mainItem.call + style: ButtonStyle.noBackground + checkable: true + Layout.preferredWidth: width + checkedImageColor: DefaultStyle.main1_500_main + icon.source: AppIcons.info + checked: detailsPanel.visible + onCheckedChanged: { + detailsPanel.visible = checked; + } + Connections { + target: detailsPanel + function onVisibleChanged() { + if (!detailsPanel.visible) + detailsPanelButton.checked = false; + } + } + } + } + } + RowLayout { + id: searchBarLayout + onVisibleChanged: { + if (!visible) + chatMessagesSearchBar.clearText(); + else + chatMessagesSearchBar.forceActiveFocus(); + } + spacing: Utils.getSizeWithScreenRatio(50) + height: Utils.getSizeWithScreenRatio(65) + Connections { + target: mainItem + function onChatChanged() { + searchBarLayout.visible = false; + } + } + SearchBar { + id: chatMessagesSearchBar + Layout.fillWidth: true + Layout.rightMargin: Utils.getSizeWithScreenRatio(10) + property ChatMessageGui messageFound + delaySearch: false + Keys.onPressed: event => { + event.accepted = false; + if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { + if (chatMessagesListView.filterText !== text) { + chatMessagesListView.filterText = text; + } else { + if (event.modifiers & Qt.ShiftModifier) { + chatMessagesListView.findIndexWithFilter(false); + } else { + chatMessagesListView.findIndexWithFilter(true); + } + } + event.accepted = true; + } else if (event.key === Qt.Key_Escape) { + searchBarLayout.visible = false; + event.accepted = true; + } + } + } + RowLayout { + spacing: Utils.getSizeWithScreenRatio(10) + RoundButton { + icon.source: AppIcons.upArrow + style: ButtonStyle.noBackground + onClicked: { + if (chatMessagesListView.filterText !== chatMessagesSearchBar.text) + chatMessagesListView.filterText = chatMessagesSearchBar.text; + else + chatMessagesListView.findIndexWithFilter(false); + } + } + RoundButton { + icon.source: AppIcons.downArrow + style: ButtonStyle.noBackground + onClicked: { + if (chatMessagesListView.filterText !== chatMessagesSearchBar.text) + chatMessagesListView.filterText = chatMessagesSearchBar.text; + else + chatMessagesListView.findIndexWithFilter(true); + } + } + } + RoundButton { + icon.source: AppIcons.closeX + Layout.rightMargin: Utils.getSizeWithScreenRatio(20) + onClicked: { + chatMessagesListView.filterText = ""; + searchBarLayout.visible = false; + } + style: ButtonStyle.noBackground + } + } + } - contentItem: Loader { - id: contentLoader - property int panelType: SelectedChatView.PanelType.None - // anchors.top: parent.top - anchors.fill: parent - anchors.topMargin: Utils.getSizeWithScreenRatio(39) - anchors.rightMargin: Utils.getSizeWithScreenRatio(15) - sourceComponent: panelType === SelectedChatView.PanelType.EphemeralSettings - ? ephemeralSettingsComponent - : panelType === SelectedChatView.PanelType.MessageReactions - ? messageReactionsComponent - : panelType === SelectedChatView.PanelType.ImdnStatus - ? messageImdnStatusComponent - : panelType === SelectedChatView.PanelType.SharedFiles || panelType === SelectedChatView.PanelType.Medias - ? sharedFilesComponent - : panelType === SelectedChatView.PanelType.ForwardToList - ? forwardToListsComponent - : panelType === SelectedChatView.PanelType.ManageParticipants - ? manageParticipantsComponent - : infoComponent - active: detailsPanel.visible - onLoaded: { - if (contentLoader.item && contentLoader.item.parentView) { - contentLoader.item.parentView = mainItem - } - } - Connections { - target: mainItem - function onChatChanged() { - detailsPanel.visible = false - } - } - } + content: Control.SplitView { + anchors.fill: parent + orientation: Qt.Vertical + handle: Rectangle { + id: splitViewHandle + visible: !mainItem.chat?.core.isReadOnly || false + // Hack for keeping handle unvisible in call history chat + // (It somehow becomes visible when switching from call history to chat + // history even if chat is read only) + onVisibleChanged: { + visible = !mainItem.chat?.core.isReadOnly || false; + } + enabled: visible + implicitHeight: Utils.getSizeWithScreenRatio(8) + color: Control.SplitHandle.hovered ? DefaultStyle.grey_200 : DefaultStyle.grey_100 + } + ColumnLayout { + spacing: 0 + Control.SplitView.fillHeight: true + Item { + Layout.fillWidth: true + Layout.fillHeight: true + ChatMessagesListView { + id: chatMessagesListView + clip: true + backgroundColor: splitPanel.panelColor + width: parent.width - anchors.leftMargin - anchors.rightMargin + chat: mainItem.chat + anchors.fill: parent + anchors.leftMargin: Utils.getSizeWithScreenRatio(18) + anchors.rightMargin: Utils.getSizeWithScreenRatio(18) + Control.ScrollBar.vertical: scrollbar + onShowReactionsForMessageRequested: chatMessage => { + mainItem.chatMessage = chatMessage; + contentLoader.panelType = SelectedChatView.PanelType.MessageReactions; + detailsPanel.visible = true; + } + onShowImdnStatusForMessageRequested: chatMessage => { + mainItem.chatMessage = chatMessage; + contentLoader.panelType = SelectedChatView.PanelType.ImdnStatus; + detailsPanel.visible = true; + } + onReplyToMessageRequested: chatMessage => { + mainItem.chatMessage = chatMessage; + mainItem.replyingToMessage = true; + if (mainItem.editingMessage) + mainItem.editingMessage = false; + } + onForwardMessageRequested: chatMessage => { + mainItem.chatMessage = chatMessage; + contentLoader.panelType = SelectedChatView.PanelType.ForwardToList; + detailsPanel.visible = true; + if (mainItem.editingMessage) + mainItem.editingMessage = false; + } + onEditMessageRequested: chatMessage => { + mainItem.chatMessage = chatMessage; + mainItem.editingMessage = true; + if (mainItem.replyingToMessage) + mainItem.replyingToMessage = false; + messageSender.text = chatMessage.core.text; + } + } + ScrollBar { + id: scrollbar + visible: chatMessagesListView.contentHeight > parent.height + active: visible + anchors.top: chatMessagesListView.top + anchors.bottom: chatMessagesListView.bottom + anchors.right: parent.right + anchors.rightMargin: Utils.getSizeWithScreenRatio(5) + policy: Control.ScrollBar.AsNeeded + } + Control.Control { + id: participantListPopup + width: parent.width + height: Math.min(participantInfoList.height, Utils.getSizeWithScreenRatio(200)) + visible: mainItem.lastChar === "@" + onVisibleChanged: console.log("participant list visible changed", visible, height) + anchors.bottom: chatMessagesListView.bottom + anchors.left: chatMessagesListView.left + anchors.right: chatMessagesListView.right - Component { - id: infoComponent - ConversationInfos { - chatGui: mainItem.chat + background: Item { + anchors.fill: parent + Rectangle { + id: participantBg + color: DefaultStyle.grey_0 + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + radius: Utils.getSizeWithScreenRatio(20) + height: parent.height + } + MultiEffect { + anchors.fill: participantBg + source: participantBg + shadowEnabled: true + shadowBlur: 0.5 + shadowColor: DefaultStyle.grey_1000 + shadowOpacity: 0.3 + } + Rectangle { + id: bg + color: DefaultStyle.grey_0 + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: parent.height / 2 + } + } + contentItem: ParticipantInfoListView { + id: participantInfoList + height: contentHeight + width: participantListPopup.width + chatGui: mainItem.chat + delegateHoverRectangleRadius: Utils.getSizeWithScreenRatio(20) + onParticipantClicked: username => { + messageSender.text = messageSender.text + username + " "; + messageSender.textArea.cursorPosition = messageSender.text.length; + } + } + } + } + Control.Control { + id: selectedFilesArea + visible: selectedFiles.count > 0 || mainItem.replyingToMessage || mainItem.editingMessage + Layout.fillWidth: true + Layout.preferredHeight: implicitHeight + topPadding: Utils.getSizeWithScreenRatio(12) + bottomPadding: Utils.getSizeWithScreenRatio(12) + leftPadding: Utils.getSizeWithScreenRatio(19) + rightPadding: Utils.getSizeWithScreenRatio(19) - onEphemeralSettingsRequested: contentLoader.panelType = SelectedChatView.PanelType.EphemeralSettings - onShowSharedFilesRequested: (showMedias) => { - contentLoader.panelType = showMedias ? SelectedChatView.PanelType.Medias : SelectedChatView.PanelType.SharedFiles - } - onManageParticipantsRequested: contentLoader.panelType = SelectedChatView.PanelType.ManageParticipants - onOneOneCall: (video) => mainItem.oneOneCall(video) - onGroupCall: mainItem.groupCall() - } - } + Button { + anchors.top: parent.top + anchors.right: parent.right + anchors.topMargin: selectedFilesArea.topPadding + anchors.rightMargin: selectedFilesArea.rightPadding + icon.source: AppIcons.closeX + style: ButtonStyle.noBackground + onClicked: { + contents.clear(); + if (mainItem.replyingToMessage) + mainItem.replyingToMessage = false; + else if (mainItem.editingMessage) { + mainItem.editingMessage = false; + messageSender.text = ""; + } + } + } + background: Item { + anchors.fill: parent + Rectangle { + color: DefaultStyle.grey_0 + border.color: DefaultStyle.main2_100 + border.width: Utils.getSizeWithScreenRatio(2) + height: parent.height / 2 + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + } + Rectangle { + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + height: 2 * parent.height / 3 + } + } + contentItem: ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(5) + ColumnLayout { + id: replyLayout + spacing: 0 + visible: mainItem.chatMessage && (mainItem.replyingToMessage || mainItem.editingMessage) + Text { + Layout.fillWidth: true + //: Reply to %1 + text: mainItem.replyingToMessage ? (mainItem.chatMessage ? qsTr("reply_to_label").arg(UtilsCpp.boldTextPart( + mainItem.chatMessage.core.fromName, mainItem.chatMessage.core.fromName)) : "") : qsTr( + "conversation_editing_message_title") + color: DefaultStyle.main2_500_main + textFormat: Text.RichText + font { + pixelSize: Typography.p3.pixelSize + weight: Typography.p3.weight + } + } + Text { + Layout.fillWidth: true + text: mainItem.chatMessage ? mainItem.chatMessage.core.text : "" + color: DefaultStyle.main2_400 + font { + pixelSize: Typography.p3.pixelSize + weight: Typography.p3.weight + } + } + } + Rectangle { + Layout.fillWidth: true + visible: replyLayout.visible && selectedFiles.visible + color: DefaultStyle.main2_300 + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) + } + ListView { + id: selectedFiles + orientation: ListView.Horizontal + visible: count > 0 + spacing: Utils.getSizeWithScreenRatio(16) + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(104) + model: ChatMessageContentProxy { + id: contents + filterType: ChatMessageContentProxy.FilterContentType.File + } + delegate: Item { + width: Utils.getSizeWithScreenRatio(80) + height: Utils.getSizeWithScreenRatio(80) + FileView { + contentGui: modelData + anchors.left: parent.left + anchors.bottom: parent.bottom + width: Utils.getSizeWithScreenRatio(69) + height: Utils.getSizeWithScreenRatio(69) + } + RoundButton { + icon.source: AppIcons.closeX + icon.width: Utils.getSizeWithScreenRatio(12) + icon.height: Utils.getSizeWithScreenRatio(12) + anchors.top: parent.top + anchors.right: parent.right + style: ButtonStyle.numericPad + shadowEnabled: true + padding: Utils.getSizeWithScreenRatio(3) + onClicked: contents.removeContent(modelData) + } + } + Control.ScrollBar.horizontal: selectedFilesScrollbar + } + } + ScrollBar { + id: selectedFilesScrollbar + active: true + anchors.bottom: selectedFilesArea.bottom + anchors.left: selectedFilesArea.left + anchors.right: selectedFilesArea.right + } + } + } + ChatDroppableTextArea { + id: messageSender + Control.SplitView.preferredHeight: mainItem.chat?.core.isReadOnly ? 0 : height + Control.SplitView.fillHeight: true + Control.SplitView.minimumHeight: mainItem.chat?.core.isReadOnly ? 0 : Utils.getSizeWithScreenRatio(79) + chat: mainItem.chat + selectedFilesCount: contents.count + callOngoing: mainItem.call != null + isEditing: mainItem.editingMessage + onChatChanged: { + if (chat) + messageSender.text = mainItem.chat.core.sendingText; + } + onTextChanged: { + if (text !== "") { + mainItem.chat.core.lCompose(); + } + mainItem.lastChar = text.slice(-1); + mainItem.chat.core.sendingText = text; + } + onSendMessage: { + var filesContents = contents.getAll(); + if (mainItem.replyingToMessage) { + mainItem.replyingToMessage = false; + UtilsCpp.sendReplyMessage(mainItem.chatMessage, mainItem.chat, text, filesContents); + } else if (mainItem.editingMessage) { + UtilsCpp.sendReplaceMessage(mainItem.chatMessage, mainItem.chat, text, filesContents); + mainItem.editingMessage = false; + } else if (filesContents.length === 0) + mainItem.chat.core.lSendTextMessage(text); + else + mainItem.chat.core.lSendMessage(text, filesContents); + contents.clear(); + } + onDropped: files => { + contents.addFiles(files); + } + Connections { + target: mainItem + function onReplyingToMessageChanged() { + if (mainItem.replyingToMessage) + messageSender.focusTextArea(); + } + function onChatChanged() { + messageSender.focusTextArea(); + } + } + } + } + } + Rectangle { + visible: detailsPanel.visible && detailsPanel.width < mainItem.width + color: DefaultStyle.main2_200 + Layout.preferredWidth: Utils.getSizeWithScreenRatio(1) + Layout.fillHeight: true + } + Control.Control { + id: detailsPanel + visible: false + Layout.fillHeight: true + Layout.preferredWidth: Math.min(Utils.getSizeWithScreenRatio(387), mainItem.width) + onVisibleChanged: if (!visible) { + contentLoader.panelType = SelectedChatView.PanelType.None; + } - Component { - id: messageReactionsComponent - MessageReactionsInfos { - chatMessageGui: mainItem.chatMessage - onGoBackRequested: { - detailsPanel.visible = false - mainItem.chatMessage = null - } - } - } - Component { - id: messageImdnStatusComponent - MessageImdnStatusInfos { - chatMessageGui: mainItem.chatMessage - onGoBackRequested: { - detailsPanel.visible = false - mainItem.chatMessage = null - } - } - } + background: Rectangle { + color: DefaultStyle.grey_0 + anchors.fill: parent + RoundButton { + style: ButtonStyle.noBackgroundOrange + icon.source: AppIcons.leftArrow + onClicked: detailsPanel.visible = false + } + } - Component { - id: sharedFilesComponent - MessageSharedFilesInfos { - chatGui: mainItem.chat - showAsSquare: contentLoader.panelType === SelectedChatView.PanelType.Medias - title: contentLoader.panelType === SelectedChatView.PanelType.Medias - //: Shared medias - ? qsTr("shared_medias_title") - //: Shared documents - : qsTr("shared_documents_title") - filter: contentLoader.panelType === SelectedChatView.PanelType.Medias ? ChatMessageFileProxy.FilterContentType.Medias : ChatMessageFileProxy.FilterContentType.Documents - onGoBackRequested: { - // detailsPanel.visible = false - contentLoader.panelType = SelectedChatView.PanelType.None - } - } - } - - Component { - id: manageParticipantsComponent - ManageParticipants { - chatGui: mainItem.chat - onDone: contentLoader.panelType = SelectedChatView.PanelType.None - } - } - - Component { - id: ephemeralSettingsComponent - EphemeralSettings { - chatGui: mainItem.chat - onDone: contentLoader.panelType = SelectedChatView.PanelType.None - } - } + contentItem: Loader { + id: contentLoader + property int panelType: SelectedChatView.PanelType.None + // anchors.top: parent.top + anchors.fill: parent + anchors.topMargin: Utils.getSizeWithScreenRatio(39) + anchors.rightMargin: Utils.getSizeWithScreenRatio(15) + sourceComponent: panelType === SelectedChatView.PanelType.EphemeralSettings ? ephemeralSettingsComponent : + panelType === SelectedChatView.PanelType.MessageReactions ? messageReactionsComponent : + panelType === SelectedChatView.PanelType.ImdnStatus + ? messageImdnStatusComponent : panelType + === SelectedChatView.PanelType.SharedFiles || panelType + === SelectedChatView.PanelType.Medias ? sharedFilesComponent : panelType + === SelectedChatView.PanelType.ForwardToList ? forwardToListsComponent : + panelType + === SelectedChatView.PanelType.ManageParticipants + ? manageParticipantsComponent : infoComponent + active: detailsPanel.visible + onLoaded: { + if (contentLoader.item && contentLoader.item.parentView) { + contentLoader.item.parentView = mainItem; + } + } + Connections { + target: mainItem + function onChatChanged() { + detailsPanel.visible = false; + } + } + } - Component { - id: forwardToListsComponent - MessageInfosLayout { - //: Forward to… - title: qsTr("forward_to_title") - // width: detailsPanel.width - // RectangleTest{anchors.fill: parent} - onGoBackRequested: { - detailsPanel.visible = false - mainItem.chatMessage = null - } - content: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(31) - SearchBar { - id: forwardSearchBar - Layout.fillWidth: true - } - Flickable { - Layout.fillWidth: true - Layout.fillHeight: true - contentWidth: parent.width - // width: parent.width - // Control.ScrollBar.vertical: ScrollBar { - // id: scrollbar - // topPadding: Utils.getSizeWithScreenRatio(24) // Avoid to be on top of collapse button - // active: true - // interactive: true - // visible: parent.contentHeight > parent.height - // policy: Control.ScrollBar.AsNeeded - // } - ColumnLayout { - anchors.left: parent.left - anchors.right: parent.right - spacing: Utils.getSizeWithScreenRatio(8) - // width: parent.width //- scrollbar.width - Utils.getSizeWithScreenRatio(5) - RowLayout { - Text { - //: Conversations - text: qsTr("conversations_title") - font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight - } - } - Item{Layout.fillWidth: true} - RoundButton { - id: expandChatButton - style: ButtonStyle.noBackground - checkable: true - checked: true - icon.source: checked ? AppIcons.upArrow : AppIcons.downArrow - } - } - ChatListView { - visible: expandChatButton.checked - searchBar: forwardSearchBar - Layout.fillWidth: true - Layout.preferredHeight: contentHeight - onChatClicked: (chat) => { - UtilsCpp.forwardMessageTo(mainItem.chatMessage, chat) - mainItem.chat = chat - detailsPanel.visible = false - } - } - AllContactListView { - Layout.fillWidth: true - itemsRightMargin: 0 - showActions: false - showContactMenu: false - showFavorites: false - searchBarText: forwardSearchBar.text - Layout.preferredHeight: contentHeight - onContactSelected: contact => selectedFriend = contact - property FriendGui selectedFriend: null - property var chatForSelectedAddressObj: selectedFriend ? UtilsCpp.getChatForAddress(selectedFriend.core.defaultAddress) : null - property ChatGui chatForAddress: chatForSelectedAddressObj ? chatForSelectedAddressObj.value : null - onChatForAddressChanged: if(chatForAddress) { - UtilsCpp.forwardMessageTo(mainItem.chatMessage, chatForAddress) - mainItem.chat = chatForAddress - detailsPanel.visible = false - } - } - } - } - } - } - } - } - } + Component { + id: infoComponent + ConversationInfos { + chatGui: mainItem.chat + + onEphemeralSettingsRequested: contentLoader.panelType = SelectedChatView.PanelType.EphemeralSettings + onShowSharedFilesRequested: showMedias => { + contentLoader.panelType = showMedias ? SelectedChatView.PanelType.Medias : + SelectedChatView.PanelType.SharedFiles; + } + onManageParticipantsRequested: contentLoader.panelType = SelectedChatView.PanelType.ManageParticipants + onOneOneCall: video => mainItem.oneOneCall(video) + onGroupCall: mainItem.groupCall() + } + } + + Component { + id: messageReactionsComponent + MessageReactionsInfos { + chatMessageGui: mainItem.chatMessage + onGoBackRequested: { + detailsPanel.visible = false; + mainItem.chatMessage = null; + } + } + } + Component { + id: messageImdnStatusComponent + MessageImdnStatusInfos { + chatMessageGui: mainItem.chatMessage + onGoBackRequested: { + detailsPanel.visible = false; + mainItem.chatMessage = null; + } + } + } + + Component { + id: sharedFilesComponent + MessageSharedFilesInfos { + chatGui: mainItem.chat + showAsSquare: contentLoader.panelType === SelectedChatView.PanelType.Medias + title: contentLoader.panelType === SelectedChatView.PanelType.Medias ? + //: Shared medias + qsTr("shared_medias_title") : + //: Shared documents + qsTr("shared_documents_title") + filter: contentLoader.panelType === SelectedChatView.PanelType.Medias + ? ChatMessageFileProxy.FilterContentType.Medias : ChatMessageFileProxy.FilterContentType.Documents + onGoBackRequested: { + // detailsPanel.visible = false + contentLoader.panelType = SelectedChatView.PanelType.None; + } + } + } + + Component { + id: manageParticipantsComponent + ManageParticipants { + chatGui: mainItem.chat + onDone: contentLoader.panelType = SelectedChatView.PanelType.None + } + } + + Component { + id: ephemeralSettingsComponent + EphemeralSettings { + chatGui: mainItem.chat + onDone: contentLoader.panelType = SelectedChatView.PanelType.None + } + } + + Component { + id: forwardToListsComponent + MessageInfosLayout { + //: Forward to… + title: qsTr("forward_to_title") + // width: detailsPanel.width + // RectangleTest{anchors.fill: parent} + onGoBackRequested: { + detailsPanel.visible = false; + mainItem.chatMessage = null; + } + content: ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(31) + SearchBar { + id: forwardSearchBar + Layout.fillWidth: true + } + Flickable { + Layout.fillWidth: true + Layout.fillHeight: true + contentWidth: parent.width + // width: parent.width + // Control.ScrollBar.vertical: ScrollBar { + // id: scrollbar + // topPadding: Utils.getSizeWithScreenRatio(24) // Avoid to be on top of collapse button + // active: true + // interactive: true + // visible: parent.contentHeight > parent.height + // policy: Control.ScrollBar.AsNeeded + // } + ColumnLayout { + anchors.left: parent.left + anchors.right: parent.right + spacing: Utils.getSizeWithScreenRatio(8) + // width: parent.width //- scrollbar.width - Utils.getSizeWithScreenRatio(5) + RowLayout { + Text { + //: Conversations + text: qsTr("conversations_title") + font { + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight + } + } + Item { + Layout.fillWidth: true + } + RoundButton { + id: expandChatButton + style: ButtonStyle.noBackground + checkable: true + checked: true + icon.source: checked ? AppIcons.upArrow : AppIcons.downArrow + } + } + ChatListView { + visible: expandChatButton.checked + searchBar: forwardSearchBar + Layout.fillWidth: true + Layout.preferredHeight: contentHeight + onChatClicked: chat => { + UtilsCpp.forwardMessageTo(mainItem.chatMessage, chat); + mainItem.chat = chat; + detailsPanel.visible = false; + } + } + AllContactListView { + Layout.fillWidth: true + itemsRightMargin: 0 + showActions: false + showContactMenu: false + showFavorites: false + searchBarText: forwardSearchBar.text + Layout.preferredHeight: contentHeight + onContactSelected: contact => selectedFriend = contact + property FriendGui selectedFriend: null + property var chatForSelectedAddressObj: selectedFriend ? UtilsCpp.getChatForAddress( + selectedFriend.core.defaultAddress) : null + property ChatGui chatForAddress: chatForSelectedAddressObj ? chatForSelectedAddressObj.value : null + onChatForAddressChanged: if (chatForAddress) { + UtilsCpp.forwardMessageTo(mainItem.chatMessage, chatForAddress); + mainItem.chat = chatForAddress; + detailsPanel.visible = false; + } + } + } + } + } + } + } + } + } } diff --git a/Linphone/view/Page/Form/Contact/ContactDescription.qml b/Linphone/view/Page/Form/Contact/ContactDescription.qml index c98cf0d52..d374056a4 100644 --- a/Linphone/view/Page/Form/Contact/ContactDescription.qml +++ b/Linphone/view/Page/Form/Contact/ContactDescription.qml @@ -7,21 +7,22 @@ import UtilsCpp import SettingsCpp import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils -ColumnLayout{ +ColumnLayout { id: mainItem property AccountGui account: null property string topText: account ? account.core.displayName : "" - property string bottomText: account ? SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(account.core.identityAddress) : account.core.identityAddress : "" + property string bottomText: account ? SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(account.core.identityAddress) : + account.core.identityAddress : "" spacing: 0 width: topTextItem.implicitWidth Text { id: topTextItem Layout.fillHeight: true Layout.fillWidth: true - verticalAlignment: (bottomTextItem.visible?Text.AlignBottom:Text.AlignVCenter) + verticalAlignment: (bottomTextItem.visible ? Text.AlignBottom : Text.AlignVCenter) visible: text != "" - font.weight: Typography.p1.weight - font.pixelSize: Typography.p1.pixelSize + font.weight: Typography.p1.weight + font.pixelSize: Typography.p1.pixelSize color: DefaultStyle.main2_700 text: mainItem.topText width: mainItem.width @@ -32,10 +33,10 @@ ColumnLayout{ id: bottomTextItem Layout.fillHeight: true Layout.fillWidth: true - verticalAlignment: (topTextItem.visible?Text.AlignTop:Text.AlignVCenter) + verticalAlignment: (topTextItem.visible ? Text.AlignTop : Text.AlignVCenter) visible: text != '' - font.weight: Utils.getSizeWithScreenRatio(300) - font.pixelSize: Utils.getSizeWithScreenRatio(12) + 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 a734c42ea..a0077e768 100644 --- a/Linphone/view/Page/Form/Contact/ContactEdition.qml +++ b/Linphone/view/Page/Form/Contact/ContactEdition.qml @@ -7,8 +7,8 @@ import QtQuick.Layouts import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle MainRightPanel { id: mainItem @@ -16,31 +16,31 @@ MainRightPanel { property FriendGui contact Connections { enabled: contact - target: contact? contact.core : null + target: contact ? contact.core : null function onIsSavedChanged() { if (contact.core.isSaved) { - mainItem.closeEdition(contact.core.defaultFullAddress) + mainItem.closeEdition(contact.core.defaultFullAddress); } } } - //: "Modifier contact" - property string title: qsTr("contact_editor_title") - //: "Enregistrer - property string saveButtonText: qsTr("save") + //: "Modifier contact" + property string title: qsTr("contact_editor_title") + //: "Enregistrer + property string saveButtonText: qsTr("save") property string oldPictureUri - property int addressCount: 0 - - signal closeEdition(var redirectAddress) + property int addressCount: 0 + + signal closeEdition(var redirectAddress) Dialog { id: confirmDialog onAccepted: { - mainItem.contact.core.undo() - mainItem.closeEdition('') + mainItem.contact.core.undo(); + mainItem.closeEdition(''); } - width: Utils.getSizeWithScreenRatio(278) - //: "Les changements seront annulés. Souhaitez-vous continuer ?" - text: qsTr("contact_editor_dialog_cancel_change_message") + width: Utils.getSizeWithScreenRatio(278) + //: "Les changements seront annulés. Souhaitez-vous continuer ?" + text: qsTr("contact_editor_dialog_cancel_change_message") } headerContentItem: RowLayout { @@ -51,7 +51,9 @@ MainRightPanel { weight: Typography.h4.weight } } - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } Button { style: ButtonStyle.noBackground Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) @@ -62,13 +64,15 @@ MainRightPanel { //: Close %1 Accessible.name: qsTr("close_accessible_name").arg(mainItem.title) onClicked: { - if (contact.core.isSaved) mainItem.closeEdition('') - else showConfirmationLambdaPopup("", qsTr("contact_editor_dialog_cancel_change_message"), "", function(confirmed) { - if (confirmed) { - mainItem.contact.core.undo() - mainItem.closeEdition('') - } - }) + if (contact.core.isSaved) + mainItem.closeEdition(''); + else + showConfirmationLambdaPopup("", qsTr("contact_editor_dialog_cancel_change_message"), "", function (confirmed) { + if (confirmed) { + mainItem.contact.core.undo(); + mainItem.closeEdition(''); + } + }); } } } @@ -78,33 +82,33 @@ MainRightPanel { anchors.fill: parent contact: mainItem.contact button.text: mainItem.saveButtonText - button.Keys.onPressed: (event) => { - if(event.key == Qt.Key_Up){ - phoneNumberInput.forceActiveFocus(Qt.BacktabFocusReason) - event.accepted = true - } - } - + button.Keys.onPressed: event => { + if (event.key == Qt.Key_Up) { + phoneNumberInput.forceActiveFocus(Qt.BacktabFocusReason); + event.accepted = true; + } + } + // Let some time to GUI to set fields on losing focus. - Timer{ + Timer { id: saveDelay interval: 200 onTriggered: { //: "Veuillez saisir un prénom ou un nom d'entreprise" if (mainItem.contact.core.givenName.length === 0 && mainItem.contact.core.organization.length === 0) { - givenName.errorMessage = qsTr("contact_editor_mandatory_first_name_or_company_not_filled") - return + givenName.errorMessage = qsTr("contact_editor_mandatory_first_name_or_company_not_filled"); + return; } else if (addressesList.count === 0 && phoneNumberList.count === 0) { - //: "Veuillez saisir une adresse ou un numéro de téléphone" - addressesErrorText.setText(qsTr("contact_editor_mandatory_address_or_number_not_filled")) - return + //: "Veuillez saisir une adresse ou un numéro de téléphone" + addressesErrorText.setText(qsTr("contact_editor_mandatory_address_or_number_not_filled")); + return; } - mainItem.contact.core.save() + mainItem.contact.core.save(); } } button.onClicked: { - button.forceActiveFocus() - saveDelay.restart() + button.forceActiveFocus(); + saveDelay.restart(); } bannerContent: [ IconLabelButton { @@ -112,10 +116,10 @@ MainRightPanel { Layout.preferredWidth: width visible: !mainItem.contact || mainItem.contact.core.pictureUri.length === 0 icon.source: AppIcons.camera - //: "Ajouter une image" - text: qsTr("contact_editor_add_image_label") - textSize: Typography.h4.pixelSize - textWeight: Typography.h4.weight + //: "Ajouter une image" + text: qsTr("contact_editor_add_image_label") + textSize: Typography.h4.pixelSize + textWeight: Typography.h4.weight textColor: DefaultStyle.main2_700 hoveredTextColor: DefaultStyle.main2_800 pressedTextColor: DefaultStyle.main2_900 @@ -125,18 +129,18 @@ MainRightPanel { RowLayout { visible: mainItem.contact && mainItem.contact.core.pictureUri.length != 0 Layout.alignment: Qt.AlignHCenter - spacing: Utils.getSizeWithScreenRatio(32) + spacing: Utils.getSizeWithScreenRatio(32) IconLabelButton { id: editButton Layout.preferredWidth: width icon.source: AppIcons.pencil - //: "Modifier" - text: qsTr("contact_details_edit") + //: "Modifier" + text: qsTr("contact_details_edit") textColor: DefaultStyle.main2_700 hoveredTextColor: DefaultStyle.main2_800 pressedTextColor: DefaultStyle.main2_900 - textSize: Typography.h4.pixelSize - textWeight: Typography.h4.weight + textSize: Typography.h4.pixelSize + textWeight: Typography.h4.weight KeyNavigation.right: removeButton onClicked: fileDialog.open() //: "Edit contact image" @@ -146,10 +150,10 @@ MainRightPanel { id: fileDialog currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0] onAccepted: { - mainItem.oldPictureUri = mainItem.contact.core.pictureUri - var avatarPath = UtilsCpp.createAvatar( selectedFile ) - if(avatarPath){ - mainItem.contact.core.pictureUri = avatarPath + mainItem.oldPictureUri = mainItem.contact.core.pictureUri; + var avatarPath = UtilsCpp.createAvatar(selectedFile); + if (avatarPath) { + mainItem.contact.core.pictureUri = avatarPath; } } } @@ -157,61 +161,62 @@ MainRightPanel { id: removeButton Layout.preferredWidth: width icon.source: AppIcons.trashCan - //: "Supprimer" - text: qsTr("contact_details_delete") + //: "Supprimer" + text: qsTr("contact_details_delete") textColor: DefaultStyle.main2_700 hoveredTextColor: DefaultStyle.main2_800 pressedTextColor: DefaultStyle.main2_900 - textSize: Typography.h4.pixelSize - textWeight: Typography.h4.weight + textSize: Typography.h4.pixelSize + textWeight: Typography.h4.weight KeyNavigation.left: editButton onClicked: mainItem.contact.core.pictureUri = "" //: "Delete contact image" Accessible.name: qsTr("delete_contact_image_accessible_name") } }, - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } ] content: Flickable { id: editionLayout - contentWidth: Math.min(parent.width, Utils.getSizeWithScreenRatio(421)) - width: parent.width + contentWidth: Math.min(parent.width, Utils.getSizeWithScreenRatio(421)) + width: parent.width contentY: 0 - MouseArea { - anchors.fill: parent - onClicked: { - editionLayout.forceActiveFocus() - } - } + MouseArea { + anchors.fill: parent + onClicked: { + editionLayout.forceActiveFocus(); + } + } signal ensureVisibleRequested(Item item) function ensureVisible(r) { if (contentY >= r.y) contentY = r.y; - else if (contentY+height <= r.y+r.height) + else if (contentY + height <= r.y + r.height) contentY = r.y + r.height - height; } // Hack to ensure the empty textfield is really visible, because // its y changes too late after the editingFinished is emitted function connectOnce(sig, slot) { - var f = function() { - slot.apply(this, arguments) - sig.disconnect(f) - } - sig.connect(f) + var f = function () { + slot.apply(this, arguments); + sig.disconnect(f); + }; + sig.connect(f); } ScrollBar.vertical: ScrollBar { anchors.right: parent.right visible: editionLayout.contentHeight > editionLayout.height } - ScrollBar.horizontal: ScrollBar { - } + ScrollBar.horizontal: ScrollBar {} ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) anchors.left: parent.left anchors.right: parent.right @@ -219,14 +224,14 @@ MainRightPanel { id: givenName Layout.fillWidth: true enableErrorText: true - //: "Prénom" - label: qsTr("contact_editor_first_name") + //: "Prénom" + label: qsTr("contact_editor_first_name") contentItem: TextField { id: givenNameEdit - Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) initialText: contact.core.givenName onTextEdited: { - contact.core.givenName = givenNameEdit.text + contact.core.givenName = givenNameEdit.text; } backgroundColor: DefaultStyle.grey_0 backgroundBorderColor: givenName.errorTextVisible ? DefaultStyle.danger_500_main : DefaultStyle.grey_200 @@ -235,9 +240,9 @@ MainRightPanel { Accessible.name: qsTr("contact_editor_first_name") } } - FormItemLayout { - //: "Nom" - label: qsTr("contact_editor_last_name") + FormItemLayout { + //: "Nom" + label: qsTr("contact_editor_last_name") Layout.fillWidth: true contentItem: TextField { id: nameTextField @@ -250,8 +255,8 @@ MainRightPanel { } } FormItemLayout { - //: "Entreprise" - label: qsTr("contact_editor_company") + //: "Entreprise" + label: qsTr("contact_editor_company") Layout.fillWidth: true contentItem: TextField { id: companyTextField @@ -264,8 +269,8 @@ MainRightPanel { } } FormItemLayout { - //: "Fonction" - label: qsTr("contact_editor_job_title") + //: "Fonction" + label: qsTr("contact_editor_job_title") Layout.fillWidth: true contentItem: TextField { id: jobTextField @@ -273,12 +278,13 @@ MainRightPanel { onTextEdited: contact.core.job = text backgroundColor: DefaultStyle.grey_0 KeyNavigation.up: companyTextField - Keys.onPressed: (event) => { - if(event.key == Qt.Key_Down){ - (addressesList.count > 0 ? addressesList.itemAt(0) : newAddressTextField).forceActiveFocus(Qt.TabFocusReason) - event.accepted = true - } - } + Keys.onPressed: event => { + if (event.key == Qt.Key_Down) { + (addressesList.count > 0 ? addressesList.itemAt(0) : newAddressTextField).forceActiveFocus( + Qt.TabFocusReason); + event.accepted = true; + } + } Accessible.name: qsTr("contact_editor_job_title") } } @@ -292,48 +298,50 @@ MainRightPanel { label: modelData.label contentItem: RowLayout { id: addressLayout - spacing: Utils.getSizeWithScreenRatio(10) - function updateFocus(event){ - if(event.key == Qt.Key_Up){ - (index - 1 >=0 ? addressesList.itemAt(index - 1) : jobTextField).forceActiveFocus(Qt.BacktabFocusReason) - event.accepted = true - }else if(event.key == Qt.Key_Down){ - (index + 1 < addressesList.count ? addressesList.itemAt(index+1) : newAddressTextField).forceActiveFocus(Qt.TabFocusReason) - event.accepted = true - }else if(event.key == Qt.Key_Right && addressTextField.activeFocus){ - removeAddressButton.forceActiveFocus(Qt.TabFocusReason) - }else if(event.key == Qt.Key_Left && removeAddressButton.activeFocus){ - addressTextField.forceActiveFocus(Qt.BacktabFocusReason) + spacing: Utils.getSizeWithScreenRatio(10) + function updateFocus(event) { + if (event.key == Qt.Key_Up) { + (index - 1 >= 0 ? addressesList.itemAt(index - 1) : jobTextField).forceActiveFocus(Qt.BacktabFocusReason); + event.accepted = true; + } else if (event.key == Qt.Key_Down) { + (index + 1 < addressesList.count ? addressesList.itemAt(index + 1) : newAddressTextField).forceActiveFocus( + Qt.TabFocusReason); + event.accepted = true; + } else if (event.key == Qt.Key_Right && addressTextField.activeFocus) { + removeAddressButton.forceActiveFocus(Qt.TabFocusReason); + } else if (event.key == Qt.Key_Left && removeAddressButton.activeFocus) { + addressTextField.forceActiveFocus(Qt.BacktabFocusReason); } } TextField { id: addressTextField - Layout.preferredWidth: Utils.getSizeWithScreenRatio(421) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(421) Layout.preferredHeight: height onEditingFinished: { - var label = qsTr("sip_address") - if (text.length != 0) mainItem.contact.core.setAddressAt(index, label, text) + var label = qsTr("sip_address"); + if (text.length != 0) + mainItem.contact.core.setAddressAt(index, label, text); } property string _initialText: modelData.address initialText: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(_initialText) : _initialText backgroundColor: DefaultStyle.grey_0 focus: true KeyNavigation.right: removeAddressButton - Keys.onPressed: (event) => addressLayout.updateFocus(event) + Keys.onPressed: event => addressLayout.updateFocus(event) //: "SIP address number %1" - Accessible.name: qsTr("sip_address_number_accessible_name").arg(index+1) + Accessible.name: qsTr("sip_address_number_accessible_name").arg(index + 1) } Button { id: removeAddressButton - Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) Layout.alignment: Qt.AlignVCenter icon.source: AppIcons.closeX - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) style: ButtonStyle.noBackground KeyNavigation.left: addressTextField - Keys.onPressed: (event) => addressLayout.updateFocus(event) + Keys.onPressed: event => addressLayout.updateFocus(event) onClicked: mainItem.contact.core.removeAddress(index) //: "Remove SIP address %1" Accessible.name: qsTr("remove_sip_address_accessible_name").arg(addressTextField.text) @@ -343,27 +351,30 @@ MainRightPanel { } FormItemLayout { id: newAddressSipTextField - label: qsTr("sip_address") + label: qsTr("sip_address") Layout.fillWidth: true onYChanged: { - editionLayout.ensureVisibleRequested(newAddressSipTextField) + editionLayout.ensureVisibleRequested(newAddressSipTextField); } contentItem: TextField { id: newAddressTextField backgroundColor: DefaultStyle.grey_0 - Keys.onPressed: (event) => { - if(event.key == Qt.Key_Up){ - (addressesList.count > 0 ? addressesList.itemAt(addressesList.count - 1) : jobTextField).forceActiveFocus(Qt.BacktabFocusReason) - event.accepted = true - }else if(event.key == Qt.Key_Down){ - (phoneNumberList.count > 0 ? phoneNumberList.itemAt(0) : phoneNumberInputTextField).forceActiveFocus(Qt.TabFocusReason) - event.accepted = true - } - } + Keys.onPressed: event => { + if (event.key == Qt.Key_Up) { + (addressesList.count > 0 ? addressesList.itemAt(addressesList.count - 1) : jobTextField).forceActiveFocus( + Qt.BacktabFocusReason); + event.accepted = true; + } else if (event.key == Qt.Key_Down) { + (phoneNumberList.count > 0 ? phoneNumberList.itemAt(0) : phoneNumberInputTextField).forceActiveFocus( + Qt.TabFocusReason); + event.accepted = true; + } + } onEditingFinished: { - if (text.length > 0) mainItem.contact.core.appendAddress(text) - newAddressTextField.clear() - editionLayout.connectOnce(editionLayout.ensureVisibleRequested, editionLayout.ensureVisible) + if (text.length > 0) + mainItem.contact.core.appendAddress(text); + newAddressTextField.clear(); + editionLayout.connectOnce(editionLayout.ensureVisibleRequested, editionLayout.ensureVisible); } //: "New SIP address" Accessible.name: qsTr("new_sip_address_accessible_name") @@ -378,43 +389,46 @@ MainRightPanel { label: modelData.label contentItem: RowLayout { id: phoneNumberLayout - spacing: Utils.getSizeWithScreenRatio(10) - function updateFocus(event){ - if(event.key == Qt.Key_Up){ - (index - 1 >=0 ? phoneNumberList.itemAt(index - 1): newAddressTextField).forceActiveFocus(Qt.BacktabFocusReason) - event.accepted = true - }else if(event.key == Qt.Key_Down){ - (index + 1 < phoneNumberList.count ? phoneNumberList.itemAt(index+1) : phoneNumberInputTextField).forceActiveFocus(Qt.TabFocusReason) - event.accepted = true + spacing: Utils.getSizeWithScreenRatio(10) + function updateFocus(event) { + if (event.key == Qt.Key_Up) { + (index - 1 >= 0 ? phoneNumberList.itemAt(index - 1) : newAddressTextField).forceActiveFocus( + Qt.BacktabFocusReason); + event.accepted = true; + } else if (event.key == Qt.Key_Down) { + (index + 1 < phoneNumberList.count ? phoneNumberList.itemAt(index + 1) : + phoneNumberInputTextField).forceActiveFocus(Qt.TabFocusReason); + event.accepted = true; } } TextField { id: phoneTextField - Layout.preferredWidth: Utils.getSizeWithScreenRatio(421) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(421) Layout.preferredHeight: height initialText: modelData.address backgroundColor: DefaultStyle.grey_0 focus: true KeyNavigation.right: removePhoneButton - Keys.onPressed: (event) => phoneNumberLayout.updateFocus(event) + Keys.onPressed: event => phoneNumberLayout.updateFocus(event) onEditingFinished: { - //: "Téléphone" - if (text.length != 0) mainItem.contact.core.setPhoneNumberAt(index, qsTr("phone"), text) + //: "Téléphone" + if (text.length != 0) + mainItem.contact.core.setPhoneNumberAt(index, qsTr("phone"), text); } //: "Phone number number %1" - Accessible.name: qsTr("phone_number_number_accessible_name").arg(index+1) + Accessible.name: qsTr("phone_number_number_accessible_name").arg(index + 1) } Button { id: removePhoneButton - Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) Layout.alignment: Qt.AlignVCenter style: ButtonStyle.noBackground icon.source: AppIcons.closeX - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) KeyNavigation.left: phoneTextField - Keys.onPressed: (event) => phoneNumberLayout.updateFocus(event) + Keys.onPressed: event => phoneNumberLayout.updateFocus(event) onClicked: mainItem.contact.core.removePhoneNumber(index) //: Remove phone number %1 Accessible.name: qsTr("remove_phone_number_accessible_name").arg(phoneTextField.text) @@ -425,26 +439,29 @@ MainRightPanel { FormItemLayout { id: phoneNumberInput Layout.fillWidth: true - label: qsTr("phone") + label: qsTr("phone") onYChanged: { - editionLayout.ensureVisibleRequested(phoneNumberInput) + editionLayout.ensureVisibleRequested(phoneNumberInput); } contentItem: TextField { id: phoneNumberInputTextField backgroundColor: DefaultStyle.grey_0 - Keys.onPressed: (event) => { - if(event.key == Qt.Key_Up){ - (phoneNumberList.count > 0 ? phoneNumberList.itemAt(phoneNumberList.count - 1) : newAddressTextField).forceActiveFocus(Qt.BacktabFocusReason) - event.accepted = true - }else if(event.key == Qt.Key_Down){ - (contactLayoutItem.button.enabled ? contactLayoutItem.button : givenNameEdit).forceActiveFocus(Qt.TabFocusReason) - event.accepted = true - } - } + Keys.onPressed: event => { + if (event.key == Qt.Key_Up) { + (phoneNumberList.count > 0 ? phoneNumberList.itemAt(phoneNumberList.count - 1) : + newAddressTextField).forceActiveFocus(Qt.BacktabFocusReason); + event.accepted = true; + } else if (event.key == Qt.Key_Down) { + (contactLayoutItem.button.enabled ? contactLayoutItem.button : givenNameEdit).forceActiveFocus( + Qt.TabFocusReason); + event.accepted = true; + } + } onEditingFinished: { - if (text.length != 0) mainItem.contact.core.appendPhoneNumber(phoneNumberInput.label, text) - phoneNumberInputTextField.clear() - editionLayout.connectOnce(editionLayout.ensureVisibleRequested, editionLayout.ensureVisible) + if (text.length != 0) + mainItem.contact.core.appendPhoneNumber(phoneNumberInput.label, text); + phoneNumberInputTextField.clear(); + editionLayout.connectOnce(editionLayout.ensureVisibleRequested, editionLayout.ensureVisible); } //: "New phone number" Accessible.name: qsTr("new_phone_number_accessible_name") @@ -455,13 +472,13 @@ MainRightPanel { Layout.fillWidth: true wrapMode: Text.WordWrap elide: Text.ElideRight - onTextChanged: if(addressesErrorText.text.length > 0) editionLayout.ensureVisible(this) + onTextChanged: if (addressesErrorText.text.length > 0) + editionLayout.ensureVisible(this) + } + Item { + Layout.fillHeight: true } - Item{Layout.fillHeight: true} } } - } - - } diff --git a/Linphone/view/Page/Form/Login/LoginPage.qml b/Linphone/view/Page/Form/Login/LoginPage.qml index e7debe115..ad0957c2e 100644 --- a/Linphone/view/Page/Form/Login/LoginPage.qml +++ b/Linphone/view/Page/Form/Login/LoginPage.qml @@ -5,47 +5,47 @@ 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 -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle LoginLayout { id: mainItem property bool showBackButton: false - signal goBack() - signal useSIPButtonClicked() - signal useRemoteConfigButtonClicked() - signal goToRegister() + signal goBack + signal useSIPButtonClicked + signal useRemoteConfigButtonClicked + signal goToRegister titleContent: [ BigButton { enabled: mainItem.showBackButton opacity: mainItem.showBackButton ? 1.0 : 0 - Layout.leftMargin: Utils.getSizeWithScreenRatio(79) + Layout.leftMargin: Utils.getSizeWithScreenRatio(79) icon.source: AppIcons.leftArrow style: ButtonStyle.noBackground onClicked: { - console.debug("[LoginLayout] User: return") - mainItem.goBack() + console.debug("[LoginLayout] User: return"); + mainItem.goBack(); } //: Return Accessible.name: qsTr("return_accessible_name") }, RowLayout { - spacing: Utils.getSizeWithScreenRatio(15) - Layout.leftMargin: Utils.getSizeWithScreenRatio(21) + spacing: Utils.getSizeWithScreenRatio(15) + Layout.leftMargin: Utils.getSizeWithScreenRatio(21) EffectImage { fillMode: Image.PreserveAspectFit imageSource: AppIcons.profile colorizationColor: DefaultStyle.main2_600 - Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) } Text { - //: Connexion - text: qsTr("assistant_account_login") + //: Connexion + text: qsTr("assistant_account_login") font { - pixelSize: Typography.h1.pixelSize - weight: Typography.h1.weight + pixelSize: Typography.h1.pixelSize + weight: Typography.h1.weight } } }, @@ -54,24 +54,26 @@ LoginLayout { }, RowLayout { visible: !SettingsCpp.assistantHideCreateAccount - spacing: Utils.getSizeWithScreenRatio(20) - Layout.rightMargin: Math.max(Utils.getSizeWithScreenRatio(10), Utils.getSizeWithScreenRatio(51 - ((51/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width)))) + spacing: Utils.getSizeWithScreenRatio(20) + 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) - //: "Pas encore de compte ?" - text: qsTr("assistant_no_account_yet") - font.pixelSize: Typography.p1.pixelSize - font.weight: Typography.p1.weight + Layout.rightMargin: Utils.getSizeWithScreenRatio(15) + //: "Pas encore de compte ?" + text: qsTr("assistant_no_account_yet") + font.pixelSize: Typography.p1.pixelSize + font.weight: Typography.p1.weight } BigButton { Layout.alignment: Qt.AlignRight style: ButtonStyle.main - //: "S'inscrire" - text: qsTr("assistant_account_register") + //: "S'inscrire" + text: qsTr("assistant_account_register") onClicked: { - console.debug("[LoginPage] User: go to register") - mainItem.goToRegister() + console.debug("[LoginPage] User: go to register"); + mainItem.goToRegister(); } } } @@ -80,7 +82,7 @@ LoginLayout { Flickable { anchors.left: parent.left anchors.top: parent.top - anchors.leftMargin: Utils.getSizeWithScreenRatio(127) + anchors.leftMargin: Utils.getSizeWithScreenRatio(127) anchors.bottom: parent.bottom ColumnLayout { id: content @@ -90,22 +92,26 @@ LoginLayout { } BigButton { Layout.preferredWidth: loginForm.width - Layout.preferredHeight: Utils.getSizeWithScreenRatio(47) - Layout.topMargin: Utils.getSizeWithScreenRatio(39) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(47) + Layout.topMargin: Utils.getSizeWithScreenRatio(39) visible: !SettingsCpp.assistantHideThirdPartyAccount - //: "Compte SIP tiers" - text: qsTr("assistant_login_third_party_sip_account_title") + //: "Compte SIP tiers" + text: qsTr("assistant_login_third_party_sip_account_title") style: ButtonStyle.secondary - onClicked: {mainItem.useSIPButtonClicked()} + onClicked: { + mainItem.useSIPButtonClicked(); + } } BigButton { Layout.preferredWidth: loginForm.width - Layout.preferredHeight: Utils.getSizeWithScreenRatio(47) - Layout.topMargin: Utils.getSizeWithScreenRatio(25) - //: "Configuration distante" - text: qsTr("assistant_login_remote_provisioning") + Layout.preferredHeight: Utils.getSizeWithScreenRatio(47) + Layout.topMargin: Utils.getSizeWithScreenRatio(25) + //: "Configuration distante" + text: qsTr("assistant_login_remote_provisioning") style: ButtonStyle.secondary - onClicked: {fetchConfigDialog.open()} + onClicked: { + fetchConfigDialog.open(); + } } } }, @@ -113,48 +119,47 @@ LoginLayout { z: -1 anchors.top: parent.top anchors.right: parent.right - anchors.topMargin: Utils.getSizeWithScreenRatio(129) - anchors.rightMargin: Utils.getSizeWithScreenRatio(127) - width: Utils.getSizeWithScreenRatio(395) - height: Utils.getSizeWithScreenRatio(350) + anchors.topMargin: Utils.getSizeWithScreenRatio(129) + anchors.rightMargin: Utils.getSizeWithScreenRatio(127) + width: Utils.getSizeWithScreenRatio(395) + height: Utils.getSizeWithScreenRatio(350) fillMode: Image.PreserveAspectFit source: AppIcons.loginImage } ] - Dialog{ + Dialog { id: fetchConfigDialog - height: Utils.getSizeWithScreenRatio(315) - width: Utils.getSizeWithScreenRatio(637) - leftPadding: Utils.getSizeWithScreenRatio(33) - rightPadding: Utils.getSizeWithScreenRatio(33) - topPadding: Utils.getSizeWithScreenRatio(41) - bottomPadding: Utils.getSizeWithScreenRatio(29) + height: Utils.getSizeWithScreenRatio(315) + width: Utils.getSizeWithScreenRatio(637) + leftPadding: Utils.getSizeWithScreenRatio(33) + rightPadding: Utils.getSizeWithScreenRatio(33) + topPadding: Utils.getSizeWithScreenRatio(41) + bottomPadding: Utils.getSizeWithScreenRatio(29) radius: 0 - //: "Télécharger une configuration distante" - title: qsTr('assistant_login_download_remote_config') - //: 'Veuillez entrer le lien de configuration qui vous a été fourni :' - text: qsTr('assistant_login_remote_provisioning_url') + //: "Télécharger une configuration distante" + title: qsTr('assistant_login_download_remote_config') + //: 'Veuillez entrer le lien de configuration qui vous a été fourni :' + text: qsTr('assistant_login_remote_provisioning_url') - firstButton.text: qsTr("cancel") + firstButton.text: qsTr("cancel") firstButtonAccept: false firstButton.style: ButtonStyle.secondary - //: "Valider" - secondButton.text: qsTr("validate") + //: "Valider" + secondButton.text: qsTr("validate") secondButtonAccept: true secondButton.style: ButtonStyle.main - onAccepted:{ - UtilsCpp.useFetchConfig(configUrl.text) + onAccepted: { + UtilsCpp.useFetchConfig(configUrl.text); } - content:[ - TextField{ + content: [ + TextField { id: configUrl Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) - //: 'Lien de configuration distante' - placeholderText: qsTr("settings_advanced_remote_provisioning_url") + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + //: 'Lien de configuration distante' + placeholderText: qsTr("settings_advanced_remote_provisioning_url") } ] } } - diff --git a/Linphone/view/Page/Form/Login/SIPLoginPage.qml b/Linphone/view/Page/Form/Login/SIPLoginPage.qml index 55b5bbfd1..07aac9542 100644 --- a/Linphone/view/Page/Form/Login/SIPLoginPage.qml +++ b/Linphone/view/Page/Form/Login/SIPLoginPage.qml @@ -4,30 +4,30 @@ import QtQuick.Controls.Basic as Control import Linphone import ConstantsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle LoginLayout { id: mainItem - signal goBack() - signal goToRegister() + signal goBack + signal goToRegister property bool showBackButton: false - + titleContent: [ RowLayout { - Layout.leftMargin: Utils.getSizeWithScreenRatio(119) + Layout.leftMargin: Utils.getSizeWithScreenRatio(119) visible: !SettingsCpp.assistantHideThirdPartyAccount - spacing: Utils.getSizeWithScreenRatio(21) + spacing: Utils.getSizeWithScreenRatio(21) Button { id: backButton - visible: mainItem.showBackButton - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + visible: mainItem.showBackButton + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) icon.source: AppIcons.leftArrow style: ButtonStyle.noBackground onClicked: { - console.debug("[SIPLoginPage] User: return") - mainItem.goBack() + console.debug("[SIPLoginPage] User: return"); + mainItem.goBack(); } //: Return Accessible.name: qsTr("return_accessible_name") @@ -35,16 +35,16 @@ LoginLayout { EffectImage { fillMode: Image.PreserveAspectFit imageSource: AppIcons.profile - Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) colorizationColor: DefaultStyle.main2_600 } Text { - //: Compte SIP tiers - text: qsTr("assistant_login_third_party_sip_account_title") + //: Compte SIP tiers + text: qsTr("assistant_login_third_party_sip_account_title") font { - pixelSize: Typography.h1.pixelSize - weight: Typography.h1.weight + pixelSize: Typography.h1.pixelSize + weight: Typography.h1.weight } scaleLettersFactor: 1.1 } @@ -54,30 +54,30 @@ LoginLayout { }, RowLayout { visible: !SettingsCpp.assistantHideCreateAccount - Layout.rightMargin: Utils.getSizeWithScreenRatio(51) - spacing: Utils.getSizeWithScreenRatio(20) + Layout.rightMargin: Utils.getSizeWithScreenRatio(51) + spacing: Utils.getSizeWithScreenRatio(20) Text { - Layout.rightMargin: Utils.getSizeWithScreenRatio(15) - //: Pas encore de compte ? - text: qsTr("assistant_no_account_yet") + Layout.rightMargin: Utils.getSizeWithScreenRatio(15) + //: Pas encore de compte ? + text: qsTr("assistant_no_account_yet") font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight } } BigButton { Layout.alignment: Qt.AlignRight - //: S'inscrire - text: qsTr("assistant_account_register") + //: S'inscrire + text: qsTr("assistant_account_register") style: ButtonStyle.main onClicked: { - console.debug("[SIPLoginPage] User: go to register page") - mainItem.goToRegister() + console.debug("[SIPLoginPage] User: go to register page"); + mainItem.goToRegister(); } } } ] - + Component { id: firstItem Flickable { @@ -87,53 +87,55 @@ LoginLayout { clip: true flickableDirection: Flickable.VerticalFlick - Control.ScrollBar.vertical: scrollbar + Control.ScrollBar.vertical: scrollbar ColumnLayout { - id: content - // rightMargin is negative margin - width: parent.width - scrollbar.width*2 - spacing: Utils.getSizeWithScreenRatio(85) + id: content + // rightMargin is negative margin + width: parent.width - scrollbar.width * 2 + spacing: Utils.getSizeWithScreenRatio(85) ColumnLayout { spacing: 0 ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(28) + spacing: Utils.getSizeWithScreenRatio(28) Text { Layout.fillWidth: true Layout.preferredWidth: rootStackView.width wrapMode: Text.WordWrap color: DefaultStyle.main2_900 font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight } - text: qsTr("Certaines fonctionnalités telles que les conversations de groupe, les vidéo-conférences, etc… nécessitent un compte %1.\n\nCes fonctionnalités seront masquées si vous utilisez un compte SIP tiers.\n\nPour les activer dans un projet commercial, merci de nous contacter.").arg(applicationName) + text: qsTr( + "Certaines fonctionnalités telles que les conversations de groupe, les vidéo-conférences, etc… nécessitent un compte %1.\n\nCes fonctionnalités seront masquées si vous utilisez un compte SIP tiers.\n\nPour les activer dans un projet commercial, merci de nous contacter.").arg( + applicationName) } } SmallButton { id: openLinkButton Layout.alignment: Qt.AlignCenter - Layout.topMargin: Utils.getSizeWithScreenRatio(18) + Layout.topMargin: Utils.getSizeWithScreenRatio(18) text: "linphone.org/contact" style: ButtonStyle.secondary onClicked: { - Qt.openUrlExternally(ConstantsCpp.ContactUrl) + Qt.openUrlExternally(ConstantsCpp.ContactUrl); } KeyNavigation.up: backButton KeyNavigation.down: createAccountButton } } ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) BigButton { id: createAccountButton style: ButtonStyle.secondary Layout.fillWidth: true - //: "Créer un compte linphone" - text: qsTr("assistant_third_party_sip_account_create_linphone_account") + //: "Créer un compte linphone" + text: qsTr("assistant_third_party_sip_account_create_linphone_account") onClicked: { - console.debug("[SIPLoginPage] User: click register") - mainItem.goToRegister() + console.debug("[SIPLoginPage] User: click register"); + mainItem.goToRegister(); } KeyNavigation.up: openLinkButton KeyNavigation.down: continueButton @@ -141,11 +143,11 @@ LoginLayout { BigButton { id: continueButton Layout.fillWidth: true - //: "Je comprends" - text: qsTr("assistant_third_party_sip_account_warning_ok") + //: "Je comprends" + text: qsTr("assistant_third_party_sip_account_warning_ok") style: ButtonStyle.main onClicked: { - rootStackView.replace(secondItem) + rootStackView.replace(secondItem); } KeyNavigation.up: createAccountButton } @@ -159,18 +161,18 @@ LoginLayout { Component { id: secondItem Flickable { - id: formFlickable + id: formFlickable width: Utils.getSizeWithScreenRatio(770) contentWidth: content.implicitWidth contentHeight: content.implicitHeight clip: true flickableDirection: Flickable.VerticalFlick - Control.ScrollBar.vertical: scrollbar + Control.ScrollBar.vertical: scrollbar RowLayout { id: content - width: formFlickable.width - scrollbar.width*2 + width: formFlickable.width - scrollbar.width * 2 spacing: Utils.getSizeWithScreenRatio(50) ColumnLayout { spacing: Utils.getSizeWithScreenRatio(2) @@ -236,7 +238,7 @@ LoginLayout { Connections { target: SettingsCpp function onAssistantThirdPartySipAccountDomainChanged() { - domainEdit.resetText() + domainEdit.resetText(); } } } @@ -263,13 +265,25 @@ LoginLayout { textRole: "text" valueRole: "value" model: [ - {text: "TCP", value: LinphoneEnums.TransportType.Tcp}, - {text: "UDP", value: LinphoneEnums.TransportType.Udp}, - {text: "TLS", value: LinphoneEnums.TransportType.Tls}, - {text: "DTLS", value: LinphoneEnums.TransportType.Dtls} + { + text: "TCP", + value: LinphoneEnums.TransportType.Tcp + }, + { + text: "UDP", + value: LinphoneEnums.TransportType.Udp + }, + { + text: "TLS", + value: LinphoneEnums.TransportType.Tls + }, + { + text: "DTLS", + value: LinphoneEnums.TransportType.Dtls + } ] currentIndex: Utils.findIndex(model, function (entry) { - return entry.text === SettingsCpp.assistantThirdPartySipAccountTransport.toUpperCase() + return entry.text === SettingsCpp.assistantThirdPartySipAccountTransport.toUpperCase(); }) KeyNavigation.up: displayName KeyNavigation.down: outboundProxyUriEdit @@ -285,7 +299,7 @@ LoginLayout { Connections { target: LoginPageCpp function onErrorMessageChanged(error) { - errorText.setText(error) + errorText.setText(error); } } } @@ -321,53 +335,53 @@ LoginLayout { target: LoginPageCpp function onRegistrationStateChanged() { if (LoginPageCpp.registrationState != LinphoneEnums.RegistrationState.Progress) { - connectionButton.enabled = true - connectionButtonContent.currentIndex = 0 + connectionButton.enabled = true; + connectionButtonContent.currentIndex = 0; } } function onErrorMessageChanged(error) { if (error.length != 0) { - connectionButton.enabled = true - connectionButtonContent.currentIndex = 0 + connectionButton.enabled = true; + connectionButtonContent.currentIndex = 0; } } } } function trigger() { - username.errorMessage = "" - password.errorMessage = "" - domain.errorMessage = "" - errorText.clear() + username.errorMessage = ""; + password.errorMessage = ""; + domain.errorMessage = ""; + errorText.clear(); - loginDelay.restart() + loginDelay.restart(); } onPressed: trigger() KeyNavigation.up: connectionId KeyNavigation.tab: tabTarget - Timer{ + Timer { id: loginDelay interval: 200 onTriggered: { if (usernameEdit.text.length == 0 || passwordEdit.text.length == 0 || domainEdit.text.length == 0) { if (usernameEdit.text.length == 0) - username.errorMessage = qsTr("assistant_account_login_missing_username") + username.errorMessage = qsTr("assistant_account_login_missing_username"); if (passwordEdit.text.length == 0) - password.errorMessage = qsTr("assistant_account_login_missing_password") + password.errorMessage = qsTr("assistant_account_login_missing_password"); if (domainEdit.text.length == 0) //: "Veuillez saisir un nom de domaine - domain.errorMessage = qsTr("assistant_account_login_missing_domain") - return + domain.errorMessage = qsTr("assistant_account_login_missing_domain"); + return; } - console.debug("[SIPLoginPage] User: Log in") - LoginPageCpp.login(usernameEdit.text, passwordEdit.text, displayName.text, domainEdit.text, - transportCbox.currentValue, registrarUriEdit.text, outboundProxyUriEdit.text, connectionIdEdit.text); - connectionButton.enabled = false - connectionButtonContent.currentIndex = 1 + console.debug("[SIPLoginPage] User: Log in"); + LoginPageCpp.login(usernameEdit.text, passwordEdit.text, displayName.text, domainEdit.text, + transportCbox.currentValue, registrarUriEdit.text, outboundProxyUriEdit.text, connectionIdEdit.text); + connectionButton.enabled = false; + connectionButtonContent.currentIndex = 1; } } } - + Item { Layout.fillHeight: true } @@ -425,9 +439,13 @@ LoginLayout { } } } - Item{Layout.fillHeight: true} + Item { + Layout.fillHeight: true + } + } + Item { + Layout.fillHeight: true } - Item{Layout.fillHeight: true} } } } @@ -457,21 +475,21 @@ LoginLayout { anchors.leftMargin: Utils.getSizeWithScreenRatio(127) width: currentItem ? currentItem.width : 0 }, - // Item { + // Item { // id: sipItem // // spacing: Utils.getSizeWithScreenRatio(8) - // anchors.fill: parent - // anchors.rightMargin: Utils.getSizeWithScreenRatio(50) + image.width - // }, + // anchors.fill: parent + // anchors.rightMargin: Utils.getSizeWithScreenRatio(50) + image.width + // }, Image { id: image z: -1 anchors.top: parent.top anchors.right: parent.right - anchors.topMargin: Utils.getSizeWithScreenRatio(129) - anchors.rightMargin: Utils.getSizeWithScreenRatio(127) - width: Utils.getSizeWithScreenRatio(395) - height: Utils.getSizeWithScreenRatio(350) + 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 95815f484..092e06c73 100644 --- a/Linphone/view/Page/Form/Meeting/AddParticipantsForm.qml +++ b/Linphone/view/Page/Form/Meeting/AddParticipantsForm.qml @@ -9,170 +9,171 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle FocusScope { - id: mainItem - //: "Rechercher des contacts" - property string placeHolderText: qsTr("search_bar_search_contacts_placeholder") - property list selectedParticipants - property int selectedParticipantsCount: selectedParticipants.length - property ConferenceInfoGui conferenceInfoGui - property color searchBarColor: DefaultStyle.grey_100 - property color searchBarBorderColor: "transparent" - property int participantscSrollBarRightMargin: Utils.getSizeWithScreenRatio(8) + id: mainItem + //: "Rechercher des contacts" + property string placeHolderText: qsTr("search_bar_search_contacts_placeholder") + property list selectedParticipants + property int selectedParticipantsCount: selectedParticipants.length + property ConferenceInfoGui conferenceInfoGui + property color searchBarColor: DefaultStyle.grey_100 + property color searchBarBorderColor: "transparent" + property int participantscSrollBarRightMargin: Utils.getSizeWithScreenRatio(8) - function clearSelectedParticipants() { - // TODO - //contactList.selectedContacts.clear() - } + function clearSelectedParticipants() { + // TODO + //contactList.selectedContacts.clear() + } - ColumnLayout { - anchors.fill: parent - spacing: Utils.getSizeWithScreenRatio(15) - GridView { - id: participantList - Layout.fillWidth: true - visible: contentHeight > 0 - Layout.preferredHeight: contentHeight - Layout.maximumHeight: mainItem.height / 3 - width: mainItem.width - cellWidth: Utils.getSizeWithScreenRatio((50 + 18)) - cellHeight: Utils.getSizeWithScreenRatio(80) - // columnCount: Math.floor(width/cellWidth) - model: mainItem.selectedParticipants - clip: true - // columnSpacing: Utils.getSizeWithScreenRatio(18) - // rowSpacing: Utils.getSizeWithScreenRatio(9) - Keys.onPressed: event => { - if (currentIndex <= 0 && event.key == Qt.Key_Up) { - nextItemInFocusChain(false).forceActiveFocus(); - } - } - header: ColumnLayout { - Layout.fillWidth: true - Text { - Layout.fillWidth: true - horizontalAlignment: Text.AlignLeft - visible: mainItem.selectedParticipantsCount > 0 - //: "%n participant(s) sélectionné(s)" - text: qsTr("add_participant_selected_count", '0', mainItem.selectedParticipantsCount).arg(mainItem.selectedParticipantsCount) - maximumLineCount: 1 - color: DefaultStyle.grey_1000 - font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(300) - } - } - Item { - Layout.preferredHeight: Utils.getSizeWithScreenRatio(10) - } - } - delegate: FocusScope { - ColumnLayout { - anchors.fill: parent - spacing: Utils.getSizeWithScreenRatio(4) - width: Utils.getSizeWithScreenRatio(50) - Item { - id: participantItem - property var nameObj: UtilsCpp.getDisplayName(modelData) - property string displayName: nameObj ? nameObj.value : "" - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: Utils.getSizeWithScreenRatio(50) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) - Avatar { - anchors.fill: parent - _address: modelData - shadowEnabled: false - secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified - } - Button { - width: Utils.getSizeWithScreenRatio(17) - height: Utils.getSizeWithScreenRatio(17) - icon.width: Utils.getSizeWithScreenRatio(12) - icon.height: Utils.getSizeWithScreenRatio(12) - icon.source: AppIcons.closeX - anchors.top: parent.top - anchors.right: parent.right - //: Remove participant %1 - Accessible.name: qsTr("remove_participant_accessible_name").arg(participantItem.displayName) - style: ButtonStyle.whiteSelected - shadowEnabled: true - onClicked: contactList.removeSelectedContactByAddress(modelData) - } - } - Text { - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: width - width: Utils.getSizeWithScreenRatio(50) - maximumLineCount: 1 - clip: true - text: participantItem.displayName - color: DefaultStyle.main2_700 - wrapMode: Text.WrapAnywhere - font { - pixelSize: Typography.p3.pixelSize - weight: Typography.p3.weight - capitalization: Font.Capitalize - } - } - } - } - Control.ScrollBar.vertical: ScrollBar { - id: scrollbar - active: true - interactive: true - policy: Control.ScrollBar.AsNeeded - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.rightMargin: mainItem.participantscSrollBarRightMargin - visible: participantList.height < participantList.contentHeight - } - } - SearchBar { - id: searchBar - Layout.fillWidth: true - Layout.topMargin: Utils.getSizeWithScreenRatio(6) - Layout.rightMargin: Utils.getSizeWithScreenRatio(28) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - placeholderText: mainItem.placeHolderText - focus: participantList.count == 0 - color: mainItem.searchBarColor - borderColor: mainItem.searchBarColor - KeyNavigation.up: participantList.count > 0 ? participantList : nextItemInFocusChain(false) - KeyNavigation.down: contactList - } - ColumnLayout { - id: content - spacing: Utils.getSizeWithScreenRatio(15) - Text { - visible: !contactList.loading && contactList.count === 0 - Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Utils.getSizeWithScreenRatio(137) - //: "Aucun contact" - text: searchBar.text.length !== 0 ? qsTr("list_filter_no_result_found") : qsTr("contact_list_empty") - font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight - } - } - AllContactListView { - id: contactList - Layout.fillWidth: true - Layout.fillHeight: true - itemsRightMargin: Utils.getSizeWithScreenRatio(28) - multiSelectionEnabled: true - showContactMenu: false - showMe: false - confInfoGui: mainItem.conferenceInfoGui - selectedContacts: mainItem.selectedParticipants - onSelectedContactsChanged: Qt.callLater(function () { - mainItem.selectedParticipants = selectedContacts; - }) - searchBarText: searchBar.text - onContactAddedToSelection: address => { - contactList.addContactToSelection(address); - } - onContactRemovedFromSelection: address => contactList.removeSelectedContactByAddress(address) - } - } - } + ColumnLayout { + anchors.fill: parent + spacing: Utils.getSizeWithScreenRatio(15) + GridView { + id: participantList + Layout.fillWidth: true + visible: contentHeight > 0 + Layout.preferredHeight: contentHeight + Layout.maximumHeight: mainItem.height / 3 + width: mainItem.width + cellWidth: Utils.getSizeWithScreenRatio((50 + 18)) + cellHeight: Utils.getSizeWithScreenRatio(80) + // columnCount: Math.floor(width/cellWidth) + model: mainItem.selectedParticipants + clip: true + // columnSpacing: Utils.getSizeWithScreenRatio(18) + // rowSpacing: Utils.getSizeWithScreenRatio(9) + Keys.onPressed: event => { + if (currentIndex <= 0 && event.key == Qt.Key_Up) { + nextItemInFocusChain(false).forceActiveFocus(); + } + } + header: ColumnLayout { + Layout.fillWidth: true + Text { + Layout.fillWidth: true + horizontalAlignment: Text.AlignLeft + visible: mainItem.selectedParticipantsCount > 0 + //: "%n participant(s) sélectionné(s)" + text: qsTr("add_participant_selected_count", '0', mainItem.selectedParticipantsCount).arg( + mainItem.selectedParticipantsCount) + maximumLineCount: 1 + color: DefaultStyle.grey_1000 + font { + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) + } + } + Item { + Layout.preferredHeight: Utils.getSizeWithScreenRatio(10) + } + } + delegate: FocusScope { + ColumnLayout { + anchors.fill: parent + spacing: Utils.getSizeWithScreenRatio(4) + width: Utils.getSizeWithScreenRatio(50) + Item { + id: participantItem + property var nameObj: UtilsCpp.getDisplayName(modelData) + property string displayName: nameObj ? nameObj.value : "" + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: Utils.getSizeWithScreenRatio(50) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) + Avatar { + anchors.fill: parent + _address: modelData + shadowEnabled: false + secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified + } + Button { + width: Utils.getSizeWithScreenRatio(17) + height: Utils.getSizeWithScreenRatio(17) + icon.width: Utils.getSizeWithScreenRatio(12) + icon.height: Utils.getSizeWithScreenRatio(12) + icon.source: AppIcons.closeX + anchors.top: parent.top + anchors.right: parent.right + //: Remove participant %1 + Accessible.name: qsTr("remove_participant_accessible_name").arg(participantItem.displayName) + style: ButtonStyle.whiteSelected + shadowEnabled: true + onClicked: contactList.removeSelectedContactByAddress(modelData) + } + } + Text { + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: width + width: Utils.getSizeWithScreenRatio(50) + maximumLineCount: 1 + clip: true + text: participantItem.displayName + color: DefaultStyle.main2_700 + wrapMode: Text.WrapAnywhere + font { + pixelSize: Typography.p3.pixelSize + weight: Typography.p3.weight + capitalization: Font.Capitalize + } + } + } + } + Control.ScrollBar.vertical: ScrollBar { + id: scrollbar + active: true + interactive: true + policy: Control.ScrollBar.AsNeeded + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.rightMargin: mainItem.participantscSrollBarRightMargin + visible: participantList.height < participantList.contentHeight + } + } + SearchBar { + id: searchBar + Layout.fillWidth: true + Layout.topMargin: Utils.getSizeWithScreenRatio(6) + Layout.rightMargin: Utils.getSizeWithScreenRatio(28) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + placeholderText: mainItem.placeHolderText + focus: participantList.count == 0 + color: mainItem.searchBarColor + borderColor: mainItem.searchBarColor + KeyNavigation.up: participantList.count > 0 ? participantList : nextItemInFocusChain(false) + KeyNavigation.down: contactList + } + ColumnLayout { + id: content + spacing: Utils.getSizeWithScreenRatio(15) + Text { + visible: !contactList.loading && contactList.count === 0 + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: Utils.getSizeWithScreenRatio(137) + //: "Aucun contact" + text: searchBar.text.length !== 0 ? qsTr("list_filter_no_result_found") : qsTr("contact_list_empty") + font { + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight + } + } + AllContactListView { + id: contactList + Layout.fillWidth: true + Layout.fillHeight: true + itemsRightMargin: Utils.getSizeWithScreenRatio(28) + multiSelectionEnabled: true + showContactMenu: false + showMe: false + confInfoGui: mainItem.conferenceInfoGui + selectedContacts: mainItem.selectedParticipants + onSelectedContactsChanged: Qt.callLater(function () { + mainItem.selectedParticipants = selectedContacts; + }) + searchBarText: searchBar.text + onContactAddedToSelection: address => { + contactList.addContactToSelection(address); + } + onContactRemovedFromSelection: address => contactList.removeSelectedContactByAddress(address) + } + } + } } diff --git a/Linphone/view/Page/Form/Meeting/MeetingForm.qml b/Linphone/view/Page/Form/Meeting/MeetingForm.qml index 217ae65b0..bc8b8960a 100644 --- a/Linphone/view/Page/Form/Meeting/MeetingForm.qml +++ b/Linphone/view/Page/Form/Meeting/MeetingForm.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 { @@ -13,46 +13,46 @@ FocusScope { height: childrenRect.height property bool isCreation property ConferenceInfoGui conferenceInfoGui - signal addParticipantsRequested() + signal addParticipantsRequested ColumnLayout { id: formLayout - spacing: Utils.getSizeWithScreenRatio(16) + spacing: Utils.getSizeWithScreenRatio(16) anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top Component.onCompleted: { - endHour.selectedDateTime = mainItem.conferenceInfoGui.core.endDateTime - startHour.selectedDateTime = mainItem.conferenceInfoGui.core.dateTime - startDate.calendar.selectedDate = mainItem.conferenceInfoGui.core.dateTime + endHour.selectedDateTime = mainItem.conferenceInfoGui.core.endDateTime; + startHour.selectedDateTime = mainItem.conferenceInfoGui.core.dateTime; + startDate.calendar.selectedDate = mainItem.conferenceInfoGui.core.dateTime; } RowLayout { visible: mainItem.isCreation && !SettingsCpp.disableBroadcastFeature - Layout.topMargin: Utils.getSizeWithScreenRatio(20) - Layout.bottomMargin: Utils.getSizeWithScreenRatio(20) - spacing: Utils.getSizeWithScreenRatio(18) + Layout.topMargin: Utils.getSizeWithScreenRatio(20) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(18) CheckableButton { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(151) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(151) icon.source: AppIcons.videoconference - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) enabled: false - //: "Réunion" - text: qsTr("meeting_schedule_meeting_label") + //: "Réunion" + text: qsTr("meeting_schedule_meeting_label") checked: true autoExclusive: true style: ButtonStyle.secondary } CheckableButton { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(151) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(151) enabled: false icon.source: AppIcons.slide - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) - //: "Webinar" - text: qsTr("meeting_schedule_broadcast_label") + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) + //: "Webinar" + text: qsTr("meeting_schedule_broadcast_label") autoExclusive: true style: ButtonStyle.secondary } @@ -61,34 +61,37 @@ FocusScope { visible: mainItem.isCreation spacing: formLayout.spacing content: RowLayout { - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.videoconference colorizationColor: DefaultStyle.main2_600 - width: Utils.getSizeWithScreenRatio(24) - height: Utils.getSizeWithScreenRatio(24) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + width: Utils.getSizeWithScreenRatio(24) + height: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } TextInput { id: confTitle Layout.fillWidth: true maximumLength: width - //: "Ajouter un titre" - property string defaultText: qsTr("meeting_schedule_subject_hint") - Component.onCompleted: text = mainItem.conferenceInfoGui.core.subject === "" ? defaultText : mainItem.conferenceInfoGui.core.subject + //: "Ajouter un titre" + property string defaultText: qsTr("meeting_schedule_subject_hint") + Component.onCompleted: text = mainItem.conferenceInfoGui.core.subject === "" ? defaultText : + mainItem.conferenceInfoGui.core.subject text: conferenceInfoGui.core.subject ? conferenceInfoGui.core.subject : "" color: DefaultStyle.main2_600 font { - pixelSize: Utils.getSizeWithScreenRatio(20) - weight: Typography.h3.weight + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Typography.h3.weight } focus: true - onActiveFocusChanged: if(activeFocus) { - if (text == defaultText) - clear() - else selectAll() - } else if (text.length === 0) text = defaultText + onActiveFocusChanged: if (activeFocus) { + if (text == defaultText) + clear(); + else + selectAll(); + } else if (text.length === 0) + text = defaultText onTextEdited: mainItem.conferenceInfoGui.core.subject = text KeyNavigation.down: startDate } @@ -101,60 +104,64 @@ FocusScope { EffectImage { imageSource: AppIcons.clock colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } CalendarComboBox { id: startDate background.visible: mainItem.isCreation indicator.visible: mainItem.isCreation - contentText.font.weight: isCreation ? Font.Bold : Font.Normal + contentText.font.weight: isCreation ? Font.Bold : Font.Normal Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) KeyNavigation.up: confTitle KeyNavigation.down: startHour onSelectedDateChanged: { - if (!selectedDate || selectedDate == mainItem.conferenceInfoGui.core.dateTime) return - mainItem.conferenceInfoGui.core.dateTime = UtilsCpp.createDateTime(selectedDate, startHour.selectedHour, startHour.selectedMin) - mainItem.conferenceInfoGui.core.endDateTime = UtilsCpp.createDateTime(selectedDate, endHour.selectedHour, endHour.selectedMin) - startHour.selectedDateTime = UtilsCpp.createDateTime(selectedDate, startHour.selectedHour, startHour.selectedMin) - endHour.selectedDateTime = UtilsCpp.createDateTime(selectedDate, endHour.selectedHour, endHour.selectedMin) + if (!selectedDate || selectedDate == mainItem.conferenceInfoGui.core.dateTime) + return; + mainItem.conferenceInfoGui.core.dateTime = UtilsCpp.createDateTime(selectedDate, startHour.selectedHour, + startHour.selectedMin); + mainItem.conferenceInfoGui.core.endDateTime = UtilsCpp.createDateTime(selectedDate, endHour.selectedHour, + endHour.selectedMin); + startHour.selectedDateTime = UtilsCpp.createDateTime(selectedDate, startHour.selectedHour, + startHour.selectedMin); + endHour.selectedDateTime = UtilsCpp.createDateTime(selectedDate, endHour.selectedHour, endHour.selectedMin); } } }, RowLayout { Item { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } RowLayout { TimeComboBox { id: startHour // indicator.visible: mainItem.isCreation - Layout.preferredWidth: Utils.getSizeWithScreenRatio(94) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(94) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) background.visible: mainItem.isCreation - contentText.font.weight: isCreation ? Font.Bold : Font.Normal + contentText.font.weight: isCreation ? Font.Bold : Font.Normal KeyNavigation.up: startDate KeyNavigation.down: timeZoneCbox KeyNavigation.left: endHour KeyNavigation.right: endHour onSelectedDateTimeChanged: { - mainItem.conferenceInfoGui.core.dateTime = selectedDateTime - endHour.minTime = selectedDateTime - endHour.maxTime = UtilsCpp.createDateTime(selectedDateTime, 23, 59) + mainItem.conferenceInfoGui.core.dateTime = selectedDateTime; + endHour.minTime = selectedDateTime; + endHour.maxTime = UtilsCpp.createDateTime(selectedDateTime, 23, 59); if (mainItem.isCreation) { - endHour.selectedDateTime = UtilsCpp.addSecs(selectedDateTime, 3600) + endHour.selectedDateTime = UtilsCpp.addSecs(selectedDateTime, 3600); } } } TimeComboBox { id: endHour // indicator.visible: mainItem.isCreation - Layout.preferredWidth: Utils.getSizeWithScreenRatio(94) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(94) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) background.visible: mainItem.isCreation - contentText.font.weight: isCreation ? Font.Bold : Font.Normal + contentText.font.weight: isCreation ? Font.Bold : Font.Normal onSelectedDateTimeChanged: mainItem.conferenceInfoGui.core.endDateTime = selectedDateTime KeyNavigation.up: startDate KeyNavigation.down: timeZoneCbox @@ -166,85 +173,83 @@ FocusScope { } Text { property int durationSec: UtilsCpp.secsTo(startHour.selectedTime, endHour.selectedTime) - property int hour: durationSec/3600 - property int min: (durationSec - hour*3600)/60 + property int hour: durationSec / 3600 + property int min: (durationSec - hour * 3600) / 60 text: (hour > 0 ? hour + "h" : "") + (min > 0 ? min + "mn" : "") font { - pixelSize: Typography.p2l.pixelSize - weight: Typography.p2l.weight + pixelSize: Typography.p2l.pixelSize + weight: Typography.p2l.weight } } } }, - ComboBox { id: timeZoneCbox Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) hoverEnabled: true oneLine: true - listView.implicitHeight: Utils.getSizeWithScreenRatio(250) + listView.implicitHeight: Utils.getSizeWithScreenRatio(250) constantImageSource: AppIcons.globe - weight: Typography.p2l.weight + weight: Typography.p2l.weight leftMargin: 0 - currentIndex: mainItem.conferenceInfoGui && model.count > 0 ? model.getIndex(mainItem.conferenceInfoGui.core.timeZoneModel) : -1 + currentIndex: mainItem.conferenceInfoGui && model.count > 0 ? model.getIndex( + mainItem.conferenceInfoGui.core.timeZoneModel) : -1 background: Rectangle { visible: parent.hovered || parent.down anchors.fill: parent color: DefaultStyle.grey_100 } - model: TimeZoneProxy { - } + model: TimeZoneProxy {} visible: model.count > 0 onCurrentIndexChanged: { - var modelIndex = timeZoneCbox.model.index(currentIndex, 0) - mainItem.conferenceInfoGui.core.timeZoneModel = timeZoneCbox.model.data(modelIndex, Qt.DisplayRole + 1) + var modelIndex = timeZoneCbox.model.index(currentIndex, 0); + mainItem.conferenceInfoGui.core.timeZoneModel = timeZoneCbox.model.data(modelIndex, Qt.DisplayRole + 1); } } ] - } Section { spacing: formLayout.spacing content: RowLayout { - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.note colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } TextArea { id: descriptionEdit Layout.fillWidth: true - Layout.preferredWidth: Utils.getSizeWithScreenRatio(275) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(275) Layout.preferredHeight: contentHeight - leftPadding: Utils.getSizeWithScreenRatio(8) - rightPadding: Utils.getSizeWithScreenRatio(8) - //: "Ajouter une description" - placeholderText: qsTr("meeting_schedule_description_hint") + leftPadding: Utils.getSizeWithScreenRatio(8) + rightPadding: Utils.getSizeWithScreenRatio(8) + //: "Ajouter une description" + placeholderText: qsTr("meeting_schedule_description_hint") placeholderTextColor: DefaultStyle.main2_600 - placeholderWeight: Typography.p2l.weight + placeholderWeight: Typography.p2l.weight color: DefaultStyle.main2_600 wrapMode: TextEdit.Wrap Component.onCompleted: text = conferenceInfoGui.core.description font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight } onEditingFinished: mainItem.conferenceInfoGui.core.description = text - Keys.onPressed: (event)=> { - if (event.key == Qt.Key_Escape) { - text = mainItem.conferenceInfoGui.core.description - nextItemInFocusChain().forceActiveFocus() - event.accepted = true; - } - } + Keys.onPressed: event => { + if (event.key == Qt.Key_Escape) { + text = mainItem.conferenceInfoGui.core.description; + nextItemInFocusChain().forceActiveFocus(); + event.accepted = true; + } + } KeyNavigation.tab: addParticipantsButton background: Rectangle { anchors.fill: parent color: descriptionEdit.hovered || descriptionEdit.activeFocus ? DefaultStyle.grey_100 : "transparent" - radius: Utils.getSizeWithScreenRatio(4) + radius: Utils.getSizeWithScreenRatio(4) } } } @@ -255,28 +260,28 @@ FocusScope { Button { id: addParticipantsButton Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) leftPadding: 0 background: Rectangle { anchors.fill: parent color: addParticipantsButton.hovered || addParticipantsButton.activeFocus ? DefaultStyle.grey_100 : "transparent" - radius: Utils.getSizeWithScreenRatio(4) + radius: Utils.getSizeWithScreenRatio(4) } contentItem: RowLayout { - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) EffectImage { imageSource: AppIcons.videoconference colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) } Text { Layout.fillWidth: true - //: "Ajouter des participants" - text: qsTr("meeting_schedule_add_participants_title") + //: "Ajouter des participants" + text: qsTr("meeting_schedule_add_participants_title") font { - pixelSize: Typography.p2l.pixelSize - weight: Typography.p2l.weight + pixelSize: Typography.p2l.pixelSize + weight: Typography.p2l.weight } } } @@ -286,7 +291,7 @@ FocusScope { id: participantList Layout.fillWidth: true Layout.preferredHeight: contentHeight - Layout.maximumHeight: Utils.getSizeWithScreenRatio(250) + Layout.maximumHeight: Utils.getSizeWithScreenRatio(250) clip: true model: mainItem.conferenceInfoGui.core.participants Control.ScrollBar.vertical: ScrollBar { @@ -297,14 +302,14 @@ FocusScope { visible: participantList.height < participantList.contentHeight } delegate: Item { - height: Utils.getSizeWithScreenRatio(56) + height: Utils.getSizeWithScreenRatio(56) width: participantList.width - participantScrollBar.width RowLayout { anchors.fill: parent - spacing: Utils.getSizeWithScreenRatio(16) + spacing: Utils.getSizeWithScreenRatio(16) Avatar { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) _address: modelData.address secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified shadowEnabled: false @@ -312,18 +317,18 @@ FocusScope { Text { property var displayNameObj: UtilsCpp.getDisplayName(modelData.address) text: displayNameObj?.value || "" - font.pixelSize: Utils.getSizeWithScreenRatio(14) + font.pixelSize: Utils.getSizeWithScreenRatio(14) font.capitalization: Font.Capitalize } Item { Layout.fillWidth: true } Button { - 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) + 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) @@ -334,15 +339,15 @@ FocusScope { ] } Switch { - //: "Envoyer une invitation aux participants" - text: qsTr("meeting_schedule_send_invitations_title") + //: "Envoyer une invitation aux participants" + text: qsTr("meeting_schedule_send_invitations_title") checked: mainItem.conferenceInfoGui.core.inviteEnabled onToggled: mainItem.conferenceInfoGui.core.inviteEnabled = checked leftPadding: 0 } Item { Layout.fillHeight: true - Layout.minimumHeight: Utils.getSizeWithScreenRatio(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 2f88adff8..bd2bbf5e3 100644 --- a/Linphone/view/Page/Form/Register/RegisterCheckingPage.qml +++ b/Linphone/view/Page/Form/Register/RegisterCheckingPage.qml @@ -3,12 +3,12 @@ import QtQuick.Layouts 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils LoginLayout { id: mainItem - signal returnToRegister() + signal returnToRegister signal sendCode(string code) property bool registerWithEmail property string address @@ -19,38 +19,38 @@ LoginLayout { onCtrlIsPressedChanged: console.log("ctrl is pressed", ctrlIsPressed) titleContent: [ RowLayout { - spacing: Utils.getSizeWithScreenRatio(21) - Layout.leftMargin: Utils.getSizeWithScreenRatio(119) + spacing: Utils.getSizeWithScreenRatio(21) + Layout.leftMargin: Utils.getSizeWithScreenRatio(119) Button { - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) icon.source: AppIcons.leftArrow style: ButtonStyle.noBackground onClicked: { - console.debug("[RegisterCheckingPage] User: return to register") - mainItem.returnToRegister() + console.debug("[RegisterCheckingPage] User: return to register"); + mainItem.returnToRegister(); } } EffectImage { fillMode: Image.PreserveAspectFit imageSource: AppIcons.profile - Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) colorizationColor: DefaultStyle.main2_600 } Text { wrapMode: Text.NoWrap text: { - //: "email" - var completeString = mainItem.registerWithEmail ? qsTr("email") - //: "numéro de téléphone" - : qsTr("phone_number") - //: "Inscription | Confirmer votre %1" - text = qsTr("confirm_register_title").arg(completeString) + //: "email" + var completeString = mainItem.registerWithEmail ? qsTr("email") : + //: "numéro de téléphone" + qsTr("phone_number"); + //: "Inscription | Confirmer votre %1" + text = qsTr("confirm_register_title").arg(completeString); } font { - pixelSize: Typography.h1.pixelSize - weight: Typography.h1.weight + pixelSize: Typography.h1.pixelSize + weight: Typography.h1.weight } scaleLettersFactor: 1.1 } @@ -64,19 +64,19 @@ LoginLayout { ColumnLayout { anchors.left: parent.left anchors.top: parent.top - anchors.leftMargin: Utils.getSizeWithScreenRatio(127) - spacing: Utils.getSizeWithScreenRatio(104) + anchors.leftMargin: Utils.getSizeWithScreenRatio(127) + spacing: Utils.getSizeWithScreenRatio(104) Text { font { bold: true - pixelSize: Typography.h3.pixelSize - weight: Typography.h3.weight + pixelSize: Typography.h3.pixelSize + weight: Typography.h3.weight } color: DefaultStyle.main2_700 - text: { - var completeString = mainItem.registerWithEmail ? ("email") : ("phone_number") - //: Nous vous avons envoyé un code de vérification sur votre %1 %2
Merci de le saisir ci-dessous - text = qsTr("assistant_account_creation_confirmation_explanation").arg(completeString).arg(address) + text: { + var completeString = mainItem.registerWithEmail ? ("email") : ("phone_number"); + //: Nous vous avons envoyé un code de vérification sur votre %1 %2
Merci de le saisir ci-dessous + text = qsTr("assistant_account_creation_confirmation_explanation").arg(completeString).arg(address); } } FormItemLayout { @@ -85,8 +85,8 @@ LoginLayout { contentItem: RowLayout { spacing: Utils.getSizeWithScreenRatio(45) Repeater { - model: 4 id: repeater + model: 4 signal pasteRequested(string text) DigitInput { id: digitInput @@ -97,73 +97,72 @@ LoginLayout { Connections { target: repeater function onPasteRequested(text) { - console.log("paste requested", text[digitInput.index]) - var test= text; - if (UtilsCpp.isInteger(text)) - { - digitInput.text = text[digitInput.index] + console.log("paste requested", text[digitInput.index]); + var test = text; + if (UtilsCpp.isInteger(text)) { + digitInput.text = text[digitInput.index]; } } } onTextChanged: { - console.log("text edited", text) - if (text.length > 0 ) { - mainItem.code = mainItem.code.slice(0, index) + text + mainItem.code.slice(index) + console.log("text edited", text); + if (text.length > 0) { + mainItem.code = mainItem.code.slice(0, index) + text + mainItem.code.slice(index); if (index < 3) - nextItemInFocusChain(true).forceActiveFocus() + nextItemInFocusChain(true).forceActiveFocus(); else { - mainItem.sendCode(mainItem.code) - mainItem.code = "" + mainItem.sendCode(mainItem.code); + mainItem.code = ""; } } else { if (index > 0) - nextItemInFocusChain(false).forceActiveFocus() - } - } - Keys.onPressed: (event) => { - if (event.key == Qt.Key_Backspace) { - if (text.length === 0) { - nextItemInFocusChain(false).forceActiveFocus() - event.accepted = true - } else { - event.accepted = false - } - } else if (event.key == Qt.Key_Control) { - mainItem.ctrlIsPressed = true - event.accepted = false - } else if (mainItem.ctrlIsPressed && event.key == Qt.Key_V) { - var clipboard = UtilsCpp.getClipboardText() - console.log("paste", clipboard) - repeater.pasteRequested(clipboard) - } else { - event.accepted = false - } - } - Keys.onReleased: (event) => { - if (event.key == Qt.Key_Control) { - mainItem.ctrlIsPressed = false - event.accepted = true + nextItemInFocusChain(false).forceActiveFocus(); } } + Keys.onPressed: event => { + if (event.key == Qt.Key_Backspace) { + if (text.length === 0) { + nextItemInFocusChain(false).forceActiveFocus(); + event.accepted = true; + } else { + event.accepted = false; + } + } else if (event.key == Qt.Key_Control) { + mainItem.ctrlIsPressed = true; + event.accepted = false; + } else if (mainItem.ctrlIsPressed && event.key == Qt.Key_V) { + var clipboard = UtilsCpp.getClipboardText(); + console.log("paste", clipboard); + repeater.pasteRequested(clipboard); + } else { + event.accepted = false; + } + } + Keys.onReleased: event => { + if (event.key == Qt.Key_Control) { + mainItem.ctrlIsPressed = false; + event.accepted = true; + } + } } } } } RowLayout { - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) Text { - //: "Vous n'avez pas reçu le code ?" - text: qsTr("assistant_account_creation_confirmation_did_not_receive_code") + //: "Vous n'avez pas reçu le code ?" + text: qsTr("assistant_account_creation_confirmation_did_not_receive_code") color: DefaultStyle.main2_700 - font.pixelSize: Typography.p1.pixelSize - font.weight: Typography.p1.weight + font.pixelSize: Typography.p1.pixelSize + font.weight: Typography.p1.weight } BigButton { style: ButtonStyle.secondary - //: "Renvoyer un code" - text: qsTr("assistant_account_creation_confirmation_resend_code") + //: "Renvoyer un code" + text: qsTr("assistant_account_creation_confirmation_resend_code") onClicked: { - console.debug("[RegisterCheckingPage] User: Resend code") + console.debug("[RegisterCheckingPage] User: Resend code"); } } } @@ -171,13 +170,12 @@ LoginLayout { Image { anchors.top: parent.top anchors.right: parent.right - anchors.topMargin: Utils.getSizeWithScreenRatio(140) - anchors.rightMargin: Utils.getSizeWithScreenRatio(97) - width: Utils.getSizeWithScreenRatio(477) - height: Utils.getSizeWithScreenRatio(345) + 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 2a1fd3749..d39c30089 100644 --- a/Linphone/view/Page/Form/Register/RegisterPage.qml +++ b/Linphone/view/Page/Form/Register/RegisterPage.qml @@ -4,13 +4,13 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp 1.0 import ConstantsCpp 1.0 -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle LoginLayout { id: mainItem - signal returnToLogin() - signal browserValidationRequested() + signal returnToLogin + signal browserValidationRequested readonly property string countryCode: phoneNumberInput.countryCode readonly property string phoneNumber: phoneNumberInput.phoneNumber readonly property string email: emailInput.text @@ -18,29 +18,34 @@ LoginLayout { Connections { target: RegisterPageCpp function onErrorInField(field, errorMessage) { - console.log("set error message", errorMessage) - if (field == "username") usernameItem.errorMessage = errorMessage - else if (field == "password") passwordItem.errorMessage = errorMessage - else if (field == "phone") phoneNumberInput.errorMessage = errorMessage - else if (field == "email") emailItem.errorMessage = errorMessage - else otherErrorText.setText(errorMessage) + console.log("set error message", errorMessage); + if (field == "username") + usernameItem.errorMessage = errorMessage; + else if (field == "password") + passwordItem.errorMessage = errorMessage; + else if (field == "phone") + phoneNumberInput.errorMessage = errorMessage; + else if (field == "email") + emailItem.errorMessage = errorMessage; + else + otherErrorText.setText(errorMessage); } function onRegisterNewAccountFailed(errorMessage) { - console.log("register failed", errorMessage) - otherErrorText.setText(errorMessage) + console.log("register failed", errorMessage); + otherErrorText.setText(errorMessage); } } titleContent: [ RowLayout { - spacing: Utils.getSizeWithScreenRatio(21) - Layout.leftMargin: Utils.getSizeWithScreenRatio(79) + spacing: Utils.getSizeWithScreenRatio(21) + Layout.leftMargin: Utils.getSizeWithScreenRatio(79) BigButton { style: ButtonStyle.noBackground icon.source: AppIcons.leftArrow onClicked: { - console.debug("[RegisterPage] User: return") - returnToLogin() + console.debug("[RegisterPage] User: return"); + returnToLogin(); } //: Return Accessible.name: qsTr("return_accessible_name") @@ -48,17 +53,17 @@ LoginLayout { EffectImage { fillMode: Image.PreserveAspectFit imageSource: AppIcons.profile - Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) colorizationColor: DefaultStyle.main2_600 } Text { Layout.preferredWidth: width - //: "Inscription - text: qsTr("assistant_account_register") + //: "Inscription + text: qsTr("assistant_account_register") font { - pixelSize: Typography.h1.pixelSize - weight: Typography.h1.weight + pixelSize: Typography.h1.pixelSize + weight: Typography.h1.weight } wrapMode: Text.NoWrap scaleLettersFactor: 1.1 @@ -68,24 +73,26 @@ LoginLayout { Layout.fillWidth: true }, RowLayout { - spacing: Utils.getSizeWithScreenRatio(20) - Layout.rightMargin: Math.max(Utils.getSizeWithScreenRatio(10), Utils.getSizeWithScreenRatio(51 - ((51/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width)))) + spacing: Utils.getSizeWithScreenRatio(20) + 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) + Layout.rightMargin: Utils.getSizeWithScreenRatio(15) color: DefaultStyle.main2_700 - // "Déjà un compte ?" - text: qsTr("assistant_already_have_an_account") + // "Déjà un compte ?" + text: qsTr("assistant_already_have_an_account") font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight } } BigButton { style: ButtonStyle.main - text: qsTr("assistant_account_login") + text: qsTr("assistant_account_login") onClicked: { - console.debug("[RegisterPage] User: return") - returnToLogin() + console.debug("[RegisterPage] User: return"); + returnToLogin(); } } } @@ -93,20 +100,22 @@ LoginLayout { centerContent: [ ColumnLayout { - id: registerForm + id: registerForm anchors.fill: parent - anchors.leftMargin: Utils.getSizeWithScreenRatio(127) - spacing: Utils.getSizeWithScreenRatio(50) + anchors.leftMargin: Utils.getSizeWithScreenRatio(127) + spacing: Utils.getSizeWithScreenRatio(50) TabBar { - Layout.fillWidth: true id: bar - spacing: Utils.getSizeWithScreenRatio(40) - 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" - qsTr("assistant_account_register_with_email")] + Layout.fillWidth: true + spacing: Utils.getSizeWithScreenRatio(40) + 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" + qsTr("assistant_account_register_with_email")] capitalization: Font.MixedCase } Flickable { @@ -128,37 +137,42 @@ LoginLayout { ColumnLayout { id: contentLayout - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) ColumnLayout { id: formLayout - spacing: Utils.getSizeWithScreenRatio(24) + spacing: Utils.getSizeWithScreenRatio(24) RowLayout { FormItemLayout { id: usernameItem - label: qsTr("username") + label: qsTr("username") mandatory: true enableErrorText: true - Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) contentItem: TextField { id: usernameInput - backgroundBorderColor: usernameItem.errorMessage.length > 0 ? DefaultStyle.danger_500_main : DefaultStyle.grey_200 + backgroundBorderColor: usernameItem.errorMessage.length > 0 ? DefaultStyle.danger_500_main : + DefaultStyle.grey_200 //: "%1 mandatory" Accessible.name: qsTr("mandatory_field_accessible_name").arg(qsTr("username")) } } RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) Layout.leftMargin: Utils.getSizeWithScreenRatio(16) ComboBox { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(210) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(210) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) enabled: false - model: [{text:"@sip.linphone.org"}] + model: [ + { + text: "@sip.linphone.org" + } + ] Accessible.name: qsTr("domain") } EffectImage { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(16) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(16) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(16) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(16) imageSource: AppIcons.lock colorizationColor: DefaultStyle.main2_600 } @@ -169,13 +183,13 @@ LoginLayout { PhoneNumberInput { id: phoneNumberInput Layout.fillWidth: false - Layout.preferredWidth: Utils.getSizeWithScreenRatio(390) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(390) property string completePhoneNumber: countryCode + phoneNumber - //: "Numéro de téléphone" - label: qsTr("phone_number") + //: "Numéro de téléphone" + label: qsTr("phone_number") enableErrorText: true mandatory: true - placeholderText: qsTr("phone_number") + placeholderText: qsTr("phone_number") defaultCallingCode: "33" //: "%1 mandatory" Accessible.name: qsTr("mandatory_field_accessible_name").arg(qsTr("phone_number")) @@ -183,8 +197,8 @@ LoginLayout { FormItemLayout { id: emailItem Layout.fillWidth: false - Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) - label: qsTr("email") + Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) + label: qsTr("email") mandatory: true enableErrorText: true contentItem: TextField { @@ -201,36 +215,39 @@ LoginLayout { clip: false RowLayout { id: rowlayout - spacing: Utils.getSizeWithScreenRatio(16) + spacing: Utils.getSizeWithScreenRatio(16) FormItemLayout { id: passwordItem - Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) - label: qsTr("password") + Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) + label: qsTr("password") mandatory: true enableErrorText: true contentItem: TextField { id: pwdInput hidden: true - Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) - backgroundBorderColor: passwordItem.errorMessage.length > 0 ? DefaultStyle.danger_500_main : DefaultStyle.grey_200 + Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) + backgroundBorderColor: passwordItem.errorMessage.length > 0 ? DefaultStyle.danger_500_main : + DefaultStyle.grey_200 //: "%1 mandatory" Accessible.name: qsTr("mandatory_field_accessible_name").arg(qsTr("password")) } } FormItemLayout { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) Layout.leftMargin: Utils.getSizeWithScreenRatio(16) - //: "Confirmation mot de passe" - label: qsTr("assistant_account_register_password_confirmation") + //: "Confirmation mot de passe" + label: qsTr("assistant_account_register_password_confirmation") mandatory: true - enableErrorText: false + enableErrorText: false contentItem: TextField { id: confirmPwdInput hidden: true - Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) - backgroundBorderColor: passwordItem.errorMessage.length > 0 ? DefaultStyle.danger_500_main : DefaultStyle.grey_200 + Layout.preferredWidth: Utils.getSizeWithScreenRatio(346) + backgroundBorderColor: passwordItem.errorMessage.length > 0 ? DefaultStyle.danger_500_main : + DefaultStyle.grey_200 //: "%1 mandatory" - Accessible.name: qsTr("mandatory_field_accessible_name").arg(qsTr("assistant_account_register_password_confirmation")) + Accessible.name: qsTr("mandatory_field_accessible_name").arg(qsTr( + "assistant_account_register_password_confirmation")) } } } @@ -243,17 +260,17 @@ LoginLayout { // Layout.topMargin: Utils.getSizeWithScreenRatio(5) } // ColumnLayout { - // spacing: Utils.getSizeWithScreenRatio(18) + // spacing: Utils.getSizeWithScreenRatio(18) // RowLayout { - // spacing: Utils.getSizeWithScreenRatio(10) + // spacing: Utils.getSizeWithScreenRatio(10) // CheckBox { // id: subscribeToNewsletterCheckBox // } // Text { // text: qsTr("Je souhaite souscrire à la newletter Linphone.") // font { - // pixelSize: Typography.p1.pixelSize - // weight: Typography.p1.weight + // pixelSize: Typography.p1.pixelSize + // weight: Typography.p1.weight // } // MouseArea { // anchors.fill: parent @@ -264,75 +281,77 @@ LoginLayout { RowLayout { id: acceptCguAndPrivacyPolicyItem - spacing: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) //: "J'accepte les %1 et la %2" property string associatedText: qsTr("assistant_dialog_cgu_and_privacy_policy_message") - //: "conditions d'utilisation" - .arg(("%2").arg(ConstantsCpp.CguUrl).arg(qsTr("assistant_dialog_general_terms_label"))) - //: "politique de confidentialité" - .arg(("%2").arg(ConstantsCpp.PrivatePolicyUrl).arg(qsTr("assistant_dialog_privacy_policy_label"))) + //: "conditions d'utilisation" + .arg(("%2").arg(ConstantsCpp.CguUrl).arg(qsTr( + "assistant_dialog_general_terms_label"))) + //: "politique de confidentialité" + .arg(("%2").arg(ConstantsCpp.PrivatePolicyUrl).arg( + qsTr("assistant_dialog_privacy_policy_label"))) CheckBox { id: termsCheckBox Accessible.name: acceptCguAndPrivacyPolicyItem.associatedText - } - Text { + } + Text { id: privacyLinkText - text: acceptCguAndPrivacyPolicyItem.associatedText - onLinkActivated: (link) => Qt.openUrlExternally(link) - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.LeftButton - cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor - onClicked: (mouse) => { - mouse.accepted = false - if (parent.hoveredLink) { - privacyLinkText.linkActivated(privacyLinkText.linkAt(mouse.x, mouse.y)) - } - else { - termsCheckBox.toggle() - } - } - } - } - } - // } + text: acceptCguAndPrivacyPolicyItem.associatedText + onLinkActivated: link => Qt.openUrlExternally(link) + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + onClicked: mouse => { + mouse.accepted = false; + if (parent.hoveredLink) { + privacyLinkText.linkActivated(privacyLinkText.linkAt(mouse.x, mouse.y)); + } else { + termsCheckBox.toggle(); + } + } + } + } + } + // } Button { enabled: termsCheckBox.checked style: ButtonStyle.main - //: "Créer" - text: qsTr("assistant_account_create") - onClicked:{ + //: "Créer" + text: qsTr("assistant_account_create") + onClicked: { if (usernameInput.text.length === 0) { - console.log("ERROR username") - //: "Veuillez entrer un nom d'utilisateur" - usernameItem.errorMessage = qsTr("assistant_account_create_missing_username_error") + console.log("ERROR username"); + //: "Veuillez entrer un nom d'utilisateur" + usernameItem.errorMessage = qsTr("assistant_account_create_missing_username_error"); } else if (pwdInput.text.length === 0) { - console.log("ERROR password") - //: "Veuillez entrer un mot de passe" - passwordItem.errorMessage = qsTr("assistant_account_create_missing_password_error") + console.log("ERROR password"); + //: "Veuillez entrer un mot de passe" + passwordItem.errorMessage = qsTr("assistant_account_create_missing_password_error"); } else if (pwdInput.text != confirmPwdInput.text) { - console.log("ERROR confirm pwd") - //: "Les mots de passe sont différents" - passwordItem.errorMessage = qsTr("assistant_account_create_confirm_password_error") + console.log("ERROR confirm pwd"); + //: "Les mots de passe sont différents" + passwordItem.errorMessage = qsTr("assistant_account_create_confirm_password_error"); } else if (bar.currentIndex === 0 && phoneNumberInput.phoneNumber.length === 0) { - console.log("ERROR phone number") - //: "Veuillez entrer un numéro de téléphone" - phoneNumberInput.errorMessage = qsTr("assistant_account_create_missing_number_error") + console.log("ERROR phone number"); + //: "Veuillez entrer un numéro de téléphone" + phoneNumberInput.errorMessage = qsTr("assistant_account_create_missing_number_error"); } else if (bar.currentIndex === 1 && emailInput.text.length === 0) { - console.log("ERROR email") - //: "Veuillez entrer un email" - emailItem.errorMessage = qsTr("assistant_account_create_missing_email_error") + console.log("ERROR email"); + //: "Veuillez entrer un email" + emailItem.errorMessage = qsTr("assistant_account_create_missing_email_error"); } else { - console.log("[RegisterPage] User: Call register") - mainItem.browserValidationRequested() + console.log("[RegisterPage] User: Call register"); + mainItem.browserValidationRequested(); if (bar.currentIndex === 0) - RegisterPageCpp.registerNewAccount(usernameInput.text, pwdInput.text, "", phoneNumberInput.countryCode, phoneNumberInput.phoneNumber) + RegisterPageCpp.registerNewAccount(usernameInput.text, pwdInput.text, "", phoneNumberInput.countryCode, + phoneNumberInput.phoneNumber); else - RegisterPageCpp.registerNewAccount(usernameInput.text, pwdInput.text, emailInput.text) + RegisterPageCpp.registerNewAccount(usernameInput.text, pwdInput.text, emailInput.text); } } } @@ -341,16 +360,15 @@ LoginLayout { }, Image { z: -1 -// visible: registerForm.x+registerForm.width < x + // visible: registerForm.x+registerForm.width < x anchors.top: parent.top anchors.right: parent.right - anchors.topMargin: Utils.getSizeWithScreenRatio(129) - anchors.rightMargin: Utils.getSizeWithScreenRatio(127) - width: Utils.getSizeWithScreenRatio(395) - height: Utils.getSizeWithScreenRatio(350) + 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/Security/SecurityModePage.qml b/Linphone/view/Page/Form/Security/SecurityModePage.qml index 065322fc1..e0742f6c8 100644 --- a/Linphone/view/Page/Form/Security/SecurityModePage.qml +++ b/Linphone/view/Page/Form/Security/SecurityModePage.qml @@ -2,7 +2,7 @@ import QtQuick 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils LoginLayout { @@ -14,56 +14,67 @@ LoginLayout { fillMode: Image.PreserveAspectFit imageSource: AppIcons.profile colorizationColor: DefaultStyle.main2_600 - Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) } ColumnLayout { Text { - //: "Choisir votre mode" - text: qsTr("manage_account_choose_mode_title") + //: "Choisir votre mode" + text: qsTr("manage_account_choose_mode_title") font { - pixelSize: Typography.h1.pixelSize - weight: Typography.h1.weight + pixelSize: Typography.h1.pixelSize + weight: Typography.h1.weight } } Text { - //: "Vous pourrez changer de mode plus tard." - text: qsTr("manage_account_choose_mode_message") + //: "Vous pourrez changer de mode plus tard." + text: qsTr("manage_account_choose_mode_message") font.bold: true font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight } } } } centerContent: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(80) + spacing: Utils.getSizeWithScreenRatio(80) RowLayout { id: radioButtonsLayout Layout.fillWidth: true Layout.alignment: Qt.AlignHCenter - spacing: Utils.getSizeWithScreenRatio(70) + spacing: Utils.getSizeWithScreenRatio(70) Repeater { model: [ - //: "Chiffrement de bout en bout" - {checked: true, title: qsTr("manage_account_e2e_encrypted_mode_default_title"), - //: "Ce mode vous garanti la confidentialité de tous vos échanges. Notre technologie de chiffrement de bout en bout assure un niveau de sécurité maximal pour tous vos échanges." - text: qsTr("manage_account_e2e_encrypted_mode_default_summary"), imgUrl: AppIcons.chiffrement, color: DefaultStyle.info_500_main}, - //: "Interoperable" - {checked: false, title: qsTr("manage_account_e2e_encrypted_mode_interoperable_title"), - //: "Ce mode vous permet de profiter de toute les fonctionnalités de Linphone, toute en restant interopérable avec n’importe qu’elle autre service SIP." - text: qsTr("manage_account_e2e_encrypted_mode_interoperable_summary"), imgUrl: AppIcons.interoperable, color: DefaultStyle.main1_500_main} + //: "Chiffrement de bout en bout" + { + checked: true, + title: qsTr("manage_account_e2e_encrypted_mode_default_title"), + //: "Ce mode vous garanti la confidentialité de tous vos échanges. Notre technologie de chiffrement de bout en bout assure un niveau de sécurité maximal pour tous vos échanges." + text: qsTr("manage_account_e2e_encrypted_mode_default_summary"), + imgUrl: AppIcons.chiffrement, + color: DefaultStyle.info_500_main + }, + //: "Interoperable" + { + checked: false, + title: qsTr("manage_account_e2e_encrypted_mode_interoperable_title"), + //: "Ce mode vous permet de profiter de toute les fonctionnalités de Linphone, toute en restant interopérable avec n’importe qu’elle autre service SIP." + text: qsTr("manage_account_e2e_encrypted_mode_interoperable_summary"), + imgUrl: AppIcons.interoperable, + color: DefaultStyle.main1_500_main + } ] SecurityRadioButton { title: modelData.title contentText: modelData.text imgUrl: modelData.imgUrl checked: modelData.checked - color: modelData. color + color: modelData.color onCheckedChanged: { - if (checked) continueButton.selectedIndex = index + if (checked) + continueButton.selectedIndex = index; } } } @@ -72,9 +83,9 @@ LoginLayout { id: continueButton property int selectedIndex: 0 Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) - //: "Continuer" - text: qsTr("dialog_continue") + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) + //: "Continuer" + text: qsTr("dialog_continue") style: ButtonStyle.main onClicked: mainItem.modeSelected(selectedIndex) } @@ -84,4 +95,3 @@ LoginLayout { } } } - diff --git a/Linphone/view/Page/Form/Settings/AbstractSettingsMenu.qml b/Linphone/view/Page/Form/Settings/AbstractSettingsMenu.qml index d5b461158..ec634fa45 100644 --- a/Linphone/view/Page/Form/Settings/AbstractSettingsMenu.qml +++ b/Linphone/view/Page/Form/Settings/AbstractSettingsMenu.qml @@ -4,38 +4,37 @@ 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 -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle AbstractMainPage { - id: mainItem showDefaultItem: false - + property var layoutsPath property var titleText - signal goBack() - signal goBackRequested() - + signal goBack + signal goBackRequested + function layoutUrl(name) { - return layoutsPath+"/"+name+".qml" + return layoutsPath + "/" + name + ".qml"; } - + property var families property var defaultIndex: -1 - + leftPanelContent: ColumnLayout { id: leftPanel Layout.fillWidth: true Layout.fillHeight: true - property real sideMargin: Utils.getSizeWithScreenRatio(45) - spacing: Utils.getSizeWithScreenRatio(5) + property real sideMargin: Utils.getSizeWithScreenRatio(45) + spacing: Utils.getSizeWithScreenRatio(5) RowLayout { Layout.fillWidth: true Layout.leftMargin: leftPanel.sideMargin Layout.rightMargin: leftPanel.sideMargin - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) Button { id: backButton icon.width: Utils.getSizeWithScreenRatio(24) @@ -46,7 +45,7 @@ AbstractMainPage { style: ButtonStyle.noBackground focus: true onClicked: { - mainItem.goBackRequested() + mainItem.goBackRequested(); } //: Back to previous menu Accessible.name: qsTr("back_previous_menu_accessible_name") @@ -60,13 +59,13 @@ AbstractMainPage { Layout.fillWidth: true } } - + ListView { id: familiesList Layout.fillWidth: true Layout.fillHeight: true model: mainItem.families - Layout.topMargin: Utils.getSizeWithScreenRatio(41) + Layout.topMargin: Utils.getSizeWithScreenRatio(41) Layout.leftMargin: leftPanel.sideMargin property int selectedIndex: mainItem.defaultIndex != -1 ? mainItem.defaultIndex : 0 activeFocusOnTab: true @@ -74,26 +73,34 @@ AbstractMainPage { Accessible.role: Accessible.List //: Settings page selection Accessible.name: qsTr("settings_page_selection_accessible_name") - + delegate: SettingsMenuItem { titleText: modelData.title visible: modelData.visible != undefined ? modelData.visible : true isSelected: familiesList.selectedIndex == index focus: index == 0 onSelected: { - familiesList.selectedIndex = index - rightPanelStackView.clear() - rightPanelStackView.push(layoutUrl(modelData.layout), { titleText: modelData.title, model: modelData.model, container: rightPanelStackView}) + familiesList.selectedIndex = index; + rightPanelStackView.clear(); + rightPanelStackView.push(layoutUrl(modelData.layout), { + titleText: modelData.title, + model: modelData.model, + container: rightPanelStackView + }); } } } Component.onCompleted: { - let initialEntry = mainItem.families[familiesList.selectedIndex] - rightPanelStackView.push(layoutUrl(initialEntry.layout), { titleText: initialEntry.title, model: initialEntry.model, container: rightPanelStackView}) - familiesList.currentIndex = familiesList.selectedIndex + let initialEntry = mainItem.families[familiesList.selectedIndex]; + rightPanelStackView.push(layoutUrl(initialEntry.layout), { + titleText: initialEntry.title, + model: initialEntry.model, + container: rightPanelStackView + }); + familiesList.currentIndex = familiesList.selectedIndex; } } Control.StackView.onActivated: { - familiesList.forceActiveFocus(FocusNavigator.doesLastFocusWasKeyboard() ? Qt.TabFocusReason : Qt.MouseFocusReason) - } + familiesList.forceActiveFocus(FocusNavigator.doesLastFocusWasKeyboard() ? Qt.TabFocusReason : Qt.MouseFocusReason); + } } diff --git a/Linphone/view/Page/Form/Settings/AccountSettingsPage.qml b/Linphone/view/Page/Form/Settings/AccountSettingsPage.qml index b9e3a2b38..b30d3ee5f 100644 --- a/Linphone/view/Page/Form/Settings/AccountSettingsPage.qml +++ b/Linphone/view/Page/Form/Settings/AccountSettingsPage.qml @@ -9,36 +9,46 @@ import SettingsCpp AbstractSettingsMenu { id: mainItem layoutsPath: "qrc:/qt/qml/Linphone/view/Page/Layout/Settings" - //: "Mon compte" - titleText: qsTr("drawer_menu_manage_account") + //: "Mon compte" + titleText: qsTr("drawer_menu_manage_account") property AccountGui account - signal accountRemoved() + signal accountRemoved families: [ - //: "Général" - {title: qsTr("settings_general_title"), layout: "AccountSettingsGeneralLayout", model: account}, - //: "Paramètres de compte" - {title: qsTr("settings_account_title"), layout: "AccountSettingsParametersLayout", model: account} + //: "Général" + { + title: qsTr("settings_general_title"), + layout: "AccountSettingsGeneralLayout", + model: account + }, + //: "Paramètres de compte" + { + title: qsTr("settings_account_title"), + layout: "AccountSettingsParametersLayout", + model: account + } ] Connections { target: account ? account.core : null - function onRemoved() { accountRemoved() } + function onRemoved() { + accountRemoved(); + } } onGoBackRequested: if (!account.core.isSaved) { - //: "Modifications non enregistrées" - UtilsCpp.getMainWindow().showConfirmationLambdaPopup(qsTr("contact_editor_popup_abort_confirmation_title"), - //: "Vous avez des modifications non enregistrées. Si vous quittez cette page, vos changements seront perdus. Voulez-vous enregistrer vos modifications avant de continuer ?" - qsTr("contact_editor_popup_abort_confirmation_message"), - "", - function (confirmed) { - if (confirmed) { - account.core.save() - } else { - account.core.undo() - } - mainItem.goBack() - //: "Ne pas enregistrer" - //: "Enregistrer" - }, qsTr("contact_editor_dialog_abort_confirmation_do_not_save"), qsTr("contact_editor_dialog_abort_confirmation_save") - ) - } else {mainItem.goBack()} + //: "Modifications non enregistrées" + UtilsCpp.getMainWindow().showConfirmationLambdaPopup(qsTr("contact_editor_popup_abort_confirmation_title"), + //: "Vous avez des modifications non enregistrées. Si vous quittez cette page, vos changements seront perdus. Voulez-vous enregistrer vos modifications avant de continuer ?" + qsTr("contact_editor_popup_abort_confirmation_message"), "", function (confirmed) { + if (confirmed) { + account.core.save(); + } else { + account.core.undo(); + } + mainItem.goBack(); + //: "Ne pas enregistrer" + //: "Enregistrer" + }, qsTr("contact_editor_dialog_abort_confirmation_do_not_save"), qsTr( + "contact_editor_dialog_abort_confirmation_save")); + } else { + mainItem.goBack(); + } } diff --git a/Linphone/view/Page/Form/Settings/SettingsPage.qml b/Linphone/view/Page/Form/Settings/SettingsPage.qml index ac3f6b5c6..74329e0af 100644 --- a/Linphone/view/Page/Form/Settings/SettingsPage.qml +++ b/Linphone/view/Page/Form/Settings/SettingsPage.qml @@ -8,50 +8,72 @@ import UtilsCpp AbstractSettingsMenu { id: mainItem layoutsPath: "qrc:/qt/qml/Linphone/view/Page/Layout/Settings" - //: "Paramètres" - titleText: qsTr("settings_title") + //: "Paramètres" + titleText: qsTr("settings_title") families: [ - //: "Appels" - {title: qsTr("settings_calls_title"), layout: "CallSettingsLayout"}, + //: "Appels" + { + title: qsTr("settings_calls_title"), + layout: "CallSettingsLayout" + }, //: "Transfert d'appel" - {title: qsTr("settings_call_forward"), layout: "CallForwardSettingsLayout"}, - //: "Conversations" - {title: qsTr("settings_conversations_title"), layout: "ChatSettingsLayout", visible: !SettingsCpp.disableChatFeature}, - //: "Contacts" - {title: qsTr("settings_contacts_title"), layout: "ContactsSettingsLayout"}, - //: "Réunions" - {title: qsTr("settings_meetings_title"), layout: "MeetingsSettingsLayout", visible: !SettingsCpp.disableMeetingsFeature}, - //: "Affichage" - //{title: qsTr("settings_user_interface_title"), layout: "DisplaySettingsLayout"}, - //: "Security" - // {title: qsTr("settings_security_title"), layout: "SecuritySettingsLayout"}, - //: "Réseau" - {title: qsTr("settings_network_title"), layout: "NetworkSettingsLayout"}, - //: "Paramètres avancés" - {title: qsTr("settings_advanced_title"), layout: "AdvancedSettingsLayout"} + { + title: qsTr("settings_call_forward"), + layout: "CallForwardSettingsLayout" + }, + //: "Conversations" + { + title: qsTr("settings_conversations_title"), + layout: "ChatSettingsLayout", + visible: !SettingsCpp.disableChatFeature + }, + //: "Contacts" + { + title: qsTr("settings_contacts_title"), + layout: "ContactsSettingsLayout" + }, + //: "Réunions" + { + title: qsTr("settings_meetings_title"), + layout: "MeetingsSettingsLayout", + visible: !SettingsCpp.disableMeetingsFeature + }, + //: "Affichage" + //{title: qsTr("settings_user_interface_title"), layout: "DisplaySettingsLayout"}, + //: "Security" + // {title: qsTr("settings_security_title"), layout: "SecuritySettingsLayout"}, + //: "Réseau" + { + title: qsTr("settings_network_title"), + layout: "NetworkSettingsLayout" + }, + //: "Paramètres avancés" + { + title: qsTr("settings_advanced_title"), + layout: "AdvancedSettingsLayout" + } ] onGoBackRequested: if (!SettingsCpp.isSaved) { - //: Modifications non enregistrées - UtilsCpp.getMainWindow().showConfirmationLambdaPopup(qsTr("contact_editor_popup_abort_confirmation_title"), - //: Vous avez des modifications non enregistrées. Si vous quittez cette page, vos changements seront perdus. Voulez-vous enregistrer vos modifications avant de continuer ? - qsTr("contact_editor_popup_abort_confirmation_message"), - "", - function (confirmed) { - if (confirmed) { - SettingsCpp.save() - } else { - SettingsCpp.undo() - } - mainItem.goBack() - //: "Ne pas enregistrer" - }, qsTr("contact_editor_dialog_abort_confirmation_do_not_save"), - //: "Enregistrer" - qsTr("contact_editor_dialog_abort_confirmation_save") - ) - } else {mainItem.goBack()} - + //: Modifications non enregistrées + UtilsCpp.getMainWindow().showConfirmationLambdaPopup(qsTr("contact_editor_popup_abort_confirmation_title"), + //: Vous avez des modifications non enregistrées. Si vous quittez cette page, vos changements seront perdus. Voulez-vous enregistrer vos modifications avant de continuer ? + qsTr("contact_editor_popup_abort_confirmation_message"), "", function (confirmed) { + if (confirmed) { + SettingsCpp.save(); + } else { + SettingsCpp.undo(); + } + mainItem.goBack(); + //: "Ne pas enregistrer" + }, qsTr("contact_editor_dialog_abort_confirmation_do_not_save"), + //: "Enregistrer" + qsTr("contact_editor_dialog_abort_confirmation_save")); + } else { + mainItem.goBack(); + } + Component.onCompleted: { - SettingsCpp.isSaved = true + SettingsCpp.isSaved = true; } } diff --git a/Linphone/view/Page/Layout/Chat/ChatInfoActionsGroup.qml b/Linphone/view/Page/Layout/Chat/ChatInfoActionsGroup.qml index 5d4698db5..b221eaeb8 100644 --- a/Linphone/view/Page/Layout/Chat/ChatInfoActionsGroup.qml +++ b/Linphone/view/Page/Layout/Chat/ChatInfoActionsGroup.qml @@ -7,99 +7,99 @@ import QtQuick.Layouts import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 { - property var title: String - property var entries + property var title: String + property var entries - Text { - font: Typography.h4 - color: DefaultStyle.main2_600 - text: title - Layout.topMargin: Utils.getSizeWithScreenRatio(5) - } + Text { + font: Typography.h4 + color: DefaultStyle.main2_600 + text: title + Layout.topMargin: Utils.getSizeWithScreenRatio(5) + } - Control.Control { - Layout.fillWidth: true - Layout.preferredHeight: implicitHeight - Layout.topMargin: Utils.getSizeWithScreenRatio(9) - background: Rectangle { - anchors.fill: parent - color: DefaultStyle.grey_100 - radius: Utils.getSizeWithScreenRatio(15) - } + Control.Control { + Layout.fillWidth: true + Layout.preferredHeight: implicitHeight + Layout.topMargin: Utils.getSizeWithScreenRatio(9) + background: Rectangle { + anchors.fill: parent + color: DefaultStyle.grey_100 + radius: Utils.getSizeWithScreenRatio(15) + } - contentItem: ColumnLayout { - id: contentColumn - spacing: 0 + contentItem: ColumnLayout { + id: contentColumn + spacing: 0 - Repeater { - model: entries + Repeater { + model: entries - delegate: ColumnLayout { - width: parent.width - spacing: 0 + delegate: ColumnLayout { + width: parent.width + spacing: 0 property bool hovered: false - Item { - Layout.fillWidth: true - Layout.preferredHeight: visible ? Utils.getSizeWithScreenRatio(56) : 0 - visible: modelData.visible + Item { + Layout.fillWidth: true + Layout.preferredHeight: visible ? Utils.getSizeWithScreenRatio(56) : 0 + visible: modelData.visible - RowLayout { - anchors.fill: parent - spacing: Utils.getSizeWithScreenRatio(8) - anchors.leftMargin: Utils.getSizeWithScreenRatio(17) - anchors.rightMargin: Utils.getSizeWithScreenRatio(10) + RowLayout { + anchors.fill: parent + 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: Utils.getSizeWithScreenRatio(20) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) - } + EffectImage { + fillMode: Image.PreserveAspectFit + imageSource: modelData.icon + colorizationColor: modelData.color + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + } - Text { - text: modelData.text - font: hovered ? Typography.p1b : Typography.p1 - color: modelData.color - Layout.alignment: Qt.AlignVCenter - Layout.fillWidth: true - } + Text { + text: modelData.text + font: hovered ? Typography.p1b : Typography.p1 + color: modelData.color + Layout.alignment: Qt.AlignVCenter + Layout.fillWidth: true + } - EffectImage { - visible: modelData.showRightArrow - fillMode: Image.PreserveAspectFit - imageSource: AppIcons.rightArrow - colorizationColor: modelData.color - Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) - } - } + EffectImage { + visible: modelData.showRightArrow + fillMode: Image.PreserveAspectFit + imageSource: AppIcons.rightArrow + colorizationColor: modelData.color + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + } + } - MouseArea { - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onClicked: modelData.action() + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: modelData.action() onEntered: hovered = true onExited: hovered = false hoverEnabled: true - } - } + } + } - Rectangle { - visible: index < entries.length - 1 - color: DefaultStyle.main2_200 - height: Utils.getSizeWithScreenRatio(1) - width: parent.width - Utils.getSizeWithScreenRatio(30) - Layout.leftMargin: Utils.getSizeWithScreenRatio(17) - } - } - } - } - } + Rectangle { + visible: index < entries.length - 1 + color: DefaultStyle.main2_200 + 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 71264a5ba..33b5f3b6b 100644 --- a/Linphone/view/Page/Layout/Chat/ConversationInfos.qml +++ b/Linphone/view/Page/Layout/Chat/ConversationInfos.qml @@ -7,7 +7,7 @@ import QtQuick.Layouts import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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,12 +18,12 @@ ColumnLayout { property bool isAppFriend: contact && contact.core.isAppFriend property bool isGroup: chatGui && chatGui.core.isGroupChat spacing: 0 - signal ephemeralSettingsRequested() + signal ephemeralSettingsRequested signal showSharedFilesRequested(bool showMedias) - signal manageParticipantsRequested() + signal manageParticipantsRequested signal oneOneCall(bool video) - signal groupCall() + signal groupCall Avatar { Layout.alignment: Qt.AlignHCenter @@ -43,9 +43,10 @@ ColumnLayout { z: parent.z + 1 anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton - onPressAndHold: (mouse) => { - if (mouse.button === Qt.RightButton) debugButton.popup.open() - } + onPressAndHold: mouse => { + if (mouse.button === Qt.RightButton) + debugButton.popup.open(); + } } popup.contentItem: RowLayout { Text { @@ -55,8 +56,8 @@ ColumnLayout { SmallButton { icon.source: AppIcons.copy onClicked: { - UtilsCpp.copyToClipboard(chatroomaddress.text) - debugButton.close() + UtilsCpp.copyToClipboard(chatroomaddress.text); + debugButton.close(); } style: ButtonStyle.noBackground } @@ -70,11 +71,11 @@ ColumnLayout { id: titleMainItem property bool isEditingSubject: false property bool canEditSubject: mainItem.chatGui.core.meAdmin && mainItem.chatGui.core.isGroupChat - + function saveSubject() { - mainItem.chatGui.core.lSetSubject(title.text) + mainItem.chatGui.core.lSetSubject(title.text); } - + Item { visible: titleMainItem.canEditSubject Layout.preferredWidth: Utils.getSizeWithScreenRatio(18) @@ -115,13 +116,13 @@ ColumnLayout { verticalAlignment: Text.AlignVCenter Keys.onReturnPressed: { if (titleMainItem.isEditingSubject) - titleMainItem.saveSubject() - titleMainItem.isEditingSubject = !titleMainItem.isEditingSubject + titleMainItem.saveSubject(); + titleMainItem.isEditingSubject = !titleMainItem.isEditingSubject; } Keys.onEnterPressed: { if (titleMainItem.isEditingSubject) - titleMainItem.saveSubject() - titleMainItem.isEditingSubject = !titleMainItem.isEditingSubject + titleMainItem.saveSubject(); + titleMainItem.isEditingSubject = !titleMainItem.isEditingSubject; } } } @@ -145,8 +146,8 @@ ColumnLayout { hoverEnabled: true onClicked: { if (titleMainItem.isEditingSubject) - titleMainItem.saveSubject() - titleMainItem.isEditingSubject = !titleMainItem.isEditingSubject + titleMainItem.saveSubject(); + titleMainItem.isEditingSubject = !titleMainItem.isEditingSubject; } cursorShape: Qt.PointingHandCursor } @@ -162,22 +163,24 @@ ColumnLayout { text: mainItem.chatGui.core.title || "" } } - + Loader { id: titleLayout Layout.alignment: Qt.AlignHCenter Layout.topMargin: Utils.getSizeWithScreenRatio(11) sourceComponent: mainItem.isGroup ? groupTitleContent : oneOneTitleContent } - + Text { font: Typography.p3 color: DefaultStyle.main2_700 - text: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(mainItem.chatGui.core.peerAddress) : mainItem.chatGui.core.peerAddress + text: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(mainItem.chatGui.core.peerAddress) : + mainItem.chatGui.core.peerAddress + Layout.alignment: Qt.AlignHCenter Layout.topMargin: Utils.getSizeWithScreenRatio(5) } - + Text { visible: mainItem.contact font: Typography.p3 @@ -186,7 +189,7 @@ ColumnLayout { Layout.alignment: Qt.AlignHCenter Layout.topMargin: Utils.getSizeWithScreenRatio(5) } - + RowLayout { visible: !mainItem.chatGui.core.isReadOnly spacing: Utils.getSizeWithScreenRatio(10) @@ -221,7 +224,7 @@ ColumnLayout { //: "Sourdine" label: mainItem.chatGui.core.muted ? qsTr("one_one_infos_unmute") : qsTr("one_one_infos_mute") button.onClicked: { - mainItem.chatGui.core.muted = !mainItem.chatGui.core.muted + mainItem.chatGui.core.muted = !mainItem.chatGui.core.muted; } } LabelButton { @@ -234,27 +237,23 @@ ColumnLayout { 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 - ? AppIcons.adressBook - : AppIcons.plusCircle - label: mainItem.isGroup - //: Schedule a meeting - ? qsTr("group_infos_meeting") - : mainItem.isAppFriend - //: Show contact - ? qsTr("one_one_infos_open_contact") - //: Create contact - : qsTr("one_one_infos_create_contact") + button.icon.source: mainItem.isGroup ? AppIcons.videoconference : mainItem.isAppFriend ? AppIcons.adressBook : + AppIcons.plusCircle + label: mainItem.isGroup ? + //: Schedule a meeting + qsTr("group_infos_meeting") : mainItem.isAppFriend ? + //: Show contact + qsTr("one_one_infos_open_contact") : + //: Create contact + qsTr("one_one_infos_create_contact") button.onClicked: { if (mainItem.isGroup) - UtilsCpp.getMainWindow().scheduleMeeting(mainItem.chatGui.core.title, mainItem.chatGui.core.participantsAddresses) + UtilsCpp.getMainWindow().scheduleMeeting(mainItem.chatGui.core.title, mainItem.chatGui.core.participantsAddresses); else { if (mainItem.isAppFriend) - mainWindow.displayContactPage(mainItem.contact.core.defaultAddress) + mainWindow.displayContactPage(mainItem.contact.core.defaultAddress); else - mainWindow.displayCreateContactPage("",mainItem.chatGui.core.peerAddress) + mainWindow.displayCreateContactPage("", mainItem.chatGui.core.peerAddress); } } } @@ -275,11 +274,11 @@ ColumnLayout { anchors.right: parent.right visible: scrollView.contentHeight > scrollView.height } - + ColumnLayout { spacing: 0 width: scrollView.width - scrollbar.width - Utils.getSizeWithScreenRatio(5) - + Loader { id: participantLoader Layout.fillWidth: true @@ -293,9 +292,10 @@ ColumnLayout { } Connections { target: mainItem.chatGui ? mainItem.chatGui.core : null - onParticipantsChanged : { // hacky reload to update intric height - participantLoader.active = false - participantLoader.active = true + onParticipantsChanged: { + // hacky reload to update intric height + participantLoader.active = false; + participantLoader.active = true; } } } @@ -312,8 +312,8 @@ ColumnLayout { text: qsTr("group_infos_shared_medias"), color: DefaultStyle.main2_600, showRightArrow: true, - action: function() { - mainItem.showSharedFilesRequested(true) + action: function () { + mainItem.showSharedFilesRequested(true); } }, { @@ -323,101 +323,97 @@ ColumnLayout { text: qsTr("group_infos_shared_docs"), color: DefaultStyle.main2_600, showRightArrow: true, - action: function() { - mainItem.showSharedFilesRequested(false) + action: function () { + mainItem.showSharedFilesRequested(false); } } ] } - + ChatInfoActionsGroup { Layout.topMargin: Utils.getSizeWithScreenRatio(17) //: Other actions title: qsTr("group_infos_other_actions") - entries: mainItem.isGroup - ? [ - { - icon: AppIcons.clockCountDown, - visible: !mainItem.chatGui.core.isReadOnly, - text: mainItem.chatGui.core.ephemeralEnabled ? qsTr("group_infos_ephemerals")+UtilsCpp.getEphemeralFormatedTime(mainItem.chatGui.core.ephemeralLifetime) : qsTr("group_infos_enable_ephemerals"), - color: DefaultStyle.main2_600, - showRightArrow: false, - action: function() { - mainItem.ephemeralSettingsRequested() - } - }, - { - icon: AppIcons.signOut, - visible: !mainItem.chatGui.core.isReadOnly, - //: Leave chat room - text: qsTr("group_infos_leave_room"), - color: DefaultStyle.main2_600, - showRightArrow: false, - action: function() { - //: Leave Chat Room ? - mainWindow.showConfirmationLambdaPopup(qsTr("group_infos_leave_room_toast_title"), - //: All the messages will be removed from the chat room. Do you want to continue ? - qsTr("group_infos_leave_room_toast_message"), - "", - function(confirmed) { - if (confirmed) { - mainItem.chatGui.core.lLeave() - } - }) - } - }, - { - icon: AppIcons.trashCan, - visible: true, - //: Delete history - text: qsTr("group_infos_delete_history"), - color: DefaultStyle.danger_500_main, - showRightArrow: false, - action: function() { - //: Delete history ? - mainWindow.showConfirmationLambdaPopup(qsTr("group_infos_delete_history_toast_title"), - //: All the messages will be removed from the chat room. Do you want to continue ? - qsTr("group_infos_delete_history_toast_message"), - "", - function(confirmed) { - if (confirmed) { - mainItem.chatGui.core.lDeleteHistory() - } - }) - } - } - ] - : [ - { - icon: AppIcons.clockCountDown, - visible: !mainItem.chatGui.core.isReadOnly, - text: mainItem.chatGui.core.ephemeralEnabled ? qsTr("one_one_infos_ephemerals")+UtilsCpp.getEphemeralFormatedTime(mainItem.chatGui.core.ephemeralLifetime) : qsTr("one_one_infos_enable_ephemerals"), - color: DefaultStyle.main2_600, - showRightArrow: false, - action: function() { - mainItem.ephemeralSettingsRequested() - } - }, - { - icon: AppIcons.trashCan, - visible: true, - text: qsTr("one_one_infos_delete_history"), - color: DefaultStyle.danger_500_main, - showRightArrow: false, - action: function() { - //: Delete history ? - mainWindow.showConfirmationLambdaPopup(qsTr("one_one_infos_delete_history_toast_title"), - //: All the messages will be removed from the chat room. Do you want to continue ? - qsTr("one_one_infos_delete_history_toast_message"), - "", - function(confirmed) { - if (confirmed) { - mainItem.chatGui.core.lDeleteHistory() - } - }) - } - } - ] + entries: mainItem.isGroup ? [ + { + icon: AppIcons.clockCountDown, + visible: !mainItem.chatGui.core.isReadOnly, + text: mainItem.chatGui.core.ephemeralEnabled ? qsTr("group_infos_ephemerals") + + UtilsCpp.getEphemeralFormatedTime(mainItem.chatGui.core.ephemeralLifetime) : qsTr( + "group_infos_enable_ephemerals"), + color: DefaultStyle.main2_600, + showRightArrow: false, + action: function () { + mainItem.ephemeralSettingsRequested(); + } + }, + { + icon: AppIcons.signOut, + visible: !mainItem.chatGui.core.isReadOnly, + //: Leave chat room + text: qsTr("group_infos_leave_room"), + color: DefaultStyle.main2_600, + showRightArrow: false, + action: function () { + //: Leave Chat Room ? + mainWindow.showConfirmationLambdaPopup(qsTr("group_infos_leave_room_toast_title"), + //: All the messages will be removed from the chat room. Do you want to continue ? + qsTr("group_infos_leave_room_toast_message"), "", function (confirmed) { + if (confirmed) { + mainItem.chatGui.core.lLeave(); + } + }); + } + }, + { + icon: AppIcons.trashCan, + visible: true, + //: Delete history + text: qsTr("group_infos_delete_history"), + color: DefaultStyle.danger_500_main, + showRightArrow: false, + action: function () { + //: Delete history ? + mainWindow.showConfirmationLambdaPopup(qsTr("group_infos_delete_history_toast_title"), + //: All the messages will be removed from the chat room. Do you want to continue ? + qsTr("group_infos_delete_history_toast_message"), "", function (confirmed) { + if (confirmed) { + mainItem.chatGui.core.lDeleteHistory(); + } + }); + } + } + ] : [ + { + icon: AppIcons.clockCountDown, + visible: !mainItem.chatGui.core.isReadOnly, + text: mainItem.chatGui.core.ephemeralEnabled ? qsTr("one_one_infos_ephemerals") + + UtilsCpp.getEphemeralFormatedTime(mainItem.chatGui.core.ephemeralLifetime) : qsTr( + "one_one_infos_enable_ephemerals"), + color: DefaultStyle.main2_600, + showRightArrow: false, + action: function () { + mainItem.ephemeralSettingsRequested(); + } + }, + { + icon: AppIcons.trashCan, + visible: true, + text: qsTr("one_one_infos_delete_history"), + color: DefaultStyle.danger_500_main, + showRightArrow: false, + action: function () { + //: Delete history ? + mainWindow.showConfirmationLambdaPopup(qsTr("one_one_infos_delete_history_toast_title"), + //: All the messages will be removed from the chat room. Do you want to continue ? + qsTr("one_one_infos_delete_history_toast_message"), "", function (confirmed) { + if (confirmed) { + mainItem.chatGui.core.lDeleteHistory(); + } + }); + } + } + ] } } } diff --git a/Linphone/view/Page/Layout/Chat/EphemeralSettings.qml b/Linphone/view/Page/Layout/Chat/EphemeralSettings.qml index 0bfa7e2f5..963539ff2 100644 --- a/Linphone/view/Page/Layout/Chat/EphemeralSettings.qml +++ b/Linphone/view/Page/Layout/Chat/EphemeralSettings.qml @@ -7,37 +7,52 @@ import QtQuick.Layouts import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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: Utils.getSizeWithScreenRatio(5) - signal done() + signal done property var model: [ - {title: qsTr("one_minute"), lifetime: 60}, - {title: qsTr("one_hour"), lifetime: 3600}, - {title: qsTr("one_day"), lifetime: 86400}, - {title: qsTr("one_week"), lifetime: 7*86400}, - {title: qsTr("disabled"), lifetime: 0} + { + title: qsTr("one_minute"), + lifetime: 60 + }, + { + title: qsTr("one_hour"), + lifetime: 3600 + }, + { + title: qsTr("one_day"), + lifetime: 86400 + }, + { + title: qsTr("one_week"), + lifetime: 7 * 86400 + }, + { + title: qsTr("disabled"), + lifetime: 0 + } ] - + Component.onCompleted: { - var isLifetimeInRange = model.some(function(item) { + var isLifetimeInRange = model.some(function (item) { return item.lifetime === selectedLifetime; }); - if (!isLifetimeInRange) { // Display life time set elsewhere, not in settable range. + if (!isLifetimeInRange) { + // Display life time set elsewhere, not in settable range. model = model.concat({ - title: qsTr("custom")+UtilsCpp.getEphemeralFormatedTime(selectedLifetime), - lifetime: selectedLifetime, - disabled: true - }); + title: qsTr("custom") + UtilsCpp.getEphemeralFormatedTime(selectedLifetime), + lifetime: selectedLifetime, + disabled: true + }); } - } + } RowLayout { id: manageParticipantsButtons @@ -49,8 +64,8 @@ ColumnLayout { icon.source: AppIcons.leftArrow onClicked: { if (chatGui.core.ephemeralLifetime != selectedLifetime) - chatGui.core.ephemeralLifetime = selectedLifetime - mainItem.done() + chatGui.core.ephemeralLifetime = selectedLifetime; + mainItem.done(); } } @@ -116,7 +131,6 @@ ColumnLayout { wrapMode: Text.NoWrap elide: Text.ElideRight } - } Rectangle { //visible: index < (model.count - 1) diff --git a/Linphone/view/Page/Layout/Chat/GroupChatInfoParticipants.qml b/Linphone/view/Page/Layout/Chat/GroupChatInfoParticipants.qml index 897334a83..754eabc46 100644 --- a/Linphone/view/Page/Layout/Chat/GroupChatInfoParticipants.qml +++ b/Linphone/view/Page/Layout/Chat/GroupChatInfoParticipants.qml @@ -7,18 +7,17 @@ import QtQuick.Layouts import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 var title: String - property var participants - property ChatGui chatGui - signal manageParticipantsRequested() - - property bool isGroupEditable: chatGui && chatGui.core.meAdmin && !chatGui.core.isReadOnly + property var title: String + property var participants + property ChatGui chatGui + signal manageParticipantsRequested + + property bool isGroupEditable: chatGui && chatGui.core.meAdmin && !chatGui.core.isReadOnly RowLayout { Text { @@ -27,7 +26,9 @@ ColumnLayout { text: title Layout.topMargin: Utils.getSizeWithScreenRatio(5) } - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } BigButton { id: expandButton style: ButtonStyle.noBackground @@ -41,7 +42,7 @@ ColumnLayout { visible: expandButton.checked Layout.fillWidth: true Layout.topMargin: Utils.getSizeWithScreenRatio(9) - height: Math.min(contentColumn.implicitHeight,Utils.getSizeWithScreenRatio(90)) + height: Math.min(contentColumn.implicitHeight, Utils.getSizeWithScreenRatio(90)) bottomPadding: Utils.getSizeWithScreenRatio(15) background: Rectangle { @@ -52,7 +53,7 @@ ColumnLayout { contentItem: ColumnLayout { id: contentColumn spacing: Utils.getSizeWithScreenRatio(16) - + Item { Layout.topMargin: Utils.getSizeWithScreenRatio(7) } @@ -82,7 +83,7 @@ ColumnLayout { Layout.alignment: Qt.AlignVCenter Text { - text: participantGui.core.displayName + text: participantGui.core.displayName font: Typography.p1 color: DefaultStyle.main2_700 } @@ -95,11 +96,11 @@ ColumnLayout { } } } - + Item { Layout.fillWidth: true } - + PopupButton { id: detailOptions popup.x: width @@ -107,10 +108,9 @@ ColumnLayout { implicitHeight: detailsButtons.implicitHeight implicitWidth: detailsButtons.implicitWidth Keys.onPressed: event => { - if (event.key == Qt.Key_Left - || event.key == Qt.Key_Escape) { - detailOptions.popup.close() - event.accepted = true + if (event.key == Qt.Key_Left || event.key == Qt.Key_Escape) { + detailOptions.popup.close(); + event.accepted = true; } } ColumnLayout { @@ -120,31 +120,30 @@ ColumnLayout { Layout.fillWidth: true //: "Show contact" text: contact && contact.core && contact.core.isAppFriend ? qsTr("menu_see_existing_contact") : - //: "Add to contacts" - qsTr("menu_add_address_to_contacts") - icon.source: (contact && contact.core && contact.core.isAppFriend) - ? AppIcons.adressBook - : AppIcons.plusCircle + //: "Add to contacts" + qsTr("menu_add_address_to_contacts") + icon.source: (contact && contact.core && contact.core.isAppFriend) ? AppIcons.adressBook : AppIcons.plusCircle icon.width: Utils.getSizeWithScreenRatio(32) icon.height: Utils.getSizeWithScreenRatio(32) onClicked: { - detailOptions.close() + detailOptions.close(); if (contact && contact.core.isAppFriend) - UtilsCpp.getMainWindow().displayContactPage(participantGui.core.sipAddress) + UtilsCpp.getMainWindow().displayContactPage(participantGui.core.sipAddress); else - UtilsCpp.getMainWindow().displayCreateContactPage("",participantGui.core.sipAddress) + UtilsCpp.getMainWindow().displayCreateContactPage("", participantGui.core.sipAddress); } } IconLabelButton { visible: mainItem.isGroupEditable Layout.fillWidth: true - text: participantGui.core.isAdmin ? qsTr("group_infos_remove_admin_rights") : qsTr("group_infos_give_admin_rights") + text: participantGui.core.isAdmin ? qsTr("group_infos_remove_admin_rights") : qsTr( + "group_infos_give_admin_rights") icon.source: AppIcons.profile icon.width: Utils.getSizeWithScreenRatio(32) icon.height: Utils.getSizeWithScreenRatio(32) onClicked: { - detailOptions.close() - mainItem.chatGui.core.lToggleParticipantAdminStatus(participantGui.core.sipAddress) + detailOptions.close(); + mainItem.chatGui.core.lToggleParticipantAdminStatus(participantGui.core.sipAddress); } } IconLabelButton { @@ -154,8 +153,8 @@ ColumnLayout { icon.width: Utils.getSizeWithScreenRatio(32) icon.height: Utils.getSizeWithScreenRatio(32) onClicked: { - detailOptions.close() - UtilsCpp.copyToClipboard(participantGui.core.sipAddress) + detailOptions.close(); + UtilsCpp.copyToClipboard(participantGui.core.sipAddress); } } Rectangle { @@ -175,24 +174,21 @@ ColumnLayout { icon.height: Utils.getSizeWithScreenRatio(32) style: ButtonStyle.hoveredBackgroundRed onClicked: { - detailOptions.close() - UtilsCpp.getMainWindow().showConfirmationLambdaPopup(qsTr("group_infos_remove_participants_toast_title"), - qsTr("group_infos_remove_participants_toast_message"), - "", - function(confirmed) { - if (confirmed) { - mainItem.chatGui.core.lRemoveParticipant(participantGui.core.sipAddress) - } - }) + detailOptions.close(); + UtilsCpp.getMainWindow().showConfirmationLambdaPopup(qsTr("group_infos_remove_participants_toast_title"), qsTr( + "group_infos_remove_participants_toast_message"), "", function (confirmed) { + if (confirmed) { + mainItem.chatGui.core.lRemoveParticipant(participantGui.core.sipAddress); + } + }); } } } } } - } } - + MediumButton { id: manageParticipants visible: mainItem.isGroupEditable diff --git a/Linphone/view/Page/Layout/Chat/ManageParticipants.qml b/Linphone/view/Page/Layout/Chat/ManageParticipants.qml index 6a37f6dbe..9061a16b8 100644 --- a/Linphone/view/Page/Layout/Chat/ManageParticipants.qml +++ b/Linphone/view/Page/Layout/Chat/ManageParticipants.qml @@ -7,7 +7,7 @@ import QtQuick.Layouts import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 { @@ -20,20 +20,21 @@ Rectangle { Layout.rightMargin: Utils.getSizeWithScreenRatio(10) color: DefaultStyle.grey_0 height: participantAddColumn.implicitHeight - signal done() + signal done Connections { enabled: chatGui !== null target: chatGui.core function onParticipantAddressesChanged(success) { - if (!success) UtilsCpp.showInformationPopup(qsTr("info_popup_error_title"), - //: Error while setting participants ! - qsTr("info_popup_manage_participant_error_message"), false) + if (!success) + UtilsCpp.showInformationPopup(qsTr("info_popup_error_title"), + //: Error while setting participants ! + qsTr("info_popup_manage_participant_error_message"), false); else { - mainItem.done() - UtilsCpp.showInformationPopup(qsTr("info_popup_success_title"), - //: Participants updated - qsTr("info_popup_manage_participant_updated_message"), true) + mainItem.done(); + UtilsCpp.showInformationPopup(qsTr("info_popup_success_title"), + //: Participants updated + qsTr("info_popup_manage_participant_updated_message"), true); } } } @@ -52,7 +53,7 @@ Rectangle { style: ButtonStyle.noBackground icon.source: AppIcons.leftArrow onClicked: { - mainItem.done() + mainItem.done(); } } Text { @@ -67,7 +68,7 @@ Rectangle { //: Apply text: qsTr("apply_button_text") onClicked: { - mainItem.chatGui.core.lSetParticipantsAddresses(manageParticipantsLayout.selectedParticipants) + mainItem.chatGui.core.lSetParticipantsAddresses(manageParticipantsLayout.selectedParticipants); } } } @@ -82,7 +83,7 @@ Rectangle { focus: true onVisibleChanged: { if (visible) - selectedParticipants = mainItem.chatGui.core.participantsAddresses + selectedParticipants = mainItem.chatGui.core.participantsAddresses; } } Item { diff --git a/Linphone/view/Page/Layout/Chat/MessageImdnStatusInfos.qml b/Linphone/view/Page/Layout/Chat/MessageImdnStatusInfos.qml index adf362129..65ea32398 100644 --- a/Linphone/view/Page/Layout/Chat/MessageImdnStatusInfos.qml +++ b/Linphone/view/Page/Layout/Chat/MessageImdnStatusInfos.qml @@ -13,7 +13,8 @@ MessageInfosLayout { tabbarModel: chatMessageGui ? chatMessageGui.core.imdnStatusListAsString : [] listModel: ImdnStatusProxy { imdnStatusList: chatMessageGui ? chatMessageGui.core.imdnStatusList : [] - filter: chatMessageGui && chatMessageGui.core.imdnStatusAsSingletons[mainItem.tabbar.currentIndex]?.state || LinphoneEnums.ChatMessageState.StateIdle + filter: chatMessageGui && chatMessageGui.core.imdnStatusAsSingletons[mainItem.tabbar.currentIndex]?.state + || LinphoneEnums.ChatMessageState.StateIdle } listView.delegate: Item { @@ -23,9 +24,8 @@ MessageInfosLayout { property var contactObj: modelData ? UtilsCpp.findFriendByAddress(modelData.address) : null property FriendGui contact: contactObj && contactObj.value || null property var nameObj: modelData ? UtilsCpp.getDisplayName(modelData.address) : null - property string updateTime: UtilsCpp.isCurrentDay(modelData.lastUpdatedTime) - ? UtilsCpp.toTimeString(modelData.lastUpdatedTime, "hh:mm") - : UtilsCpp.formatDate(modelData.lastUpdatedTime, true) + property string updateTime: UtilsCpp.isCurrentDay(modelData.lastUpdatedTime) ? UtilsCpp.toTimeString( + modelData.lastUpdatedTime, "hh:mm") : UtilsCpp.formatDate(modelData.lastUpdatedTime, true) RowLayout { id: delegateIn anchors.fill: parent @@ -58,7 +58,9 @@ MessageInfosLayout { } } } - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } Text { text: listDelegate.updateTime font { diff --git a/Linphone/view/Page/Layout/Chat/MessageInfosLayout.qml b/Linphone/view/Page/Layout/Chat/MessageInfosLayout.qml index 4c40fffd9..dc666c3ca 100644 --- a/Linphone/view/Page/Layout/Chat/MessageInfosLayout.qml +++ b/Linphone/view/Page/Layout/Chat/MessageInfosLayout.qml @@ -7,7 +7,7 @@ import QtQuick.Layouts import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 { @@ -25,7 +25,7 @@ ColumnLayout { spacing: Utils.getSizeWithScreenRatio(25) - signal goBackRequested() + signal goBackRequested RowLayout { BigButton { @@ -49,7 +49,7 @@ ColumnLayout { visible: mainItem.tabbarModel !== undefined Layout.fillWidth: true Layout.preferredWidth: implicitWidth - model: mainItem.tabbarModel + model: mainItem.tabbarModel pixelSize: Typography.h4.pixelSize textWeight: Typography.h4.weight spacing: Utils.getSizeWithScreenRatio(10) diff --git a/Linphone/view/Page/Layout/Chat/MessageReactionsInfos.qml b/Linphone/view/Page/Layout/Chat/MessageReactionsInfos.qml index acfd81f72..29d1c073d 100644 --- a/Linphone/view/Page/Layout/Chat/MessageReactionsInfos.qml +++ b/Linphone/view/Page/Layout/Chat/MessageReactionsInfos.qml @@ -16,7 +16,9 @@ MessageInfosLayout { reactions: chatMessageGui ? chatMessageGui.core.reactions : [] // First index of reactionsSingletonAsStrings list is all reactions combined which does not appear // in reactionsSingleton list - filter: tabbar.currentIndex >=1 && chatMessageGui && chatMessageGui.core.reactionsSingleton[tabbar.currentIndex-1].body || "" + filter: tabbar.currentIndex >= 1 && chatMessageGui && chatMessageGui.core.reactionsSingleton[tabbar.currentIndex - 1].body + || "" + } listView.delegate: Item { width: listView.width @@ -61,7 +63,9 @@ MessageInfosLayout { } } } - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } Text { text: UtilsCpp.encodeEmojiToQmlRichFormat(modelData.body) textFormat: Text.RichText diff --git a/Linphone/view/Page/Layout/Chat/MessageSharedFilesInfos.qml b/Linphone/view/Page/Layout/Chat/MessageSharedFilesInfos.qml index 8d4eee4bf..91ffd383c 100644 --- a/Linphone/view/Page/Layout/Chat/MessageSharedFilesInfos.qml +++ b/Linphone/view/Page/Layout/Chat/MessageSharedFilesInfos.qml @@ -20,7 +20,8 @@ MessageInfosLayout { Layout.fillHeight: true Layout.preferredHeight: contentHeight cellWidth: mainItem.filter === ChatMessageFileProxy.FilterContentType.Documents ? width : Math.round(width / 4) - cellHeight: mainItem.filter === ChatMessageFileProxy.FilterContentType.Documents ? Utils.getSizeWithScreenRatio(69) : 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 @@ -36,11 +37,11 @@ MessageInfosLayout { anchors.centerIn: parent visible: !gridView.loading && gridView.count === 0 font: Typography.p2l - text: mainItem.filter === ChatMessageFileProxy.FilterContentType.Medias - //: No media - ? qsTr("no_shared_medias") - //: No document - : qsTr("no_shared_documents") + text: mainItem.filter === ChatMessageFileProxy.FilterContentType.Medias ? + //: No media + qsTr("no_shared_medias") : + //: No document + qsTr("no_shared_documents") } delegate: FileView { contentGui: modelData @@ -49,6 +50,8 @@ MessageInfosLayout { height: gridView.cellHeight - Utils.getSizeWithScreenRatio(2) } }, - Item{Layout.fillHeight: true} + Item { + Layout.fillHeight: true + } ] -} \ No newline at end of file +} diff --git a/Linphone/view/Page/Layout/Login/LoginLayout.qml b/Linphone/view/Page/Layout/Login/LoginLayout.qml index b539dd4a1..f79981769 100644 --- a/Linphone/view/Page/Layout/Login/LoginLayout.qml +++ b/Linphone/view/Page/Layout/Login/LoginLayout.qml @@ -8,26 +8,26 @@ import QtQuick.Controls.Basic as Control import Linphone import ConstantsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle Rectangle { id: mainItem - property alias titleContent : titleLayout.children - property alias centerContent : centerLayout.children + property alias titleContent: titleLayout.children + property alias centerContent: centerLayout.children color: DefaultStyle.grey_0 component AboutLine: RowLayout { id: line - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) property var imageSource property string title property string text property bool enableMouseArea: false - signal contentClicked() + signal contentClicked EffectImage { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) imageSource: parent.imageSource colorizationColor: DefaultStyle.main1_500_main } @@ -38,8 +38,8 @@ Rectangle { text: line.title color: DefaultStyle.main2_600 font { - pixelSize: Typography.b2.pixelSize - weight: Typography.b2.weight + pixelSize: Typography.b2.pixelSize + weight: Typography.b2.weight } horizontalAlignment: Layout.AlignLeft } @@ -48,14 +48,14 @@ Rectangle { Layout.fillWidth: true text: line.text color: DefaultStyle.main2_500_main - font.pixelSize: Utils.getSizeWithScreenRatio(14) + font.pixelSize: Utils.getSizeWithScreenRatio(14) horizontalAlignment: Layout.AlignLeft - Keys.onPressed: (event)=> { - if (event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { - line.contentClicked(undefined) - event.accepted = true; - } - } + Keys.onPressed: event => { + if (event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { + line.contentClicked(undefined); + event.accepted = true; + } + } MouseArea { id: privateMouseArea enabled: line.enableMouseArea @@ -72,51 +72,51 @@ Rectangle { Dialog { id: aboutPopup anchors.centerIn: parent - width: Utils.getSizeWithScreenRatio(637) - //: À propos de %1 - title: qsTr("help_about_title").arg(applicationName) - bottomPadding: Utils.getSizeWithScreenRatio(10) + width: Utils.getSizeWithScreenRatio(637) + //: À propos de %1 + title: qsTr("help_about_title").arg(applicationName) + bottomPadding: Utils.getSizeWithScreenRatio(10) buttons: [] content: RowLayout { ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(17) + spacing: Utils.getSizeWithScreenRatio(17) Layout.alignment: Qt.AlignTop | Qt.AlignLeft AboutLine { imageSource: AppIcons.detective - //: "Politique de confidentialité" - title: qsTr("help_about_privacy_policy_title") - //: "Visiter notre potilique de confidentialité" - text: qsTr("help_about_privacy_policy_link") + //: "Politique de confidentialité" + title: qsTr("help_about_privacy_policy_title") + //: "Visiter notre potilique de confidentialité" + text: qsTr("help_about_privacy_policy_link") enableMouseArea: true onContentClicked: Qt.openUrlExternally(ConstantsCpp.PrivatePolicyUrl) } AboutLine { imageSource: AppIcons.info - //: "Version" - title: qsTr("help_about_version_title") + //: "Version" + title: qsTr("help_about_version_title") text: Qt.application.version } AboutLine { imageSource: AppIcons.checkSquareOffset - //: "Licence" - title: qsTr("help_about_licence_title") + //: "Licence" + title: qsTr("help_about_licence_title") text: applicationLicence } AboutLine { imageSource: AppIcons.copyright - //: "Copyright - title: qsTr("help_about_copyright_title") + //: "Copyright + title: qsTr("help_about_copyright_title") text: applicationVendor } Item { // Item to shift close button - Layout.preferredHeight: Utils.getSizeWithScreenRatio(10) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(10) } } MediumButton { Layout.alignment: Qt.AlignRight | Qt.AlignBottom - //: "Fermer" - text: qsTr("close") + //: "Fermer" + text: qsTr("close") style: ButtonStyle.main onClicked: aboutPopup.close() } @@ -125,11 +125,15 @@ Rectangle { ColumnLayout { anchors.fill: parent - spacing: 0 - RowLayout { + spacing: 0 + RowLayout { Layout.fillWidth: true - 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)))) + 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,25 +154,26 @@ Rectangle { RowLayout { id: titleLayout Layout.fillWidth: true - Layout.topMargin: Math.max(Utils.getSizeWithScreenRatio(10), Utils.getSizeWithScreenRatio(40 - ((40/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height)))) + 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.max(Utils.getSizeWithScreenRatio(15), Utils.getSizeWithScreenRatio(70 - ((70/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height)))) - Layout.alignment: Qt.AlignBottom - + Layout.topMargin: Math.max(Utils.getSizeWithScreenRatio(15), Utils.getSizeWithScreenRatio(70 - ((70 / ( + DefaultStyle.defaultHeight - mainWindow.minimumHeight)) * (DefaultStyle.defaultHeight + - mainWindow.height)))) + Layout.alignment: Qt.AlignBottom } Image { id: bottomMountains source: AppIcons.belledonne fillMode: Image.Stretch Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(108) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(108) } } - -} - +} diff --git a/Linphone/view/Page/Layout/Main/MainLayout.qml b/Linphone/view/Page/Layout/Main/MainLayout.qml index bdc9508f4..5311b652f 100644 --- a/Linphone/view/Page/Layout/Main/MainLayout.qml +++ b/Linphone/view/Page/Layout/Main/MainLayout.qml @@ -11,758 +11,771 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle Item { - id: mainItem - property var callObj - property var contextualMenuOpenedComponent: undefined - property bool focusPageOnNextLoad: false // Focus the page on next load - usefull cause of loader + id: mainItem + property var callObj + property var contextualMenuOpenedComponent: undefined + property bool focusPageOnNextLoad: false // Focus the page on next load - usefull cause of loader - signal addAccountRequest - signal openNewCallRequest - signal callCreated - signal openCallHistory - signal openNumPadRequest - signal displayContactRequested(string contactAddress) - signal displayChatRequested(string contactAddress) - signal openChatRequested(ChatGui chat) - signal createContactRequested(string name, string address) - signal scheduleMeetingRequested(string subject, list addresses) - signal accountRemoved + signal addAccountRequest + signal openNewCallRequest + signal callCreated + signal openCallHistory + signal openNumPadRequest + signal displayContactRequested(string contactAddress) + signal displayChatRequested(string contactAddress) + signal openChatRequested(ChatGui chat) + signal createContactRequested(string name, string address) + signal scheduleMeetingRequested(string subject, list addresses) + signal accountRemoved - function goToNewCall() { - tabbar.currentIndex = 0; - mainItem.openNewCallRequest(); - } - function goToCallHistory() { - tabbar.currentIndex = 0; - mainItem.openCallHistory(); - } - function displayContactPage(contactAddress) { - tabbar.currentIndex = 1; - mainItem.displayContactRequested(contactAddress); - } - function displayChatPage(contactAddress) { - tabbar.currentIndex = 2; - mainItem.displayChatRequested(contactAddress); - } - function openChat(chat) { - tabbar.currentIndex = 2; - mainItem.openChatRequested(chat); - } - function createContact(name, address) { - tabbar.currentIndex = 1; - mainItem.createContactRequested(name, address); - } - function scheduleMeeting(subject, addresses) { - tabbar.currentIndex = 3; - mainItem.scheduleMeetingRequested(subject, addresses); - } + function goToNewCall() { + tabbar.currentIndex = 0; + mainItem.openNewCallRequest(); + } + function goToCallHistory() { + tabbar.currentIndex = 0; + mainItem.openCallHistory(); + } + function displayContactPage(contactAddress) { + tabbar.currentIndex = 1; + mainItem.displayContactRequested(contactAddress); + } + function displayChatPage(contactAddress) { + tabbar.currentIndex = 2; + mainItem.displayChatRequested(contactAddress); + } + function openChat(chat) { + tabbar.currentIndex = 2; + mainItem.openChatRequested(chat); + } + function createContact(name, address) { + tabbar.currentIndex = 1; + mainItem.createContactRequested(name, address); + } + function scheduleMeeting(subject, addresses) { + tabbar.currentIndex = 3; + mainItem.scheduleMeetingRequested(subject, addresses); + } - function openContextualMenuComponent(component) { - if (mainItem.contextualMenuOpenedComponent && mainItem.contextualMenuOpenedComponent != component) { - mainStackView.pop(); - if (mainItem.contextualMenuOpenedComponent) { - mainItem.contextualMenuOpenedComponent.destroy(); - } - mainItem.contextualMenuOpenedComponent = undefined; - } - if (!mainItem.contextualMenuOpenedComponent) { - mainStackView.push(component); - mainItem.contextualMenuOpenedComponent = component; - } - settingsMenuButton.popup.close(); - } + function openContextualMenuComponent(component) { + if (mainItem.contextualMenuOpenedComponent && mainItem.contextualMenuOpenedComponent != component) { + mainStackView.pop(); + if (mainItem.contextualMenuOpenedComponent) { + mainItem.contextualMenuOpenedComponent.destroy(); + } + mainItem.contextualMenuOpenedComponent = undefined; + } + if (!mainItem.contextualMenuOpenedComponent) { + mainStackView.push(component); + mainItem.contextualMenuOpenedComponent = component; + } + settingsMenuButton.popup.close(); + } - function closeContextualMenuComponent() { - mainStackView.pop(); - if (mainItem.contextualMenuOpenedComponent) - mainItem.contextualMenuOpenedComponent.destroy(); - mainItem.contextualMenuOpenedComponent = undefined; - } + function closeContextualMenuComponent() { + mainStackView.pop(); + if (mainItem.contextualMenuOpenedComponent) + mainItem.contextualMenuOpenedComponent.destroy(); + mainItem.contextualMenuOpenedComponent = undefined; + } - function openAccountSettings(account) { - var page = accountSettingsPageComponent.createObject(parent, { - "account": account - }); - openContextualMenuComponent(page); - } + function openAccountSettings(account) { + var page = accountSettingsPageComponent.createObject(parent, { + "account": account + }); + openContextualMenuComponent(page); + } - AccountProxy { - id: accountProxy - onDefaultAccountChanged: if (tabbar.currentIndex === 0 && defaultAccount) - defaultAccount.core?.lResetMissedCalls() - } + AccountProxy { + id: accountProxy + onDefaultAccountChanged: if (tabbar.currentIndex === 0 && defaultAccount) + defaultAccount.core?.lResetMissedCalls() + } - CallProxy { - id: callsModel - sourceModel: AppCpp.calls - } + CallProxy { + id: callsModel + sourceModel: AppCpp.calls + } - Item { - anchors.fill: parent + Item { + anchors.fill: parent - Popup { - id: currentCallNotif - background: Item {} - closePolicy: Control.Popup.NoAutoClose - visible: currentCall && currentCall.core.state != LinphoneEnums.CallState.Idle && currentCall.core.state != LinphoneEnums.CallState.IncomingReceived && currentCall.core.state != LinphoneEnums.CallState.PushIncomingReceived - x: mainItem.width / 2 - width / 2 - y: contentItem.height / 2 - property var currentCall: callsModel.currentCall ? callsModel.currentCall : null - property string remoteName: currentCall ? currentCall.core.remoteName : "" - contentItem: MediumButton { - style: ButtonStyle.toast - text: currentCallNotif.currentCall ? currentCallNotif.currentCall.core.conference ? ("Réunion en cours : ") + currentCallNotif.currentCall.core.conference.core.subject : (("Appel en cours : ") + currentCallNotif.remoteName) : "appel en cours" - onClicked: { - var callsWindow = UtilsCpp.getOrCreateCallsWindow(currentCallNotif.currentCall); - UtilsCpp.smartShowWindow(callsWindow); - } - } - } + Popup { + id: currentCallNotif + background: Item {} + closePolicy: Control.Popup.NoAutoClose + visible: currentCall && currentCall.core.state != LinphoneEnums.CallState.Idle && currentCall.core.state + != LinphoneEnums.CallState.IncomingReceived && currentCall.core.state + != LinphoneEnums.CallState.PushIncomingReceived + x: mainItem.width / 2 - width / 2 + y: contentItem.height / 2 + property var currentCall: callsModel.currentCall ? callsModel.currentCall : null + property string remoteName: currentCall ? currentCall.core.remoteName : "" + contentItem: MediumButton { + style: ButtonStyle.toast + text: currentCallNotif.currentCall ? currentCallNotif.currentCall.core.conference ? ("Réunion en cours : ") + + currentCallNotif.currentCall.core.conference.core.subject : (("Appel en cours : ") + + currentCallNotif.remoteName) : "appel en cours" + onClicked: { + var callsWindow = UtilsCpp.getOrCreateCallsWindow(currentCallNotif.currentCall); + UtilsCpp.smartShowWindow(callsWindow); + } + } + } - RowLayout { - anchors.fill: parent - spacing: 0 - anchors.topMargin: Utils.getSizeWithScreenRatio(25) + RowLayout { + anchors.fill: parent + spacing: 0 + anchors.topMargin: Utils.getSizeWithScreenRatio(25) - VerticalTabBar { - id: tabbar - Layout.fillHeight: true - Layout.preferredWidth: Utils.getSizeWithScreenRatio(82) - defaultAccount: accountProxy.defaultAccount - currentIndex: 0 - onCountChanged: if (currentIndex >= count) currentIndex = 0 - Binding on currentIndex { - when: mainItem.contextualMenuOpenedComponent != undefined - value: -1 - } - model: [ - { - "icon": AppIcons.phone, - "selectedIcon": AppIcons.phoneSelected, - //: "Appels" - "label": qsTr("bottom_navigation_calls_label"), - //: "Open calls page" - "accessibilityLabel": qsTr("open_calls_page_accessible_name") - }, - { - "icon": AppIcons.adressBook, - "selectedIcon": AppIcons.adressBookSelected, - //: "Contacts" - "label": qsTr("bottom_navigation_contacts_label"), - //: "Open contacts page" - "accessibilityLabel": qsTr("open_contacts_page_accessible_name") - }, - { - "icon": AppIcons.chatTeardropText, - "selectedIcon": AppIcons.chatTeardropTextSelected, - //: "Conversations" - "label": qsTr("bottom_navigation_conversations_label"), - //: "Open conversations page" - "accessibilityLabel": qsTr("open_conversations_page_accessible_name"), - "visible": !SettingsCpp.disableChatFeature - }, - { - "icon": AppIcons.videoconference, - "selectedIcon": AppIcons.videoconferenceSelected, - //: "Réunions" - "label": qsTr("bottom_navigation_meetings_label"), - //: "Open meetings page" - "accessibilityLabel": qsTr("open_contact_page_accessible_name"), - "visible": !SettingsCpp.disableMeetingsFeature - } - ] - onCurrentIndexChanged: { - if (currentIndex === -1 || currentIndex >= tabbar.visibleCount) - return; - if (currentIndex === 0 && accountProxy.defaultAccount) - accountProxy.defaultAccount.core?.lResetMissedCalls(); - if (mainItem.contextualMenuOpenedComponent) { - closeContextualMenuComponent(); - } - } - Keys.onPressed: event => { - if (event.key == Qt.Key_Right) { - mainStackView.currentItem.forceActiveFocus(); - } - } + VerticalTabBar { + id: tabbar + Layout.fillHeight: true + Layout.preferredWidth: Utils.getSizeWithScreenRatio(82) + defaultAccount: accountProxy.defaultAccount + currentIndex: 0 + onCountChanged: if (currentIndex >= count) + currentIndex = 0 + Binding on currentIndex { + when: mainItem.contextualMenuOpenedComponent != undefined + value: -1 + } + model: [ + { + "icon": AppIcons.phone, + "selectedIcon": AppIcons.phoneSelected, + //: "Appels" + "label": qsTr("bottom_navigation_calls_label"), + //: "Open calls page" + "accessibilityLabel": qsTr("open_calls_page_accessible_name") + }, + { + "icon": AppIcons.adressBook, + "selectedIcon": AppIcons.adressBookSelected, + //: "Contacts" + "label": qsTr("bottom_navigation_contacts_label"), + //: "Open contacts page" + "accessibilityLabel": qsTr("open_contacts_page_accessible_name") + }, + { + "icon": AppIcons.chatTeardropText, + "selectedIcon": AppIcons.chatTeardropTextSelected, + //: "Conversations" + "label": qsTr("bottom_navigation_conversations_label"), + //: "Open conversations page" + "accessibilityLabel": qsTr("open_conversations_page_accessible_name"), + "visible": !SettingsCpp.disableChatFeature + }, + { + "icon": AppIcons.videoconference, + "selectedIcon": AppIcons.videoconferenceSelected, + //: "Réunions" + "label": qsTr("bottom_navigation_meetings_label"), + //: "Open meetings page" + "accessibilityLabel": qsTr("open_contact_page_accessible_name"), + "visible": !SettingsCpp.disableMeetingsFeature + } + ] + onCurrentIndexChanged: { + if (currentIndex === -1 || currentIndex >= tabbar.visibleCount) + return; + if (currentIndex === 0 && accountProxy.defaultAccount) + accountProxy.defaultAccount.core?.lResetMissedCalls(); + if (mainItem.contextualMenuOpenedComponent) { + closeContextualMenuComponent(); + } + } + Keys.onPressed: event => { + if (event.key == Qt.Key_Right) { + mainStackView.currentItem.forceActiveFocus(); + } + } - /** - * Focus the page when user select the page with keyboard. - * Do not add this behavior on the arrows - */ - onEnterPressed: { - focusPageOnNextLoad = true - } - onSpacePressed: { - focusPageOnNextLoad = true - } - - Component.onCompleted: { - if (SettingsCpp.shortcutCount > 0) { - var shortcuts = SettingsCpp.shortcuts; - shortcuts.forEach(shortcut => { - model.push({ - "icon": shortcut.icon, - "selectedIcon": shortcut.icon, - "label": shortcut.name, - "colored": true, - "link": shortcut.link - }); - }); - } - initButtons(); - currentIndex = SettingsCpp.getLastActiveTabIndex(); - tabbar.updateVisibleCount() - if (currentIndex === -1 || currentIndex >= tabbar.visibleCount) - currentIndex = 0; - } - } - ColumnLayout { - spacing: 0 + /** + * Focus the page when user select the page with keyboard. + * Do not add this behavior on the arrows + */ + onEnterPressed: { + focusPageOnNextLoad = true; + } + onSpacePressed: { + focusPageOnNextLoad = true; + } - RowLayout { - id: topRow - Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) - Layout.leftMargin: Utils.getSizeWithScreenRatio(45) - Layout.rightMargin: Utils.getSizeWithScreenRatio(41) - spacing: Utils.getSizeWithScreenRatio(25) - SearchBar { - id: magicSearchBar - Layout.fillWidth: true - //: "Rechercher un contact, appeler %1" - placeholderText: qsTr("searchbar_placeholder_text").arg(SettingsCpp.disableChatFeature ? "…" : - //: "ou envoyer un message …" - qsTr("searchbar_placeholder_text_chat_feature_enabled")) - focusedBorderColor: DefaultStyle.main1_500_main - numericPadButton.visible: text.length === 0 - numericPadButton.checkable: false - handleNumericPadPopupButtonsPressed: false + Component.onCompleted: { + if (SettingsCpp.shortcutCount > 0) { + var shortcuts = SettingsCpp.shortcuts; + shortcuts.forEach(shortcut => { + model.push({ + "icon": shortcut.icon, + "selectedIcon": shortcut.icon, + "label": shortcut.name, + "colored": true, + "link": shortcut.link + }); + }); + } + initButtons(); + currentIndex = SettingsCpp.getLastActiveTabIndex(); + tabbar.updateVisibleCount(); + if (currentIndex === -1 || currentIndex >= tabbar.visibleCount) + currentIndex = 0; + } + } + ColumnLayout { + spacing: 0 - onOpenNumericPadRequested: mainItem.goToNewCall() + RowLayout { + id: topRow + Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) + Layout.leftMargin: Utils.getSizeWithScreenRatio(45) + Layout.rightMargin: Utils.getSizeWithScreenRatio(41) + spacing: Utils.getSizeWithScreenRatio(25) + SearchBar { + id: magicSearchBar + Layout.fillWidth: true + //: "Rechercher un contact, appeler %1" + placeholderText: qsTr("searchbar_placeholder_text").arg(SettingsCpp.disableChatFeature ? "…" : + //: "ou envoyer un message …" + qsTr("searchbar_placeholder_text_chat_feature_enabled")) + focusedBorderColor: DefaultStyle.main1_500_main + numericPadButton.visible: text.length === 0 + numericPadButton.checkable: false + handleNumericPadPopupButtonsPressed: false - Connections { - target: mainItem - function onCallCreated() { - magicSearchBar.focus = false; - magicSearchBar.clearText(); - } - } + onOpenNumericPadRequested: mainItem.goToNewCall() - onTextChanged: { - if (text.length != 0) - listPopup.open(); - else - listPopup.close(); - } - KeyNavigation.down: contactList //contactLoader.item?.count > 0 || !contactLoader.item?.footerItem? contactLoader.item : contactLoader.item?.footerItem - KeyNavigation.up: contactList //contactLoader.item?.footerItem ? contactLoader.item?.footerItem : contactLoader.item - Keys.onPressed: (event) => { - event.accepted = false - var firstContact = contactList.getFirstContact() - if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return && firstContact.searchResultItem) { - console.log("Enter pressed from magic search bar, calling", firstContact.searchResultItem.core.defaultAddress) - mainWindow.startCallWithContact(firstContact.searchResultItem, false) - } - } - Popup { - id: listPopup - width: magicSearchBar.width - property real maxHeight: Utils.getSizeWithScreenRatio(400) - property bool displayScrollbar: contactList.height > maxHeight - height: Math.min(contactList.contentHeight, maxHeight) + topPadding + bottomPadding - y: magicSearchBar.height - // closePolicy: Popup.CloseOnEscape - topPadding: Utils.getSizeWithScreenRatio(20) - bottomPadding: Utils.getSizeWithScreenRatio(contactList.haveContacts ? 20 : 10) - rightPadding: Utils.getSizeWithScreenRatio(8) - leftPadding: Utils.getSizeWithScreenRatio(20) - visible: magicSearchBar.text.length != 0 + Connections { + target: mainItem + function onCallCreated() { + magicSearchBar.focus = false; + magicSearchBar.clearText(); + } + } - background: Item { - anchors.fill: parent - Rectangle { - id: popupBg - radius: Utils.getSizeWithScreenRatio(16) - color: DefaultStyle.grey_0 - anchors.fill: parent - border.color: DefaultStyle.main1_500_main - border.width: contactList.activeFocus ? 2 : 0 - } - MultiEffect { - source: popupBg - anchors.fill: popupBg - shadowEnabled: true - shadowBlur: 0.1 - shadowColor: DefaultStyle.grey_1000 - shadowOpacity: 0.1 - } - } + onTextChanged: { + if (text.length != 0) + listPopup.open(); + else + listPopup.close(); + } + KeyNavigation.down: + contactList //contactLoader.item?.count > 0 || !contactLoader.item?.footerItem? contactLoader.item : contactLoader.item?.footerItem + KeyNavigation.up: + contactList //contactLoader.item?.footerItem ? contactLoader.item?.footerItem : contactLoader.item + Keys.onPressed: event => { + event.accepted = false; + var firstContact = contactList.getFirstContact(); + if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return && firstContact.searchResultItem) { + console.log("Enter pressed from magic search bar, calling", + firstContact.searchResultItem.core.defaultAddress); + mainWindow.startCallWithContact(firstContact.searchResultItem, false); + } + } + Popup { + id: listPopup + width: magicSearchBar.width + property real maxHeight: Utils.getSizeWithScreenRatio(400) + property bool displayScrollbar: contactList.height > maxHeight + height: Math.min(contactList.contentHeight, maxHeight) + topPadding + bottomPadding + y: magicSearchBar.height + // closePolicy: Popup.CloseOnEscape + topPadding: Utils.getSizeWithScreenRatio(20) + bottomPadding: Utils.getSizeWithScreenRatio(contactList.haveContacts ? 20 : 10) + rightPadding: Utils.getSizeWithScreenRatio(8) + leftPadding: Utils.getSizeWithScreenRatio(20) + visible: magicSearchBar.text.length != 0 - contentItem: AllContactListView { - id: contactList - width: listPopup.width - listPopup.leftPadding - listPopup.rightPadding - itemsRightMargin: Utils.getSizeWithScreenRatio(5) //(Actions have already 10 of margin) - showInitials: false - showContactMenu: false - showActions: true - showFavorites: false - selectionEnabled: false - searchOnEmpty: false + background: Item { + anchors.fill: parent + Rectangle { + id: popupBg + radius: Utils.getSizeWithScreenRatio(16) + color: DefaultStyle.grey_0 + anchors.fill: parent + border.color: DefaultStyle.main1_500_main + border.width: contactList.activeFocus ? 2 : 0 + } + MultiEffect { + source: popupBg + anchors.fill: popupBg + shadowEnabled: true + shadowBlur: 0.1 + shadowColor: DefaultStyle.grey_1000 + shadowOpacity: 0.1 + } + } - sectionsPixelSize: Typography.p2.pixelSize - sectionsWeight: Typography.p2.weight - sectionsSpacing: Utils.getSizeWithScreenRatio(5) + contentItem: AllContactListView { + id: contactList + width: listPopup.width - listPopup.leftPadding - listPopup.rightPadding + itemsRightMargin: Utils.getSizeWithScreenRatio(5) //(Actions have already 10 of margin) + showInitials: false + showContactMenu: false + showActions: true + showFavorites: false + selectionEnabled: false + searchOnEmpty: false - searchBarText: magicSearchBar.text - } - } - } - RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) - PopupButton { - id: deactivateDndButton - Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) - popup.padding: Utils.getSizeWithScreenRatio(14) - //: "Do not disturb" - popUpTitle: qsTr("do_not_disturb_accessible_name") - visible: SettingsCpp.dnd - contentItem: EffectImage { - imageSource: AppIcons.bellDnd - width: Utils.getSizeWithScreenRatio(32) - height: Utils.getSizeWithScreenRatio(32) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) - fillMode: Image.PreserveAspectFit - colorizationColor: DefaultStyle.main1_500_main - } - popup.contentItem: ColumnLayout { - IconLabelButton { - Layout.fillWidth: true - focus: visible - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - //: "Désactiver ne pas déranger" - text: qsTr("contact_presence_status_disable_do_not_disturb") - icon.source: AppIcons.bellDnd - onClicked: { - deactivateDndButton.popup.close(); - SettingsCpp.dnd = false; - } - } - } - } - Voicemail { - id: voicemail - Layout.preferredWidth: Utils.getSizeWithScreenRatio(42) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(36) - Repeater { - model: accountProxy - delegate: Item { - Connections { - target: modelData ? modelData.core : null - function onShowMwiChanged() { - voicemail.updateCumulatedMwi(); - } - function onVoicemailAddressChanged() { - voicemail.updateCumulatedMwi(); - } - } - } - } + sectionsPixelSize: Typography.p2.pixelSize + sectionsWeight: Typography.p2.weight + sectionsSpacing: Utils.getSizeWithScreenRatio(5) - function updateCumulatedMwi() { - var count = 0; - var showMwi = false; - var supportsVoiceMail = false; - for (var i = 0; i < accountProxy.count; i++) { - var core = accountProxy.getAt(i).core; - count += core.voicemailCount; - showMwi |= core.showMwi; - supportsVoiceMail |= core.voicemailAddress.length > 0; - } - voicemail.showMwi = showMwi; - voicemail.voicemailCount = count; - voicemail.visible = showMwi || supportsVoiceMail; - } + searchBarText: magicSearchBar.text + } + } + } + RowLayout { + spacing: Utils.getSizeWithScreenRatio(10) + PopupButton { + id: deactivateDndButton + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) + popup.padding: Utils.getSizeWithScreenRatio(14) + //: "Do not disturb" + popUpTitle: qsTr("do_not_disturb_accessible_name") + visible: SettingsCpp.dnd + contentItem: EffectImage { + imageSource: AppIcons.bellDnd + width: Utils.getSizeWithScreenRatio(32) + height: Utils.getSizeWithScreenRatio(32) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(32) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(32) + fillMode: Image.PreserveAspectFit + colorizationColor: DefaultStyle.main1_500_main + } + popup.contentItem: ColumnLayout { + IconLabelButton { + Layout.fillWidth: true + focus: visible + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + //: "Désactiver ne pas déranger" + text: qsTr("contact_presence_status_disable_do_not_disturb") + icon.source: AppIcons.bellDnd + onClicked: { + deactivateDndButton.popup.close(); + SettingsCpp.dnd = false; + } + } + } + } + Voicemail { + id: voicemail + Layout.preferredWidth: Utils.getSizeWithScreenRatio(42) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(36) + Repeater { + model: accountProxy + delegate: Item { + Connections { + target: modelData ? modelData.core : null + function onShowMwiChanged() { + voicemail.updateCumulatedMwi(); + } + function onVoicemailAddressChanged() { + voicemail.updateCumulatedMwi(); + } + } + } + } - Component.onCompleted: { - updateCumulatedMwi(); - } + function updateCumulatedMwi() { + var count = 0; + var showMwi = false; + var supportsVoiceMail = false; + for (var i = 0; i < accountProxy.count; i++) { + var core = accountProxy.getAt(i).core; + count += core.voicemailCount; + showMwi |= core.showMwi; + supportsVoiceMail |= core.voicemailAddress.length > 0; + } + voicemail.showMwi = showMwi; + voicemail.voicemailCount = count; + voicemail.visible = showMwi || supportsVoiceMail; + } - onClicked: { - if (accountProxy.count > 1) { - avatarButton.popup.open(); - } else { - if (accountProxy.defaultAccount.core.voicemailAddress.length > 0) - UtilsCpp.createCall(accountProxy.defaultAccount.core.voicemailAddress); - else - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: "L'URI de messagerie vocale n'est pas définie." - qsTr("no_voicemail_uri_error_message"), false); - } - } - } - PopupButton { - id: avatarButton - Layout.preferredWidth: Utils.getSizeWithScreenRatio(54) - Layout.preferredHeight: width - popup.topPadding: Utils.getSizeWithScreenRatio(23) - popup.bottomPadding: Utils.getSizeWithScreenRatio(23) - popup.leftPadding: Utils.getSizeWithScreenRatio(24) - popup.rightPadding: Utils.getSizeWithScreenRatio(24) - //: "Account list" - popUpTitle: qsTr("account_list_accessible_name") - contentItem: Item { - Avatar { - id: avatar - height: avatarButton.height - width: avatarButton.width - account: accountProxy.defaultAccount - } - Rectangle { - // Black border for keyboard navigation - visible: avatarButton.keyboardFocus - width: avatar.width - height: avatar.height - color: "transparent" - border.color: DefaultStyle.main2_900 - border.width: Utils.getSizeWithScreenRatio(3) - radius: width / 2 - } - } - popup.contentItem: AccountListView { - id: accounts - popupId: avatarButton - onAddAccountRequest: mainItem.addAccountRequest() - onEditAccount: function (account) { - avatarButton.popup.close(); - openAccountSettings(account); - } - getPreviousItem: avatarButton.getPreviousItem - getNextItem: avatarButton.getNextItem - } - } - PopupButton { - id: settingsMenuButton - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) - popup.width: Utils.getSizeWithScreenRatio(271) - popup.padding: Utils.getSizeWithScreenRatio(14) - //: "Application options" - popUpTitle: qsTr("application_options_accessible_name") - popup.contentItem: FocusScope { - id: popupFocus - implicitHeight: settingsButtons.implicitHeight - implicitWidth: settingsButtons.implicitWidth - Keys.onPressed: event => { - if (event.key == Qt.Key_Left || event.key == Qt.Key_Escape) { - settingsMenuButton.popup.close(); - event.accepted = true; - } - } + Component.onCompleted: { + updateCumulatedMwi(); + } - ColumnLayout { - id: settingsButtons - spacing: Utils.getSizeWithScreenRatio(16) - anchors.fill: parent + onClicked: { + if (accountProxy.count > 1) { + avatarButton.popup.open(); + } else { + if (accountProxy.defaultAccount.core.voicemailAddress.length > 0) + UtilsCpp.createCall(accountProxy.defaultAccount.core.voicemailAddress); + else + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "L'URI de messagerie vocale n'est pas définie." + qsTr("no_voicemail_uri_error_message"), false); + } + } + } + PopupButton { + id: avatarButton + Layout.preferredWidth: Utils.getSizeWithScreenRatio(54) + Layout.preferredHeight: width + popup.topPadding: Utils.getSizeWithScreenRatio(23) + popup.bottomPadding: Utils.getSizeWithScreenRatio(23) + popup.leftPadding: Utils.getSizeWithScreenRatio(24) + popup.rightPadding: Utils.getSizeWithScreenRatio(24) + //: "Account list" + popUpTitle: qsTr("account_list_accessible_name") + contentItem: Item { + Avatar { + id: avatar + height: avatarButton.height + width: avatarButton.width + account: accountProxy.defaultAccount + } + Rectangle { + // Black border for keyboard navigation + visible: avatarButton.keyboardFocus + width: avatar.width + height: avatar.height + color: "transparent" + border.color: DefaultStyle.main2_900 + border.width: Utils.getSizeWithScreenRatio(3) + radius: width / 2 + } + } + popup.contentItem: AccountListView { + id: accounts + popupId: avatarButton + onAddAccountRequest: mainItem.addAccountRequest() + onEditAccount: function (account) { + avatarButton.popup.close(); + openAccountSettings(account); + } + getPreviousItem: avatarButton.getPreviousItem + getNextItem: avatarButton.getNextItem + } + } + PopupButton { + id: settingsMenuButton + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) + popup.width: Utils.getSizeWithScreenRatio(271) + popup.padding: Utils.getSizeWithScreenRatio(14) + //: "Application options" + popUpTitle: qsTr("application_options_accessible_name") + popup.contentItem: FocusScope { + id: popupFocus + implicitHeight: settingsButtons.implicitHeight + implicitWidth: settingsButtons.implicitWidth + Keys.onPressed: event => { + if (event.key == Qt.Key_Left || event.key == Qt.Key_Escape) { + settingsMenuButton.popup.close(); + event.accepted = true; + } + } - IconLabelButton { - id: accountButton - Layout.fillWidth: true - visible: !SettingsCpp.hideAccountSettings - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) + ColumnLayout { + id: settingsButtons + spacing: Utils.getSizeWithScreenRatio(16) + anchors.fill: parent - //: Mon compte - text: qsTr("drawer_menu_manage_account") - icon.source: AppIcons.manageProfile - onClicked: openAccountSettings(accountProxy.defaultAccount ? accountProxy.defaultAccount : accountProxy.firstAccount()) - KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(0) : null - KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(0) : null - } - IconLabelButton { - id: dndButton - Layout.fillWidth: true - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - text: SettingsCpp.dnd ? qsTr("contact_presence_status_disable_do_not_disturb") : - //: "Activer ne pas déranger" - qsTr("contact_presence_status_enable_do_not_disturb") - icon.source: AppIcons.bellDnd - onClicked: { - settingsMenuButton.popup.close(); - SettingsCpp.dnd = !SettingsCpp.dnd; - } - KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(1) : null - KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(1) : null - } - IconLabelButton { - id: settingsButton - Layout.fillWidth: true - visible: !SettingsCpp.hideSettings - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - text: qsTr("settings_title") - icon.source: AppIcons.settings - onClicked: { - var page = settingsPageComponent.createObject(parent); - openContextualMenuComponent(page) - } - KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(2) : null - KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(2) : null - } - IconLabelButton { - id: recordsButton - Layout.fillWidth: true - visible: false// !SettingsCpp.disableCallRecordings - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - //: "Enregistrements" - text: qsTr("recordings_title") - icon.source: AppIcons.micro - KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(3) : null - KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(3) : null - } - IconLabelButton { - id: helpButton - Layout.fillWidth: true - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - //: "Aide" - text: qsTr("help_title") - icon.source: AppIcons.question - onClicked: { - var page = helpPageComponent.createObject(parent); - openContextualMenuComponent(page) - } - KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(4) : null - KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(4) : null - } - IconLabelButton { - id: quitButton - Layout.fillWidth: true - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - //: "Quitter l'application" - text: qsTr("help_quit_title") - icon.source: AppIcons.power - onClicked: { - settingsMenuButton.popup.close(); - //: "Quitter %1 ?" - UtilsCpp.getMainWindow().showConfirmationLambdaPopup("", qsTr("quit_app_question").arg(applicationName), "", function (confirmed) { - if (confirmed) { - console.info("Exiting App from Top Menu"); - Qt.quit(); - } - }); - } - KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(5) : null - KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(5) : null - } - Rectangle { - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) - visible: addAccountButton.visible - color: DefaultStyle.main2_400 - } - IconLabelButton { - id: addAccountButton - Layout.fillWidth: true - visible: SettingsCpp.maxAccount == 0 || SettingsCpp.maxAccount > accountProxy.count - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - //: "Ajouter un compte" - text: qsTr("drawer_menu_add_account") - icon.source: AppIcons.plusCircle - onClicked: mainItem.addAccountRequest() - KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(7) : null - KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(7) : null - } - } - } + IconLabelButton { + id: accountButton + Layout.fillWidth: true + visible: !SettingsCpp.hideAccountSettings + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) - MouseArea { - z: parent.z + 1 - anchors.fill: parent - acceptedButtons: Qt.RightButton - onPressAndHold: (mouse) => { - debugPopup.open() - } - PopupButton { - id: debugPopup - visible: false - popup.contentItem: Button { - text: "debug: force crash" - onClicked: UtilsCpp.forceCrash() - } - } - } - } - } - } - Component { - id: mainStackLayoutComponent - StackLayout { - id: mainStackLayout - objectName: "mainStackLayout" - property int _currentIndex: tabbar.currentIndex - currentIndex: -1 - onActiveFocusChanged: if (activeFocus && currentIndex >= 0) - children[currentIndex].forceActiveFocus() - on_CurrentIndexChanged: { - if (count > 0) { - if (_currentIndex >= count && tabbar.model[_currentIndex].link) { - Qt.openUrlExternally(tabbar.model[_currentIndex].link); - } else if (_currentIndex >= 0) { - currentIndex = _currentIndex; - SettingsCpp.setLastActiveTabIndex(currentIndex); - } - } - } - Loader { - active: mainStackLayout.currentIndex === 0 - sourceComponent: CallPage { - id: callPage - Connections { - target: mainItem - function onOpenNewCallRequest() { - callPage.goToNewCall(); - } - function onCallCreated() { - callPage.goToCallHistory(); - } - function onOpenCallHistory() { - callPage.goToCallHistory(); - } - function onOpenNumPadRequest() { - callPage.openNumPadRequest(); - } - } - onCreateContactRequested: (name, address) => { - mainItem.createContact(name, address); - } - Component.onCompleted: { - magicSearchBar.numericPadPopup = callPage.numericPadPopup; - } - onGoToCallForwardSettings: { - var page = settingsPageComponent.createObject(parent, { - defaultIndex: 1 - }); - openContextualMenuComponent(page); - } - } - onLoaded: { - if(focusPageOnNextLoad) item.forceActiveFocus(Qt.TabFocusReason) - focusPageOnNextLoad = false - } - } - Loader { - active: mainStackLayout.currentIndex === 1 - sourceComponent: ContactPage { - id: contactPage - Connections { - target: mainItem - function onCreateContactRequested(name, address) { - contactPage.createContact(name, address); - } - function onDisplayContactRequested(contactAddress) { - contactPage.initialFriendToDisplay = contactAddress; - } - } - } - onLoaded: { - if(focusPageOnNextLoad) item.forceActiveFocus(Qt.TabFocusReason) - focusPageOnNextLoad = false - } - } - Loader { - active: mainStackLayout.currentIndex === 2 - sourceComponent: ChatPage { - id: chatPage - Connections { - target: mainItem - function onDisplayChatRequested(contactAddress) { - console.log("display chat requested, open with address", contactAddress); - chatPage.remoteAddress = ""; - chatPage.remoteAddress = contactAddress; - } - function onOpenChatRequested(chat) { - console.log("open chat requested, open", chat.core.title); - chatPage.openChatRequested(chat); - } - } - } - onLoaded: { - if(focusPageOnNextLoad) item.forceActiveFocus(Qt.TabFocusReason) - focusPageOnNextLoad = false - } - } + //: Mon compte + text: qsTr("drawer_menu_manage_account") + icon.source: AppIcons.manageProfile + onClicked: openAccountSettings(accountProxy.defaultAccount ? accountProxy.defaultAccount : + accountProxy.firstAccount()) + KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(0) : null + KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(0) : null + } + IconLabelButton { + id: dndButton + Layout.fillWidth: true + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + text: SettingsCpp.dnd ? qsTr("contact_presence_status_disable_do_not_disturb") : + //: "Activer ne pas déranger" + qsTr("contact_presence_status_enable_do_not_disturb") + icon.source: AppIcons.bellDnd + onClicked: { + settingsMenuButton.popup.close(); + SettingsCpp.dnd = !SettingsCpp.dnd; + } + KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(1) : null + KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(1) : null + } + IconLabelButton { + id: settingsButton + Layout.fillWidth: true + visible: !SettingsCpp.hideSettings + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + text: qsTr("settings_title") + icon.source: AppIcons.settings + onClicked: { + var page = settingsPageComponent.createObject(parent); + openContextualMenuComponent(page); + } + KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(2) : null + KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(2) : null + } + IconLabelButton { + id: recordsButton + Layout.fillWidth: true + visible: false// !SettingsCpp.disableCallRecordings + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + //: "Enregistrements" + text: qsTr("recordings_title") + icon.source: AppIcons.micro + KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(3) : null + KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(3) : null + } + IconLabelButton { + id: helpButton + Layout.fillWidth: true + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + //: "Aide" + text: qsTr("help_title") + icon.source: AppIcons.question + onClicked: { + var page = helpPageComponent.createObject(parent); + openContextualMenuComponent(page); + } + KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(4) : null + KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(4) : null + } + IconLabelButton { + id: quitButton + Layout.fillWidth: true + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + //: "Quitter l'application" + text: qsTr("help_quit_title") + icon.source: AppIcons.power + onClicked: { + settingsMenuButton.popup.close(); + //: "Quitter %1 ?" + UtilsCpp.getMainWindow().showConfirmationLambdaPopup("", qsTr("quit_app_question").arg(applicationName), "", function ( + confirmed) { + if (confirmed) { + console.info("Exiting App from Top Menu"); + Qt.quit(); + } + }); + } + KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(5) : null + KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(5) : null + } + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) + visible: addAccountButton.visible + color: DefaultStyle.main2_400 + } + IconLabelButton { + id: addAccountButton + Layout.fillWidth: true + visible: SettingsCpp.maxAccount == 0 || SettingsCpp.maxAccount > accountProxy.count + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + //: "Ajouter un compte" + text: qsTr("drawer_menu_add_account") + icon.source: AppIcons.plusCircle + onClicked: mainItem.addAccountRequest() + KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem(7) : null + KeyNavigation.down: visibleChildren.length != 0 ? settingsMenuButton.getNextItem(7) : null + } + } + } - Loader { - active: mainStackLayout.currentIndex === 3 - sourceComponent: Component { - id: meetingComp - MeetingPage { - id: meetingPage - Connections { - target: mainItem - function onScheduleMeetingRequested(subject, addresses) { - meetingPage.createPreFilledMeeting(subject, addresses); - } - } - } - } - onLoaded: { - if(focusPageOnNextLoad) item.forceActiveFocus(Qt.TabFocusReason) - focusPageOnNextLoad = false - } - } + MouseArea { + z: parent.z + 1 + anchors.fill: parent + acceptedButtons: Qt.RightButton + onPressAndHold: mouse => { + debugPopup.open(); + } + PopupButton { + id: debugPopup + visible: false + popup.contentItem: Button { + text: "debug: force crash" + onClicked: UtilsCpp.forceCrash() + } + } + } + } + } + } + Component { + id: mainStackLayoutComponent + StackLayout { + id: mainStackLayout + objectName: "mainStackLayout" + property int _currentIndex: tabbar.currentIndex + currentIndex: -1 + onActiveFocusChanged: if (activeFocus && currentIndex >= 0) + children[currentIndex].forceActiveFocus() + on_CurrentIndexChanged: { + if (count > 0) { + if (_currentIndex >= count && tabbar.model[_currentIndex].link) { + Qt.openUrlExternally(tabbar.model[_currentIndex].link); + } else if (_currentIndex >= 0) { + currentIndex = _currentIndex; + SettingsCpp.setLastActiveTabIndex(currentIndex); + } + } + } + Loader { + active: mainStackLayout.currentIndex === 0 + sourceComponent: CallPage { + id: callPage + Connections { + target: mainItem + function onOpenNewCallRequest() { + callPage.goToNewCall(); + } + function onCallCreated() { + callPage.goToCallHistory(); + } + function onOpenCallHistory() { + callPage.goToCallHistory(); + } + function onOpenNumPadRequest() { + callPage.openNumPadRequest(); + } + } + onCreateContactRequested: (name, address) => { + mainItem.createContact(name, address); + } + Component.onCompleted: { + magicSearchBar.numericPadPopup = callPage.numericPadPopup; + } + onGoToCallForwardSettings: { + var page = settingsPageComponent.createObject(parent, { + defaultIndex: 1 + }); + openContextualMenuComponent(page); + } + } + onLoaded: { + if (focusPageOnNextLoad) + item.forceActiveFocus(Qt.TabFocusReason); + focusPageOnNextLoad = false; + } + } + Loader { + active: mainStackLayout.currentIndex === 1 + sourceComponent: ContactPage { + id: contactPage + Connections { + target: mainItem + function onCreateContactRequested(name, address) { + contactPage.createContact(name, address); + } + function onDisplayContactRequested(contactAddress) { + contactPage.initialFriendToDisplay = contactAddress; + } + } + } + onLoaded: { + if (focusPageOnNextLoad) + item.forceActiveFocus(Qt.TabFocusReason); + focusPageOnNextLoad = false; + } + } + Loader { + active: mainStackLayout.currentIndex === 2 + sourceComponent: ChatPage { + id: chatPage + Connections { + target: mainItem + function onDisplayChatRequested(contactAddress) { + console.log("display chat requested, open with address", contactAddress); + chatPage.remoteAddress = ""; + chatPage.remoteAddress = contactAddress; + } + function onOpenChatRequested(chat) { + console.log("open chat requested, open", chat.core.title); + chatPage.openChatRequested(chat); + } + } + } + onLoaded: { + if (focusPageOnNextLoad) + item.forceActiveFocus(Qt.TabFocusReason); + focusPageOnNextLoad = false; + } + } - } - } - Component { - id: accountSettingsPageComponent - AccountSettingsPage { - onGoBack: closeContextualMenuComponent() - onAccountRemoved: { - closeContextualMenuComponent(); - mainItem.accountRemoved(); - } - } - } - Component { - id: settingsPageComponent - SettingsPage { - onGoBack: closeContextualMenuComponent() - } - } - Component { - id: helpPageComponent - HelpPage { - onGoBack: closeContextualMenuComponent() - } - } - Control.StackView { - id: mainStackView - property Transition noTransition: Transition { - PropertyAnimation { - property: "opacity" - from: 1 - to: 1 - duration: 0 - } - } - pushEnter: noTransition - pushExit: noTransition - popEnter: noTransition - popExit: noTransition - Layout.topMargin: Utils.getSizeWithScreenRatio(24) - Layout.fillWidth: true - Layout.fillHeight: true - initialItem: mainStackLayoutComponent - } - } - } - } + Loader { + active: mainStackLayout.currentIndex === 3 + sourceComponent: Component { + id: meetingComp + MeetingPage { + id: meetingPage + Connections { + target: mainItem + function onScheduleMeetingRequested(subject, addresses) { + meetingPage.createPreFilledMeeting(subject, addresses); + } + } + } + } + onLoaded: { + if (focusPageOnNextLoad) + item.forceActiveFocus(Qt.TabFocusReason); + focusPageOnNextLoad = false; + } + } + } + } + Component { + id: accountSettingsPageComponent + AccountSettingsPage { + onGoBack: closeContextualMenuComponent() + onAccountRemoved: { + closeContextualMenuComponent(); + mainItem.accountRemoved(); + } + } + } + Component { + id: settingsPageComponent + SettingsPage { + onGoBack: closeContextualMenuComponent() + } + } + Component { + id: helpPageComponent + HelpPage { + onGoBack: closeContextualMenuComponent() + } + } + Control.StackView { + id: mainStackView + property Transition noTransition: Transition { + PropertyAnimation { + property: "opacity" + from: 1 + to: 1 + duration: 0 + } + } + pushEnter: noTransition + pushExit: noTransition + popEnter: noTransition + popExit: noTransition + Layout.topMargin: Utils.getSizeWithScreenRatio(24) + Layout.fillWidth: true + Layout.fillHeight: true + initialItem: mainStackLayoutComponent + } + } + } + } } diff --git a/Linphone/view/Page/Layout/Settings/AbstractSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/AbstractSettingsLayout.qml index 1e175a822..1dbd4d951 100644 --- a/Linphone/view/Page/Layout/Settings/AbstractSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AbstractSettingsLayout.qml @@ -1,10 +1,9 @@ - import QtQuick import QtQuick.Layouts import QtQuick.Controls.Basic as Control import Linphone -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle Rectangle { id: mainItem @@ -16,30 +15,30 @@ Rectangle { property var model color: DefaultStyle.grey_0 property var container - // property real contentHeight: contentListView.contentHeight - property real minimumWidthForSwitchintToRowLayout: Utils.getSizeWithScreenRatio(981) + // property real contentHeight: contentListView.contentHeight + property real minimumWidthForSwitchintToRowLayout: Utils.getSizeWithScreenRatio(981) property var useVerticalLayout property bool saveButtonVisible: true - signal save() - signal undo() + signal save + signal undo function setResponsivityFlags() { - var newValue = width < minimumWidthForSwitchintToRowLayout + var newValue = width < minimumWidthForSwitchintToRowLayout; if (useVerticalLayout != newValue) { - useVerticalLayout = newValue + useVerticalLayout = newValue; } } onWidthChanged: { - setResponsivityFlags() - } + setResponsivityFlags(); + } Component.onCompleted: { - setResponsivityFlags() + setResponsivityFlags(); } Control.Control { id: header anchors.left: parent.left anchors.right: parent.right - leftPadding: Utils.getSizeWithScreenRatio(45) - rightPadding: Utils.getSizeWithScreenRatio(45) + leftPadding: Utils.getSizeWithScreenRatio(45) + rightPadding: Utils.getSizeWithScreenRatio(45) z: 1 background: Rectangle { anchors.fill: parent @@ -48,20 +47,20 @@ Rectangle { contentItem: ColumnLayout { RowLayout { Layout.fillWidth: true - Layout.topMargin: Utils.getSizeWithScreenRatio(20) - spacing: Utils.getSizeWithScreenRatio(5) - Layout.bottomMargin: Utils.getSizeWithScreenRatio(10) + Layout.topMargin: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(5) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(10) Button { id: backButton - Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) icon.source: AppIcons.leftArrow focus: true visible: mainItem.container.depth > 1 - Layout.rightMargin: Utils.getSizeWithScreenRatio(41) + Layout.rightMargin: Utils.getSizeWithScreenRatio(41) style: ButtonStyle.noBackground onClicked: { - mainItem.container.pop() + mainItem.container.pop(); } //: Return Accessible.name: qsTr("return_accessible_name") @@ -77,25 +76,25 @@ Rectangle { Loader { Layout.alignment: Qt.AlignRight sourceComponent: mainItem.topbarOptionalComponent - Layout.rightMargin: Utils.getSizeWithScreenRatio(34) + Layout.rightMargin: Utils.getSizeWithScreenRatio(34) } MediumButton { id: saveButton style: ButtonStyle.main - //: "Enregistrer" - text: qsTr("save") - Layout.rightMargin: Utils.getSizeWithScreenRatio(6) + //: "Enregistrer" + text: qsTr("save") + Layout.rightMargin: Utils.getSizeWithScreenRatio(6) visible: mainItem.saveButtonVisible //: Save %1 settings Accessible.name: qsTr("save_settings_accessible_name").arg(mainItem.titleText) onClicked: { - mainItem.save() + mainItem.save(); } } } Rectangle { Layout.fillWidth: true - height: Utils.getSizeWithScreenRatio(1) + height: Utils.getSizeWithScreenRatio(1) color: DefaultStyle.main2_500_main } } @@ -106,7 +105,7 @@ Rectangle { anchors.right: parent.right anchors.bottom: parent.bottom anchors.top: header.bottom - anchors.topMargin: Utils.getSizeWithScreenRatio(16) + anchors.topMargin: Utils.getSizeWithScreenRatio(16) contentHeight: contentListView.contentHeight Control.ScrollBar.vertical: ScrollBar { active: contentListView.contentHeight > scrollView.height @@ -116,7 +115,7 @@ Rectangle { anchors.top: parent.top anchors.bottom: parent.bottom anchors.right: parent.right - anchors.rightMargin: Utils.getSizeWithScreenRatio(15) + anchors.rightMargin: Utils.getSizeWithScreenRatio(15) } Control.ScrollBar.horizontal: ScrollBar { active: false @@ -131,8 +130,9 @@ Rectangle { height: contentHeight spacing: Utils.getSizeWithScreenRatio(10) delegate: ColumnLayout { - visible: modelData.visible != undefined ? modelData.visible: true - Component.onCompleted: if (!visible) height = 0 + visible: modelData.visible != undefined ? modelData.visible : true + Component.onCompleted: if (!visible) + height = 0 spacing: Utils.getSizeWithScreenRatio(16) width: contentListView.width Rectangle { @@ -186,22 +186,22 @@ Rectangle { sourceComponent: modelData.contentComponent } Item { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(modelData.customRightMargin > 0 ? modelData.customRightMargin : 17) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(modelData.customRightMargin > 0 + ? modelData.customRightMargin : 17) } } } } } - + Connections { target: FocusNavigator function onFocusChanged(item, keyboardFocus) { - if(Utils.isDescendant(item,scrollView) && keyboardFocus){ - Utils.ensureVisibleY(item, scrollView) + if (Utils.isDescendant(item, scrollView) && keyboardFocus) { + Utils.ensureVisibleY(item, scrollView); } } } } } - diff --git a/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml b/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml index 7e36fddd0..723521a59 100644 --- a/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml @@ -6,7 +6,7 @@ import QtQuick.Dialogs import Linphone import SettingsCpp import UtilsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 { @@ -16,18 +16,18 @@ AbstractSettingsLayout { width: parent?.width contentModel: [ { - //: "Détails" - title: qsTr("manage_account_details_title"), - //: Éditer les informations de votre compte. - subTitle: qsTr("manage_account_details_subtitle"), + //: "Détails" + title: qsTr("manage_account_details_title"), + //: Éditer les informations de votre compte. + subTitle: qsTr("manage_account_details_subtitle"), contentComponent: accountParametersComponent }, { - visible: SettingsCpp.showAccountDevices, - //: "Vos appareils" - title: qsTr("manage_account_devices_title"), - //: "La liste des appareils connectés à votre compte. Vous pouvez retirer les appareils que vous n’utilisez plus." - subTitle: qsTr("manage_account_devices_subtitle"), + visible: SettingsCpp.showAccountDevices, + //: "Vos appareils" + title: qsTr("manage_account_devices_title"), + //: "La liste des appareils connectés à votre compte. Vous pouvez retirer les appareils que vous n’utilisez plus." + subTitle: qsTr("manage_account_devices_subtitle"), contentComponent: accountDevicesComponent } ] @@ -41,23 +41,23 @@ AbstractSettingsLayout { id: accountParametersComponent ColumnLayout { Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) Avatar { id: avatar account: model displayPresence: false - Layout.preferredWidth: Utils.getSizeWithScreenRatio(100) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(100) + 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: Utils.getSizeWithScreenRatio(17) - icon.height: Utils.getSizeWithScreenRatio(17) - //: "Ajouter une image" - text: qsTr("manage_account_add_picture") + icon.width: Utils.getSizeWithScreenRatio(17) + icon.height: Utils.getSizeWithScreenRatio(17) + //: "Ajouter une image" + text: qsTr("manage_account_add_picture") style: ButtonStyle.noBackground onClicked: fileDialog.open() Layout.alignment: Qt.AlignHCenter @@ -65,24 +65,24 @@ AbstractSettingsLayout { RowLayout { visible: model.core.pictureUri.length > 0 Layout.alignment: Qt.AlignHCenter - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) IconLabelButton { Layout.preferredWidth: width icon.source: AppIcons.pencil - icon.width: Utils.getSizeWithScreenRatio(17) - icon.height: Utils.getSizeWithScreenRatio(17) - //: "Modifier l'image" - text: qsTr("manage_account_edit_picture") + icon.width: Utils.getSizeWithScreenRatio(17) + icon.height: Utils.getSizeWithScreenRatio(17) + //: "Modifier l'image" + text: qsTr("manage_account_edit_picture") style: ButtonStyle.noBackground onClicked: fileDialog.open() } IconLabelButton { Layout.preferredWidth: width icon.source: AppIcons.trashCan - icon.width: Utils.getSizeWithScreenRatio(17) - icon.height: Utils.getSizeWithScreenRatio(17) - //: "Supprimer l'image" - text: qsTr("manage_account_remove_picture") + icon.width: Utils.getSizeWithScreenRatio(17) + icon.height: Utils.getSizeWithScreenRatio(17) + //: "Supprimer l'image" + text: qsTr("manage_account_remove_picture") style: ButtonStyle.noBackground onClicked: model.core.pictureUri = "" } @@ -91,20 +91,20 @@ AbstractSettingsLayout { id: fileDialog currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0] onAccepted: { - var avatarPath = UtilsCpp.createAvatar( selectedFile ) - if(avatarPath){ - model.core.pictureUri = avatarPath - avatar.model = model + var avatarPath = UtilsCpp.createAvatar(selectedFile); + if (avatarPath) { + model.core.pictureUri = avatarPath; + avatar.model = model; } } } RowLayout { Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) Text { Layout.alignment: Qt.AlignLeft //: SIP address - text: "%1 :".arg(qsTr("sip_address")) + text: "%1 :".arg(qsTr("sip_address")) color: DefaultStyle.main2_600 font: Typography.p2l } @@ -125,28 +125,28 @@ AbstractSettingsLayout { if (UtilsCpp.copyToClipboard(model.core.identityAddress)) { //: Copied UtilsCpp.showInformationPopup(qsTr("copied"), - //: Your SIP address has been copied in the clipboard - qsTr("account_settings_sip_address_copied_message")) + //: Your SIP address has been copied in the clipboard + qsTr("account_settings_sip_address_copied_message")); } else { UtilsCpp.showInformationPopup(qsTr("error"), - //: Error copying your SIP address - qsTr("account_settings_sip_address_copied_error_message"), false) + //: Error copying your SIP address + qsTr("account_settings_sip_address_copied_error_message"), false); } } } } ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) Layout.alignment: Qt.AlignLeft Text { - //: "Nom d'affichage - text: qsTr("sip_address_display_name") + //: "Nom d'affichage + text: qsTr("sip_address_display_name") color: DefaultStyle.main2_600 font: Typography.p2l } Text { - //: "Le nom qui sera affiché à vos correspondants lors de vos échanges." - text: qsTr("sip_address_display_name_explaination") + //: "Le nom qui sera affiché à vos correspondants lors de vos échanges." + text: qsTr("sip_address_display_name_explaination") color: DefaultStyle.main2_600 font: Typography.p1 } @@ -154,23 +154,24 @@ AbstractSettingsLayout { TextField { Layout.alignment: Qt.AlignLeft Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) initialText: model.core.displayName backgroundColor: DefaultStyle.grey_100 onEditingFinished: { - if (text.length != 0) model.core.displayName = text + if (text.length != 0) + model.core.displayName = text; } toValidate: true } Text { - //: Indicatif international* - text: qsTr("manage_account_international_prefix") + //: Indicatif international* + text: qsTr("manage_account_international_prefix") color: DefaultStyle.main2_600 font: Typography.p2l } ComboSetting { Layout.fillWidth: true - Layout.topMargin: Utils.getSizeWithScreenRatio(15) + Layout.topMargin: Utils.getSizeWithScreenRatio(15) entries: account.core.dialPlans propertyName: "dialPlan" propertyOwnerGui: account @@ -184,21 +185,21 @@ AbstractSettingsLayout { propertyOwnerGui: account } RowLayout { - id:mainItem - spacing : Utils.getSizeWithScreenRatio(20) + id: mainItem + spacing: Utils.getSizeWithScreenRatio(20) ColumnLayout { - spacing : Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) Text { - //: "Déconnecter mon compte" - text: qsTr("manage_account_delete") + //: "Déconnecter mon compte" + text: qsTr("manage_account_delete") font: Typography.p2l wrapMode: Text.WordWrap color: DefaultStyle.danger_500_main Layout.fillWidth: true } Text { - // "Votre compte sera retiré de ce client linphone, mais vous restez connecté sur vos autres clients - text: qsTr("manage_account_delete_message") + // "Votre compte sera retiré de ce client linphone, mais vous restez connecté sur vos autres clients + text: qsTr("manage_account_delete_message") font: Typography.p1 wrapMode: Text.WordWrap color: DefaultStyle.main2_500_main @@ -211,28 +212,25 @@ AbstractSettingsLayout { BigButton { style: ButtonStyle.noBackgroundRed Layout.alignment: Qt.AlignRight - Layout.rightMargin: Utils.getSizeWithScreenRatio(5) + Layout.rightMargin: Utils.getSizeWithScreenRatio(5) icon.source: AppIcons.trashCan onClicked: { - var mainWin = UtilsCpp.getMainWindow() + var mainWin = UtilsCpp.getMainWindow(); mainWin.showConfirmationLambdaPopup("", - //: "Se déconnecter du compte ?" - qsTr("manage_account_dialog_remove_account_title"), - //: Si vous souhaitez supprimer définitivement votre compte rendez-vous sur : https://sip.linphone.org - qsTr("manage_account_dialog_remove_account_message"), - function (confirmed) { - if (confirmed) { - account.core.removeAccount() - } - } - ) + //: "Se déconnecter du compte ?" + qsTr("manage_account_dialog_remove_account_title"), + //: Si vous souhaitez supprimer définitivement votre compte rendez-vous sur : https://sip.linphone.org + qsTr("manage_account_dialog_remove_account_message"), function (confirmed) { + if (confirmed) { + account.core.removeAccount(); + } + }); } } } } } - // Account devices ////////////////////////// @@ -241,67 +239,68 @@ AbstractSettingsLayout { RoundedPane { Layout.fillWidth: true Layout.fillHeight: true - // 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) + // 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: Utils.getSizeWithScreenRatio(15) + radius: Utils.getSizeWithScreenRatio(15) } contentItem: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(15) - BusyIndicator { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(60) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(60) - Layout.alignment: Qt.AlignHCenter - visible: devices.loading - } + spacing: Utils.getSizeWithScreenRatio(15) + BusyIndicator { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(60) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(60) + Layout.alignment: Qt.AlignHCenter + visible: devices.loading + } Repeater { id: devices - visible: !loading - property bool loading - Component.onCompleted: loading = true + visible: !loading + property bool loading + Component.onCompleted: loading = true model: AccountDeviceProxy { id: accountDeviceProxy account: mainItem.model - onDevicesSet: devices.loading = false; - onRequestError: (errorMessage) => { - devices.loading = false; - //: Erreur - mainWindow.showInformationPopup(qsTr("error"), errorMessage, false) - } + onDevicesSet: devices.loading = false + onRequestError: errorMessage => { + devices.loading = false; + //: Erreur + mainWindow.showInformationPopup(qsTr("error"), errorMessage, false); + } } - Control.Control { + Control.Control { Layout.fillWidth: true - height: Utils.getSizeWithScreenRatio(133) - topPadding: Utils.getSizeWithScreenRatio(26) - bottomPadding: Utils.getSizeWithScreenRatio(26) - rightPadding: Utils.getSizeWithScreenRatio(36) - leftPadding: Utils.getSizeWithScreenRatio(33) + 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: Utils.getSizeWithScreenRatio(10) + radius: Utils.getSizeWithScreenRatio(10) } contentItem: ColumnLayout { width: parent.width - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) RowLayout { - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) EffectImage { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + 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 + imageSource: modelData.core.userAgent.toLowerCase().includes('ios') | modelData.core.userAgent.toLowerCase( + ).includes('android') ? AppIcons.mobile : AppIcons.desktop } Text { text: modelData.core.deviceName @@ -313,56 +312,54 @@ AbstractSettingsLayout { } MediumButton { Layout.alignment: Qt.AlignRight - //: "Supprimer" - text: qsTr("manage_account_device_remove") + //: "Supprimer" + text: qsTr("manage_account_device_remove") icon.source: AppIcons.trashCan - icon.width: Utils.getSizeWithScreenRatio(16) - icon.height: Utils.getSizeWithScreenRatio(16) + icon.width: Utils.getSizeWithScreenRatio(16) + icon.height: Utils.getSizeWithScreenRatio(16) style: ButtonStyle.tertiary onClicked: { - var mainWin = UtilsCpp.getMainWindow() + var mainWin = UtilsCpp.getMainWindow(); mainWin.showConfirmationLambdaPopup("", - //:"Supprimer %1 ?" - qsTr("manage_account_device_remove_confirm_dialog").arg(modelData.core.deviceName), "", - function (confirmed) { - if (confirmed) { - accountDeviceProxy.deleteDevice(modelData) - } - } - ) + //:"Supprimer %1 ?" + qsTr("manage_account_device_remove_confirm_dialog").arg(modelData.core.deviceName), "", function ( + confirmed) { + if (confirmed) { + accountDeviceProxy.deleteDevice(modelData); + } + }); } } } RowLayout { - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) Text { - //: "Dernière connexion:" - text: qsTr("manage_account_device_last_connection") + //: "Dernière connexion:" + text: qsTr("manage_account_device_last_connection") color: DefaultStyle.main2_600 font: Typography.p2 } EffectImage { visible: dateText.lastDate != "" - Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) imageSource: AppIcons.calendarBlank colorizationColor: DefaultStyle.main2_600 fillMode: Image.PreserveAspectFit } Text { id: dateText - property string lastDate: UtilsCpp.formatDate(modelData.core.lastUpdateTimestamp,false) - text: lastDate != "" - ? lastDate - //: "No information" - : qsTr("device_last_updated_time_no_info") + property string lastDate: UtilsCpp.formatDate(modelData.core.lastUpdateTimestamp, false) + text: lastDate != "" ? lastDate : + //: "No information" + qsTr("device_last_updated_time_no_info") color: DefaultStyle.main2_600 font: Typography.p1 } EffectImage { visible: dateText.lastDate != "" - Layout.preferredWidth: Utils.getSizeWithScreenRatio(20) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(20) + 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 21f236af9..4a2bb0fd5 100644 --- a/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml @@ -10,280 +10,285 @@ import ConstantsCpp import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { - id: mainItem - width: parent?.width - property bool registrarUriIsValid - property bool outboundProxyIsValid - contentModel: [{ - "title": qsTr("settings_title"), - "subTitle": "", - "contentComponent": generalParametersComponent - }, { - "title": qsTr("settings_account_title"), - "subTitle": "", - "contentComponent": advancedParametersComponent - }] + id: mainItem + width: parent?.width + property bool registrarUriIsValid + property bool outboundProxyIsValid + contentModel: [ + { + "title": qsTr("settings_title"), + "subTitle": "", + "contentComponent": generalParametersComponent + }, + { + "title": qsTr("settings_account_title"), + "subTitle": "", + "contentComponent": advancedParametersComponent + } + ] - property alias account: mainItem.model + property alias account: mainItem.model - onSave: { - account.core.save() - } - onUndo: account.core.undo() - Connections { - enabled: account - target: account ? account.core : null - function onIsSavedChanged() { - console.log("saved changed", account.core.isSaved) - if (account.core.isSaved) { - UtilsCpp.showInformationPopup(qsTr("information_popup_success_title"), - //: "Modifications sauvegardés" - qsTr("contact_editor_saved_changes_toast"), true, mainWindow) - } - } - function onSetValueFailed(error) { - if (error) { - UtilsCpp.showInformationPopup( - qsTr("information_popup_error_title"), error, false, mainWindow) - } - } - } + onSave: { + account.core.save(); + } + onUndo: account.core.undo() + Connections { + enabled: account + target: account ? account.core : null + function onIsSavedChanged() { + console.log("saved changed", account.core.isSaved); + if (account.core.isSaved) { + UtilsCpp.showInformationPopup(qsTr("information_popup_success_title"), + //: "Modifications sauvegardés" + qsTr("contact_editor_saved_changes_toast"), true, mainWindow); + } + } + function onSetValueFailed(error) { + if (error) { + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), error, false, mainWindow); + } + } + } - // General parameters - ///////////////////// - Component { - id: generalParametersComponent - ColumnLayout { - id: column - Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(20) - DecoratedTextField { - id: mwiServerAddressField - propertyName: "mwiServerAddress" - propertyOwnerGui: account - //: "MWI server address" - title: qsTr("account_settings_mwi_uri_title") - Layout.fillWidth: true - //: Address of the MWI server that sends SIP notifications to display new voicemail indicators - tooltip: qsTr("mwi_server_address_tooltip") - isValid: function (text) { - return text.length == 0 || !text.endsWith(".") - } // work around sdk crash when adress ends with . - toValidate: true + // General parameters + ///////////////////// + Component { + id: generalParametersComponent + ColumnLayout { + id: column + Layout.fillWidth: true + spacing: Utils.getSizeWithScreenRatio(20) + DecoratedTextField { + id: mwiServerAddressField + propertyName: "mwiServerAddress" + propertyOwnerGui: account + //: "MWI server address" + title: qsTr("account_settings_mwi_uri_title") + Layout.fillWidth: true + //: Address of the MWI server that sends SIP notifications to display new voicemail indicators + tooltip: qsTr("mwi_server_address_tooltip") + isValid: function (text) { + return text.length == 0 || !text.endsWith("."); + } // work around sdk crash when adress ends with . + toValidate: true - Connections { - enabled: account - target: account ? account.core : null - function onMwiServerAddressChanged() { - if (mwiServerAddressField.text != mwiServerAddressField.propertyOwnerGui.core[mwiServerAddressField.propertyName]) - mwiServerAddressField.text = mwiServerAddressField.propertyOwnerGui.core[mwiServerAddressField.propertyName] - } - } - } - DecoratedTextField { - id: voicemailAddressField - propertyName: "voicemailAddress" - propertyOwnerGui: account - //: "Voicemail address" - title: qsTr("account_settings_voicemail_uri_title") - //: SIP address dialed when clicking the voicemail button - tooltip: qsTr("voicemail_address_tooltip") - Layout.fillWidth: true - toValidate: true + Connections { + enabled: account + target: account ? account.core : null + function onMwiServerAddressChanged() { + if (mwiServerAddressField.text != mwiServerAddressField.propertyOwnerGui.core[mwiServerAddressField.propertyName]) + mwiServerAddressField.text = mwiServerAddressField.propertyOwnerGui.core[mwiServerAddressField.propertyName]; + } + } + } + DecoratedTextField { + id: voicemailAddressField + propertyName: "voicemailAddress" + propertyOwnerGui: account + //: "Voicemail address" + title: qsTr("account_settings_voicemail_uri_title") + //: SIP address dialed when clicking the voicemail button + tooltip: qsTr("voicemail_address_tooltip") + Layout.fillWidth: true + toValidate: true - Connections { - enabled: account - target: account ? account.core : null - function onVoicemailAddressChanged() { - if (voicemailAddressField.text != voicemailAddressField.propertyOwnerGui.core[voicemailAddressField.propertyName]) - voicemailAddressField.text = voicemailAddressField.propertyOwnerGui.core[voicemailAddressField.propertyName] - } - } - } - } - } + Connections { + enabled: account + target: account ? account.core : null + function onVoicemailAddressChanged() { + if (voicemailAddressField.text != voicemailAddressField.propertyOwnerGui.core[voicemailAddressField.propertyName]) + voicemailAddressField.text = voicemailAddressField.propertyOwnerGui.core[voicemailAddressField.propertyName]; + } + } + } + } + } - // Advanced parameters - ///////////////////// - Component { - id: advancedParametersComponent - ColumnLayout { - Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(20) - DecoratedTextField { - id: registrarUriField - Layout.fillWidth: true - //:"Registrar URI" - title: qsTr("account_settings_registrar_uri_title") - propertyName: "registrarUri" - propertyOwnerGui: account - toValidate: true - Connections { - enabled: account - target: account ? account.core : null - function onRegistrarUriChanged() { - if (registrarUriField.text != registrarUriField.propertyOwnerGui.core[registrarUriField.propertyName]) - registrarUriField.text = registrarUriField.propertyOwnerGui.core[registrarUriField.propertyName] - } - } - } - DecoratedTextField { - id: outboundProxyUriField - Layout.fillWidth: true - //:"Outbound SIP Proxy URI" - title: qsTr("account_settings_sip_proxy_url_title") - propertyName: "outboundProxyUri" - propertyOwnerGui: account - //: "If this field is filled, the outbound proxy will be enabled automatically. Leave it empty to disable it." - tooltip: qsTr("login_proxy_server_url_tooltip") - toValidate: true - Connections { - enabled: account - target: account ? account.core : null - function onOutboundProxyUriChanged() { - if (outboundProxyUriField.text != outboundProxyUriField.propertyOwnerGui.core[outboundProxyUriField.propertyName]) - outboundProxyUriField.text = outboundProxyUriField.propertyOwnerGui.core[outboundProxyUriField.propertyName] - } - } - } - DecoratedTextField { - id: stunServerField - Layout.fillWidth: true - propertyName: "stunServer" - propertyOwnerGui: account - //: "Adresse du serveur STUN" - title: qsTr("account_settings_stun_server_url_title") - toValidate: true - Connections { - enabled: account - target: account ? account.core : null - function onStunServerChanged() { - if (stunServerField.text != stunServerField.propertyOwnerGui.core[stunServerField.propertyName]) - stunServerField.text = stunServerField.propertyOwnerGui.core[stunServerField.propertyName] - } - } - } - SwitchSetting { - id: iceSwitch - //: "Activer ICE" - titleText: qsTr("account_settings_enable_ice_title") - propertyName: "iceEnabled" - propertyOwnerGui: account - Connections { - enabled: account - target: account ? account.core : null - function onIceEnabledChanged() { - if (iceSwitch.checked != iceSwitch.propertyOwnerGui.core[iceSwitch.propertyName]) - iceSwitch.checked = iceSwitch.propertyOwnerGui.core[iceSwitch.propertyName] - } - } - } - SwitchSetting { - id: avpfSwitch - //: "AVPF" - titleText: qsTr("account_settings_avpf_title") - propertyName: "avpfEnabled" - propertyOwnerGui: account - Connections { - enabled: account - target: account ? account.core : null - function onAvpfEnabledChanged() { - if (avpfSwitch.checked != avpfSwitch.propertyOwnerGui.core[avpfSwitch.propertyName]) - avpfSwitch.checked = avpfSwitch.propertyOwnerGui.core[avpfSwitch.propertyName] - } - } - } - SwitchSetting { - id: bundleModeSwitch - //: "Mode bundle" - titleText: qsTr("account_settings_bundle_mode_title") - propertyName: "bundleModeEnabled" - propertyOwnerGui: account - Connections { - enabled: account - target: account ? account.core : null - function onBundleModeEnabledChanged() { - if (bundleModeSwitch.checked != bundleModeSwitch.propertyOwnerGui.core[bundleModeSwitch.propertyName]) - bundleModeSwitch.checked = bundleModeSwitch.propertyOwnerGui.core[bundleModeSwitch.propertyName] - } - } - } - DecoratedTextField { - id: expireField - Layout.fillWidth: true - propertyName: "expire" - propertyOwnerGui: account - //: "Expiration (en seconde)" - title: qsTr("account_settings_expire_title") - canBeEmpty: false - isValid: function (text) { - return !isNaN(Number(text)) - } - toValidate: true - Connections { - target: account ? account.core : null - function onExpireChanged() { - if (expireField.text != expireField.propertyOwnerGui.core[expireField.propertyName]) - expireField.text = expireField.propertyOwnerGui.core[expireField.propertyName] - } - } - } - DecoratedTextField { - id: conferenceFactoryUriField - Layout.fillWidth: true - //: "URI du serveur de conversations" - title: qsTr("account_settings_conference_factory_uri_title") - propertyName: "conferenceFactoryAddress" - propertyOwnerGui: account - toValidate: true - Connections { - target: account ? account.core : null - function onConferenceFactoryAddressChanged() { - if (conferenceFactoryUriField.text != conferenceFactoryUriField.propertyOwnerGui.core[conferenceFactoryUriField.propertyName]) - conferenceFactoryUriField.text = conferenceFactoryUriField.propertyOwnerGui.core[conferenceFactoryUriField.propertyName] - } - } - } - DecoratedTextField { - id: audioVideoConfUriField - Layout.fillWidth: true - propertyName: "audioVideoConferenceFactoryAddress" - //: "URI du serveur de réunions" - title: qsTr("account_settings_audio_video_conference_factory_uri_title") - propertyOwnerGui: account - toValidate: true - Connections { - target: account ? account.core : null - function onAudioVideoConferenceFactoryAddressChanged() { - if (audioVideoConfUriField.text != audioVideoConfUriField.propertyOwnerGui.core[audioVideoConfUriField.propertyName]) - audioVideoConfUriField.text = audioVideoConfUriField.propertyOwnerGui.core[audioVideoConfUriField.propertyName] - } - } - } - DecoratedTextField { - id: limeServerUrlField - Layout.fillWidth: true - //: "URL du serveur d’échange de clés de chiffrement" - title: qsTr("account_settings_lime_server_url_title") - propertyName: "limeServerUrl" - propertyOwnerGui: account - toValidate: true - Connections { - target: account ? account.core : null - function onLimeServerUrlChanged() { - if (limeServerUrlField.text != limeServerUrlField.propertyOwnerGui.core[limeServerUrlField.propertyName]) - limeServerUrlField.text = limeServerUrlField.propertyOwnerGui.core[limeServerUrlField.propertyName] - } - } - } - DecoratedTextField { - Layout.fillWidth: true - //: "URL du serveur CCMP" - title: qsTr("account_settings_ccmp_server_url_title") - propertyName: "ccmpServerUrl" - propertyOwnerGui: account - toValidate: true - } - } - } + // Advanced parameters + ///////////////////// + Component { + id: advancedParametersComponent + ColumnLayout { + Layout.fillWidth: true + spacing: Utils.getSizeWithScreenRatio(20) + DecoratedTextField { + id: registrarUriField + Layout.fillWidth: true + //:"Registrar URI" + title: qsTr("account_settings_registrar_uri_title") + propertyName: "registrarUri" + propertyOwnerGui: account + toValidate: true + Connections { + enabled: account + target: account ? account.core : null + function onRegistrarUriChanged() { + if (registrarUriField.text != registrarUriField.propertyOwnerGui.core[registrarUriField.propertyName]) + registrarUriField.text = registrarUriField.propertyOwnerGui.core[registrarUriField.propertyName]; + } + } + } + DecoratedTextField { + id: outboundProxyUriField + Layout.fillWidth: true + //:"Outbound SIP Proxy URI" + title: qsTr("account_settings_sip_proxy_url_title") + propertyName: "outboundProxyUri" + propertyOwnerGui: account + //: "If this field is filled, the outbound proxy will be enabled automatically. Leave it empty to disable it." + tooltip: qsTr("login_proxy_server_url_tooltip") + toValidate: true + Connections { + enabled: account + target: account ? account.core : null + function onOutboundProxyUriChanged() { + if (outboundProxyUriField.text != outboundProxyUriField.propertyOwnerGui.core[outboundProxyUriField.propertyName]) + outboundProxyUriField.text = outboundProxyUriField.propertyOwnerGui.core[outboundProxyUriField.propertyName]; + } + } + } + DecoratedTextField { + id: stunServerField + Layout.fillWidth: true + propertyName: "stunServer" + propertyOwnerGui: account + //: "Adresse du serveur STUN" + title: qsTr("account_settings_stun_server_url_title") + toValidate: true + Connections { + enabled: account + target: account ? account.core : null + function onStunServerChanged() { + if (stunServerField.text != stunServerField.propertyOwnerGui.core[stunServerField.propertyName]) + stunServerField.text = stunServerField.propertyOwnerGui.core[stunServerField.propertyName]; + } + } + } + SwitchSetting { + id: iceSwitch + //: "Activer ICE" + titleText: qsTr("account_settings_enable_ice_title") + propertyName: "iceEnabled" + propertyOwnerGui: account + Connections { + enabled: account + target: account ? account.core : null + function onIceEnabledChanged() { + if (iceSwitch.checked != iceSwitch.propertyOwnerGui.core[iceSwitch.propertyName]) + iceSwitch.checked = iceSwitch.propertyOwnerGui.core[iceSwitch.propertyName]; + } + } + } + SwitchSetting { + id: avpfSwitch + //: "AVPF" + titleText: qsTr("account_settings_avpf_title") + propertyName: "avpfEnabled" + propertyOwnerGui: account + Connections { + enabled: account + target: account ? account.core : null + function onAvpfEnabledChanged() { + if (avpfSwitch.checked != avpfSwitch.propertyOwnerGui.core[avpfSwitch.propertyName]) + avpfSwitch.checked = avpfSwitch.propertyOwnerGui.core[avpfSwitch.propertyName]; + } + } + } + SwitchSetting { + id: bundleModeSwitch + //: "Mode bundle" + titleText: qsTr("account_settings_bundle_mode_title") + propertyName: "bundleModeEnabled" + propertyOwnerGui: account + Connections { + enabled: account + target: account ? account.core : null + function onBundleModeEnabledChanged() { + if (bundleModeSwitch.checked != bundleModeSwitch.propertyOwnerGui.core[bundleModeSwitch.propertyName]) + bundleModeSwitch.checked = bundleModeSwitch.propertyOwnerGui.core[bundleModeSwitch.propertyName]; + } + } + } + DecoratedTextField { + id: expireField + Layout.fillWidth: true + propertyName: "expire" + propertyOwnerGui: account + //: "Expiration (en seconde)" + title: qsTr("account_settings_expire_title") + canBeEmpty: false + isValid: function (text) { + return !isNaN(Number(text)); + } + toValidate: true + Connections { + target: account ? account.core : null + function onExpireChanged() { + if (expireField.text != expireField.propertyOwnerGui.core[expireField.propertyName]) + expireField.text = expireField.propertyOwnerGui.core[expireField.propertyName]; + } + } + } + DecoratedTextField { + id: conferenceFactoryUriField + Layout.fillWidth: true + //: "URI du serveur de conversations" + title: qsTr("account_settings_conference_factory_uri_title") + propertyName: "conferenceFactoryAddress" + propertyOwnerGui: account + toValidate: true + Connections { + target: account ? account.core : null + function onConferenceFactoryAddressChanged() { + if (conferenceFactoryUriField.text + != conferenceFactoryUriField.propertyOwnerGui.core[conferenceFactoryUriField.propertyName]) + conferenceFactoryUriField.text + = conferenceFactoryUriField.propertyOwnerGui.core[conferenceFactoryUriField.propertyName]; + } + } + } + DecoratedTextField { + id: audioVideoConfUriField + Layout.fillWidth: true + propertyName: "audioVideoConferenceFactoryAddress" + //: "URI du serveur de réunions" + title: qsTr("account_settings_audio_video_conference_factory_uri_title") + propertyOwnerGui: account + toValidate: true + Connections { + target: account ? account.core : null + function onAudioVideoConferenceFactoryAddressChanged() { + if (audioVideoConfUriField.text + != audioVideoConfUriField.propertyOwnerGui.core[audioVideoConfUriField.propertyName]) + audioVideoConfUriField.text = audioVideoConfUriField.propertyOwnerGui.core[audioVideoConfUriField.propertyName]; + } + } + } + DecoratedTextField { + id: limeServerUrlField + Layout.fillWidth: true + //: "URL du serveur d’échange de clés de chiffrement" + title: qsTr("account_settings_lime_server_url_title") + propertyName: "limeServerUrl" + propertyOwnerGui: account + toValidate: true + Connections { + target: account ? account.core : null + function onLimeServerUrlChanged() { + if (limeServerUrlField.text != limeServerUrlField.propertyOwnerGui.core[limeServerUrlField.propertyName]) + limeServerUrlField.text = limeServerUrlField.propertyOwnerGui.core[limeServerUrlField.propertyName]; + } + } + } + DecoratedTextField { + Layout.fillWidth: true + //: "URL du serveur CCMP" + title: qsTr("account_settings_ccmp_server_url_title") + propertyName: "ccmpServerUrl" + propertyOwnerGui: account + toValidate: true + } + } + } } diff --git a/Linphone/view/Page/Layout/Settings/AdvancedSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/AdvancedSettingsLayout.qml index a02a7b25d..bab5b6b9a 100644 --- a/Linphone/view/Page/Layout/Settings/AdvancedSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AdvancedSettingsLayout.qml @@ -1,44 +1,43 @@ - import QtQuick import QtQuick.Layouts import QtQuick.Controls.Basic as Control import SettingsCpp 1.0 import UtilsCpp 1.0 import Linphone -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle AbstractSettingsLayout { width: parent?.width contentModel: [ { - //: System - title: qsTr("settings_system_title"), + //: System + title: qsTr("settings_system_title"), subTitle: "", contentComponent: systemComponent }, { - //: Remote provisioning - title: qsTr("settings_remote_provisioning_title"), + //: Remote provisioning + title: qsTr("settings_remote_provisioning_title"), subTitle: "", contentComponent: remoteProvisioningComponent, hideTopSeparator: true }, { - //: Security / Encryption - title: qsTr("settings_security_title"), + //: Security / Encryption + title: qsTr("settings_security_title"), subTitle: "", - contentComponent: securityComponent, + contentComponent: securityComponent }, { - //: Audio codecs - title: qsTr("settings_advanced_audio_codecs_title"), + //: Audio codecs + title: qsTr("settings_advanced_audio_codecs_title"), subTitle: "", - contentComponent: audioCodecsComponent, + contentComponent: audioCodecsComponent }, { - //: Video codecs - title: qsTr("settings_advanced_video_codecs_title"), + //: Video codecs + title: qsTr("settings_advanced_video_codecs_title"), subTitle: "", contentComponent: videoCodecsComponent }, @@ -50,7 +49,7 @@ AbstractSettingsLayout { ] onSave: { - SettingsCpp.save() + SettingsCpp.save(); } onUndo: SettingsCpp.undo() @@ -60,11 +59,11 @@ AbstractSettingsLayout { Component { id: systemComponent ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(40) + spacing: Utils.getSizeWithScreenRatio(40) SwitchSetting { Layout.fillWidth: true - //: Auto start %1 - titleText: qsTr("settings_advanced_auto_start_title").arg(applicationName) + //: Auto start %1 + titleText: qsTr("settings_advanced_auto_start_title").arg(applicationName) propertyName: "autoStart" propertyOwner: SettingsCpp } @@ -77,27 +76,28 @@ AbstractSettingsLayout { Component { id: remoteProvisioningComponent ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(6) + spacing: Utils.getSizeWithScreenRatio(6) DecoratedTextField { - Layout.fillWidth: true id: configUri - //: Remote provisioning URL - title: qsTr("settings_advanced_remote_provisioning_url") + Layout.fillWidth: true + //: Remote provisioning URL + title: qsTr("settings_advanced_remote_provisioning_url") toValidate: true } SmallButton { - Layout.topMargin: Utils.getSizeWithScreenRatio(-20) + Layout.topMargin: Utils.getSizeWithScreenRatio(-20) Layout.alignment: Qt.AlignRight - //: Download and apply - text: qsTr("settings_advanced_download_apply_remote_provisioning") + //: Download and apply + text: qsTr("settings_advanced_download_apply_remote_provisioning") style: ButtonStyle.tertiary onClicked: { - var url = configUri.value() + var url = configUri.value(); if (UtilsCpp.isValidURL(url)) - UtilsCpp.useFetchConfig(configUri.value()) + UtilsCpp.useFetchConfig(configUri.value()); else - //: Invalid URL format - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), qsTr("settings_advanced_invalid_url_message"), false, UtilsCpp.getMainWindow()) + //: Invalid URL format + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), qsTr("settings_advanced_invalid_url_message"), + false, UtilsCpp.getMainWindow()); } //: "Download and apply remote provisioning" Accessible.name: qsTr("download_apply_remote_provisioning_accessible_name") @@ -108,15 +108,15 @@ AbstractSettingsLayout { Component { id: securityComponent ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) Text { - //: Media encryption - text: qsTr("settings_advanced_media_encryption_title") + //: Media encryption + text: qsTr("settings_advanced_media_encryption_title") font { - pixelSize: Typography.p2l.pixelSize - weight: Typography.p2l.weight + pixelSize: Typography.p2l.pixelSize + weight: Typography.p2l.weight } } ComboSetting { @@ -125,22 +125,22 @@ AbstractSettingsLayout { entries: SettingsCpp.mediaEncryptions propertyName: "mediaEncryption" textRole: 'display_name' - propertyOwner: SettingsCpp + propertyOwner: SettingsCpp Accessible.name: qsTr("settings_advanced_media_encryption_title") } } SwitchSetting { Layout.fillWidth: true - //: Media encryption mandatory - titleText: qsTr("settings_advanced_media_encryption_mandatory_title") + //: Media encryption mandatory + titleText: qsTr("settings_advanced_media_encryption_mandatory_title") propertyName: "mediaEncryptionMandatory" propertyOwner: SettingsCpp } SwitchSetting { visible: false Layout.fillWidth: true - //: Create end to end encrypted meetings and group calls - titleText: qsTr("settings_advanced_create_endtoend_encrypted_meetings_title") + //: Create end to end encrypted meetings and group calls + titleText: qsTr("settings_advanced_create_endtoend_encrypted_meetings_title") propertyName: "createEndToEndEncryptedMeetingsAndGroupCalls" propertyOwner: SettingsCpp } @@ -156,26 +156,28 @@ AbstractSettingsLayout { ListView { Layout.preferredHeight: contentHeight Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) model: PayloadTypeProxy { filterType: PayloadTypeProxy.Audio | PayloadTypeProxy.NotDownloadable } delegate: SwitchSetting { width: parent.width - height: Utils.getSizeWithScreenRatio(32) + height: Utils.getSizeWithScreenRatio(32) titleText: Utils.capitalizeFirstLetter(modelData.core.mimeType) subTitleText: modelData.core.clockRate + " Hz" propertyName: "enabled" propertyOwnerGui: modelData Connections { target: modelData.core - function onChanged() { SettingsCpp.isSaved = false } + function onChanged() { + SettingsCpp.isSaved = false; + } } Connections { target: SettingsCpp function onIsSavedChanged(saved) { if (saved) - modelData.core.save() + modelData.core.save(); } } } @@ -189,32 +191,34 @@ AbstractSettingsLayout { Component { id: videoCodecsComponent ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) ListView { id: videoCodecList Layout.preferredHeight: contentHeight Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) model: PayloadTypeProxy { id: videoPayloadTypeProxy filterType: PayloadTypeProxy.Video | PayloadTypeProxy.NotDownloadable } delegate: SwitchSetting { width: videoCodecList.width - height: Utils.getSizeWithScreenRatio(32) + height: Utils.getSizeWithScreenRatio(32) titleText: Utils.capitalizeFirstLetter(modelData.core.mimeType) subTitleText: modelData.core.encoderDescription propertyName: "enabled" propertyOwnerGui: modelData Connections { target: modelData.core - function onChanged() { SettingsCpp.isSaved = false } + function onChanged() { + SettingsCpp.isSaved = false; + } } Connections { target: SettingsCpp function onIsSavedChanged(saved) { if (saved) - modelData.core.save() + modelData.core.save(); } } } @@ -223,29 +227,25 @@ AbstractSettingsLayout { id: payloadList Layout.preferredHeight: contentHeight Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) model: PayloadTypeProxy { id: downloadableVideoPayloadTypeProxy filterType: PayloadTypeProxy.Video | PayloadTypeProxy.Downloadable } delegate: SwitchSetting { width: payloadList.width - height: Utils.getSizeWithScreenRatio(32) + height: Utils.getSizeWithScreenRatio(32) titleText: Utils.capitalizeFirstLetter(modelData.core.mimeType) subTitleText: modelData.core.encoderDescription - onToggled: Utils.openCodecOnlineInstallerDialog( - UtilsCpp.getMainWindow(), - modelData.core, - function cancelCallBack() { - checked = false - }, - function successCallBack() { - videoPayloadTypeProxy.reload() - downloadableVideoPayloadTypeProxy.reload() - }, - function errorCallBack() { - checked = false - }) + onToggled: Utils.openCodecOnlineInstallerDialog(UtilsCpp.getMainWindow(), modelData.core, function cancelCallBack( + ) { + checked = false; + }, function successCallBack() { + videoPayloadTypeProxy.reload(); + downloadableVideoPayloadTypeProxy.reload(); + }, function errorCallBack() { + checked = false; + }) } } } @@ -257,10 +257,10 @@ AbstractSettingsLayout { Component { id: hideFpsComponent ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(40) + spacing: Utils.getSizeWithScreenRatio(40) SwitchSetting { - //:"Cacher les FPS" - titleText:qsTr("settings_advanced_hide_fps_title") + //:"Cacher les FPS" + titleText: qsTr("settings_advanced_hide_fps_title") propertyName: "hideFps" propertyOwner: SettingsCpp } diff --git a/Linphone/view/Page/Layout/Settings/CallForwardSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/CallForwardSettingsLayout.qml index 1b1ef1139..f30454f2b 100644 --- a/Linphone/view/Page/Layout/Settings/CallForwardSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/CallForwardSettingsLayout.qml @@ -1,4 +1,3 @@ - import QtQuick import QtQuick.Layouts import QtQuick.Controls.Basic as Control @@ -10,9 +9,9 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { id: mainItem width: parent?.width - + property bool enableCallForward: SettingsCpp.callForwardToAddress.length > 0 - + contentModel: [ { title: "", @@ -20,36 +19,36 @@ AbstractSettingsLayout { contentComponent: parametersComponent } ] - + onSave: { if (mainItem.enableCallForward && SettingsCpp.callForwardToAddress.length == 0) { - UtilsCpp.getMainWindow().showInformationPopup("", qsTr("settings_call_forward_address_cannot_be_empty"), false) - return + UtilsCpp.getMainWindow().showInformationPopup("", qsTr("settings_call_forward_address_cannot_be_empty"), false); + return; } - SettingsCpp.save() + SettingsCpp.save(); } onUndo: SettingsCpp.undo() // Generic forward parameters ///////////////////////////// - Component { - id: parametersComponent - ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(20) - SwitchSetting { - //: "Forward calls" - titleText: qsTr("settings_call_forward_activate_title") - //: "Enable call forwarding to voicemail or sip address" - subTitleText: qsTr("settings_call_forward_activate_subtitle") - propertyName: "enableCallForward" - propertyOwner: mainItem - onToggled: function () { - SettingsCpp.isSaved = false + Component { + id: parametersComponent + ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(20) + SwitchSetting { + //: "Forward calls" + titleText: qsTr("settings_call_forward_activate_title") + //: "Enable call forwarding to voicemail or sip address" + subTitleText: qsTr("settings_call_forward_activate_subtitle") + propertyName: "enableCallForward" + propertyOwner: mainItem + onToggled: function () { + SettingsCpp.isSaved = false; if (!mainItem.enableCallForward) - SettingsCpp.callForwardToAddress = "" + SettingsCpp.callForwardToAddress = ""; } - } + } Text { visible: mainItem.enableCallForward //: Forward to destination @@ -65,14 +64,18 @@ AbstractSettingsLayout { Layout.fillWidth: true Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) model: [ - {text: qsTr("settings_call_forward_to_voicemail")}, - {text: qsTr("settings_call_forward_to_sipaddress")} - ] + { + text: qsTr("settings_call_forward_to_voicemail") + }, + { + text: qsTr("settings_call_forward_to_sipaddress") + } + ] property bool isInitialized: false Component.onCompleted: { if (mainItem.enableCallForward) { - forwardDestination.currentIndex = - (SettingsCpp.callForwardToAddress === "voicemail" || SettingsCpp.callForwardToAddress.length === 0) ? 0 : 1; + forwardDestination.currentIndex = (SettingsCpp.callForwardToAddress === "voicemail" + || SettingsCpp.callForwardToAddress.length === 0) ? 0 : 1; } else { forwardDestination.currentIndex = 0; } @@ -90,11 +93,10 @@ AbstractSettingsLayout { } onVisibleChanged: { if (visible) { - currentIndex = 0 - SettingsCpp.callForwardToAddress = "voicemail"; + currentIndex = 0; + SettingsCpp.callForwardToAddress = "voicemail"; } } - } DecoratedTextField { id: sipInputField diff --git a/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml index 444426e07..5f1d791d7 100644 --- a/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml @@ -1,4 +1,3 @@ - import QtQuick import QtQuick.Layouts import QtQuick.Controls.Basic as Control @@ -6,7 +5,7 @@ import QtQuick.Dialogs 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { @@ -19,10 +18,10 @@ AbstractSettingsLayout { contentComponent: genericParametersComponent }, { - //: "Périphériques" - title: qsTr("settings_call_devices_title"), - //: "Vous pouvez modifier les périphériques de sortie audio, le microphone et la caméra de capture." - subTitle: qsTr("settings_call_devices_subtitle"), + //: "Périphériques" + title: qsTr("settings_call_devices_title"), + //: "Vous pouvez modifier les périphériques de sortie audio, le microphone et la caméra de capture." + subTitle: qsTr("settings_call_devices_subtitle"), contentComponent: multiMediaParametersComponent, customWidth: 540, customRightMargin: 36 @@ -30,7 +29,7 @@ AbstractSettingsLayout { ] onSave: { - SettingsCpp.save() + SettingsCpp.save(); } onUndo: SettingsCpp.undo() @@ -45,40 +44,40 @@ AbstractSettingsLayout { // Generic call parameters ////////////////////////// - Component { - id: genericParametersComponent - ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(20) - SwitchSetting { - //: "Annulateur d'écho" - titleText: qsTr("settings_calls_echo_canceller_title") - //: "Évite que de l'écho soit entendu par votre correspondant" - subTitleText: qsTr("settings_calls_echo_canceller_subtitle") - propertyName: "echoCancellationEnabled" - propertyOwner: SettingsCpp - } - SwitchSetting { - Layout.fillWidth: true - //: "Activer l’enregistrement automatique des appels" - titleText: qsTr("settings_calls_auto_record_title") - propertyName: "automaticallyRecordCallsEnabled" - propertyOwner: SettingsCpp - visible: !SettingsCpp.disableCallRecordings - } - SwitchSetting { - //: Tonalités - titleText: qsTr("settings_call_enable_tones_title") - //: Activer les tonalités - subTitleText: qsTr("settings_call_enable_tones_subtitle") - propertyName: "callToneIndicationsEnabled" - propertyOwner: SettingsCpp - } - SwitchSetting { - //: "Autoriser la vidéo" - titleText: qsTr("settings_calls_enable_video_title") - propertyName: "videoEnabled" - propertyOwner: SettingsCpp - } + Component { + id: genericParametersComponent + ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(20) + SwitchSetting { + //: "Annulateur d'écho" + titleText: qsTr("settings_calls_echo_canceller_title") + //: "Évite que de l'écho soit entendu par votre correspondant" + subTitleText: qsTr("settings_calls_echo_canceller_subtitle") + propertyName: "echoCancellationEnabled" + propertyOwner: SettingsCpp + } + SwitchSetting { + Layout.fillWidth: true + //: "Activer l’enregistrement automatique des appels" + titleText: qsTr("settings_calls_auto_record_title") + propertyName: "automaticallyRecordCallsEnabled" + propertyOwner: SettingsCpp + visible: !SettingsCpp.disableCallRecordings + } + SwitchSetting { + //: Tonalités + titleText: qsTr("settings_call_enable_tones_title") + //: Activer les tonalités + subTitleText: qsTr("settings_call_enable_tones_subtitle") + propertyName: "callToneIndicationsEnabled" + propertyOwner: SettingsCpp + } + SwitchSetting { + //: "Autoriser la vidéo" + titleText: qsTr("settings_calls_enable_video_title") + propertyName: "videoEnabled" + propertyOwner: SettingsCpp + } DecoratedTextField { visible: !SettingsCpp.disableCommandLine Layout.fillWidth: true @@ -119,15 +118,17 @@ AbstractSettingsLayout { } } } - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } RoundButton { style: ButtonStyle.noBackground icon.source: AppIcons.arrowSquareOut onClicked: { - fileDialog.open() + fileDialog.open(); } //: Choose ringtone file - Accessible.name:qsTr("choose_ringtone_file_accessible_name") + Accessible.name: qsTr("choose_ringtone_file_accessible_name") } } } @@ -141,7 +142,7 @@ AbstractSettingsLayout { MultimediaSettings { ringerDevicesVisible: true backgroundVisible: false - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) } } } diff --git a/Linphone/view/Page/Layout/Settings/CarddavSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/CarddavSettingsLayout.qml index 12324fb9c..f62513c1d 100644 --- a/Linphone/view/Page/Layout/Settings/CarddavSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/CarddavSettingsLayout.qml @@ -6,7 +6,7 @@ import QtQuick.Dialogs 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { @@ -14,10 +14,10 @@ AbstractSettingsLayout { width: parent?.width contentModel: [ { - //: Carnet d'adresse CardDAV - title: qsTr("settings_contacts_carddav_title"), - //: "Ajouter un carnet d’adresse CardDAV pour synchroniser vos contacts Linphone avec un carnet d’adresse tiers." - subTitle: qsTr("settings_contacts_carddav_subtitle"), + //: Carnet d'adresse CardDAV + title: qsTr("settings_contacts_carddav_title"), + //: "Ajouter un carnet d’adresse CardDAV pour synchroniser vos contacts Linphone avec un carnet d’adresse tiers." + subTitle: qsTr("settings_contacts_carddav_subtitle"), contentComponent: cardDavParametersComponent } ] @@ -26,11 +26,11 @@ AbstractSettingsLayout { property bool isNew: false onSave: { if (carddavGui.core.isValid()) { - carddavGui.core.save() + carddavGui.core.save(); } else { - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: "Vérifiez que toutes les informations ont été saisies." - qsTr("settings_contacts_carddav_popup_invalid_error"), false, mainWindow) + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "Vérifiez que toutes les informations ont été saisies." + qsTr("settings_contacts_carddav_popup_invalid_error"), false, mainWindow); } } Connections { @@ -38,56 +38,53 @@ AbstractSettingsLayout { target: carddavGui ? carddavGui.core : null function onSaved(success, message) { if (success) - UtilsCpp.showInformationPopup(qsTr("information_popup_synchronization_success_title"), - //: "Le carnet d'adresse CardDAV est synchronisé." - qsTr("settings_contacts_carddav_synchronization_success_message"), true, mainWindow) + UtilsCpp.showInformationPopup(qsTr("information_popup_synchronization_success_title"), + //: "Le carnet d'adresse CardDAV est synchronisé." + qsTr("settings_contacts_carddav_synchronization_success_message"), true, mainWindow); else - UtilsCpp.showInformationPopup(qsTr("settings_contacts_carddav_popup_synchronization_error_title"), - //: "Erreur de synchronisation : %1" - qsTr("settings_contacts_carddav_popup_synchronization_error_message").arg(message), false, mainWindow) + UtilsCpp.showInformationPopup(qsTr("settings_contacts_carddav_popup_synchronization_error_title"), + //: "Erreur de synchronisation : %1" + qsTr("settings_contacts_carddav_popup_synchronization_error_message").arg(message), false, mainWindow); } } Component { id: topBar RowLayout { - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) BigButton { style: ButtonStyle.noBackground icon.source: AppIcons.trashCan - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) visible: !isNew onClicked: { - var mainWin = UtilsCpp.getMainWindow() + var mainWin = UtilsCpp.getMainWindow(); mainWin.showConfirmationLambdaPopup("", - //: "Supprimer le carnet d'adresse CardDAV ?" - qsTr("settings_contacts_delete_carddav_server_title"), - "", - function (confirmed) { - if (confirmed) { - carddavGui.core.remove() - mainItem.container.pop() - } - } - ) + //: "Supprimer le carnet d'adresse CardDAV ?" + qsTr("settings_contacts_delete_carddav_server_title"), "", function (confirmed) { + if (confirmed) { + carddavGui.core.remove(); + mainItem.container.pop(); + } + }); } } } } - + Component { id: cardDavParametersComponent ColumnLayout { Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(20) - Layout.rightMargin: Utils.getSizeWithScreenRatio(44) - Layout.topMargin: Utils.getSizeWithScreenRatio(20) - Layout.leftMargin: Utils.getSizeWithScreenRatio(64) + spacing: Utils.getSizeWithScreenRatio(20) + Layout.rightMargin: Utils.getSizeWithScreenRatio(44) + Layout.topMargin: Utils.getSizeWithScreenRatio(20) + Layout.leftMargin: Utils.getSizeWithScreenRatio(64) DecoratedTextField { propertyName: "displayName" propertyOwnerGui: carddavGui - //: Nom d'affichage - title: qsTr("sip_address_display_name") + //: Nom d'affichage + title: qsTr("sip_address_display_name") canBeEmpty: false toValidate: true Layout.fillWidth: true @@ -95,8 +92,8 @@ AbstractSettingsLayout { DecoratedTextField { propertyName: "uri" propertyOwnerGui: carddavGui - //: "URL du serveur" - title: qsTr("settings_contacts_carddav_server_url_title") + //: "URL du serveur" + title: qsTr("settings_contacts_carddav_server_url_title") canBeEmpty: false toValidate: true Layout.fillWidth: true @@ -104,7 +101,7 @@ AbstractSettingsLayout { DecoratedTextField { propertyName: "username" propertyOwnerGui: carddavGui - title: qsTr("username") + title: qsTr("username") toValidate: true Layout.fillWidth: true } @@ -112,21 +109,21 @@ AbstractSettingsLayout { propertyName: "password" hidden: true propertyOwnerGui: carddavGui - title: qsTr("password") + title: qsTr("password") toValidate: true Layout.fillWidth: true } DecoratedTextField { propertyName: "realm" propertyOwnerGui: carddavGui - //: Domaine d’authentification - title: qsTr("settings_contacts_carddav_realm_title") + //: Domaine d’authentification + title: qsTr("settings_contacts_carddav_realm_title") toValidate: true Layout.fillWidth: true } SwitchSetting { - //: "Stocker ici les contacts nouvellement crées" - titleText: qsTr("settings_contacts_carddav_use_as_default_title") + //: "Stocker ici les contacts nouvellement crées" + titleText: qsTr("settings_contacts_carddav_use_as_default_title") propertyName: "storeNewFriendsInIt" propertyOwnerGui: carddavGui } diff --git a/Linphone/view/Page/Layout/Settings/ChatSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/ChatSettingsLayout.qml index 910e727bf..1275b233f 100644 --- a/Linphone/view/Page/Layout/Settings/ChatSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/ChatSettingsLayout.qml @@ -1,4 +1,3 @@ - import QtQuick import QtQuick.Layouts import QtQuick.Dialogs @@ -12,17 +11,17 @@ AbstractSettingsLayout { width: parent?.width contentModel: [ { - //: Attached files - title: qsTr("settings_chat_attached_files_title"), - subTitle: "", - contentComponent: attachedFilesParamComp, + //: Attached files + title: qsTr("settings_chat_attached_files_title"), + subTitle: "", + contentComponent: attachedFilesParamComp // hideTopMargin: true }, { - //: Notifications - title: qsTr("settings_chat_notifications_title"), - subTitle: "", - contentComponent: displayNotifParamComp, + //: Notifications + title: qsTr("settings_chat_notifications_title"), + subTitle: "", + contentComponent: displayNotifParamComp // hideTopMargin: true } ] @@ -35,14 +34,14 @@ AbstractSettingsLayout { currentFolder: SettingsCpp.downloadFolder options: FolderDialog.DontResolveSymlinks onAccepted: { - SettingsCpp.downloadFolder = Utils.getSystemPathFromUri(selectedFolder) + SettingsCpp.downloadFolder = Utils.getSystemPathFromUri(selectedFolder); } } Component { id: attachedFilesParamComp ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) SwitchSetting { //: "Automatic download" titleText: qsTr("settings_chat_attached_files_auto_download_title") @@ -58,19 +57,20 @@ AbstractSettingsLayout { propertyName: "downloadFolder" propertyOwner: SettingsCpp customButtonIcon: AppIcons.arrowSquareOut - customCallback: function() {folderDialog.open()} + customCallback: function () { + folderDialog.open(); + } toValidate: true //: Browse folders customButtonAccessibleName: qsTr("settings_chat_download_folder_browse_button") Connections { - target: SettingsCpp - function onDownloadFolderChanged() { - if (downloadFolderTextField.text != downloadFolderTextField.propertyOwner[downloadFolderTextField.propertyName]) - downloadFolderTextField.text = downloadFolderTextField.propertyOwner[downloadFolderTextField.propertyName] - } - } + target: SettingsCpp + function onDownloadFolderChanged() { + if (downloadFolderTextField.text != downloadFolderTextField.propertyOwner[downloadFolderTextField.propertyName]) + downloadFolderTextField.text = downloadFolderTextField.propertyOwner[downloadFolderTextField.propertyName]; + } + } } - } } Component { @@ -84,4 +84,4 @@ AbstractSettingsLayout { propertyOwner: SettingsCpp } } -} \ No newline at end of file +} diff --git a/Linphone/view/Page/Layout/Settings/ContactsSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/ContactsSettingsLayout.qml index 194aaac20..ae94e0292 100644 --- a/Linphone/view/Page/Layout/Settings/ContactsSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/ContactsSettingsLayout.qml @@ -1,4 +1,3 @@ - import QtQuick import QtQuick.Layouts import QtQuick.Controls.Basic as Control @@ -10,26 +9,26 @@ AbstractSettingsLayout { width: parent?.width contentModel: [ { - //: Annuaires LDAP - title: qsTr("settings_contacts_ldap_title"), - //: "Ajouter vos annuaires LDAP pour pouvoir effectuer des recherches dans la barre de recherche." - subTitle: qsTr("settings_contacts_ldap_subtitle"), + //: Annuaires LDAP + title: qsTr("settings_contacts_ldap_title"), + //: "Ajouter vos annuaires LDAP pour pouvoir effectuer des recherches dans la barre de recherche." + subTitle: qsTr("settings_contacts_ldap_subtitle"), contentComponent: ldapParametersComponent, hideTopMargin: true }, { - title: qsTr("settings_contacts_carddav_title"), - subTitle: qsTr("settings_contacts_carddav_subtitle"), + title: qsTr("settings_contacts_carddav_title"), + subTitle: qsTr("settings_contacts_carddav_subtitle"), contentComponent: cardDavParametersComponent, hideTopMargin: true } ] function layoutUrl(name) { - return layoutsPath+"/"+name+".qml" + return layoutsPath + "/" + name + ".qml"; } function createGuiObject(name) { - return Qt.createQmlObject('import Linphone; '+name+'Gui{}', mainItem) + return Qt.createQmlObject('import Linphone; ' + name + 'Gui{}', mainItem); } // Ldap parameters @@ -38,10 +37,10 @@ AbstractSettingsLayout { Component { id: ldapParametersComponent ContactsSettingsProviderLayout { - //: "Ajouter un annuaire LDAP" - addText: qsTr("settings_contacts_add_ldap_server_title") - //: "Modifier un annuaire LDAP" - editText: qsTr("settings_contacts_edit_ldap_server_title") + //: "Ajouter un annuaire LDAP" + addText: qsTr("settings_contacts_add_ldap_server_title") + //: "Modifier un annuaire LDAP" + editText: qsTr("settings_contacts_edit_ldap_server_title") //: "Editer le serveur LDAP %1" accessibleEditButtonText: qsTr("edit_ldap_server_accessible_name") //: "Utiliser le serveur LDAP %1" @@ -56,8 +55,12 @@ AbstractSettingsLayout { Connections { target: mainItem - function onSave() { save()} - function onUndo() { undo()} + function onSave() { + save(); + } + function onUndo() { + undo(); + } } } } @@ -69,18 +72,18 @@ AbstractSettingsLayout { id: cardDavParametersComponent ContactsSettingsProviderLayout { id: carddavProvider - //: "Ajouter un carnet d'adresse CardDAV" - addText: qsTr("settings_contacts_add_carddav_server_title") - //: "Modifier un carnet d'adresse CardDAV" - editText: qsTr("settings_contacts_edit_carddav_server_title") + //: "Ajouter un carnet d'adresse CardDAV" + addText: qsTr("settings_contacts_add_carddav_server_title") + //: "Modifier un carnet d'adresse CardDAV" + editText: qsTr("settings_contacts_edit_carddav_server_title") //: "Editer le carnet d'adresses CardDAV %1" accessibleEditButtonText: qsTr("edit_cardav_server_accessible_name") //: "Utiliser le d'adresses CardDAV %1" accessibleUseButtonText: qsTr("use_cardav_server_accessible_name") proxyModel: CarddavProxy { - onModelReset: { - carddavProvider.showAddButton = carddavProvider.proxyModel.count == 0 - carddavProvider.newItemGui = createGuiObject('Carddav') + onModelReset: { + carddavProvider.showAddButton = carddavProvider.proxyModel.count == 0; + carddavProvider.newItemGui = createGuiObject('Carddav'); } } newItemGui: createGuiObject('Carddav') @@ -91,8 +94,12 @@ AbstractSettingsLayout { Connections { target: mainItem - function onSave() { save()} - function onUndo() { undo()} + function onSave() { + save(); + } + function onUndo() { + undo(); + } } } } diff --git a/Linphone/view/Page/Layout/Settings/ContactsSettingsProviderLayout.qml b/Linphone/view/Page/Layout/Settings/ContactsSettingsProviderLayout.qml index b5b051a9f..41043da30 100644 --- a/Linphone/view/Page/Layout/Settings/ContactsSettingsProviderLayout.qml +++ b/Linphone/view/Page/Layout/Settings/ContactsSettingsProviderLayout.qml @@ -1,16 +1,15 @@ - import QtQuick import QtQuick.Layouts 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 -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle RowLayout { id: mainItem - + property string title property string addText property string addTextDescription @@ -25,21 +24,21 @@ RowLayout { property bool supportsEnableDisable property bool showAddButton - signal save() - signal undo() + signal save + signal undo - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) ColumnLayout { Layout.fillWidth: true Layout.fillHeight: true - spacing: Utils.getSizeWithScreenRatio(16) + spacing: Utils.getSizeWithScreenRatio(16) Repeater { model: mainItem.proxyModel RowLayout { Layout.fillWidth: true - Layout.alignment: Qt.AlignLeft|Qt.AlignHCenter - Layout.preferredHeight: Utils.getSizeWithScreenRatio(74) - spacing: Utils.getSizeWithScreenRatio(20) + Layout.alignment: Qt.AlignLeft | Qt.AlignHCenter + Layout.preferredHeight: Utils.getSizeWithScreenRatio(74) + spacing: Utils.getSizeWithScreenRatio(20) Text { text: modelData.core[titleProperty] font: Typography.p2l @@ -54,16 +53,17 @@ RowLayout { Button { style: ButtonStyle.noBackground icon.source: AppIcons.pencil - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) onClicked: { mainItem.owner.container.push(mainItem.settingsLayout, { - titleText: mainItem.editText, - model: modelData, - container: mainItem.owner.container, - isNew: false}) + titleText: mainItem.editText, + model: modelData, + container: mainItem.owner.container, + isNew: false + }); } Accessible.name: mainItem.accessibleEditButtonText.arg(modelData.core[titleProperty]) } @@ -73,7 +73,7 @@ RowLayout { checked: supportsEnableDisable && modelData.core["enabled"] visible: supportsEnableDisable onToggled: { - binding.when = true + binding.when = true; } Accessible.name: mainItem.accessibleUseButtonText.arg(modelData.core[titleProperty]) } @@ -87,50 +87,51 @@ RowLayout { Connections { target: mainItem function onSave() { - modelData.core.save() + modelData.core.save(); } function onUndo() { - modelData.core.undo() + modelData.core.undo(); } } Connections { enabled: modelData target: modelData ? modelData.core : null function onSavedChanged() { - if (modelData.core.saved) UtilsCpp.showInformationPopup(qsTr("information_popup_success_title"), - //: "Les changements ont été sauvegardés" - qsTr("information_popup_changes_saved"), true, mainWindow) + if (modelData.core.saved) + UtilsCpp.showInformationPopup(qsTr("information_popup_success_title"), + //: "Les changements ont été sauvegardés" + qsTr("information_popup_changes_saved"), true, mainWindow); } - } - + } } onVisibleChanged: { if (visible) - proxyModel.updateView() + proxyModel.updateView(); } Component.onCompleted: { - proxyModel.updateView() + proxyModel.updateView(); } } RowLayout { Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) Item { Layout.fillWidth: true } MediumButton { Layout.alignment: Qt.AlignRight | Qt.AlignHCenter - //: "Ajouter" - text: qsTr("add") + //: "Ajouter" + text: qsTr("add") Accessible.name: mainItem.addText style: ButtonStyle.main visible: mainItem.showAddButton onClicked: { mainItem.owner.container.push(mainItem.settingsLayout, { - titleText: mainItem.addText, - model: mainItem.newItemGui, - container: mainItem.owner.container, - isNew: true}) + titleText: mainItem.addText, + model: mainItem.newItemGui, + container: mainItem.owner.container, + isNew: true + }); } } } diff --git a/Linphone/view/Page/Layout/Settings/DebugSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/DebugSettingsLayout.qml index 5b290f44b..42f591d70 100644 --- a/Linphone/view/Page/Layout/Settings/DebugSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/DebugSettingsLayout.qml @@ -1,4 +1,3 @@ - import QtQuick import QtQuick.Layouts import QtQuick.Controls.Basic as Control @@ -6,13 +5,13 @@ import QtQuick.Controls.Basic as Control 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractSettingsLayout { + id: mainItem Layout.fillWidth: true Layout.fillHeight: true - id: mainItem property string logsUrl contentModel: [ { @@ -29,95 +28,94 @@ AbstractSettingsLayout { Dialog { id: deleteLogs - //: "Les traces de débogage seront supprimées. Souhaitez-vous continuer ?" - text: qsTr("settings_debug_clean_logs_message") + //: "Les traces de débogage seront supprimées. Souhaitez-vous continuer ?" + text: qsTr("settings_debug_clean_logs_message") onAccepted: SettingsCpp.cleanLogs() } - + onSave: { - SettingsCpp.save() + SettingsCpp.save(); } - + Dialog { id: shareLogs - //: "Les traces de débogage ont été téléversées. Comment souhaitez-vous partager le lien ? " - text: qsTr("settings_debug_share_logs_message") + //: "Les traces de débogage ont été téléversées. Comment souhaitez-vous partager le lien ? " + text: qsTr("settings_debug_share_logs_message") buttons: [ BigButton { - //: "Presse-papier" - text: qsTr("settings_debug_clipboard") + //: "Presse-papier" + text: qsTr("settings_debug_clipboard") style: ButtonStyle.main onClicked: { - shareLogs.close() - UtilsCpp.copyToClipboard(mainItem.logsUrl) + shareLogs.close(); + UtilsCpp.copyToClipboard(mainItem.logsUrl); } }, BigButton { - //: "E-Mail" - text: qsTr("settings_debug_email") + //: "E-Mail" + text: qsTr("settings_debug_email") style: ButtonStyle.main onClicked: { - shareLogs.close() - //: "Traces %1" - if(!Qt.openUrlExternally("mailto:%1%2%3%4%5".arg(encodeURIComponent(SettingsCpp.logsEmail)) - .arg('?subject=').arg(encodeURIComponent(qsTr("debug_settings_trace").arg(applicationName))) - .arg('&body=').arg(encodeURIComponent(mainItem.logsUrl)) - )) - //: Une erreur est survenue. - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: "Le partage par mail a échoué. Veuillez envoyer le lien %1 directement à l'adresse %2." - qsTr("information_popup_email_sharing_failed").arg(mainItem.logsUrl).arg(SettingsCpp.logsEmail), false) + shareLogs.close(); + //: "Traces %1" + if (!Qt.openUrlExternally("mailto:%1%2%3%4%5".arg(encodeURIComponent(SettingsCpp.logsEmail)).arg('?subject=').arg( + encodeURIComponent(qsTr("debug_settings_trace").arg(applicationName))).arg('&body=').arg( + encodeURIComponent(mainItem.logsUrl)))) + //: Une erreur est survenue. + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "Le partage par mail a échoué. Veuillez envoyer le lien %1 directement à l'adresse %2." + qsTr("information_popup_email_sharing_failed").arg(mainItem.logsUrl).arg(SettingsCpp.logsEmail), false); } } ] } - + Component { id: logContent ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) SwitchSetting { - //: "Activer les traces de débogage" - titleText: qsTr("settings_debug_enable_logs_title") + //: "Activer les traces de débogage" + titleText: qsTr("settings_debug_enable_logs_title") propertyName: "logsEnabled" propertyOwner: SettingsCpp } SwitchSetting { - //: "Activer les traces de débogage intégrales" - titleText: qsTr("settings_debug_enable_full_logs_title") + //: "Activer les traces de débogage intégrales" + titleText: qsTr("settings_debug_enable_full_logs_title") propertyName: "fullLogsEnabled" propertyOwner: SettingsCpp } RowLayout { - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) Layout.alignment: Qt.AlignRight MediumButton { style: ButtonStyle.tertiary - //: "Supprimer les traces" - text: qsTr("settings_debug_delete_logs_title") + //: "Supprimer les traces" + text: qsTr("settings_debug_delete_logs_title") onClicked: { - deleteLogs.open() + deleteLogs.open(); } } MediumButton { style: ButtonStyle.tertiary - //: "Partager les traces" - text: qsTr("settings_debug_share_logs_title") + //: "Partager les traces" + text: qsTr("settings_debug_share_logs_title") enabled: SettingsCpp.logsEnabled || SettingsCpp.fullLogsEnabled onClicked: { - //: "Téléversement des traces en cours …" - UtilsCpp.getMainWindow().showLoadingPopup(qsTr("settings_debug_share_logs_loading_message")) - SettingsCpp.sendLogs() + //: "Téléversement des traces en cours …" + UtilsCpp.getMainWindow().showLoadingPopup(qsTr("settings_debug_share_logs_loading_message")); + SettingsCpp.sendLogs(); } } } } } - + Component { - id: versionContent + id: versionContent ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) HelpIconLabelButton { enabled: false // Layout.preferredWidth: width @@ -126,7 +124,7 @@ AbstractSettingsLayout { //: "Version de l'application" title: qsTr("settings_debug_app_version_title") iconSource: AppIcons.appWindow - subTitle: AppCpp.applicationVersion + ' ('+ AppCpp.gitBranchName + ')' + subTitle: AppCpp.applicationVersion + ' (' + AppCpp.gitBranchName + ')' } HelpIconLabelButton { enabled: false @@ -150,18 +148,18 @@ AbstractSettingsLayout { } } } - + Connections { target: SettingsCpp function onLogsUploadTerminated(status, url) { - UtilsCpp.getMainWindow().closeLoadingPopup() + UtilsCpp.getMainWindow().closeLoadingPopup(); if (status) { - mainItem.logsUrl = url - shareLogs.open() + mainItem.logsUrl = url; + shareLogs.open(); } else { - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: "Le téléversement des traces a échoué. Vous pouvez partager les fichiers de trace directement depuis le répertoire suivant : %1" - qsTr("settings_debug_share_logs_error").arg(SettingsCpp.logsFolder), false) + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "Le téléversement des traces a échoué. Vous pouvez partager les fichiers de trace directement depuis le répertoire suivant : %1" + qsTr("settings_debug_share_logs_error").arg(SettingsCpp.logsFolder), false); } } } diff --git a/Linphone/view/Page/Layout/Settings/LdapSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/LdapSettingsLayout.qml index b1513bfe6..237db5035 100644 --- a/Linphone/view/Page/Layout/Settings/LdapSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/LdapSettingsLayout.qml @@ -6,16 +6,16 @@ import QtQuick.Dialogs import Linphone import SettingsCpp 1.0 import UtilsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle AbstractSettingsLayout { id: mainItem width: parent?.width contentModel: [ { - title: qsTr("settings_contacts_ldap_title"), - subTitle: qsTr("settings_contacts_ldap_subtitle"), + title: qsTr("settings_contacts_ldap_title"), + subTitle: qsTr("settings_contacts_ldap_subtitle"), contentComponent: ldapParametersComponent } ] @@ -23,74 +23,71 @@ AbstractSettingsLayout { topbarOptionalComponent: topBar property alias ldapGui: mainItem.model property bool isNew: false - + onSave: { if (ldapGui.core.isValid()) { - ldapGui.core.save() - UtilsCpp.showInformationPopup(qsTr("information_popup_success_title"), - //: "L'annuaire LDAP a été sauvegardé" - qsTr("settings_contacts_ldap_success_toast"), true, mainWindow) + ldapGui.core.save(); + UtilsCpp.showInformationPopup(qsTr("information_popup_success_title"), + //: "L'annuaire LDAP a été sauvegardé" + qsTr("settings_contacts_ldap_success_toast"), true, mainWindow); } else { - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: "Une erreur s'est produite, la configuration LDAP n'a pas été sauvegardée !" - qsTr("settings_contacts_ldap_error_toast"), false, mainWindow) + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "Une erreur s'est produite, la configuration LDAP n'a pas été sauvegardée !" + qsTr("settings_contacts_ldap_error_toast"), false, mainWindow); } } Component { id: topBar RowLayout { - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) Button { style: ButtonStyle.noBackground icon.source: AppIcons.trashCan - icon.width: Utils.getSizeWithScreenRatio(30) - icon.height: Utils.getSizeWithScreenRatio(30) + icon.width: Utils.getSizeWithScreenRatio(30) + icon.height: Utils.getSizeWithScreenRatio(30) Layout.preferredHeight: Utils.getSizeWithScreenRatio(38) Layout.preferredWidth: Utils.getSizeWithScreenRatio(38) visible: !isNew onClicked: { - var mainWin = UtilsCpp.getMainWindow() + var mainWin = UtilsCpp.getMainWindow(); mainWin.showConfirmationLambdaPopup("", - //: "Supprimer l'annuaire LDAP ?" - qsTr("settings_contacts_ldap_delete_confirmation_message"), - "", - function (confirmed) { - if (confirmed) { - ldapGui.core.remove() - mainItem.container.pop() - } - } - ) + //: "Supprimer l'annuaire LDAP ?" + qsTr("settings_contacts_ldap_delete_confirmation_message"), "", function (confirmed) { + if (confirmed) { + ldapGui.core.remove(); + mainItem.container.pop(); + } + }); } //: Delete LDAP server Accessible.name: qsTr("delete_ldap_server_accessible_name") } } } - + Component { id: ldapParametersComponent ColumnLayout { Layout.fillWidth: true - spacing: Utils.getSizeWithScreenRatio(20) - Layout.rightMargin: Utils.getSizeWithScreenRatio(44) - Layout.topMargin: Utils.getSizeWithScreenRatio(20) - Layout.leftMargin: Utils.getSizeWithScreenRatio(64) + spacing: Utils.getSizeWithScreenRatio(20) + Layout.rightMargin: Utils.getSizeWithScreenRatio(44) + Layout.topMargin: Utils.getSizeWithScreenRatio(20) + Layout.leftMargin: Utils.getSizeWithScreenRatio(64) DecoratedTextField { id: server propertyName: "serverUrl" propertyOwnerGui: ldapGui - //: "URL du serveur (ne peut être vide)" - title: qsTr("settings_contacts_ldap_server_url_title") + //: "URL du serveur (ne peut être vide)" + title: qsTr("settings_contacts_ldap_server_url_title") toValidate: true Layout.fillWidth: true } DecoratedTextField { propertyName: "bindDn" propertyOwnerGui: ldapGui - //: "Bind DN" - title: qsTr("settings_contacts_ldap_bind_dn_title") + //: "Bind DN" + title: qsTr("settings_contacts_ldap_bind_dn_title") toValidate: true Layout.fillWidth: true } @@ -98,96 +95,104 @@ AbstractSettingsLayout { propertyName: "password" hidden: true propertyOwnerGui: ldapGui - //: "Mot de passe" - title: qsTr("settings_contacts_ldap_password_title") + //: "Mot de passe" + title: qsTr("settings_contacts_ldap_password_title") toValidate: true Layout.fillWidth: true } SwitchSetting { - //: "Utiliser TLS" - titleText: qsTr("settings_contacts_ldap_use_tls_title") + //: "Utiliser TLS" + titleText: qsTr("settings_contacts_ldap_use_tls_title") propertyName: "tls" propertyOwnerGui: ldapGui } DecoratedTextField { propertyName: "baseObject" propertyOwnerGui: ldapGui - //: "Base de recherche (ne peut être vide)" - title: qsTr("settings_contacts_ldap_search_base_title") + //: "Base de recherche (ne peut être vide)" + title: qsTr("settings_contacts_ldap_search_base_title") toValidate: true Layout.fillWidth: true } DecoratedTextField { propertyName: "filter" propertyOwnerGui: ldapGui - //: "Filtre" - title: qsTr("settings_contacts_ldap_search_filter_title") + //: "Filtre" + title: qsTr("settings_contacts_ldap_search_filter_title") toValidate: true Layout.fillWidth: true } DecoratedTextField { propertyName: "limit" propertyOwnerGui: ldapGui - validator: RegularExpressionValidator { regularExpression: /[0-9]+/ } - //: "Nombre maximum de résultats" - title: qsTr("settings_contacts_ldap_max_results_title") + validator: RegularExpressionValidator { + regularExpression: /[0-9]+/ + } + //: "Nombre maximum de résultats" + title: qsTr("settings_contacts_ldap_max_results_title") toValidate: true Layout.fillWidth: true } DecoratedTextField { propertyName: "delay" propertyOwnerGui: ldapGui - validator: RegularExpressionValidator { regularExpression: /[0-9]+/ } - //: "Délai entre 2 requêtes (en millisecondes)" - title: qsTr("settings_contacts_ldap_request_delay_title") + validator: RegularExpressionValidator { + regularExpression: /[0-9]+/ + } + //: "Délai entre 2 requêtes (en millisecondes)" + title: qsTr("settings_contacts_ldap_request_delay_title") toValidate: true Layout.fillWidth: true } DecoratedTextField { propertyName: "timeout" propertyOwnerGui: ldapGui - //: "Durée maximun (en secondes)" - title: qsTr("settings_contacts_ldap_request_timeout_title") - validator: RegularExpressionValidator { regularExpression: /[0-9]+/ } + //: "Durée maximun (en secondes)" + title: qsTr("settings_contacts_ldap_request_timeout_title") + validator: RegularExpressionValidator { + regularExpression: /[0-9]+/ + } toValidate: true Layout.fillWidth: true } DecoratedTextField { propertyName: "minCharacters" propertyOwnerGui: ldapGui - //: "Nombre minimum de caractères pour la requête" - title: qsTr("settings_contacts_ldap_min_characters_title") - validator: RegularExpressionValidator { regularExpression: /[0-9]+/ } + //: "Nombre minimum de caractères pour la requête" + title: qsTr("settings_contacts_ldap_min_characters_title") + validator: RegularExpressionValidator { + regularExpression: /[0-9]+/ + } toValidate: true Layout.fillWidth: true } DecoratedTextField { propertyName: "nameAttribute" propertyOwnerGui: ldapGui - //: "Attributs de nom" - title: qsTr("settings_contacts_ldap_name_attributes_title") + //: "Attributs de nom" + title: qsTr("settings_contacts_ldap_name_attributes_title") toValidate: true Layout.fillWidth: true } DecoratedTextField { propertyName: "sipAttribute" propertyOwnerGui: ldapGui - //: "Attributs SIP" - title: qsTr("settings_contacts_ldap_sip_attributes_title") + //: "Attributs SIP" + title: qsTr("settings_contacts_ldap_sip_attributes_title") toValidate: true Layout.fillWidth: true } DecoratedTextField { propertyName: "sipDomain" propertyOwnerGui: ldapGui - //: "Domaine SIP" - title: qsTr("settings_contacts_ldap_sip_domain_title") + //: "Domaine SIP" + title: qsTr("settings_contacts_ldap_sip_domain_title") toValidate: true Layout.fillWidth: true } SwitchSetting { - //: "Débogage" - titleText: qsTr("settings_contacts_ldap_debug_title") + //: "Débogage" + titleText: qsTr("settings_contacts_ldap_debug_title") propertyName: "debug" propertyOwnerGui: ldapGui } diff --git a/Linphone/view/Page/Layout/Settings/MeetingsSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/MeetingsSettingsLayout.qml index 83d07327e..9ccdb1380 100644 --- a/Linphone/view/Page/Layout/Settings/MeetingsSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/MeetingsSettingsLayout.qml @@ -1,4 +1,3 @@ - import QtQuick import QtQuick.Layouts import QtQuick.Controls.Basic as Control @@ -12,8 +11,8 @@ AbstractSettingsLayout { width: parent?.width contentModel: [ { - //: "Affichage" - title: qsTr("settings_meetings_display_title"), + //: "Affichage" + title: qsTr("settings_meetings_display_title"), subTitle: "", contentComponent: confDisplayParametersComponent, hideTopMargin: true @@ -21,14 +20,14 @@ AbstractSettingsLayout { ] onSave: { - SettingsCpp.save() + SettingsCpp.save(); } onUndo: SettingsCpp.undo() Component { id: confDisplayParametersComponent ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(20) + spacing: Utils.getSizeWithScreenRatio(20) ColumnLayout { spacing: Utils.getSizeWithScreenRatio(5) Text { diff --git a/Linphone/view/Page/Layout/Settings/NetworkSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/NetworkSettingsLayout.qml index eb59f77de..4bd46b68e 100644 --- a/Linphone/view/Page/Layout/Settings/NetworkSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/NetworkSettingsLayout.qml @@ -1,4 +1,3 @@ - import QtQuick import QtQuick.Layouts import QtQuick.Controls.Basic as Control @@ -11,25 +10,25 @@ AbstractSettingsLayout { width: parent?.width contentModel: [ { - //: "Réseau" - title: qsTr("settings_network_title"), + //: "Réseau" + title: qsTr("settings_network_title"), subTitle: "", contentComponent: content } ] onSave: { - SettingsCpp.save() + SettingsCpp.save(); } onUndo: SettingsCpp.undo() - + Component { id: content ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(40) + spacing: Utils.getSizeWithScreenRatio(40) SwitchSetting { Layout.fillWidth: true - //: "Autoriser l'IPv6" - titleText: qsTr("settings_network_allow_ipv6") + //: "Autoriser l'IPv6" + titleText: qsTr("settings_network_allow_ipv6") propertyName: "ipv6Enabled" propertyOwner: SettingsCpp } diff --git a/Linphone/view/Page/Layout/Settings/SecuritySettingsLayout.qml b/Linphone/view/Page/Layout/Settings/SecuritySettingsLayout.qml index fa7def9a0..d89e57ef6 100644 --- a/Linphone/view/Page/Layout/Settings/SecuritySettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/SecuritySettingsLayout.qml @@ -1,4 +1,3 @@ - import QtQuick import QtQuick.Layouts import QtQuick.Controls.Basic as Control @@ -16,19 +15,19 @@ AbstractSettingsLayout { } ] onSave: { - SettingsCpp.save() + SettingsCpp.save(); } onUndo: SettingsCpp.undo() - + Component { id: content ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(40) + spacing: Utils.getSizeWithScreenRatio(40) SwitchSetting { - //: "Chiffrer tous les fichiers" - titleText: qsTr("settings_security_enable_vfs_title") - //: "Attention, vous ne pourrez pas revenir en arrière !" - subTitleText: qsTr("settings_security_enable_vfs_subtitle") + //: "Chiffrer tous les fichiers" + titleText: qsTr("settings_security_enable_vfs_title") + //: "Attention, vous ne pourrez pas revenir en arrière !" + subTitleText: qsTr("settings_security_enable_vfs_subtitle") propertyName: "vfsEnabled" propertyOwner: SettingsCpp } diff --git a/Linphone/view/Page/Main/AbstractMainPage.qml b/Linphone/view/Page/Main/AbstractMainPage.qml index 65b1e37d6..95bb2721a 100644 --- a/Linphone/view/Page/Main/AbstractMainPage.qml +++ b/Linphone/view/Page/Main/AbstractMainPage.qml @@ -8,7 +8,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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils FocusScope { @@ -23,25 +23,25 @@ FocusScope { property alias rightPanel: rightPanel property int rightPanelStackTopMargin: 0 property int rightPanelStackBottomMargin: 0 - signal noItemButtonPressed() + signal noItemButtonPressed Control.SplitView { id: splitView anchors.fill: parent - anchors.topMargin: Utils.getSizeWithScreenRatio(10) + anchors.topMargin: Utils.getSizeWithScreenRatio(10) handle: Rectangle { - implicitWidth: Utils.getSizeWithScreenRatio(6) + implicitWidth: Utils.getSizeWithScreenRatio(6) color: Control.SplitHandle.hovered ? DefaultStyle.main2_200 : DefaultStyle.grey_200 } ColumnLayout { id: leftPanel - spacing:0 + spacing: 0 // Control.SplitView.fillWidth:false Control.SplitView.fillHeight: true Control.SplitView.preferredWidth: Utils.getSizeWithScreenRatio(404) - Control.SplitView.minimumWidth: Utils.getSizeWithScreenRatio(200) - Control.SplitView.maximumWidth: Utils.getSizeWithScreenRatio(500) + Control.SplitView.minimumWidth: Utils.getSizeWithScreenRatio(200) + Control.SplitView.maximumWidth: Utils.getSizeWithScreenRatio(500) } Rectangle { id: rightPanel @@ -55,30 +55,30 @@ FocusScope { anchors.fill: parent ColumnLayout { id: defaultItem - + RowLayout { Layout.alignment: Qt.AlignHCenter Item { Layout.fillWidth: true } ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(30) + spacing: Utils.getSizeWithScreenRatio(30) Item { Layout.fillHeight: true } Image { Layout.alignment: Qt.AlignHCenter source: AppIcons.noItemImage - Layout.preferredWidth: Utils.getSizeWithScreenRatio(359) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(314) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(359) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(314) fillMode: Image.PreserveAspectFit } Text { text: mainItem.emptyListText Layout.alignment: Qt.AlignHCenter font { - pixelSize: Typography.h3.pixelSize - weight: Typography.h3.weight + pixelSize: Typography.h3.pixelSize + weight: Typography.h3.weight } } BigButton { @@ -86,7 +86,7 @@ FocusScope { icon.source: mainItem.newItemIconSource style: ButtonStyle.main text: mainItem.noItemButtonText - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) onPressed: mainItem.noItemButtonPressed() } Item { @@ -97,7 +97,6 @@ FocusScope { Layout.fillWidth: true } } - } Control.StackView { id: rightPanelStackView diff --git a/Linphone/view/Page/Main/Account/AccountListView.qml b/Linphone/view/Page/Main/Account/AccountListView.qml index 7affd9a22..86cfae008 100644 --- a/Linphone/view/Page/Main/Account/AccountListView.qml +++ b/Linphone/view/Page/Main/Account/AccountListView.qml @@ -7,10 +7,10 @@ import QtQuick.Dialogs import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle -ColumnLayout{ +ColumnLayout { id: mainItem anchors.top: parent.top anchors.topMargin: Utils.getSizeWithScreenRatio(23) @@ -20,17 +20,17 @@ ColumnLayout{ anchors.rightMargin: Utils.getSizeWithScreenRatio(24) anchors.bottom: parent.bottom anchors.bottomMargin: Utils.getSizeWithScreenRatio(23) - - signal addAccountRequest() - signal editAccount(AccountGui account) - readonly property var childrenWidth: Utils.getSizeWithScreenRatio(517) - readonly property real spacing: Utils.getSizeWithScreenRatio(16) + signal addAccountRequest + signal editAccount(AccountGui account) + readonly property var childrenWidth: Utils.getSizeWithScreenRatio(517) + + readonly property real spacing: Utils.getSizeWithScreenRatio(16) required property var getPreviousItem required property var getNextItem - property AccountProxy accountProxy + property AccountProxy accountProxy property var popupId - Component{ + Component { id: contactDelegate Contact { id: contactItem @@ -39,7 +39,7 @@ ColumnLayout{ isSelected: modelData && accountProxy.defaultAccount && modelData.core === accountProxy.defaultAccount.core onAvatarClicked: fileDialog.open() onBackgroundClicked: { - modelData.core.lSetDefaultAccount() + modelData.core.lSetDefaultAccount(); } onEdit: editAccount(modelData) hoverEnabled: true @@ -48,35 +48,31 @@ ColumnLayout{ id: fileDialog currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0] onAccepted: { - var avatarPath = UtilsCpp.createAvatar( selectedFile ) - if(avatarPath){ - modelData.core.pictureUri = avatarPath + var avatarPath = UtilsCpp.createAvatar(selectedFile); + if (avatarPath) { + modelData.core.pictureUri = avatarPath; } } } style: ButtonStyle.whiteSelected - KeyNavigation.up: visibleChildren.length - != 0 ? getPreviousItem( - index) : null - KeyNavigation.down: visibleChildren.length - != 0 ? getNextItem( - index) : null + KeyNavigation.up: visibleChildren.length != 0 ? getPreviousItem(index) : null + KeyNavigation.down: visibleChildren.length != 0 ? getNextItem(index) : null } } - Repeater{ + Repeater { model: AccountProxy { id: accountProxy } delegate: contactDelegate } - HorizontalBar{ + HorizontalBar { Layout.topMargin: mainItem.spacing Layout.bottomMargin: mainItem.spacing visible: addAccountButton.visible color: DefaultStyle.main2_300 } - IconLabelButton{ + IconLabelButton { id: addAccountButton Layout.fillWidth: true visible: SettingsCpp.maxAccount == 0 || SettingsCpp.maxAccount > accountProxy.count @@ -86,13 +82,7 @@ ColumnLayout{ icon.height: Utils.getSizeWithScreenRatio(32) //: Add an account text: qsTr("add_an_account") - KeyNavigation.up: visibleChildren.length - != 0 ? getPreviousItem( - AppCpp.accounts.getCount()) : null - KeyNavigation.down: visibleChildren.length - != 0 ? getNextItem( - AppCpp.accounts.getCount()) : null + KeyNavigation.up: visibleChildren.length != 0 ? getPreviousItem(AppCpp.accounts.getCount()) : null + KeyNavigation.down: visibleChildren.length != 0 ? getNextItem(AppCpp.accounts.getCount()) : null } } - - diff --git a/Linphone/view/Page/Main/Call/CallPage.qml b/Linphone/view/Page/Main/Call/CallPage.qml index d6ffb7bc3..0cf4a88ea 100644 --- a/Linphone/view/Page/Main/Call/CallPage.qml +++ b/Linphone/view/Page/Main/Call/CallPage.qml @@ -9,234 +9,228 @@ 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 - //: "Nouvel appel" - noItemButtonText: qsTr("history_call_start_title") - //: "Historique d'appel vide" - emptyListText: qsTr("call_history_empty_title") - newItemIconSource: AppIcons.newCall + id: mainItem + //: "Nouvel appel" + noItemButtonText: qsTr("history_call_start_title") + //: "Historique d'appel vide" + emptyListText: qsTr("call_history_empty_title") + newItemIconSource: AppIcons.newCall - property var selectedRowHistoryGui - signal listViewUpdated - signal goToCallForwardSettings + property var selectedRowHistoryGui + signal listViewUpdated + signal goToCallForwardSettings - onVisibleChanged: if (!visible) { - goToCallHistory() - } + onVisibleChanged: if (!visible) { + goToCallHistory(); + } - /** - * Focus on the first pertinent element in the page (LINQT-2202) - * @override - */ - function forceActiveFocus(reason = undefined){ - listStackView.currentItem?.newCallButton?.forceActiveFocus(reason) - } + /** + * Focus on the first pertinent element in the page (LINQT-2202) + * @override + */ + function forceActiveFocus(reason = undefined) { + listStackView.currentItem?.newCallButton?.forceActiveFocus(reason); + } - //Group call properties - property ConferenceInfoGui confInfoGui - property AccountProxy accounts: AccountProxy { - id: accountProxy - } - property AccountGui account: accountProxy.defaultAccount - property var state: account && account.core?.registrationState || 0 - property bool isRegistered: account ? account.core?.registrationState - == LinphoneEnums.RegistrationState.Ok : false - property int selectedParticipantsCount - signal createCallFromSearchBarRequested - signal createContactRequested(string name, string address) - signal openNumPadRequest + //Group call properties + property ConferenceInfoGui confInfoGui + property AccountProxy accounts: AccountProxy { + id: accountProxy + } + property AccountGui account: accountProxy.defaultAccount + property var state: account && account.core?.registrationState || 0 + property bool isRegistered: account ? account.core?.registrationState == LinphoneEnums.RegistrationState.Ok : false + property int selectedParticipantsCount + signal createCallFromSearchBarRequested + signal createContactRequested(string name, string address) + signal openNumPadRequest - property alias numericPadPopup: numericPadPopupItem + property alias numericPadPopup: numericPadPopupItem - Connections { - enabled: confInfoGui - target: confInfoGui ? confInfoGui.core : null - function onConferenceSchedulerStateChanged() { - if (confInfoGui.core.schedulerState === LinphoneEnums.ConferenceSchedulerState.Ready) { - listStackView.pop() - } - } - } + Connections { + enabled: confInfoGui + target: confInfoGui ? confInfoGui.core : null + function onConferenceSchedulerStateChanged() { + if (confInfoGui.core.schedulerState === LinphoneEnums.ConferenceSchedulerState.Ready) { + listStackView.pop(); + } + } + } - onSelectedRowHistoryGuiChanged: { - if (selectedRowHistoryGui) - rightPanelStackView.replace(contactDetailComp, - Control.StackView.Immediate) - else - rightPanelStackView.replace(emptySelection, - Control.StackView.Immediate) - } - rightPanelStackView.initialItem: emptySelection - rightPanelStackView.width: Utils.getSizeWithScreenRatio(360) + onSelectedRowHistoryGuiChanged: { + if (selectedRowHistoryGui) + rightPanelStackView.replace(contactDetailComp, Control.StackView.Immediate); + else + rightPanelStackView.replace(emptySelection, Control.StackView.Immediate); + } + rightPanelStackView.initialItem: emptySelection + rightPanelStackView.width: Utils.getSizeWithScreenRatio(360) - onNoItemButtonPressed: goToNewCall() + onNoItemButtonPressed: goToNewCall() - showDefaultItem: listStackView.currentItem - && listStackView.currentItem.objectName == "historyListItem" - && listStackView.currentItem.listView.count === 0 || false + showDefaultItem: listStackView.currentItem && listStackView.currentItem.objectName == "historyListItem" + && listStackView.currentItem.listView.count === 0 || false - function goToNewCall() { - if (listStackView.currentItem - && listStackView.currentItem.objectName != "newCallItem") - listStackView.push(newCallItem) - } - function goToCallHistory() { - if (listStackView.currentItem - && listStackView.currentItem.objectName != "historyListItem") - listStackView.replace(historyListItem) - } + function goToNewCall() { + if (listStackView.currentItem && listStackView.currentItem.objectName != "newCallItem") + listStackView.push(newCallItem); + } + function goToCallHistory() { + if (listStackView.currentItem && listStackView.currentItem.objectName != "historyListItem") + listStackView.replace(historyListItem); + } - Dialog { - id: deleteHistoryPopup - width: Utils.getSizeWithScreenRatio(637) - //: Supprimer l\'historique d\'appels ? - title: qsTr("history_dialog_delete_all_call_logs_title") - //: "L'ensemble de votre historique d'appels sera définitivement supprimé." - text: qsTr("history_dialog_delete_all_call_logs_message") - } - Dialog { - id: deleteForUserPopup - width: Utils.getSizeWithScreenRatio(637) - //: Supprimer l'historique d\'appels ? - title: qsTr("history_dialog_delete_call_logs_title") - //: "L\'ensemble de votre historique d\'appels avec ce correspondant sera définitivement supprimé." - text: qsTr("history_dialog_delete_call_logs_message") - } + Dialog { + id: deleteHistoryPopup + width: Utils.getSizeWithScreenRatio(637) + //: Supprimer l\'historique d\'appels ? + title: qsTr("history_dialog_delete_all_call_logs_title") + //: "L'ensemble de votre historique d'appels sera définitivement supprimé." + text: qsTr("history_dialog_delete_all_call_logs_message") + } + Dialog { + id: deleteForUserPopup + width: Utils.getSizeWithScreenRatio(637) + //: Supprimer l'historique d\'appels ? + title: qsTr("history_dialog_delete_call_logs_title") + //: "L\'ensemble de votre historique d\'appels avec ce correspondant sera définitivement supprimé." + text: qsTr("history_dialog_delete_call_logs_message") + } - leftPanelContent: Item { - id: leftPanel - Layout.fillWidth: true - Layout.fillHeight: true + leftPanelContent: Item { + id: leftPanel + Layout.fillWidth: true + Layout.fillHeight: true - Control.StackView { - id: listStackView - anchors.fill: parent - anchors.leftMargin: Utils.getSizeWithScreenRatio(45) - clip: true - initialItem: historyListItem - focus: true - onActiveFocusChanged: if (activeFocus) { - currentItem.forceActiveFocus() - } - } + Control.StackView { + id: listStackView + anchors.fill: parent + anchors.leftMargin: Utils.getSizeWithScreenRatio(45) + clip: true + initialItem: historyListItem + focus: true + onActiveFocusChanged: if (activeFocus) { + currentItem.forceActiveFocus(); + } + } - Item { - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - height: Utils.getSizeWithScreenRatio(402) - NumericPadPopup { - id: numericPadPopupItem - width: parent.width - height: parent.height - visible: false - onLaunchCall: { - mainItem.createCallFromSearchBarRequested() - } - } - } - } + Item { + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + height: Utils.getSizeWithScreenRatio(402) + NumericPadPopup { + id: numericPadPopupItem + width: parent.width + height: parent.height + visible: false + onLaunchCall: { + mainItem.createCallFromSearchBarRequested(); + } + } + } + } - Component { - id: historyListItem - FocusScope { - objectName: "historyListItem" - property alias listView: historyListView - property alias newCallButton: newCallButton + Component { + id: historyListItem + FocusScope { + objectName: "historyListItem" + property alias listView: historyListView + property alias newCallButton: newCallButton - ColumnLayout { - anchors.fill: parent - spacing: 0 - RowLayout { - id: titleCallLayout - // direction: FlexboxLayout.Row - spacing: Utils.getSizeWithScreenRatio(16) - // alignItems: FlexboxLayout.AlignCenter - Layout.rightMargin: Utils.getSizeWithScreenRatio(39) - Layout.fillHeight: false - Text { - Layout.fillWidth: true - //: "Appels" - text: qsTr("call_history_call_list_title") + ColumnLayout { + anchors.fill: parent + spacing: 0 + RowLayout { + id: titleCallLayout + // direction: FlexboxLayout.Row + spacing: Utils.getSizeWithScreenRatio(16) + // alignItems: FlexboxLayout.AlignCenter + Layout.rightMargin: Utils.getSizeWithScreenRatio(39) + Layout.fillHeight: false + Text { + Layout.fillWidth: true + //: "Appels" + text: qsTr("call_history_call_list_title") maximumLineCount: 1 - color: DefaultStyle.main2_700 - font.pixelSize: Typography.h2.pixelSize - font.weight: Typography.h2.weight - } - PopupButton { - id: removeHistory - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) - focus: true - popup.x: 0 - KeyNavigation.right: newCallButton - KeyNavigation.down: listStackView - //: Call history options - popUpTitle: qsTr("call_history_list_options_accessible_name") - popup.contentItem: ColumnLayout { - IconLabelButton { - Layout.fillWidth: true - focus: visible - //: "Supprimer l'historique" - text: qsTr("menu_delete_history") - icon.source: AppIcons.trashCan - style: ButtonStyle.hoveredBackgroundRed - onClicked: { - removeHistory.close() - deleteHistoryPopup.open() - } - } - } - Connections { - target: deleteHistoryPopup - onAccepted: { - if (listStackView.currentItem.listView) - listStackView.currentItem.listView.model.removeAllEntries() - } - } - } - Button { - id: newCallButton - focus: true - style: ButtonStyle.noBackground - icon.source: AppIcons.newCall - Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) - icon.width: Utils.getSizeWithScreenRatio(28) - icon.height: Utils.getSizeWithScreenRatio(28) - KeyNavigation.left: removeHistory - KeyNavigation.down: listStackView - //: Create new call - Accessible.name: qsTr("create_new_call_accessible_name") - onClicked: { - console.debug("[CallPage]User: create new call") - listStackView.push(newCallItem) - } - } - } - SearchBar { - id: searchBar - Layout.fillWidth: true - Layout.topMargin: Utils.getSizeWithScreenRatio(18) - Layout.rightMargin: Utils.getSizeWithScreenRatio(39) - //: "Rechercher un appel" - placeholderText: qsTr("call_search_in_history") - visible: historyListView.count !== 0 || text.length !== 0 - focus: true - KeyNavigation.up: newCallButton - KeyNavigation.down: historyListView - Binding { - target: mainItem - property: "showDefaultItem" - when: searchBar.text.length != 0 - value: false - } - Keys.onPressed: (event) => { - if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { - mainItem.createCallFromSearchBarRequested() - } - } - } + color: DefaultStyle.main2_700 + font.pixelSize: Typography.h2.pixelSize + font.weight: Typography.h2.weight + } + PopupButton { + id: removeHistory + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) + focus: true + popup.x: 0 + KeyNavigation.right: newCallButton + KeyNavigation.down: listStackView + //: Call history options + popUpTitle: qsTr("call_history_list_options_accessible_name") + popup.contentItem: ColumnLayout { + IconLabelButton { + Layout.fillWidth: true + focus: visible + //: "Supprimer l'historique" + text: qsTr("menu_delete_history") + icon.source: AppIcons.trashCan + style: ButtonStyle.hoveredBackgroundRed + onClicked: { + removeHistory.close(); + deleteHistoryPopup.open(); + } + } + } + Connections { + target: deleteHistoryPopup + onAccepted: { + if (listStackView.currentItem.listView) + listStackView.currentItem.listView.model.removeAllEntries(); + } + } + } + Button { + id: newCallButton + focus: true + style: ButtonStyle.noBackground + icon.source: AppIcons.newCall + Layout.preferredWidth: Utils.getSizeWithScreenRatio(34) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(34) + icon.width: Utils.getSizeWithScreenRatio(28) + icon.height: Utils.getSizeWithScreenRatio(28) + KeyNavigation.left: removeHistory + KeyNavigation.down: listStackView + //: Create new call + Accessible.name: qsTr("create_new_call_accessible_name") + onClicked: { + console.debug("[CallPage]User: create new call"); + listStackView.push(newCallItem); + } + } + } + SearchBar { + id: searchBar + Layout.fillWidth: true + Layout.topMargin: Utils.getSizeWithScreenRatio(18) + Layout.rightMargin: Utils.getSizeWithScreenRatio(39) + //: "Rechercher un appel" + placeholderText: qsTr("call_search_in_history") + visible: historyListView.count !== 0 || text.length !== 0 + focus: true + KeyNavigation.up: newCallButton + KeyNavigation.down: historyListView + Binding { + target: mainItem + property: "showDefaultItem" + when: searchBar.text.length != 0 + value: false + } + Keys.onPressed: event => { + if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { + mainItem.createCallFromSearchBarRequested(); + } + } + } Rectangle { visible: SettingsCpp.callForwardToAddress.length > 0 Layout.fillWidth: true @@ -259,7 +253,8 @@ AbstractMainPage { Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) } Text { - text: qsTr("call_forward_to_address_info") + (SettingsCpp.callForwardToAddress == 'voicemail' ? qsTr("call_forward_to_address_info_voicemail") : SettingsCpp.callForwardToAddress) + text: qsTr("call_forward_to_address_info") + (SettingsCpp.callForwardToAddress == 'voicemail' ? qsTr( + "call_forward_to_address_info_voicemail") : SettingsCpp.callForwardToAddress) color: DefaultStyle.warning_500_main font: Typography.p1 } @@ -269,471 +264,455 @@ AbstractMainPage { anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: { - goToCallForwardSettings() + goToCallForwardSettings(); } } } - Item { - Layout.fillWidth: true - Layout.fillHeight: true - Control.Control { - id: listLayout - anchors.fill: parent - anchors.rightMargin: Utils.getSizeWithScreenRatio(39) - padding: 0 - background: Item {} - contentItem: ColumnLayout { - Text { - visible: historyListView.count === 0 && !historyListView.loading - Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Utils.getSizeWithScreenRatio(137) - //: "Aucun résultat…" - text: searchBar.text.length != 0 ? qsTr("list_filter_no_result_found") - //: "Aucun appel dans votre historique" - : qsTr("history_list_empty_history") - font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight - } - } - CallHistoryListView { - id: historyListView - Layout.fillWidth: true - Layout.fillHeight: true - Layout.topMargin: Utils.getSizeWithScreenRatio(38) - searchBar: searchBar - Control.ScrollBar.vertical: scrollbar + Item { + Layout.fillWidth: true + Layout.fillHeight: true + Control.Control { + id: listLayout + anchors.fill: parent + anchors.rightMargin: Utils.getSizeWithScreenRatio(39) + padding: 0 + background: Item {} + contentItem: ColumnLayout { + Text { + visible: historyListView.count === 0 && !historyListView.loading + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: Utils.getSizeWithScreenRatio(137) + //: "Aucun résultat…" + text: searchBar.text.length != 0 ? qsTr("list_filter_no_result_found") : + //: "Aucun appel dans votre historique" + qsTr("history_list_empty_history") + font { + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight + } + } + CallHistoryListView { + id: historyListView + Layout.fillWidth: true + Layout.fillHeight: true + Layout.topMargin: Utils.getSizeWithScreenRatio(38) + searchBar: searchBar + Control.ScrollBar.vertical: scrollbar - Connections { - target: mainItem - function onListViewUpdated() { - historyListView.model.reload() - } - } - Binding { - target: mainItem - property: "showDefaultItem" - when: historyListView.loading - value: false - } - onCurrentIndexChanged: { - mainItem.selectedRowHistoryGui = model.getAt( - currentIndex) - } - onCountChanged: { - mainItem.selectedRowHistoryGui = model.getAt( - currentIndex) - } - } - } - } - ScrollBar { - id: scrollbar - visible: historyListView.contentHeight > parent.height - active: visible - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.rightMargin: Utils.getSizeWithScreenRatio(8) - policy: Control.ScrollBar.AsNeeded - } - } - - } - } - } + Connections { + target: mainItem + function onListViewUpdated() { + historyListView.model.reload(); + } + } + Binding { + target: mainItem + property: "showDefaultItem" + when: historyListView.loading + value: false + } + onCurrentIndexChanged: { + mainItem.selectedRowHistoryGui = model.getAt(currentIndex); + } + onCountChanged: { + mainItem.selectedRowHistoryGui = model.getAt(currentIndex); + } + } + } + } + ScrollBar { + id: scrollbar + visible: historyListView.contentHeight > parent.height + active: visible + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.rightMargin: Utils.getSizeWithScreenRatio(8) + policy: Control.ScrollBar.AsNeeded + } + } + } + } + } - Component { - id: newCallItem - FocusScope { - objectName: "newCallItem" - width: parent?.width - height: parent?.height - Control.StackView.onActivated: { - callContactsList.forceActiveFocus() - } - ColumnLayout { - anchors.fill: parent - spacing: 0 - RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) - Button { - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) - style: ButtonStyle.noBackground - icon.source: AppIcons.leftArrow - focus: true - KeyNavigation.down: listStackView - //: Return to call history - Accessible.name: qsTr("return_to_call_history_accessible_name") - onClicked: { - console.debug( - "[CallPage]User: return to call history") - listStackView.pop() - listStackView.forceActiveFocus() - } - } - Text { - Layout.fillWidth: true - //: "Nouvel appel" - text: qsTr("call_action_start_new_call") - color: DefaultStyle.main2_700 - font.pixelSize: Typography.h2.pixelSize - font.weight: Typography.h2.weight - } - Item { - Layout.fillWidth: true - } - } - NewCallForm { - id: callContactsList - Layout.topMargin: Utils.getSizeWithScreenRatio(18) - Layout.fillWidth: true - Layout.fillHeight: true - focus: true - numPadPopup: numericPadPopupItem - groupCallVisible: true - searchBarColor: DefaultStyle.grey_100 - onContactClicked: contact => { - mainWindow.startCallWithContact(contact, false, callContactsList) - } - onGroupCreationRequested: { - console.log("groupe call requetsed") - listStackView.push(groupCallItem) - } - Connections { - target: mainItem - function onCreateCallFromSearchBarRequested() { - UtilsCpp.createCall(callContactsList.searchBar.text) - } - } - } - } - } - } + Component { + id: newCallItem + FocusScope { + objectName: "newCallItem" + width: parent?.width + height: parent?.height + Control.StackView.onActivated: { + callContactsList.forceActiveFocus(); + } + ColumnLayout { + anchors.fill: parent + spacing: 0 + RowLayout { + spacing: Utils.getSizeWithScreenRatio(10) + Button { + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + style: ButtonStyle.noBackground + icon.source: AppIcons.leftArrow + focus: true + KeyNavigation.down: listStackView + //: Return to call history + Accessible.name: qsTr("return_to_call_history_accessible_name") + onClicked: { + console.debug("[CallPage]User: return to call history"); + listStackView.pop(); + listStackView.forceActiveFocus(); + } + } + Text { + Layout.fillWidth: true + //: "Nouvel appel" + text: qsTr("call_action_start_new_call") + color: DefaultStyle.main2_700 + font.pixelSize: Typography.h2.pixelSize + font.weight: Typography.h2.weight + } + Item { + Layout.fillWidth: true + } + } + NewCallForm { + id: callContactsList + Layout.topMargin: Utils.getSizeWithScreenRatio(18) + Layout.fillWidth: true + Layout.fillHeight: true + focus: true + numPadPopup: numericPadPopupItem + groupCallVisible: true + searchBarColor: DefaultStyle.grey_100 + onContactClicked: contact => { + mainWindow.startCallWithContact(contact, false, callContactsList); + } + onGroupCreationRequested: { + console.log("groupe call requetsed"); + listStackView.push(groupCallItem); + } + Connections { + target: mainItem + function onCreateCallFromSearchBarRequested() { + UtilsCpp.createCall(callContactsList.searchBar.text); + } + } + } + } + } + } - Component { - id: groupCallItem - GroupCreationFormLayout { - objectName: "groupCallItem" - //: "Appel de groupe" - formTitle: qsTr("call_start_group_call_title") - //: "Lancer" - createGroupButtonText: qsTr("call_action_start_group_call") - Control.StackView.onActivated: { - addParticipantsLayout.forceActiveFocus() - } - onReturnRequested: { - listStackView.pop() - listStackView.currentItem?.forceActiveFocus() - } - onGroupCreationRequested: { - if (groupName.text.length === 0) { - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: "Un nom doit être donné à l'appel de groupe - qsTr("group_call_error_must_have_name"), false) - } else if (!mainItem.isRegistered) { - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: "Vous n'etes pas connecté" - qsTr("group_call_error_not_connected"), false) - } else { - UtilsCpp.createGroupCall(groupName.text, addParticipantsLayout.selectedParticipants) - } - } - } - } + Component { + id: groupCallItem + GroupCreationFormLayout { + objectName: "groupCallItem" + //: "Appel de groupe" + formTitle: qsTr("call_start_group_call_title") + //: "Lancer" + createGroupButtonText: qsTr("call_action_start_group_call") + Control.StackView.onActivated: { + addParticipantsLayout.forceActiveFocus(); + } + onReturnRequested: { + listStackView.pop(); + listStackView.currentItem?.forceActiveFocus(); + } + onGroupCreationRequested: { + if (groupName.text.length === 0) { + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "Un nom doit être donné à l'appel de groupe + qsTr("group_call_error_must_have_name"), false); + } else if (!mainItem.isRegistered) { + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "Vous n'etes pas connecté" + qsTr("group_call_error_not_connected"), false); + } else { + UtilsCpp.createGroupCall(groupName.text, addParticipantsLayout.selectedParticipants); + } + } + } + } - Component { - id: emptySelection - Item { - objectName: "emptySelection" - } - } - Component { - id: contactDetailComp - FocusScope { - CallHistoryLayout { - id: contactDetail - anchors.fill: parent - anchors.topMargin: Utils.getSizeWithScreenRatio(45) - anchors.bottomMargin: Utils.getSizeWithScreenRatio(45) - visible: mainItem.selectedRowHistoryGui != undefined - callHistoryGui: selectedRowHistoryGui + Component { + id: emptySelection + Item { + objectName: "emptySelection" + } + } + Component { + id: contactDetailComp + FocusScope { + CallHistoryLayout { + id: contactDetail + anchors.fill: parent + anchors.topMargin: Utils.getSizeWithScreenRatio(45) + anchors.bottomMargin: Utils.getSizeWithScreenRatio(45) + visible: mainItem.selectedRowHistoryGui != undefined + callHistoryGui: selectedRowHistoryGui - property var contactObj: UtilsCpp.findFriendByAddress(specificAddress) - contact: contactObj && contactObj.value || null - specificAddress: callHistoryGui - && callHistoryGui.core.remoteAddress || "" - property bool isLocalFriend: contact ? contact.core.isAppFriend : false + property var contactObj: UtilsCpp.findFriendByAddress(specificAddress) + contact: contactObj && contactObj.value || null + specificAddress: callHistoryGui && callHistoryGui.core.remoteAddress || "" + property bool isLocalFriend: contact ? contact.core.isAppFriend : false - buttonContent: PopupButton { - id: detailOptions - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - popUpTitle: qsTr("call_history_options_accessible_name") - popup.x: width - popup.contentItem: FocusScope { - implicitHeight: detailsButtons.implicitHeight - implicitWidth: detailsButtons.implicitWidth - Keys.onPressed: event => { - if (event.key == Qt.Key_Left - || event.key == Qt.Key_Escape) { - detailOptions.popup.close() - event.accepted = true - } - } - ColumnLayout { - id: detailsButtons - anchors.fill: parent - IconLabelButton { - id: addContactButton - Layout.fillWidth: true - //: "Show contact" - text: contactDetail.isLocalFriend ? qsTr("menu_see_existing_contact") : - //: "Add to contacts" - qsTr("menu_add_address_to_contacts") - icon.source: AppIcons.plusCircle - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - onClicked: { - detailOptions.close() - if (contactDetail.isLocalFriend) - mainWindow.displayContactPage(contactDetail.contactAddress) - else - mainItem.createContactRequested(contactDetail.contactName, contactDetail.contactAddress) - } - KeyNavigation.up: visibleChildren.length - != 0 ? detailOptions.getPreviousItem( - 0) : null - KeyNavigation.down: visibleChildren.length - != 0 ? detailOptions.getNextItem( - 0) : null - } - IconLabelButton { - id: copySIPAddressButton - Layout.fillWidth: true - //: "Copier l'adresse SIP" - text: qsTr("menu_copy_sip_address") - icon.source: AppIcons.copy - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - onClicked: { - detailOptions.close() - var success = UtilsCpp.copyToClipboard( - mainItem.selectedRowHistoryGui - && mainItem.selectedRowHistoryGui.core.remoteAddress) - if (success) - UtilsCpp.showInformationPopup( - //: Adresse copiée - qsTr("sip_address_copied_to_clipboard_toast"), - //: L'adresse a été copié dans le presse_papiers - qsTr("sip_address_copied_to_clipboard_message"), - true) - else - UtilsCpp.showInformationPopup( - qsTr("information_popup_error_title"), - //: "Erreur lors de la copie de l'adresse" - qsTr("sip_address_copy_to_clipboard_error"), - false) - } - KeyNavigation.up: visibleChildren.length - != 0 ? detailOptions.getPreviousItem( - 1) : null - KeyNavigation.down: visibleChildren.length - != 0 ? detailOptions.getNextItem( - 1) : null - } - // IconLabelButton { - // background: Item {} - // enabled: false - // contentItem: IconLabel { - // text: qsTr("Bloquer") - // iconSource: AppIcons.empty - // } - // onClicked: console.debug("[CallPage.qml] TODO : block user") - // } - Rectangle { - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(2) - color: DefaultStyle.main2_400 - } + buttonContent: PopupButton { + id: detailOptions + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + popUpTitle: qsTr("call_history_options_accessible_name") + popup.x: width + popup.contentItem: FocusScope { + implicitHeight: detailsButtons.implicitHeight + implicitWidth: detailsButtons.implicitWidth + Keys.onPressed: event => { + if (event.key == Qt.Key_Left || event.key == Qt.Key_Escape) { + detailOptions.popup.close(); + event.accepted = true; + } + } + ColumnLayout { + id: detailsButtons + anchors.fill: parent + IconLabelButton { + id: addContactButton + Layout.fillWidth: true + //: "Show contact" + text: contactDetail.isLocalFriend ? qsTr("menu_see_existing_contact") : + //: "Add to contacts" + qsTr("menu_add_address_to_contacts") + icon.source: AppIcons.plusCircle + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + onClicked: { + detailOptions.close(); + if (contactDetail.isLocalFriend) + mainWindow.displayContactPage(contactDetail.contactAddress); + else + mainItem.createContactRequested(contactDetail.contactName, contactDetail.contactAddress); + } + KeyNavigation.up: visibleChildren.length != 0 ? detailOptions.getPreviousItem(0) : null + KeyNavigation.down: visibleChildren.length != 0 ? detailOptions.getNextItem(0) : null + } + IconLabelButton { + id: copySIPAddressButton + Layout.fillWidth: true + //: "Copier l'adresse SIP" + text: qsTr("menu_copy_sip_address") + icon.source: AppIcons.copy + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + onClicked: { + detailOptions.close(); + var success = UtilsCpp.copyToClipboard(mainItem.selectedRowHistoryGui + && mainItem.selectedRowHistoryGui.core.remoteAddress); + if (success) + UtilsCpp.showInformationPopup( + //: Adresse copiée + qsTr("sip_address_copied_to_clipboard_toast"), + //: L'adresse a été copié dans le presse_papiers + qsTr("sip_address_copied_to_clipboard_message"), true); + else + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "Erreur lors de la copie de l'adresse" + qsTr("sip_address_copy_to_clipboard_error"), false); + } + KeyNavigation.up: visibleChildren.length != 0 ? detailOptions.getPreviousItem(1) : null + KeyNavigation.down: visibleChildren.length != 0 ? detailOptions.getNextItem(1) : null + } + // IconLabelButton { + // background: Item {} + // enabled: false + // contentItem: IconLabel { + // text: qsTr("Bloquer") + // iconSource: AppIcons.empty + // } + // onClicked: console.debug("[CallPage.qml] TODO : block user") + // } + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(2) + color: DefaultStyle.main2_400 + } - IconLabelButton { - id: deleteHistoryButton - Layout.fillWidth: true - //: "Supprimer l'historique" - text: qsTr("menu_delete_history") - icon.source: AppIcons.trashCan - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - style: ButtonStyle.hoveredBackgroundRed - Connections { - target: deleteForUserPopup - function onAccepted() { - detailListView.model.removeEntriesWithFilter( - detailListView.searchText) - mainItem.listViewUpdated() - } - } - onClicked: { - detailOptions.close() - deleteForUserPopup.open() - } - KeyNavigation.up: visibleChildren.length - != 0 ? detailOptions.getPreviousItem( - 2) : null - KeyNavigation.down: visibleChildren.length - != 0 ? detailOptions.getNextItem( - 2) : null - } - } - } - } - onConferenceChatDisplayRequested: detailContentStack.currentIndex = 1 - onConferenceCallHistoryDisplayRequested: detailContentStack.currentIndex = 0 - detailContent: Item { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) - Layout.fillHeight: true - RoundedPane { - id: detailControl - visible: detailContentStack.currentIndex !== 0 || detailListView.count > 0 - width: parent.width - height: detailContentStack.currentIndex === 0 - ? Math.min(parent.height, detailListView.contentHeight) + topPadding + bottomPadding - : parent.height - background: Rectangle { - id: detailListBackground - anchors.fill: parent - color: DefaultStyle.grey_0 - radius: Utils.getSizeWithScreenRatio(15) - } + IconLabelButton { + id: deleteHistoryButton + Layout.fillWidth: true + //: "Supprimer l'historique" + text: qsTr("menu_delete_history") + icon.source: AppIcons.trashCan + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + style: ButtonStyle.hoveredBackgroundRed + Connections { + target: deleteForUserPopup + function onAccepted() { + detailListView.model.removeEntriesWithFilter(detailListView.searchText); + mainItem.listViewUpdated(); + } + } + onClicked: { + detailOptions.close(); + deleteForUserPopup.open(); + } + KeyNavigation.up: visibleChildren.length != 0 ? detailOptions.getPreviousItem(2) : null + KeyNavigation.down: visibleChildren.length != 0 ? detailOptions.getNextItem(2) : null + } + } + } + } + onConferenceChatDisplayRequested: detailContentStack.currentIndex = 1 + onConferenceCallHistoryDisplayRequested: detailContentStack.currentIndex = 0 + detailContent: Item { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(360) + Layout.fillHeight: true + RoundedPane { + id: detailControl + visible: detailContentStack.currentIndex !== 0 || detailListView.count > 0 + width: parent.width + height: detailContentStack.currentIndex === 0 ? Math.min(parent.height, detailListView.contentHeight) + + topPadding + bottomPadding : parent.height + background: Rectangle { + id: detailListBackground + anchors.fill: parent + color: DefaultStyle.grey_0 + radius: Utils.getSizeWithScreenRatio(15) + } - contentItem: StackLayout { - id: detailContentStack - currentIndex: 0 - Control.ScrollView { - id: historyScrollView - Control.ScrollBar.vertical: ScrollBar { - id: historyScrollBar - visible: historyScrollView.contentHeight > historyScrollView.height - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - } - CallHistoryListView { - id: detailListView - Layout.fillWidth: true - Layout.fillHeight: true - Layout.rightMargin: historyScrollBar.width + Utils.getSizeWithScreenRatio(8) - spacing: Utils.getSizeWithScreenRatio(14) - clip: true - searchText: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.remoteAddress : "" - busyIndicatorSize: Utils.getSizeWithScreenRatio(40) + contentItem: StackLayout { + id: detailContentStack + currentIndex: 0 + Control.ScrollView { + id: historyScrollView + Control.ScrollBar.vertical: ScrollBar { + id: historyScrollBar + visible: historyScrollView.contentHeight > historyScrollView.height + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: parent.right + } + CallHistoryListView { + id: detailListView + Layout.fillWidth: true + Layout.fillHeight: true + Layout.rightMargin: historyScrollBar.width + Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(14) + clip: true + searchText: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.remoteAddress : "" + busyIndicatorSize: Utils.getSizeWithScreenRatio(40) - delegate: Item { - width: detailListView.width - height: Utils.getSizeWithScreenRatio(56) - RowLayout { - anchors.fill: parent - anchors.leftMargin: Utils.getSizeWithScreenRatio(20) - anchors.rightMargin: Utils.getSizeWithScreenRatio(20) - anchors.verticalCenter: parent.verticalCenter - ColumnLayout { - Layout.alignment: Qt.AlignVCenter - RowLayout { - EffectImage { - id: statusIcon - imageSource: modelData.core.status - === LinphoneEnums.CallStatus.Declined - || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted ? AppIcons.arrowElbow : modelData.core.isOutgoing ? AppIcons.arrowUpRight : AppIcons.arrowDownLeft - colorizationColor: modelData.core.status === LinphoneEnums.CallStatus.Declined || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted || modelData.core.status === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500_main : modelData.core.isOutgoing ? DefaultStyle.info_500_main : DefaultStyle.success_500_main - Layout.preferredWidth: Utils.getSizeWithScreenRatio(16) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(16) - transform: Rotation { - angle: modelData.core.isOutgoing - && (modelData.core.status === LinphoneEnums.CallStatus.Declined || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0 - origin { - x: statusIcon.width / 2 - y: statusIcon.height / 2 - } - } - } - Text { - //: "Appel manqué" - text: modelData.core.status === LinphoneEnums.CallStatus.Missed ? qsTr("notification_missed_call_title") - : modelData.core.isOutgoing - //: "Appel sortant" - ? qsTr("call_outgoing") - //: "Appel entrant" - : qsTr("call_audio_incoming") - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } - } - } - Text { - text: UtilsCpp.formatDate(modelData.core.date) - color: modelData.core.status === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500_main : DefaultStyle.main2_500_main - font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(300) - } - } - } - Item { - Layout.fillHeight: true - Layout.fillWidth: true - } - Text { - text: UtilsCpp.formatElapsedTime( - modelData.core.duration, - false) - font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(300) - } - } - } - } - } - } - SelectedChatView { - Layout.fillWidth: true - Layout.fillHeight: true - chat: contactDetail.callHistoryGui.core.chatGui - } - } - } - } - Item { - Layout.fillHeight: true - } - } - } - } + delegate: Item { + width: detailListView.width + height: Utils.getSizeWithScreenRatio(56) + RowLayout { + anchors.fill: parent + anchors.leftMargin: Utils.getSizeWithScreenRatio(20) + anchors.rightMargin: Utils.getSizeWithScreenRatio(20) + anchors.verticalCenter: parent.verticalCenter + ColumnLayout { + Layout.alignment: Qt.AlignVCenter + RowLayout { + EffectImage { + id: statusIcon + imageSource: modelData.core.status === LinphoneEnums.CallStatus.Declined || modelData.core.status + === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status + === LinphoneEnums.CallStatus.Aborted || modelData.core.status + === LinphoneEnums.CallStatus.EarlyAborted ? AppIcons.arrowElbow : modelData.core.isOutgoing + ? AppIcons.arrowUpRight : AppIcons.arrowDownLeft + colorizationColor: modelData.core.status === LinphoneEnums.CallStatus.Declined || modelData.core.status + === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status + === LinphoneEnums.CallStatus.Aborted || modelData.core.status + === LinphoneEnums.CallStatus.EarlyAborted || modelData.core.status + === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500_main : modelData.core.isOutgoing + ? DefaultStyle.info_500_main : DefaultStyle.success_500_main + Layout.preferredWidth: Utils.getSizeWithScreenRatio(16) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(16) + transform: Rotation { + angle: modelData.core.isOutgoing && (modelData.core.status === LinphoneEnums.CallStatus.Declined + || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere + || modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status + === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0 + origin { + x: statusIcon.width / 2 + y: statusIcon.height / 2 + } + } + } + Text { + //: "Appel manqué" + text: modelData.core.status === LinphoneEnums.CallStatus.Missed ? qsTr("notification_missed_call_title") : + modelData.core.isOutgoing ? + //: "Appel sortant" + qsTr("call_outgoing") : + //: "Appel entrant" + qsTr("call_audio_incoming") + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + } + } + Text { + text: UtilsCpp.formatDate(modelData.core.date) + color: modelData.core.status === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500_main : + DefaultStyle.main2_500_main + font { + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) + } + } + } + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + Text { + text: UtilsCpp.formatElapsedTime(modelData.core.duration, false) + font { + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) + } + } + } + } + } + } + SelectedChatView { + Layout.fillWidth: true + Layout.fillHeight: true + chat: contactDetail.callHistoryGui.core.chatGui + } + } + } + } + Item { + Layout.fillHeight: true + } + } + } + } - component IconLabel: RowLayout { - id: iconLabel - property string text - property string iconSource - property color colorizationColor: DefaultStyle.main2_500_main - EffectImage { - imageSource: iconLabel.iconSource - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - fillMode: Image.PreserveAspectFit - colorizationColor: iconLabel.colorizationColor - } - Text { - text: iconLabel.text - color: iconLabel.colorizationColor - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } - } - } + component IconLabel: RowLayout { + id: iconLabel + property string text + property string iconSource + property color colorizationColor: DefaultStyle.main2_500_main + EffectImage { + imageSource: iconLabel.iconSource + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + fillMode: Image.PreserveAspectFit + colorizationColor: iconLabel.colorizationColor + } + Text { + text: iconLabel.text + color: iconLabel.colorizationColor + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + } + } } diff --git a/Linphone/view/Page/Main/Call/CallSettingsPanel.qml b/Linphone/view/Page/Main/Call/CallSettingsPanel.qml index 27671a2df..2cc08a673 100644 --- a/Linphone/view/Page/Main/Call/CallSettingsPanel.qml +++ b/Linphone/view/Page/Main/Call/CallSettingsPanel.qml @@ -2,8 +2,8 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls.Basic as Control import Linphone -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils +import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle Control.Page { id: mainItem @@ -19,36 +19,36 @@ Control.Page { property string headerTitleText property string headerSubtitleText property string headerValidateButtonText - signal returnRequested() - signal validateRequested() + signal returnRequested + signal validateRequested - topPadding: Utils.getSizeWithScreenRatio(20) - bottomPadding: Utils.getSizeWithScreenRatio(20) - leftPadding: Utils.getSizeWithScreenRatio(17) - rightPadding: Utils.getSizeWithScreenRatio(5) + 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: Utils.getSizeWithScreenRatio(15) + radius: Utils.getSizeWithScreenRatio(15) } - + header: Control.Control { id: pageHeader width: mainItem.width - height: Utils.getSizeWithScreenRatio(67) - leftPadding: Utils.getSizeWithScreenRatio(10) - rightPadding: Utils.getSizeWithScreenRatio(10) + 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: Utils.getSizeWithScreenRatio(15) + radius: Utils.getSizeWithScreenRatio(15) Rectangle { - y: pageHeader.height/2 - height: pageHeader.height/2 + y: pageHeader.height / 2 + height: pageHeader.height / 2 width: pageHeader.width } } @@ -56,7 +56,7 @@ Control.Page { id: headerStack RowLayout { Layout.alignment: Qt.AlignVCenter - spacing: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) Text { text: mainItem.headerTitleText Layout.fillWidth: true @@ -67,8 +67,8 @@ Control.Page { verticalAlignment: Text.AlignVCenter color: DefaultStyle.main1_500_main font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight } } RowLayout { @@ -82,17 +82,17 @@ Control.Page { onClicked: mainItem.visible = false //: Close %1 panel Accessible.name: qsTr("close_name_panel_accessible_button").arg(mainItem.headerTitleText) - KeyNavigation.tab : firstContentFocusableItem ?? nextItemInFocusChain() + KeyNavigation.tab: firstContentFocusableItem ?? nextItemInFocusChain() } } RowLayout { Layout.alignment: Qt.AlignVCenter - spacing: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) Button { style: ButtonStyle.noBackgroundOrange icon.source: AppIcons.leftArrow - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) onClicked: mainItem.returnRequested() } ColumnLayout { @@ -103,19 +103,19 @@ Control.Page { text: mainItem.headerTitleText color: DefaultStyle.main1_500_main font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight } } Text { - Layout.alignment: Qt.AlignVCenter - verticalAlignment: Text.AlignVCenter + Layout.alignment: Qt.AlignVCenter + verticalAlignment: Text.AlignVCenter text: mainItem.headerSubtitleText color: DefaultStyle.main2_500_main font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(300) } } } @@ -142,7 +142,7 @@ Control.Page { anchors.bottom: scrollview.bottom visible: contentControl.height > scrollview.height } - Control.ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + Control.ScrollBar.horizontal.policy: ScrollBar.AlwaysOff Control.Control { id: contentControl rightPadding: scrollbar.width + Utils.getSizeWithScreenRatio(10) diff --git a/Linphone/view/Page/Main/Call/WaitingRoom.qml b/Linphone/view/Page/Main/Call/WaitingRoom.qml index c6f0f5b1c..bbc789c47 100644 --- a/Linphone/view/Page/Main/Call/WaitingRoom.qml +++ b/Linphone/view/Page/Main/Call/WaitingRoom.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Basic as Control import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 { @@ -15,20 +15,20 @@ RowLayout { property alias settingsButtonChecked: settingsButton.checked property ConferenceInfoGui conferenceInfo signal joinConfRequested(string uri) - signal cancelJoiningRequested() - signal cancelAfterJoinRequested() + signal cancelJoiningRequested + signal cancelAfterJoinRequested RowLayout { Layout.fillWidth: false Layout.fillHeight: false - spacing: Utils.getSizeWithScreenRatio(100) + spacing: Utils.getSizeWithScreenRatio(100) Layout.alignment: Qt.AlignCenter ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(31) + spacing: Utils.getSizeWithScreenRatio(31) Sticker { id: preview previewEnabled: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(330) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(558) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(330) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(558) qmlName: "WP" displayAll: false displayPresence: false @@ -38,68 +38,68 @@ RowLayout { } account: accounts.defaultAccount } - RowLayout { - Layout.alignment: Qt.AlignHCenter - spacing: Utils.getSizeWithScreenRatio(16) - CheckableButton { - id: videoButton - visible: SettingsCpp.videoEnabled - iconUrl: AppIcons.videoCamera - checkedIconUrl: AppIcons.videoCameraSlash - checked: !mainItem.localVideoEnabled - 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: 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: 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: Utils.getSizeWithScreenRatio(55) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - } - } - } + RowLayout { + Layout.alignment: Qt.AlignHCenter + spacing: Utils.getSizeWithScreenRatio(16) + CheckableButton { + id: videoButton + visible: SettingsCpp.videoEnabled + iconUrl: AppIcons.videoCamera + checkedIconUrl: AppIcons.videoCameraSlash + checked: !mainItem.localVideoEnabled + 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: 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: 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: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + } + } + } StackLayout { id: stackLayout currentIndex: 0 ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(93) + spacing: Utils.getSizeWithScreenRatio(93) ColumnLayout { - Layout.topMargin: Utils.getSizeWithScreenRatio(54) + Layout.topMargin: Utils.getSizeWithScreenRatio(54) spacing: 0 Text { Layout.fillWidth: true - //: Participer à : - text: qsTr("meeting_waiting_room_title") + //: Participer à : + text: qsTr("meeting_waiting_room_title") color: DefaultStyle.grey_0 font { - pixelSize: Utils.getSizeWithScreenRatio(30) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(30) + weight: Utils.getSizeWithScreenRatio(300) } } Text { @@ -107,75 +107,75 @@ RowLayout { text: mainItem.conferenceInfo && mainItem.conferenceInfo.core.subject color: DefaultStyle.grey_0 font { - pixelSize: Utils.getSizeWithScreenRatio(30) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(30) + weight: Utils.getSizeWithScreenRatio(300) } } } ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(5) + spacing: Utils.getSizeWithScreenRatio(5) BigButton { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(292) - //: "Rejoindre" - text: qsTr("meeting_waiting_room_join") + Layout.preferredWidth: Utils.getSizeWithScreenRatio(292) + //: "Rejoindre" + text: qsTr("meeting_waiting_room_join") style: ButtonStyle.main onClicked: { - settingsButton.checked = false - stackLayout.currentIndex = 1 - mainItem.joinConfRequested(mainItem.conferenceInfo.core.uri) + settingsButton.checked = false; + stackLayout.currentIndex = 1; + mainItem.joinConfRequested(mainItem.conferenceInfo.core.uri); } } BigButton { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(292) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(292) style: ButtonStyle.secondary - text: qsTr("cancel") + text: qsTr("cancel") onClicked: { - mainItem.cancelJoiningRequested() + mainItem.cancelJoiningRequested(); } } } } ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(37) + spacing: Utils.getSizeWithScreenRatio(37) ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(13) + spacing: Utils.getSizeWithScreenRatio(13) Text { Layout.fillWidth: true - //: "Connexion à la réunion" - text: qsTr("meeting_waiting_room_joining_title") + //: "Connexion à la réunion" + text: qsTr("meeting_waiting_room_joining_title") color: DefaultStyle.grey_0 font { - pixelSize: Utils.getSizeWithScreenRatio(30) - weight: Utils.getSizeWithScreenRatio(300) + pixelSize: Utils.getSizeWithScreenRatio(30) + weight: Utils.getSizeWithScreenRatio(300) } } Text { Layout.fillWidth: true - //: "Vous allez rejoindre la réunion dans quelques instants…" - text: qsTr("meeting_waiting_room_joining_subtitle") + //: "Vous allez rejoindre la réunion dans quelques instants…" + text: qsTr("meeting_waiting_room_joining_subtitle") color: DefaultStyle.grey_0 font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight } } } BusyIndicator { indicatorColor: DefaultStyle.main1_500_main Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: Utils.getSizeWithScreenRatio(48) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(48) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(48) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(48) } BigButton { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(292) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(292) Layout.alignment: Qt.AlignHCenter style: ButtonStyle.main //: Cancel - text: qsTr("cancel") + text: qsTr("cancel") onClicked: { - settingsButton.checked = false - stackLayout.currentIndex = 1 - mainItem.cancelAfterJoinRequested() + settingsButton.checked = false; + stackLayout.currentIndex = 1; + mainItem.cancelAfterJoinRequested(); } } } diff --git a/Linphone/view/Page/Main/Chat/ChatPage.qml b/Linphone/view/Page/Main/Chat/ChatPage.qml index e141a6adf..bef83c38e 100644 --- a/Linphone/view/Page/Main/Chat/ChatPage.qml +++ b/Linphone/view/Page/Main/Chat/ChatPage.qml @@ -9,428 +9,431 @@ 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 - //: "Nouvelle conversation" - noItemButtonText: qsTr("chat_start_title") - //: "Aucune conversation" - emptyListText: qsTr("chat_empty_title") - newItemIconSource: AppIcons.plusCircle + id: mainItem + //: "Nouvelle conversation" + noItemButtonText: qsTr("chat_start_title") + //: "Aucune conversation" + emptyListText: qsTr("chat_empty_title") + newItemIconSource: AppIcons.plusCircle - /** - * Focus on the first pertinent element in the page (LINQT-2202) - * @override - */ - function forceActiveFocus(reason = undefined){ - listStackView.currentItem?.newChatButton?.forceActiveFocus(reason) - } + /** + * Focus on the first pertinent element in the page (LINQT-2202) + * @override + */ + function forceActiveFocus(reason = undefined) { + listStackView.currentItem?.newChatButton?.forceActiveFocus(reason); + } - property AccountProxy accounts: AccountProxy { - id: accountProxy - } - property AccountGui account: accountProxy.defaultAccount - property var state: account && account.core?.registrationState || 0 - property bool isRegistered: account ? account.core?.registrationState - == LinphoneEnums.RegistrationState.Ok : false + property AccountProxy accounts: AccountProxy { + id: accountProxy + } + property AccountGui account: accountProxy.defaultAccount + property var state: account && account.core?.registrationState || 0 + property bool isRegistered: account ? account.core?.registrationState == LinphoneEnums.RegistrationState.Ok : false - property var selectedChatGui: null - property string remoteAddress - onRemoteAddressChanged: console.log("ChatPage : remote address changed :", remoteAddress) - property var remoteChatObj: remoteAddress.length > 0 ? UtilsCpp.getChatForAddress(remoteAddress) : null - property var remoteChat: remoteChatObj ? remoteChatObj.value : null + property var selectedChatGui: null + property string remoteAddress + onRemoteAddressChanged: console.log("ChatPage : remote address changed :", remoteAddress) + property var remoteChatObj: remoteAddress.length > 0 ? UtilsCpp.getChatForAddress(remoteAddress) : null + property var remoteChat: remoteChatObj ? remoteChatObj.value : null - signal openChatRequested(ChatGui chat) + signal openChatRequested(ChatGui chat) - Connections { - enabled: remoteChat !== null - target: remoteChat ? remoteChat.core : null - function onChatRoomStateChanged() { - if (remoteChat.core.state === LinphoneEnums.ChatRoomState.CreationPending) { - //: Chat room is being created... - mainWindow.showLoadingPopup(qsTr("loading_popup_chatroom_creation_pending_message")) - } else { - mainWindow.closeLoadingPopup() - if (remoteChat.core.state === LinphoneEnums.ChatRoomState.CreationFailed) { - UtilsCpp.showInformationPopup(qsTr("info_popup_error_title"), - //: Chat room creation failed ! - qsTr("info_popup_chatroom_creation_failed"), false) - } - } - } - } - onRemoteChatChanged: { - if (remoteChat && remoteChat.core.state === LinphoneEnums.ChatRoomState.Created) { - openChatRequested(remoteChat) - } - } + Connections { + enabled: remoteChat !== null + target: remoteChat ? remoteChat.core : null + function onChatRoomStateChanged() { + if (remoteChat.core.state === LinphoneEnums.ChatRoomState.CreationPending) { + //: Chat room is being created... + mainWindow.showLoadingPopup(qsTr("loading_popup_chatroom_creation_pending_message")); + } else { + mainWindow.closeLoadingPopup(); + if (remoteChat.core.state === LinphoneEnums.ChatRoomState.CreationFailed) { + UtilsCpp.showInformationPopup(qsTr("info_popup_error_title"), + //: Chat room creation failed ! + qsTr("info_popup_chatroom_creation_failed"), false); + } + } + } + } + onRemoteChatChanged: { + if (remoteChat && remoteChat.core.state === LinphoneEnums.ChatRoomState.Created) { + openChatRequested(remoteChat); + } + } - onSelectedChatGuiChanged: { - if (selectedChatGui) { - if (!listStackView.currentItem || listStackView.currentItem.objectName !== "chatListItem") { - listStackView.popToIndex(0) - if (listStackView.depth === 0 || listStackView.currentItem && listStackView.currentItem.objectName !== "chatListItem") listStackView.push(chatListItem) - } - } - AppCpp.currentChat = visible ? selectedChatGui : null - } - onVisibleChanged: { - AppCpp.currentChat = visible ? selectedChatGui : null - } + onSelectedChatGuiChanged: { + if (selectedChatGui) { + if (!listStackView.currentItem || listStackView.currentItem.objectName !== "chatListItem") { + listStackView.popToIndex(0); + if (listStackView.depth === 0 || listStackView.currentItem && listStackView.currentItem.objectName + !== "chatListItem") + listStackView.push(chatListItem); + } + } + AppCpp.currentChat = visible ? selectedChatGui : null; + } + onVisibleChanged: { + AppCpp.currentChat = visible ? selectedChatGui : null; + } - rightPanelStackView.initialItem: currentChatComp - // Only play on the visible property of the right panel as there is only one item pushed - // and the sending TextArea must be instantiated only once, otherwise it looses focus - // when the chat list order is updated - rightPanelStackView.visible: false//listStackView.currentItem && listStackView.currentItem.objectName === "chatListItem" && selectedChatGui !== null + rightPanelStackView.initialItem: currentChatComp + // Only play on the visible property of the right panel as there is only one item pushed + // and the sending TextArea must be instantiated only once, otherwise it looses focus + // when the chat list order is updated + rightPanelStackView.visible: + false//listStackView.currentItem && listStackView.currentItem.objectName === "chatListItem" && selectedChatGui !== null - onNoItemButtonPressed: goToNewChat() - signal newChatItemOpen() + onNoItemButtonPressed: goToNewChat() + signal newChatItemOpen - showDefaultItem: listStackView.currentItem - && listStackView.currentItem.objectName == "chatListItem" - && listStackView.currentItem.listView.count === 0 - && !listStackView.currentItem.listView.loading || false + showDefaultItem: listStackView.currentItem && listStackView.currentItem.objectName == "chatListItem" + && listStackView.currentItem.listView.count === 0 && !listStackView.currentItem.listView.loading || false - function goToNewChat() { - if (listStackView.currentItem - && listStackView.currentItem.objectName != "newChatItem") - listStackView.push(newChatItem) - newChatItemOpen() - } + function goToNewChat() { + if (listStackView.currentItem && listStackView.currentItem.objectName != "newChatItem") + listStackView.push(newChatItem); + newChatItemOpen(); + } - Dialog { - id: deleteChatPopup - width: Utils.getSizeWithScreenRatio(637) - //: Supprimer la conversation ? - title: qsTr("chat_dialog_delete_chat_title") - //: "La conversation et tous ses messages seront supprimés." - text: qsTr("chat_dialog_delete_chat_message") - } + Dialog { + id: deleteChatPopup + width: Utils.getSizeWithScreenRatio(637) + //: Supprimer la conversation ? + title: qsTr("chat_dialog_delete_chat_title") + //: "La conversation et tous ses messages seront supprimés." + text: qsTr("chat_dialog_delete_chat_message") + } - leftPanelContent: Control.StackView { - id: listStackView - Layout.fillWidth: true - Layout.fillHeight: true - Layout.leftMargin: Utils.getSizeWithScreenRatio(45) - clip: true - initialItem: chatListItem - focus: true - onActiveFocusChanged: if (activeFocus) { - currentItem.forceActiveFocus() - } - } + leftPanelContent: Control.StackView { + id: listStackView + Layout.fillWidth: true + Layout.fillHeight: true + Layout.leftMargin: Utils.getSizeWithScreenRatio(45) + clip: true + initialItem: chatListItem + focus: true + onActiveFocusChanged: if (activeFocus) { + currentItem.forceActiveFocus(); + } + } - Component { - id: chatListItem - FocusScope { - objectName: "chatListItem" - property alias listView: chatListView - property alias newChatButton: newChatButton - ColumnLayout { - anchors.fill: parent - spacing: 0 - RowLayout { - // direction: FlexboxLayout.Row - // alignItems: FlexboxLayout.AlignCenter - spacing: Utils.getSizeWithScreenRatio(16) - Layout.rightMargin: Utils.getSizeWithScreenRatio(39) - Layout.fillHeight: false - Text { - Layout.fillWidth: true - //: "Conversations" - text: qsTr("chat_list_title") - maximumLineCount: 1 - color: DefaultStyle.main2_700 - font.pixelSize: Typography.h2.pixelSize - font.weight: Typography.h2.weight - } - PopupButton { - id: chatListMenu - width: Utils.getSizeWithScreenRatio(24) - height: Utils.getSizeWithScreenRatio(24) - focus: true - popup.x: 0 - KeyNavigation.right: newChatButton - KeyNavigation.down: listStackView - popup.contentItem: ColumnLayout { - IconLabelButton { - Layout.fillWidth: true - focus: visible - //: "mark all as read" - text: qsTr("menu_mark_all_as_read") - icon.source: AppIcons.checks - onClicked: { - chatListView.markAllAsRead() - chatListMenu.close() - } - } - } - } - Button { - id: newChatButton - focus: true - style: ButtonStyle.noBackground - icon.source: AppIcons.plusCircle - Layout.preferredWidth: Utils.getSizeWithScreenRatio(28) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) - icon.width: Utils.getSizeWithScreenRatio(28) - icon.height: Utils.getSizeWithScreenRatio(28) - KeyNavigation.down: searchBar - onClicked: { - console.debug("[ChatPage]User: create new chat") - mainItem.goToNewChat() - } - } - } - SearchBar { - id: searchBar - Layout.fillWidth: true - 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 - focus: true - KeyNavigation.up: newChatButton - KeyNavigation.down: chatListView - Binding { - target: mainItem - property: "showDefaultItem" - when: searchBar.text.length != 0 - value: false - } - } - Item { - Layout.fillWidth: true - Layout.fillHeight: true - ColumnLayout { - anchors.fill: parent - anchors.rightMargin: Utils.getSizeWithScreenRatio(39) - Text { - visible: chatListView.count === 0 && chatListView.loading === false - Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Utils.getSizeWithScreenRatio(137) - //: "Aucun résultat…" - text: searchBar.text.length != 0 ? qsTr("list_filter_no_result_found") - //: "Aucune conversation dans votre historique" - : qsTr("chat_list_empty_history") - font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight - } - } - ChatListView { - id: chatListView - Layout.fillWidth: true - Layout.fillHeight: true - chatProxy.model: AppCpp.chats - Layout.topMargin: Utils.getSizeWithScreenRatio(39) - searchBar: searchBar - Control.ScrollBar.vertical: scrollbar + Component { + id: chatListItem + FocusScope { + objectName: "chatListItem" + property alias listView: chatListView + property alias newChatButton: newChatButton + ColumnLayout { + anchors.fill: parent + spacing: 0 + RowLayout { + // direction: FlexboxLayout.Row + // alignItems: FlexboxLayout.AlignCenter + spacing: Utils.getSizeWithScreenRatio(16) + Layout.rightMargin: Utils.getSizeWithScreenRatio(39) + Layout.fillHeight: false + Text { + Layout.fillWidth: true + //: "Conversations" + text: qsTr("chat_list_title") + maximumLineCount: 1 + color: DefaultStyle.main2_700 + font.pixelSize: Typography.h2.pixelSize + font.weight: Typography.h2.weight + } + PopupButton { + id: chatListMenu + width: Utils.getSizeWithScreenRatio(24) + height: Utils.getSizeWithScreenRatio(24) + focus: true + popup.x: 0 + KeyNavigation.right: newChatButton + KeyNavigation.down: listStackView + popup.contentItem: ColumnLayout { + IconLabelButton { + Layout.fillWidth: true + focus: visible + //: "mark all as read" + text: qsTr("menu_mark_all_as_read") + icon.source: AppIcons.checks + onClicked: { + chatListView.markAllAsRead(); + chatListMenu.close(); + } + } + } + } + Button { + id: newChatButton + focus: true + style: ButtonStyle.noBackground + icon.source: AppIcons.plusCircle + Layout.preferredWidth: Utils.getSizeWithScreenRatio(28) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) + icon.width: Utils.getSizeWithScreenRatio(28) + icon.height: Utils.getSizeWithScreenRatio(28) + KeyNavigation.down: searchBar + onClicked: { + console.debug("[ChatPage]User: create new chat"); + mainItem.goToNewChat(); + } + } + } + SearchBar { + id: searchBar + Layout.fillWidth: true + 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 + focus: true + KeyNavigation.up: newChatButton + KeyNavigation.down: chatListView + Binding { + target: mainItem + property: "showDefaultItem" + when: searchBar.text.length != 0 + value: false + } + } + Item { + Layout.fillWidth: true + Layout.fillHeight: true + ColumnLayout { + anchors.fill: parent + anchors.rightMargin: Utils.getSizeWithScreenRatio(39) + Text { + visible: chatListView.count === 0 && chatListView.loading === false + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: Utils.getSizeWithScreenRatio(137) + //: "Aucun résultat…" + text: searchBar.text.length != 0 ? qsTr("list_filter_no_result_found") : + //: "Aucune conversation dans votre historique" + qsTr("chat_list_empty_history") + font { + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight + } + } + ChatListView { + id: chatListView + Layout.fillWidth: true + Layout.fillHeight: true + chatProxy.model: AppCpp.chats + Layout.topMargin: Utils.getSizeWithScreenRatio(39) + searchBar: searchBar + Control.ScrollBar.vertical: scrollbar - onCurrentChatGuiChanged: { - mainItem.selectedChatGui = currentChatGui - } + onCurrentChatGuiChanged: { + mainItem.selectedChatGui = currentChatGui; + } - Connections { - target: mainItem - function onOpenChatRequested(chat) { - chatListView.chatToSelect = chat - } - function onNewChatItemOpen() { - // reset index to clear right panel when opening new conversation - chatListView.currentIndex = -1 - } - } - } - } - ScrollBar { - id: scrollbar - visible: chatListView.contentHeight > parent.height - active: visible - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.rightMargin: Utils.getSizeWithScreenRatio(8) - policy: Control.ScrollBar.AsNeeded - } - } - } - } - } + Connections { + target: mainItem + function onOpenChatRequested(chat) { + chatListView.chatToSelect = chat; + } + function onNewChatItemOpen() { + // reset index to clear right panel when opening new conversation + chatListView.currentIndex = -1; + } + } + } + } + ScrollBar { + id: scrollbar + visible: chatListView.contentHeight > parent.height + active: visible + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.rightMargin: Utils.getSizeWithScreenRatio(8) + policy: Control.ScrollBar.AsNeeded + } + } + } + } + } - Component { - id: newChatItem - FocusScope { - objectName: "newChatItem" - width: parent?.width - height: parent?.height - ColumnLayout { - anchors.fill: parent - spacing: 0 - RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) - Button { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - style: ButtonStyle.noBackground - icon.source: AppIcons.leftArrow - focus: true - KeyNavigation.down: listStackView - onClicked: { - console.debug( - "[CallPage]User: return to call history") - listStackView.pop() - listStackView.forceActiveFocus() - } - } - Text { - Layout.fillWidth: true - //: "New chat" - text: qsTr("chat_action_start_new_chat") - color: DefaultStyle.main2_700 - font.pixelSize: Typography.h2m.pixelSize - font.weight: Typography.h2m.weight - } - Item { - Layout.fillWidth: true - } - } - NewChatForm { - id: newChatForm - startGroupButtonVisible: mainItem.account && mainItem.account.core.conferenceFactoryAddress !== "" - Layout.fillWidth: true - Layout.fillHeight: true - Layout.rightMargin: Utils.getSizeWithScreenRatio(8) - Layout.topMargin: Utils.getSizeWithScreenRatio(18) - onGroupCreationRequested: { - console.log("groupe call requested") - listStackView.push(groupChatItem) - } - onContactClicked: (contact) => { - if (contact) { - mainItem.remoteAddress = "" - mainItem.remoteAddress = contact.core.defaultAddress - } - } - } - } - } - } + Component { + id: newChatItem + FocusScope { + objectName: "newChatItem" + width: parent?.width + height: parent?.height + ColumnLayout { + anchors.fill: parent + spacing: 0 + RowLayout { + spacing: Utils.getSizeWithScreenRatio(10) + Button { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + style: ButtonStyle.noBackground + icon.source: AppIcons.leftArrow + focus: true + KeyNavigation.down: listStackView + onClicked: { + console.debug("[CallPage]User: return to call history"); + listStackView.pop(); + listStackView.forceActiveFocus(); + } + } + Text { + Layout.fillWidth: true + //: "New chat" + text: qsTr("chat_action_start_new_chat") + color: DefaultStyle.main2_700 + font.pixelSize: Typography.h2m.pixelSize + font.weight: Typography.h2m.weight + } + Item { + Layout.fillWidth: true + } + } + NewChatForm { + id: newChatForm + startGroupButtonVisible: mainItem.account && mainItem.account.core.conferenceFactoryAddress !== "" + Layout.fillWidth: true + Layout.fillHeight: true + Layout.rightMargin: Utils.getSizeWithScreenRatio(8) + Layout.topMargin: Utils.getSizeWithScreenRatio(18) + onGroupCreationRequested: { + console.log("groupe call requested"); + listStackView.push(groupChatItem); + } + onContactClicked: contact => { + if (contact) { + mainItem.remoteAddress = ""; + mainItem.remoteAddress = contact.core.defaultAddress; + } + } + } + } + } + } - Component { - id: groupChatItem - GroupCreationFormLayout { - id: chatCreationLayout + Component { + id: groupChatItem + GroupCreationFormLayout { + id: chatCreationLayout - objectName: "groupChatItem" - //: "Nouveau groupe" - formTitle: qsTr("chat_start_group_chat_title") - //: "Créer" - createGroupButtonText: qsTr("chat_action_start_group_chat") + objectName: "groupChatItem" + //: "Nouveau groupe" + formTitle: qsTr("chat_start_group_chat_title") + //: "Créer" + createGroupButtonText: qsTr("chat_action_start_group_chat") - property var groupChatObj - property var groupChat: groupChatObj ? groupChatObj.value : null - onGroupChatChanged: if (groupChat && groupChat.core.state === LinphoneEnums.ChatRoomState.Created) { - mainItem.selectedChatGui = groupChat - } - Connections { - enabled: groupChat || false - target: groupChat?.core || null - function onChatRoomStateChanged() { - if (chatCreationLayout.groupChat.core.state === LinphoneEnums.ChatRoomState.Created) { - mainWindow.closeLoadingPopup() - mainItem.selectedChatGui = chatCreationLayout.groupChat - } else if (chatCreationLayout.groupChat.core.state === LinphoneEnums.ChatRoomState.CreationFailed) { - mainWindow.closeLoadingPopup() - mainWindow.showInformationPopup(qsTr("information_popup_error_title"), - //: "La création a échoué" - qsTr("information_popup_chat_creation_failed_message"), false) - chatCreationLayout.groupChat.core.lDelete() - } - } - } + property var groupChatObj + property var groupChat: groupChatObj ? groupChatObj.value : null + onGroupChatChanged: if (groupChat && groupChat.core.state === LinphoneEnums.ChatRoomState.Created) { + mainItem.selectedChatGui = groupChat; + } + Connections { + enabled: groupChat || false + target: groupChat?.core || null + function onChatRoomStateChanged() { + if (chatCreationLayout.groupChat.core.state === LinphoneEnums.ChatRoomState.Created) { + mainWindow.closeLoadingPopup(); + mainItem.selectedChatGui = chatCreationLayout.groupChat; + } else if (chatCreationLayout.groupChat.core.state === LinphoneEnums.ChatRoomState.CreationFailed) { + mainWindow.closeLoadingPopup(); + mainWindow.showInformationPopup(qsTr("information_popup_error_title"), + //: "La création a échoué" + qsTr("information_popup_chat_creation_failed_message"), false); + chatCreationLayout.groupChat.core.lDelete(); + } + } + } - Control.StackView.onActivated: { - addParticipantsLayout.forceActiveFocus() - } - onReturnRequested: { - listStackView.pop() - listStackView.currentItem?.forceActiveFocus() - } + Control.StackView.onActivated: { + addParticipantsLayout.forceActiveFocus(); + } + onReturnRequested: { + listStackView.pop(); + listStackView.currentItem?.forceActiveFocus(); + } - onGroupCreationRequested: { - var hasError = false - if (groupName.text.length === 0) { - //: "Un nom doit être donné au groupe - groupNameItem.errorMessage = qsTr("group_chat_error_must_have_name") - hasError = true - } if (addParticipantsLayout.selectedParticipantsCount === 0) { - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: "Please select at least one participant - qsTr("group_chat_error_no_participant"), false) - hasError = true - } if (!mainItem.isRegistered) { - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: "Vous n'etes pas connecté" - qsTr("group_call_error_not_connected"), false) - hasError = true - } - if (hasError) return - console.log("Create group chat") - //: Creation de la conversation en cours … - mainWindow.showLoadingPopup(qsTr("chat_creation_in_progress"), true, function () { - if (chatCreationLayout.groupChat) chatCreationLayout.groupChat.core.lDelete() - }) - chatCreationLayout.groupChatObj = UtilsCpp.createGroupChat(chatCreationLayout.groupName.text, addParticipantsLayout.selectedParticipants) - } - } - } + onGroupCreationRequested: { + var hasError = false; + if (groupName.text.length === 0) { + //: "Un nom doit être donné au groupe + groupNameItem.errorMessage = qsTr("group_chat_error_must_have_name"); + hasError = true; + } + if (addParticipantsLayout.selectedParticipantsCount === 0) { + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "Please select at least one participant + qsTr("group_chat_error_no_participant"), false); + hasError = true; + } + if (!mainItem.isRegistered) { + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "Vous n'etes pas connecté" + qsTr("group_call_error_not_connected"), false); + hasError = true; + } + if (hasError) + return; + console.log("Create group chat"); + //: Creation de la conversation en cours … + mainWindow.showLoadingPopup(qsTr("chat_creation_in_progress"), true, function () { + if (chatCreationLayout.groupChat) + chatCreationLayout.groupChat.core.lDelete(); + }); + chatCreationLayout.groupChatObj = UtilsCpp.createGroupChat(chatCreationLayout.groupName.text, + addParticipantsLayout.selectedParticipants); + } + } + } - Component { - id: emptySelection - Item { - objectName: "emptySelection" - } - } - Component { - id: currentChatComp - FocusScope { - BusyIndicator { - anchors.centerIn: parent - visible: selectedChatView.chat && !selectedChatView.visible - indicatorHeight: visible ? Utils.getSizeWithScreenRatio(60) : 0 - indicatorWidth: Utils.getSizeWithScreenRatio(60) - indicatorColor: DefaultStyle.main1_500_main - } - SelectedChatView { - id: selectedChatView - visible: chat != undefined - anchors.fill: parent - chat: mainItem.selectedChatGui ? mainItem.selectedChatGui : null + Component { + id: emptySelection + Item { + objectName: "emptySelection" + } + } + Component { + id: currentChatComp + FocusScope { + BusyIndicator { + anchors.centerIn: parent + visible: selectedChatView.chat && !selectedChatView.visible + indicatorHeight: visible ? Utils.getSizeWithScreenRatio(60) : 0 + indicatorWidth: Utils.getSizeWithScreenRatio(60) + indicatorColor: DefaultStyle.main1_500_main + } + SelectedChatView { + id: selectedChatView + visible: chat != undefined + anchors.fill: parent + chat: mainItem.selectedChatGui ? mainItem.selectedChatGui : null - // Reset current chat when switching account, otherwise the binding makes - // the last chat from last account the current chat for the new default account - Connections { - target: AppCpp - function onDefaultAccountChanged() { - selectedChatView.chat = null - } - } - // Binding is destroyed when forward message is done so - // we need this connection in addition - Connections { - target: mainItem - function onSelectedChatGuiChanged() { - selectedChatView.chat = mainItem.selectedChatGui ? mainItem.selectedChatGui : null - } - } - Binding { - target: mainItem - property: "showDefaultItem" - when: selectedChatView.messagesLoading - value: false - } - } - } - } + // Reset current chat when switching account, otherwise the binding makes + // the last chat from last account the current chat for the new default account + Connections { + target: AppCpp + function onDefaultAccountChanged() { + selectedChatView.chat = null; + } + } + // Binding is destroyed when forward message is done so + // we need this connection in addition + Connections { + target: mainItem + function onSelectedChatGuiChanged() { + selectedChatView.chat = mainItem.selectedChatGui ? mainItem.selectedChatGui : null; + } + } + Binding { + target: mainItem + property: "showDefaultItem" + when: selectedChatView.messagesLoading + value: false + } + } + } + } } diff --git a/Linphone/view/Page/Main/Contact/ContactPage.qml b/Linphone/view/Page/Main/Contact/ContactPage.qml index 135270a1d..d53cb2df9 100644 --- a/Linphone/view/Page/Main/Contact/ContactPage.qml +++ b/Linphone/view/Page/Main/Contact/ContactPage.qml @@ -10,878 +10,852 @@ 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 - //: "Ajouter un contact" - noItemButtonText: qsTr("contacts_add") - //: "Aucun contact pour le moment" - emptyListText: qsTr("contacts_list_empty") - newItemIconSource: AppIcons.plusCircle + id: mainItem + //: "Ajouter un contact" + noItemButtonText: qsTr("contacts_add") + //: "Aucun contact pour le moment" + emptyListText: qsTr("contacts_list_empty") + newItemIconSource: AppIcons.plusCircle - /** - * Focus on the first pertinent element in the page (LINQT-2202) - * @override - */ - function forceActiveFocus(reason = undefined){ - createContactButton.forceActiveFocus(reason) - } + /** + * Focus on the first pertinent element in the page (LINQT-2202) + * @override + */ + function forceActiveFocus(reason = undefined) { + createContactButton.forceActiveFocus(reason); + } - // disable left panel contact list interaction while a contact is being edited - property bool leftPanelEnabled: !rightPanelStackView.currentItem - || rightPanelStackView.currentItem.objectName - != "contactEdition" - property FriendGui selectedContact - property string initialFriendToDisplay - onInitialFriendToDisplayChanged: { - if (initialFriendToDisplay != '' && contactList.selectContact(initialFriendToDisplay) != -1) - initialFriendToDisplay = "" - else if (initialFriendToDisplay != '') - console.warn("Abstract not selected yet: ", initialFriendToDisplay) - } + // disable left panel contact list interaction while a contact is being edited + property bool leftPanelEnabled: !rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName + != "contactEdition" + property FriendGui selectedContact + property string initialFriendToDisplay + onInitialFriendToDisplayChanged: { + if (initialFriendToDisplay != '' && contactList.selectContact(initialFriendToDisplay) != -1) + initialFriendToDisplay = ""; + else if (initialFriendToDisplay != '') + console.warn("Abstract not selected yet: ", initialFriendToDisplay); + } - onVisibleChanged: if (!visible) { - rightPanelStackView.clear() - contactList.resetSelections() - } - function goToContactDetails() { - if (selectedContact) { - var firstItem = rightPanelStackView.get(0) - if (firstItem && firstItem.objectName == "contactDetail") - // Go directly to detail - rightPanelStackView.popToIndex(0) - else { - if (rightPanelStackView.depth >= 1) { - // Replace in background and go back to it - rightPanelStackView.replace(firstItem, contactDetail) - rightPanelStackView.popToIndex(0) - } else { - // empty - rightPanelStackView.push(contactDetail) - } - } - } else { - rightPanelStackView.clear() - } - } - onSelectedContactChanged: { - // if we are editing a contact, force staying on edition page - if (!rightPanelStackView.currentItem - || rightPanelStackView.currentItem.objectName != "contactEdition") { - console.log("selected contact changed, go to contact details") - goToContactDetails() - } - } + onVisibleChanged: if (!visible) { + rightPanelStackView.clear(); + contactList.resetSelections(); + } + function goToContactDetails() { + if (selectedContact) { + var firstItem = rightPanelStackView.get(0); + if (firstItem && firstItem.objectName == "contactDetail") + // Go directly to detail + rightPanelStackView.popToIndex(0); + else { + if (rightPanelStackView.depth >= 1) { + // Replace in background and go back to it + rightPanelStackView.replace(firstItem, contactDetail); + rightPanelStackView.popToIndex(0); + } else { + // empty + rightPanelStackView.push(contactDetail); + } + } + } else { + rightPanelStackView.clear(); + } + } + onSelectedContactChanged: { + // if we are editing a contact, force staying on edition page + if (!rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName != "contactEdition") { + console.log("selected contact changed, go to contact details"); + goToContactDetails(); + } + } - onNoItemButtonPressed: createContact("", "") + onNoItemButtonPressed: createContact("", "") - function createContact(name, address) { - var friendGui = Qt.createQmlObject('import Linphone + function createContact(name, address) { + var friendGui = Qt.createQmlObject('import Linphone FriendGui{ - }', mainItem) - friendGui.core.givenName = UtilsCpp.getGivenNameFromFullName(name) - friendGui.core.familyName = UtilsCpp.getFamilyNameFromFullName(name) - friendGui.core.appendAddress(address) - if (!rightPanelStackView.currentItem - || rightPanelStackView.currentItem.objectName != "contactEdition") - rightPanelStackView.push(contactEdition, { - "contact": friendGui, - //: "Nouveau contact" - "title": qsTr("contact_new_title"), - // "Créer" - "saveButtonText": qsTr("create") - }) - } + }', mainItem); + friendGui.core.givenName = UtilsCpp.getGivenNameFromFullName(name); + friendGui.core.familyName = UtilsCpp.getFamilyNameFromFullName(name); + friendGui.core.appendAddress(address); + if (!rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName != "contactEdition") + rightPanelStackView.push(contactEdition, { + "contact": friendGui, + //: "Nouveau contact" + "title": qsTr("contact_new_title"), + // "Créer" + "saveButtonText": qsTr("create") + }); + } - function editContact(friendGui) { - rightPanelStackView.push(contactEdition, { - "contact": friendGui, - //: "Modifier contact" - "title": qsTr("contact_edit_title"), - "saveButtonText": qsTr("save") - }) - } + function editContact(friendGui) { + rightPanelStackView.push(contactEdition, { + "contact": friendGui, + //: "Modifier contact" + "title": qsTr("contact_edit_title"), + "saveButtonText": qsTr("save") + }); + } - // rightPanelStackView.initialItem: contactDetail - showDefaultItem: rightPanelStackView.depth == 0 && !contactList.haveContacts - && searchBar.text.length === 0 + // rightPanelStackView.initialItem: contactDetail + showDefaultItem: rightPanelStackView.depth == 0 && !contactList.haveContacts && searchBar.text.length === 0 - function deleteContact(contact) { - if (!contact) - return - var mainWin = UtilsCpp.getMainWindow() - mainWin.showConfirmationLambdaPopup( - //: Supprimer %1 ?" - qsTr("contact_dialog_delete_title").arg(contact.core.fullName), - //: Ce contact sera définitivement supprimé. - qsTr("contact_dialog_delete_message"), "", function (confirmed) { - if (confirmed) { - var name = contact.core.fullName - contact.core.remove() - contactList.resetSelections() - UtilsCpp.showInformationPopup( - //: "Contact supprimé" - qsTr("contact_deleted_toast"), - //: "%1 a été supprimé" - qsTr("contact_deleted_message").arg(name)) - } - }) - } + function deleteContact(contact) { + if (!contact) + return; + var mainWin = UtilsCpp.getMainWindow(); + mainWin.showConfirmationLambdaPopup( + //: Supprimer %1 ?" + qsTr("contact_dialog_delete_title").arg(contact.core.fullName), + //: Ce contact sera définitivement supprimé. + qsTr("contact_dialog_delete_message"), "", function (confirmed) { + if (confirmed) { + var name = contact.core.fullName; + contact.core.remove(); + contactList.resetSelections(); + UtilsCpp.showInformationPopup( + //: "Contact supprimé" + qsTr("contact_deleted_toast"), + //: "%1 a été supprimé" + qsTr("contact_deleted_message").arg(name)); + } + }); + } - Dialog { - id: verifyDevicePopup - property string deviceName - property string deviceAddress - padding: Utils.getSizeWithScreenRatio(30) - width: Utils.getSizeWithScreenRatio(637) - anchors.centerIn: parent - closePolicy: Control.Popup.CloseOnEscape - modal: true - onAboutToHide: neverDisplayAgainCheckbox.checked = false - //: "Augmenter la confiance" - title: qsTr("contact_dialog_devices_trust_popup_title") - //: "Pour augmenter le niveau de confiance vous devez appeler les différents appareils de votre contact et valider un code.

Vous êtes sur le point d’appeler “%1” voulez vous continuer ?" - text: qsTr("contact_dialog_devices_trust_popup_message").arg(verifyDevicePopup.deviceName) - buttons: RowLayout { - RowLayout { - spacing: Utils.getSizeWithScreenRatio(7) - CheckBox { - id: neverDisplayAgainCheckbox - } - Text { - //: Ne plus afficher - text: qsTr("popup_do_not_show_again") - font.pixelSize: Utils.getSizeWithScreenRatio(14) - MouseArea { - anchors.fill: parent - onClicked: neverDisplayAgainCheckbox.toggle() - } - } - } - Item { - Layout.fillWidth: true - } - RowLayout { - spacing: Utils.getSizeWithScreenRatio(15) - BigButton { - style: ButtonStyle.secondary - text: qsTr("cancel") - onClicked: verifyDevicePopup.close() - } - BigButton { - style: ButtonStyle.main - //: "Appeler" - text: qsTr("dialog_call") - onClicked: { - SettingsCpp.setDisplayDeviceCheckConfirmation( - !neverDisplayAgainCheckbox.checked) - UtilsCpp.createCall(verifyDevicePopup.deviceAddress, - {}, - LinphoneEnums.MediaEncryption.Zrtp) - onClicked: verifyDevicePopup.close() - } - } - } - } - } - Dialog { - id: trustInfoDialog - 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: Utils.getSizeWithScreenRatio(50) - Avatar { - displayNameVal: "A C" - Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - } - EffectImage { - imageSource: AppIcons.arrowRight - colorizationColor: DefaultStyle.main2_600 - Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - } - Avatar { - displayNameVal: "A C" - secured: true - Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - } - } - buttons: Button { - //: "Ok" - text: qsTr("dialog_ok") - style: ButtonStyle.main - leftPadding: Utils.getSizeWithScreenRatio(30) - rightPadding: Utils.getSizeWithScreenRatio(30) - onClicked: trustInfoDialog.close() - } - } + Dialog { + id: verifyDevicePopup + property string deviceName + property string deviceAddress + padding: Utils.getSizeWithScreenRatio(30) + width: Utils.getSizeWithScreenRatio(637) + anchors.centerIn: parent + closePolicy: Control.Popup.CloseOnEscape + modal: true + onAboutToHide: neverDisplayAgainCheckbox.checked = false + //: "Augmenter la confiance" + title: qsTr("contact_dialog_devices_trust_popup_title") + //: "Pour augmenter le niveau de confiance vous devez appeler les différents appareils de votre contact et valider un code.

Vous êtes sur le point d’appeler “%1” voulez vous continuer ?" + text: qsTr("contact_dialog_devices_trust_popup_message").arg(verifyDevicePopup.deviceName) + buttons: RowLayout { + RowLayout { + spacing: Utils.getSizeWithScreenRatio(7) + CheckBox { + id: neverDisplayAgainCheckbox + } + Text { + //: Ne plus afficher + text: qsTr("popup_do_not_show_again") + font.pixelSize: Utils.getSizeWithScreenRatio(14) + MouseArea { + anchors.fill: parent + onClicked: neverDisplayAgainCheckbox.toggle() + } + } + } + Item { + Layout.fillWidth: true + } + RowLayout { + spacing: Utils.getSizeWithScreenRatio(15) + BigButton { + style: ButtonStyle.secondary + text: qsTr("cancel") + onClicked: verifyDevicePopup.close() + } + BigButton { + style: ButtonStyle.main + //: "Appeler" + text: qsTr("dialog_call") + onClicked: { + SettingsCpp.setDisplayDeviceCheckConfirmation(!neverDisplayAgainCheckbox.checked); + UtilsCpp.createCall(verifyDevicePopup.deviceAddress, {}, LinphoneEnums.MediaEncryption.Zrtp); + onClicked: verifyDevicePopup.close(); + } + } + } + } + } + Dialog { + id: trustInfoDialog + 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: Utils.getSizeWithScreenRatio(50) + Avatar { + displayNameVal: "A C" + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + } + EffectImage { + imageSource: AppIcons.arrowRight + colorizationColor: DefaultStyle.main2_600 + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + } + Avatar { + displayNameVal: "A C" + secured: true + Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) + } + } + buttons: Button { + //: "Ok" + text: qsTr("dialog_ok") + style: ButtonStyle.main + leftPadding: Utils.getSizeWithScreenRatio(30) + rightPadding: Utils.getSizeWithScreenRatio(30) + onClicked: trustInfoDialog.close() + } + } - leftPanelContent: FocusScope { - id: leftPanel - property real leftMargin: Utils.getSizeWithScreenRatio(45) - property real rightMargin: Utils.getSizeWithScreenRatio(39) - Layout.fillHeight: true - Layout.fillWidth: true + leftPanelContent: FocusScope { + id: leftPanel + property real leftMargin: Utils.getSizeWithScreenRatio(45) + property real rightMargin: Utils.getSizeWithScreenRatio(39) + Layout.fillHeight: true + Layout.fillWidth: true - RowLayout { - id: title - // direction: FlexboxLayout.Row - spacing: Utils.getSizeWithScreenRatio(16) - // alignItems: FlexboxLayout.AlignCenter - anchors.top: leftPanel.top - anchors.right: leftPanel.right - anchors.left: leftPanel.left - anchors.leftMargin: leftPanel.leftMargin - anchors.rightMargin: leftPanel.rightMargin - Layout.fillHeight: false - Text { - Layout.fillWidth: true - //: "Contacts" - text: qsTr("bottom_navigation_contacts_label") - maximumLineCount: 1 - color: DefaultStyle.main2_700 - font.pixelSize: Typography.h2.pixelSize - font.weight: Typography.h2.weight - } - Button { - id: createContactButton - visible: !rightPanelStackView.currentItem - || rightPanelStackView.currentItem.objectName !== "contactEdition" - style: ButtonStyle.noBackground - focus: true - icon.source: AppIcons.plusCircle - Layout.preferredWidth: Utils.getSizeWithScreenRatio(28) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) - icon.width: Utils.getSizeWithScreenRatio(28) - icon.height: Utils.getSizeWithScreenRatio(28) - onClicked: { - mainItem.createContact("", "") - } - KeyNavigation.down: searchBar - //: Create new contact - Accessible.name: qsTr("create_contact_accessible_name") - } - } + RowLayout { + id: title + // direction: FlexboxLayout.Row + spacing: Utils.getSizeWithScreenRatio(16) + // alignItems: FlexboxLayout.AlignCenter + anchors.top: leftPanel.top + anchors.right: leftPanel.right + anchors.left: leftPanel.left + anchors.leftMargin: leftPanel.leftMargin + anchors.rightMargin: leftPanel.rightMargin + Layout.fillHeight: false + Text { + Layout.fillWidth: true + //: "Contacts" + text: qsTr("bottom_navigation_contacts_label") + maximumLineCount: 1 + color: DefaultStyle.main2_700 + font.pixelSize: Typography.h2.pixelSize + font.weight: Typography.h2.weight + } + Button { + id: createContactButton + visible: !rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName !== "contactEdition" + style: ButtonStyle.noBackground + focus: true + icon.source: AppIcons.plusCircle + Layout.preferredWidth: Utils.getSizeWithScreenRatio(28) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(28) + icon.width: Utils.getSizeWithScreenRatio(28) + icon.height: Utils.getSizeWithScreenRatio(28) + onClicked: { + mainItem.createContact("", ""); + } + KeyNavigation.down: searchBar + //: Create new contact + Accessible.name: qsTr("create_contact_accessible_name") + } + } - ColumnLayout { - anchors.top: title.bottom - anchors.right: leftPanel.right - anchors.left: leftPanel.left - anchors.leftMargin: leftPanel.leftMargin - anchors.bottom: leftPanel.bottom - enabled: mainItem.leftPanelEnabled - spacing: Utils.getSizeWithScreenRatio(38) - SearchBar { - id: searchBar - visible: contactList.haveContacts || text.length !== 0 - Layout.rightMargin: leftPanel.rightMargin - Layout.topMargin: Utils.getSizeWithScreenRatio(18) - Layout.fillWidth: true - //: Rechercher un contact - placeholderText: qsTr("search_bar_look_for_contact_text") - KeyNavigation.up: createContactButton - KeyNavigation.down: contactList - } - ColumnLayout { - id: content - spacing: Utils.getSizeWithScreenRatio(15) - Text { - visible: !contactList.loading && !contactList.haveContacts - Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Utils.getSizeWithScreenRatio(137) - //: Aucun résultat… - text: searchBar.text.length !== 0 ? qsTr("list_filter_no_result_found") - //: Aucun contact pour le moment - : qsTr("contact_list_empty") - font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight - } - } - AllContactListView { - id: contactList - Layout.fillWidth: true - Layout.fillHeight: true - Layout.rightMargin: Utils.getSizeWithScreenRatio(8) - searchBarText: searchBar.text - hideSuggestions: true - sourceFlags: LinphoneEnums.MagicSearchSource.Friends - | LinphoneEnums.MagicSearchSource.FavoriteFriends - | LinphoneEnums.MagicSearchSource.LdapServers - | LinphoneEnums.MagicSearchSource.RemoteCardDAV - onHighlightedContactChanged: mainItem.selectedContact = highlightedContact - onContactDeletionRequested: contact => { - mainItem.deleteContact(contact) - } - onLoadingChanged: { - if (!loading && initialFriendToDisplay.length !== 0) { - Qt.callLater(function () { - if (selectContact(initialFriendToDisplay) != -1) - initialFriendToDisplay = "" - }) - } - } - } - } - } - } + ColumnLayout { + anchors.top: title.bottom + anchors.right: leftPanel.right + anchors.left: leftPanel.left + anchors.leftMargin: leftPanel.leftMargin + anchors.bottom: leftPanel.bottom + enabled: mainItem.leftPanelEnabled + spacing: Utils.getSizeWithScreenRatio(38) + SearchBar { + id: searchBar + visible: contactList.haveContacts || text.length !== 0 + Layout.rightMargin: leftPanel.rightMargin + Layout.topMargin: Utils.getSizeWithScreenRatio(18) + Layout.fillWidth: true + //: Rechercher un contact + placeholderText: qsTr("search_bar_look_for_contact_text") + KeyNavigation.up: createContactButton + KeyNavigation.down: contactList + } + ColumnLayout { + id: content + spacing: Utils.getSizeWithScreenRatio(15) + Text { + visible: !contactList.loading && !contactList.haveContacts + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: Utils.getSizeWithScreenRatio(137) + //: Aucun résultat… + text: searchBar.text.length !== 0 ? qsTr("list_filter_no_result_found") : + //: Aucun contact pour le moment + qsTr("contact_list_empty") + font { + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight + } + } + AllContactListView { + id: contactList + Layout.fillWidth: true + Layout.fillHeight: true + Layout.rightMargin: Utils.getSizeWithScreenRatio(8) + searchBarText: searchBar.text + hideSuggestions: true + sourceFlags: LinphoneEnums.MagicSearchSource.Friends | LinphoneEnums.MagicSearchSource.FavoriteFriends + | LinphoneEnums.MagicSearchSource.LdapServers | LinphoneEnums.MagicSearchSource.RemoteCardDAV + onHighlightedContactChanged: mainItem.selectedContact = highlightedContact + onContactDeletionRequested: contact => { + mainItem.deleteContact(contact); + } + onLoadingChanged: { + if (!loading && initialFriendToDisplay.length !== 0) { + Qt.callLater(function () { + if (selectContact(initialFriendToDisplay) != -1) + initialFriendToDisplay = ""; + }); + } + } + } + } + } + } - Component { - id: contactDetail - Item { - width: parent?.width - height: parent?.height - property string objectName: "contactDetail" - component ContactDetailLayout: ColumnLayout { - id: contactDetailLayout - spacing: Utils.getSizeWithScreenRatio(15) - property string label - property var icon - property alias content: contentControl.contentItem - signal titleIconClicked - RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) - Text { - text: contactDetailLayout.label - color: DefaultStyle.main1_500_main - font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight - } - } - RoundButton { - visible: contactDetailLayout.icon != undefined - icon.source: contactDetailLayout.icon - style: ButtonStyle.noBackgroundOrange - onClicked: contactDetailLayout.titleIconClicked() - //: More info %1 - Accessible.name: qsTr("more_info_accessible_name").arg(contactDetailLayout.label) - } - Item { - Layout.fillWidth: true - } - RoundButton { - id: expandButton - style: ButtonStyle.noBackground - checkable: true - checked: true - icon.source: checked ? AppIcons.upArrow : AppIcons.downArrow - KeyNavigation.down: contentControl - Accessible.name: (checked ? - //: Shrink %1 - qsTr("shrink_accessible_name"): - //: Expand %1 - qsTr("expand_accessible_name")).arg(contactDetailLayout.label) + Component { + id: contactDetail + Item { + width: parent?.width + height: parent?.height + property string objectName: "contactDetail" + ContactLayout { + id: contactDetail + anchors.fill: parent + contact: mainItem.selectedContact + button.color: DefaultStyle.main1_100 + //: Edit + button.text: qsTr("contact_details_edit") + button.style: ButtonStyle.tertiary + button.icon.source: AppIcons.pencil + button.onClicked: mainItem.editContact(mainItem.selectedContact) + button.visible: mainItem.selectedContact && mainItem.selectedContact.core.isStored && + !mainItem.selectedContact.core.readOnly + property string contactAddress: contact ? contact.core.defaultAddress : "" + property var computedContactNameObj: UtilsCpp.getDisplayName(contactAddress) + property string computedContactName: computedContactNameObj ? computedContactNameObj.value : "" + property string contactName: contact ? contact.core.fullName : computedContactName + bannerContent: [ + ColumnLayout { + spacing: 0 + Text { + text: UtilsCpp.encodeEmojiToQmlRichFormat(contactDetail.contactName) + textFormat: Text.RichText + Layout.fillWidth: true + maximumLineCount: 1 + font { + pixelSize: Typography.h2.pixelSize + weight: Typography.h2.weight + capitalization: Font.Capitalize + } + } + Text { + visible: contactDetail.contact + horizontalAlignment: Text.AlignLeft + Layout.fillWidth: true + text: contactDetail.contact ? contactDetail.contact.core.presenceStatus : "" + color: contactDetail.contact ? contactDetail.contact.core.presenceColor : 'transparent' + font.pixelSize: Utils.getSizeWithScreenRatio(14) + } + }, + ActionsButtons { + visible: !contactDetail.useVerticalLayout + } + ] + secondLineContent: ActionsButtons {} + content: Flickable { + contentWidth: parent.width + ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(32) + anchors.left: parent.left + anchors.right: parent.right + ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(15) + Layout.fillWidth: true + ContactDetailLayout { + id: infoLayout + Layout.fillWidth: true + //: "Coordonnées" + label: qsTr("contact_details_numbers_and_addresses_title") + content: ListView { + id: addrList + height: contentHeight + implicitHeight: contentHeight + width: parent.width + clip: true + 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: Utils.getSizeWithScreenRatio(46) - } - } - RoundedPane { - id: contentControl - visible: expandButton.checked - Layout.fillWidth: true - leftPadding: Utils.getSizeWithScreenRatio(20) - rightPadding: Utils.getSizeWithScreenRatio(20) - topPadding: Utils.getSizeWithScreenRatio(17) - bottomPadding: Utils.getSizeWithScreenRatio(17) - } - } - ContactLayout { - id: contactDetail - anchors.fill: parent - contact: mainItem.selectedContact - button.color: DefaultStyle.main1_100 - //: Edit - button.text: qsTr("contact_details_edit") - button.style: ButtonStyle.tertiary - button.icon.source: AppIcons.pencil - button.onClicked: mainItem.editContact(mainItem.selectedContact) - button.visible: mainItem.selectedContact && mainItem.selectedContact.core.isStored && !mainItem.selectedContact.core.readOnly - property string contactAddress: contact ? contact.core.defaultAddress : "" - property var computedContactNameObj: UtilsCpp.getDisplayName(contactAddress) - property string computedContactName: computedContactNameObj ? computedContactNameObj.value : "" - property string contactName: contact ? contact.core.fullName : computedContactName - component ActionsButtons: RowLayout { - spacing: Utils.getSizeWithScreenRatio(58) - LabelButton { - button.icon.source: AppIcons.phone - //: "Appel" - label: qsTr("contact_call_action") - 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 { - button.icon.source: AppIcons.chatTeardropText - visible: !SettingsCpp.disableChatFeature - //: "Message" - label: qsTr("contact_message_action") - 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) - } - } - LabelButton { - visible: SettingsCpp.videoEnabled - button.icon.source: AppIcons.videoCamera - //: "Appel vidéo" - label: qsTr("contact_video_call_action") - 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) - } - } - bannerContent: [ - ColumnLayout { - spacing: 0 - Text { - text: UtilsCpp.encodeEmojiToQmlRichFormat(contactDetail.contactName) - textFormat: Text.RichText - Layout.fillWidth: true - maximumLineCount: 1 - font { - pixelSize: Typography.h2.pixelSize - weight: Typography.h2.weight - capitalization: Font.Capitalize - } - } - Text { - visible: contactDetail.contact - horizontalAlignment: Text.AlignLeft - Layout.fillWidth: true - text: contactDetail.contact ? contactDetail.contact.core.presenceStatus : "" - color: contactDetail.contact ? contactDetail.contact.core.presenceColor : 'transparent' - font.pixelSize: Utils.getSizeWithScreenRatio(14) - } - }, - ActionsButtons { - visible: !contactDetail.useVerticalLayout - } - ] - secondLineContent: ActionsButtons {} - content: Flickable { - contentWidth: parent.width - ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(32) - anchors.left: parent.left - anchors.right: parent.right - ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(15) - Layout.fillWidth: true - ContactDetailLayout { - id: infoLayout - Layout.fillWidth: true - //: "Coordonnées" - label: qsTr("contact_details_numbers_and_addresses_title") - content: ListView { - id: addrList - height: contentHeight - implicitHeight: contentHeight - width: parent.width - clip: true - 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: Utils.getSizeWithScreenRatio(46) + ColumnLayout { + anchors.fill: parent + // anchors.topMargin: Utils.getSizeWithScreenRatio(5) + RowLayout { + Layout.fillWidth: true + // Layout.fillHeight: true + // Layout.alignment: Qt.AlignVCenter + // Layout.topMargin: Utils.getSizeWithScreenRatio(10) + // Layout.bottomMargin: Utils.getSizeWithScreenRatio(10) + ColumnLayout { + Layout.fillWidth: true + Text { + Layout.fillWidth: true + text: listViewModelData.label + font { + pixelSize: Typography.p2.pixelSize + weight: Typography.p2.weight + } + } + Text { + Layout.fillWidth: true + property string _text: listViewModelData.address + text: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(_text) : _text + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + } + } + Item { + Layout.fillWidth: true + } + RoundButton { + style: ButtonStyle.noBackground + icon.source: AppIcons.phone + onClicked: { + UtilsCpp.createCall(listViewModelData.address); + } + //: Call address %1 + Accessible.name: qsTr("call_adress_accessible_name").arg(listViewModelData.address) + } + } - ColumnLayout { - anchors.fill: parent - // anchors.topMargin: Utils.getSizeWithScreenRatio(5) - RowLayout { - Layout.fillWidth: true - // Layout.fillHeight: true - // Layout.alignment: Qt.AlignVCenter - // Layout.topMargin: Utils.getSizeWithScreenRatio(10) - // Layout.bottomMargin: Utils.getSizeWithScreenRatio(10) - ColumnLayout { - Layout.fillWidth: true - Text { - Layout.fillWidth: true - text: listViewModelData.label - font { - pixelSize: Typography.p2.pixelSize - weight: Typography.p2.weight - } - } - Text { - Layout.fillWidth: true - property string _text: listViewModelData.address - text: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(_text) : _text - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } - } - } - Item { - Layout.fillWidth: true - } - RoundButton { - style: ButtonStyle.noBackground - icon.source: AppIcons.phone - onClicked: { - UtilsCpp.createCall( - listViewModelData.address) - } - //: Call address %1 - Accessible.name: qsTr("call_adress_accessible_name").arg(listViewModelData.address) - } - } + Rectangle { + visible: index != addrList.model.count - 1 + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) + Layout.rightMargin: Utils.getSizeWithScreenRatio(3) + Layout.leftMargin: Utils.getSizeWithScreenRatio(3) + color: DefaultStyle.main2_200 + clip: true + } + } + } + } + } + RoundedPane { + visible: infoLayout.visible && companyText.text.length != 0 || jobText.text.length != 0 + Layout.fillWidth: true + topPadding: Utils.getSizeWithScreenRatio(17) + bottomPadding: Utils.getSizeWithScreenRatio(17) + leftPadding: Utils.getSizeWithScreenRatio(20) + rightPadding: Utils.getSizeWithScreenRatio(20) - Rectangle { - visible: index != addrList.model.count - 1 - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) - Layout.rightMargin: Utils.getSizeWithScreenRatio(3) - Layout.leftMargin: Utils.getSizeWithScreenRatio(3) - color: DefaultStyle.main2_200 - clip: true - } - } - } - } - } - RoundedPane { - visible: infoLayout.visible - && companyText.text.length != 0 - || jobText.text.length != 0 - Layout.fillWidth: true - topPadding: Utils.getSizeWithScreenRatio(17) - bottomPadding: Utils.getSizeWithScreenRatio(17) - leftPadding: Utils.getSizeWithScreenRatio(20) - rightPadding: Utils.getSizeWithScreenRatio(20) + contentItem: ColumnLayout { + RowLayout { + height: Utils.getSizeWithScreenRatio(50) + visible: companyText.text.length != 0 + Text { + //: "Société :" + text: qsTr("contact_details_company_name") + font { + pixelSize: Typography.p2.pixelSize + weight: Typography.p2.weight + } + } + Text { + id: companyText + text: mainItem.selectedContact && mainItem.selectedContact.core.organization + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + } + } + RowLayout { + height: Utils.getSizeWithScreenRatio(50) + visible: jobText.text.length != 0 + Text { + //: "Poste :" + text: qsTr("contact_details_job_title") + font { + pixelSize: Typography.p2.pixelSize + weight: Typography.p2.weight + } + } + Text { + id: jobText + text: mainItem.selectedContact && mainItem.selectedContact.core.job + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + } + } + } + } + } + ContactDetailLayout { + visible: false//!SettingsCpp.disableChatFeature + //: "Medias" + label: qsTr("contact_details_medias_title") + Layout.fillWidth: true + content: Button { + style: ButtonStyle.noBackground + contentItem: RowLayout { + EffectImage { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + imageSource: AppIcons.shareNetwork + colorizationColor: DefaultStyle.main2_600 + } + Text { + //: "Afficher les medias partagés" + text: qsTr("contact_details_medias_subtitle") + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + } + Item { + Layout.fillWidth: true + } + EffectImage { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + imageSource: AppIcons.rightArrow + colorizationColor: DefaultStyle.main2_600 + } + } + onClicked: console.debug("TODO : go to shared media") + Accessible.name: qsTr("contact_details_medias_subtitle") + } + } + ContactDetailLayout { + Layout.fillWidth: true + //: "Confiance" + label: qsTr("contact_details_trust_title") + icon: AppIcons.question + onTitleIconClicked: trustInfoDialog.open() + content: ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(13) + Text { + //: "Niveau de confiance - Appareils vérifiés" + text: qsTr("contact_dialog_devices_trust_title") + font { + pixelSize: Typography.p2.pixelSize + weight: Typography.p2.weight + } + } + Text { + visible: deviceList.count === 0 + //: "Aucun appareil" + text: qsTr("contact_details_no_device_found") + } + ProgressBar { + visible: deviceList.count > 0 + Layout.fillWidth: true + 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(Utils.getSizeWithScreenRatio(200), contentHeight) + clip: true + model: mainItem.selectedContact ? mainItem.selectedContact.core.devices : [] + spacing: Utils.getSizeWithScreenRatio(16) + delegate: RowLayout { + id: deviceDelegate + width: deviceList.width + height: Utils.getSizeWithScreenRatio(30) + property var listViewModelData: modelData + property var callObj + property CallGui deviceCall: callObj ? callObj.value : null + //: "Appareil inconnu" + property string deviceName: listViewModelData.name.length != 0 ? listViewModelData.name : qsTr( + "contact_device_without_name") - contentItem: ColumnLayout { - RowLayout { - height: Utils.getSizeWithScreenRatio(50) - visible: companyText.text.length != 0 - Text { - //: "Société :" - text: qsTr("contact_details_company_name") - font { - pixelSize: Typography.p2.pixelSize - weight: Typography.p2.weight - } - } - Text { - id: companyText - text: mainItem.selectedContact - && mainItem.selectedContact.core.organization - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } - } - } - RowLayout { - height: Utils.getSizeWithScreenRatio(50) - visible: jobText.text.length != 0 - Text { - //: "Poste :" - text: qsTr("contact_details_job_title") - font { - pixelSize: Typography.p2.pixelSize - weight: Typography.p2.weight - } - } - Text { - id: jobText - text: mainItem.selectedContact - && mainItem.selectedContact.core.job - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } - } - } - } - } - } - ContactDetailLayout { - visible: false//!SettingsCpp.disableChatFeature - //: "Medias" - label: qsTr("contact_details_medias_title") - Layout.fillWidth: true - content: Button { - style: ButtonStyle.noBackground - contentItem: RowLayout { - EffectImage { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - imageSource: AppIcons.shareNetwork - colorizationColor: DefaultStyle.main2_600 - } - Text { - //: "Afficher les medias partagés" - text: qsTr("contact_details_medias_subtitle") - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } - } - Item { - Layout.fillWidth: true - } - EffectImage { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - imageSource: AppIcons.rightArrow - colorizationColor: DefaultStyle.main2_600 - } - } - onClicked: console.debug( - "TODO : go to shared media") - Accessible.name: qsTr("contact_details_medias_subtitle") - } - } - ContactDetailLayout { - Layout.fillWidth: true - //: "Confiance" - label: qsTr("contact_details_trust_title") - icon: AppIcons.question - onTitleIconClicked: trustInfoDialog.open() - content: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(13) - Text { - //: "Niveau de confiance - Appareils vérifiés" - text: qsTr("contact_dialog_devices_trust_title") - font { - pixelSize: Typography.p2.pixelSize - weight: Typography.p2.weight - } - } - Text { - visible: deviceList.count === 0 - //: "Aucun appareil" - text: qsTr("contact_details_no_device_found") - } - ProgressBar { - visible: deviceList.count > 0 - Layout.fillWidth: true - 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( - Utils.getSizeWithScreenRatio(200), - contentHeight) - clip: true - model: mainItem.selectedContact ? mainItem.selectedContact.core.devices : [] - spacing: Utils.getSizeWithScreenRatio(16) - delegate: RowLayout { - id: deviceDelegate - width: deviceList.width - height: Utils.getSizeWithScreenRatio(30) - property var listViewModelData: modelData - property var callObj - property CallGui deviceCall: callObj ? callObj.value : null - //: "Appareil inconnu" - property string deviceName: listViewModelData.name.length != 0 ? listViewModelData.name : qsTr("contact_device_without_name") - Text { - text: deviceDelegate.deviceName - font.pixelSize: Utils.getSizeWithScreenRatio(14) - } - Item { - Layout.fillWidth: true - } - EffectImage { - visible: listViewModelData.securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified - imageSource: AppIcons.trusted - Layout.preferredWidth: Utils.getSizeWithScreenRatio(22) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(22) - } + Text { + text: deviceDelegate.deviceName + font.pixelSize: Utils.getSizeWithScreenRatio(14) + } + Item { + Layout.fillWidth: true + } + EffectImage { + visible: listViewModelData.securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified + imageSource: AppIcons.trusted + Layout.preferredWidth: Utils.getSizeWithScreenRatio(22) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(22) + } - SmallButton { - // Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) - visible: listViewModelData.securityLevel != LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified - icon.source: AppIcons.warningCircle - style: ButtonStyle.tertiary - //: "Vérifier" - text: qsTr("contact_make_call_check_device_trust") - //: Verify %1 device - Accessible.name: qsTr("verify_device_accessible_name").arg(deviceDelegate.deviceName) - onClicked: { - if (SettingsCpp.getDisplayDeviceCheckConfirmation( - )) { - verifyDevicePopup.deviceName - = deviceDelegate.deviceName - verifyDevicePopup.deviceAddress - = listViewModelData.address - verifyDevicePopup.open() - } else { - UtilsCpp.createCall( - listViewModelData.address, - {}, - LinphoneEnums.MediaEncryption.Zrtp) - parent.callObj = UtilsCpp.getCallByAddress( - listViewModelData.address) - } - } - } - } - } - } - } - ContactDetailLayout { - Layout.fillWidth: true - //: "Autres actions" - label: qsTr("contact_details_actions_title") - content: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(10) - ColumnLayout { - visible: mainItem.selectedContact && mainItem.selectedContact.core.isStored && !mainItem.selectedContact.core.readOnly - IconLabelButton { - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) - icon.source: AppIcons.pencil - //: "Éditer" - text: qsTr("contact_details_edit") - onClicked: mainItem.editContact(mainItem.selectedContact) - style: ButtonStyle.noBackground - } - Rectangle { - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) - color: DefaultStyle.main2_200 - } - } - ColumnLayout { - visible: mainItem.selectedContact && mainItem.selectedContact.core.isStored && !mainItem.selectedContact.core.readOnly - IconLabelButton { - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) - icon.source: mainItem.selectedContact - && mainItem.selectedContact.core.starred ? AppIcons.heartFill : AppIcons.heart - text: mainItem.selectedContact - && mainItem.selectedContact.core.starred - //: "Retirer des favoris" - ? qsTr("contact_details_remove_from_favourites") - //: "Ajouter aux favoris" - : qsTr("contact_details_add_to_favourites") - style: ButtonStyle.noBackground - onClicked: if (mainItem.selectedContact) - mainItem.selectedContact.core.lSetStarred( - !mainItem.selectedContact.core.starred) - } - Rectangle { - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) - color: DefaultStyle.main2_200 - } - } - IconLabelButton { - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) - icon.source: AppIcons.shareNetwork - //: "Partager" - text: qsTr("contact_details_share") - style: ButtonStyle.noBackground - onClicked: { - if (mainItem.selectedContact) { - var vcard = mainItem.selectedContact.core.getVCard() - var username = mainItem.selectedContact.core.givenName - + mainItem.selectedContact.core.familyName - var filepath = UtilsCpp.createVCardFile( - username, vcard) - if (filepath == "") - UtilsCpp.showInformationPopup( - qsTr("information_popup_error_title"), - //: "La création du fichier vcard a échoué" - qsTr("contact_details_share_error_mesage"), - false) - else - mainWindow.showInformationPopup( - //: "VCard créée" - qsTr("contact_details_share_success_title"), - //: "VCard du contact enregistrée dans %1" - qsTr("contact_details_share_success_mesage").arg(filepath)) - UtilsCpp.shareByEmail( - //: "Partage de contact" - qsTr("contact_details_share_email_title"), - vcard, filepath) - } - } - } - // IconLabelButton { - // Layout.fillWidth: true - // 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: Utils.getSizeWithScreenRatio(1) - // color: DefaultStyle.main2_200 - // } - // IconLabelButton { - // Layout.fillWidth: true - // Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) - // icon.source: AppIcons.empty - // text: qsTr("Bloquer") - // onClicked: console.log("TODO : block contact") - // } - // Rectangle { - // Layout.fillWidth: true - // 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: Utils.getSizeWithScreenRatio(1) - color: DefaultStyle.main2_200 - } - IconLabelButton { - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) - icon.source: AppIcons.trashCan - //: "Supprimer ce contact" - text: qsTr("contact_details_delete") - onClicked: { - mainItem.deleteContact(mainItem.selectedContact) - } - style: ButtonStyle.noBackgroundRed - } - } - } - } - Item { - Layout.fillHeight: true - } - } - } - } - } - } + SmallButton { + // Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + visible: listViewModelData.securityLevel != LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified + icon.source: AppIcons.warningCircle + style: ButtonStyle.tertiary + //: "Vérifier" + text: qsTr("contact_make_call_check_device_trust") + //: Verify %1 device + Accessible.name: qsTr("verify_device_accessible_name").arg(deviceDelegate.deviceName) + onClicked: { + if (SettingsCpp.getDisplayDeviceCheckConfirmation()) { + verifyDevicePopup.deviceName = deviceDelegate.deviceName; + verifyDevicePopup.deviceAddress = listViewModelData.address; + verifyDevicePopup.open(); + } else { + UtilsCpp.createCall(listViewModelData.address, {}, LinphoneEnums.MediaEncryption.Zrtp); + parent.callObj = UtilsCpp.getCallByAddress(listViewModelData.address); + } + } + } + } + } + } + } + ContactDetailLayout { + Layout.fillWidth: true + //: "Autres actions" + label: qsTr("contact_details_actions_title") + content: ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(10) + ColumnLayout { + visible: mainItem.selectedContact && mainItem.selectedContact.core.isStored && + !mainItem.selectedContact.core.readOnly + IconLabelButton { + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) + icon.source: AppIcons.pencil + //: "Éditer" + text: qsTr("contact_details_edit") + onClicked: mainItem.editContact(mainItem.selectedContact) + style: ButtonStyle.noBackground + } + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) + color: DefaultStyle.main2_200 + } + } + ColumnLayout { + visible: mainItem.selectedContact && mainItem.selectedContact.core.isStored && + !mainItem.selectedContact.core.readOnly + IconLabelButton { + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) + icon.source: mainItem.selectedContact && mainItem.selectedContact.core.starred ? AppIcons.heartFill : + AppIcons.heart + text: mainItem.selectedContact && mainItem.selectedContact.core.starred ? + //: "Retirer des favoris" + qsTr("contact_details_remove_from_favourites") : + //: "Ajouter aux favoris" + qsTr("contact_details_add_to_favourites") + style: ButtonStyle.noBackground + onClicked: if (mainItem.selectedContact) + mainItem.selectedContact.core.lSetStarred(!mainItem.selectedContact.core.starred) + } + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) + color: DefaultStyle.main2_200 + } + } + IconLabelButton { + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) + icon.source: AppIcons.shareNetwork + //: "Partager" + text: qsTr("contact_details_share") + style: ButtonStyle.noBackground + onClicked: { + if (mainItem.selectedContact) { + var vcard = mainItem.selectedContact.core.getVCard(); + var username = mainItem.selectedContact.core.givenName + mainItem.selectedContact.core.familyName; + var filepath = UtilsCpp.createVCardFile(username, vcard); + if (filepath == "") + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "La création du fichier vcard a échoué" + qsTr("contact_details_share_error_mesage"), false); + else + mainWindow.showInformationPopup( + //: "VCard créée" + qsTr("contact_details_share_success_title"), + //: "VCard du contact enregistrée dans %1" + qsTr("contact_details_share_success_mesage").arg(filepath)); + UtilsCpp.shareByEmail( + //: "Partage de contact" + qsTr("contact_details_share_email_title"), vcard, filepath); + } + } + } + // IconLabelButton { + // Layout.fillWidth: true + // 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: Utils.getSizeWithScreenRatio(1) + // color: DefaultStyle.main2_200 + // } + // IconLabelButton { + // Layout.fillWidth: true + // Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) + // icon.source: AppIcons.empty + // text: qsTr("Bloquer") + // onClicked: console.log("TODO : block contact") + // } + // Rectangle { + // Layout.fillWidth: true + // 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: Utils.getSizeWithScreenRatio(1) + color: DefaultStyle.main2_200 + } + IconLabelButton { + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(50) + icon.source: AppIcons.trashCan + //: "Supprimer ce contact" + text: qsTr("contact_details_delete") + onClicked: { + mainItem.deleteContact(mainItem.selectedContact); + } + style: ButtonStyle.noBackgroundRed + } + } + } + } + Item { + Layout.fillHeight: true + } + } + } + } + } + } + component ContactDetailLayout: ColumnLayout { + id: contactDetailLayout + spacing: Utils.getSizeWithScreenRatio(15) + property string label + property var icon + property alias content: contentControl.contentItem + signal titleIconClicked + RowLayout { + spacing: Utils.getSizeWithScreenRatio(10) + Text { + text: contactDetailLayout.label + color: DefaultStyle.main1_500_main + font { + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight + } + } + RoundButton { + visible: contactDetailLayout.icon != undefined + icon.source: contactDetailLayout.icon + style: ButtonStyle.noBackgroundOrange + onClicked: contactDetailLayout.titleIconClicked() + //: More info %1 + Accessible.name: qsTr("more_info_accessible_name").arg(contactDetailLayout.label) + } + Item { + Layout.fillWidth: true + } + RoundButton { + id: expandButton + style: ButtonStyle.noBackground + checkable: true + checked: true + icon.source: checked ? AppIcons.upArrow : AppIcons.downArrow + KeyNavigation.down: contentControl + Accessible.name: (checked ? + //: Shrink %1 + qsTr("shrink_accessible_name") : + //: Expand %1 + qsTr("expand_accessible_name")).arg(contactDetailLayout.label) + } + } + RoundedPane { + id: contentControl + visible: expandButton.checked + Layout.fillWidth: true + leftPadding: Utils.getSizeWithScreenRatio(20) + rightPadding: Utils.getSizeWithScreenRatio(20) + topPadding: Utils.getSizeWithScreenRatio(17) + bottomPadding: Utils.getSizeWithScreenRatio(17) + } + } + component ActionsButtons: RowLayout { + spacing: Utils.getSizeWithScreenRatio(58) + LabelButton { + button.icon.source: AppIcons.phone + //: "Appel" + label: qsTr("contact_call_action") + 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 { + button.icon.source: AppIcons.chatTeardropText + visible: !SettingsCpp.disableChatFeature + //: "Message" + label: qsTr("contact_message_action") + 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); + } + } + LabelButton { + visible: SettingsCpp.videoEnabled + button.icon.source: AppIcons.videoCamera + //: "Appel vidéo" + label: qsTr("contact_video_call_action") + 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) + } + } - Component { - id: contactEdition - ContactEdition { - property string objectName: "contactEdition" - onCloseEdition: redirectAddress => { - goToContactDetails() - if (redirectAddress) { - initialFriendToDisplay = redirectAddress - } - } - } - } + Component { + id: contactEdition + ContactEdition { + property string objectName: "contactEdition" + onCloseEdition: redirectAddress => { + goToContactDetails(); + if (redirectAddress) { + initialFriendToDisplay = redirectAddress; + } + } + } + } } diff --git a/Linphone/view/Page/Main/Help/HelpPage.qml b/Linphone/view/Page/Main/Help/HelpPage.qml index 71ab04360..06c2b8398 100644 --- a/Linphone/view/Page/Main/Help/HelpPage.qml +++ b/Linphone/view/Page/Main/Help/HelpPage.qml @@ -6,41 +6,39 @@ import Linphone import UtilsCpp import ConstantsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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 showDefaultItem: false - - signal goBack() - + + signal goBack + leftPanelContent: ColumnLayout { id: leftPanel Layout.fillWidth: true Layout.fillHeight: true - property real leftMargin: Utils.getSizeWithScreenRatio(45) - property real rightMargin: Utils.getSizeWithScreenRatio(29) - spacing: Utils.getSizeWithScreenRatio(5) + property real leftMargin: Utils.getSizeWithScreenRatio(45) + property real rightMargin: Utils.getSizeWithScreenRatio(29) + spacing: Utils.getSizeWithScreenRatio(5) RowLayout { Layout.fillWidth: true Layout.leftMargin: leftPanel.leftMargin Layout.rightMargin: leftPanel.rightMargin - spacing: Utils.getSizeWithScreenRatio(8) + spacing: Utils.getSizeWithScreenRatio(8) RoundButton { icon.source: AppIcons.leftArrow style: ButtonStyle.noBackground - icon.width: Utils.getSizeWithScreenRatio(24) - icon.height: Utils.getSizeWithScreenRatio(24) + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) onClicked: { - mainItem.goBack() + mainItem.goBack(); } } Text { - //: "Aide" - text: qsTr("help_title") + //: "Aide" + text: qsTr("help_title") color: DefaultStyle.main2_700 font: Typography.h2 } @@ -60,17 +58,17 @@ AbstractMainPage { visible: source !== "" && status === Image.Ready onStatusChanged: { if (status === Image.Error) { - visible = false + visible = false; } } } Text { Layout.leftMargin: leftPanel.leftMargin Layout.rightMargin: leftPanel.rightMargin - Layout.topMargin: Utils.getSizeWithScreenRatio(aboutImage.visible ? 41 : 24) + Layout.topMargin: Utils.getSizeWithScreenRatio(aboutImage.visible ? 41 : 24) Layout.fillWidth: true - //: "À propos de %1" - text: qsTr("help_about_title").arg(applicationName) + //: "À propos de %1" + text: qsTr("help_about_title").arg(applicationName) color: DefaultStyle.main2_600 font: Typography.h4 } @@ -78,18 +76,18 @@ AbstractMainPage { Layout.fillWidth: true Layout.leftMargin: leftPanel.leftMargin Layout.rightMargin: leftPanel.rightMargin - Layout.topMargin: Utils.getSizeWithScreenRatio(24) - spacing: Utils.getSizeWithScreenRatio(32) + Layout.topMargin: Utils.getSizeWithScreenRatio(24) + spacing: Utils.getSizeWithScreenRatio(32) HelpIconLabelButton { Layout.fillWidth: true iconSource: AppIcons.detective - //: "Règles de confidentialité" - title: qsTr("help_about_privacy_policy_title") - //: Quelles informations %1 collecte et utilise - subTitle: qsTr("help_about_privacy_policy_subtitle").arg(applicationName) + //: "Règles de confidentialité" + title: qsTr("help_about_privacy_policy_title") + //: Quelles informations %1 collecte et utilise + subTitle: qsTr("help_about_privacy_policy_subtitle").arg(applicationName) onClicked: { - rightPanelStackView.clear() - Qt.openUrlExternally(ConstantsCpp.PrivatePolicyUrl) + rightPanelStackView.clear(); + Qt.openUrlExternally(ConstantsCpp.PrivatePolicyUrl); } } RowLayout { @@ -102,7 +100,9 @@ AbstractMainPage { subTitle: AppCpp.shortApplicationVersion onClicked: {} } - Item{Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } MediumButton { style: ButtonStyle.tertiary Layout.fillWidth: true @@ -114,32 +114,33 @@ AbstractMainPage { HelpIconLabelButton { Layout.fillWidth: true iconSource: AppIcons.license - //: "Licences GPLv3" - title: qsTr("help_about_gpl_licence_title") - subTitle: (copyrightRangeDate || applicationVendor ? '\u00A9 ': '') + (copyrightRangeDate ? copyrightRangeDate : '')+ (applicationVendor ? ' ' + applicationVendor : '') + //: "Licences GPLv3" + title: qsTr("help_about_gpl_licence_title") + subTitle: (copyrightRangeDate || applicationVendor ? '\u00A9 ' : '') + (copyrightRangeDate ? copyrightRangeDate : + '') + (applicationVendor ? ' ' + applicationVendor : '') onClicked: { - rightPanelStackView.clear() - Qt.openUrlExternally(applicationLicenceUrl) + rightPanelStackView.clear(); + Qt.openUrlExternally(applicationLicenceUrl); } } HelpIconLabelButton { Layout.fillWidth: true iconSource: AppIcons.world - //: "Contribuer à la traduction de %1" - title: qsTr("help_about_contribute_translations_title").arg(applicationName) + //: "Contribuer à la traduction de %1" + title: qsTr("help_about_contribute_translations_title").arg(applicationName) onClicked: { - rightPanelStackView.clear() - Qt.openUrlExternally(ConstantsCpp.TranslationUrl) + rightPanelStackView.clear(); + Qt.openUrlExternally(ConstantsCpp.TranslationUrl); } } } Text { Layout.leftMargin: leftPanel.leftMargin Layout.rightMargin: leftPanel.rightMargin - Layout.topMargin: Utils.getSizeWithScreenRatio(32) + Layout.topMargin: Utils.getSizeWithScreenRatio(32) Layout.fillWidth: true - //: "À propos de %1" - text: qsTr("help_about_title").arg(applicationName) + //: "À propos de %1" + text: qsTr("help_about_title").arg(applicationName) color: DefaultStyle.main2_600 font: Typography.h4 } @@ -148,14 +149,17 @@ AbstractMainPage { Layout.fillWidth: true Layout.leftMargin: leftPanel.leftMargin Layout.rightMargin: leftPanel.rightMargin - Layout.topMargin: Utils.getSizeWithScreenRatio(24) + Layout.topMargin: Utils.getSizeWithScreenRatio(24) iconSource: AppIcons.debug arrowImageVisible: true - //: "Dépannage" - title: qsTr("help_troubleshooting_title") + //: "Dépannage" + title: qsTr("help_troubleshooting_title") onClicked: { - rightPanelStackView.clear() - rightPanelStackView.push("qrc:/qt/qml/Linphone/view/Page/Layout/Settings/DebugSettingsLayout.qml", { titleText: troubleShooting.title, container: rightPanelStackView }) + rightPanelStackView.clear(); + rightPanelStackView.push("qrc:/qt/qml/Linphone/view/Page/Layout/Settings/DebugSettingsLayout.qml", { + titleText: troubleShooting.title, + container: rightPanelStackView + }); } } Item { diff --git a/Linphone/view/Page/Main/Meeting/MeetingPage.qml b/Linphone/view/Page/Main/Meeting/MeetingPage.qml index a57b9fe9f..b62cad2c2 100644 --- a/Linphone/view/Page/Main/Meeting/MeetingPage.qml +++ b/Linphone/view/Page/Main/Meeting/MeetingPage.qml @@ -4,7 +4,7 @@ import QtQuick.Layouts 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // TODO : spacing @@ -12,70 +12,75 @@ AbstractMainPage { id: mainItem property ConferenceInfoGui selectedConference property int meetingListCount: 0 - signal returnRequested() + signal returnRequested signal addParticipantsValidated(list selectedParticipants) - //: "Créer une réunion" - noItemButtonText: qsTr("meetings_add") - //: "Aucune réunion" - emptyListText: qsTr("meetings_list_empty") + //: "Créer une réunion" + noItemButtonText: qsTr("meetings_add") + //: "Aucune réunion" + emptyListText: qsTr("meetings_list_empty") newItemIconSource: AppIcons.plusCircle - rightPanelColor: selectedConference ? DefaultStyle.grey_0 : DefaultStyle.grey_100 - showDefaultItem: leftPanelStackView.currentItem && leftPanelStackView.currentItem.objectName === "listLayout" && meetingListCount === 0 + rightPanelColor: selectedConference ? DefaultStyle.grey_0 : DefaultStyle.grey_100 + showDefaultItem: leftPanelStackView.currentItem && leftPanelStackView.currentItem.objectName === "listLayout" + && meetingListCount === 0 - rightPanelStackView.width: Utils.getSizeWithScreenRatio(393) + rightPanelStackView.width: Utils.getSizeWithScreenRatio(393) rightPanelStackTopMargin: Utils.getSizeWithScreenRatio(45) rightPanelStackBottomMargin: Utils.getSizeWithScreenRatio(30) - /** - * Focus on the first pertinent element in the page (LINQT-2202) - * @override - */ - function forceActiveFocus(reason = undefined){ - leftPanelStackView.currentItem?.newConfButton?.forceActiveFocus(reason) - } - + /** + * Focus on the first pertinent element in the page (LINQT-2202) + * @override + */ + function forceActiveFocus(reason = undefined) { + leftPanelStackView.currentItem?.newConfButton?.forceActiveFocus(reason); + } function createPreFilledMeeting(subject, addresses) { mainItem.selectedConference = Qt.createQmlObject('import Linphone ConferenceInfoGui{ - }', mainItem) - mainItem.selectedConference.core.resetParticipants(addresses) - mainItem.selectedConference.core.subject = subject - var item = leftPanelStackView.push(createConf, {"conferenceInfoGui": mainItem.selectedConference}) - item.forceActiveFocus() + }', mainItem); + mainItem.selectedConference.core.resetParticipants(addresses); + mainItem.selectedConference.core.subject = subject; + var item = leftPanelStackView.push(createConf, { + "conferenceInfoGui": mainItem.selectedConference + }); + item.forceActiveFocus(); } - function editConference(confInfoGui = null) { - var isCreation = !confInfoGui - var item + var isCreation = !confInfoGui; + var item; if (isCreation) { confInfoGui = Qt.createQmlObject('import Linphone ConferenceInfoGui{ - }', mainItem) - mainItem.selectedConference = confInfoGui - item = leftPanelStackView.push(createConf, {"conferenceInfoGui": mainItem.selectedConference}) - item.forceActiveFocus() + }', mainItem); + mainItem.selectedConference = confInfoGui; + item = leftPanelStackView.push(createConf, { + "conferenceInfoGui": mainItem.selectedConference + }); + item.forceActiveFocus(); } else { - mainItem.selectedConference = confInfoGui - item = rightPanelStackView.push(editConf, {"conferenceInfoGui": mainItem.selectedConference}) - item.forceActiveFocus() + mainItem.selectedConference = confInfoGui; + item = rightPanelStackView.push(editConf, { + "conferenceInfoGui": mainItem.selectedConference + }); + item.forceActiveFocus(); } } - - + onVisibleChanged: if (!visible) { - leftPanelStackView.clear() - leftPanelStackView.push(leftPanelStackView.initialItem) - } + leftPanelStackView.clear(); + leftPanelStackView.push(leftPanelStackView.initialItem); + } onSelectedConferenceChanged: { // While a conference is being created or edited, we need to stay on the edition page - rightPanelStackView.clear() - if ((rightPanelStackView.currentItem && rightPanelStackView.currentItem.objectName === "editConf") - || (leftPanelStackView.currentItem && leftPanelStackView.currentItem.objectName === "createConf")) return + rightPanelStackView.clear(); + if ((rightPanelStackView.currentItem && rightPanelStackView.currentItem.objectName === "editConf") || ( + leftPanelStackView.currentItem && leftPanelStackView.currentItem.objectName === "createConf")) + return; if (selectedConference && selectedConference.core && selectedConference.core.haveModel) { - rightPanelStackView.push(meetingDetail, Control.StackView.Immediate) + rightPanelStackView.push(meetingDetail, Control.StackView.Immediate); } } @@ -85,49 +90,49 @@ AbstractMainPage { id: cancelAndDeleteConfDialog property ConferenceInfoGui confInfoToDelete property bool cancel: false - signal cancelRequested() - // 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 ? - : qsTr("meeting_schedule_delete_dialog_message") + signal cancelRequested + // 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 ? + qsTr("meeting_schedule_delete_dialog_message") onCancelRequested: { - confInfoToDelete.core.lCancelConferenceInfo() + confInfoToDelete.core.lCancelConferenceInfo(); } onAccepted: { - confInfoToDelete.core.lDeleteConferenceInfo() + confInfoToDelete.core.lDeleteConferenceInfo(); } buttons: [ BigButton { visible: cancelAndDeleteConfDialog.cancel style: ButtonStyle.main - //: "Annuler et supprimer" - text: qsTr("meeting_schedule_cancel_and_delete_action") + //: "Annuler et supprimer" + text: qsTr("meeting_schedule_cancel_and_delete_action") onClicked: { - cancelAndDeleteConfDialog.cancelRequested() - cancelAndDeleteConfDialog.accepted() - cancelAndDeleteConfDialog.close() + cancelAndDeleteConfDialog.cancelRequested(); + cancelAndDeleteConfDialog.accepted(); + cancelAndDeleteConfDialog.close(); } }, BigButton { - //: "Supprimer seulement" - text: cancelAndDeleteConfDialog.cancel ? qsTr("meeting_schedule_delete_only_action") - //: "Supprimer" - : qsTr("meeting_schedule_delete_action") + //: "Supprimer seulement" + text: cancelAndDeleteConfDialog.cancel ? qsTr("meeting_schedule_delete_only_action") : + //: "Supprimer" + qsTr("meeting_schedule_delete_action") style: ButtonStyle.main onClicked: { - cancelAndDeleteConfDialog.accepted() - cancelAndDeleteConfDialog.close() + cancelAndDeleteConfDialog.accepted(); + cancelAndDeleteConfDialog.close(); } }, BigButton { - //: Retour - text: qsTr("back_action") + //: Retour + text: qsTr("back_action") style: ButtonStyle.secondary onClicked: { - cancelAndDeleteConfDialog.rejected() - cancelAndDeleteConfDialog.close() + cancelAndDeleteConfDialog.rejected(); + cancelAndDeleteConfDialog.close(); } } ] @@ -144,14 +149,14 @@ AbstractMainPage { Component { id: listLayout - FocusScope{ + FocusScope { property string objectName: "listLayout" property alias newConfButton: newConfButton Control.StackView.onDeactivated: { - mainItem.selectedConference = null + mainItem.selectedConference = null; } Control.StackView.onActivated: { - mainItem.selectedConference = conferenceList.selectedConference + mainItem.selectedConference = conferenceList.selectedConference; } enabled: !rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName !== "editConf" @@ -185,7 +190,7 @@ AbstractMainPage { icon.height: Utils.getSizeWithScreenRatio(28) KeyNavigation.down: scrollToCurrentDateButton onClicked: { - mainItem.editConference() + mainItem.editConference(); } } } @@ -225,9 +230,9 @@ AbstractMainPage { Layout.fillHeight: true Layout.alignment: Qt.AlignHCenter //: "Aucun résultat…" - text: searchBar.text.length !== 0 ? qsTr("list_filter_no_result_found") + text: searchBar.text.length !== 0 ? qsTr("list_filter_no_result_found") : //: "Aucune réunion" - : qsTr("meetings_empty_list") + qsTr("meetings_empty_list") font { pixelSize: Typography.h4.pixelSize weight: Typography.h4.weight @@ -245,7 +250,7 @@ AbstractMainPage { searchBarText: searchBar.text onCountChanged: { - mainItem.meetingListCount = count + mainItem.meetingListCount = count; } Binding { target: mainItem @@ -254,23 +259,23 @@ AbstractMainPage { value: false } onSelectedConferenceChanged: { - mainItem.selectedConference = selectedConference + mainItem.selectedConference = selectedConference; } onMeetingDeletionRequested: (confInfo, canCancel) => { - cancelAndDeleteConfDialog.confInfoToDelete = confInfo - cancelAndDeleteConfDialog.cancel = canCancel - cancelAndDeleteConfDialog.open() - } + cancelAndDeleteConfDialog.confInfoToDelete = confInfo; + cancelAndDeleteConfDialog.cancel = canCancel; + cancelAndDeleteConfDialog.open(); + } - Keys.onPressed: (event) => { - if(event.key == Qt.Key_Escape){ - searchBar.forceActiveFocus() - event.accepted = true - }else if(event.key == Qt.Key_Right){ - rightPanelStackView.currentItem.forceActiveFocus() - event.accepted = true - } - } + Keys.onPressed: event => { + if (event.key == Qt.Key_Escape) { + searchBar.forceActiveFocus(); + event.accepted = true; + } else if (event.key == Qt.Key_Right) { + rightPanelStackView.currentItem.forceActiveFocus(); + event.accepted = true; + } + } } } } @@ -278,7 +283,7 @@ AbstractMainPage { Component { id: createConf - FocusScope{ + FocusScope { id: createConfLayout objectName: "createConf" property ConferenceInfoGui conferenceInfoGui @@ -298,8 +303,8 @@ AbstractMainPage { KeyNavigation.right: createButton KeyNavigation.down: meetingSetup onClicked: { - meetingSetup.conferenceInfoGui.core.undo() - leftPanelStackView.pop() + meetingSetup.conferenceInfoGui.core.undo(); + leftPanelStackView.pop(); } } Text { @@ -312,7 +317,9 @@ AbstractMainPage { } Layout.fillWidth: true } - Item {Layout.fillWidth: true} + Item { + Layout.fillWidth: true + } SmallButton { id: createButton text: qsTr("create") @@ -321,20 +328,21 @@ AbstractMainPage { KeyNavigation.down: meetingSetup onClicked: { - if (meetingSetup.conferenceInfoGui.core.subject.length === 0 || meetingSetup.conferenceInfoGui.core.participantCount === 0) { + if (meetingSetup.conferenceInfoGui.core.subject.length === 0 + || meetingSetup.conferenceInfoGui.core.participantCount === 0) { UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), //: Veuillez saisir un titre et sélectionner au moins un participant - qsTr("meeting_schedule_mandatory_field_not_filled_toast"), false) + qsTr("meeting_schedule_mandatory_field_not_filled_toast"), false); } else if (meetingSetup.conferenceInfoGui.core.duration <= 0) { UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), //: "La fin de la conférence doit être plus récente que son début" - qsTr("meeting_schedule_duration_error_toast"), false) + qsTr("meeting_schedule_duration_error_toast"), false); } else { - meetingSetup.conferenceInfoGui.core.save() + meetingSetup.conferenceInfoGui.core.save(); //: "Création de la réunion en cours …" mainWindow.showLoadingPopup(qsTr("meeting_schedule_creation_in_progress"), true, function () { - meetingSetup.conferenceInfoGui.core.lCancelCreation() - }) + meetingSetup.conferenceInfoGui.core.lCancelCreation(); + }); } } } @@ -361,44 +369,49 @@ AbstractMainPage { Connections { target: meetingSetup.conferenceInfoGui ? meetingSetup.conferenceInfoGui.core : null function onConferenceSchedulerStateChanged() { - var mainWin = UtilsCpp.getMainWindow() + var mainWin = UtilsCpp.getMainWindow(); if (meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Ready) { - leftPanelStackView.pop() + leftPanelStackView.pop(); //: "Nouvelle réunion" UtilsCpp.showInformationPopup(qsTr("meeting_schedule_title"), - //: "Réunion planifiée avec succès" - qsTr("meeting_info_created_toast"), true) - mainWindow.closeLoadingPopup() - } - else if (meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.AllocationPending - || meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Updating) { + //: "Réunion planifiée avec succès" + qsTr("meeting_info_created_toast"), true); + mainWindow.closeLoadingPopup(); + } else if (meetingSetup.conferenceInfoGui.core.schedulerState + == LinphoneEnums.ConferenceSchedulerState.AllocationPending + || meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Updating) { mainWin.showLoadingPopup(qsTr("meeting_schedule_creation_in_progress"), true, function () { - leftPanelStackView.pop() - }) + leftPanelStackView.pop(); + }); } else { if (meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Error) { UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: "Échec de création de la réunion !" - qsTr("meeting_failed_to_schedule_toast"), false) + //: "Échec de création de la réunion !" + qsTr("meeting_failed_to_schedule_toast"), false); } - mainWin.closeLoadingPopup() + mainWin.closeLoadingPopup(); } - createConfLayout.enabled = meetingSetup.conferenceInfoGui.core.schedulerState != LinphoneEnums.ConferenceSchedulerState.AllocationPending + createConfLayout.enabled = meetingSetup.conferenceInfoGui.core.schedulerState + != LinphoneEnums.ConferenceSchedulerState.AllocationPending; } function onSaveFailed() { - var mainWin = UtilsCpp.getMainWindow() - mainWin.closeLoadingPopup() + var mainWin = UtilsCpp.getMainWindow(); + mainWin.closeLoadingPopup(); } } onAddParticipantsRequested: { - leftPanelStackView.push(addParticipants, {"conferenceInfoGui": conferenceInfoGui, "container": leftPanelStackView, "overridenWidth": leftPanelStackView.width}) + leftPanelStackView.push(addParticipants, { + "conferenceInfoGui": conferenceInfoGui, + "container": leftPanelStackView, + "overridenWidth": leftPanelStackView.width + }); } Connections { target: mainItem - onAddParticipantsValidated: (selectedParticipants) => { - meetingSetup.conferenceInfoGui.core.resetParticipants(selectedParticipants) - leftPanelStackView.pop() - } + onAddParticipantsValidated: selectedParticipants => { + meetingSetup.conferenceInfoGui.core.resetParticipants(selectedParticipants); + leftPanelStackView.pop(); + } } } } @@ -408,7 +421,7 @@ AbstractMainPage { Component { id: editConf - FocusScope{ + FocusScope { id: editFocusScope objectName: "editConf" property ConferenceInfoGui conferenceInfoGui @@ -438,13 +451,13 @@ AbstractMainPage { KeyNavigation.down: conferenceEdit KeyNavigation.up: conferenceEdit onClicked: { - conferenceEdit.conferenceInfoGui.core.undo() - rightPanelStackView.pop() + conferenceEdit.conferenceInfoGui.core.undo(); + rightPanelStackView.pop(); } } RowLayout { spacing: Utils.getSizeWithScreenRatio(8) - EffectImage{ + EffectImage { imageSource: AppIcons.videoconference colorizationColor: DefaultStyle.main2_600 Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) @@ -463,10 +476,11 @@ AbstractMainPage { KeyNavigation.right: saveButton KeyNavigation.down: conferenceEdit KeyNavigation.up: conferenceEdit - onActiveFocusChanged: if(activeFocus==true) selectAll() + onActiveFocusChanged: if (activeFocus == true) + selectAll() onTextEdited: mainItem.selectedConference.core.subject = text Component.onCompleted: { - text = mainItem.selectedConference.core.subject + text = mainItem.selectedConference.core.subject; } } SmallButton { @@ -479,14 +493,15 @@ AbstractMainPage { KeyNavigation.down: conferenceEdit KeyNavigation.up: conferenceEdit onClicked: { - if (mainItem.selectedConference.core.subject.length === 0 || mainItem.selectedConference.core.participantCount === 0) { - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - qsTr("meeting_schedule_mandatory_field_not_filled_toast"), false) + if (mainItem.selectedConference.core.subject.length === 0 || mainItem.selectedConference.core.participantCount + === 0) { + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), qsTr( + "meeting_schedule_mandatory_field_not_filled_toast"), false); } else if (mainItem.selectedConference.core.duration <= 0) { - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - qsTr("meeting_schedule_duration_error_toast"), false) + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), qsTr( + "meeting_schedule_duration_error_toast"), false); } else { - mainItem.selectedConference.core.save() + mainItem.selectedConference.core.save(); } } } @@ -501,13 +516,17 @@ AbstractMainPage { conferenceInfoGui: editFocusScope.conferenceInfoGui onAddParticipantsRequested: { - rightPanelStackView.push(addParticipants, {"conferenceInfoGui": conferenceInfoGui, "container": rightPanelStackView, "overridenWidth": Utils.getSizeWithScreenRatio(393)}) + rightPanelStackView.push(addParticipants, { + "conferenceInfoGui": conferenceInfoGui, + "container": rightPanelStackView, + "overridenWidth": Utils.getSizeWithScreenRatio(393) + }); } Connections { target: mainItem function onAddParticipantsValidated(selectedParticipants) { - conferenceEdit.conferenceInfoGui.core.resetParticipants(selectedParticipants) - rightPanelStackView.pop() + conferenceEdit.conferenceInfoGui.core.resetParticipants(selectedParticipants); + rightPanelStackView.pop(); } } Connections { @@ -515,29 +534,32 @@ AbstractMainPage { target: conferenceEdit.conferenceInfoGui ? conferenceEdit.conferenceInfoGui.core : null ignoreUnknownSignals: true function onSaveFailed() { - UtilsCpp.getMainWindow().closeLoadingPopup() + UtilsCpp.getMainWindow().closeLoadingPopup(); } function onSchedulerStateChanged() { - editFocusScope.enabled = conferenceEdit.conferenceInfoGui.core.schedulerState != LinphoneEnums.ConferenceSchedulerState.AllocationPending + editFocusScope.enabled = conferenceEdit.conferenceInfoGui.core.schedulerState + != LinphoneEnums.ConferenceSchedulerState.AllocationPending; if (conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Ready) { - UtilsCpp.getMainWindow().closeLoadingPopup() - rightPanelStackView.pop() + UtilsCpp.getMainWindow().closeLoadingPopup(); + rightPanelStackView.pop(); //: "Enregistré" UtilsCpp.showInformationPopup(qsTr("saved"), //: "Réunion mise à jour" - qsTr("meeting_info_updated_toast"), true) - } - else if (conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.AllocationPending - || conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Updating) { - //: "Modification de la réunion en cours…" - UtilsCpp.getMainWindow().showLoadingPopup(qsTr("meeting_schedule_edit_in_progress"), true, function(){ - conferenceEdit.conferenceInfoGui.core.undo() - }) - } else if (conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Error) { + qsTr("meeting_info_updated_toast"), true); + } else if (conferenceEdit.conferenceInfoGui.core.schedulerState + == LinphoneEnums.ConferenceSchedulerState.AllocationPending + || conferenceEdit.conferenceInfoGui.core.schedulerState + == LinphoneEnums.ConferenceSchedulerState.Updating) { + //: "Modification de la réunion en cours…" + UtilsCpp.getMainWindow().showLoadingPopup(qsTr("meeting_schedule_edit_in_progress"), true, function () { + conferenceEdit.conferenceInfoGui.core.undo(); + }); + } else if (conferenceEdit.conferenceInfoGui.core.schedulerState + == LinphoneEnums.ConferenceSchedulerState.Error) { UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), //: "Échec de la modification de la réunion !" - qsTr("meeting_failed_to_edit_toast"), false) - UtilsCpp.getMainWindow().closeLoadingPopup() + qsTr("meeting_failed_to_edit_toast"), false); + UtilsCpp.getMainWindow().closeLoadingPopup(); } } } @@ -548,7 +570,7 @@ AbstractMainPage { Component { id: addParticipants - FocusScope{ + FocusScope { id: addParticipantInItem property int overridenWidth property Control.StackView container @@ -602,13 +624,14 @@ AbstractMainPage { KeyNavigation.left: addParticipantsBackButton KeyNavigation.down: addParticipantsForm onClicked: { - mainItem.addParticipantsValidated(addParticipantsForm.selectedParticipants) + mainItem.addParticipantsValidated(addParticipantsForm.selectedParticipants); } } } Text { //: "%n participant(s) sélectionné(s)" - text: qsTr("group_call_participant_selected", '', addParticipantsForm.selectedParticipantsCount).arg(addParticipantsForm.selectedParticipantsCount) + text: qsTr("group_call_participant_selected", '', addParticipantsForm.selectedParticipantsCount).arg( + addParticipantsForm.selectedParticipantsCount) color: DefaultStyle.main2_500_main Layout.leftMargin: addParticipantsBackButton.width + addParticipantsButtons.spacing maximumLineCount: 1 @@ -632,7 +655,7 @@ AbstractMainPage { Component { id: meetingDetail - FocusScope{ + FocusScope { width: Utils.getSizeWithScreenRatio(393) anchors.horizontalCenter: parent?.horizontalCenter ColumnLayout { @@ -646,7 +669,7 @@ AbstractMainPage { uniformCellSizes: true // direction: FlexboxLayout.Column // alignContent: FlexboxLayout.AlignSpaceBetween - ColumnLayout{ + ColumnLayout { Layout.alignment: Qt.AlignTop spacing: Utils.getSizeWithScreenRatio(16) Section { @@ -662,7 +685,8 @@ AbstractMainPage { } Text { Layout.fillWidth: true - text: mainItem.selectedConference && mainItem.selectedConference.core? mainItem.selectedConference.core.subject : "" + text: mainItem.selectedConference && mainItem.selectedConference.core + ? mainItem.selectedConference.core.subject : "" maximumLineCount: 1 font { pixelSize: Utils.getSizeWithScreenRatio(20) @@ -698,17 +722,18 @@ AbstractMainPage { popup.contentItem: IconLabelButton { style: ButtonStyle.hoveredBackgroundRed property var isMeObj: UtilsCpp.isMe(mainItem.selectedConference?.core?.organizerAddress) - property bool canCancel: isMeObj && isMeObj.value && mainItem.selectedConference?.core?.state !== LinphoneEnums.ConferenceInfoState.Cancelled + property bool canCancel: isMeObj && isMeObj.value && mainItem.selectedConference?.core?.state + !== LinphoneEnums.ConferenceInfoState.Cancelled icon.source: AppIcons.trashCan //: "Supprimer la réunion" text: qsTr("meeting_info_delete") onClicked: { if (mainItem.selectedConference) { - cancelAndDeleteConfDialog.confInfoToDelete = mainItem.selectedConference - cancelAndDeleteConfDialog.cancel = canCancel - cancelAndDeleteConfDialog.open() - deletePopup.close() + cancelAndDeleteConfDialog.confInfoToDelete = mainItem.selectedConference; + cancelAndDeleteConfDialog.cancel = canCancel; + cancelAndDeleteConfDialog.open(); + deletePopup.close(); } } } @@ -737,19 +762,19 @@ AbstractMainPage { textWeight: Typography.p1.weight underline: true style: ButtonStyle.noBackground - Keys.onPressed: (event)=> { - if (event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { - clicked(undefined) - event.accepted = true; - } - } + Keys.onPressed: event => { + if (event.key == Qt.Key_Space || event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { + clicked(undefined); + event.accepted = true; + } + } KeyNavigation.left: shareNetworkButton KeyNavigation.right: shareNetworkButton KeyNavigation.up: deletePopup KeyNavigation.down: joinButton onClicked: { // TODO : voir si c'est en audio only quand on clique sur le lien - UtilsCpp.createCall(mainItem.selectedConference.core.uri) + UtilsCpp.createCall(mainItem.selectedConference.core.uri); } } RoundButton { @@ -761,10 +786,11 @@ AbstractMainPage { KeyNavigation.up: deletePopup KeyNavigation.down: joinButton onClicked: { - var success = UtilsCpp.copyToClipboard(mainItem.selectedConference.core.uri) - if (success) UtilsCpp.showInformationPopup(qsTr("saved"), - //: "Adresse de la réunion copiée" - qsTr("meeting_address_copied_to_clipboard_toast")) + var success = UtilsCpp.copyToClipboard(mainItem.selectedConference.core.uri); + if (success) + UtilsCpp.showInformationPopup(qsTr("saved"), + //: "Adresse de la réunion copiée" + qsTr("meeting_address_copied_to_clipboard_toast")); } } } @@ -777,12 +803,10 @@ AbstractMainPage { colorizationColor: DefaultStyle.main2_600 } Text { - text: mainItem.selectedConference && mainItem.selectedConference.core - ? UtilsCpp.toDateString(mainItem.selectedConference.core.dateTime) - + " | " + UtilsCpp.toDateHourString(mainItem.selectedConference.core.dateTime) - + " - " - + UtilsCpp.toDateHourString(mainItem.selectedConference.core.endDateTime) - : '' + text: mainItem.selectedConference && mainItem.selectedConference.core ? UtilsCpp.toDateString( + mainItem.selectedConference.core.dateTime) + " | " + UtilsCpp.toDateHourString( + mainItem.selectedConference.core.dateTime) + " - " + UtilsCpp.toDateHourString( + mainItem.selectedConference.core.endDateTime) : '' font { pixelSize: Utils.getSizeWithScreenRatio(14) capitalization: Font.Capitalize @@ -800,7 +824,10 @@ AbstractMainPage { Text { Layout.fillWidth: true //: "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) : "") + 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: Utils.getSizeWithScreenRatio(14) capitalization: Font.Capitalize @@ -821,7 +848,8 @@ AbstractMainPage { colorizationColor: DefaultStyle.main2_600 } Text { - text: mainItem.selectedConference && mainItem.selectedConference.core ? mainItem.selectedConference.core.description : "" + text: mainItem.selectedConference && mainItem.selectedConference.core + ? mainItem.selectedConference.core.description : "" Layout.fillWidth: true font { pixelSize: Utils.getSizeWithScreenRatio(14) @@ -836,7 +864,7 @@ AbstractMainPage { KeyNavigation.up: shareNetworkButton KeyNavigation.down: joinButton onClicked: { - mainItem.selectedConference.core.exportConferenceToICS() + mainItem.selectedConference.core.exportConferenceToICS(); } } } @@ -854,11 +882,13 @@ AbstractMainPage { Avatar { Layout.preferredWidth: Utils.getSizeWithScreenRatio(45) Layout.preferredHeight: Utils.getSizeWithScreenRatio(45) - _address: mainItem.selectedConference && mainItem.selectedConference.core ? mainItem.selectedConference.core.organizerAddress : "" + _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 : "" + text: mainItem.selectedConference && mainItem.selectedConference.core + ? mainItem.selectedConference.core.organizerName : "" font { pixelSize: Utils.getSizeWithScreenRatio(14) capitalization: Font.Capitalize @@ -871,8 +901,7 @@ AbstractMainPage { Layout.fillWidth: true Layout.fillHeight: true Layout.maximumHeight: participantList.contentHeight + Utils.getSizeWithScreenRatio(1) + spacing - content: - RowLayout { + content: RowLayout { width: Utils.getSizeWithScreenRatio(393) spacing: Utils.getSizeWithScreenRatio(8) EffectImage { @@ -889,7 +918,8 @@ AbstractMainPage { Layout.fillWidth: true Layout.fillHeight: true height: contentHeight - model: mainItem.selectedConference && mainItem.selectedConference.core ? mainItem.selectedConference.core.participants : [] + model: mainItem.selectedConference && mainItem.selectedConference.core + ? mainItem.selectedConference.core.participants : [] clip: true Control.ScrollBar.vertical: ScrollBar { id: participantScrollBar @@ -921,7 +951,8 @@ AbstractMainPage { Text { //: "Organisateur" text: qsTr("meeting_info_organizer_label") - visible: mainItem.selectedConference && mainItem.selectedConference.core?.organizerAddress === modelData.address + visible: mainItem.selectedConference && mainItem.selectedConference.core?.organizerAddress + === modelData.address color: DefaultStyle.main2_400 font { pixelSize: Utils.getSizeWithScreenRatio(12) @@ -934,7 +965,8 @@ AbstractMainPage { } BigButton { id: joinButton - visible: mainItem.selectedConference && mainItem.selectedConference.core?.state !== LinphoneEnums.ConferenceInfoState.Cancelled + visible: mainItem.selectedConference && mainItem.selectedConference.core?.state + !== LinphoneEnums.ConferenceInfoState.Cancelled Layout.fillWidth: true //: "Rejoindre la réunion" text: qsTr("meeting_info_join_title") @@ -944,15 +976,14 @@ AbstractMainPage { KeyNavigation.left: leftPanelStackView.currentItem KeyNavigation.right: leftPanelStackView.currentItem onClicked: { - console.log(mainItem.selectedConference.core.uri) - var callsWindow = UtilsCpp.getOrCreateCallsWindow() - callsWindow.setupConference(mainItem.selectedConference) - UtilsCpp.smartShowWindow(callsWindow) + console.log(mainItem.selectedConference.core.uri); + var callsWindow = UtilsCpp.getOrCreateCallsWindow(); + callsWindow.setupConference(mainItem.selectedConference); + UtilsCpp.smartShowWindow(callsWindow); } } } } } } - } diff --git a/Linphone/view/Page/Main/Start/WelcomePage.qml b/Linphone/view/Page/Main/Start/WelcomePage.qml index 811e71694..7164c83ab 100644 --- a/Linphone/view/Page/Main/Start/WelcomePage.qml +++ b/Linphone/view/Page/Main/Start/WelcomePage.qml @@ -3,37 +3,37 @@ 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/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils LoginLayout { id: mainItem - signal startButtonPressed() + signal startButtonPressed titleContent: [ Text { id: welcome - //: "Bienvenue" - text: qsTr("welcome_page_title") + //: "Bienvenue" + text: qsTr("welcome_page_title") Layout.alignment: Qt.AlignVCenter - Layout.leftMargin: Utils.getSizeWithScreenRatio(132) + Layout.leftMargin: Utils.getSizeWithScreenRatio(132) color: DefaultStyle.main2_800 font { - pixelSize: Utils.getSizeWithScreenRatio(96) - weight: Typography.h4.weight - } + pixelSize: Utils.getSizeWithScreenRatio(96) + weight: Typography.h4.weight + } scaleLettersFactor: 1.1 }, Text { Layout.alignment: Qt.AlignBottom - Layout.leftMargin: Utils.getSizeWithScreenRatio(29) - Layout.bottomMargin: Utils.getSizeWithScreenRatio(19) + Layout.leftMargin: Utils.getSizeWithScreenRatio(29) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(19) color: DefaultStyle.main2_800 - //: "sur %1" - text: qsTr("welcome_page_subtitle").arg(applicationName) + //: "sur %1" + text: qsTr("welcome_page_subtitle").arg(applicationName) font { - pixelSize: Typography.h1.pixelSize - weight: Typography.h1.weight + pixelSize: Typography.h1.pixelSize + weight: Typography.h1.weight } scaleLettersFactor: 1.1 }, @@ -43,72 +43,80 @@ LoginLayout { SmallButton { visible: carousel.currentIndex < (carousel.itemsCount - 1) flat: true - Layout.rightMargin: Utils.getSizeWithScreenRatio(50) + Layout.rightMargin: Utils.getSizeWithScreenRatio(50) Layout.alignment: Qt.AlignVCenter | Layout.AlignRight style: ButtonStyle.noBackground - //: "Passer" - text: qsTr("welcome_carousel_skip") + //: "Passer" + text: qsTr("welcome_carousel_skip") underline: true onClicked: { - console.debug("[WelcomePage] User: Click skip") - mainItem.startButtonPressed() + console.debug("[WelcomePage] User: Click skip"); + mainItem.startButtonPressed(); } } ] centerContent: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(76) + spacing: Utils.getSizeWithScreenRatio(76) anchors.left: parent.left anchors.top: parent.top - anchors.leftMargin: Utils.getSizeWithScreenRatio(308) - anchors.topMargin: Utils.getSizeWithScreenRatio(166) + anchors.leftMargin: Utils.getSizeWithScreenRatio(308) + anchors.topMargin: Utils.getSizeWithScreenRatio(166) RowLayout { id: carouselLayout - spacing: Utils.getSizeWithScreenRatio(76) + spacing: Utils.getSizeWithScreenRatio(76) Image { id: carouselImg - // Layout.rightMargin: Utils.getSizeWithScreenRatio(40) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(153) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(156) + // 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 + source: carousel.currentIndex == 0 ? AppIcons.welcomeLinphoneLogo : carousel.currentIndex == 1 + ? AppIcons.welcomeLock : AppIcons.welcomeOpenSource } Carousel { id: carousel - Layout.leftMargin: Utils.getSizeWithScreenRatio(76) + Layout.leftMargin: Utils.getSizeWithScreenRatio(76) itemsCount: slideRepeater.count itemsList: Repeater { id: slideRepeater model: [ - //: "Une application de communication sécurisée,
open source et française." - {title: applicationName, text: qsTr("welcome_page_1_message")}, - //: "Sécurisé" - {title: qsTr("welcome_page_2_title"), - //: "Vos communications sont en sécurité grâce aux
Chiffrement de bout en bout." - text: qsTr("welcome_page_2_message")}, - //: "Open Source" - {title: qsTr("welcome_page_3_title"), - //: "Une application open source et un service gratuit
depuis 2001" - text: qsTr("welcome_page_3_message")} + //: "Une application de communication sécurisée,
open source et française." + { + title: applicationName, + text: qsTr("welcome_page_1_message") + }, + //: "Sécurisé" + { + title: qsTr("welcome_page_2_title"), + //: "Vos communications sont en sécurité grâce aux
Chiffrement de bout en bout." + text: qsTr("welcome_page_2_message") + }, + //: "Open Source" + { + title: qsTr("welcome_page_3_title"), + //: "Une application open source et un service gratuit
depuis 2001" + text: qsTr("welcome_page_3_message") + } ] ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) Text { id: title text: modelData.title font { - pixelSize: Typography.h2.pixelSize - weight: Typography.h2.weight + pixelSize: Typography.h2.pixelSize + weight: Typography.h2.weight } } Text { id: txt - Layout.maximumWidth: Utils.getSizeWithScreenRatio(361) - wrapMode: Text.WordWrap - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } + Layout.maximumWidth: Utils.getSizeWithScreenRatio(361) + wrapMode: Text.WordWrap + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } text: modelData.text } } @@ -117,17 +125,18 @@ LoginLayout { } BigButton { - Layout.leftMargin: Utils.getSizeWithScreenRatio(509) - style: ButtonStyle.main - //: "Suivant" - text: carousel.currentIndex < (carousel.itemsCount - 1) ? qsTr("next") - //: "Commencer" - : qsTr("start") + Layout.leftMargin: Utils.getSizeWithScreenRatio(509) + style: ButtonStyle.main + //: "Suivant" + text: carousel.currentIndex < (carousel.itemsCount - 1) ? qsTr("next") : + //: "Commencer" + qsTr("start") onClicked: { - if (carousel.currentIndex < carousel.itemsCount - 1) carousel.goToSlide(carousel.currentIndex + 1); - else mainItem.startButtonPressed(); + if (carousel.currentIndex < carousel.itemsCount - 1) + carousel.goToSlide(carousel.currentIndex + 1); + else + mainItem.startButtonPressed(); } } } -} - +} diff --git a/Linphone/view/Page/Window/AbstractWindow.qml b/Linphone/view/Page/Window/AbstractWindow.qml index 7d54b0aa6..77f9cde4d 100644 --- a/Linphone/view/Page/Window/AbstractWindow.qml +++ b/Linphone/view/Page/Window/AbstractWindow.qml @@ -6,328 +6,355 @@ import Linphone import UtilsCpp import SettingsCpp import DesktopToolsCpp -import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle +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(Utils.getSizeWithScreenRatio(1512), Screen.desktopAvailableWidth) - height: Math.min(Utils.getSizeWithScreenRatio(982), Screen.desktopAvailableHeight) + id: mainWindow + x: 0 + y: 0 + width: Math.min(Utils.getSizeWithScreenRatio(1512), Screen.desktopAvailableWidth) + height: Math.min(Utils.getSizeWithScreenRatio(982), Screen.desktopAvailableHeight) - onActiveChanged: { - if (active) UtilsCpp.setLastActiveWindow(this) - } - onVisibleChanged: { - AppCpp.handleAppActivity() - } - Component.onDestruction: if (UtilsCpp.getLastActiveWindow() === this) UtilsCpp.setLastActiveWindow(null) + onActiveChanged: { + if (active) + UtilsCpp.setLastActiveWindow(this); + } + onVisibleChanged: { + AppCpp.handleAppActivity(); + } + Component.onDestruction: if (UtilsCpp.getLastActiveWindow() === this) + UtilsCpp.setLastActiveWindow(null) - property bool isFullscreen: visibility == Window.FullScreen - onIsFullscreenChanged: DesktopToolsCpp.screenSaverStatus = !isFullscreen + property bool isFullscreen: visibility == Window.FullScreen + onIsFullscreenChanged: DesktopToolsCpp.screenSaverStatus = !isFullscreen + MouseArea { + anchors.fill: parent + onClicked: mainWindow.contentItem.forceActiveFocus() + } - MouseArea { - anchors.fill: parent - onClicked: mainWindow.contentItem.forceActiveFocus() - } + Component { + id: popupComp + InformationPopup {} + } - Component { - id: popupComp - InformationPopup{} - } + Component { + id: confirmPopupComp + Dialog { + property var requestDialog + property int index + property var callback: requestDialog?.result + signal closePopup(int index) + onClosed: closePopup(index) + text: requestDialog?.message + details: requestDialog?.details + firstButtonAccept: title.length === 0 + secondButtonAccept: title.length !== 0 + Component.onCompleted: if (details.length != 0) + radius = 0 + // For C++, requestDialog need to be call directly + onAccepted: requestDialog ? requestDialog.result(1) : callback(1) + onRejected: requestDialog ? requestDialog.result(0) : callback(0) + width: Utils.getSizeWithScreenRatio(title.length === 0 ? 278 : 637) + } + } - Component{ - id: confirmPopupComp - Dialog { - property var requestDialog - property int index - property var callback: requestDialog?.result - signal closePopup(int index) - onClosed: closePopup(index) - text: requestDialog?.message - details: requestDialog?.details - firstButtonAccept: title.length === 0 - secondButtonAccept: title.length !== 0 - Component.onCompleted: if (details.length != 0) radius = 0 - // For C++, requestDialog need to be call directly - onAccepted: requestDialog ? requestDialog.result(1) : callback(1) - onRejected: requestDialog ? requestDialog.result(0) : callback(0) - width: Utils.getSizeWithScreenRatio(title.length === 0 ? 278 : 637) - } - } + Component { + id: addressChooserPopupComp + Popup { + id: addressChooserPopup + property FriendGui contact + signal addressChosen(string address) + underlineColor: DefaultStyle.main1_500_main + anchors.centerIn: parent + width: Utils.getSizeWithScreenRatio(370) + modal: true + leftPadding: Utils.getSizeWithScreenRatio(15) + rightPadding: Utils.getSizeWithScreenRatio(15) + topPadding: Utils.getSizeWithScreenRatio(20) + bottomPadding: Utils.getSizeWithScreenRatio(25) + contentItem: ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(16) + RowLayout { + spacing: Utils.getSizeWithScreenRatio(5) + width: addressChooserPopup.width + Text { + //: "Choisissez un numéro ou adresse SIP" + text: qsTr("contact_dialog_pick_phone_number_or_sip_address_title") + wrapMode: Text.Wrap + Layout.fillWidth: true + font { + pixelSize: Typography.h4.pixelSize + weight: Typography.h4.weight + } + } + RoundButton { + Layout.alignment: Qt.AlignVCenter + style: ButtonStyle.noBackground + icon.source: AppIcons.closeX + onClicked: addressChooserPopup.close() + } + } + ListView { + id: popuplist + model: VariantList { + model: addressChooserPopup.contact && addressChooserPopup.contact.core.allAddresses || [] + } + spacing: Utils.getSizeWithScreenRatio(10) + keyNavigationEnabled: true + Layout.fillWidth: true + activeFocusOnTab: true + onVisibleChanged: if (visible) + forceActiveFocus() + onActiveFocusChanged: { + if (activeFocus) + currentIndex = 0; + else + currentIndex = -1; + } + Keys.onPressed: event => { + if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter || event.key == Qt.Key_Space) { + addressChooserPopup.addressChosen(itemAtIndex(popuplist.currentIndex).address); + } + } + Layout.preferredHeight: contentHeight + delegate: FocusScope { + width: popuplist.width + height: Utils.getSizeWithScreenRatio(56) + property string address: modelData.address + ColumnLayout { + width: popuplist.width + anchors.verticalCenter: parent.verticalCenter + spacing: Utils.getSizeWithScreenRatio(10) + ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(7) + Text { + Layout.leftMargin: Utils.getSizeWithScreenRatio(5) + text: modelData.label + " :" + font { + pixelSize: Typography.p2.pixelSize + weight: Typography.p2.weight + } + } + Text { + Layout.leftMargin: Utils.getSizeWithScreenRatio(5) + text: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(modelData.address) : modelData.address + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + } + } + Rectangle { + visible: index != popuplist.model.count - 1 + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) + color: DefaultStyle.main2_200 + } + } + Rectangle { + anchors.fill: parent + opacity: 0.7 + visible: index === popuplist.currentIndex + color: DefaultStyle.main2_100 + radius: Utils.getSizeWithScreenRatio(8) + } + MouseArea { + id: delegateMouseArea + anchors.fill: parent + hoverEnabled: true + focus: true + cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor + onClicked: { + addressChooserPopup.addressChosen(modelData.address); + } + } + } + } + } + } + } - Component { - id: addressChooserPopupComp - Popup { - id: addressChooserPopup - property FriendGui contact - signal addressChosen(string address) - underlineColor: DefaultStyle.main1_500_main - anchors.centerIn: parent - width: Utils.getSizeWithScreenRatio(370) - modal: true - leftPadding: Utils.getSizeWithScreenRatio(15) - rightPadding: Utils.getSizeWithScreenRatio(15) - topPadding: Utils.getSizeWithScreenRatio(20) - bottomPadding: Utils.getSizeWithScreenRatio(25) - contentItem: ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(16) - RowLayout { - spacing: Utils.getSizeWithScreenRatio(5) - width: addressChooserPopup.width - Text { - //: "Choisissez un numéro ou adresse SIP" - text: qsTr("contact_dialog_pick_phone_number_or_sip_address_title") - wrapMode: Text.Wrap - Layout.fillWidth: true - font { - pixelSize: Typography.h4.pixelSize - weight: Typography.h4.weight - } - } - RoundButton { - Layout.alignment: Qt.AlignVCenter - style: ButtonStyle.noBackground - icon.source:AppIcons.closeX - onClicked: addressChooserPopup.close() - } - } - ListView { - id: popuplist - model: VariantList { - model: addressChooserPopup.contact && addressChooserPopup.contact.core.allAddresses || [] - } - spacing: Utils.getSizeWithScreenRatio(10) - keyNavigationEnabled: true - Layout.fillWidth: true - activeFocusOnTab: true - onVisibleChanged: if (visible) forceActiveFocus() - onActiveFocusChanged: { - if (activeFocus) currentIndex = 0 - else currentIndex = -1 - } - Keys.onPressed: event => { - if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter || event.key == Qt.Key_Space) { - addressChooserPopup.addressChosen(itemAtIndex(popuplist.currentIndex).address) - } - } - Layout.preferredHeight: contentHeight - delegate: FocusScope { - width: popuplist.width - height: Utils.getSizeWithScreenRatio(56) - property string address: modelData.address - ColumnLayout { - width: popuplist.width - anchors.verticalCenter: parent.verticalCenter - spacing: Utils.getSizeWithScreenRatio(10) - ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(7) - Text { - Layout.leftMargin: Utils.getSizeWithScreenRatio(5) - text: modelData.label + " :" - font { - pixelSize: Typography.p2.pixelSize - weight: Typography.p2.weight - } - } - Text { - Layout.leftMargin: Utils.getSizeWithScreenRatio(5) - text: SettingsCpp.hideSipAddresses ? UtilsCpp.getUsername(modelData.address) : modelData.address - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - } - } - } - Rectangle { - visible: index != popuplist.model.count - 1 - Layout.fillWidth: true - Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) - color: DefaultStyle.main2_200 - } - } - Rectangle { - anchors.fill: parent - opacity: 0.7 - visible: index === popuplist.currentIndex - color: DefaultStyle.main2_100 - radius: Utils.getSizeWithScreenRatio(8) - } - MouseArea { - id: delegateMouseArea - anchors.fill: parent - hoverEnabled: true - focus: true - cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor - onClicked: { - addressChooserPopup.addressChosen(modelData.address) - } - } - } - } - } - } - } + function startCallWithContact(contact, videoEnabled, parentItem) { + if (parentItem == undefined) + parentItem = mainWindow.contentItem; + if (contact) { + console.log("START CALL WITH", contact.core.fullName, "addresses count", contact.core.allAddresses.length); + if (contact.core.allAddresses.length > 1) { + var addressPopup = addressChooserPopupComp.createObject(); + addressPopup.parent = parentItem; + addressPopup.contact = contact; + addressPopup.addressChosen.connect(function (address) { + UtilsCpp.createCall(address, { + 'localVideoEnabled': videoEnabled + }); + addressPopup.close(); + }); + addressPopup.open(); + } else { + var addressToCall = contact.core.defaultAddress.length === 0 ? contact.core.phoneNumbers.length === 0 ? "" : + contact.core.phoneNumbers[0].address : contact.core.defaultAddress; + if (addressToCall.length != 0) + UtilsCpp.createCall(addressToCall, { + 'localVideoEnabled': videoEnabled + }); + } + } + } - function startCallWithContact(contact, videoEnabled, parentItem) { - if (parentItem == undefined) parentItem = mainWindow.contentItem - if (contact) { - console.log("START CALL WITH", contact.core.fullName, "addresses count", contact.core.allAddresses.length) - if (contact.core.allAddresses.length > 1) { - var addressPopup = addressChooserPopupComp.createObject() - addressPopup.parent = parentItem - addressPopup.contact = contact - addressPopup.addressChosen.connect(function(address) { - UtilsCpp.createCall(address, {'localVideoEnabled': videoEnabled}) - addressPopup.close() - }) - addressPopup.open() + function sendMessageToContact(contact, parentItem) { + if (parentItem == undefined) + parentItem = mainWindow.contentItem; + if (contact) { + console.log("SEND MESSAGE TO", contact.core.fullName, "addresses count", contact.core.allAddresses.length); + if (contact.core.allAddresses.length > 1) { + var addressPopup = addressChooserPopupComp.createObject(); + addressPopup.parent = parentItem; + addressPopup.contact = contact; + addressPopup.addressChosen.connect(function (address) { + displayChatPage(address); + addressPopup.close(); + }); + addressPopup.open(); + } else { + displayChatPage(contact.core.defaultAddress); + if (addressToCall.length != 0) + UtilsCpp.createCall(addressToCall, { + 'localVideoEnabled': videoEnabled + }); + } + } + } - } else { - var addressToCall = contact.core.defaultAddress.length === 0 - ? contact.core.phoneNumbers.length === 0 - ? "" - : contact.core.phoneNumbers[0].address - : contact.core.defaultAddress - if (addressToCall.length != 0) UtilsCpp.createCall(addressToCall, {'localVideoEnabled':videoEnabled}) - } - } - } + function transferCallToContact(call, contact, parentItem) { + if (!call || !contact) + return; + if (parentItem == undefined) + parentItem = mainWindow.contentItem; + if (contact) { + console.log("[AbstractWindow] Transfer call to", contact.core.fullName, "addresses count", + contact.core.allAddresses.length, call); + if (contact.core.allAddresses.length > 1) { + var addressPopup = addressChooserPopupComp.createObject(); + addressPopup.parent = parentItem; + addressPopup.contact = contact; + addressPopup.addressChosen.connect(function (address) { + call.core.lTransferCall(address); + addressPopup.close(); + }); + addressPopup.open(); + } else { + var addressToCall = contact.core.defaultAddress.length === 0 ? contact.core.phoneNumbers.length === 0 ? "" : + contact.core.phoneNumbers[0].address : contact.core.defaultAddress; + if (addressToCall.length != 0) + call.core.lTransferCall(addressToCall); + } + } + } - function sendMessageToContact(contact, parentItem) { - if (parentItem == undefined) parentItem = mainWindow.contentItem - if (contact) { - console.log("SEND MESSAGE TO", contact.core.fullName, "addresses count", contact.core.allAddresses.length) - if (contact.core.allAddresses.length > 1) { - var addressPopup = addressChooserPopupComp.createObject() - addressPopup.parent = parentItem - addressPopup.contact = contact - addressPopup.addressChosen.connect(function(address) { - displayChatPage(address) - addressPopup.close() - }) - addressPopup.open() + function removeFromPopupLayout(index) { + popupLayout.popupList.splice(index, 1); + } + function showInformationPopup(title, description, isSuccess) { + if (isSuccess == undefined) + isSuccess = true; + var infoPopup = popupComp.createObject(popupLayout, { + "title": title, + "description": description, + "isSuccess": isSuccess + }); + infoPopup.index = popupLayout.popupList.length; + popupLayout.popupList.push(infoPopup); + infoPopup.open(); + infoPopup.closePopup.connect(removeFromPopupLayout); + } + function showLoadingPopup(text, cancelButtonVisible, callback) { + if (cancelButtonVisible == undefined) + cancelButtonVisible = false; + loadingPopup.text = text; + loadingPopup.callback = callback; + loadingPopup.cancelButtonVisible = cancelButtonVisible; + loadingPopup.open(); + } + function closeLoadingPopup() { + loadingPopup.close(); + } - } else { - displayChatPage(contact.core.defaultAddress) - if (addressToCall.length != 0) UtilsCpp.createCall(addressToCall, {'localVideoEnabled':videoEnabled}) - } - } - } + function showConfirmationPopup(requestDialog) { + console.log("Showing confirmation popup"); + var popup = confirmPopupComp.createObject(popupLayout, { + "requestDialog": requestDialog + }); + popup.open(); + popup.closePopup.connect(removeFromPopupLayout); + } - function transferCallToContact(call, contact, parentItem) { - if (!call || !contact) return - if (parentItem == undefined) parentItem = mainWindow.contentItem - if (contact) { - console.log("[AbstractWindow] Transfer call to", contact.core.fullName, "addresses count", contact.core.allAddresses.length, call) - if (contact.core.allAddresses.length > 1) { - var addressPopup = addressChooserPopupComp.createObject() - addressPopup.parent = parentItem - addressPopup.contact = contact - addressPopup.addressChosen.connect(function(address) { - call.core.lTransferCall(address) - addressPopup.close() - }) - addressPopup.open() + function showConfirmationLambdaPopup(title, text, details, callback, firstButtonText, secondButtonText, + customContent) { + console.log("Showing confirmation lambda popup"); + var popup = confirmPopupComp.createObject(popupLayout, { + "title": title, + "text": text, + "details": details, + "callback": callback + }); + if (firstButtonText != undefined) + popup.firstButtonText = firstButtonText; + if (secondButtonText != undefined) + popup.secondButtonText = secondButtonText; + if (customContent != undefined) + popup.content = customContent; + popup.titleColor = DefaultStyle.main1_500_main; + popup.open(); + popup.closePopup.connect(removeFromPopupLayout); + } - } else { - var addressToCall = contact.core.defaultAddress.length === 0 - ? contact.core.phoneNumbers.length === 0 - ? "" - : contact.core.phoneNumbers[0].address - : contact.core.defaultAddress - if (addressToCall.length != 0) call.core.lTransferCall(addressToCall) - } - } - } + ColumnLayout { + id: popupLayout + anchors.fill: parent + Layout.alignment: Qt.AlignBottom + property real nextY: mainWindow.height + property list popupList + property int popupCount: popupList.length + spacing: Utils.getSizeWithScreenRatio(15) + onPopupCountChanged: { + nextY = mainWindow.height; + for (var i = 0; i < popupCount; ++i) { + var popupItem = popupList[i]; + if (popupItem) { + popupItem.y = nextY - popupItem.height; + popupItem.index = i; + nextY = nextY - popupItem.height - 15; + } + } + } + } - function removeFromPopupLayout(index) { - popupLayout.popupList.splice(index, 1) - } - function showInformationPopup(title, description, isSuccess) { - if (isSuccess == undefined) isSuccess = true - var infoPopup = popupComp.createObject(popupLayout, {"title": title, "description": description, "isSuccess": isSuccess}) - infoPopup.index = popupLayout.popupList.length - popupLayout.popupList.push(infoPopup) - infoPopup.open() - infoPopup.closePopup.connect(removeFromPopupLayout) - } - function showLoadingPopup(text, cancelButtonVisible, callback) { - if (cancelButtonVisible == undefined) cancelButtonVisible = false - loadingPopup.text = text - loadingPopup.callback = callback - loadingPopup.cancelButtonVisible = cancelButtonVisible - loadingPopup.open() - } - function closeLoadingPopup() { - loadingPopup.close() - } - - function showConfirmationPopup(requestDialog){ - console.log("Showing confirmation popup") - var popup = confirmPopupComp.createObject(popupLayout, {"requestDialog": requestDialog}) - popup.open() - popup.closePopup.connect(removeFromPopupLayout) - } - - function showConfirmationLambdaPopup(title,text, details, callback, firstButtonText, secondButtonText, customContent){ - console.log("Showing confirmation lambda popup") - var popup = confirmPopupComp.createObject(popupLayout, {"title": title, "text": text, "details":details,"callback":callback}) - if (firstButtonText != undefined) popup.firstButtonText = firstButtonText - if (secondButtonText != undefined) popup.secondButtonText = secondButtonText - if (customContent != undefined) popup.content = customContent - popup.titleColor = DefaultStyle.main1_500_main - popup.open() - popup.closePopup.connect(removeFromPopupLayout) - } - - ColumnLayout { - id: popupLayout - anchors.fill: parent - Layout.alignment: Qt.AlignBottom - property real nextY: mainWindow.height - property list popupList - property int popupCount: popupList.length - spacing: Utils.getSizeWithScreenRatio(15) - onPopupCountChanged: { - nextY = mainWindow.height - for(var i = 0; i < popupCount; ++i) { - var popupItem = popupList[i] - if( popupItem ){ - popupItem.y = nextY - popupItem.height - popupItem.index = i - nextY = nextY - popupItem.height - 15 - } - } - } - } - - LoadingPopup { - id: loadingPopup - modal: true - closePolicy: Popup.NoAutoClose - anchors.centerIn: parent - padding: Utils.getSizeWithScreenRatio(20) - underlineColor: DefaultStyle.main1_500_main - radius: Utils.getSizeWithScreenRatio(15) - } - FPSCounter{ - anchors.top: parent.top - anchors.left: parent.left - height: 50 - width: fpsText.implicitWidth - z: 100 - visible: !SettingsCpp.hideFps - Text{ - id: fpsText - font.bold: true - font.italic: true - 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 - } - } + LoadingPopup { + id: loadingPopup + modal: true + closePolicy: Popup.NoAutoClose + anchors.centerIn: parent + padding: Utils.getSizeWithScreenRatio(20) + underlineColor: DefaultStyle.main1_500_main + radius: Utils.getSizeWithScreenRatio(15) + } + FPSCounter { + anchors.top: parent.top + anchors.left: parent.left + height: 50 + width: fpsText.implicitWidth + z: 100 + visible: !SettingsCpp.hideFps + Text { + id: fpsText + font.bold: true + font.italic: true + 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 15ce9e373..e65f6ad6e 100644 --- a/Linphone/view/Page/Window/Call/CallsWindow.qml +++ b/Linphone/view/Page/Window/Call/CallsWindow.qml @@ -11,1843 +11,1781 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle AbstractWindow { - id: mainWindow - flags: Qt.Window - minimumWidth: Utils.getSizeWithScreenRatio(1020) - minimumHeight: Utils.getSizeWithScreenRatio(700) + id: mainWindow + flags: Qt.Window + minimumWidth: Utils.getSizeWithScreenRatio(1020) + minimumHeight: Utils.getSizeWithScreenRatio(700) - // modality: Qt.WindowModal - property CallGui call + // modality: Qt.WindowModal + property CallGui call - property ConferenceGui conference: call && call.core.conference || null - property bool isConference: call ? call.core.isConference : false + property ConferenceGui conference: call && call.core.conference || null + property bool isConference: call ? call.core.isConference : false - // Chat related to call - property var chatObj - property ChatGui chat: chatObj ? chatObj.value : null + // Chat related to call + property var chatObj + property ChatGui chat: chatObj ? chatObj.value : null - property int conferenceLayout: call && call.core.conferenceVideoLayout || 0 - property bool cameraEnabled: call && call.core.cameraEnabled - property bool remoteVideoEnabled: call && call.core.remoteVideoEnabled + property int conferenceLayout: call && call.core.conferenceVideoLayout || 0 + property bool cameraEnabled: call && call.core.cameraEnabled + property bool remoteVideoEnabled: call && call.core.remoteVideoEnabled - property bool callTerminatedByUser: false - property var callState: call ? call.core.state : LinphoneEnums.CallState.Idle - property var transferState: call && call.core.transferState - property bool startingCall: mainWindow.callState == LinphoneEnums.CallState.OutgoingInit - || mainWindow.callState - == LinphoneEnums.CallState.OutgoingProgress - || mainWindow.callState - == LinphoneEnums.CallState.OutgoingRinging - || mainWindow.callState - == LinphoneEnums.CallState.OutgoingEarlyMedia - || mainWindow.callState == LinphoneEnums.CallState.IncomingReceived - property Item firstButtonInBottomTab : mainWindow.startingCall ? endCallButton : (videoCameraButton.visible && videoCameraButton.enabled ? videoCameraButton : audioMicrophoneButton) - property Item lastButtonInBottomTab : mainWindow.startingCall ? Utils.getLastFocusableItemInItem(controlCallButtons) : endCallButton + property bool callTerminatedByUser: false + property var callState: call ? call.core.state : LinphoneEnums.CallState.Idle + property var transferState: call && call.core.transferState + property bool startingCall: mainWindow.callState == LinphoneEnums.CallState.OutgoingInit || mainWindow.callState + == LinphoneEnums.CallState.OutgoingProgress || mainWindow.callState == LinphoneEnums.CallState.OutgoingRinging + || mainWindow.callState == LinphoneEnums.CallState.OutgoingEarlyMedia || mainWindow.callState + == LinphoneEnums.CallState.IncomingReceived + property Item firstButtonInBottomTab: mainWindow.startingCall ? endCallButton : (videoCameraButton.visible + && videoCameraButton.enabled ? videoCameraButton : audioMicrophoneButton) + property Item lastButtonInBottomTab: mainWindow.startingCall ? Utils.getLastFocusableItemInItem(controlCallButtons) : + endCallButton - onCallStateChanged: { - if (callState === LinphoneEnums.CallState.Connected) { - if (middleItemStackView.currentItem.objectName != "inCallItem") { - middleItemStackView.replace(inCallItem) - bottomButtonsLayout.visible = true - } - if (call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp - && !mainWindow.isConference && (!call.core.tokenVerified - || call.core.isMismatch)) { - zrtpValidation.open() - } - } else if (callState === LinphoneEnums.CallState.StreamsRunning) { - if (!mainWindow.chat && (!mainWindow.conference || mainWindow.conference.core.isChatEnabled)) - mainWindow.chatObj = UtilsCpp.getCurrentCallChat(mainWindow.call) - } else if (callState === LinphoneEnums.CallState.Error - || callState === LinphoneEnums.CallState.End) { - zrtpValidation.close() - callEnded(call) - } - } + onCallStateChanged: { + if (callState === LinphoneEnums.CallState.Connected) { + if (middleItemStackView.currentItem.objectName != "inCallItem") { + middleItemStackView.replace(inCallItem); + bottomButtonsLayout.visible = true; + } + if (call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp && !mainWindow.isConference && ( + !call.core.tokenVerified || call.core.isMismatch)) { + zrtpValidation.open(); + } + } else if (callState === LinphoneEnums.CallState.StreamsRunning) { + if (!mainWindow.chat && (!mainWindow.conference || mainWindow.conference.core.isChatEnabled)) + mainWindow.chatObj = UtilsCpp.getCurrentCallChat(mainWindow.call); + } else if (callState === LinphoneEnums.CallState.Error || callState === LinphoneEnums.CallState.End) { + zrtpValidation.close(); + callEnded(call); + } + } - onTransferStateChanged: { - console.log("Transfer state:", transferState) - if (mainWindow.transferState === LinphoneEnums.CallState.OutgoingInit) { - var callsWin = UtilsCpp.getOrCreateCallsWindow() - if (!callsWin) - return - //: "Transfert en cours, veuillez patienter" - callsWin.showLoadingPopup(qsTr("call_transfer_in_progress_toast")) - } else if (mainWindow.transferState === LinphoneEnums.CallState.Error - || mainWindow.transferState === LinphoneEnums.CallState.End - || mainWindow.transferState === LinphoneEnums.CallState.Released - || mainWindow.transferState === LinphoneEnums.CallState.Connected) { - var callsWin = UtilsCpp.getOrCreateCallsWindow() - callsWin.closeLoadingPopup() - if (transferState === LinphoneEnums.CallState.Error) - UtilsCpp.showInformationPopup( - qsTr("information_popup_error_title"), - //: "Le transfert d'appel a échoué" - qsTr("call_transfer_failed_toast"), false, - mainWindow) - else if (transferState === LinphoneEnums.CallState.Connected) { - var mainWin = UtilsCpp.getMainWindow() - UtilsCpp.smartShowWindow(mainWin) - mainWin.transferCallSucceed() - } - } - } - onClosing: close => { - DesktopToolsCpp.screenSaverStatus = true - if (callsModel.haveCall) { - close.accepted = false - terminateAllCallsDialog.open() - } - if (middleItemStackView.currentItem.objectName === "waitingRoom") - middleItemStackView.replace(inCallItem) - } - Connections { - enabled: activeFocusItem !== null - target: activeFocusItem.Keys - function onPressed(event) { - if (rightPanel.contentLoader.item && rightPanel.contentLoader.item.objectName === "dialerPanel"){ - mainWindow.keyPressedOnDialer(event) - } - if ((event.key === Qt.Key_Escape || event.key === Qt.Key_Return) && mainWindow.visibility == Window.FullScreen) - mainWindow.showNormal() - } - } - - signal keyPressedOnDialer(KeyEvent event) + onTransferStateChanged: { + console.log("Transfer state:", transferState); + if (mainWindow.transferState === LinphoneEnums.CallState.OutgoingInit) { + var callsWin = UtilsCpp.getOrCreateCallsWindow(); + if (!callsWin) + return; + //: "Transfert en cours, veuillez patienter" + callsWin.showLoadingPopup(qsTr("call_transfer_in_progress_toast")); + } else if (mainWindow.transferState === LinphoneEnums.CallState.Error || mainWindow.transferState + === LinphoneEnums.CallState.End || mainWindow.transferState === LinphoneEnums.CallState.Released + || mainWindow.transferState === LinphoneEnums.CallState.Connected) { + var callsWin = UtilsCpp.getOrCreateCallsWindow(); + callsWin.closeLoadingPopup(); + if (transferState === LinphoneEnums.CallState.Error) + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "Le transfert d'appel a échoué" + qsTr("call_transfer_failed_toast"), false, mainWindow); + else if (transferState === LinphoneEnums.CallState.Connected) { + var mainWin = UtilsCpp.getMainWindow(); + UtilsCpp.smartShowWindow(mainWin); + mainWin.transferCallSucceed(); + } + } + } + onClosing: close => { + DesktopToolsCpp.screenSaverStatus = true; + if (callsModel.haveCall) { + close.accepted = false; + terminateAllCallsDialog.open(); + } + if (middleItemStackView.currentItem.objectName === "waitingRoom") + middleItemStackView.replace(inCallItem); + } + Connections { + enabled: activeFocusItem !== null + target: activeFocusItem.Keys + function onPressed(event) { + if (rightPanel.contentLoader.item && rightPanel.contentLoader.item.objectName === "dialerPanel") { + mainWindow.keyPressedOnDialer(event); + } + if ((event.key === Qt.Key_Escape || event.key === Qt.Key_Return) && mainWindow.visibility == Window.FullScreen) + mainWindow.showNormal(); + } + } + signal keyPressedOnDialer(KeyEvent event) - function changeLayout(layoutIndex) { - if (layoutIndex == 0) { - console.log("Set Grid layout") - call.core.lSetConferenceVideoLayout(LinphoneEnums.ConferenceLayout.Grid) - } else if (layoutIndex == 1) { - console.log("Set AS layout") - call.core.lSetConferenceVideoLayout(LinphoneEnums.ConferenceLayout.ActiveSpeaker) - } else { - console.log("Set audio-only layout", layoutIndex) - call.core.lSetConferenceVideoLayout(LinphoneEnums.ConferenceLayout.AudioOnly) - } - } + function changeLayout(layoutIndex) { + if (layoutIndex == 0) { + console.log("Set Grid layout"); + call.core.lSetConferenceVideoLayout(LinphoneEnums.ConferenceLayout.Grid); + } else if (layoutIndex == 1) { + console.log("Set AS layout"); + call.core.lSetConferenceVideoLayout(LinphoneEnums.ConferenceLayout.ActiveSpeaker); + } else { + console.log("Set audio-only layout", layoutIndex); + call.core.lSetConferenceVideoLayout(LinphoneEnums.ConferenceLayout.AudioOnly); + } + } - function endCall(callToFinish) { - if (callToFinish) - callToFinish.core.lTerminate() - else { - if (!callsModel.haveCall) UtilsCpp.closeCallsWindow() - } - // var mainWin = UtilsCpp.getMainWindow() - // mainWin.goToCallHistory() - } - function callEnded(call) { - if (call && call.core.state === LinphoneEnums.CallState.Error) { - middleItemStackView.replace(inCallItem) - } - if (!callsModel.haveCall) { - if (call && call.core.isConference) - UtilsCpp.closeCallsWindow() - else { - bottomButtonsLayout.setButtonsEnabled(false) - autoCloseWindow.restart() - } - } else { - if (middleItemStackView.currentItem.objectName === "waitingRoom") { - middleItemStackView.replace(inCallItem) - } - mainWindow.call = callsModel.currentCall - } - } + function endCall(callToFinish) { + if (callToFinish) + callToFinish.core.lTerminate(); + else { + if (!callsModel.haveCall) + UtilsCpp.closeCallsWindow(); + } + // var mainWin = UtilsCpp.getMainWindow() + // mainWin.goToCallHistory() + } + function callEnded(call) { + if (call && call.core.state === LinphoneEnums.CallState.Error) { + middleItemStackView.replace(inCallItem); + } + if (!callsModel.haveCall) { + if (call && call.core.isConference) + UtilsCpp.closeCallsWindow(); + else { + bottomButtonsLayout.setButtonsEnabled(false); + autoCloseWindow.restart(); + } + } else { + if (middleItemStackView.currentItem.objectName === "waitingRoom") { + middleItemStackView.replace(inCallItem); + } + mainWindow.call = callsModel.currentCall; + } + } - signal setUpConferenceRequested(ConferenceInfoGui conferenceInfo) - function setupConference(conferenceInfo) { - middleItemStackView.replace(waitingRoom) - setUpConferenceRequested(conferenceInfo) - } + signal setUpConferenceRequested(ConferenceInfoGui conferenceInfo) + function setupConference(conferenceInfo) { + middleItemStackView.replace(waitingRoom); + setUpConferenceRequested(conferenceInfo); + } - function joinConference(uri, options) { - if (uri.length === 0) - UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: "La conférence n'a pas pu démarrer en raison d'une erreur d'uri." - qsTr("conference_error_empty_uri"),mainWindow) - else { - UtilsCpp.createCall(uri, options) - } - } - function cancelJoinConference() { - if (!callsModel.haveCall) { - UtilsCpp.closeCallsWindow() - } else { - mainWindow.call = callsModel.currentCall - } - middleItemStackView.replace(inCallItem) - } - function cancelAfterJoin() { - endCall(mainWindow.call) - } + function joinConference(uri, options) { + if (uri.length === 0) + UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), + //: "La conférence n'a pas pu démarrer en raison d'une erreur d'uri." + qsTr("conference_error_empty_uri"), mainWindow); + else { + UtilsCpp.createCall(uri, options); + } + } + function cancelJoinConference() { + if (!callsModel.haveCall) { + UtilsCpp.closeCallsWindow(); + } else { + mainWindow.call = callsModel.currentCall; + } + middleItemStackView.replace(inCallItem); + } + function cancelAfterJoin() { + endCall(mainWindow.call); + } - Connections { - enabled: !!mainWindow.call - target: mainWindow.call ? mainWindow.call.core : null - function onSecurityUpdated() { - if (mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp) { - if (call.core.tokenVerified) { - zrtpValidation.close() - zrtpValidationToast.open() - } else { - zrtpValidation.open() - } - } else { - zrtpValidation.close() - } - } - function onTokenVerified() { - if (!zrtpValidation.isTokenVerified) { - zrtpValidation.securityError = true - } else - zrtpValidation.close() - } - } + Connections { + enabled: !!mainWindow.call + target: mainWindow.call ? mainWindow.call.core : null + function onSecurityUpdated() { + if (mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp) { + if (call.core.tokenVerified) { + zrtpValidation.close(); + zrtpValidationToast.open(); + } else { + zrtpValidation.open(); + } + } else { + zrtpValidation.close(); + } + } + function onTokenVerified() { + if (!zrtpValidation.isTokenVerified) { + zrtpValidation.securityError = true; + } else + zrtpValidation.close(); + } + } - Timer { - id: autoCloseWindow - interval: mainWindow.callTerminatedByUser ? 1500 : 2500 - onTriggered: { - UtilsCpp.closeCallsWindow() - } - } + Timer { + id: autoCloseWindow + interval: mainWindow.callTerminatedByUser ? 1500 : 2500 + onTriggered: { + UtilsCpp.closeCallsWindow(); + } + } - Dialog { - id: terminateAllCallsDialog - onAccepted: { - mainWindow.callTerminatedByUser = true - call.core.lTerminateAllCalls() - } - 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." - text: qsTr("call_close_window_dialog_message") - } + Dialog { + id: terminateAllCallsDialog + onAccepted: { + mainWindow.callTerminatedByUser = true; + call.core.lTerminateAllCalls(); + } + 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." + text: qsTr("call_close_window_dialog_message") + } - CallProxy { - id: callsModel - sourceModel: AppCpp.calls - onCurrentCallChanged: { - if (currentCall) { - mainWindow.call = currentCall - } - } - onHaveCallChanged: { - if (!haveCall) { - mainWindow.callEnded() - } else { - bottomButtonsLayout.setButtonsEnabled(true) - } - } - } + CallProxy { + id: callsModel + sourceModel: AppCpp.calls + onCurrentCallChanged: { + if (currentCall) { + mainWindow.call = currentCall; + } + } + onHaveCallChanged: { + if (!haveCall) { + mainWindow.callEnded(); + } else { + bottomButtonsLayout.setButtonsEnabled(true); + } + } + } - component BottomButton: Button { - id: bottomButton - required property string enabledIcon - property string disabledIcon - enabled: call != undefined - leftPadding: 0 - rightPadding: 0 - topPadding: 0 - bottomPadding: 0 - checkable: true - 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: Utils.getSizeWithScreenRatio(71) - } - icon.source: disabledIcon - && bottomButton.checked ? disabledIcon : enabledIcon - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - contentImageColor: DefaultStyle.grey_0 - } - ZrtpAuthenticationDialog { - id: zrtpValidation - call: mainWindow.call - modal: true - closePolicy: Popup.NoAutoClose - } - Timer { - id: autoCloseZrtpToast - interval: 4000 - onTriggered: { - zrtpValidationToast.y = -zrtpValidationToast.height * 2 - } - } - Control.Control { - id: zrtpValidationToast - // width: Utils.getSizeWithScreenRatio(269) - y: -height * 2 - z: 1 - topPadding: Utils.getSizeWithScreenRatio(8) - bottomPadding: Utils.getSizeWithScreenRatio(8) - leftPadding: Utils.getSizeWithScreenRatio(50) - rightPadding: Utils.getSizeWithScreenRatio(50) - anchors.horizontalCenter: parent.horizontalCenter - clip: true - function open() { - if (mainWindow.isConference) - return - y = headerItem.height / 2 - autoCloseZrtpToast.restart() - } - Behavior on y { - NumberAnimation { - duration: 1000 - } - } - background: Rectangle { - anchors.fill: parent - color: DefaultStyle.grey_0 - border.color: DefaultStyle.info_500_main - border.width: Utils.getSizeWithScreenRatio(1) - radius: Utils.getSizeWithScreenRatio(50) - } - contentItem: RowLayout { - // anchors.centerIn: parent - Image { - source: AppIcons.trusted - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - fillMode: Image.PreserveAspectFit - Layout.fillWidth: true - } - Text { - color: DefaultStyle.info_500_main - //: "Appareil authentifié" - text: qsTr("call_can_be_trusted_toast") - Layout.fillWidth: true - font { - pixelSize: Utils.getSizeWithScreenRatio(14) - } - } - } - } + component BottomButton: Button { + id: bottomButton + required property string enabledIcon + property string disabledIcon + enabled: call != undefined + leftPadding: 0 + rightPadding: 0 + topPadding: 0 + bottomPadding: 0 + checkable: true + 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: Utils.getSizeWithScreenRatio(71) + } + icon.source: disabledIcon && bottomButton.checked ? disabledIcon : enabledIcon + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + contentImageColor: DefaultStyle.grey_0 + } + ZrtpAuthenticationDialog { + id: zrtpValidation + call: mainWindow.call + modal: true + closePolicy: Popup.NoAutoClose + } + Timer { + id: autoCloseZrtpToast + interval: 4000 + onTriggered: { + zrtpValidationToast.y = -zrtpValidationToast.height * 2; + } + } + Control.Control { + id: zrtpValidationToast + // width: Utils.getSizeWithScreenRatio(269) + y: -height * 2 + z: 1 + topPadding: Utils.getSizeWithScreenRatio(8) + bottomPadding: Utils.getSizeWithScreenRatio(8) + leftPadding: Utils.getSizeWithScreenRatio(50) + rightPadding: Utils.getSizeWithScreenRatio(50) + anchors.horizontalCenter: parent.horizontalCenter + clip: true + function open() { + if (mainWindow.isConference) + return; + y = headerItem.height / 2; + autoCloseZrtpToast.restart(); + } + Behavior on y { + NumberAnimation { + duration: 1000 + } + } + background: Rectangle { + anchors.fill: parent + color: DefaultStyle.grey_0 + border.color: DefaultStyle.info_500_main + border.width: Utils.getSizeWithScreenRatio(1) + radius: Utils.getSizeWithScreenRatio(50) + } + contentItem: RowLayout { + // anchors.centerIn: parent + Image { + source: AppIcons.trusted + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + fillMode: Image.PreserveAspectFit + Layout.fillWidth: true + } + Text { + color: DefaultStyle.info_500_main + //: "Appareil authentifié" + text: qsTr("call_can_be_trusted_toast") + Layout.fillWidth: true + font { + pixelSize: Utils.getSizeWithScreenRatio(14) + } + } + } + } - /************************* CONTENT ********************************/ - Rectangle { - anchors.fill: parent - color: DefaultStyle.grey_900 - focus: true + /************************* CONTENT ********************************/ + Rectangle { + anchors.fill: parent + color: DefaultStyle.grey_900 + focus: true - ColumnLayout { - anchors.fill: parent - anchors.bottomMargin: Utils.getSizeWithScreenRatio(10) - anchors.topMargin: Utils.getSizeWithScreenRatio(10) - spacing: Utils.getSizeWithScreenRatio(10) - Item { - id: headerItem - Layout.margins: Utils.getSizeWithScreenRatio(10) - Layout.leftMargin: Utils.getSizeWithScreenRatio(20) - Layout.fillWidth: true - Layout.minimumHeight: Utils.getSizeWithScreenRatio(25) - RowLayout { - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - spacing: Utils.getSizeWithScreenRatio(10) - RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) - Loader { - id: callStatusIconLoader - Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) - sourceComponent: EffectImage { - id: callStatusIcon - anchors.fill: parent - // TODO : change with broadcast or meeting icon when available - // onImageSourceChanged: console.log("image source changed", imageSource) - imageSource: !mainWindow.call - ? AppIcons.meeting - : (mainWindow.callState === LinphoneEnums.CallState.End || mainWindow.callState === LinphoneEnums.CallState.Released) - ? AppIcons.endCall - : (mainWindow.call.core.paused || mainWindow.callState === LinphoneEnums.CallState.Paused || mainWindow.callState === LinphoneEnums.CallState.PausedByRemote) - ? AppIcons.pause - : mainWindow.conference - ? AppIcons.videoconference - : mainWindow.call.core.dir === LinphoneEnums.CallDir.Outgoing - ? AppIcons.arrowUpRight - : AppIcons.arrowDownLeft - colorizationColor: !mainWindow.call - || mainWindow.call.core.paused - || mainWindow.callState - === LinphoneEnums.CallState.Paused - || mainWindow.callState - === LinphoneEnums.CallState.PausedByRemote - || mainWindow.callState - === LinphoneEnums.CallState.End - || mainWindow.callState - === LinphoneEnums.CallState.Released - || mainWindow.conference ? DefaultStyle.danger_500_main : mainWindow.call.core.dir === LinphoneEnums.CallDir.Outgoing ? DefaultStyle.info_500_main : DefaultStyle.success_500_main - - Binding { - target: callStatusIcon - when: middleItemStackView.currentItem.objectName === "waitingRoom" - property: "imageSource" - value: AppIcons.videoconference - } - } - Connections { - target: mainWindow - function onCallStateChanged() { - callStatusIconLoader.active = !callStatusIconLoader.active - callStatusIconLoader.active = !callStatusIconLoader.active - } - } - } - ColumnLayout { - spacing: Utils.getSizeWithScreenRatio(6) - RowLayout { - spacing: Utils.getSizeWithScreenRatio(10) - Text { - id: callStatusText - property string remoteName: mainWindow.call ? qsTr("call_dir").arg(EnumsToStringCpp.dirToString(mainWindow.call.core.dir)) : "" - Connections { - target: mainWindow - onCallStateChanged: { - if (mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState === LinphoneEnums.CallState.StreamsRunning) - callStatusText.remoteName = mainWindow.call.core.remoteName - } - } + ColumnLayout { + anchors.fill: parent + anchors.bottomMargin: Utils.getSizeWithScreenRatio(10) + anchors.topMargin: Utils.getSizeWithScreenRatio(10) + spacing: Utils.getSizeWithScreenRatio(10) + Item { + id: headerItem + Layout.margins: Utils.getSizeWithScreenRatio(10) + Layout.leftMargin: Utils.getSizeWithScreenRatio(20) + Layout.fillWidth: true + Layout.minimumHeight: Utils.getSizeWithScreenRatio(25) + RowLayout { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + spacing: Utils.getSizeWithScreenRatio(10) + RowLayout { + spacing: Utils.getSizeWithScreenRatio(10) + Loader { + id: callStatusIconLoader + Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + sourceComponent: EffectImage { + id: callStatusIcon + anchors.fill: parent + // TODO : change with broadcast or meeting icon when available + // onImageSourceChanged: console.log("image source changed", imageSource) + imageSource: !mainWindow.call ? AppIcons.meeting : (mainWindow.callState === LinphoneEnums.CallState.End + || mainWindow.callState === LinphoneEnums.CallState.Released) ? AppIcons.endCall : ( + mainWindow.call.core.paused || mainWindow.callState + === LinphoneEnums.CallState.Paused || mainWindow.callState + === LinphoneEnums.CallState.PausedByRemote) ? AppIcons.pause : + mainWindow.conference ? AppIcons.videoconference : + mainWindow.call.core.dir === LinphoneEnums.CallDir.Outgoing + ? AppIcons.arrowUpRight : AppIcons.arrowDownLeft + colorizationColor: !mainWindow.call || mainWindow.call.core.paused || mainWindow.callState + === LinphoneEnums.CallState.Paused || mainWindow.callState === LinphoneEnums.CallState.PausedByRemote + || mainWindow.callState === LinphoneEnums.CallState.End || mainWindow.callState + === LinphoneEnums.CallState.Released || mainWindow.conference ? DefaultStyle.danger_500_main : + mainWindow.call.core.dir === LinphoneEnums.CallDir.Outgoing ? DefaultStyle.info_500_main : + DefaultStyle.success_500_main - text: (mainWindow.callState === LinphoneEnums.CallState.End || mainWindow.callState === LinphoneEnums.CallState.Released) - //: Appel terminé - ? qsTr("call_ended") - : mainWindow.call && (mainWindow.call.core.paused) - ? (mainWindow.conference - //: Meeting paused - ? qsTr("conference_paused") - : mainWindow.callState === LinphoneEnums.CallState.PausedByRemote - //: Call paused by remote - ? qsTr("call_paused_by_remote") - //: Call paused - : qsTr("call_paused")) - : mainWindow.conference - ? mainWindow.conference.core.subject - : remoteName - color: DefaultStyle.grey_0 - font { - pixelSize: Typography.h3.pixelSize - weight: Typography.h3.weight - } - } - Rectangle { - visible: mainWindow.call - && (mainWindow.callState - === LinphoneEnums.CallState.Connected - || mainWindow.callState - === LinphoneEnums.CallState.StreamsRunning) - Layout.fillHeight: true - Layout.topMargin: Utils.getSizeWithScreenRatio(10) - Layout.bottomMargin: Utils.getSizeWithScreenRatio(2) - Layout.preferredWidth: Utils.getSizeWithScreenRatio(2) - color: DefaultStyle.grey_0 - } - Text { - text: mainWindow.call ? UtilsCpp.formatElapsedTime(mainWindow.call.core.duration) : "" - color: DefaultStyle.grey_0 - font { - pixelSize: Typography.h3.pixelSize - weight: Typography.h3.weight - } - visible: mainWindow.callState - === LinphoneEnums.CallState.Connected - || mainWindow.callState - === LinphoneEnums.CallState.StreamsRunning - } - Text { - Layout.leftMargin: Utils.getSizeWithScreenRatio(14) - id: conferenceDate - text: mainWindow.conferenceInfo ? mainWindow.conferenceInfo.core.getStartEndDateString() : "" - color: DefaultStyle.grey_0 - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - capitalization: Font.Capitalize - } - } - } - RowLayout { - id: securityStateLayout - spacing: Utils.getSizeWithScreenRatio(5) - visible: false - Connections { - target: mainWindow - function onCallStateChanged() { - if (mainWindow.callState - === LinphoneEnums.CallState.Connected) - securityStateLayout.visible = true - else if (mainWindow.callState - === LinphoneEnums.CallState.End - || mainWindow.callState - === LinphoneEnums.CallState.Released) - securityStateLayout.visible = false - } - } - BusyIndicator { - //: Waiting for encryption - visible: encryptionStatusText.text === qsTr("call_waiting_for_encryption_info") - Layout.preferredWidth: Utils.getSizeWithScreenRatio(15) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(15) - indicatorColor: DefaultStyle.grey_0 - } - EffectImage { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(15) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(15) - colorizationColor: mainWindow.conference - ? DefaultStyle.info_500_main - : mainWindow.call - ? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp - ? DefaultStyle.info_500_main - : mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp - ? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified - ? DefaultStyle.warning_600 - : DefaultStyle.info_500_main - : DefaultStyle.grey_0 - : "transparent" - visible: mainWindow.call - imageSource: mainWindow.conference - ? AppIcons.lockKey - : mainWindow.call - ? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp - ? AppIcons.lockSimple - : mainWindow.call && mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp - ? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified - ? AppIcons.warningCircle - : AppIcons.lockKey - : AppIcons.lockSimpleOpen - : "" - } - Text { - id: encryptionStatusText - text: mainWindow.conference - ? mainWindow.call.core.conferenceSecurityLevel === LinphoneEnums.ConferenceSecurityLevel.EndToEnd - //: End to end encrypted meeting - ? qsTr("conference_end_to_end_encrypted") - //: Point to point encrypted meeting - : qsTr("conference_srtp_point_to_point_encrypted") - : mainWindow.call - ? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp - //: Appel chiffré de point à point - ? qsTr("call_srtp_point_to_point_encrypted") - : mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp - ? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified - //: Vérification nécessaire - ? qsTr("call_zrtp_sas_validation_required") - //: Appel chiffré de bout en bout - : qsTr("call_zrtp_end_to_end_encrypted") - : mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.None - //: "Appel non chiffré" - ? qsTr("call_not_encrypted") - : qsTr("call_waiting_for_encryption_info") - : "" - color: mainWindow.conference || mainWindow.call?.core.encryption === LinphoneEnums.MediaEncryption.Srtp - ? DefaultStyle.info_500_main - : mainWindow.call - ? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp - ? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified - ? DefaultStyle.warning_600 - : DefaultStyle.info_500_main - : DefaultStyle.grey_0 - : DefaultStyle.grey_0 - font { - pixelSize: Utils.getSizeWithScreenRatio(12) - weight: Utils.getSizeWithScreenRatio(400) - } - MouseArea { - anchors.fill: parent - hoverEnabled: true - cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor - onClicked: { - if (rightPanel.visible - && rightPanel.contentLoader.item.objectName - === "encryptionPanel") - rightPanel.visible = false - else { - rightPanel.visible = true - rightPanel.replace(encryptionPanel) - } - } - } - } - Item { - Layout.fillWidth: true - } - } - } - } - Item { - Layout.fillWidth: true - } + Binding { + target: callStatusIcon + when: middleItemStackView.currentItem.objectName === "waitingRoom" + property: "imageSource" + value: AppIcons.videoconference + } + } + Connections { + target: mainWindow + function onCallStateChanged() { + callStatusIconLoader.active = !callStatusIconLoader.active; + callStatusIconLoader.active = !callStatusIconLoader.active; + } + } + } + ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(6) + RowLayout { + spacing: Utils.getSizeWithScreenRatio(10) + Text { + id: callStatusText + property string remoteName: mainWindow.call ? qsTr("call_dir").arg(EnumsToStringCpp.dirToString( + mainWindow.call.core.dir)) : "" + Connections { + target: mainWindow + onCallStateChanged: { + if (mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState + === LinphoneEnums.CallState.StreamsRunning) + callStatusText.remoteName = mainWindow.call.core.remoteName; + } + } - // Button open statistics panel - Button{ - id: openStatisticPanelButton - property int quality: mainWindow.call ? mainWindow.call.core.quality : 0 - 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: quality >= 2 ? DefaultStyle.grey_0 : DefaultStyle.danger_500_main - style: ButtonStyle.noBackgroundLightBorder - Accessible.name: qsTr("open_statistic_panel_accessible_name") - onClicked: { - if (rightPanel.visible - && rightPanel.contentLoader.item.objectName - === "statsPanel") - rightPanel.visible = false - else { - rightPanel.visible = true - rightPanel.replace(statsPanel) - } - } - KeyNavigation.tab: rightPanel.visible ? nextItemInFocusChain() : mainWindow.firstButtonInBottomTab - KeyNavigation.backtab: mainWindow.lastButtonInBottomTab - } - } + text: (mainWindow.callState === LinphoneEnums.CallState.End || mainWindow.callState + === LinphoneEnums.CallState.Released) ? + //: Appel terminé + qsTr("call_ended") : mainWindow.call && (mainWindow.call.core.paused) ? (mainWindow.conference ? + //: Meeting paused + qsTr("conference_paused") : mainWindow.callState + === LinphoneEnums.CallState.PausedByRemote ? + //: Call paused by remote + qsTr("call_paused_by_remote") : + //: Call paused + qsTr("call_paused")) : mainWindow.conference ? mainWindow.conference.core.subject : + remoteName + color: DefaultStyle.grey_0 + font { + pixelSize: Typography.h3.pixelSize + weight: Typography.h3.weight + } + } + Rectangle { + visible: mainWindow.call && (mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState + === LinphoneEnums.CallState.StreamsRunning) + Layout.fillHeight: true + Layout.topMargin: Utils.getSizeWithScreenRatio(10) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(2) + Layout.preferredWidth: Utils.getSizeWithScreenRatio(2) + color: DefaultStyle.grey_0 + } + Text { + text: mainWindow.call ? UtilsCpp.formatElapsedTime(mainWindow.call.core.duration) : "" + color: DefaultStyle.grey_0 + font { + pixelSize: Typography.h3.pixelSize + weight: Typography.h3.weight + } + visible: mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState + === LinphoneEnums.CallState.StreamsRunning + } + Text { + id: conferenceDate + Layout.leftMargin: Utils.getSizeWithScreenRatio(14) + text: mainWindow.conferenceInfo ? mainWindow.conferenceInfo.core.getStartEndDateString() : "" + color: DefaultStyle.grey_0 + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + capitalization: Font.Capitalize + } + } + } + RowLayout { + id: securityStateLayout + spacing: Utils.getSizeWithScreenRatio(5) + visible: false + Connections { + target: mainWindow + function onCallStateChanged() { + if (mainWindow.callState === LinphoneEnums.CallState.Connected) + securityStateLayout.visible = true; + else if (mainWindow.callState === LinphoneEnums.CallState.End || mainWindow.callState + === LinphoneEnums.CallState.Released) + securityStateLayout.visible = false; + } + } + BusyIndicator { + //: Waiting for encryption + visible: encryptionStatusText.text === qsTr("call_waiting_for_encryption_info") + Layout.preferredWidth: Utils.getSizeWithScreenRatio(15) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(15) + indicatorColor: DefaultStyle.grey_0 + } + EffectImage { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(15) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(15) + colorizationColor: mainWindow.conference ? DefaultStyle.info_500_main : mainWindow.call ? mainWindow.call.core.encryption + === LinphoneEnums.MediaEncryption.Srtp ? DefaultStyle.info_500_main : + mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp + ? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified + ? DefaultStyle.warning_600 : DefaultStyle.info_500_main : + DefaultStyle.grey_0 : "transparent" + visible: mainWindow.call + imageSource: mainWindow.conference ? AppIcons.lockKey : mainWindow.call ? mainWindow.call.core.encryption + === LinphoneEnums.MediaEncryption.Srtp ? AppIcons.lockSimple : mainWindow.call + && mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp + ? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified + ? AppIcons.warningCircle : AppIcons.lockKey : AppIcons.lockSimpleOpen : "" + } + Text { + id: encryptionStatusText + text: mainWindow.conference ? mainWindow.call.core.conferenceSecurityLevel + === LinphoneEnums.ConferenceSecurityLevel.EndToEnd ? + //: End to end encrypted meeting + qsTr("conference_end_to_end_encrypted") : + //: Point to point encrypted meeting + qsTr("conference_srtp_point_to_point_encrypted") : mainWindow.call ? mainWindow.call.core.encryption + === LinphoneEnums.MediaEncryption.Srtp ? + //: Appel chiffré de point à point + qsTr("call_srtp_point_to_point_encrypted") : mainWindow.call.core.encryption + === LinphoneEnums.MediaEncryption.Zrtp ? mainWindow.call.core.isMismatch || + !mainWindow.call.core.tokenVerified ? + //: Vérification nécessaire + qsTr("call_zrtp_sas_validation_required") : + //: Appel chiffré de bout en bout + qsTr("call_zrtp_end_to_end_encrypted") : mainWindow.call.core.encryption + === LinphoneEnums.MediaEncryption.None ? + //: "Appel non chiffré" + qsTr("call_not_encrypted") : qsTr("call_waiting_for_encryption_info") : + "" + color: mainWindow.conference || mainWindow.call?.core.encryption === LinphoneEnums.MediaEncryption.Srtp + ? DefaultStyle.info_500_main : mainWindow.call ? mainWindow.call.core.encryption + === LinphoneEnums.MediaEncryption.Zrtp ? mainWindow.call.core.isMismatch || + !mainWindow.call.core.tokenVerified ? DefaultStyle.warning_600 : + DefaultStyle.info_500_main : DefaultStyle.grey_0 : DefaultStyle.grey_0 + font { + pixelSize: Utils.getSizeWithScreenRatio(12) + weight: Utils.getSizeWithScreenRatio(400) + } + MouseArea { + anchors.fill: parent + hoverEnabled: true + cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor + onClicked: { + if (rightPanel.visible && rightPanel.contentLoader.item.objectName === "encryptionPanel") + rightPanel.visible = false; + else { + rightPanel.visible = true; + rightPanel.replace(encryptionPanel); + } + } + } + } + Item { + Layout.fillWidth: true + } + } + } + } + Item { + Layout.fillWidth: true + } - // Banner middle of header - screen sharing or record screen - Control.Control { - id: screenSharingOrRecordBanner - property var isScreenSharing: mainWindow.conference && mainWindow.conference.core.isLocalScreenSharing - visible: mainWindow.call - ? !!mainWindow.conference - ? mainWindow.conference.core.isRecording || isScreenSharing//mainWindow.conference.core.isLocalScreenSharing - : (mainWindow.call.core.recording || mainWindow.call.core.remoteRecording) - : false - anchors.centerIn: parent - 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: Utils.getSizeWithScreenRatio(10) - } - contentItem: RowLayout { - spacing: Utils.getSizeWithScreenRatio(85) - RowLayout { - spacing: Utils.getSizeWithScreenRatio(15) - EffectImage { - imageSource: screenSharingOrRecordBanner.isScreenSharing - ? AppIcons.screencast - : AppIcons.recordFill - colorizationColor: screenSharingOrRecordBanner.isScreenSharing - ? DefaultStyle.grey_0 - : DefaultStyle.danger_500_main - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - } - Text { - color: screenSharingOrRecordBanner.isScreenSharing - ? DefaultStyle.grey_0 - : DefaultStyle.danger_500_main - font: Typography.b1 - text: mainWindow.call - ? screenSharingOrRecordBanner.isScreenSharing - //: "You are sharing your screen" - ? qsTr("conference_user_is_sharing_screen") - : mainWindow.call.core.recording - ? mainWindow.conference - //: "You are recording the meeting" - ? qsTr("conference_user_is_recording") - //: "You are recording the call" - : qsTr("call_user_is_recording") - : mainWindow.conference - //: "Someone is recording the meeting" - ? qsTr("conference_remote_is_recording") - //: "%1 is recording the call" - : qsTr("call_remote_recording").arg(mainWindow.call.core.remoteName) - : "" - } - } - MediumButton { - visible: mainWindow.call - && mainWindow.call.core.recording || screenSharingOrRecordBanner.isScreenSharing - - text: screenSharingOrRecordBanner.isScreenSharing - //: "Stop sharing" - ? qsTr("call_stop_screen_sharing") - //: "Stop recording" - : qsTr("call_stop_recording") - Accessible.name: screenSharingOrRecordBanner.isScreenSharing ? - //: "Stop screen sharing" - qsTr("stop_screen_sharing_accessible_name") - //: Stop recording - : qsTr("stop_recording_accessible_name") - style: ButtonStyle.mainLightBorder - onPressed: { - if (screenSharingOrRecordBanner.isScreenSharing) mainWindow.conference.core.lToggleScreenSharing() - else mainWindow.call.core.lStopRecording() - } - } - } - } - } + // Button open statistics panel + Button { + id: openStatisticPanelButton + property int quality: mainWindow.call ? mainWindow.call.core.quality : 0 + 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: quality >= 2 ? DefaultStyle.grey_0 : DefaultStyle.danger_500_main + style: ButtonStyle.noBackgroundLightBorder + Accessible.name: qsTr("open_statistic_panel_accessible_name") + onClicked: { + if (rightPanel.visible && rightPanel.contentLoader.item.objectName === "statsPanel") + rightPanel.visible = false; + else { + rightPanel.visible = true; + rightPanel.replace(statsPanel); + } + } + KeyNavigation.tab: rightPanel.visible ? nextItemInFocusChain() : mainWindow.firstButtonInBottomTab + KeyNavigation.backtab: mainWindow.lastButtonInBottomTab + } + } - RowLayout { - Layout.fillWidth: true - Layout.fillHeight: true - spacing: Utils.getSizeWithScreenRatio(23) - Control.StackView { - id: middleItemStackView - initialItem: inCallItem - Layout.fillWidth: true - Layout.fillHeight: true - } - CallSettingsPanel { - id: rightPanel - Layout.fillHeight: true - 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 - function replace(id) { - rightPanel.customHeaderButtons = null - contentLoader.sourceComponent = id - } - headerStack.currentIndex: 0 - headerValidateButtonText: qsTr("add") - KeyNavigation.tab : Utils.isDescendant(nextItemInFocusChain(), rightPanel) ? nextItemInFocusChain() : videoCameraButton + // Banner middle of header - screen sharing or record screen + Control.Control { + id: screenSharingOrRecordBanner + property var isScreenSharing: mainWindow.conference && mainWindow.conference.core.isLocalScreenSharing + visible: mainWindow.call ? !!mainWindow.conference ? mainWindow.conference.core.isRecording + || isScreenSharing//mainWindow.conference.core.isLocalScreenSharing + : (mainWindow.call.core.recording || mainWindow.call.core.remoteRecording) : false + anchors.centerIn: parent + 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: Utils.getSizeWithScreenRatio(10) + } + contentItem: RowLayout { + spacing: Utils.getSizeWithScreenRatio(85) + RowLayout { + spacing: Utils.getSizeWithScreenRatio(15) + EffectImage { + imageSource: screenSharingOrRecordBanner.isScreenSharing ? AppIcons.screencast : AppIcons.recordFill + colorizationColor: screenSharingOrRecordBanner.isScreenSharing ? DefaultStyle.grey_0 : + DefaultStyle.danger_500_main + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + } + Text { + color: screenSharingOrRecordBanner.isScreenSharing ? DefaultStyle.grey_0 : DefaultStyle.danger_500_main + font: Typography.b1 + text: mainWindow.call ? screenSharingOrRecordBanner.isScreenSharing ? + //: "You are sharing your screen" + qsTr("conference_user_is_sharing_screen") : mainWindow.call.core.recording ? mainWindow.conference ? + //: "You are recording the meeting" + qsTr("conference_user_is_recording") : + //: "You are recording the call" + qsTr("call_user_is_recording") : mainWindow.conference ? + //: "Someone is recording the meeting" + qsTr("conference_remote_is_recording") : + //: "%1 is recording the call" + qsTr("call_remote_recording").arg(mainWindow.call.core.remoteName) : "" + } + } + MediumButton { + visible: mainWindow.call && mainWindow.call.core.recording || screenSharingOrRecordBanner.isScreenSharing - // Do not consider padding for chat - Binding on topPadding { - when: rightPanel.contentLoader.item && rightPanel.contentLoader.item.objectName === "chatPanel" - value: 0 - restoreMode: Binding.RestoreBindingOrValue - } - Binding on leftPadding { - when: rightPanel.contentLoader.item && rightPanel.contentLoader.item.objectName === "chatPanel" - value: 0 - restoreMode: Binding.RestoreBindingOrValue - } - Binding on rightPadding { - when: rightPanel.contentLoader.item && rightPanel.contentLoader.item.objectName == "chatPanel" - value: 0 - restoreMode: Binding.RestoreBindingOrValue - } - Connections { - target: rightPanel.contentLoader - function onItemChanged() { - if (rightPanel.contentLoader.item) { - if (rightPanel.contentLoader.item.objectName === "callTransferPanel") { - //: "Transférer %1 à…" - rightPanel.headerTitleText = qsTr("call_transfer_current_call_title").arg(mainWindow.call.core.remoteName) - } - else if (rightPanel.contentLoader.item.objectName === "newCallPanel") { - //: "Nouvel appel" - rightPanel.headerTitleText = qsTr("call_action_start_new_call") - } - else if (rightPanel.contentLoader.item.objectName === "dialerPanel") { - //: "Pavé numérique" - rightPanel.headerTitleText = qsTr("call_action_show_dialer") - } - else if (rightPanel.contentLoader.item.objectName === "changeLayoutPanel") { - //: "Modifier la disposition" - rightPanel.headerTitleText = qsTr("call_action_change_layout") - } - else if (rightPanel.contentLoader.item.objectName === "callListPanel") { - //: "Liste d'appel" - rightPanel.headerTitleText = qsTr("call_action_go_to_calls_list") - } - else if (rightPanel.contentLoader.item.objectName === "chatPanel") { - rightPanel.headerTitleText = "" - } - else if (rightPanel.contentLoader.item.objectName === "settingsPanel") { - //: "Paramètres" - rightPanel.headerTitleText = qsTr("call_action_go_to_settings") - } - else if (rightPanel.contentLoader.item.objectName === "screencastPanel") { - //: "Partage de votre écran" - rightPanel.headerTitleText = qsTr("conference_action_screen_sharing") - } - else if (rightPanel.contentLoader.item.objectName === "encryptionPanel") { - //: Chiffrement - rightPanel.headerTitleText = qsTr("call_encryption_title") - } - else if (rightPanel.contentLoader.item.objectName === "statsPanel") { - //: Statistiques - rightPanel.headerTitleText = qsTr("call_stats_title") - } - } - if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "participantListPanel") rightPanel.headerStack.currentIndex = 0 - if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "callTransferPanel") transferCallButton.checked = false - if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "newCallPanel") newCallButton.checked = false - if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "callListPanel") callListButton.checked = false - if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "screencastPanel") screencastPanelButton.checked = false - if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "chatPanel") chatPanelButton.checked = false - if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "participantListPanel") participantListButton.checked = false + text: screenSharingOrRecordBanner.isScreenSharing ? + //: "Stop sharing" + qsTr("call_stop_screen_sharing") : + //: "Stop recording" + qsTr("call_stop_recording") + Accessible.name: screenSharingOrRecordBanner.isScreenSharing ? + //: "Stop screen sharing" + qsTr("stop_screen_sharing_accessible_name") : + //: Stop recording + qsTr("stop_recording_accessible_name") + style: ButtonStyle.mainLightBorder + onPressed: { + if (screenSharingOrRecordBanner.isScreenSharing) + mainWindow.conference.core.lToggleScreenSharing(); + else + mainWindow.call.core.lStopRecording(); + } + } + } + } + } - // Update tab focus properties - var firstContentFocusableItem = Utils.getFirstFocusableItemInItem(rightPanel.contentLoader.item) - rightPanel.firstContentFocusableItem = firstContentFocusableItem ?? mainWindow.firstButtonInBottomTab - var lastContentFocusableItem = Utils.getLastFocusableItemInItem(rightPanel.contentLoader.item) - if(lastContentFocusableItem != undefined){ - lastContentFocusableItem.KeyNavigation.tab = mainWindow.firstButtonInBottomTab - } - } - } + RowLayout { + Layout.fillWidth: true + Layout.fillHeight: true + spacing: Utils.getSizeWithScreenRatio(23) + Control.StackView { + id: middleItemStackView + initialItem: inCallItem + Layout.fillWidth: true + Layout.fillHeight: true + } + CallSettingsPanel { + id: rightPanel + Layout.fillHeight: true + 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 + function replace(id) { + rightPanel.customHeaderButtons = null; + contentLoader.sourceComponent = id; + } + headerStack.currentIndex: 0 + headerValidateButtonText: qsTr("add") + KeyNavigation.tab: Utils.isDescendant(nextItemInFocusChain(), rightPanel) ? nextItemInFocusChain() : + videoCameraButton - // Binding on rightPadding { - // when: rightPanel.contentLoader.item && rightPanel.contentLoader.item.objectName == "participantListView" - // value: Utils.getSizeWithScreenRatio(10) - // restoreMode: Binding.RestoreBindingOrValue - // } + // Do not consider padding for chat + Binding on topPadding { + when: rightPanel.contentLoader.item && rightPanel.contentLoader.item.objectName === "chatPanel" + value: 0 + restoreMode: Binding.RestoreBindingOrValue + } + Binding on leftPadding { + when: rightPanel.contentLoader.item && rightPanel.contentLoader.item.objectName === "chatPanel" + value: 0 + restoreMode: Binding.RestoreBindingOrValue + } + Binding on rightPadding { + when: rightPanel.contentLoader.item && rightPanel.contentLoader.item.objectName == "chatPanel" + value: 0 + restoreMode: Binding.RestoreBindingOrValue + } + Connections { + target: rightPanel.contentLoader + function onItemChanged() { + if (rightPanel.contentLoader.item) { + if (rightPanel.contentLoader.item.objectName === "callTransferPanel") { + //: "Transférer %1 à…" + rightPanel.headerTitleText = qsTr("call_transfer_current_call_title").arg(mainWindow.call.core.remoteName); + } else if (rightPanel.contentLoader.item.objectName === "newCallPanel") { + //: "Nouvel appel" + rightPanel.headerTitleText = qsTr("call_action_start_new_call"); + } else if (rightPanel.contentLoader.item.objectName === "dialerPanel") { + //: "Pavé numérique" + rightPanel.headerTitleText = qsTr("call_action_show_dialer"); + } else if (rightPanel.contentLoader.item.objectName === "changeLayoutPanel") { + //: "Modifier la disposition" + rightPanel.headerTitleText = qsTr("call_action_change_layout"); + } else if (rightPanel.contentLoader.item.objectName === "callListPanel") { + //: "Liste d'appel" + rightPanel.headerTitleText = qsTr("call_action_go_to_calls_list"); + } else if (rightPanel.contentLoader.item.objectName === "chatPanel") { + rightPanel.headerTitleText = ""; + } else if (rightPanel.contentLoader.item.objectName === "settingsPanel") { + //: "Paramètres" + rightPanel.headerTitleText = qsTr("call_action_go_to_settings"); + } else if (rightPanel.contentLoader.item.objectName === "screencastPanel") { + //: "Partage de votre écran" + rightPanel.headerTitleText = qsTr("conference_action_screen_sharing"); + } else if (rightPanel.contentLoader.item.objectName === "encryptionPanel") { + //: Chiffrement + rightPanel.headerTitleText = qsTr("call_encryption_title"); + } else if (rightPanel.contentLoader.item.objectName === "statsPanel") { + //: Statistiques + rightPanel.headerTitleText = qsTr("call_stats_title"); + } + } + if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "participantListPanel") + rightPanel.headerStack.currentIndex = 0; + if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "callTransferPanel") + transferCallButton.checked = false; + if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "newCallPanel") + newCallButton.checked = false; + if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "callListPanel") + callListButton.checked = false; + if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "screencastPanel") + screencastPanelButton.checked = false; + if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "chatPanel") + chatPanelButton.checked = false; + if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "participantListPanel") + participantListButton.checked = false; - Item { - id: numericPadContainer - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - height: childrenRect.height - } - } - } + // Update tab focus properties + var firstContentFocusableItem = Utils.getFirstFocusableItemInItem(rightPanel.contentLoader.item); + rightPanel.firstContentFocusableItem = firstContentFocusableItem ?? mainWindow.firstButtonInBottomTab; + var lastContentFocusableItem = Utils.getLastFocusableItemInItem(rightPanel.contentLoader.item); + if (lastContentFocusableItem != undefined) { + lastContentFocusableItem.KeyNavigation.tab = mainWindow.firstButtonInBottomTab; + } + } + } - Component { - id: callTransferPanel - Control.Control { - objectName: "callTransferPanel" - width: parent.width - NewCallForm { - id: newCallForm - width: parent.width - height: rightPanel.contentItemHeight - Keys.onEscapePressed: event => { - rightPanel.visible = false - event.accepted = true - } - groupCallVisible: false - displayCurrentCalls: true - searchBarColor: DefaultStyle.grey_0 - searchBarBorderColor: DefaultStyle.grey_200 - searchBarRightMaring: 0 - onContactClicked: contact => { - var callsWin = UtilsCpp.getOrCreateCallsWindow() - if (contact) - //: "Confirmer le transfert" - callsWin.showConfirmationLambdaPopup(qsTr("call_transfer_confirm_dialog_tittle"), - //: "Vous allez transférer %1 à %2." - qsTr("call_transfer_confirm_dialog_message").arg(mainWindow.call.core.remoteName).arg(contact.core.fullName), "", - function (confirmed) { - if (confirmed) { - mainWindow.transferCallToContact(mainWindow.call,contact,newCallForm) - } - }) - } - onTransferCallToAnotherRequested: dest => { - var callsWin = UtilsCpp.getOrCreateCallsWindow() - console.log("transfer to",dest) - callsWin.showConfirmationLambdaPopup(qsTr("call_transfer_confirm_dialog_tittle"), - qsTr("call_transfer_confirm_dialog_message").arg(mainWindow.call.core.remoteName).arg(dest.core.remoteName),"", - function (confirmed) { - if (confirmed) { - mainWindow.call.core.lTransferCallToAnother(dest.core.remoteAddress) - } - }) - } - numPadPopup: numPadPopup + // Binding on rightPadding { + // when: rightPanel.contentLoader.item && rightPanel.contentLoader.item.objectName == "participantListView" + // value: Utils.getSizeWithScreenRatio(10) + // restoreMode: Binding.RestoreBindingOrValue + // } - NumericPadPopup { - id: numPadPopup - parent: numericPadContainer - width: parent.width - roundedBottom: true - lastRowVisible: false - visible: false - leftPadding: Utils.getSizeWithScreenRatio(40) - rightPadding: Utils.getSizeWithScreenRatio(40) - topPadding: Utils.getSizeWithScreenRatio(41) - bottomPadding: Utils.getSizeWithScreenRatio(18) - Component.onCompleted: parent.height = height - } - } - } - } - Component { - id: newCallPanel - Control.Control { - objectName: "newCallPanel" - width: parent.width - NewCallForm { - id: newCallForm - width: parent.width - height: rightPanel.contentItemHeight - groupCallVisible: false - searchBarColor: DefaultStyle.grey_0 - searchBarBorderColor: DefaultStyle.grey_200 - numPadPopup: numericPad - onContactClicked: contact => { - mainWindow.startCallWithContact(contact, false, rightPanel) - } - Connections { - target: mainWindow - function onCallChanged() { - if (rightPanel.contentLoader.item.objectName === "newCallPanel") - rightPanel.visible = false - } - } + Item { + id: numericPadContainer + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + height: childrenRect.height + } + } + } - NumericPadPopup { - id: numericPad - width: parent.width - parent: numericPadContainer - roundedBottom: true - visible: newCallForm.searchBar.numericPadButton.checked - 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) - } - Component.onCompleted: parent.height = height - } - } - } - } - Component { - id: dialerPanel - Control.Control { - id: dialerPanelContent - objectName: "dialerPanel" - width: parent.width - Keys.onEscapePressed: event => { - rightPanel.visible = false - event.accepted = true - } - FocusScope { - width: parent.width - height: rightPanel.contentItemHeight - ColumnLayout { - anchors.fill: parent - spacing: Utils.getSizeWithScreenRatio(41) - Item{Layout.fillHeight: true} - SearchBar { - id: searchBar - height: Utils.getSizeWithScreenRatio(45) - magnifierVisible: false - color: DefaultStyle.grey_0 - borderColor: DefaultStyle.grey_200 - placeholderText: "" - numericPadPopup: numPad - numericPadButton.visible: false - enabled: false - } - NumericPad { - id: numPad - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - Layout.bottomMargin: Utils.getSizeWithScreenRatio(18) - currentCall: callsModel.currentCall - lastRowVisible: false - onLaunchCall: { - UtilsCpp.createCall(dialerTextInput.text) - } - Component.onCompleted: parent.height = height - Connections { - target: mainWindow - function onKeyPressedOnDialer(event) { - if (event.modifiers & Qt.KeypadModifier) { - if (event.key === Qt.Key_0) { - numPad.keypadKeyPressedAtIndex(10) - event.accepted = true - } - if (event.key === Qt.Key_1) { - numPad.keypadKeyPressedAtIndex(0) - event.accepted = true - } - if (event.key === Qt.Key_2) { - numPad.keypadKeyPressedAtIndex(1) - event.accepted = true - } - if (event.key === Qt.Key_3) { - numPad.keypadKeyPressedAtIndex(2) - event.accepted = true - } - if (event.key === Qt.Key_4) { - numPad.keypadKeyPressedAtIndex(3) - event.accepted = true - } - if (event.key === Qt.Key_5) { - numPad.keypadKeyPressedAtIndex(4) - event.accepted = true - } - if (event.key === Qt.Key_6) { - numPad.keypadKeyPressedAtIndex(5) - event.accepted = true - } - if (event.key === Qt.Key_7) { - numPad.keypadKeyPressedAtIndex(6) - event.accepted = true - } - if (event.key === Qt.Key_8) { - numPad.keypadKeyPressedAtIndex(7) - event.accepted = true - } - if (event.key === Qt.Key_9) { - numPad.keypadKeyPressedAtIndex(8) - event.accepted = true - } - if (event.key === Qt.Key_Asterisk) { - numPad.keypadKeyPressedAtIndex(9) - event.accepted = true - } - if (event.key === Qt.Key_Plus) { - numPad.buttonPressed("+") - event.accepted = true - } - if (event.key === Qt.Key_Enter) { - numPad.launchCall() - event.accepted = true - } - } - if (event.key === Qt.Key_Backspace) { - numPad.wipe() - event.accepted = true - } - } - } - } - } - } - } - } - Component { - id: changeLayoutPanel - ChangeLayoutForm { - objectName: "changeLayoutPanel" - width: parent.width - Keys.onEscapePressed: event => { - rightPanel.visible = false - event.accepted = true - } - call: mainWindow.call - onChangeLayoutRequested: index => { - mainWindow.changeLayout(index) - } - } - } - Component { - id: callListPanel - ColumnLayout { - objectName: "callListPanel" - Keys.onEscapePressed: event => { - rightPanel.visible = false - event.accepted = true - } - spacing: 0 - Component { - id: mergeCallPopupButton - PopupButton { - visible: callsModel.count >= 2 - id: popupbutton - popup.contentItem: IconLabelButton { - icon.source: AppIcons.arrowsMerge - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - //: call_action_merge_calls - text: qsTr("Merger tous les appels") - textSize: Utils.getSizeWithScreenRatio(14) - onClicked: { - callsModel.lMergeAll() - popupbutton.close() - } - } - } - } - RoundedPane { - Layout.fillWidth: true - Layout.maximumHeight: rightPanel.height - visible: callList.contentHeight > 0 - leftPadding: Utils.getSizeWithScreenRatio(16) - rightPadding: Utils.getSizeWithScreenRatio(6) - topPadding: Utils.getSizeWithScreenRatio(15) - bottomPadding: Utils.getSizeWithScreenRatio(16) + Component { + id: callTransferPanel + Control.Control { + objectName: "callTransferPanel" + width: parent.width + NewCallForm { + id: newCallForm + width: parent.width + height: rightPanel.contentItemHeight + Keys.onEscapePressed: event => { + rightPanel.visible = false; + event.accepted = true; + } + groupCallVisible: false + displayCurrentCalls: true + searchBarColor: DefaultStyle.grey_0 + searchBarBorderColor: DefaultStyle.grey_200 + searchBarRightMaring: 0 + onContactClicked: contact => { + var callsWin = UtilsCpp.getOrCreateCallsWindow(); + if (contact) + //: "Confirmer le transfert" + callsWin.showConfirmationLambdaPopup(qsTr("call_transfer_confirm_dialog_tittle"), + //: "Vous allez transférer %1 à %2." + qsTr("call_transfer_confirm_dialog_message").arg(mainWindow.call.core.remoteName).arg( + contact.core.fullName), "", function (confirmed) { + if (confirmed) { + mainWindow.transferCallToContact(mainWindow.call, contact, newCallForm); + } + }); + } + onTransferCallToAnotherRequested: dest => { + var callsWin = UtilsCpp.getOrCreateCallsWindow(); + console.log("transfer to", dest); + callsWin.showConfirmationLambdaPopup(qsTr("call_transfer_confirm_dialog_tittle"), qsTr( + "call_transfer_confirm_dialog_message").arg(mainWindow.call.core.remoteName).arg( + dest.core.remoteName), "", function (confirmed) { + if (confirmed) { + mainWindow.call.core.lTransferCallToAnother(dest.core.remoteAddress); + } + }); + } + numPadPopup: numPadPopup - Layout.topMargin: Utils.getSizeWithScreenRatio(15) - Layout.bottomMargin: Utils.getSizeWithScreenRatio(16) - Layout.leftMargin: Utils.getSizeWithScreenRatio(16) - Layout.rightMargin: Utils.getSizeWithScreenRatio(16) + NumericPadPopup { + id: numPadPopup + parent: numericPadContainer + width: parent.width + roundedBottom: true + lastRowVisible: false + visible: false + leftPadding: Utils.getSizeWithScreenRatio(40) + rightPadding: Utils.getSizeWithScreenRatio(40) + topPadding: Utils.getSizeWithScreenRatio(41) + bottomPadding: Utils.getSizeWithScreenRatio(18) + Component.onCompleted: parent.height = height + } + } + } + } + Component { + id: newCallPanel + Control.Control { + objectName: "newCallPanel" + width: parent.width + NewCallForm { + id: newCallForm + width: parent.width + height: rightPanel.contentItemHeight + groupCallVisible: false + searchBarColor: DefaultStyle.grey_0 + searchBarBorderColor: DefaultStyle.grey_200 + numPadPopup: numericPad + onContactClicked: contact => { + mainWindow.startCallWithContact(contact, false, rightPanel); + } + Connections { + target: mainWindow + function onCallChanged() { + if (rightPanel.contentLoader.item.objectName === "newCallPanel") + rightPanel.visible = false; + } + } - contentItem: CallListView { - id: callList - } - } - Item { - Layout.fillHeight: true - } - Connections { - target: rightPanel.contentLoader - function onItemChanged() { - if (rightPanel.contentLoader.item.objectName === "callListPanel") { - rightPanel.customHeaderButtons = mergeCallPopupButton.createObject(rightPanel) - } - } - } - } - } - Component { - id: chatPanel - Control.Control { - objectName: "chatPanel" - width: parent.width - Component.onCompleted: chatView.forceActiveFocus() - SelectedChatView { - id: chatView - width: parent.width - height: rightPanel.contentItemHeight - Keys.onEscapePressed: event => { - rightPanel.visible = false - event.accepted = true - } - call: mainWindow.call - chat: mainWindow.chat - } - Connections { - target: rightPanel.contentLoader - function onItemChanged() { - if (rightPanel.contentLoader.item.objectName === "chatPanel") { - rightPanel.customHeaderButtons = chatView.callHeaderContent - } - } - } - } - } - Component { - id: settingsPanel - MultimediaSettings { - id: inSettingsPanel - objectName: "settingsPanel" - Keys.onEscapePressed: event => { - rightPanel.visible = false - event.accepted = true - } - call: mainWindow.call - height: childrenRect.height - width: parent.width - } - } - Component { - id: screencastPanel - Control.Control { - objectName: "screencastPanel" - width: parent.width - Keys.onEscapePressed: event => { - rightPanel.visible = false - event.accepted = true - } - contentItem: ScreencastSettings { - id: screencastsettings - anchors.topMargin: Utils.getSizeWithScreenRatio(16) - width: parent.width - call: mainWindow.call - onIsLocalScreenSharingChanged: { - // Check if component is ready as well so we can reopen the panel after starting sharing screen - // and change shared window or screen if needed - if (isLocalScreenSharing && status === Component.Ready) rightPanel.visible = false - } - } - } - } - Component { - id: participantListPanel - Control.Control { - width: parent.width - objectName: "participantListPanel" - Keys.onEscapePressed: event => { - rightPanel.visible = false - event.accepted = true - } - Control.StackView { - id: participantsStack - width: parent.width - height: rightPanel.contentItemHeight - // anchors.fill: parent - // 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 + NumericPadPopup { + id: numericPad + width: parent.width + parent: numericPadContainer + roundedBottom: true + visible: newCallForm.searchBar.numericPadButton.checked + 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); + } + Component.onCompleted: parent.height = height + } + } + } + } + Component { + id: dialerPanel + Control.Control { + id: dialerPanelContent + objectName: "dialerPanel" + width: parent.width + Keys.onEscapePressed: event => { + rightPanel.visible = false; + event.accepted = true; + } + FocusScope { + width: parent.width + height: rightPanel.contentItemHeight + ColumnLayout { + anchors.fill: parent + spacing: Utils.getSizeWithScreenRatio(41) + Item { + Layout.fillHeight: true + } + SearchBar { + id: searchBar + height: Utils.getSizeWithScreenRatio(45) + magnifierVisible: false + color: DefaultStyle.grey_0 + borderColor: DefaultStyle.grey_200 + placeholderText: "" + numericPadPopup: numPad + numericPadButton.visible: false + enabled: false + } + NumericPad { + id: numPad + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: Utils.getSizeWithScreenRatio(18) + currentCall: callsModel.currentCall + lastRowVisible: false + onLaunchCall: { + UtilsCpp.createCall(dialerTextInput.text); + } + Component.onCompleted: parent.height = height + Connections { + target: mainWindow + function onKeyPressedOnDialer(event) { + if (event.modifiers & Qt.KeypadModifier) { + if (event.key === Qt.Key_0) { + numPad.keypadKeyPressedAtIndex(10); + event.accepted = true; + } + if (event.key === Qt.Key_1) { + numPad.keypadKeyPressedAtIndex(0); + event.accepted = true; + } + if (event.key === Qt.Key_2) { + numPad.keypadKeyPressedAtIndex(1); + event.accepted = true; + } + if (event.key === Qt.Key_3) { + numPad.keypadKeyPressedAtIndex(2); + event.accepted = true; + } + if (event.key === Qt.Key_4) { + numPad.keypadKeyPressedAtIndex(3); + event.accepted = true; + } + if (event.key === Qt.Key_5) { + numPad.keypadKeyPressedAtIndex(4); + event.accepted = true; + } + if (event.key === Qt.Key_6) { + numPad.keypadKeyPressedAtIndex(5); + event.accepted = true; + } + if (event.key === Qt.Key_7) { + numPad.keypadKeyPressedAtIndex(6); + event.accepted = true; + } + if (event.key === Qt.Key_8) { + numPad.keypadKeyPressedAtIndex(7); + event.accepted = true; + } + if (event.key === Qt.Key_9) { + numPad.keypadKeyPressedAtIndex(8); + event.accepted = true; + } + if (event.key === Qt.Key_Asterisk) { + numPad.keypadKeyPressedAtIndex(9); + event.accepted = true; + } + if (event.key === Qt.Key_Plus) { + numPad.buttonPressed("+"); + event.accepted = true; + } + if (event.key === Qt.Key_Enter) { + numPad.launchCall(); + event.accepted = true; + } + } + if (event.key === Qt.Key_Backspace) { + numPad.wipe(); + event.accepted = true; + } + } + } + } + } + } + } + } + Component { + id: changeLayoutPanel + ChangeLayoutForm { + objectName: "changeLayoutPanel" + width: parent.width + Keys.onEscapePressed: event => { + rightPanel.visible = false; + event.accepted = true; + } + call: mainWindow.call + onChangeLayoutRequested: index => { + mainWindow.changeLayout(index); + } + } + } + Component { + id: callListPanel + ColumnLayout { + objectName: "callListPanel" + Keys.onEscapePressed: event => { + rightPanel.visible = false; + event.accepted = true; + } + spacing: 0 + Component { + id: mergeCallPopupButton + PopupButton { + id: popupbutton + visible: callsModel.count >= 2 + popup.contentItem: IconLabelButton { + icon.source: AppIcons.arrowsMerge + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + //: call_action_merge_calls + text: qsTr("Merger tous les appels") + textSize: Utils.getSizeWithScreenRatio(14) + onClicked: { + callsModel.lMergeAll(); + popupbutton.close(); + } + } + } + } + RoundedPane { + Layout.fillWidth: true + Layout.maximumHeight: rightPanel.height + visible: callList.contentHeight > 0 + leftPadding: Utils.getSizeWithScreenRatio(16) + rightPadding: Utils.getSizeWithScreenRatio(6) + topPadding: Utils.getSizeWithScreenRatio(15) + bottomPadding: Utils.getSizeWithScreenRatio(16) - Connections { - target: rightPanel - function onReturnRequested() { - participantsStack.pop() - } - } + Layout.topMargin: Utils.getSizeWithScreenRatio(15) + Layout.bottomMargin: Utils.getSizeWithScreenRatio(16) + Layout.leftMargin: Utils.getSizeWithScreenRatio(16) + Layout.rightMargin: Utils.getSizeWithScreenRatio(16) - Component { - id: participantListComp - ParticipantListView { - id: participantList - objectName: "participantListView" - call: mainWindow.call - height: contentHeight - width: parent.width - rightMargin: 0 - Component { - id: headerbutton - PopupButton { - popup.contentItem: IconLabelButton { - icon.source: AppIcons.shareNetwork - //: Partager le lien de la réunion - text: qsTr("conference_share_link_title") - onClicked: { - UtilsCpp.copyToClipboard(mainWindow.conference ? mainWindow.conference.core.uri : mainWindow.call.core.remoteAddress) - //: Copié - showInformationPopup(qsTr("copied"), - //: Le lien de la réunion a été copié dans le presse-papier - qsTr("information_popup_meeting_address_copied_to_clipboard"),true) - } - } - } - } - - onVisibleChanged: if (visible) { - rightPanel.customHeaderButtons = headerbutton.createObject(rightPanel) - //: "Participants (%1)" - rightPanel.headerTitleText = qsTr("conference_participants_list_title").arg(count) - } - onAddParticipantRequested: participantsStack.push(addParticipantComp) - onCountChanged: { - rightPanel.headerTitleText = qsTr("conference_participants_list_title").arg(count) - } - Connections { - target: participantsStack - function onCurrentItemChanged() { - if (participantsStack.currentItem == participantList) - rightPanel.headerTitleText = qsTr("conference_participants_list_title").arg(participantList.count) - } - } - Connections { - target: rightPanel - function onValidateRequested() { - participantList.model.addAddresses(participantsStack.selectedParticipants) - participantsStack.pop() - } - } - } - } - Component { - id: addParticipantComp - AddParticipantsForm { - id: addParticipantLayout - // height: childrenRect.height - // width: parent.width - searchBarColor: DefaultStyle.grey_0 - searchBarBorderColor: DefaultStyle.grey_200 - onSelectedParticipantsCountChanged: { - rightPanel.headerSubtitleText = qsTr("group_call_participant_selected", '', selectedParticipantsCount).arg(selectedParticipantsCount) - participantsStack.selectedParticipants = selectedParticipants - } - Connections { - target: participantsStack - function onCurrentItemChanged() { - if (participantsStack.currentItem == addParticipantLayout) { - rightPanel.headerTitleText = qsTr("meeting_schedule_add_participants_title") - rightPanel.headerSubtitleText = qsTr("group_call_participant_selected", '', addParticipantLayout.selectedParticipants.length).arg(addParticipantLayout.selectedParticipants.length) - } else { - rightPanel.headerSubtitleText = "" - } - } - } - } - } - } - } - } - Component { - id: encryptionPanel - EncryptionSettings { - objectName: "encryptionPanel" - call: mainWindow.call - width: parent.width - onEncryptionValidationRequested: zrtpValidation.open() - } - } - Component { - id: statsPanel - CallStatistics { - objectName: "statsPanel" - width: parent.width - call: mainWindow.call - } - } - Component { - id: waitingRoom - WaitingRoom { - id: waitingRoomIn - objectName: "waitingRoom" - Layout.alignment: Qt.AlignCenter - onSettingsButtonCheckedChanged: { - if (settingsButtonChecked) { - rightPanel.visible = true - rightPanel.replace(settingsPanel) - } else { - rightPanel.visible = false - } - } - Binding { - target: callStatusText - when: middleItemStackView.currentItem.objectName === "waitingRoom" - property: "text" - value: waitingRoomIn.conferenceInfo ? waitingRoomIn.conferenceInfo.core.subject : '' - } - Binding { - target: conferenceDate - when: middleItemStackView.currentItem.objectName === "waitingRoom" - property: "text" - value: waitingRoomIn.conferenceInfo ? waitingRoomIn.conferenceInfo.core.startEndDateString : '' - } - Connections { - target: rightPanel - function onVisibleChanged() { - if (!rightPanel.visible) { - waitingRoomIn.settingsButtonChecked = false - } - } - } - Connections { - target: mainWindow - function onSetUpConferenceRequested(conferenceInfo) { - waitingRoomIn.conferenceInfo = conferenceInfo - } - } - onJoinConfRequested: uri => { - mainWindow.joinConference(uri, { - "microEnabled": microEnabled, - "localVideoEnabled": localVideoEnabled - }) - } - onCancelJoiningRequested: mainWindow.cancelJoinConference() - onCancelAfterJoinRequested: mainWindow.cancelAfterJoin() - } - } - Component { - id: inCallItem - Loader { - property string objectName: "inCallItem" - asynchronous: true - sourceComponent: Item { - CallLayout { - anchors.fill: parent - 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 - } - } - } - } + contentItem: CallListView { + id: callList + } + } + Item { + Layout.fillHeight: true + } + Connections { + target: rightPanel.contentLoader + function onItemChanged() { + if (rightPanel.contentLoader.item.objectName === "callListPanel") { + rightPanel.customHeaderButtons = mergeCallPopupButton.createObject(rightPanel); + } + } + } + } + } + Component { + id: chatPanel + Control.Control { + objectName: "chatPanel" + width: parent.width + Component.onCompleted: chatView.forceActiveFocus() + SelectedChatView { + id: chatView + width: parent.width + height: rightPanel.contentItemHeight + Keys.onEscapePressed: event => { + rightPanel.visible = false; + event.accepted = true; + } + call: mainWindow.call + chat: mainWindow.chat + } + Connections { + target: rightPanel.contentLoader + function onItemChanged() { + if (rightPanel.contentLoader.item.objectName === "chatPanel") { + rightPanel.customHeaderButtons = chatView.callHeaderContent; + } + } + } + } + } + Component { + id: settingsPanel + MultimediaSettings { + id: inSettingsPanel + objectName: "settingsPanel" + Keys.onEscapePressed: event => { + rightPanel.visible = false; + event.accepted = true; + } + call: mainWindow.call + height: childrenRect.height + width: parent.width + } + } + Component { + id: screencastPanel + Control.Control { + objectName: "screencastPanel" + width: parent.width + Keys.onEscapePressed: event => { + rightPanel.visible = false; + event.accepted = true; + } + contentItem: ScreencastSettings { + id: screencastsettings + anchors.topMargin: Utils.getSizeWithScreenRatio(16) + width: parent.width + call: mainWindow.call + onIsLocalScreenSharingChanged: { + // Check if component is ready as well so we can reopen the panel after starting sharing screen + // and change shared window or screen if needed + if (isLocalScreenSharing && status === Component.Ready) + rightPanel.visible = false; + } + } + } + } + Component { + id: participantListPanel + Control.Control { + width: parent.width + objectName: "participantListPanel" + Keys.onEscapePressed: event => { + rightPanel.visible = false; + event.accepted = true; + } + Control.StackView { + id: participantsStack + width: parent.width + height: rightPanel.contentItemHeight + // anchors.fill: parent + // 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 + Connections { + target: rightPanel + function onReturnRequested() { + participantsStack.pop(); + } + } - // ----------------------------------------------------------------------------- - // Bottom round buttons - // ----------------------------------------------------------------------------- - RowLayout { - id: bottomButtonsLayout - Layout.alignment: Qt.AlignHCenter - spacing: Utils.getSizeWithScreenRatio(58) - visible: middleItemStackView.currentItem.objectName == "inCallItem" - property bool moreOptionsButtonVisibility: true + Component { + id: participantListComp + ParticipantListView { + id: participantList + objectName: "participantListView" + call: mainWindow.call + height: contentHeight + width: parent.width + rightMargin: 0 + Component { + id: headerbutton + PopupButton { + popup.contentItem: IconLabelButton { + icon.source: AppIcons.shareNetwork + //: Partager le lien de la réunion + text: qsTr("conference_share_link_title") + onClicked: { + UtilsCpp.copyToClipboard(mainWindow.conference ? mainWindow.conference.core.uri : + mainWindow.call.core.remoteAddress); + //: Copié + showInformationPopup(qsTr("copied"), + //: Le lien de la réunion a été copié dans le presse-papier + qsTr("information_popup_meeting_address_copied_to_clipboard"), true); + } + } + } + } - function refreshLayout() { - if (mainWindow.callState === LinphoneEnums.CallState.Connected - || mainWindow.callState === LinphoneEnums.CallState.StreamsRunning - || mainWindow.callState === LinphoneEnums.CallState.Paused - || mainWindow.callState === LinphoneEnums.CallState.PausedByRemote) { - connectedCallButtons.visible = bottomButtonsLayout.visible - moreOptionsButtonVisibility = bottomButtonsLayout.visible - bottomButtonsLayout.layoutDirection = Qt.RightToLeft - } else if (mainWindow.callState === LinphoneEnums.CallState.OutgoingInit) { - connectedCallButtons.visible = false - bottomButtonsLayout.layoutDirection = Qt.LeftToRight - moreOptionsButtonVisibility = false - } - } + onVisibleChanged: if (visible) { + rightPanel.customHeaderButtons = headerbutton.createObject(rightPanel); + //: "Participants (%1)" + rightPanel.headerTitleText = qsTr("conference_participants_list_title").arg(count); + } + onAddParticipantRequested: participantsStack.push(addParticipantComp) + onCountChanged: { + rightPanel.headerTitleText = qsTr("conference_participants_list_title").arg(count); + } + Connections { + target: participantsStack + function onCurrentItemChanged() { + if (participantsStack.currentItem == participantList) + rightPanel.headerTitleText = qsTr("conference_participants_list_title").arg(participantList.count); + } + } + Connections { + target: rightPanel + function onValidateRequested() { + participantList.model.addAddresses(participantsStack.selectedParticipants); + participantsStack.pop(); + } + } + } + } + Component { + id: addParticipantComp + AddParticipantsForm { + id: addParticipantLayout + // height: childrenRect.height + // width: parent.width + searchBarColor: DefaultStyle.grey_0 + searchBarBorderColor: DefaultStyle.grey_200 + onSelectedParticipantsCountChanged: { + rightPanel.headerSubtitleText = qsTr("group_call_participant_selected", '', selectedParticipantsCount).arg( + selectedParticipantsCount); + participantsStack.selectedParticipants = selectedParticipants; + } + Connections { + target: participantsStack + function onCurrentItemChanged() { + if (participantsStack.currentItem == addParticipantLayout) { + rightPanel.headerTitleText = qsTr("meeting_schedule_add_participants_title"); + rightPanel.headerSubtitleText = qsTr("group_call_participant_selected", '', + addParticipantLayout.selectedParticipants.length).arg( + addParticipantLayout.selectedParticipants.length); + } else { + rightPanel.headerSubtitleText = ""; + } + } + } + } + } + } + } + } + Component { + id: encryptionPanel + EncryptionSettings { + objectName: "encryptionPanel" + call: mainWindow.call + width: parent.width + onEncryptionValidationRequested: zrtpValidation.open() + } + } + Component { + id: statsPanel + CallStatistics { + objectName: "statsPanel" + width: parent.width + call: mainWindow.call + } + } + Component { + id: waitingRoom + WaitingRoom { + id: waitingRoomIn + objectName: "waitingRoom" + Layout.alignment: Qt.AlignCenter + onSettingsButtonCheckedChanged: { + if (settingsButtonChecked) { + rightPanel.visible = true; + rightPanel.replace(settingsPanel); + } else { + rightPanel.visible = false; + } + } + Binding { + target: callStatusText + when: middleItemStackView.currentItem.objectName === "waitingRoom" + property: "text" + value: waitingRoomIn.conferenceInfo ? waitingRoomIn.conferenceInfo.core.subject : '' + } + Binding { + target: conferenceDate + when: middleItemStackView.currentItem.objectName === "waitingRoom" + property: "text" + value: waitingRoomIn.conferenceInfo ? waitingRoomIn.conferenceInfo.core.startEndDateString : '' + } + Connections { + target: rightPanel + function onVisibleChanged() { + if (!rightPanel.visible) { + waitingRoomIn.settingsButtonChecked = false; + } + } + } + Connections { + target: mainWindow + function onSetUpConferenceRequested(conferenceInfo) { + waitingRoomIn.conferenceInfo = conferenceInfo; + } + } + onJoinConfRequested: uri => { + mainWindow.joinConference(uri, { + "microEnabled": microEnabled, + "localVideoEnabled": localVideoEnabled + }); + } + onCancelJoiningRequested: mainWindow.cancelJoinConference() + onCancelAfterJoinRequested: mainWindow.cancelAfterJoin() + } + } + Component { + id: inCallItem + Loader { + property string objectName: "inCallItem" + asynchronous: true + sourceComponent: Item { + CallLayout { + anchors.fill: parent + 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 + } + } + } + } - Connections { - target: mainWindow - function onCallStateChanged() { - bottomButtonsLayout.refreshLayout() - } - function onCallChanged() { - bottomButtonsLayout.refreshLayout() - } - } - function setButtonsEnabled(enabled) { - for (var i = 0; i < children.length; ++i) { - children[i].enabled = enabled - } - } + // ----------------------------------------------------------------------------- + // Bottom round buttons + // ----------------------------------------------------------------------------- + RowLayout { + id: bottomButtonsLayout + Layout.alignment: Qt.AlignHCenter + spacing: Utils.getSizeWithScreenRatio(58) + visible: middleItemStackView.currentItem.objectName == "inCallItem" + property bool moreOptionsButtonVisibility: true - // End call button - BigButton { - id: endCallButton - Layout.row: 0 - 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: 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 - KeyNavigation.backtab: mainWindow.startingCall ? rightPanel.visible ? Utils.getLastFocusableItemInItem(rightPanel) : nextItemInFocusChain(false): callListButton - onClicked: { - mainWindow.callTerminatedByUser = true - mainWindow.endCall(mainWindow.call) - } - } + function refreshLayout() { + if (mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState + === LinphoneEnums.CallState.StreamsRunning || mainWindow.callState === LinphoneEnums.CallState.Paused + || mainWindow.callState === LinphoneEnums.CallState.PausedByRemote) { + connectedCallButtons.visible = bottomButtonsLayout.visible; + moreOptionsButtonVisibility = bottomButtonsLayout.visible; + bottomButtonsLayout.layoutDirection = Qt.RightToLeft; + } else if (mainWindow.callState === LinphoneEnums.CallState.OutgoingInit) { + connectedCallButtons.visible = false; + bottomButtonsLayout.layoutDirection = Qt.LeftToRight; + moreOptionsButtonVisibility = false; + } + } - // ----------------------------------------------------------------------------- - // Group button: pauseCall, transfertCall, newCall, callList - // ----------------------------------------------------------------------------- - RowLayout { - id: connectedCallButtons - visible: false - Layout.row: 0 - Layout.column: 1 - spacing: Utils.getSizeWithScreenRatio(10) + Connections { + target: mainWindow + function onCallStateChanged() { + bottomButtonsLayout.refreshLayout(); + } + function onCallChanged() { + bottomButtonsLayout.refreshLayout(); + } + } + function setButtonsEnabled(enabled) { + for (var i = 0; i < children.length; ++i) { + children[i].enabled = enabled; + } + } - // Pause call button - CheckableButton { - id: pauseButton - 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" - : qsTr("call_action_pause_call") - Accessible.name: checked ? qsTr("call_action_resume_call") : qsTr("call_action_pause_call") - enabled: mainWindow.conference - || mainWindow.callState != LinphoneEnums.CallState.PausedByRemote - icon.source: enabled - && checked ? AppIcons.play : AppIcons.phonePause - checked: mainWindow.call - && mainWindow.callState == LinphoneEnums.CallState.Paused - || mainWindow.callState == LinphoneEnums.CallState.Pausing - || (!mainWindow.conference - && mainWindow.callState - == LinphoneEnums.CallState.PausedByRemote) - color: enabled ? DefaultStyle.grey_500 : DefaultStyle.grey_600 - pressedColor: enabled ? DefaultStyle.success_500_main : DefaultStyle.grey_600 - hoveredColor: enabled ? DefaultStyle.main2_400 : DefaultStyle.grey_600 - onClicked: { - mainWindow.call.core.lSetPaused(!mainWindow.call.core.paused) - } - KeyNavigation.backtab: moreOptionsButton - } + // End call button + BigButton { + id: endCallButton + Layout.row: 0 + 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: 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 + KeyNavigation.backtab: mainWindow.startingCall ? rightPanel.visible ? Utils.getLastFocusableItemInItem(rightPanel) : + nextItemInFocusChain(false) : callListButton + onClicked: { + mainWindow.callTerminatedByUser = true; + mainWindow.endCall(mainWindow.call); + } + } - // Transfert call button - CheckableButton { - id: transferCallButton - visible: !mainWindow.conference - icon.source: AppIcons.transferCall - 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") - Accessible.name: qsTr("call_action_transfer_call") - onToggled: { - console.log("checked transfer changed", checked) - if (checked) { - rightPanel.visible = true - rightPanel.replace(callTransferPanel) - } else { - rightPanel.visible = false - } - } - } + // ----------------------------------------------------------------------------- + // Group button: pauseCall, transfertCall, newCall, callList + // ----------------------------------------------------------------------------- + RowLayout { + id: connectedCallButtons + visible: false + Layout.row: 0 + Layout.column: 1 + spacing: Utils.getSizeWithScreenRatio(10) - // New call button - CheckableButton { - id: newCallButton - checkable: true - icon.source: AppIcons.newCall - 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") - onToggled: { - console.log("checked newcall changed", checked) - if (checked) { - rightPanel.visible = true - rightPanel.replace(newCallPanel) - } else { - rightPanel.visible = false - } - } - } + // Pause call button + CheckableButton { + id: pauseButton + 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" + qsTr("call_action_pause_call") + Accessible.name: checked ? qsTr("call_action_resume_call") : qsTr("call_action_pause_call") + enabled: mainWindow.conference || mainWindow.callState != LinphoneEnums.CallState.PausedByRemote + icon.source: enabled && checked ? AppIcons.play : AppIcons.phonePause + checked: mainWindow.call && mainWindow.callState == LinphoneEnums.CallState.Paused || mainWindow.callState + == LinphoneEnums.CallState.Pausing || (!mainWindow.conference && mainWindow.callState + == LinphoneEnums.CallState.PausedByRemote) + color: enabled ? DefaultStyle.grey_500 : DefaultStyle.grey_600 + pressedColor: enabled ? DefaultStyle.success_500_main : DefaultStyle.grey_600 + hoveredColor: enabled ? DefaultStyle.main2_400 : DefaultStyle.grey_600 + onClicked: { + mainWindow.call.core.lSetPaused(!mainWindow.call.core.paused); + } + KeyNavigation.backtab: moreOptionsButton + } - // Call list button - CheckableButton { - id: callListButton - Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) - checkable: true - icon.source: AppIcons.callList - 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") - onToggled: { - if (checked) { - rightPanel.visible = true - rightPanel.replace(callListPanel) - } else { - rightPanel.visible = false - } - } - KeyNavigation.tab: mainWindow.startingCall ? nextItemInFocusChain() : endCallButton - } - } + // Transfert call button + CheckableButton { + id: transferCallButton + visible: !mainWindow.conference + icon.source: AppIcons.transferCall + 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") + Accessible.name: qsTr("call_action_transfer_call") + onToggled: { + console.log("checked transfer changed", checked); + if (checked) { + rightPanel.visible = true; + rightPanel.replace(callTransferPanel); + } else { + rightPanel.visible = false; + } + } + } - // ----------------------------------------------------------------------------- - // Group button: Video, audio, screensharing, chat, raiseHand, reaction, participantList, callOptions - // ----------------------------------------------------------------------------- - RowLayout { - id: controlCallButtons - Layout.row: 0 - Layout.column: mainWindow.startingCall ? bottomButtonsLayout.columns - 1 : 0 - spacing: Utils.getSizeWithScreenRatio(10) + // New call button + CheckableButton { + id: newCallButton + checkable: true + icon.source: AppIcons.newCall + 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") + onToggled: { + console.log("checked newcall changed", checked); + if (checked) { + rightPanel.visible = true; + rightPanel.replace(newCallPanel); + } else { + rightPanel.visible = false; + } + } + } - // Video camera button - CheckableButton { - id: videoCameraButton - visible: SettingsCpp.videoEnabled - enabled: mainWindow.conferenceInfo - || (mainWindow.callState === LinphoneEnums.CallState.Connected - || mainWindow.callState - === LinphoneEnums.CallState.StreamsRunning) - iconUrl: AppIcons.videoCamera - checkedIconUrl: AppIcons.videoCameraSlash - //: "Désactiver la vidéo" - //: "Activer la vidéo" - ToolTip.text: mainWindow.cameraEnabled ? qsTr("call_deactivate_video_hint") : qsTr("call_activate_video_hint") - Accessible.name: mainWindow.cameraEnabled ? qsTr("call_deactivate_video_hint") : qsTr("call_activate_video_hint") - checked: !mainWindow.cameraEnabled - Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - onClicked: mainWindow.call.core.lSetCameraEnabled(!mainWindow.call.core.cameraEnabled) - } + // Call list button + CheckableButton { + id: callListButton + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + checkable: true + icon.source: AppIcons.callList + 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") + onToggled: { + if (checked) { + rightPanel.visible = true; + rightPanel.replace(callListPanel); + } else { + rightPanel.visible = false; + } + } + KeyNavigation.tab: mainWindow.startingCall ? nextItemInFocusChain() : endCallButton + } + } - // Audio microphone button - CheckableButton { - id: audioMicrophoneButton - iconUrl: AppIcons.microphone - checkedIconUrl: AppIcons.microphoneSlash - ToolTip.text: mainWindow.call && mainWindow.call.core.microphoneMuted - //: "Activer le micro" - ? qsTr("call_activate_microphone") - //: "Désactiver le micro" - : 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: 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) - } + // ----------------------------------------------------------------------------- + // Group button: Video, audio, screensharing, chat, raiseHand, reaction, participantList, callOptions + // ----------------------------------------------------------------------------- + RowLayout { + id: controlCallButtons + Layout.row: 0 + Layout.column: mainWindow.startingCall ? bottomButtonsLayout.columns - 1 : 0 + spacing: Utils.getSizeWithScreenRatio(10) - // Screen cast button - CheckableButton { - id: screencastPanelButton - iconUrl: AppIcons.screencast - visible: !!mainWindow.conference - //: Partager l'écran… - ToolTip.text: qsTr("call_share_screen_hint") - Accessible.name: qsTr("call_share_screen_hint") - 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 - rightPanel.replace(screencastPanel) - } else { - rightPanel.visible = false - } - } - - } + // Video camera button + CheckableButton { + id: videoCameraButton + visible: SettingsCpp.videoEnabled + enabled: mainWindow.conferenceInfo || (mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState + === LinphoneEnums.CallState.StreamsRunning) + iconUrl: AppIcons.videoCamera + checkedIconUrl: AppIcons.videoCameraSlash + //: "Désactiver la vidéo" + //: "Activer la vidéo" + ToolTip.text: mainWindow.cameraEnabled ? qsTr("call_deactivate_video_hint") : qsTr("call_activate_video_hint") + Accessible.name: mainWindow.cameraEnabled ? qsTr("call_deactivate_video_hint") : qsTr("call_activate_video_hint") + checked: !mainWindow.cameraEnabled + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + onClicked: mainWindow.call.core.lSetCameraEnabled(!mainWindow.call.core.cameraEnabled) + } - // Chat panel button - CheckableButton { - id: chatPanelButton - visible: !mainWindow.conference || mainWindow.conference.core.isChatEnabled - iconUrl: AppIcons.chatTeardropText - //: Open chat… - ToolTip.text: qsTr("call_open_chat_hint") - Accessible.name: qsTr("call_open_chat_hint") - Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - UnreadNotification { - anchors.top: parent.top - anchors.right: parent.right - unread: mainWindow.chat ? mainWindow.chat.core.unreadMessagesCount : 0 - } - onToggled: { - if (checked) { - rightPanel.visible = true - rightPanel.replace(chatPanel) - } else { - rightPanel.visible = false - } - } - } + // Audio microphone button + CheckableButton { + id: audioMicrophoneButton + iconUrl: AppIcons.microphone + checkedIconUrl: AppIcons.microphoneSlash + ToolTip.text: mainWindow.call && mainWindow.call.core.microphoneMuted ? + //: "Activer le micro" + qsTr("call_activate_microphone") : + //: "Désactiver le micro" + 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: 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) + } - // Raise hand button - CheckableButton { - id: raiseHandButton - visible: false - checkable: false - iconUrl: AppIcons.handWaving - //: "Lever la main" - ToolTip.text: qsTr("call_rise_hand_hint") - Accessible.name: qsTr("call_rise_hand_hint") - Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - } + // Screen cast button + CheckableButton { + id: screencastPanelButton + iconUrl: AppIcons.screencast + visible: !!mainWindow.conference + //: Partager l'écran… + ToolTip.text: qsTr("call_share_screen_hint") + Accessible.name: qsTr("call_share_screen_hint") + 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; + rightPanel.replace(screencastPanel); + } else { + rightPanel.visible = false; + } + } + } - // Reaction button - CheckableButton { - id: reactionButton - visible: false - iconUrl: AppIcons.smiley - //: "Envoyer une réaction" - ToolTip.text: qsTr("call_send_reaction_hint") - Accessible.name: qsTr("call_send_reaction_hint") - Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - } + // Chat panel button + CheckableButton { + id: chatPanelButton + visible: !mainWindow.conference || mainWindow.conference.core.isChatEnabled + iconUrl: AppIcons.chatTeardropText + //: Open chat… + ToolTip.text: qsTr("call_open_chat_hint") + Accessible.name: qsTr("call_open_chat_hint") + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + UnreadNotification { + anchors.top: parent.top + anchors.right: parent.right + unread: mainWindow.chat ? mainWindow.chat.core.unreadMessagesCount : 0 + } + onToggled: { + if (checked) { + rightPanel.visible = true; + rightPanel.replace(chatPanel); + } else { + rightPanel.visible = false; + } + } + } - // Participant list button - CheckableButton { - id: participantListButton - //: "Gérer les participants" - ToolTip.text: qsTr("call_manage_participants_hint") - Accessible.name: qsTr("call_manage_participants_hint") - visible: mainWindow.conference - iconUrl: AppIcons.usersTwo - 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 - rightPanel.replace(participantListPanel) - } else { - rightPanel.visible = false - } - } - } + // Raise hand button + CheckableButton { + id: raiseHandButton + visible: false + checkable: false + iconUrl: AppIcons.handWaving + //: "Lever la main" + ToolTip.text: qsTr("call_rise_hand_hint") + Accessible.name: qsTr("call_rise_hand_hint") + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + } - // More option button - PopupButton { - id: moreOptionsButton - //: "Plus d'options…" - ToolTip.text: qsTr("call_more_options_hint") - popUpTitle: qsTr("call_more_options_hint") - 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: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - KeyNavigation.tab: connectedCallButtons.visible ? pauseButton : nextItemInFocusChain() - visible: bottomButtonsLayout.moreOptionsButtonVisibility + // Reaction button + CheckableButton { + id: reactionButton + visible: false + iconUrl: AppIcons.smiley + //: "Envoyer une réaction" + ToolTip.text: qsTr("call_send_reaction_hint") + Accessible.name: qsTr("call_send_reaction_hint") + Layout.preferredWidth: Utils.getSizeWithScreenRatio(55) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(55) + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + } - Connections { - target: moreOptionsButton.popup - function onOpened() { - moreOptionsButton.popup.y = -moreOptionsButton.popup.height - - moreOptionsButton.popup.padding - } - } - popup.contentItem: ColumnLayout { - id: optionsList - spacing: Utils.getSizeWithScreenRatio(5) + // Participant list button + CheckableButton { + id: participantListButton + //: "Gérer les participants" + ToolTip.text: qsTr("call_manage_participants_hint") + Accessible.name: qsTr("call_manage_participants_hint") + visible: mainWindow.conference + iconUrl: AppIcons.usersTwo + 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; + rightPanel.replace(participantListPanel); + } else { + rightPanel.visible = false; + } + } + } - IconLabelButton { - Layout.fillWidth: true - visible: mainWindow.conference - icon.source: AppIcons.layout - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - //: "Modifier la disposition" - text: qsTr("call_action_change_conference_layout") - style: ButtonStyle.noBackground - onClicked: { - rightPanel.visible = true - rightPanel.replace(changeLayoutPanel) - moreOptionsButton.close() - } - KeyNavigation.up: visibleChildren.length != 0 ? moreOptionsButton.getPreviousItem(0) : null - KeyNavigation.down: visibleChildren.length != 0 ? moreOptionsButton.getNextItem(0) : null - } - IconLabelButton { - Layout.fillWidth: true - icon.source: AppIcons.fullscreen - //: "Mode Plein écran" - text: qsTr("call_action_full_screen") - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - checkable: true - style: ButtonStyle.noBackground - Binding on checked { - value: mainWindow.visibility === Window.FullScreen - } - onToggled: { - if (checked) { - mainWindow.showFullScreen() - } else { - mainWindow.showNormal() - } - moreOptionsButton.close() - } - KeyNavigation.up: visibleChildren.length != 0 ? moreOptionsButton.getPreviousItem(1) : null - KeyNavigation.down: visibleChildren.length != 0 ? moreOptionsButton.getNextItem(1) : null - } - IconLabelButton { - Layout.fillWidth: true - icon.source: AppIcons.dialer - text: qsTr("call_action_show_dialer") - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - style: ButtonStyle.noBackground - onClicked: { - rightPanel.visible = true - rightPanel.replace(dialerPanel) - moreOptionsButton.close() - } - KeyNavigation.up: visibleChildren.length != 0 ? moreOptionsButton.getPreviousItem(2) : null - KeyNavigation.down: visibleChildren.length != 0 ? moreOptionsButton.getNextItem(2) : null - } - IconLabelButton { - Layout.fillWidth: true - checkable: true - style: ButtonStyle.noBackground - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - visible: mainWindow.call - && !mainWindow.conference - && !SettingsCpp.disableCallRecordings - enabled: mainWindow.call - && mainWindow.call.core.recordable - icon.source: AppIcons.recordFill - checked: mainWindow.call - && mainWindow.call.core.recording - hoveredImageColor: contentImageColor - contentImageColor: mainWindow.call - && mainWindow.call.core.recording ? DefaultStyle.danger_500_main : DefaultStyle.main2_500_main - text: mainWindow.call && mainWindow.call.core.recording - //: "Terminer l'enregistrement" - ? qsTr("call_action_stop_recording") - //: "Enregistrer l'appel" - : qsTr("call_action_record") - textColor: mainWindow.call - && mainWindow.call.core.recording ? DefaultStyle.danger_500_main : DefaultStyle.main2_500_main - hoveredTextColor: textColor - onToggled: { - if (mainWindow.call) - if (mainWindow.call.core.recording) - mainWindow.call.core.lStopRecording( - ) - else - mainWindow.call.core.lStartRecording() - } - KeyNavigation.up: visibleChildren.length != 0 ? moreOptionsButton.getPreviousItem(3) : null - KeyNavigation.down: visibleChildren.length != 0 ? moreOptionsButton.getNextItem(3) : null - } - IconLabelButton { - Layout.fillWidth: true - checkable: true - style: ButtonStyle.noBackground - 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 - && mainWindow.call.core.speakerMuted ? DefaultStyle.danger_500_main : DefaultStyle.main2_500_main - hoveredImageColor: contentImageColor - text: mainWindow.call && mainWindow.call.core.speakerMuted - //: "Activer le son" - ? qsTr("call_activate_speaker_hint") - //: "Désactiver le son" - : qsTr("call_deactivate_speaker_hint") - textColor: mainWindow.call - && mainWindow.call.core.speakerMuted ? DefaultStyle.danger_500_main : DefaultStyle.main2_500_main - hoveredTextColor: textColor - onCheckedChanged: { - if (mainWindow.call) - mainWindow.call.core.lSetSpeakerMuted( - !mainWindow.call.core.speakerMuted) - } - KeyNavigation.up: visibleChildren.length != 0 ? moreOptionsButton.getPreviousItem(4) : null - KeyNavigation.down: visibleChildren.length != 0 ? moreOptionsButton.getNextItem(4) : null - } - IconLabelButton { - Layout.fillWidth: true - icon.source: AppIcons.settings - icon.width: Utils.getSizeWithScreenRatio(32) - icon.height: Utils.getSizeWithScreenRatio(32) - //: "Paramètres" - text: qsTr("call_action_go_to_settings") - style: ButtonStyle.noBackground - onClicked: { - rightPanel.visible = true - rightPanel.replace(settingsPanel) - moreOptionsButton.close() - } - KeyNavigation.up: visibleChildren.length != 0 ? moreOptionsButton.getPreviousItem(5) : null - KeyNavigation.down: visibleChildren.length != 0 ? moreOptionsButton.getNextItem(5) : null - } - } - } - } - } - } - } + // More option button + PopupButton { + id: moreOptionsButton + //: "Plus d'options…" + ToolTip.text: qsTr("call_more_options_hint") + popUpTitle: qsTr("call_more_options_hint") + 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: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + KeyNavigation.tab: connectedCallButtons.visible ? pauseButton : nextItemInFocusChain() + visible: bottomButtonsLayout.moreOptionsButtonVisibility + + Connections { + target: moreOptionsButton.popup + function onOpened() { + moreOptionsButton.popup.y = -moreOptionsButton.popup.height - moreOptionsButton.popup.padding; + } + } + popup.contentItem: ColumnLayout { + id: optionsList + spacing: Utils.getSizeWithScreenRatio(5) + + IconLabelButton { + Layout.fillWidth: true + visible: mainWindow.conference + icon.source: AppIcons.layout + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + //: "Modifier la disposition" + text: qsTr("call_action_change_conference_layout") + style: ButtonStyle.noBackground + onClicked: { + rightPanel.visible = true; + rightPanel.replace(changeLayoutPanel); + moreOptionsButton.close(); + } + KeyNavigation.up: visibleChildren.length != 0 ? moreOptionsButton.getPreviousItem(0) : null + KeyNavigation.down: visibleChildren.length != 0 ? moreOptionsButton.getNextItem(0) : null + } + IconLabelButton { + Layout.fillWidth: true + icon.source: AppIcons.fullscreen + //: "Mode Plein écran" + text: qsTr("call_action_full_screen") + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + checkable: true + style: ButtonStyle.noBackground + Binding on checked { + value: mainWindow.visibility === Window.FullScreen + } + onToggled: { + if (checked) { + mainWindow.showFullScreen(); + } else { + mainWindow.showNormal(); + } + moreOptionsButton.close(); + } + KeyNavigation.up: visibleChildren.length != 0 ? moreOptionsButton.getPreviousItem(1) : null + KeyNavigation.down: visibleChildren.length != 0 ? moreOptionsButton.getNextItem(1) : null + } + IconLabelButton { + Layout.fillWidth: true + icon.source: AppIcons.dialer + text: qsTr("call_action_show_dialer") + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + style: ButtonStyle.noBackground + onClicked: { + rightPanel.visible = true; + rightPanel.replace(dialerPanel); + moreOptionsButton.close(); + } + KeyNavigation.up: visibleChildren.length != 0 ? moreOptionsButton.getPreviousItem(2) : null + KeyNavigation.down: visibleChildren.length != 0 ? moreOptionsButton.getNextItem(2) : null + } + IconLabelButton { + Layout.fillWidth: true + checkable: true + style: ButtonStyle.noBackground + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + visible: mainWindow.call && !mainWindow.conference && !SettingsCpp.disableCallRecordings + enabled: mainWindow.call && mainWindow.call.core.recordable + icon.source: AppIcons.recordFill + checked: mainWindow.call && mainWindow.call.core.recording + hoveredImageColor: contentImageColor + contentImageColor: mainWindow.call && mainWindow.call.core.recording ? DefaultStyle.danger_500_main : + DefaultStyle.main2_500_main + text: mainWindow.call && mainWindow.call.core.recording ? + //: "Terminer l'enregistrement" + qsTr("call_action_stop_recording") : + //: "Enregistrer l'appel" + qsTr("call_action_record") + textColor: mainWindow.call && mainWindow.call.core.recording ? DefaultStyle.danger_500_main : + DefaultStyle.main2_500_main + hoveredTextColor: textColor + onToggled: { + if (mainWindow.call) + if (mainWindow.call.core.recording) + mainWindow.call.core.lStopRecording(); + else + mainWindow.call.core.lStartRecording(); + } + KeyNavigation.up: visibleChildren.length != 0 ? moreOptionsButton.getPreviousItem(3) : null + KeyNavigation.down: visibleChildren.length != 0 ? moreOptionsButton.getNextItem(3) : null + } + IconLabelButton { + Layout.fillWidth: true + checkable: true + style: ButtonStyle.noBackground + 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 && mainWindow.call.core.speakerMuted ? DefaultStyle.danger_500_main : + DefaultStyle.main2_500_main + hoveredImageColor: contentImageColor + text: mainWindow.call && mainWindow.call.core.speakerMuted ? + //: "Activer le son" + qsTr("call_activate_speaker_hint") : + //: "Désactiver le son" + qsTr("call_deactivate_speaker_hint") + textColor: mainWindow.call && mainWindow.call.core.speakerMuted ? DefaultStyle.danger_500_main : + DefaultStyle.main2_500_main + hoveredTextColor: textColor + onCheckedChanged: { + if (mainWindow.call) + mainWindow.call.core.lSetSpeakerMuted(!mainWindow.call.core.speakerMuted); + } + KeyNavigation.up: visibleChildren.length != 0 ? moreOptionsButton.getPreviousItem(4) : null + KeyNavigation.down: visibleChildren.length != 0 ? moreOptionsButton.getNextItem(4) : null + } + IconLabelButton { + Layout.fillWidth: true + icon.source: AppIcons.settings + icon.width: Utils.getSizeWithScreenRatio(32) + icon.height: Utils.getSizeWithScreenRatio(32) + //: "Paramètres" + text: qsTr("call_action_go_to_settings") + style: ButtonStyle.noBackground + onClicked: { + rightPanel.visible = true; + rightPanel.replace(settingsPanel); + moreOptionsButton.close(); + } + KeyNavigation.up: visibleChildren.length != 0 ? moreOptionsButton.getPreviousItem(5) : null + KeyNavigation.down: visibleChildren.length != 0 ? moreOptionsButton.getNextItem(5) : null + } + } + } + } + } + } + } } diff --git a/Linphone/view/Page/Window/Main/MainWindow.qml b/Linphone/view/Page/Window/Main/MainWindow.qml index 964b68add..6d1f706f3 100644 --- a/Linphone/view/Page/Window/Main/MainWindow.qml +++ b/Linphone/view/Page/Window/Main/MainWindow.qml @@ -5,142 +5,154 @@ import QtQuick.Controls.Basic import Linphone import UtilsCpp import SettingsCpp -import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils AbstractWindow { id: mainWindow - // height: Utils.getSizeWithScreenRatio(982) - title: applicationName + // height: Utils.getSizeWithScreenRatio(982) + title: applicationName // TODO : handle this bool when security mode is implemented property bool firstConnection: true - property int initialWidth - property int initialHeight - Component.onCompleted: { - initialWidth = width - initialHeight = height - } + property int initialWidth + property int initialHeight + Component.onCompleted: { + initialWidth = width; + initialHeight = height; + } color: DefaultStyle.grey_0 - minimumWidth: Utils.getSizeWithScreenRatio(1020) - minimumHeight: Utils.getSizeWithScreenRatio(700) + minimumWidth: Utils.getSizeWithScreenRatio(1020) + minimumHeight: Utils.getSizeWithScreenRatio(700) - signal callCreated() + signal callCreated property var accountProxy // TODO : use this to make the border transparent flags: Qt.Window // menuBar: Rectangle { // width: parent.width - // height: Utils.getSizeWithScreenRatio(40) + // height: Utils.getSizeWithScreenRatio(40) // color: DefaultStyle.grey_100 // } - function openMainPage(connectionSucceed){ - if (mainWindowStackView.currentItem.objectName !== "mainPage") mainWindowStackView.replace(mainPage, StackView.Immediate) - //: "Connexion réussie" - if (connectionSucceed) mainWindow.showInformationPopup(qsTr("information_popup_connexion_succeed_title"), - //: "Vous êtes connecté en mode %1" - qsTr("information_popup_connexion_succeed_message").arg( - //: interopérable - qsTr("interoperable"))) + function openMainPage(connectionSucceed) { + if (mainWindowStackView.currentItem.objectName !== "mainPage") + mainWindowStackView.replace(mainPage, StackView.Immediate); + //: "Connexion réussie" + if (connectionSucceed) + mainWindow.showInformationPopup(qsTr("information_popup_connexion_succeed_title"), + //: "Vous êtes connecté en mode %1" + qsTr("information_popup_connexion_succeed_message").arg( + //: interopérable + qsTr("interoperable"))); } function goToCallHistory() { - openMainPage() - mainWindowStackView.currentItem.goToCallHistory() + openMainPage(); + mainWindowStackView.currentItem.goToCallHistory(); } function goToNewCall() { - openMainPage() - mainWindowStackView.currentItem.goToNewCall() + openMainPage(); + mainWindowStackView.currentItem.goToNewCall(); } function displayContactPage(contactAddress) { - openMainPage() - mainWindowStackView.currentItem.displayContactPage(contactAddress) + openMainPage(); + mainWindowStackView.currentItem.displayContactPage(contactAddress); } function displayCreateContactPage(name, contactAddress) { - openMainPage() - mainWindowStackView.currentItem.createContact(name, contactAddress) + openMainPage(); + mainWindowStackView.currentItem.createContact(name, contactAddress); } function displayChatPage(contactAddress) { - openMainPage() - mainWindowStackView.currentItem.displayChatPage(contactAddress) + openMainPage(); + mainWindowStackView.currentItem.displayChatPage(contactAddress); } function openChat(chat) { - openMainPage() - mainWindowStackView.currentItem.openChat(chat) + openMainPage(); + mainWindowStackView.currentItem.openChat(chat); } function transferCallSucceed() { - openMainPage() - //: "Appel transféré" - mainWindow.showInformationPopup(qsTr("call_transfer_successful_toast_title"), - //: "Votre correspondant a été transféré au contact sélectionné" - qsTr("call_transfer_successful_toast_message")) + openMainPage(); + //: "Appel transféré" + mainWindow.showInformationPopup(qsTr("call_transfer_successful_toast_title"), + //: "Votre correspondant a été transféré au contact sélectionné" + qsTr("call_transfer_successful_toast_message")); } function initStackViewItem() { - if(accountProxy && accountProxy.isInitialized) { - if (accountProxy.haveAccount) openMainPage() - else if (SettingsCpp.getFirstLaunch()) mainWindowStackView.replace(welcomePage, StackView.Immediate) - else if (SettingsCpp.assistantGoDirectlyToThirdPartySipAccountLogin) mainWindowStackView.replace(sipLoginPage, StackView.Immediate) - else mainWindowStackView.replace(loginPage, StackView.Immediate) - } - } - + if (accountProxy && accountProxy.isInitialized) { + if (accountProxy.haveAccount) + openMainPage(); + else if (SettingsCpp.getFirstLaunch()) + mainWindowStackView.replace(welcomePage, StackView.Immediate); + else if (SettingsCpp.assistantGoDirectlyToThirdPartySipAccountLogin) + mainWindowStackView.replace(sipLoginPage, StackView.Immediate); + else + mainWindowStackView.replace(loginPage, StackView.Immediate); + } + } + function goToLogin() { if (SettingsCpp.assistantGoDirectlyToThirdPartySipAccountLogin) - mainWindowStackView.replace(sipLoginPage) + mainWindowStackView.replace(sipLoginPage); else - mainWindowStackView.replace(loginPage) + mainWindowStackView.replace(loginPage); } function openSSOPage() { - mainWindowStackView.replace(ssoPage) + mainWindowStackView.replace(ssoPage); } function scheduleMeeting(subject, addresses) { - openMainPage() - mainWindowStackView.currentItem.scheduleMeeting(subject, addresses) + openMainPage(); + mainWindowStackView.currentItem.scheduleMeeting(subject, addresses); } property bool authenticationPopupOpened: false Component { id: authenticationPopupComp - AuthenticationDialog{ + AuthenticationDialog { onOpened: mainWindow.authenticationPopupOpened = true onClosed: { - mainWindow.authenticationPopupOpened = false - destroy() + mainWindow.authenticationPopupOpened = false; + destroy(); } } } - function reauthenticateAccount(identity, domain, callback){ - if (authenticationPopupOpened) return - if (mainWindowStackView.currentItem.objectName === "loginPage" - || mainWindowStackView.currentItem.objectName === "sipLoginPage") - return - console.log("Showing authentication dialog") - var popup = authenticationPopupComp.createObject(mainWindow, {"identity": identity, "domain": domain, "callback":callback}) // Callback ownership is not passed - popup.open() - popup.announce() + function reauthenticateAccount(identity, domain, callback) { + if (authenticationPopupOpened) + return; + if (mainWindowStackView.currentItem.objectName === "loginPage" || mainWindowStackView.currentItem.objectName + === "sipLoginPage") + return; + console.log("Showing authentication dialog"); + var popup = authenticationPopupComp.createObject(mainWindow, { + "identity": identity, + "domain": domain, + "callback": callback + }); // Callback ownership is not passed + popup.open(); + popup.announce(); } Connections { target: SettingsCpp function onAssistantGoDirectlyToThirdPartySipAccountLoginChanged() { - initStackViewItem() + initStackViewItem(); } function onIsSavedChanged(saved) { - if (saved) UtilsCpp.showInformationPopup(qsTr("information_popup_success_title"), - //: "Les changements ont été sauvegardés" - qsTr("information_popup_changes_saved"), true, mainWindow) - } + if (saved) + UtilsCpp.showInformationPopup(qsTr("information_popup_success_title"), + //: "Les changements ont été sauvegardés" + qsTr("information_popup_changes_saved"), true, mainWindow); + } } Connections { target: LoginPageCpp function onRegistrationStateChanged() { if (LoginPageCpp.registrationState === LinphoneEnums.RegistrationState.Ok) { - openMainPage(true) - proposeH264CodecsDownload() + openMainPage(true); + proposeH264CodecsDownload(); } } } @@ -149,17 +161,17 @@ AbstractWindow { id: accountProxyLoader active: AppCpp.coreStarted sourceComponent: AccountProxy { - onInitializedChanged: if (isInitialized) { - mainWindow.accountProxy = this - mainWindow.initStackViewItem() - } + onInitializedChanged: if (isInitialized) { + mainWindow.accountProxy = this; + mainWindow.initStackViewItem(); + } } } StackView { id: mainWindowStackView anchors.fill: parent - initialItem: splashScreen + initialItem: splashScreen } Component { id: splashScreen @@ -168,10 +180,10 @@ AbstractWindow { Image { anchors.centerIn: parent source: AppIcons.splashscreenLogo - sourceSize.width: Utils.getSizeWithScreenRatio(395) - sourceSize.height: Utils.getSizeWithScreenRatio(395) - width: Utils.getSizeWithScreenRatio(395) - height: Utils.getSizeWithScreenRatio(395) + sourceSize.width: Utils.getSizeWithScreenRatio(395) + sourceSize.height: Utils.getSizeWithScreenRatio(395) + width: Utils.getSizeWithScreenRatio(395) + height: Utils.getSizeWithScreenRatio(395) } } } @@ -179,8 +191,8 @@ AbstractWindow { id: welcomePage WelcomePage { onStartButtonPressed: { - goToLogin() // Replacing the first item will destroy the old. - SettingsCpp.setFirstLaunch(false) + goToLogin(); // Replacing the first item will destroy the old. + SettingsCpp.setFirstLaunch(false); } } } @@ -192,10 +204,10 @@ AbstractWindow { id: logoImage anchors.centerIn: parent source: AppIcons.splashscreenLogo - sourceSize.width: Utils.getSizeWithScreenRatio(395) - sourceSize.height: Utils.getSizeWithScreenRatio(395) - width: Utils.getSizeWithScreenRatio(395) - height: Utils.getSizeWithScreenRatio(395) + sourceSize.width: Utils.getSizeWithScreenRatio(395) + sourceSize.height: Utils.getSizeWithScreenRatio(395) + width: Utils.getSizeWithScreenRatio(395) + height: Utils.getSizeWithScreenRatio(395) } ColumnLayout { anchors.top: logoImage.bottom @@ -230,8 +242,9 @@ AbstractWindow { onGoBack: openMainPage() onUseSIPButtonClicked: mainWindowStackView.push(sipLoginPage) onGoToRegister: mainWindowStackView.replace(registerPage) - showBackButton: false - StackView.onActivated: if (mainWindow.accountProxy?.haveAccount) showBackButton = true + showBackButton: false + StackView.onActivated: if (mainWindow.accountProxy?.haveAccount) + showBackButton = true } } Component { @@ -239,33 +252,41 @@ AbstractWindow { SIPLoginPage { objectName: "sipLoginPage" onGoBack: { - if(SettingsCpp.assistantGoDirectlyToThirdPartySipAccountLogin){ - openMainPage() - }else - mainWindowStackView.pop() + if (SettingsCpp.assistantGoDirectlyToThirdPartySipAccountLogin) { + openMainPage(); + } else + mainWindowStackView.pop(); } onGoToRegister: mainWindowStackView.replace(registerPage) - showBackButton: false - StackView.onActivated: if (!SettingsCpp.assistantGoDirectlyToThirdPartySipAccountLogin || mainWindow.accountProxy?.haveAccount) showBackButton = true + showBackButton: false + StackView.onActivated: if (!SettingsCpp.assistantGoDirectlyToThirdPartySipAccountLogin || mainWindow.accountProxy + ?.haveAccount) + showBackButton = true } } Component { id: registerPage RegisterPage { onReturnToLogin: goToLogin() - //: "Veuillez valider le captcha sur la page web" - onBrowserValidationRequested: mainWindow.showLoadingPopup(qsTr("captcha_validation_loading_message"), true) + //: "Veuillez valider le captcha sur la page web" + onBrowserValidationRequested: mainWindow.showLoadingPopup(qsTr("captcha_validation_loading_message"), true) Connections { target: RegisterPageCpp function onNewAccountCreationSucceed(withEmail, address, sipIdentityAddress) { - mainWindowStackView.push(checkingPage, {"registerWithEmail": withEmail, "address": address, "sipIdentityAddress": sipIdentityAddress}) + mainWindowStackView.push(checkingPage, { + "registerWithEmail": withEmail, + "address": address, + "sipIdentityAddress": sipIdentityAddress + }); } function onRegisterNewAccountFailed(errorMessage) { - //: "Erreur lors de la création" - mainWindow.showInformationPopup(qsTr("assistant_register_error_title"), errorMessage, false) - mainWindow.closeLoadingPopup() + //: "Erreur lors de la création" + mainWindow.showInformationPopup(qsTr("assistant_register_error_title"), errorMessage, false); + mainWindow.closeLoadingPopup(); + } + function onTokenConversionSucceed() { + mainWindow.closeLoadingPopup(); } - function onTokenConversionSucceed(){ mainWindow.closeLoadingPopup()} } } } @@ -274,23 +295,24 @@ AbstractWindow { RegisterCheckingPage { id: registerCheckingPage onReturnToRegister: mainWindowStackView.pop() - onSendCode: (code) => { - RegisterPageCpp.linkNewAccountUsingCode(code, registerWithEmail, sipIdentityAddress) - } + onSendCode: code => { + RegisterPageCpp.linkNewAccountUsingCode(code, registerWithEmail, sipIdentityAddress); + } Connections { target: RegisterPageCpp function onLinkingNewAccountWithCodeSucceed() { - goToLogin() + goToLogin(); //: "Compte créé" mainWindow.showInformationPopup(qsTr("assistant_register_success_title"), //: "Le compte a été créé. Vous pouvez maintenant vous connecter" - qsTr("assistant_register_success_message"), true) + qsTr("assistant_register_success_message"), true); } function onLinkingNewAccountWithCodeFailed(errorMessage) { - registerCheckingPage.errorMessage = "" + registerCheckingPage.errorMessage = ""; //: "Erreur dans le code de validation" - if (errorMessage.length === 0) errorMessage = qsTr("assistant_register_error_code") - registerCheckingPage.errorMessage = errorMessage + if (errorMessage.length === 0) + errorMessage = qsTr("assistant_register_error_code"); + registerCheckingPage.errorMessage = errorMessage; } } } @@ -299,12 +321,12 @@ AbstractWindow { id: securityModePage SecurityModePage { id: securePage - onModeSelected: (index) => { - // TODO : connect to cpp part when ready - var selectedMode = index == 0 ? "chiffrement" : "interoperable" - console.debug("[SelectMode]User: User selected mode " + selectedMode) - openMainPage() - } + onModeSelected: index => { + // TODO : connect to cpp part when ready + var selectedMode = index == 0 ? "chiffrement" : "interoperable"; + console.debug("[SelectMode]User: User selected mode " + selectedMode); + openMainPage(); + } } } Component { @@ -314,11 +336,13 @@ AbstractWindow { objectName: "mainPage" onAddAccountRequest: goToLogin() onAccountRemoved: { - initStackViewItem() + initStackViewItem(); } Connections { target: mainWindow - function onCallCreated(){ mainLayout.callCreated() } + function onCallCreated() { + mainLayout.callCreated(); + } } // StackView.onActivated: connectionSecured(0) // TODO : connect to cpp part when ready } @@ -335,12 +359,11 @@ AbstractWindow { Item { Component.onCompleted: { if (modelData.core.mimeType == "H264") - Utils.openCodecOnlineInstallerDialog(mainWindow, modelData.core) + Utils.openCodecOnlineInstallerDialog(mainWindow, modelData.core); } } } function proposeH264CodecsDownload() { - codecDownloader.model = downloadableVideoPayloadTypeProxy + codecDownloader.model = downloadableVideoPayloadTypeProxy; } - } diff --git a/Linphone/view/Style/AppIcons.qml b/Linphone/view/Style/AppIcons.qml index 80a9a3b79..9db24e6d3 100644 --- a/Linphone/view/Style/AppIcons.qml +++ b/Linphone/view/Style/AppIcons.qml @@ -75,21 +75,21 @@ QtObject { property string trustedWhite: "image://internal/trusted-white.svg" property string trustedMask: "image://internal/trusted-mask.svg" property string avatar: "image://internal/randomAvatar.png" - property string layout: "image://internal/layout.svg" + property string layout: "image://internal/layout.svg" property string pause: "image://internal/pause.svg" property string pauseFill: "image://internal/pause-fill.svg" - property string play: "image://internal/play.svg" - property string playFill: "image://internal/play-fill.svg" - property string stopFill: "image://internal/stop-filled.svg" - property string filePdf: "image://internal/file-pdf.svg" - property string fileText: "image://internal/file-text.svg" - property string fileImage: "image://internal/file-image.svg" - property string filePlus: "image://internal/file-plus.svg" - property string download: "image://internal/download-simple.svg" - property string file: "image://internal/file.svg" - property string paperclip: "image://internal/paperclip.svg" - property string paperPlaneRight: "image://internal/paper-plane-right.svg" - property string smiley: "image://internal/smiley.svg" + property string play: "image://internal/play.svg" + property string playFill: "image://internal/play-fill.svg" + property string stopFill: "image://internal/stop-filled.svg" + property string filePdf: "image://internal/file-pdf.svg" + property string fileText: "image://internal/file-text.svg" + property string fileImage: "image://internal/file-image.svg" + property string filePlus: "image://internal/file-plus.svg" + property string download: "image://internal/download-simple.svg" + property string file: "image://internal/file.svg" + property string paperclip: "image://internal/paperclip.svg" + property string paperPlaneRight: "image://internal/paper-plane-right.svg" + property string smiley: "image://internal/smiley.svg" property string smileySad: "image://internal/smiley-sad.svg" property string trashCan: "image://internal/trash-simple.svg" property string copy: "image://internal/copy.svg" diff --git a/Linphone/view/Style/DefaultStyle.qml b/Linphone/view/Style/DefaultStyle.qml index e1adb509b..435b89ec9 100644 --- a/Linphone/view/Style/DefaultStyle.qml +++ b/Linphone/view/Style/DefaultStyle.qml @@ -6,71 +6,70 @@ import SettingsCpp QtObject { property var currentTheme: Themes.themes.hasOwnProperty(SettingsCpp.themeMainColor) - ? Themes.themes[SettingsCpp.themeMainColor] - : Themes.themes["orange"] - property var main1_100: currentTheme.main100 - property var main1_200: currentTheme.main200 - property var main1_300: currentTheme.main300 - property var main1_500_main: currentTheme.main500 - property var main1_600: currentTheme.main600 - property var main1_700: currentTheme.main700 + ? Themes.themes[SettingsCpp.themeMainColor] : Themes.themes["orange"] + property var main1_100: currentTheme.main100 + property var main1_200: currentTheme.main200 + property var main1_300: currentTheme.main300 + property var main1_500_main: currentTheme.main500 + property var main1_600: currentTheme.main600 + property var main1_700: currentTheme.main700 - property var main2_0: "#FAFEFF" - property var main2_100: "#EEF6F8" - property var main2_200: "#DFECF2" - property var main2_300: "#C0D1D9" - property var main2_400: "#9AABB5" - property var main2_500_main: "#6C7A87" - property var main2_600: "#4E6074" - property var main2_700: "#364860" - property var main2_800: "#22334D" - property var main2_900: "#2D3648" + property var main2_0: "#FAFEFF" + property var main2_100: "#EEF6F8" + property var main2_200: "#DFECF2" + property var main2_300: "#C0D1D9" + property var main2_400: "#9AABB5" + property var main2_500_main: "#6C7A87" + property var main2_600: "#4E6074" + property var main2_700: "#364860" + property var main2_800: "#22334D" + property var main2_900: "#2D3648" - property var grey_0: "#FFFFFF" - property var grey_100: "#F9F9F9" - property var grey_200: "#EDEDED" - property var grey_300: "#C9C9C9" - property var grey_400: "#949494" - property var grey_500: "#4E4E4E" - property var grey_600: "#2E3030" - property var grey_850: "#D9D9D9" - property var grey_900: "#070707" - property var grey_1000: "#000000" + property var grey_0: "#FFFFFF" + property var grey_100: "#F9F9F9" + property var grey_200: "#EDEDED" + property var grey_300: "#C9C9C9" + property var grey_400: "#949494" + property var grey_500: "#4E4E4E" + property var grey_600: "#2E3030" + property var grey_850: "#D9D9D9" + property var grey_900: "#070707" + property var grey_1000: "#000000" - property var warning_600: "#DBB820" - property var warning_700: "#AF9308" - property var danger_500_main: "#DD5F5F" - property var warning_500_main: "#FFDC2E" - property var danger_700: "#9E3548" - property var danger_900: "#723333" - property var success_500_main: "#4FAE80" - property var success_700: "#377d71" - property var success_900: "#1E4C53" - property var info_500_main: "#4AA8FF" - property var info_800_main: "#02528D" + property var warning_600: "#DBB820" + property var warning_700: "#AF9308" + property var danger_500_main: "#DD5F5F" + property var warning_500_main: "#FFDC2E" + property var danger_700: "#9E3548" + property var danger_900: "#723333" + property var success_500_main: "#4FAE80" + property var success_700: "#377d71" + property var success_900: "#1E4C53" + property var info_500_main: "#4AA8FF" + property var info_800_main: "#02528D" - property var vue_meter_light_green: "#6FF88D" - property var vue_meter_dark_green: "#00D916" + property var vue_meter_light_green: "#6FF88D" + property var vue_meter_dark_green: "#00D916" - property real defaultHeight: 1007.0 - property real defaultWidth: 1512.0 - property real maxDp: 0.98 - property real dp: Math.min((Screen.width/Screen.height)/(defaultWidth/defaultHeight), maxDp) + property real defaultHeight: 1007.0 + property real defaultWidth: 1512.0 + property real maxDp: 0.98 + property real dp: Math.min((Screen.width / Screen.height) / (defaultWidth / defaultHeight), maxDp) - onDpChanged: { - console.log("Screen ratio changed", dp) - AppCpp.setScreenRatio(dp) - } + onDpChanged: { + console.log("Screen ratio changed", dp); + AppCpp.setScreenRatio(dp); + } - // Warning: Qt 6.8.1 (current version) and previous versions, Qt only support COLRv0 fonts. Don't try to use v1. - property string emojiFont: "Noto Color Emoji" - property string flagFont: "Noto Color Emoji" - property string defaultFont: "Noto Sans" + // Warning: Qt 6.8.1 (current version) and previous versions, Qt only support COLRv0 fonts. Don't try to use v1. + property string emojiFont: "Noto Color Emoji" + property string flagFont: "Noto Color Emoji" + property string defaultFont: "Noto Sans" - property var numericPadPressedButtonColor: "#EEF7F8" + property var numericPadPressedButtonColor: "#EEF7F8" - property var groupCallButtonColor: "#EEF7F8" + property var groupCallButtonColor: "#EEF7F8" + + property var placeholders: '#CACACA' // No name in design - property var placeholders: '#CACACA' // No name in design - } diff --git a/Linphone/view/Style/FileViewStyle.qml b/Linphone/view/Style/FileViewStyle.qml index f8d604fe5..05bb31fdf 100644 --- a/Linphone/view/Style/FileViewStyle.qml +++ b/Linphone/view/Style/FileViewStyle.qml @@ -7,20 +7,20 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils // ============================================================================= QtObject { - property string sectionName : 'FileView' - + property string sectionName: 'FileView' + property int height: 120 property int heightbetter: 200 property int iconSize: 18 property int margins: 8 property int spacing: 8 property int width: 100 - - property QtObject name: QtObject{ + + property QtObject name: QtObject { property int pointSize: Utils.getSizeWithScreenRatio(7) } - - property QtObject download: QtObject{ + + property QtObject download: QtObject { property string icon: AppIcons.download property int height: 20 property int pointSize: Utils.getSizeWithScreenRatio(8) @@ -28,44 +28,44 @@ QtObject { } property QtObject thumbnailVideoIcon: QtObject { property int iconSize: 40 - property string name : 'play' - property string icon : AppIcons.playFill + property string name: 'play' + property string icon: AppIcons.playFill } property QtObject animation: QtObject { property int duration: 300 property real to: 1.7 property real thumbnailTo: 2 } - + property QtObject extension: QtObject { property string icon: AppIcons.file property string imageIcon: AppIcons.fileImage property int iconSize: 60 property int internalSize: 37 property int radius: Utils.getSizeWithScreenRatio(5) - + property QtObject background: QtObject { property var color: DefaultStyle.grey_0 property var borderColor: DefaultStyle.grey_0 } - + property QtObject text: QtObject { property var color: DefaultStyle.grey_0 property int pointSize: Utils.getSizeWithScreenRatio(9) } } - + property QtObject status: QtObject { property int spacing: 4 - + property QtObject bar: QtObject { property int height: 6 property int radius: 3 - + property QtObject background: QtObject { property var color: DefaultStyle.grey_0 } - + property QtObject contentItem: QtObject { property var color: DefaultStyle.grey_0 } diff --git a/Linphone/view/Style/Themes.qml b/Linphone/view/Style/Themes.qml index 769f279d8..79ab2db9f 100644 --- a/Linphone/view/Style/Themes.qml +++ b/Linphone/view/Style/Themes.qml @@ -2,64 +2,64 @@ pragma Singleton import QtQuick QtObject { - property var themes: { - return { - "orange": { - "main100": "#FFEACB", - "main200": "#FFD098", - "main300": "#FFB266", - "main500": "#FF5E00", - "main600": "#DA4400", - "main700": "#B72D00" - }, - "yellow": { - "main100": "#FFF5D6", - "main200": "#FFEFB2", - "main300": "#FFE799", - "main500": "#F5BC00", - "main600": "#C69300", - "main700": "#A37D00" - }, - "green": { - "main100": "#DCF9E7", - "main200": "#BDF0CF", - "main300": "#A8F0C2", - "main500": "#25D366", - "main600": "#1FA352", - "main700": "#1C9C4B" - }, - "blue": { - "main100": "#D6F4FF", - "main200": "#B2E9FF", - "main300": "#99E4FF", - "main500": "#00AFF0", - "main600": "#008CC0", - "main700": "#0078A3" - }, - "red": { - "main100": "#FBE1DA", - "main200": "#F8C1B6", - "main300": "#F5B53A", - "main500": "#E14318", - "main600": "#C23814", - "main700": "#A63211" - }, - "pink": { - "main100": "#FFD6F1", - "main200": "#FFB8E8", - "main300": "#FF99DD", - "main500": "#FF00A9", - "main600": "#D60090", - "main700": "#B8007A" - }, - "purple": { - "main100": "#FFD6FF", - "main200": "#F0B3F0", - "main300": "#FF99FF", - "main500": "#800080", - "main600": "#660066", - "main700": "#520052" - } - } - } + property var themes: { + return { + "orange": { + "main100": "#FFEACB", + "main200": "#FFD098", + "main300": "#FFB266", + "main500": "#FF5E00", + "main600": "#DA4400", + "main700": "#B72D00" + }, + "yellow": { + "main100": "#FFF5D6", + "main200": "#FFEFB2", + "main300": "#FFE799", + "main500": "#F5BC00", + "main600": "#C69300", + "main700": "#A37D00" + }, + "green": { + "main100": "#DCF9E7", + "main200": "#BDF0CF", + "main300": "#A8F0C2", + "main500": "#25D366", + "main600": "#1FA352", + "main700": "#1C9C4B" + }, + "blue": { + "main100": "#D6F4FF", + "main200": "#B2E9FF", + "main300": "#99E4FF", + "main500": "#00AFF0", + "main600": "#008CC0", + "main700": "#0078A3" + }, + "red": { + "main100": "#FBE1DA", + "main200": "#F8C1B6", + "main300": "#F5B53A", + "main500": "#E14318", + "main600": "#C23814", + "main700": "#A63211" + }, + "pink": { + "main100": "#FFD6F1", + "main200": "#FFB8E8", + "main300": "#FF99DD", + "main500": "#FF00A9", + "main600": "#D60090", + "main700": "#B8007A" + }, + "purple": { + "main100": "#FFD6FF", + "main200": "#F0B3F0", + "main300": "#FF99FF", + "main500": "#800080", + "main600": "#660066", + "main700": "#520052" + } + }; + } } diff --git a/Linphone/view/Style/Typography.qml b/Linphone/view/Style/Typography.qml index 97cd15e32..0043a3bc0 100644 --- a/Linphone/view/Style/Typography.qml +++ b/Linphone/view/Style/Typography.qml @@ -5,143 +5,143 @@ 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: Utils.getSizeWithScreenRatio(16), - weight: Font.ExtraBold - }) + property font h4: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(16), + weight: Font.ExtraBold + }) // Title/H3M - Bloc title - property font h3m: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(16), - weight: Font.Bold - }) - + property font h3m: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(16), + weight: Font.Bold + }) + // Title/H3 - Bloc title - property font h3: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(22), - weight: Font.ExtraBold - }) + property font h3: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(22), + weight: Font.ExtraBold + }) // Title/H2M - Large bloc title - property font h2m: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(20), - weight: Font.ExtraBold - }) + property font h2m: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(20), + weight: Font.ExtraBold + }) // Title/H2 - Large bloc title - property font h2: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(29), - weight: Font.ExtraBold - }) + property font h2: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(29), + weight: Font.ExtraBold + }) // Title/H1 - Large bloc title - property font h1: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(36), - weight: Font.ExtraBold - }) + property font h1: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(36), + weight: Font.ExtraBold + }) // Text/P4 - Xsmall paragraph text - property font p4: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(10), - weight: Font.Light - }) + property font p4: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(10), + weight: Font.Light + }) + + // Text/P3 - Reduced paragraph text + property font p3: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(12), + weight: Font.Light + }) - // Text/P3 - Reduced paragraph text - property font p3: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(12), - weight: Font.Light - }) - // Text/P2 - Bold, reduced paragraph text - property font p2: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(13), - weight: Font.Bold - }) + property font p2: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(13), + weight: Font.Bold + }) // Text/P2l - Large Bold, reduced paragraph text - property font p2l: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(14), - weight: Font.Bold - }) - + property font p2l: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(14), + weight: Font.Bold + }) + // Text/P1 - Paragraph text - property font p1: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(14), - weight: Font.Normal - }) - + property font p1: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(14), + weight: Font.Normal + }) + // Text/P1i - Paragraph text Italic - property font p1i: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(14), - weight: Font.Normal, - italic: true - }) - + property font p1i: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(14), + weight: Font.Normal, + italic: true + }) + // Text/P1s - Paragraph text - property font p1s: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(13), - weight: Font.Normal - }) - + property font p1s: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(13), + weight: Font.Normal + }) + // Text/P1 - Paragraph text - property font p1b: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(15), - weight: Font.Normal - }) - + property font p1b: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(15), + weight: Font.Normal + }) + // Button/B1 - Big Button - property font b1: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(18), - weight: Font.DemiBold - }) + property font b1: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(18), + weight: Font.DemiBold + }) // Button/B2 - Medium Button - property font b2: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(15), - weight: Font.DemiBold - }) - + property font b2: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(15), + weight: Font.DemiBold + }) + // Button/B3 - Small Button - property font b3: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(13), - weight: Font.DemiBold - }) + property font b3: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(13), + weight: Font.DemiBold + }) // FileView/F1 - File View name text - property font f1: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(11), - weight: Font.Bold - }) + property font f1: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(11), + weight: Font.Bold + }) // FileView/F1light - File View size text - property font f1l: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(10), - weight: Font.Medium - }) + property font f1l: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(10), + weight: Font.Medium + }) // FileView/F1light - Duration text - property font d1: Qt.font( { - family: DefaultStyle.defaultFont, - pixelSize: Utils.getSizeWithScreenRatio(8), - weight: Font.DemiBold - }) + property font d1: Qt.font({ + family: DefaultStyle.defaultFont, + pixelSize: Utils.getSizeWithScreenRatio(8), + weight: Font.DemiBold + }) } diff --git a/Linphone/view/Style/buttonStyle.js b/Linphone/view/Style/buttonStyle.js index eda1dc96b..ad486c23a 100644 --- a/Linphone/view/Style/buttonStyle.js +++ b/Linphone/view/Style/buttonStyle.js @@ -2,397 +2,396 @@ .import QtQuick as QtQuick .import Linphone as Linphone - // Orange - var main = { - color: { - normal: Linphone.DefaultStyle.main1_500_main, - hovered: Linphone.DefaultStyle.main1_600, - pressed: Linphone.DefaultStyle.main1_700 - }, - text: { - normal: Linphone.DefaultStyle.grey_0, - pressed: Linphone.DefaultStyle.grey_0 - }, - image: { - normal: Linphone.DefaultStyle.grey_0, - pressed: Linphone.DefaultStyle.grey_0 - } +var main = { + color: { + normal: Linphone.DefaultStyle.main1_500_main, + hovered: Linphone.DefaultStyle.main1_600, + pressed: Linphone.DefaultStyle.main1_700 + }, + text: { + normal: Linphone.DefaultStyle.grey_0, + pressed: Linphone.DefaultStyle.grey_0 + }, + image: { + normal: Linphone.DefaultStyle.grey_0, + pressed: Linphone.DefaultStyle.grey_0 } - var mainLightBorder = Object.assign({ - borderColor : { - keybaordFocused: Linphone.DefaultStyle.main2_0 - } - }, main) +}; +var mainLightBorder = Object.assign({ + borderColor: { + keybaordFocused: Linphone.DefaultStyle.main2_0 + } + }, main); // White with orange border - var secondary = { - color: { - normal: Linphone.DefaultStyle.grey_0, - hovered: Linphone.DefaultStyle.main1_100, - pressed: Linphone.DefaultStyle.main1_500_main - }, - borderColor: { - normal: Linphone.DefaultStyle.main1_500_main, - keybaordFocused: Linphone.DefaultStyle.main2_900 - }, - text: { - normal: Linphone.DefaultStyle.main1_500_main, - pressed: Linphone.DefaultStyle.grey_0 - }, - image: { - normal: Linphone.DefaultStyle.main1_500_main, - pressed: Linphone.DefaultStyle.grey_0 - } +var secondary = { + color: { + normal: Linphone.DefaultStyle.grey_0, + hovered: Linphone.DefaultStyle.main1_100, + pressed: Linphone.DefaultStyle.main1_500_main + }, + borderColor: { + normal: Linphone.DefaultStyle.main1_500_main, + keybaordFocused: Linphone.DefaultStyle.main2_900 + }, + text: { + normal: Linphone.DefaultStyle.main1_500_main, + pressed: Linphone.DefaultStyle.grey_0 + }, + image: { + normal: Linphone.DefaultStyle.main1_500_main, + pressed: Linphone.DefaultStyle.grey_0 } +}; - // White with orange icon - var player = { - color: { - normal: Linphone.DefaultStyle.grey_0, - hovered: Linphone.DefaultStyle.main1_100, - pressed: Linphone.DefaultStyle.main1_500_main - }, - text: { - normal: Linphone.DefaultStyle.main1_500_main, - pressed: Linphone.DefaultStyle.main1_500_main - }, - image: { - normal: Linphone.DefaultStyle.main1_500_main, - pressed: Linphone.DefaultStyle.main1_500_main - } +// White with orange icon +var player = { + color: { + normal: Linphone.DefaultStyle.grey_0, + hovered: Linphone.DefaultStyle.main1_100, + pressed: Linphone.DefaultStyle.main1_500_main + }, + text: { + normal: Linphone.DefaultStyle.main1_500_main, + pressed: Linphone.DefaultStyle.main1_500_main + }, + image: { + normal: Linphone.DefaultStyle.main1_500_main, + pressed: Linphone.DefaultStyle.main1_500_main } +}; // Light orange - var tertiary = { - color: { - normal: Linphone.DefaultStyle.main1_100, - hovered: Linphone.DefaultStyle.main1_200, - pressed: Linphone.DefaultStyle.main1_300 - }, - text: { - normal: Linphone.DefaultStyle.main1_500_main, - pressed: Linphone.DefaultStyle.main1_500_main - }, - image: { - normal: Linphone.DefaultStyle.main1_500_main, - pressed: Linphone.DefaultStyle.main1_500_main - } +var tertiary = { + color: { + normal: Linphone.DefaultStyle.main1_100, + hovered: Linphone.DefaultStyle.main1_200, + pressed: Linphone.DefaultStyle.main1_300 + }, + text: { + normal: Linphone.DefaultStyle.main1_500_main, + pressed: Linphone.DefaultStyle.main1_500_main + }, + image: { + normal: Linphone.DefaultStyle.main1_500_main, + pressed: Linphone.DefaultStyle.main1_500_main } +}; // Blue-grey - var grey = { - color: { - normal: Linphone.DefaultStyle.main2_200, - hovered: Linphone.DefaultStyle.main2_300, - pressed: Linphone.DefaultStyle.main2_400 - }, - text: { - normal: Linphone.DefaultStyle.main2_500_main, - pressed: Linphone.DefaultStyle.main2_700 - }, - image: { - normal: Linphone.DefaultStyle.main2_500_main, - pressed: Linphone.DefaultStyle.main2_700 - } +var grey = { + color: { + normal: Linphone.DefaultStyle.main2_200, + hovered: Linphone.DefaultStyle.main2_300, + pressed: Linphone.DefaultStyle.main2_400 + }, + text: { + normal: Linphone.DefaultStyle.main2_500_main, + pressed: Linphone.DefaultStyle.main2_700 + }, + image: { + normal: Linphone.DefaultStyle.main2_500_main, + pressed: Linphone.DefaultStyle.main2_700 } +}; // Red phone - var phoneRed = { - iconSource: Linphone.AppIcons.endCall, - color: { - normal: Linphone.DefaultStyle.danger_500_main, - hovered: Linphone.DefaultStyle.danger_700, - pressed: Linphone.DefaultStyle.danger_900 - }, - text: { - normal: Linphone.DefaultStyle.grey_0, - pressed: Linphone.DefaultStyle.grey_0 - }, - image: { - normal: Linphone.DefaultStyle.grey_0, - pressed: Linphone.DefaultStyle.grey_0 - } +var phoneRed = { + iconSource: Linphone.AppIcons.endCall, + color: { + normal: Linphone.DefaultStyle.danger_500_main, + hovered: Linphone.DefaultStyle.danger_700, + pressed: Linphone.DefaultStyle.danger_900 + }, + text: { + normal: Linphone.DefaultStyle.grey_0, + pressed: Linphone.DefaultStyle.grey_0 + }, + image: { + normal: Linphone.DefaultStyle.grey_0, + pressed: Linphone.DefaultStyle.grey_0 } - var phoneRedLightBorder = Object.assign({ - borderColor : { - keybaordFocused: Linphone.DefaultStyle.main2_0 - } - }, phoneRed) +}; +var phoneRedLightBorder = Object.assign({ + borderColor: { + keybaordFocused: Linphone.DefaultStyle.main2_0 + } + }, phoneRed); // Green phone - var phoneGreen = { - iconSource: Linphone.AppIcons.phone, - color: { - normal: Linphone.DefaultStyle.success_500_main, - hovered: Linphone.DefaultStyle.success_700, - pressed: Linphone.DefaultStyle.success_900 - }, - text: { - normal: Linphone.DefaultStyle.grey_0, - pressed: Linphone.DefaultStyle.grey_0 - }, - image: { - normal: Linphone.DefaultStyle.grey_0, - pressed: Linphone.DefaultStyle.grey_0 - } +var phoneGreen = { + iconSource: Linphone.AppIcons.phone, + color: { + normal: Linphone.DefaultStyle.success_500_main, + hovered: Linphone.DefaultStyle.success_700, + pressed: Linphone.DefaultStyle.success_900 + }, + text: { + normal: Linphone.DefaultStyle.grey_0, + pressed: Linphone.DefaultStyle.grey_0 + }, + image: { + normal: Linphone.DefaultStyle.grey_0, + pressed: Linphone.DefaultStyle.grey_0 } +}; // Checkable - var checkable = { - color: { - normal: Linphone.DefaultStyle.grey_500, - hovered: Linphone.DefaultStyle.grey_600, - pressed: Linphone.DefaultStyle.main2_400, - hovered: Linphone.DefaultStyle.main2_400 - }, - text: { - normal: Linphone.DefaultStyle.grey_0, - pressed: Linphone.DefaultStyle.grey_0 - }, - borderColor: { - keybaordFocused: Linphone.DefaultStyle.main2_0 - }, - image: { - normal: Linphone.DefaultStyle.grey_0, - pressed: Linphone.DefaultStyle.grey_0, - checked: Linphone.DefaultStyle.grey_0 - } +var checkable = { + color: { + normal: Linphone.DefaultStyle.grey_500, + hovered: Linphone.DefaultStyle.grey_600, + pressed: Linphone.DefaultStyle.main2_400, + hovered: Linphone.DefaultStyle.main2_400 + }, + text: { + normal: Linphone.DefaultStyle.grey_0, + pressed: Linphone.DefaultStyle.grey_0 + }, + borderColor: { + keybaordFocused: Linphone.DefaultStyle.main2_0 + }, + image: { + normal: Linphone.DefaultStyle.grey_0, + pressed: Linphone.DefaultStyle.grey_0, + checked: Linphone.DefaultStyle.grey_0 } +}; // No background light - var noBackgroundLight = { - color: { - normal: "#00000000", - hovered: "#00000000", - pressed: "#00000000", - checked: "#00000000" - }, - borderColor: { - normal: "#00000000", - keybaordFocused: Linphone.DefaultStyle.main2_900 - }, - text: { - normal: Linphone.DefaultStyle.main2_200, - hovered: Linphone.DefaultStyle.main2_300, - pressed: Linphone.DefaultStyle.main2_400, - checked: Linphone.DefaultStyle.main1_500_main - }, - image: { - normal: Linphone.DefaultStyle.main2_200, - hovered: Linphone.DefaultStyle.main2_300, - pressed: Linphone.DefaultStyle.main2_400, - checked: Linphone.DefaultStyle.main1_500_main, - } +var noBackgroundLight = { + color: { + normal: "#00000000", + hovered: "#00000000", + pressed: "#00000000", + checked: "#00000000" + }, + borderColor: { + normal: "#00000000", + keybaordFocused: Linphone.DefaultStyle.main2_900 + }, + text: { + normal: Linphone.DefaultStyle.main2_200, + hovered: Linphone.DefaultStyle.main2_300, + pressed: Linphone.DefaultStyle.main2_400, + checked: Linphone.DefaultStyle.main1_500_main + }, + image: { + normal: Linphone.DefaultStyle.main2_200, + hovered: Linphone.DefaultStyle.main2_300, + pressed: Linphone.DefaultStyle.main2_400, + checked: Linphone.DefaultStyle.main1_500_main } +}; // No background - var noBackground = { - color: { - normal: "#00000000", - hovered: "#00000000", - pressed: "#00000000", - checked: "#00000000" - }, - borderColor: { - normal: "#00000000", - keybaordFocused: Linphone.DefaultStyle.main2_900 - }, - text: { - normal: Linphone.DefaultStyle.main2_600, - hovered: Linphone.DefaultStyle.main2_700, - pressed: Linphone.DefaultStyle.main2_800, - checked: Linphone.DefaultStyle.main1_500_main - }, - image: { - normal: Linphone.DefaultStyle.main2_600, - hovered: Linphone.DefaultStyle.main2_700, - pressed: Linphone.DefaultStyle.main2_800, - checked: Linphone.DefaultStyle.main1_500_main, - } +var noBackground = { + color: { + normal: "#00000000", + hovered: "#00000000", + pressed: "#00000000", + checked: "#00000000" + }, + borderColor: { + normal: "#00000000", + keybaordFocused: Linphone.DefaultStyle.main2_900 + }, + text: { + normal: Linphone.DefaultStyle.main2_600, + hovered: Linphone.DefaultStyle.main2_700, + pressed: Linphone.DefaultStyle.main2_800, + checked: Linphone.DefaultStyle.main1_500_main + }, + image: { + normal: Linphone.DefaultStyle.main2_600, + hovered: Linphone.DefaultStyle.main2_700, + pressed: Linphone.DefaultStyle.main2_800, + checked: Linphone.DefaultStyle.main1_500_main } - var noBackgroundLightBorder = Object.assign({ - borderColor : { - keybaordFocused: Linphone.DefaultStyle.main2_0 - } - }, noBackground) +}; +var noBackgroundLightBorder = Object.assign({ + borderColor: { + keybaordFocused: Linphone.DefaultStyle.main2_0 + } + }, noBackground); // No background red - var noBackgroundRed = { - color: { - normal: "#00000000", - hovered: "#00000000", - pressed: "#00000000" - }, - text: { - normal: Linphone.DefaultStyle.danger_500_main, - hovered: Linphone.DefaultStyle.danger_700, - pressed: Linphone.DefaultStyle.danger_900 - }, - image: { - normal: Linphone.DefaultStyle.danger_500_main, - hovered: Linphone.DefaultStyle.danger_700, - pressed: Linphone.DefaultStyle.danger_900, - checked: Linphone.DefaultStyle.danger_900 - } +var noBackgroundRed = { + color: { + normal: "#00000000", + hovered: "#00000000", + pressed: "#00000000" + }, + text: { + normal: Linphone.DefaultStyle.danger_500_main, + hovered: Linphone.DefaultStyle.danger_700, + pressed: Linphone.DefaultStyle.danger_900 + }, + image: { + normal: Linphone.DefaultStyle.danger_500_main, + hovered: Linphone.DefaultStyle.danger_700, + pressed: Linphone.DefaultStyle.danger_900, + checked: Linphone.DefaultStyle.danger_900 } +}; // No background orange - var noBackgroundOrange = { - color: { - normal: "#00000000", - hovered: "#00000000", - pressed: "#00000000" - }, - text: { - normal: Linphone.DefaultStyle.main1_500_main, - hovered: Linphone.DefaultStyle.main1_600, - pressed: Linphone.DefaultStyle.main1_700 - }, - image: { - normal: Linphone.DefaultStyle.main1_500_main, - hovered: Linphone.DefaultStyle.main1_600, - pressed: Linphone.DefaultStyle.main1_700 - } +var noBackgroundOrange = { + color: { + normal: "#00000000", + hovered: "#00000000", + pressed: "#00000000" + }, + text: { + normal: Linphone.DefaultStyle.main1_500_main, + hovered: Linphone.DefaultStyle.main1_600, + pressed: Linphone.DefaultStyle.main1_700 + }, + image: { + normal: Linphone.DefaultStyle.main1_500_main, + hovered: Linphone.DefaultStyle.main1_600, + pressed: Linphone.DefaultStyle.main1_700 } +}; - // Popup button - var popupButton = { - color: { - normal: "#00000000", - hovered: Linphone.DefaultStyle.grey_100, - pressed: Linphone.DefaultStyle.main2_300 - }, - text: { - normal: Linphone.DefaultStyle.main2_600, - hovered: Linphone.DefaultStyle.main2_600, - pressed: Linphone.DefaultStyle.main2_600 - }, - image: { - normal: Linphone.DefaultStyle.main2_600, - hovered: Linphone.DefaultStyle.main2_600, - pressed: Linphone.DefaultStyle.main2_600 - } +// Popup button +var popupButton = { + color: { + normal: "#00000000", + hovered: Linphone.DefaultStyle.grey_100, + pressed: Linphone.DefaultStyle.main2_300 + }, + text: { + normal: Linphone.DefaultStyle.main2_600, + hovered: Linphone.DefaultStyle.main2_600, + pressed: Linphone.DefaultStyle.main2_600 + }, + image: { + normal: Linphone.DefaultStyle.main2_600, + hovered: Linphone.DefaultStyle.main2_600, + pressed: Linphone.DefaultStyle.main2_600 } +}; // Icon + label button - var hoveredBackground = { - color: { - normal: "#00000000", - hovered: Linphone.DefaultStyle.main2_100, - pressed: Linphone.DefaultStyle.main2_100 - }, - text: { - normal: Linphone.DefaultStyle.main2_500_main, - hovered: Linphone.DefaultStyle.main2_500_main, - pressed: Linphone.DefaultStyle.main2_500_main - }, - image: { - normal: Linphone.DefaultStyle.main2_500_main, - hovered: Linphone.DefaultStyle.main2_500_main, - pressed: Linphone.DefaultStyle.main2_500_main - } +var hoveredBackground = { + color: { + normal: "#00000000", + hovered: Linphone.DefaultStyle.main2_100, + pressed: Linphone.DefaultStyle.main2_100 + }, + text: { + normal: Linphone.DefaultStyle.main2_500_main, + hovered: Linphone.DefaultStyle.main2_500_main, + pressed: Linphone.DefaultStyle.main2_500_main + }, + image: { + normal: Linphone.DefaultStyle.main2_500_main, + hovered: Linphone.DefaultStyle.main2_500_main, + pressed: Linphone.DefaultStyle.main2_500_main } +}; // Icon + label red button - var hoveredBackgroundRed = { - color: { - normal: "#00000000", - hovered: Linphone.DefaultStyle.main2_100, - pressed: Linphone.DefaultStyle.main2_100 - }, - text: { - normal: Linphone.DefaultStyle.danger_500_main, - hovered: Linphone.DefaultStyle.danger_700, - pressed: Linphone.DefaultStyle.danger_900 - }, - image: { - normal: Linphone.DefaultStyle.danger_500_main, - hovered: Linphone.DefaultStyle.danger_700, - pressed: Linphone.DefaultStyle.danger_900 - } +var hoveredBackgroundRed = { + color: { + normal: "#00000000", + hovered: Linphone.DefaultStyle.main2_100, + pressed: Linphone.DefaultStyle.main2_100 + }, + text: { + normal: Linphone.DefaultStyle.danger_500_main, + hovered: Linphone.DefaultStyle.danger_700, + pressed: Linphone.DefaultStyle.danger_900 + }, + image: { + normal: Linphone.DefaultStyle.danger_500_main, + hovered: Linphone.DefaultStyle.danger_700, + pressed: Linphone.DefaultStyle.danger_900 } +}; // Numpad - var numericPad = { - color: { - normal: Linphone.DefaultStyle.grey_0, - hovered: Linphone.DefaultStyle.grey_200, - pressed: Linphone.DefaultStyle.grey_300 - }, - text: { - normal: Linphone.DefaultStyle.main2_600, - pressed: Linphone.DefaultStyle.main2_700 - } +var numericPad = { + color: { + normal: Linphone.DefaultStyle.grey_0, + hovered: Linphone.DefaultStyle.grey_200, + pressed: Linphone.DefaultStyle.grey_300 + }, + text: { + normal: Linphone.DefaultStyle.main2_600, + pressed: Linphone.DefaultStyle.main2_700 } +}; // Green toast - var toast = { - color: { - normal: Linphone.DefaultStyle.grey_0, - hovered: Linphone.DefaultStyle.grey_0, - pressed: Linphone.DefaultStyle.grey_0 - }, - borderColor: { - normal: Linphone.DefaultStyle.success_500_main, - keybaordFocused: Linphone.DefaultStyle.main2_900 - }, - text: { - normal: Linphone.DefaultStyle.success_500_main, - pressed: Linphone.DefaultStyle.success_700 - } +var toast = { + color: { + normal: Linphone.DefaultStyle.grey_0, + hovered: Linphone.DefaultStyle.grey_0, + pressed: Linphone.DefaultStyle.grey_0 + }, + borderColor: { + normal: Linphone.DefaultStyle.success_500_main, + keybaordFocused: Linphone.DefaultStyle.main2_900 + }, + text: { + normal: Linphone.DefaultStyle.success_500_main, + pressed: Linphone.DefaultStyle.success_700 } +}; // Security blue toast - var securityToast = { - color: { - normal: Linphone.DefaultStyle.grey_0, - hovered: Linphone.DefaultStyle.grey_0, - pressed: Linphone.DefaultStyle.grey_0 - }, - borderColor: { - normal: Linphone.DefaultStyle.info_500_main, - keybaordFocused: Linphone.DefaultStyle.main2_900 - }, - text: { - normal: Linphone.DefaultStyle.info_500_main, - pressed: Linphone.DefaultStyle.info_500_main - } +var securityToast = { + color: { + normal: Linphone.DefaultStyle.grey_0, + hovered: Linphone.DefaultStyle.grey_0, + pressed: Linphone.DefaultStyle.grey_0 + }, + borderColor: { + normal: Linphone.DefaultStyle.info_500_main, + keybaordFocused: Linphone.DefaultStyle.main2_900 + }, + text: { + normal: Linphone.DefaultStyle.info_500_main, + pressed: Linphone.DefaultStyle.info_500_main } +}; // Security red toast - var securityToastError = { - color: { - normal: Linphone.DefaultStyle.grey_0, - hovered: Linphone.DefaultStyle.grey_0, - pressed: Linphone.DefaultStyle.grey_0 - }, - borderColor: { - normal: Linphone.DefaultStyle.danger_500_main, - keybaordFocused: Linphone.DefaultStyle.main2_900 - }, - text: { - normal: Linphone.DefaultStyle.danger_500_main, - pressed: Linphone.DefaultStyle.danger_500_main - } +var securityToastError = { + color: { + normal: Linphone.DefaultStyle.grey_0, + hovered: Linphone.DefaultStyle.grey_0, + pressed: Linphone.DefaultStyle.grey_0 + }, + borderColor: { + normal: Linphone.DefaultStyle.danger_500_main, + keybaordFocused: Linphone.DefaultStyle.main2_900 + }, + text: { + normal: Linphone.DefaultStyle.danger_500_main, + pressed: Linphone.DefaultStyle.danger_500_main } +}; // White selected - var whiteSelected = { - color: { - normal: Linphone.DefaultStyle.grey_0, - hovered: Linphone.DefaultStyle.main2_100, - selected: Linphone.DefaultStyle.grey_200, - }, - borderColor: { - keybaordFocused: Linphone.DefaultStyle.main2_900 - } +var whiteSelected = { + color: { + normal: Linphone.DefaultStyle.grey_0, + hovered: Linphone.DefaultStyle.main2_100, + selected: Linphone.DefaultStyle.grey_200 + }, + borderColor: { + keybaordFocused: Linphone.DefaultStyle.main2_900 } +}; - var hoveredBackgroundBis = { - color: { - normal: "#00000000", - hovered: Linphone.DefaultStyle.main2_100, - pressed: Linphone.DefaultStyle.main2_100 - } - } \ No newline at end of file +var hoveredBackgroundBis = { + color: { + normal: "#00000000", + hovered: Linphone.DefaultStyle.main2_100, + pressed: Linphone.DefaultStyle.main2_100 + } +}; diff --git a/Linphone/view/Test/ItemsTest.qml b/Linphone/view/Test/ItemsTest.qml index d0647f9c9..5875c2ecd 100644 --- a/Linphone/view/Test/ItemsTest.qml +++ b/Linphone/view/Test/ItemsTest.qml @@ -7,7 +7,7 @@ Window { width: 960 height: 600 visible: true - title: ("Test") + title: ("Test") ColumnLayout { RowLayout { ColumnLayout { @@ -16,9 +16,18 @@ Window { } ComboBox { model: [ - {text: "item 1", img: AppIcons.info}, - {text: "item 2", img: AppIcons.info}, - {text: "item 3", img: AppIcons.info} + { + text: "item 1", + img: AppIcons.info + }, + { + text: "item 2", + img: AppIcons.info + }, + { + text: "item 3", + img: AppIcons.info + } ] } } @@ -28,9 +37,15 @@ Window { } ComboBox { model: [ - {text: "item 1"}, - {text: "item 2"}, - {text: "item 3"} + { + text: "item 1" + }, + { + text: "item 2" + }, + { + text: "item 3" + } ] } } @@ -80,7 +95,7 @@ Window { Text { text: "item 3" } - }, + }, Component { Text { text: "item 4" @@ -115,7 +130,7 @@ Window { } TextField { label: "number text input" - validator: IntValidator{} + validator: IntValidator {} } } @@ -126,16 +141,15 @@ Window { RowLayout { Repeater { model: 4 - DigitInput { - } + DigitInput {} } } } TabBar { spacing: 10 contentWidth: 400 - model: [("A"), ("Lot"), ("Of"), ("Tab"), ("Buttons (which one has a very long label)"), ("For"), ("The"), ("Tab"), ("Bar"), ("To"), ("Not"), ("Have"), ("Enough"), ("Space"), ("To"), ("Display"), ("Them"), ("All")] + model: [("A"), ("Lot"), ("Of"), ("Tab"), ("Buttons (which one has a very long label)"), ("For"), ("The"), ("Tab"), ("Bar"), + ("To"), ("Not"), ("Have"), ("Enough"), ("Space"), ("To"), ("Display"), ("Them"), ("All")] } - } } diff --git a/Linphone/view/Test/RectangleTest.qml b/Linphone/view/Test/RectangleTest.qml index 572f396e1..704d812c0 100644 --- a/Linphone/view/Test/RectangleTest.qml +++ b/Linphone/view/Test/RectangleTest.qml @@ -1,10 +1,9 @@ import QtQuick Rectangle { - function genRandomColor(){ - return '#'+ Math.floor(Math.random()*255).toString(16) - +Math.floor(Math.random()*255).toString(16) - +Math.floor(Math.random()*255).toString(16) + function genRandomColor() { + return '#' + Math.floor(Math.random() * 255).toString(16) + Math.floor(Math.random() * 255).toString(16) + Math.floor( + Math.random() * 255).toString(16); } color: genRandomColor() //"blue"