resolve mr threads

This commit is contained in:
Gaelle Braud 2023-10-27 18:01:47 +02:00
parent 7764044ca8
commit 440b3991f1
17 changed files with 194 additions and 223 deletions

View file

@ -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) { int PhoneNumberProxy::findIndexByCountryCallingCode(const QString &countryCallingCode) {
auto model = qobject_cast<PhoneNumberList *>(sourceModel()); auto model = qobject_cast<PhoneNumberList *>(sourceModel());
if (!model) return -1; if (!model) return -1;
@ -62,8 +50,6 @@ int PhoneNumberProxy::findIndexByCountryCallingCode(const QString &countryCallin
}); });
auto proxyModelIndex = mapFromSource(model->index(it - list.begin())); auto proxyModelIndex = mapFromSource(model->index(it - list.begin()));
return proxyModelIndex.row(); return proxyModelIndex.row();
return -1;
} }
bool PhoneNumberProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { bool PhoneNumberProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {

View file

@ -29,28 +29,23 @@ class PhoneNumberProxy : public SortFilterProxy {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString filterText READ getFilterText WRITE setFilterText NOTIFY filterTextChanged) Q_PROPERTY(QString filterText READ getFilterText WRITE setFilterText NOTIFY filterTextChanged)
Q_PROPERTY(QString defaultCountryCallingCode READ getDefaultCountryCallingCode NOTIFY defaultCountryCallingCodeChanged)
public: public:
PhoneNumberProxy(QObject *parent = Q_NULLPTR); PhoneNumberProxy(QObject *parent = Q_NULLPTR);
QString getFilterText() const; QString getFilterText() const;
void setFilterText(const QString &filter); void setFilterText(const QString &filter);
QString getDefaultCountryCallingCode() const;
void setDefaultCountryCallingCode(const QString &filter);
Q_INVOKABLE int findIndexByCountryCallingCode(const QString& countryCallingCode); Q_INVOKABLE int findIndexByCountryCallingCode(const QString& countryCallingCode);
signals: signals:
void filterTextChanged(); void filterTextChanged();
void defaultCountryCallingCodeChanged();
protected: protected:
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
QString mFilterText; QString mFilterText;
QString mDefaultCountryCallingCode;
}; };
#endif #endif

View file

