From ebd960a4a8c4045aa838df592803bc43d8d2ceb5 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Tue, 7 Mar 2017 14:33:10 +0100 Subject: [PATCH] feat(ui/views/App/Assistant/AssistantUseLinphoneSipAccount): view done --- linphone-desktop/assets/languages/en.ts | 35 +++++- linphone-desktop/assets/languages/fr.ts | 35 +++++- linphone-desktop/resources.qrc | 2 + .../ui/modules/Common/Form/CheckBoxText.qml | 34 ++++-- .../AssistantCreateLinphoneSipAccount.qml | 4 +- .../AssistantUseLinphoneSipAccount.qml | 111 ++++++++++++++++++ .../AssistantUseLinphoneSipAccountStyle.qml | 12 ++ linphone-desktop/ui/views/App/Styles/qmldir | 3 +- 8 files changed, 220 insertions(+), 16 deletions(-) create mode 100644 linphone-desktop/ui/views/App/Assistant/AssistantUseLinphoneSipAccount.qml create mode 100644 linphone-desktop/ui/views/App/Styles/Assistant/AssistantUseLinphoneSipAccountStyle.qml diff --git a/linphone-desktop/assets/languages/en.ts b/linphone-desktop/assets/languages/en.ts index 37007ec59..a3168416a 100644 --- a/linphone-desktop/assets/languages/en.ts +++ b/linphone-desktop/assets/languages/en.ts @@ -78,8 +78,8 @@ Password confirmation - createAction - + confirmAction + CREATE @@ -124,6 +124,37 @@ CREATE A LINPHONE ACCOUNT + + AssistantUseLinphoneSipAccount + + confirmAction + LOGIN + + + useLinphoneSipAccountTitle + USE A LINPHONE ACCOUNT + + + countryLabel + Your country + + + phoneNumberLabel + Phone number + + + useUsernameToLogin + Use username and password rather than your phone number. + + + usernameLabel + + + + passwordLabel + Password + + AssistantUseOtherSipAccount diff --git a/linphone-desktop/assets/languages/fr.ts b/linphone-desktop/assets/languages/fr.ts index c15f49605..572ee9212 100644 --- a/linphone-desktop/assets/languages/fr.ts +++ b/linphone-desktop/assets/languages/fr.ts @@ -78,8 +78,8 @@ Confirmation du mot de passe - createAction - + confirmAction + CREATE @@ -124,6 +124,37 @@ CRÉER UN COMPTE LINPHONE + + AssistantUseLinphoneSipAccount + + confirmAction + CONNEXION + + + useLinphoneSipAccountTitle + UTILISER UN COMPTE LINPHONE + + + countryLabel + Votre pays + + + phoneNumberLabel + Numéro de téléphone + + + useUsernameToLogin + Utiliser un nom et mot de passe plutôt que votre numéro de téléphone. + + + usernameLabel + Nom d'utilisateur + + + passwordLabel + Mot de passe + + AssistantUseOtherSipAccount diff --git a/linphone-desktop/resources.qrc b/linphone-desktop/resources.qrc index 4b319c458..b78857c98 100644 --- a/linphone-desktop/resources.qrc +++ b/linphone-desktop/resources.qrc @@ -313,6 +313,7 @@ ui/views/App/Assistant/AssistantCreateLinphoneSipAccount.qml ui/views/App/Assistant/AssistantFetchRemoteConfiguration.qml ui/views/App/Assistant/AssistantHome.qml + ui/views/App/Assistant/AssistantUseLinphoneSipAccount.qml ui/views/App/Assistant/AssistantUseOtherSipAccount.qml ui/views/App/AssistantWindow.qml ui/views/App/Calls/AbstractStartingCall.qml @@ -340,6 +341,7 @@ ui/views/App/Styles/Assistant/AssistantAbstractViewStyle.qml ui/views/App/Styles/Assistant/AssistantCreateLinphoneSipAccountStyle.qml ui/views/App/Styles/Assistant/AssistantHomeStyle.qml + ui/views/App/Styles/Assistant/AssistantUseLinphoneSipAccountStyle.qml ui/views/App/Styles/AssistantWindowStyle.qml ui/views/App/Styles/Calls/CallStyle.qml ui/views/App/Styles/Calls/CallsWindowStyle.qml diff --git a/linphone-desktop/ui/modules/Common/Form/CheckBoxText.qml b/linphone-desktop/ui/modules/Common/Form/CheckBoxText.qml index 44a9d55ae..86143b90d 100644 --- a/linphone-desktop/ui/modules/Common/Form/CheckBoxText.qml +++ b/linphone-desktop/ui/modules/Common/Form/CheckBoxText.qml @@ -13,26 +13,39 @@ CheckBox { contentItem: Text { color: checkBox.down ? CheckBoxTextStyle.color.pressed - : (checkBox.hovered - ? CheckBoxTextStyle.color.hovered - : CheckBoxTextStyle.color.normal - ) + : ( + checkBox.hovered + ? CheckBoxTextStyle.color.hovered + : CheckBoxTextStyle.color.normal + ) + + elide: Text.ElideRight font: checkBox.font leftPadding: checkBox.indicator.width + checkBox.spacing text: checkBox.text + + width: parent.width + wrapMode: Text.WordWrap + verticalAlignment: Text.AlignVCenter } + hoverEnabled: true + indicator: Rectangle { border.color: checkBox.down ? CheckBoxTextStyle.color.pressed - : (checkBox.hovered - ? CheckBoxTextStyle.color.hovered - : CheckBoxTextStyle.color.normal - ) + : ( + checkBox.hovered + ? CheckBoxTextStyle.color.hovered + : CheckBoxTextStyle.color.normal + ) + implicitHeight: CheckBoxTextStyle.size implicitWidth: CheckBoxTextStyle.size + radius: CheckBoxTextStyle.radius + x: checkBox.leftPadding y: parent.height / 2 - height / 2 @@ -43,10 +56,13 @@ CheckBox { ? CheckBoxTextStyle.color.hovered : CheckBoxTextStyle.color.normal ) + height: parent.height - y * 2 + width: parent.width - x * 2 + radius: CheckBoxTextStyle.radius visible: checkBox.checked - width: parent.width - x * 2 + x: 4 // Fixed, no needed to use style file. y: 4 // Same thing. } diff --git a/linphone-desktop/ui/views/App/Assistant/AssistantCreateLinphoneSipAccount.qml b/linphone-desktop/ui/views/App/Assistant/AssistantCreateLinphoneSipAccount.qml index 8e83bb5e5..33f5ef031 100644 --- a/linphone-desktop/ui/views/App/Assistant/AssistantCreateLinphoneSipAccount.qml +++ b/linphone-desktop/ui/views/App/Assistant/AssistantCreateLinphoneSipAccount.qml @@ -27,7 +27,7 @@ AssistantAbstractView { mainActionEnabled: country.currentIndex !== -1 && phoneNumber.text.length - mainActionLabel: qsTr('createAction') + mainActionLabel: qsTr('confirmAction') title: view.title @@ -83,7 +83,7 @@ AssistantAbstractView { && password.text.length && passwordConfirmation.text === password.text - mainActionLabel: qsTr('createAction') + mainActionLabel: qsTr('confirmAction') title: view.title diff --git a/linphone-desktop/ui/views/App/Assistant/AssistantUseLinphoneSipAccount.qml b/linphone-desktop/ui/views/App/Assistant/AssistantUseLinphoneSipAccount.qml new file mode 100644 index 000000000..d66dfa5d2 --- /dev/null +++ b/linphone-desktop/ui/views/App/Assistant/AssistantUseLinphoneSipAccount.qml @@ -0,0 +1,111 @@ +import QtQuick 2.7 + +import Common 1.0 + +import App.Styles 1.0 + +// ============================================================================= + +AssistantAbstractView { + mainAction: (function () { + console.log('TODO') + }) + + mainActionEnabled: { + var item = loader.item + return item && item.mainActionEnabled + } + + mainActionLabel: qsTr('confirmAction') + + title: qsTr('useLinphoneSipAccountTitle') + + // --------------------------------------------------------------------------- + // Login with phone number. + // --------------------------------------------------------------------------- + + Component { + id: phoneNumberForm + + Form { + property bool mainActionEnabled: country.currentIndex !== -1 && phoneNumber.text + + orientation: Qt.Vertical + + FormLine { + FormGroup { + label: qsTr('countryLabel') + + ComboBox { + id: country + } + } + } + + FormLine { + FormGroup { + label: qsTr('phoneNumberLabel') + + TextField { + id: phoneNumber + } + } + } + } + } + + // --------------------------------------------------------------------------- + // Login with email address. + // --------------------------------------------------------------------------- + + Component { + id: emailAddressForm + + Form { + property bool mainActionEnabled: username.length && password.text + + orientation: Qt.Vertical + + FormLine { + FormGroup { + label: qsTr('usernameLabel') + + TextField { + id: username + } + } + } + + FormLine { + FormGroup { + label: qsTr('passwordLabel') + + TextField { + id: password + } + } + } + } + } + + // --------------------------------------------------------------------------- + + Column { + anchors.fill: parent + spacing: AssistantUseLinphoneSipAccountStyle.spacing + + Loader { + id: loader + + sourceComponent: checkBox.checked ? emailAddressForm : phoneNumberForm + width: parent.width + } + + CheckBoxText { + id: checkBox + + text: qsTr('useUsernameToLogin') + width: AssistantUseLinphoneSipAccountStyle.checkBox.width + } + } +} diff --git a/linphone-desktop/ui/views/App/Styles/Assistant/AssistantUseLinphoneSipAccountStyle.qml b/linphone-desktop/ui/views/App/Styles/Assistant/AssistantUseLinphoneSipAccountStyle.qml new file mode 100644 index 000000000..b0fedf75f --- /dev/null +++ b/linphone-desktop/ui/views/App/Styles/Assistant/AssistantUseLinphoneSipAccountStyle.qml @@ -0,0 +1,12 @@ +pragma Singleton +import QtQuick 2.7 + +// ============================================================================= + +QtObject { + property int spacing: 20 + + property QtObject checkBox: QtObject { + property int width: 300 + } +} diff --git a/linphone-desktop/ui/views/App/Styles/qmldir b/linphone-desktop/ui/views/App/Styles/qmldir index 43c4e6cec..c1b4b336b 100644 --- a/linphone-desktop/ui/views/App/Styles/qmldir +++ b/linphone-desktop/ui/views/App/Styles/qmldir @@ -8,9 +8,10 @@ singleton AssistantWindowStyle 1.0 AssistantWindowStyle.qml singleton InviteFriendsWindowStyle 1.0 InviteFriendsWindowStyle.qml singleton ManageAccountsWindowStyle 1.0 ManageAccountsWindowStyle.qml -singleton AssistantHomeStyle 1.0 Assistant/AssistantHomeStyle.qml singleton AssistantAbstractViewStyle 1.0 Assistant/AssistantAbstractViewStyle.qml singleton AssistantCreateLinphoneSipAccountStyle 1.0 Assistant/AssistantCreateLinphoneSipAccountStyle.qml +singleton AssistantHomeStyle 1.0 Assistant/AssistantHomeStyle.qml +singleton AssistantUseLinphoneSipAccountStyle 1.0 Assistant/AssistantUseLinphoneSipAccountStyle.qml singleton CallStyle 1.0 Calls/CallStyle.qml singleton CallsWindowStyle 1.0 Calls/CallsWindowStyle.qml