From 440b3991f1ca4e84a7d949c645d6a2a0ae8a0575 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Fri, 27 Oct 2023 18:01:47 +0200 Subject: [PATCH] resolve mr threads --- .../core/phone-number/PhoneNumberProxy.cpp | 14 -- .../core/phone-number/PhoneNumberProxy.hpp | 5 - Linphone/view/App/Layout/LoginLayout.qml | 4 +- Linphone/view/Item/CheckBox.qml | 4 +- Linphone/view/Item/ComboBox.qml | 135 +++++++++--------- Linphone/view/Item/DigitInput.qml | 16 +-- Linphone/view/Item/PhoneNumberComboBox.qml | 88 ++++++------ Linphone/view/Item/PhoneNumberInput.qml | 11 +- Linphone/view/Item/TabBar.qml | 26 ++-- Linphone/view/Item/TextInput.qml | 18 +-- Linphone/view/Page/Login/LoginItem.qml | 3 +- .../view/Page/Login/RegisterCheckingPage.qml | 45 +++--- Linphone/view/Page/Login/RegisterPage.qml | 18 +-- Linphone/view/Page/Login/SIPLoginPage.qml | 21 ++- Linphone/view/Page/Login/WelcomePage.qml | 6 +- .../view/Prototype/PhoneNumberPrototype.qml | 2 +- Linphone/view/Style/DefaultStyle.qml | 1 + 17 files changed, 194 insertions(+), 223 deletions(-) diff --git a/Linphone/core/phone-number/PhoneNumberProxy.cpp b/Linphone/core/phone-number/PhoneNumberProxy.cpp index 976fa86dd..0eecc9968 100644 --- a/Linphone/core/phone-number/PhoneNumberProxy.cpp +++ b/Linphone/core/phone-number/PhoneNumberProxy.cpp @@ -39,18 +39,6 @@ void PhoneNumberProxy::setFilterText(const QString &filter) { } } -QString PhoneNumberProxy::getDefaultCountryCallingCode() const { - return mDefaultCountryCallingCode; -} - -void PhoneNumberProxy::setDefaultCountryCallingCode(const QString &code) { - if (mDefaultCountryCallingCode != code) { - mDefaultCountryCallingCode = code; - invalidate(); - emit defaultCountryCallingCodeChanged(); - } -} - int PhoneNumberProxy::findIndexByCountryCallingCode(const QString &countryCallingCode) { auto model = qobject_cast(sourceModel()); if (!model) return -1; @@ -62,8 +50,6 @@ int PhoneNumberProxy::findIndexByCountryCallingCode(const QString &countryCallin }); auto proxyModelIndex = mapFromSource(model->index(it - list.begin())); return proxyModelIndex.row(); - - return -1; } bool PhoneNumberProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { diff --git a/Linphone/core/phone-number/PhoneNumberProxy.hpp b/Linphone/core/phone-number/PhoneNumberProxy.hpp index 39931a5b0..27c38c112 100644 --- a/Linphone/core/phone-number/PhoneNumberProxy.hpp +++ b/Linphone/core/phone-number/PhoneNumberProxy.hpp @@ -29,28 +29,23 @@ class PhoneNumberProxy : public SortFilterProxy { Q_OBJECT Q_PROPERTY(QString filterText READ getFilterText WRITE setFilterText NOTIFY filterTextChanged) - Q_PROPERTY(QString defaultCountryCallingCode READ getDefaultCountryCallingCode NOTIFY defaultCountryCallingCodeChanged) public: PhoneNumberProxy(QObject *parent = Q_NULLPTR); QString getFilterText() const; void setFilterText(const QString &filter); - QString getDefaultCountryCallingCode() const; - void setDefaultCountryCallingCode(const QString &filter); Q_INVOKABLE int findIndexByCountryCallingCode(const QString& countryCallingCode); signals: void filterTextChanged(); - void defaultCountryCallingCodeChanged(); protected: virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; QString mFilterText; - QString mDefaultCountryCallingCode; }; #endif diff --git a/Linphone/view/App/Layout/LoginLayout.qml b/Linphone/view/App/Layout/LoginLayout.qml index e3b7927bc..125f8c3d6 100644 --- a/Linphone/view/App/Layout/LoginLayout.qml +++ b/Linphone/view/App/Layout/LoginLayout.qml @@ -32,11 +32,11 @@ Item { fillMode: Image.PreserveAspectFit source: AppIcons.info } - onClicked: console.debug("[LoginLayout] open about popup") + onClicked: console.debug("[LoginLayout]User: open about popup") } Text { - Layout.alignment: Qt.AlignRight |Qt.AlignVCenter + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter text: "About" font.pixelSize: 12 color: DefaultStyle.grayColor diff --git a/Linphone/view/Item/CheckBox.qml b/Linphone/view/Item/CheckBox.qml index fb6d435a9..e45374e4a 100644 --- a/Linphone/view/Item/CheckBox.qml +++ b/Linphone/view/Item/CheckBox.qml @@ -3,7 +3,7 @@ import QtQuick.Controls 2.2 as Control import Linphone Control.CheckBox { - id: checkbox + id: mainItem indicator: Rectangle { implicitWidth: 18 @@ -20,7 +20,7 @@ Control.CheckBox { text: "\u2714" font.pointSize: 18 color: DefaultStyle.checkboxBorderColor - visible: checkbox.checked + visible: mainItem.checked } } } diff --git a/Linphone/view/Item/ComboBox.qml b/Linphone/view/Item/ComboBox.qml index 68ccd04d0..8c82fd622 100644 --- a/Linphone/view/Item/ComboBox.qml +++ b/Linphone/view/Item/ComboBox.qml @@ -1,20 +1,20 @@ import QtQuick -import QtQuick.Controls +import QtQuick.Controls as Control import QtQuick.Layouts 1.0 import Linphone ColumnLayout { - id: cellLayout + id: mainItem property string label: "" property int backgroundWidth: 200 // Usage : each item of the model list must be {text: ..., img: ...} property var modelList: [] - readonly property string currentText: chosenItemText.text + readonly property string currentText: selectedItemText.text Text { visible: label.length > 0 verticalAlignment: Text.AlignVCenter - text: cellLayout.label + text: mainItem.label color: DefaultStyle.formItemLabelColor font { pointSize: DefaultStyle.formItemLabelSize @@ -22,53 +22,61 @@ ColumnLayout { } } - ComboBox { + Control.ComboBox { id: combobox - model: cellLayout.modelList - width: cellLayout.backgroundWidth - background: Loader { - sourceComponent: backgroundRectangle + model: mainItem.modelList + width: mainItem.backgroundWidth + background: Rectangle { + implicitWidth: mainItem.backgroundWidth + implicitHeight: 30 + radius: 15 + color: DefaultStyle.formItemBackgroundColor } contentItem: Item { anchors.left: parent.left - anchors.right: indic.right - anchors.leftMargin: 10 + anchors.right: indicImage.right Image { - id: chosenItemImg + id: selectedItemImg + visible: source != "" sourceSize.width: 20 - width: 20 + width: visible ? 20 : 0 fillMode: Image.PreserveAspectFit - anchors.leftMargin: 20 anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: visible ? 10 : 0 } Text { - id: chosenItemText - anchors.left: chosenItemImg.right - anchors.leftMargin: 10 - anchors.rightMargin: 20 - anchors.right: parent.right + id: selectedItemText elide: Text.ElideRight + anchors.left: selectedItemImg.right + anchors.leftMargin: selectedItemImg.visible ? 15 : 10 + anchors.right: parent.right + anchors.rightMargin: 20 anchors.verticalCenter: parent.verticalCenter } Component.onCompleted: { - if (cellLayout.modelList[combobox.currentIndex].img) - chosenItemImg.source = cellLayout.modelList[combobox.currentIndex].img - if (cellLayout.modelList[combobox.currentIndex].text) - chosenItemText.text = cellLayout.modelList[combobox.currentIndex].text + var index = combobox.currentIndex < 0 ? 0 : combobox.currentIndex + if (mainItem.modelList[index].img) { + selectedItemImg.source = mainItem.modelList[0].img + } + if (mainItem.modelList[index].text) + selectedItemText.text = mainItem.modelList[0].text + else if (mainItem.modelList[index]) + selectedItemText.text = mainItem.modelList[0] } } indicator: Image { - id: indic - x: combobox.width - width - combobox.rightPadding - y: combobox.topPadding + (combobox.availableHeight - height) / 2 + id: indicImage + anchors.right: parent.right + anchors.rightMargin: 10 + anchors.verticalCenter: parent.verticalCenter source: AppIcons.downArrow } - popup: Popup { + popup: Control.Popup { id: listPopup y: combobox.height - 1 width: combobox.width @@ -82,34 +90,47 @@ ColumnLayout { model: combobox.model currentIndex: combobox.highlightedIndex >= 0 ? combobox.highlightedIndex : 0 highlightFollowsCurrentItem: true - highlight: highlight + highlight: Rectangle { + width: listView.width + color: DefaultStyle.comboBoxHighlightColor + radius: 15 + y: listView.currentItem? listView.currentItem.y : 0 + } delegate: Item { - width:combobox.width; - height: combobox.height; + width:combobox.width + height: combobox.height + anchors.left: parent.left + anchors.right: parent.right + Image { - id: delegateImg; + id: delegateImg + visible: source != "" + width: visible ? 20 : 0 sourceSize.width: 20 - width: 20 - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.verticalCenter: parent.verticalCenter - fillMode: Image.PreserveAspectFit source: modelData.img ? modelData.img : "" + fillMode: Image.PreserveAspectFit + anchors.left: parent.left + anchors.leftMargin: visible ? 10 : 0 + anchors.verticalCenter: parent.verticalCenter } Text { - text: modelData.text ? modelData.text : modelData ? modelData : "" - anchors.leftMargin: 10 - anchors.rightMargin: 10 + text: modelData.text + ? modelData.text + : modelData + ? modelData + : "" elide: Text.ElideRight anchors.verticalCenter: parent.verticalCenter anchors.left: delegateImg.right + anchors.leftMargin: delegateImg.visible ? 5 : 10 anchors.right: parent.right + anchors.rightMargin: 20 } MouseArea { - anchors.fill: parent; + anchors.fill: parent hoverEnabled: true Rectangle { anchors.fill: parent @@ -120,43 +141,29 @@ ColumnLayout { } onPressed: { combobox.state = "" - chosenItemText.text = modelData.text ? modelData.text : modelData ? modelData : "" - chosenItemImg.source = modelData.img ? modelData.img : "" - listView.currentIndex = index + selectedItemText.text = modelData.text + ? modelData.text + : modelData + ? modelData + : "" + selectedItemImg.source = modelData.img ? modelData.img : "" + combobox.currentIndex = index listPopup.close() } } } - ScrollIndicator.vertical: ScrollIndicator { } + Control.ScrollIndicator.vertical: Control.ScrollIndicator { } } onOpened: { listView.positionViewAtIndex(listView.currentIndex, ListView.Center) } - Component { - id: highlight - Rectangle { - width: listView.width - height: listView.height - color: DefaultStyle.comboBoxHighlightColor - radius: 15 - y: listView.currentItem? listView.currentItem.y : 0 - } - } - - background: Loader { - sourceComponent: backgroundRectangle - } - } - Component { - id: backgroundRectangle - Rectangle { - implicitWidth: cellLayout.backgroundWidth + background: Rectangle { + implicitWidth: mainItem.backgroundWidth implicitHeight: 30 radius: 15 - color: DefaultStyle.formItemBackgroundColor } } } diff --git a/Linphone/view/Item/DigitInput.qml b/Linphone/view/Item/DigitInput.qml index 814aa21d5..8860d5057 100644 --- a/Linphone/view/Item/DigitInput.qml +++ b/Linphone/view/Item/DigitInput.qml @@ -3,7 +3,7 @@ import QtQuick.Controls 2.2 as Control import Linphone Control.TextField { - id: numberInput + id: mainItem property int inputSize: 50 color: activeFocus ? DefaultStyle.digitInputFocusedColor : DefaultStyle.digitInputColor rightPadding: inputSize / 4 @@ -20,20 +20,20 @@ Control.TextField { background: Rectangle { // id: background - border.color: numberInput.activeFocus ? DefaultStyle.digitInputFocusedColor : DefaultStyle.digitInputColor - radius: numberInput.inputSize / 8 + border.color: mainItem.activeFocus ? DefaultStyle.digitInputFocusedColor : DefaultStyle.digitInputColor + radius: mainItem.inputSize / 8 } // cursorDelegate: Rectangle { - // visible: numberInput.activeFocus - // // width: numberInput.cursorRectangle.width - // // height: numberInput.cursorRectangle.height - inputSize/5 + // visible: mainItem.activeFocus + // // width: mainItem.cursorRectangle.width + // // height: mainItem.cursorRectangle.height - inputSize/5 // x: background.x // y: background.height - inputSize/8 // transform: Rotation {angle: -90} // // anchors.bottom: parent.bottom // // anchors.left: parent.left // // anchors.bottomMargin: inputSize/8 - // // transform: [/*Translate {x: numberInput.cursorRectangle.height},*/ Rotation {angle: -90}] - // color: numberInput.activeFocus ? DefaultStyle.digitInputFocusedColor : DefaultStyle.digitInputColor + // // transform: [/*Translate {x: mainItem.cursorRectangle.height},*/ Rotation {angle: -90}] + // color: mainItem.activeFocus ? DefaultStyle.digitInputFocusedColor : DefaultStyle.digitInputColor // } } diff --git a/Linphone/view/Item/PhoneNumberComboBox.qml b/Linphone/view/Item/PhoneNumberComboBox.qml index ffb53b653..ac1cf883d 100644 --- a/Linphone/view/Item/PhoneNumberComboBox.qml +++ b/Linphone/view/Item/PhoneNumberComboBox.qml @@ -4,16 +4,16 @@ import QtQuick.Layouts 1.0 import Linphone ColumnLayout { - id: cellLayout + id: mainItem property string label: "" property int backgroundWidth: 100 readonly property string currentText: combobox.model.getAt(combobox.currentIndex) ? combobox.model.getAt(combobox.currentIndex).countryCallingCode : "" - property alias defaultCallingCode: phoneNumberModel.defaultCountryCallingCode + property string defaultCallingCode: "" Text { visible: label.length > 0 verticalAlignment: Text.AlignVCenter - text: cellLayout.label + text: mainItem.label color: DefaultStyle.formItemLabelColor font { pointSize: DefaultStyle.formItemLabelSize @@ -26,40 +26,36 @@ ColumnLayout { model: PhoneNumberProxy { id: phoneNumberModel onCountChanged: { - var defaultIndex = findIndexByCountryCallingCode(defaultCallingCode) - combobox.currentIndex = defaultIndex < 0 ? 0 : defaultIndex + combobox.currentIndex = Math.max(0, findIndexByCountryCallingCode(defaultCallingCode)) } } - background: Loader { - sourceComponent: backgroundRectangle + background: Rectangle { + implicitWidth: mainItem.backgroundWidth + implicitHeight: 30 + radius: 15 + color: DefaultStyle.formItemBackgroundColor } contentItem: Item { anchors.fill: parent - anchors.leftMargin: 5 + readonly property var currentItem: combobox.model.getAt(combobox.currentIndex) + anchors.leftMargin: 15 Text { - id: chosenItemFlag - text: combobox.model.getAt(combobox.currentIndex) ? combobox.model.getAt(combobox.currentIndex).flag : "" - font.family: 'Noto Color Emoji' - anchors.leftMargin: 5 + visible: text.length > 0 + id: selectedItemFlag + text: parent.currentItem ? parent.currentItem.flag : "" + font.family: DefaultStyle.emojiFont + anchors.rightMargin: 5 anchors.verticalCenter: parent.verticalCenter } Text { - id: chosenItemCountry leftPadding: 5 - text: combobox.model.getAt(combobox.currentIndex) ? "+" + combobox.model.getAt(combobox.currentIndex).countryCallingCode : "" - font.family: DefaultStyle.defaultFont - font.pointSize: DefaultStyle.formItemLabelSize + text: parent.currentItem ? "+" + parent.currentItem.countryCallingCode : "" color: DefaultStyle.formItemLabelColor anchors.right: parent.right - anchors.left: chosenItemFlag.right + anchors.left: selectedItemFlag.right anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 5 elide: Text.ElideRight } - Item { - Layout.fillWidth: true - } - } indicator: Image { @@ -84,24 +80,37 @@ ColumnLayout { model: PhoneNumberProxy{} currentIndex: combobox.highlightedIndex >= 0 ? combobox.highlightedIndex : 0 highlightFollowsCurrentItem: true - highlight: highlight + highlight: Rectangle { + width: listView.width + height: listView.height + color: DefaultStyle.comboBoxHighlightColor + radius: 15 + y: listView.currentItem? listView.currentItem.y : 0 + } delegate: Item { width:combobox.width; height: combobox.height; - anchors.leftMargin: 5 + Text { id: delegateImg; + visible: text.length > 0 text: $modelData.flag - font.family: 'Noto Color Emoji' - anchors.leftMargin: 5 + font.family: DefaultStyle.emojiFont + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 15 + anchors.rightMargin: 5 } Text { text: "+" + $modelData.countryCallingCode - anchors.top: parent.top + elide: Text.ElideRight + leftPadding: 5 anchors.left: delegateImg.right - anchors.leftMargin: 5 + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + color: DefaultStyle.formItemLabelColor } MouseArea { @@ -127,28 +136,11 @@ ColumnLayout { listView.positionViewAtIndex(listView.currentIndex, ListView.Center) } - Component { - id: highlight - Rectangle { - width: listView.width - height: listView.height - color: DefaultStyle.comboBoxHighlightColor - radius: 15 - y: listView.currentItem? listView.currentItem.y : 0 - } - } - - background: Loader { - sourceComponent: backgroundRectangle - } - } - Component { - id: backgroundRectangle - Rectangle { - implicitWidth: cellLayout.backgroundWidth + background: Rectangle { + implicitWidth: mainItem.backgroundWidth implicitHeight: 30 radius: 15 - color: DefaultStyle.formItemBackgroundColor + // color: DefaultStyle.formItemBackgroundColor } } } diff --git a/Linphone/view/Item/PhoneNumberInput.qml b/Linphone/view/Item/PhoneNumberInput.qml index c320e231c..d4b04adfa 100644 --- a/Linphone/view/Item/PhoneNumberInput.qml +++ b/Linphone/view/Item/PhoneNumberInput.qml @@ -4,7 +4,7 @@ import QtQuick.Layouts 1.0 import Linphone ColumnLayout { - id: cellLayout + id: mainItem property string label: "" property string defaultText : "" @@ -16,7 +16,7 @@ ColumnLayout { Text { visible: label.length > 0 verticalAlignment: Text.AlignVCenter - text: cellLayout.label + (cellLayout.mandatory ? "*" : "") + text: mainItem.label + (mainItem.mandatory ? "*" : "") color: DefaultStyle.formItemLabelColor font { pointSize: DefaultStyle.formItemLabelSize @@ -25,7 +25,7 @@ ColumnLayout { } Rectangle { - implicitWidth: cellLayout.textInputWidth + implicitWidth: mainItem.textInputWidth implicitHeight: 30 radius: 20 color: DefaultStyle.formItemBackgroundColor @@ -36,8 +36,7 @@ ColumnLayout { backgroundWidth: 100 } Rectangle { - - width: 1 + Layout.preferredWidth: 1 Layout.fillHeight: true Layout.topMargin: 5 Layout.bottomMargin: 5 @@ -46,7 +45,7 @@ ColumnLayout { TextInput { id: textField Layout.fillWidth: true - defaultText: cellLayout.defaultText + defaultText: mainItem.defaultText inputMethodHints: Qt.ImhDigitsOnly fillWidth: true validator: IntValidator{} diff --git a/Linphone/view/Item/TabBar.qml b/Linphone/view/Item/TabBar.qml index 31dd3a5ac..07810040a 100644 --- a/Linphone/view/Item/TabBar.qml +++ b/Linphone/view/Item/TabBar.qml @@ -4,13 +4,13 @@ import QtQuick.Controls 2.2 as Control import Linphone Control.TabBar { - id: bar + id: mainItem + property var model + readonly property int originX: count > 0 + ? itemAt(0).x + : 0 spacing: 40 - function appendTab(label) { - var newTab = tab.createObject(bar, {title: label, index: bar.count}) - } - background: Item { anchors.fill: parent @@ -26,18 +26,20 @@ Control.TabBar { height: 4 color: DefaultStyle.orangeColor anchors.bottom: parent.bottom - x: bar.currentItem ? bar.currentItem.x : 0 - width: bar.currentItem ? bar.currentItem.width : 0 + x: mainItem.currentItem + ? mainItem.currentItem.x - mainItem.originX + : 0 + width: mainItem.currentItem ? mainItem.currentItem.width : 0 clip: true Behavior on x { NumberAnimation {duration: 100}} + Behavior on width {NumberAnimation {duration: 100}} } } - Component { - id: tab + Repeater { + model: mainItem.model Control.TabButton { - property string title - property int index + required property string modelData width: txtMeter. advanceWidth background: Item { @@ -57,7 +59,7 @@ Control.TabBar { TextMetrics { id: txtMeter font: tabText.font - text: title + text: modelData } } } diff --git a/Linphone/view/Item/TextInput.qml b/Linphone/view/Item/TextInput.qml index 4550a8695..a547bc00e 100644 --- a/Linphone/view/Item/TextInput.qml +++ b/Linphone/view/Item/TextInput.qml @@ -4,7 +4,7 @@ import QtQuick.Layouts 1.0 import Linphone ColumnLayout { - id: cellLayout + id: mainItem property string label: "" property string defaultText : "" @@ -19,7 +19,7 @@ ColumnLayout { Text { visible: label.length > 0 verticalAlignment: Text.AlignVCenter - text: cellLayout.label + (cellLayout.mandatory ? "*" : "") + text: mainItem.label + (mainItem.mandatory ? "*" : "") color: DefaultStyle.formItemLabelColor font { pointSize: DefaultStyle.formItemLabelSize @@ -29,10 +29,10 @@ ColumnLayout { Rectangle { Component.onCompleted: { - if (cellLayout.fillWidth) + if (mainItem.fillWidth) Layout.fillWidth = true } - implicitWidth: cellLayout.textInputWidth + implicitWidth: mainItem.textInputWidth implicitHeight: 30 radius: 20 color: DefaultStyle.formItemBackgroundColor @@ -42,14 +42,14 @@ ColumnLayout { anchors.left: parent.left anchors.right: eyeButton.visible ? eyeButton.left : parent.right anchors.verticalCenter: parent.verticalCenter - placeholderText: cellLayout.defaultText - echoMode: (cellLayout.hidden && !eyeButton.checked) ? TextInput.Password : TextInput.Normal + placeholderText: mainItem.defaultText + echoMode: (mainItem.hidden && !eyeButton.checked) ? TextInput.Password : TextInput.Normal font.family: DefaultStyle.defaultFont font.pointSize: DefaultStyle.formTextInputSize color: DefaultStyle.formItemLabelColor - inputMethodHints: cellLayout.inputMethodHints + inputMethodHints: mainItem.inputMethodHints selectByMouse: true - validator: cellLayout.validator + validator: mainItem.validator // MouseArea { // anchors.fill: parent // // acceptedButtons: Qt.NoButton @@ -60,7 +60,7 @@ ColumnLayout { } Button { id: eyeButton - visible: cellLayout.hidden + visible: mainItem.hidden checkable: true background: Rectangle { color: "transparent" diff --git a/Linphone/view/Page/Login/LoginItem.qml b/Linphone/view/Page/Login/LoginItem.qml index 33343b34a..9ff564197 100644 --- a/Linphone/view/Page/Login/LoginItem.qml +++ b/Linphone/view/Page/Login/LoginItem.qml @@ -44,7 +44,8 @@ RowLayout { text: "Use SIP Account" onClicked: { console.debug("[LoginItem] User: click use Sip") - root.useSIP()} + root.useSIP() + } } } Item { diff --git a/Linphone/view/Page/Login/RegisterCheckingPage.qml b/Linphone/view/Page/Login/RegisterCheckingPage.qml index 731437d60..46de76a83 100644 --- a/Linphone/view/Page/Login/RegisterCheckingPage.qml +++ b/Linphone/view/Page/Login/RegisterCheckingPage.qml @@ -4,7 +4,6 @@ import QtQuick.Controls as Control import Linphone LoginLayout { - id: mainItem signal returnToRegister() property string phoneNumber @@ -12,13 +11,14 @@ LoginLayout { titleContent: RowLayout { Control.Button { + Layout.preferredHeight: 40 + Layout.preferredWidth: 40 + icon.width: 40 + icon.height: 40 + icon.source: AppIcons.returnArrow background: Rectangle { color: "transparent" } - contentItem: Image { - source: AppIcons.returnArrow - fillMode: Image.PreserveAspectFit - } onClicked: { console.debug("[RegisterCheckingPage] User: return to register") mainItem.returnToRegister() @@ -58,30 +58,23 @@ LoginLayout { Layout.margins: 10 ColumnLayout { RowLayout { - // Layout.fillWidth: true - DigitInput { - id: first - onTextEdited: if (text.length > 0 ) second.forceActiveFocus() - Layout.margins: 10 - } - DigitInput { - id: second - onTextEdited: if (text.length > 0 ) third.forceActiveFocus() - Layout.margins: 10 - } - DigitInput { - id: third - onTextEdited: if (text.length > 0 ) fourth.forceActiveFocus() - Layout.margins: 10 - } - DigitInput { - id: fourth - Layout.margins: 10 - // onTextEdited: validate() + Repeater { + model: 4 + DigitInput { + required property int index + onTextEdited: if (text.length > 0 ) { + console.log("next", nextItemInFocusChain(true)) + if (index < 3) + nextItemInFocusChain(true).forceActiveFocus() + else { + // validate() + } + } + Layout.margins: 10 + } } } RowLayout { - // Layout.topMargin: 10 Text { Layout.rightMargin: 15 text: "Didn't receive the code ?" diff --git a/Linphone/view/Page/Login/RegisterPage.qml b/Linphone/view/Page/Login/RegisterPage.qml index 068b56832..7709b79bd 100644 --- a/Linphone/view/Page/Login/RegisterPage.qml +++ b/Linphone/view/Page/Login/RegisterPage.qml @@ -4,8 +4,7 @@ import QtQuick.Controls as Control import Linphone LoginLayout { - - id: registerPage + id: mainItem signal returnToLogin() signal registerCalled() readonly property string countryCode: phoneNumberInput.countryCode @@ -37,7 +36,8 @@ LoginLayout { text: "Log in" onClicked: { console.debug("[LoginItem] User: return") - returnToLogin()} + returnToLogin() + } } } @@ -45,11 +45,7 @@ LoginLayout { TabBar { Layout.fillWidth: true id: bar - Component.onCompleted: { - appendTab(qsTr("Register with phone number")) - appendTab(qsTr("Register with email")) - - } + model: [qsTr("Register with phone number"), qsTr("Register with email")] } StackLayout { currentIndex: bar.currentIndex @@ -107,8 +103,8 @@ LoginLayout { text: "Register" onClicked:{ console.log("[RegisterPage] User: Call register") - registerPage.registerCalled() - } + mainItem.registerCalled() + } } } Item { @@ -176,7 +172,7 @@ LoginLayout { text: "Register" onClicked:{ console.log("[RegisterPage] User: Call register") - registerPage.registerCalled() + mainItem.registerCalled() } } } diff --git a/Linphone/view/Page/Login/SIPLoginPage.qml b/Linphone/view/Page/Login/SIPLoginPage.qml index b406e87bd..80117dc5c 100644 --- a/Linphone/view/Page/Login/SIPLoginPage.qml +++ b/Linphone/view/Page/Login/SIPLoginPage.qml @@ -5,23 +5,22 @@ import Linphone import ConstantsCpp 1.0 LoginLayout { - - id: sipLoginPage + id: mainItem signal returnToLogin() signal goToRegister() - titleContent: RowLayout { Control.Button { + Layout.preferredHeight: 40 + Layout.preferredWidth: 40 + icon.width: 40 + icon.height: 40 + icon.source: AppIcons.returnArrow background: Rectangle { color: "transparent" } - contentItem: Image { - source: AppIcons.returnArrow - fillMode: Image.PreserveAspectFit - } onClicked: { console.debug("[LoginItem] User: return") - sipLoginPage.returnToLogin() + mainItem.returnToLogin() } } Image { @@ -48,7 +47,7 @@ LoginLayout { text: "Register" onClicked: { console.debug("[SIPLoginPage] User: go to register page") - sipLoginPage.goToRegister() + mainItem.goToRegister() } } } @@ -99,7 +98,7 @@ LoginLayout { inversedColors: true onClicked: { console.debug("[LoginItem] User: click register") - sipLoginPage.goToRegister() + mainItem.goToRegister() } } @@ -156,7 +155,7 @@ LoginLayout { text: 'Log in' onClicked: { - console.debug("[LoginItem] User: Log in") + console.debug("[SIPLoginPage] User: Log in") LoginPageCpp.login(username.inputText, password.inputText); } } diff --git a/Linphone/view/Page/Login/WelcomePage.qml b/Linphone/view/Page/Login/WelcomePage.qml index 9e642c38d..43a46f871 100644 --- a/Linphone/view/Page/Login/WelcomePage.qml +++ b/Linphone/view/Page/Login/WelcomePage.qml @@ -5,7 +5,7 @@ import QtQuick.Controls 2.2 as Control import Linphone LoginLayout { - id: welcomePage + id: mainItem signal startButtonPressed() titleContent: RowLayout { @@ -47,7 +47,7 @@ LoginLayout { } onClicked: { console.debug("[LoginItem] User: Click skip") - welcomePage.startButtonPressed() + mainItem.startButtonPressed() } } } @@ -135,7 +135,7 @@ LoginLayout { text: carousel.currentIndex < (carousel.itemsList.length - 1) ? "Next" : "Start" onClicked: { if (carousel.currentIndex < 2) carousel.goToSlide(carousel.currentIndex + 1); - else welcomePage.startButtonPressed(); + else mainItem.startButtonPressed(); } } Item { diff --git a/Linphone/view/Prototype/PhoneNumberPrototype.qml b/Linphone/view/Prototype/PhoneNumberPrototype.qml index ff5d24ca6..0076e3ebd 100644 --- a/Linphone/view/Prototype/PhoneNumberPrototype.qml +++ b/Linphone/view/Prototype/PhoneNumberPrototype.qml @@ -14,7 +14,7 @@ ListView{ anchors.fill: parent Text{ text: $modelData.flag - font.family: 'Noto Color Emoji' + font.family: DefaultStyle.emojiFont } Text{ text: $modelData.country diff --git a/Linphone/view/Style/DefaultStyle.qml b/Linphone/view/Style/DefaultStyle.qml index 93fce5687..e93322303 100644 --- a/Linphone/view/Style/DefaultStyle.qml +++ b/Linphone/view/Style/DefaultStyle.qml @@ -4,6 +4,7 @@ import QtQuick 2.15 QtObject { property string defaultFont: "Noto Sans" + property string emojiFont: "Noto Color Emoji" property color orangeColor: "#FE5E00" property color buttonBackground: "#FE5E00" property color buttonInversedBackground: "white"