@ -32,11 +32,11 @@ Item {
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: AppIcons.info source: AppIcons.info
} }
onClicked: console.debug("[LoginLayout] open about popup") onClicked: console.debug("[LoginLayout]User: open about popup")
} }
Text { Text {
Layout.alignment: Qt.AlignRight |Qt.AlignVCenter Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
text: "About" text: "About"
font.pixelSize: 12 font.pixelSize: 12
color: DefaultStyle.grayColor color: DefaultStyle.grayColor

View file

@ -3,7 +3,7 @@ import QtQuick.Controls 2.2 as Control
import Linphone import Linphone
Control.CheckBox { Control.CheckBox {
id: checkbox id: mainItem
indicator: Rectangle { indicator: Rectangle {
implicitWidth: 18 implicitWidth: 18
@ -20,7 +20,7 @@ Control.CheckBox {
text: "\u2714" text: "\u2714"
font.pointSize: 18 font.pointSize: 18
color: DefaultStyle.checkboxBorderColor color: DefaultStyle.checkboxBorderColor
visible: checkbox.checked visible: mainItem.checked
} }
} }
} }

View file

@ -1,20 +1,20 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls as Control
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import Linphone import Linphone
ColumnLayout { ColumnLayout {
id: cellLayout id: mainItem
property string label: "" property string label: ""
property int backgroundWidth: 200 property int backgroundWidth: 200
// Usage : each item of the model list must be {text: ..., img: ...} // Usage : each item of the model list must be {text: ..., img: ...}
property var modelList: [] property var modelList: []
readonly property string currentText: chosenItemText.text readonly property string currentText: selectedItemText.text
Text { Text {
visible: label.length > 0 visible: label.length > 0
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
text: cellLayout.label text: mainItem.label
color: DefaultStyle.formItemLabelColor color: DefaultStyle.formItemLabelColor
font { font {
pointSize: DefaultStyle.formItemLabelSize pointSize: DefaultStyle.formItemLabelSize
@ -22,53 +22,61 @@ ColumnLayout {
} }
} }
ComboBox { Control.ComboBox {
id: combobox id: combobox
model: cellLayout.modelList model: mainItem.modelList
width: cellLayout.backgroundWidth width: mainItem.backgroundWidth
background: Loader { background: Rectangle {
sourceComponent: backgroundRectangle implicitWidth: mainItem.backgroundWidth
implicitHeight: 30
radius: 15
color: DefaultStyle.formItemBackgroundColor
} }
contentItem: Item { contentItem: Item {
anchors.left: parent.left anchors.left: parent.left
anchors.right: indic.right anchors.right: indicImage.right
anchors.leftMargin: 10
Image { Image {
id: chosenItemImg id: selectedItemImg
visible: source != ""
sourceSize.width: 20 sourceSize.width: 20
width: 20 width: visible ? 20 : 0
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: visible ? 10 : 0
} }
Text { Text {
id: chosenItemText id: selectedItemText
anchors.left: chosenItemImg.right
anchors.leftMargin: 10
anchors.rightMargin: 20
anchors.right: parent.right
elide: Text.ElideRight elide: Text.ElideRight
anchors.left: selectedItemImg.right
anchors.leftMargin: selectedItemImg.visible ? 15 : 10
anchors.right: parent.right
anchors.rightMargin: 20
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
Component.onCompleted: { Component.onCompleted: {
if (cellLayout.modelList[combobox.currentIndex].img) var index = combobox.currentIndex < 0 ? 0 : combobox.currentIndex
chosenItemImg.source = cellLayout.modelList[combobox.currentIndex].img if (mainItem.modelList[index].img) {
if (cellLayout.modelList[combobox.currentIndex].text) selectedItemImg.source = mainItem.modelList[0].img
chosenItemText.text = cellLayout.modelList[combobox.currentIndex].text }
if (mainItem.modelList[index].text)
selectedItemText.text = mainItem.modelList[0].text
else if (mainItem.modelList[index])
selectedItemText.text = mainItem.modelList[0]
} }
} }
indicator: Image { indicator: Image {
id: indic id: indicImage
x: combobox.width - width - combobox.rightPadding anchors.right: parent.right
y: combobox.topPadding + (combobox.availableHeight - height) / 2 anchors.rightMargin: 10
anchors.verticalCenter: parent.verticalCenter
source: AppIcons.downArrow source: AppIcons.downArrow
} }
popup: Popup { popup: Control.Popup {
id: listPopup id: listPopup
y: combobox.height - 1 y: combobox.height - 1
width: combobox.width width: combobox.width
@ -82,34 +90,47 @@ ColumnLayout {
model: combobox.model model: combobox.model
currentIndex: combobox.highlightedIndex >= 0 ? combobox.highlightedIndex : 0 currentIndex: combobox.highlightedIndex >= 0 ? combobox.highlightedIndex : 0
highlightFollowsCurrentItem: true highlightFollowsCurrentItem: true
highlight: highlight highlight: Rectangle {
width: listView.width
color: DefaultStyle.comboBoxHighlightColor
radius: 15
y: listView.currentItem? listView.currentItem.y : 0
}
delegate: Item { delegate: Item {
width:combobox.width; width:combobox.width
height: combobox.height; height: combobox.height
anchors.left: parent.left
anchors.right: parent.right
Image { Image {
id: delegateImg; id: delegateImg
visible: source != ""
width: visible ? 20 : 0
sourceSize.width: 20 sourceSize.width: 20
width: 20
anchors.left: parent.left
anchors.leftMargin: 10
anchors.verticalCenter: parent.verticalCenter
fillMode: Image.PreserveAspectFit
source: modelData.img ? modelData.img : "" source: modelData.img ? modelData.img : ""
fillMode: Image.PreserveAspectFit
anchors.left: parent.left
anchors.leftMargin: visible ? 10 : 0
anchors.verticalCenter: parent.verticalCenter
} }
Text { Text {
text: modelData.text ? modelData.text : modelData ? modelData : "" text: modelData.text
anchors.leftMargin: 10 ? modelData.text
anchors.rightMargin: 10 : modelData
? modelData
: ""
elide: Text.ElideRight elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: delegateImg.right anchors.left: delegateImg.right
anchors.leftMargin: delegateImg.visible ? 5 : 10
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 20
} }
MouseArea { MouseArea {
anchors.fill: parent; anchors.fill: parent
hoverEnabled: true hoverEnabled: true
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
@ -120,43 +141,29 @@ ColumnLayout {
} }
onPressed: { onPressed: {
combobox.state = "" combobox.state = ""
chosenItemText.text = modelData.text ? modelData.text : modelData ? modelData : "" selectedItemText.text = modelData.text
chosenItemImg.source = modelData.img ? modelData.img : "" ? modelData.text
listView.currentIndex = index : modelData
? modelData
: ""
selectedItemImg.source = modelData.img ? modelData.img : ""
combobox.currentIndex = index
listPopup.close() listPopup.close()
} }
} }
} }
ScrollIndicator.vertical: ScrollIndicator { } Control.ScrollIndicator.vertical: Control.ScrollIndicator { }
} }
onOpened: { onOpened: {
listView.positionViewAtIndex(listView.currentIndex, ListView.Center) listView.positionViewAtIndex(listView.currentIndex, ListView.Center)
} }
Component { background: Rectangle {
id: highlight implicitWidth: mainItem.backgroundWidth
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
implicitHeight: 30 implicitHeight: 30
radius: 15 radius: 15
color: DefaultStyle.formItemBackgroundColor
} }
} }
} }

View file

@ -3,7 +3,7 @@ import QtQuick.Controls 2.2 as Control
import Linphone import Linphone
Control.TextField { Control.TextField {
id: numberInput id: mainItem
property int inputSize: 50 property int inputSize: 50
color: activeFocus ? DefaultStyle.digitInputFocusedColor : DefaultStyle.digitInputColor color: activeFocus ? DefaultStyle.digitInputFocusedColor : DefaultStyle.digitInputColor
rightPadding: inputSize / 4 rightPadding: inputSize / 4
@ -20,20 +20,20 @@ Control.TextField {
background: Rectangle { background: Rectangle {
// id: background // id: background
border.color: numberInput.activeFocus ? DefaultStyle.digitInputFocusedColor : DefaultStyle.digitInputColor border.color: mainItem.activeFocus ? DefaultStyle.digitInputFocusedColor : DefaultStyle.digitInputColor
radius: numberInput.inputSize / 8 radius: mainItem.inputSize / 8
} }
// cursorDelegate: Rectangle { // cursorDelegate: Rectangle {
// visible: numberInput.activeFocus // visible: mainItem.activeFocus
// // width: numberInput.cursorRectangle.width // // width: mainItem.cursorRectangle.width
// // height: numberInput.cursorRectangle.height - inputSize/5 // // height: mainItem.cursorRectangle.height - inputSize/5
// x: background.x // x: background.x
// y: background.height - inputSize/8 // y: background.height - inputSize/8
// transform: Rotation {angle: -90} // transform: Rotation {angle: -90}
// // anchors.bottom: parent.bottom // // anchors.bottom: parent.bottom
// // anchors.left: parent.left // // anchors.left: parent.left
// // anchors.bottomMargin: inputSize/8 // // anchors.bottomMargin: inputSize/8
// // transform: [/*Translate {x: numberInput.cursorRectangle.height},*/ Rotation {angle: -90}] // // transform: [/*Translate {x: mainItem.cursorRectangle.height},*/ Rotation {angle: -90}]
// color: numberInput.activeFocus ? DefaultStyle.digitInputFocusedColor : DefaultStyle.digitInputColor // color: mainItem.activeFocus ? DefaultStyle.digitInputFocusedColor : DefaultStyle.digitInputColor
// } // }
} }

View file

@ -4,16 +4,16 @@ import QtQuick.Layouts 1.0
import Linphone import Linphone
ColumnLayout { ColumnLayout {
id: cellLayout id: mainItem
property string label: "" property string label: ""
property int backgroundWidth: 100 property int backgroundWidth: 100
readonly property string currentText: combobox.model.getAt(combobox.currentIndex) ? combobox.model.getAt(combobox.currentIndex).countryCallingCode : "" readonly property string currentText: combobox.model.getAt(combobox.currentIndex) ? combobox.model.getAt(combobox.currentIndex).countryCallingCode : ""
property alias defaultCallingCode: phoneNumberModel.defaultCountryCallingCode property string defaultCallingCode: ""
Text { Text {
visible: label.length > 0 visible: label.length > 0
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
text: cellLayout.label text: mainItem.label
color: DefaultStyle.formItemLabelColor color: DefaultStyle.formItemLabelColor
font { font {
pointSize: DefaultStyle.formItemLabelSize pointSize: DefaultStyle.formItemLabelSize
@ -26,40 +26,36 @@ ColumnLayout {
model: PhoneNumberProxy { model: PhoneNumberProxy {
id: phoneNumberModel id: phoneNumberModel
onCountChanged: { onCountChanged: {
var defaultIndex = findIndexByCountryCallingCode(defaultCallingCode) combobox.currentIndex = Math.max(0, findIndexByCountryCallingCode(defaultCallingCode))
combobox.currentIndex = defaultIndex < 0 ? 0 : defaultIndex
} }
} }
background: Loader { background: Rectangle {
sourceComponent: backgroundRectangle implicitWidth: mainItem.backgroundWidth
implicitHeight: 30
radius: 15
color: DefaultStyle.formItemBackgroundColor
} }
contentItem: Item { contentItem: Item {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: 5 readonly property var currentItem: combobox.model.getAt(combobox.currentIndex)
anchors.leftMargin: 15
Text { Text {
id: chosenItemFlag visible: text.length > 0
text: combobox.model.getAt(combobox.currentIndex) ? combobox.model.getAt(combobox.currentIndex).flag : "" id: selectedItemFlag
font.family: 'Noto Color Emoji' text: parent.currentItem ? parent.currentItem.flag : ""
anchors.leftMargin: 5 font.family: DefaultStyle.emojiFont
anchors.rightMargin: 5
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
Text { Text {
id: chosenItemCountry
leftPadding: 5 leftPadding: 5
text: combobox.model.getAt(combobox.currentIndex) ? "+" + combobox.model.getAt(combobox.currentIndex).countryCallingCode : "" text: parent.currentItem ? "+" + parent.currentItem.countryCallingCode : ""
font.family: DefaultStyle.defaultFont
font.pointSize: DefaultStyle.formItemLabelSize
color: DefaultStyle.formItemLabelColor color: DefaultStyle.formItemLabelColor
anchors.right: parent.right anchors.right: parent.right
anchors.left: chosenItemFlag.right anchors.left: selectedItemFlag.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 5
elide: Text.ElideRight elide: Text.ElideRight
} }
Item {
Layout.fillWidth: true
}
} }
indicator: Image { indicator: Image {
@ -84,24 +80,37 @@ ColumnLayout {
model: PhoneNumberProxy{} model: PhoneNumberProxy{}
currentIndex: combobox.highlightedIndex >= 0 ? combobox.highlightedIndex : 0 currentIndex: combobox.highlightedIndex >= 0 ? combobox.highlightedIndex : 0
highlightFollowsCurrentItem: true 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 { delegate: Item {
width:combobox.width; width:combobox.width;
height: combobox.height; height: combobox.height;
anchors.leftMargin: 5
Text { Text {
id: delegateImg; id: delegateImg;
visible: text.length > 0
text: $modelData.flag text: $modelData.flag
font.family: 'Noto Color Emoji' font.family: DefaultStyle.emojiFont
anchors.leftMargin: 5 anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 15
anchors.rightMargin: 5
} }
Text { Text {
text: "+" + $modelData.countryCallingCode text: "+" + $modelData.countryCallingCode
anchors.top: parent.top elide: Text.ElideRight
leftPadding: 5
anchors.left: delegateImg.right anchors.left: delegateImg.right
anchors.leftMargin: 5 anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
color: DefaultStyle.formItemLabelColor
} }
MouseArea { MouseArea {
@ -127,28 +136,11 @@ ColumnLayout {
listView.positionViewAtIndex(listView.currentIndex, ListView.Center) listView.positionViewAtIndex(listView.currentIndex, ListView.Center)
} }
Component { background: Rectangle {
id: highlight implicitWidth: mainItem.backgroundWidth
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
implicitHeight: 30 implicitHeight: 30
radius: 15 radius: 15
color: DefaultStyle.formItemBackgroundColor // color: DefaultStyle.formItemBackgroundColor
} }
} }
} }

View file

@ -4,7 +4,7 @@ import QtQuick.Layouts 1.0
import Linphone import Linphone
ColumnLayout { ColumnLayout {
id: cellLayout id: mainItem
property string label: "" property string label: ""
property string defaultText : "" property string defaultText : ""
@ -16,7 +16,7 @@ ColumnLayout {
Text { Text {
visible: label.length > 0 visible: label.length > 0
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
text: cellLayout.label + (cellLayout.mandatory ? "*" : "") text: mainItem.label + (mainItem.mandatory ? "*" : "")
color: DefaultStyle.formItemLabelColor color: DefaultStyle.formItemLabelColor
font { font {
pointSize: DefaultStyle.formItemLabelSize pointSize: DefaultStyle.formItemLabelSize
@ -25,7 +25,7 @@ ColumnLayout {
} }
Rectangle { Rectangle {
implicitWidth: cellLayout.textInputWidth implicitWidth: mainItem.textInputWidth
implicitHeight: 30 implicitHeight: 30
radius: 20 radius: 20
color: DefaultStyle.formItemBackgroundColor color: DefaultStyle.formItemBackgroundColor
@ -36,8 +36,7 @@ ColumnLayout {
backgroundWidth: 100 backgroundWidth: 100
} }
Rectangle { Rectangle {
Layout.preferredWidth: 1
width: 1
Layout.fillHeight: true Layout.fillHeight: true
Layout.topMargin: 5 Layout.topMargin: 5
Layout.bottomMargin: 5 Layout.bottomMargin: 5
@ -46,7 +45,7 @@ ColumnLayout {
TextInput { TextInput {
id: textField id: textField
Layout.fillWidth: true Layout.fillWidth: true
defaultText: cellLayout.defaultText defaultText: mainItem.defaultText
inputMethodHints: Qt.ImhDigitsOnly inputMethodHints: Qt.ImhDigitsOnly
fillWidth: true fillWidth: true
validator: IntValidator{} validator: IntValidator{}

View file

@ -4,13 +4,13 @@ import QtQuick.Controls 2.2 as Control
import Linphone import Linphone
Control.TabBar { Control.TabBar {
id: bar id: mainItem
property var model
readonly property int originX: count > 0
? itemAt(0).x
: 0
spacing: 40 spacing: 40
function appendTab(label) {
var newTab = tab.createObject(bar, {title: label, index: bar.count})
}
background: Item { background: Item {
anchors.fill: parent anchors.fill: parent
@ -26,18 +26,20 @@ Control.TabBar {
height: 4 height: 4
color: DefaultStyle.orangeColor color: DefaultStyle.orangeColor
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
x: bar.currentItem ? bar.currentItem.x : 0 x: mainItem.currentItem
width: bar.currentItem ? bar.currentItem.width : 0 ? mainItem.currentItem.x - mainItem.originX
: 0
width: mainItem.currentItem ? mainItem.currentItem.width : 0
clip: true clip: true
Behavior on x { NumberAnimation {duration: 100}} Behavior on x { NumberAnimation {duration: 100}}
Behavior on width {NumberAnimation {duration: 100}}
} }
} }
Component { Repeater {
id: tab model: mainItem.model
Control.TabButton { Control.TabButton {
property string title required property string modelData
property int index
width: txtMeter. advanceWidth width: txtMeter. advanceWidth
background: Item { background: Item {
@ -57,7 +59,7 @@ Control.TabBar {
TextMetrics { TextMetrics {
id: txtMeter id: txtMeter
font: tabText.font font: tabText.font
text: title text: modelData
} }
} }
} }

View file

@ -4,7 +4,7 @@ import QtQuick.Layouts 1.0
import Linphone import Linphone
ColumnLayout { ColumnLayout {
id: cellLayout id: mainItem
property string label: "" property string label: ""
property string defaultText : "" property string defaultText : ""
@ -19,7 +19,7 @@ ColumnLayout {
Text { Text {
visible: label.length > 0 visible: label.length > 0
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
text: cellLayout.label + (cellLayout.mandatory ? "*" : "") text: mainItem.label + (mainItem.mandatory ? "*" : "")
color: DefaultStyle.formItemLabelColor color: DefaultStyle.formItemLabelColor
font { font {
pointSize: DefaultStyle.formItemLabelSize pointSize: DefaultStyle.formItemLabelSize
@ -29,10 +29,10 @@ ColumnLayout {
Rectangle { Rectangle {
Component.onCompleted: { Component.onCompleted: {
if (cellLayout.fillWidth) if (mainItem.fillWidth)
Layout.fillWidth = true Layout.fillWidth = true
} }
implicitWidth: cellLayout.textInputWidth implicitWidth: mainItem.textInputWidth
implicitHeight: 30 implicitHeight: 30
radius: 20 radius: 20
color: DefaultStyle.formItemBackgroundColor color: DefaultStyle.formItemBackgroundColor
@ -42,14 +42,14 @@ ColumnLayout {
anchors.left: parent.left anchors.left: parent.left
anchors.right: eyeButton.visible ? eyeButton.left : parent.right anchors.right: eyeButton.visible ? eyeButton.left : parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
placeholderText: cellLayout.defaultText placeholderText: mainItem.defaultText
echoMode: (cellLayout.hidden && !eyeButton.checked) ? TextInput.Password : TextInput.Normal echoMode: (mainItem.hidden && !eyeButton.checked) ? TextInput.Password : TextInput.Normal
font.family: DefaultStyle.defaultFont font.family: DefaultStyle.defaultFont
font.pointSize: DefaultStyle.formTextInputSize font.pointSize: DefaultStyle.formTextInputSize
color: DefaultStyle.formItemLabelColor color: DefaultStyle.formItemLabelColor
inputMethodHints: cellLayout.inputMethodHints inputMethodHints: mainItem.inputMethodHints
selectByMouse: true selectByMouse: true
validator: cellLayout.validator validator: mainItem.validator
// MouseArea { // MouseArea {
// anchors.fill: parent // anchors.fill: parent
// // acceptedButtons: Qt.NoButton // // acceptedButtons: Qt.NoButton
@ -60,7 +60,7 @@ ColumnLayout {
} }
Button { Button {
id: eyeButton id: eyeButton
visible: cellLayout.hidden visible: mainItem.hidden
checkable: true checkable: true
background: Rectangle { background: Rectangle {
color: "transparent" color: "transparent"

View file

@ -44,7 +44,8 @@ RowLayout {
text: "Use SIP Account" text: "Use SIP Account"
onClicked: { onClicked: {
console.debug("[LoginItem] User: click use Sip") console.debug("[LoginItem] User: click use Sip")
root.useSIP()} root.useSIP()
}
} }
} }
Item { Item {

View file

@ -4,7 +4,6 @@ import QtQuick.Controls as Control
import Linphone import Linphone
LoginLayout { LoginLayout {
id: mainItem id: mainItem
signal returnToRegister() signal returnToRegister()
property string phoneNumber property string phoneNumber
@ -12,13 +11,14 @@ LoginLayout {
titleContent: RowLayout { titleContent: RowLayout {
Control.Button { Control.Button {
Layout.preferredHeight: 40
Layout.preferredWidth: 40
icon.width: 40
icon.height: 40
icon.source: AppIcons.returnArrow
background: Rectangle { background: Rectangle {
color: "transparent" color: "transparent"
} }
contentItem: Image {
source: AppIcons.returnArrow
fillMode: Image.PreserveAspectFit
}
onClicked: { onClicked: {
console.debug("[RegisterCheckingPage] User: return to register") console.debug("[RegisterCheckingPage] User: return to register")
mainItem.returnToRegister() mainItem.returnToRegister()
@ -58,30 +58,23 @@ LoginLayout {
Layout.margins: 10 Layout.margins: 10
ColumnLayout { ColumnLayout {
RowLayout { RowLayout {
// Layout.fillWidth: true Repeater {
DigitInput { model: 4
id: first DigitInput {
onTextEdited: if (text.length > 0 ) second.forceActiveFocus() required property int index
Layout.margins: 10 onTextEdited: if (text.length > 0 ) {
} console.log("next", nextItemInFocusChain(true))
DigitInput { if (index < 3)
id: second nextItemInFocusChain(true).forceActiveFocus()
onTextEdited: if (text.length > 0 ) third.forceActiveFocus() else {
Layout.margins: 10 // validate()
} }
DigitInput { }
id: third Layout.margins: 10
onTextEdited: if (text.length > 0 ) fourth.forceActiveFocus() }
Layout.margins: 10
}
DigitInput {
id: fourth
Layout.margins: 10
// onTextEdited: validate()
} }
} }
RowLayout { RowLayout {
// Layout.topMargin: 10
Text { Text {
Layout.rightMargin: 15 Layout.rightMargin: 15
text: "Didn't receive the code ?" text: "Didn't receive the code ?"

View file

@ -4,8 +4,7 @@ import QtQuick.Controls as Control
import Linphone import Linphone
LoginLayout { LoginLayout {
id: mainItem
id: registerPage
signal returnToLogin() signal returnToLogin()
signal registerCalled() signal registerCalled()
readonly property string countryCode: phoneNumberInput.countryCode readonly property string countryCode: phoneNumberInput.countryCode
@ -37,7 +36,8 @@ LoginLayout {
text: "Log in" text: "Log in"
onClicked: { onClicked: {
console.debug("[LoginItem] User: return") console.debug("[LoginItem] User: return")
returnToLogin()} returnToLogin()
}
} }
} }
@ -45,11 +45,7 @@ LoginLayout {
TabBar { TabBar {
Layout.fillWidth: true Layout.fillWidth: true
id: bar id: bar
Component.onCompleted: { model: [qsTr("Register with phone number"), qsTr("Register with email")]
appendTab(qsTr("Register with phone number"))
appendTab(qsTr("Register with email"))
}
} }
StackLayout { StackLayout {
currentIndex: bar.currentIndex currentIndex: bar.currentIndex
@ -107,8 +103,8 @@ LoginLayout {
text: "Register" text: "Register"
onClicked:{ onClicked:{
console.log("[RegisterPage] User: Call register") console.log("[RegisterPage] User: Call register")
registerPage.registerCalled() mainItem.registerCalled()
} }
} }
} }
Item { Item {
@ -176,7 +172,7 @@ LoginLayout {
text: "Register" text: "Register"
onClicked:{ onClicked:{
console.log("[RegisterPage] User: Call register") console.log("[RegisterPage] User: Call register")
registerPage.registerCalled() mainItem.registerCalled()
} }
} }
} }

View file

@ -5,23 +5,22 @@ import Linphone
import ConstantsCpp 1.0 import ConstantsCpp 1.0
LoginLayout { LoginLayout {
id: mainItem
id: sipLoginPage
signal returnToLogin() signal returnToLogin()
signal goToRegister() signal goToRegister()
titleContent: RowLayout { titleContent: RowLayout {
Control.Button { Control.Button {
Layout.preferredHeight: 40
Layout.preferredWidth: 40
icon.width: 40
icon.height: 40
icon.source: AppIcons.returnArrow
background: Rectangle { background: Rectangle {
color: "transparent" color: "transparent"
} }
contentItem: Image {
source: AppIcons.returnArrow
fillMode: Image.PreserveAspectFit
}
onClicked: { onClicked: {
console.debug("[LoginItem] User: return") console.debug("[LoginItem] User: return")
sipLoginPage.returnToLogin() mainItem.returnToLogin()
} }
} }
Image { Image {
@ -48,7 +47,7 @@ LoginLayout {
text: "Register" text: "Register"
onClicked: { onClicked: {
console.debug("[SIPLoginPage] User: go to register page") console.debug("[SIPLoginPage] User: go to register page")
sipLoginPage.goToRegister() mainItem.goToRegister()
} }
} }
} }
@ -99,7 +98,7 @@ LoginLayout {
inversedColors: true inversedColors: true
onClicked: { onClicked: {
console.debug("[LoginItem] User: click register") console.debug("[LoginItem] User: click register")
sipLoginPage.goToRegister() mainItem.goToRegister()
} }
} }
@ -156,7 +155,7 @@ LoginLayout {
text: 'Log in' text: 'Log in'
onClicked: { onClicked: {
console.debug("[LoginItem] User: Log in") console.debug("[SIPLoginPage] User: Log in")
LoginPageCpp.login(username.inputText, password.inputText); LoginPageCpp.login(username.inputText, password.inputText);
} }
} }

View file

@ -5,7 +5,7 @@ import QtQuick.Controls 2.2 as Control
import Linphone import Linphone
LoginLayout { LoginLayout {
id: welcomePage id: mainItem
signal startButtonPressed() signal startButtonPressed()
titleContent: RowLayout { titleContent: RowLayout {
@ -47,7 +47,7 @@ LoginLayout {
} }
onClicked: { onClicked: {
console.debug("[LoginItem] User: Click skip") console.debug("[LoginItem] User: Click skip")
welcomePage.startButtonPressed() mainItem.startButtonPressed()
} }
} }
} }
@ -135,7 +135,7 @@ LoginLayout {
text: carousel.currentIndex < (carousel.itemsList.length - 1) ? "Next" : "Start" text: carousel.currentIndex < (carousel.itemsList.length - 1) ? "Next" : "Start"
onClicked: { onClicked: {
if (carousel.currentIndex < 2) carousel.goToSlide(carousel.currentIndex + 1); if (carousel.currentIndex < 2) carousel.goToSlide(carousel.currentIndex + 1);
else welcomePage.startButtonPressed(); else mainItem.startButtonPressed();
} }
} }
Item { Item {

View file

@ -14,7 +14,7 @@ ListView{
anchors.fill: parent anchors.fill: parent
Text{ Text{
text: $modelData.flag text: $modelData.flag
font.family: 'Noto Color Emoji' font.family: DefaultStyle.emojiFont
} }
Text{ Text{
text: $modelData.country text: $modelData.country

View file

@ -4,6 +4,7 @@ import QtQuick 2.15
QtObject { QtObject {
property string defaultFont: "Noto Sans" property string defaultFont: "Noto Sans"
property string emojiFont: "Noto Color Emoji"
property color orangeColor: "#FE5E00" property color orangeColor: "#FE5E00"
property color buttonBackground: "#FE5E00" property color buttonBackground: "#FE5E00"
property color buttonInversedBackground: "white" property color buttonInversedBackground: "white"