fix sip login page content layout

This commit is contained in:
Gaelle Braud 2023-11-15 14:11:12 +01:00
parent 22724d8cd2
commit 62a9d34e09

View file

@ -57,162 +57,160 @@ LoginLayout {
centerContent: ColumnLayout { centerContent: ColumnLayout {
signal useSIPButtonClicked() signal useSIPButtonClicked()
RowLayout { RowLayout {
Control.StackView {
ColumnLayout { id: rootStackView
Layout.preferredWidth: 330 initialItem: firstItem
Layout.maximumWidth: 340 Layout.preferredWidth: 280
Control.StackView { Layout.fillHeight: true
id: rootStackView Layout.alignment: Qt.AlignTop
initialItem: firstItem }
Layout.preferredWidth: parent.width Component {
Layout.preferredHeight: parent.height id: firstItem
ColumnLayout {
Component { ColumnLayout {
id: firstItem Layout.bottomMargin: 60
ColumnLayout { Text {
Layout.alignment: Qt.AlignTop Layout.fillWidth: true
Layout.fillHeight: true Layout.preferredWidth: rootStackView.width
Layout.maximumWidth: rootStackView.width width: rootStackView.width
clip: true wrapMode: Text.WordWrap
color: DefaultStyle.darkGrayColor
ColumnLayout { font.pointSize: DefaultStyle.defaultTextSize
Text { text: "<p>Some features require a Linphone account, such as group messaging, video conferences...</p>
Layout.preferredWidth: rootStackView.width <p>These features are hidden when you register with a third party SIP account.</p>
width: rootStackView.width <p>To enable it in a commercial projet, please contact us. </p>"
}
wrapMode: Text.WordWrap Button {
color: DefaultStyle.darkGrayColor text: "linphone.org/contact"
font.pointSize: DefaultStyle.defaultTextSize textSize: 8
text: "<p>Some features require a Linphone account, such as group messaging, video conferences...</p> inversedColors: true
<p>These features are hidden when you register with a third party SIP account.</p> leftPadding: 8
<p>To enable it in a commercial projet, please contact us. </p>" rightPadding: 8
} topPadding: 5
Button { bottomPadding: 5
text: "linphone.org/contact" onClicked: {
textSize: 8 Qt.openUrlExternally(ConstantsCpp.ContactUrl)
inversedColors: true
onClicked: {
Qt.openUrlExternally(ConstantsCpp.ContactUrl)
}
}
}
ColumnLayout {
spacing: 10
Layout.bottomMargin: 20
Button {
Layout.fillWidth: true
inversedColors: true
text: "I prefer creating an account"
onClicked: {
console.debug("[SIPLoginPage] User: click register")
mainItem.goToRegister()
}
}
Button {
Layout.fillWidth: true
text: "I understand"
onClicked: {
rootStackView.replace(secondItem)
}
}
} }
} }
} }
Component { ColumnLayout {
id: secondItem spacing: 10
ColumnLayout { Layout.bottomMargin: 20
spacing: 10 Button {
TextInput { Layout.fillWidth: true
id: username inversedColors: true
label: "Username" text: "I prefer creating an account"
mandatory: true onClicked: {
textInputWidth: 250 console.debug("[SIPLoginPage] User: click register")
} mainItem.goToRegister()
TextInput {
id: password
label: "Password"
mandatory: true
hidden: true
textInputWidth: 250
}
TextInput {
id: domain
label: "Domain"
mandatory: true
textInputWidth: 250
}
TextInput {
id: displayName
label: "Display Name"
textInputWidth: 250
}
ComboBox {
label: "Transport"
backgroundWidth: 250
modelList:[ "TCP", "UDP", "TLS"]
}
Text {
id: errorText
text: "Connection has failed. Please verify your credentials"
color: DefaultStyle.errorMessageColor
opacity: 0
states: [
State{
name: "Visible"
PropertyChanges{target: errorText; opacity: 1.0}
},
State{
name:"Invisible"
PropertyChanges{target: errorText; opacity: 0.0}
}
]
transitions: [
Transition {
from: "Visible"
to: "Invisible"
NumberAnimation {
property: "opacity"
duration: 1000
}
}
]
Timer {
id: autoHideErrorMessage
interval: 2500
onTriggered: errorText.state = "Invisible"
}
Connections {
target: LoginPageCpp
onRegistrationStateChanged: {
if (LoginPageCpp.registrationState === LinphoneEnums.RegistrationState.Failed) {
errorText.state = "Visible"
autoHideErrorMessage.restart()
} else if (LoginPageCpp.registrationState === LinphoneEnums.RegistrationState.Ok) {
mainItem.connectionSucceed()
}
}
}
}
Button {
Layout.topMargin: 20
Layout.bottomMargin: 20
text: "Log in"
onClicked: {
console.debug("[SIPLoginPage] User: Log in")
LoginPageCpp.login(username.inputText, password.inputText);
}
}
Item {
Layout.fillHeight: true
} }
} }
Button {
Layout.fillWidth: true
text: "I understand"
onClicked: {
rootStackView.replace(secondItem)
}
}
}
Item {
Layout.fillHeight: true
} }
} }
} }
Component {
id: secondItem
ColumnLayout {
spacing: 10
TextInput {
id: username
label: "Username"
mandatory: true
textInputWidth: 250
}
TextInput {
id: password
label: "Password"
mandatory: true
hidden: true
textInputWidth: 250
}
TextInput {
id: domain
label: "Domain"
mandatory: true
textInputWidth: 250
}
TextInput {
id: displayName
label: "Display Name"
textInputWidth: 250
}
ComboBox {
label: "Transport"
backgroundWidth: 250
modelList:[ "TCP", "UDP", "TLS"]
}
Text {
id: errorText
text: "Connection has failed. Please verify your credentials"
color: DefaultStyle.errorMessageColor
opacity: 0
states: [
State{
name: "Visible"
PropertyChanges{target: errorText; opacity: 1.0}
},
State{
name:"Invisible"
PropertyChanges{target: errorText; opacity: 0.0}
}
]
transitions: [
Transition {
from: "Visible"
to: "Invisible"
NumberAnimation {
property: "opacity"
duration: 1000
}
}
]
Timer {
id: autoHideErrorMessage
interval: 2500
onTriggered: errorText.state = "Invisible"
}
Connections {
target: LoginPageCpp
onRegistrationStateChanged: {
if (LoginPageCpp.registrationState === LinphoneEnums.RegistrationState.Failed) {
errorText.state = "Visible"
autoHideErrorMessage.restart()
} else if (LoginPageCpp.registrationState === LinphoneEnums.RegistrationState.Ok) {
mainItem.connectionSucceed()
}
}
}
}
Button {
Layout.topMargin: 20
Layout.bottomMargin: 20
text: "Log in"
onClicked: {
console.debug("[SIPLoginPage] User: Log in")
LoginPageCpp.login(username.inputText, password.inputText);
}
}
Item {
Layout.fillHeight: true
}
}
}
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
} }
@ -228,5 +226,4 @@ LoginLayout {
Layout.fillHeight: true Layout.fillHeight: true
} }
} }
} }