mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
feat(ui/views/App/Main/Assistant): creation in progress
This commit is contained in:
parent
749e0051e2
commit
85ce8f7166
18 changed files with 482 additions and 266 deletions
|
|
@ -53,17 +53,20 @@
|
|||
<source>withEmailAddress</source>
|
||||
<translation>WITH AN EMAIL ADDRESS</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AssistantCreateLinphoneSipAccountWithEmail</name>
|
||||
<message>
|
||||
<source>countryLabel</source>
|
||||
<translation>Your country</translation>
|
||||
<source>createLinphoneSipAccountTitle</source>
|
||||
<translation>CREATE A LINPHONE ACCOUNT</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>phoneNumberLabel</source>
|
||||
<translation>Phone number</translation>
|
||||
<source>confirmAction</source>
|
||||
<translation>CREATE</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>usernameLabel</source>
|
||||
<translation>Username (optional)</translation>
|
||||
<translation>Username</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>emailLabel</source>
|
||||
|
|
@ -78,8 +81,27 @@
|
|||
<translation>Password confirmation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>confirmAction</source>
|
||||
<translation>CREATE</translation>
|
||||
<source>passwordConfirmationError</source>
|
||||
<translation>The passwords you entered do not match.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AssistantCreateLinphoneSipAccountWithPhoneNumber</name>
|
||||
<message>
|
||||
<source>createLinphoneSipAccountTitle</source>
|
||||
<translation>CREATE A LINPHONE ACCOUNT</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>countryLabel</source>
|
||||
<translation>Your country</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>phoneNumberLabel</source>
|
||||
<translation>Phone number</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>usernameLabel</source>
|
||||
<translation>Username</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
|
@ -166,6 +188,22 @@
|
|||
<source>requestFailed</source>
|
||||
<translation>Unable to send the request.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>emailStatusMalformed</source>
|
||||
<translation>Malformed email.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>emailStatusMalformedInvalidCharacters</source>
|
||||
<translation>Malformed email or invalid characters.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>cannotSendSms</source>
|
||||
<translation>Server error: Cannot send sms.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>accountAlreadyExists</source>
|
||||
<translation>Account already exists.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AssistantUseLinphoneSipAccount</name>
|
||||
|
|
@ -177,6 +215,13 @@
|
|||
<source>useLinphoneSipAccountTitle</source>
|
||||
<translation>USE A LINPHONE ACCOUNT</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>useUsernameToLogin</source>
|
||||
<translation>Use username and password rather than your phone number.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AssistantUseLinphoneSipAccountWithPhoneNumber</name>
|
||||
<message>
|
||||
<source>countryLabel</source>
|
||||
<translation>Your country</translation>
|
||||
|
|
@ -185,10 +230,9 @@
|
|||
<source>phoneNumberLabel</source>
|
||||
<translation>Phone number</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>useUsernameToLogin</source>
|
||||
<translation>Use username and password rather than your phone number.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AssistantUseLinphoneSipAccountWithUsername</name>
|
||||
<message>
|
||||
<source>usernameLabel</source>
|
||||
<translation>Username</translation>
|
||||
|
|
|
|||
|
|
@ -53,13 +53,16 @@
|
|||
<source>withEmailAddress</source>
|
||||
<translation>AVER UNE ADRESSE E-MAIL</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AssistantCreateLinphoneSipAccountWithEmail</name>
|
||||
<message>
|
||||
<source>countryLabel</source>
|
||||
<translation>Votre pays</translation>
|
||||
<source>createLinphoneSipAccountTitle</source>
|
||||
<translation>CRÉER UN COMPTE LINPHONE</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>phoneNumberLabel</source>
|
||||
<translation>Numéro de téléphone</translation>
|
||||
<source>confirmAction</source>
|
||||
<translation>CRÉER</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>usernameLabel</source>
|
||||
|
|
@ -78,8 +81,27 @@
|
|||
<translation>Confirmation du mot de passe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>confirmAction</source>
|
||||
<translation>CREATE</translation>
|
||||
<source>passwordConfirmationError</source>
|
||||
<translation>Les mots de passe ne correspondent pas.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AssistantCreateLinphoneSipAccountWithPhoneNumber</name>
|
||||
<message>
|
||||
<source>createLinphoneSipAccountTitle</source>
|
||||
<translation>CRÉER UN COMPTE LINPHONE</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>countryLabel</source>
|
||||
<translation>Votre pays</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>phoneNumberLabel</source>
|
||||
<translation>Numéro de téléphone</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>usernameLabel</source>
|
||||
<translation>Nom d'utilisateur</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
|
@ -166,6 +188,22 @@
|
|||
<source>loginWithUsernameFailed</source>
|
||||
<translation>La connection a échouée. Merci de vérifier le nom d'utilisateur/mot de passe.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>emailStatusMalformed</source>
|
||||
<translation>Adresse malformée.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>emailStatusMalformedInvalidCharacters</source>
|
||||
<translation>Adresse malformée ou caractères invalides.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>cannotSendSms</source>
|
||||
<translation>Erreur serveur : impossible d'envoyer un sms.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>accountAlreadyExists</source>
|
||||
<translation>Le compte existe déjà.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AssistantUseLinphoneSipAccount</name>
|
||||
|
|
@ -177,6 +215,13 @@
|
|||
<source>useLinphoneSipAccountTitle</source>
|
||||
<translation>UTILISER UN COMPTE LINPHONE</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>useUsernameToLogin</source>
|
||||
<translation>Utiliser un nom et mot de passe plutôt que votre numéro de téléphone.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AssistantUseLinphoneSipAccountWithPhoneNumber</name>
|
||||
<message>
|
||||
<source>countryLabel</source>
|
||||
<translation>Votre pays</translation>
|
||||
|
|
@ -185,10 +230,9 @@
|
|||
<source>phoneNumberLabel</source>
|
||||
<translation>Numéro de téléphone</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>useUsernameToLogin</source>
|
||||
<translation>Utiliser un nom et mot de passe plutôt que votre numéro de téléphone.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AssistantUseLinphoneSipAccountWithUsername</name>
|
||||
<message>
|
||||
<source>usernameLabel</source>
|
||||
<translation>Nom d'utilisateur</translation>
|
||||
|
|
@ -283,27 +327,27 @@ Url du serveur non configurée.</translation>
|
|||
<name>CodecsViewer</name>
|
||||
<message>
|
||||
<source>codecMime</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Nom</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>codecEncoderDescription</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Description</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>codecEncoderClockRate</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Fréquence (Hz)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>codecBitrate</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Débit (Kbit/s)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>codecRecvFmtp</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Paramètres</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>codecStatus</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>status</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
|
|
|||
|
|
@ -327,9 +327,13 @@
|
|||
<file>ui/views/App/Calls/OutgoingCall.qml</file>
|
||||
<file>ui/views/App/Main/Assistant/AssistantAbstractView.qml</file>
|
||||
<file>ui/views/App/Main/Assistant/AssistantCreateLinphoneSipAccount.qml</file>
|
||||
<file>ui/views/App/Main/Assistant/AssistantCreateLinphoneSipAccountWithEmail.qml</file>
|
||||
<file>ui/views/App/Main/Assistant/AssistantCreateLinphoneSipAccountWithPhoneNumber.qml</file>
|
||||
<file>ui/views/App/Main/Assistant/AssistantFetchRemoteConfiguration.qml</file>
|
||||
<file>ui/views/App/Main/Assistant/AssistantHome.qml</file>
|
||||
<file>ui/views/App/Main/Assistant/AssistantUseLinphoneSipAccount.qml</file>
|
||||
<file>ui/views/App/Main/Assistant/AssistantUseLinphoneSipAccountWithPhoneNumber.qml</file>
|
||||
<file>ui/views/App/Main/Assistant/AssistantUseLinphoneSipAccountWithUsername.qml</file>
|
||||
<file>ui/views/App/Main/Assistant/AssistantUseOtherSipAccount.qml</file>
|
||||
<file>ui/views/App/Main/Assistant.qml</file>
|
||||
<file>ui/views/App/Main/ContactEdit.js</file>
|
||||
|
|
|
|||
|
|
@ -37,11 +37,22 @@ public:
|
|||
m_assistant = assistant;
|
||||
}
|
||||
|
||||
// void onCreateAccount (
|
||||
// const shared_ptr<linphone::AccountCreator> &creator,
|
||||
// linphone::AccountCreatorStatus status,
|
||||
// const string &resp
|
||||
// ) override {}
|
||||
void onCreateAccount (
|
||||
const shared_ptr<linphone::AccountCreator> &,
|
||||
linphone::AccountCreatorStatus status,
|
||||
const string &
|
||||
) override {
|
||||
if (status == linphone::AccountCreatorStatusAccountCreated)
|
||||
emit m_assistant->createStatusChanged("");
|
||||
else {
|
||||
if (status == linphone::AccountCreatorStatusRequestFailed)
|
||||
emit m_assistant->createStatusChanged(tr("requestFailed"));
|
||||
else if (status == linphone::AccountCreatorStatusServerError)
|
||||
emit m_assistant->createStatusChanged(tr("cannotSendSms"));
|
||||
else
|
||||
emit m_assistant->createStatusChanged(tr("accountAlreadyExists"));
|
||||
}
|
||||
}
|
||||
|
||||
void onIsAccountExist (
|
||||
const shared_ptr<linphone::AccountCreator> &creator,
|
||||
|
|
@ -125,29 +136,22 @@ AssistantModel::AssistantModel (QObject *parent) : QObject(parent) {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void AssistantModel::setUsername (const QString &username) {
|
||||
void AssistantModel::setEmail (const QString &email) {
|
||||
shared_ptr<linphone::Config> config = CoreManager::getInstance()->getCore()->getConfig();
|
||||
QString error;
|
||||
|
||||
switch (m_account_creator->setUsername(::Utils::qStringToLinphoneString(username))) {
|
||||
case linphone::AccountCreatorUsernameStatusOk:
|
||||
switch (m_account_creator->setEmail(::Utils::qStringToLinphoneString(email))) {
|
||||
case linphone::AccountCreatorEmailStatusOk:
|
||||
break;
|
||||
case linphone::AccountCreatorUsernameStatusTooShort:
|
||||
error = tr("usernameStatusTooShort").arg(config->getInt("assistant", "username_min_length", 1));
|
||||
case linphone::AccountCreatorEmailStatusMalformed:
|
||||
error = tr("emailStatusMalformed");
|
||||
break;
|
||||
case linphone::AccountCreatorUsernameStatusTooLong:
|
||||
error = tr("usernameStatusTooLong").arg(config->getInt("assistant", "username_max_length", -1));
|
||||
break;
|
||||
case linphone::AccountCreatorUsernameStatusInvalidCharacters:
|
||||
error = tr("usernameStatusInvalidCharacters")
|
||||
.arg(::Utils::linphoneStringToQString(config->getString("assistant", "username_regex", "")));
|
||||
break;
|
||||
case linphone::AccountCreatorUsernameStatusInvalid:
|
||||
error = tr("usernameStatusInvalid");
|
||||
case linphone::AccountCreatorEmailStatusInvalidCharacters:
|
||||
error = tr("emailStatusMalformedInvalidCharacters");
|
||||
break;
|
||||
}
|
||||
|
||||
emit usernameChanged(username, error);
|
||||
emit emailChanged(email, error);
|
||||
}
|
||||
|
||||
void AssistantModel::setPassword (const QString &password) {
|
||||
|
|
@ -185,8 +189,46 @@ void AssistantModel::setPhoneNumber (const QString &phone_number) {
|
|||
emit phoneNumberChanged(phone_number, error);
|
||||
}
|
||||
|
||||
void AssistantModel::setUsername (const QString &username) {
|
||||
shared_ptr<linphone::Config> config = CoreManager::getInstance()->getCore()->getConfig();
|
||||
QString error;
|
||||
|
||||
switch (m_account_creator->setUsername(::Utils::qStringToLinphoneString(username))) {
|
||||
case linphone::AccountCreatorUsernameStatusOk:
|
||||
break;
|
||||
case linphone::AccountCreatorUsernameStatusTooShort:
|
||||
error = tr("usernameStatusTooShort").arg(config->getInt("assistant", "username_min_length", 1));
|
||||
break;
|
||||
case linphone::AccountCreatorUsernameStatusTooLong:
|
||||
error = tr("usernameStatusTooLong").arg(config->getInt("assistant", "username_max_length", -1));
|
||||
break;
|
||||
case linphone::AccountCreatorUsernameStatusInvalidCharacters:
|
||||
error = tr("usernameStatusInvalidCharacters")
|
||||
.arg(::Utils::linphoneStringToQString(config->getString("assistant", "username_regex", "")));
|
||||
break;
|
||||
case linphone::AccountCreatorUsernameStatusInvalid:
|
||||
error = tr("usernameStatusInvalid");
|
||||
break;
|
||||
}
|
||||
|
||||
emit usernameChanged(username, error);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void AssistantModel::create () {
|
||||
m_account_creator->createAccount();
|
||||
}
|
||||
|
||||
void AssistantModel::login () {
|
||||
m_account_creator->isAccountExist();
|
||||
}
|
||||
|
||||
void AssistantModel::reset () {
|
||||
m_account_creator->reset();
|
||||
|
||||
emit emailChanged("", "");
|
||||
emit passwordChanged("", "");
|
||||
emit phoneNumberChanged("", "");
|
||||
emit usernameChanged("", "");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,17 +36,22 @@ class AssistantModel : public QObject {
|
|||
public:
|
||||
AssistantModel (QObject *parent = Q_NULLPTR);
|
||||
|
||||
Q_INVOKABLE void setUsername (const QString &username);
|
||||
Q_INVOKABLE void setEmail (const QString &email);
|
||||
Q_INVOKABLE void setPassword (const QString &password);
|
||||
Q_INVOKABLE void setPhoneNumber (const QString &phone_number);
|
||||
Q_INVOKABLE void setUsername (const QString &username);
|
||||
|
||||
Q_INVOKABLE void create ();
|
||||
Q_INVOKABLE void login ();
|
||||
Q_INVOKABLE void reset ();
|
||||
|
||||
signals:
|
||||
void usernameChanged (const QString &username, const QString &error);
|
||||
void emailChanged (const QString &email, const QString &error);
|
||||
void passwordChanged (const QString &password, const QString &error);
|
||||
void phoneNumberChanged (const QString &phone_number, const QString &error);
|
||||
void usernameChanged (const QString &username, const QString &error);
|
||||
|
||||
void createStatusChanged (const QString &error);
|
||||
void loginStatusChanged (const QString &error);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ QtObject {
|
|||
property QtObject error: QtObject {
|
||||
property color color: Colors.error
|
||||
property int fontSize: 10
|
||||
property int height: 16
|
||||
property int height: 11
|
||||
}
|
||||
|
||||
property QtObject legend: QtObject {
|
||||
|
|
|
|||
|
|
@ -44,13 +44,17 @@ Item {
|
|||
width: parent.width
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
padding: RequestBlockStyle.error.padding
|
||||
wrapMode: Text.WordWrap
|
||||
|
||||
visible: !block.loading
|
||||
}
|
||||
|
||||
BusyIndicator {
|
||||
anchors.centerIn: parent
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
top: parent.top
|
||||
}
|
||||
|
||||
height: RequestBlockStyle.loadingIndicator.height
|
||||
width: RequestBlockStyle.loadingIndicator.width
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ QtObject {
|
|||
property QtObject error: QtObject {
|
||||
property color color: Colors.error
|
||||
property int fontSize: 11
|
||||
property int padding: 4
|
||||
}
|
||||
|
||||
property QtObject loadingIndicator: QtObject {
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ Item {
|
|||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
width: parent.width
|
||||
|
||||
visible: text.length > 0
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -7,133 +7,11 @@ import App.Styles 1.0
|
|||
// =============================================================================
|
||||
|
||||
AssistantAbstractView {
|
||||
id: view
|
||||
|
||||
description: qsTr('createLinphoneSipAccountDescription')
|
||||
title: qsTr('createLinphoneSipAccountTitle')
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Create with phone number.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Component {
|
||||
id: phoneNumberView
|
||||
|
||||
AssistantAbstractView {
|
||||
mainAction: (function () {
|
||||
console.log('TODO')
|
||||
})
|
||||
|
||||
mainActionEnabled: country.currentIndex !== -1 &&
|
||||
phoneNumber.text.length
|
||||
|
||||
mainActionLabel: qsTr('confirmAction')
|
||||
|
||||
title: view.title
|
||||
|
||||
Form {
|
||||
anchors.fill: parent
|
||||
orientation: Qt.Vertical
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('countryLabel')
|
||||
|
||||
ComboBox {
|
||||
id: country
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('phoneNumberLabel')
|
||||
|
||||
TextField {
|
||||
id: phoneNumber
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('usernameLabel')
|
||||
|
||||
TextField {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Create with email address.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Component {
|
||||
id: emailAddressView
|
||||
|
||||
AssistantAbstractView {
|
||||
mainAction: (function () {
|
||||
console.log('TODO')
|
||||
})
|
||||
|
||||
mainActionEnabled: username.text.length
|
||||
&& email.text.length
|
||||
&& password.text.length
|
||||
&& passwordConfirmation.text === password.text
|
||||
|
||||
mainActionLabel: qsTr('confirmAction')
|
||||
|
||||
title: view.title
|
||||
|
||||
Form {
|
||||
anchors.fill: parent
|
||||
orientation: Qt.Vertical
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('usernameLabel')
|
||||
|
||||
TextField {
|
||||
id: username
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('emailLabel')
|
||||
|
||||
TextField {
|
||||
id: email
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('passwordLabel')
|
||||
|
||||
TextField {
|
||||
id: password
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('passwordConfirmationLabel')
|
||||
|
||||
TextField {
|
||||
id: passwordConfirmation
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Menu.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Column {
|
||||
|
|
@ -147,7 +25,7 @@ AssistantAbstractView {
|
|||
height: AssistantCreateLinphoneSipAccountStyle.buttons.button.height
|
||||
width: parent.width
|
||||
|
||||
onClicked: assistant.pushView(phoneNumberView)
|
||||
onClicked: assistant.pushView('AssistantCreateLinphoneSipAccountWithPhoneNumber')
|
||||
}
|
||||
|
||||
TextButtonA {
|
||||
|
|
@ -156,7 +34,7 @@ AssistantAbstractView {
|
|||
height: AssistantCreateLinphoneSipAccountStyle.buttons.button.height
|
||||
width: parent.width
|
||||
|
||||
onClicked: assistant.pushView(emailAddressView)
|
||||
onClicked: assistant.pushView('AssistantCreateLinphoneSipAccountWithEmail')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
import QtQuick 2.7
|
||||
|
||||
import Common 1.0
|
||||
import Linphone 1.0
|
||||
|
||||
import App.Styles 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
AssistantAbstractView {
|
||||
id: view
|
||||
|
||||
property alias emailError: email.error
|
||||
property alias passwordError: password.error
|
||||
property alias usernameError: username.error
|
||||
|
||||
title: qsTr('createLinphoneSipAccountTitle')
|
||||
|
||||
mainAction: requestBlock.execute
|
||||
mainActionEnabled: email.text.length
|
||||
&& password.text.length
|
||||
&& passwordConfirmation.text === password.text
|
||||
&& username.text.length
|
||||
&& !emailError.length
|
||||
&& !passwordError.length
|
||||
&& !requestBlock.loading
|
||||
&& !usernameError.length
|
||||
mainActionLabel: qsTr('confirmAction')
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
|
||||
Form {
|
||||
dealWithErrors: true
|
||||
orientation: Qt.Vertical
|
||||
width: parent.width
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('usernameLabel')
|
||||
|
||||
TextField {
|
||||
id: username
|
||||
|
||||
onTextChanged: assistantModel.setUsername(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('emailLabel')
|
||||
|
||||
TextField {
|
||||
id: email
|
||||
|
||||
onTextChanged: assistantModel.setEmail(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('passwordLabel')
|
||||
|
||||
TextField {
|
||||
id: password
|
||||
|
||||
onTextChanged: assistantModel.setPassword(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('passwordConfirmationLabel')
|
||||
|
||||
TextField {
|
||||
id: passwordConfirmation
|
||||
|
||||
onTextChanged: error = password.text !== text
|
||||
? qsTr('passwordConfirmationError')
|
||||
: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RequestBlock {
|
||||
id: requestBlock
|
||||
|
||||
action: assistantModel.create
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Assistant.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
AssistantModel {
|
||||
id: assistantModel
|
||||
|
||||
onEmailChanged: emailError = error
|
||||
onPasswordChanged: passwordError = error
|
||||
onUsernameChanged: usernameError = error
|
||||
|
||||
onCreateStatusChanged: {
|
||||
requestBlock.stop(error)
|
||||
if (!error.length) {
|
||||
// TODO.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
import QtQuick 2.7
|
||||
|
||||
import Common 1.0
|
||||
import Linphone 1.0
|
||||
|
||||
import App.Styles 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
AssistantAbstractView {
|
||||
id: view
|
||||
|
||||
property alias usernameError: username.error
|
||||
|
||||
title: qsTr('createLinphoneSipAccountTitle')
|
||||
|
||||
Form {
|
||||
anchors.fill: parent
|
||||
|
||||
dealWithErrors: true
|
||||
orientation: Qt.Vertical
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('countryLabel')
|
||||
|
||||
ComboBox {
|
||||
id: country
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('phoneNumberLabel')
|
||||
|
||||
TextField {
|
||||
id: phoneNumber
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('usernameLabel')
|
||||
|
||||
TextField {
|
||||
id: username
|
||||
|
||||
onTextChanged: assistantModel.setUsername(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Assistant.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
AssistantModel {
|
||||
id: assistantModel
|
||||
|
||||
onUsernameChanged: usernameError = error
|
||||
|
||||
onCreateStatusChanged: {
|
||||
requestBlock.stop(error)
|
||||
if (!error.length) {
|
||||
// TODO.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,91 +13,10 @@ AssistantAbstractView {
|
|||
var item = loader.item
|
||||
return item && item.mainActionEnabled && !requestBlock.loading
|
||||
}
|
||||
|
||||
mainActionLabel: qsTr('confirmAction')
|
||||
|
||||
title: qsTr('useLinphoneSipAccountTitle')
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Login with phone number.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Component {
|
||||
id: phoneNumberForm
|
||||
|
||||
Form {
|
||||
property bool mainActionEnabled: country.currentIndex !== -1 && phoneNumber.text
|
||||
|
||||
dealWithErrors: true
|
||||
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 &&
|
||||
!usernameError.length &&
|
||||
!passwordError.length
|
||||
|
||||
property alias usernameError: username.error
|
||||
property alias passwordError: password.error
|
||||
|
||||
dealWithErrors: true
|
||||
orientation: Qt.Vertical
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('usernameLabel')
|
||||
|
||||
TextField {
|
||||
id: username
|
||||
|
||||
onTextChanged: assistantModel.setUsername(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('passwordLabel')
|
||||
|
||||
TextField {
|
||||
id: password
|
||||
|
||||
onTextChanged: assistantModel.setPassword(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Column {
|
||||
|
|
@ -106,7 +25,9 @@ AssistantAbstractView {
|
|||
Loader {
|
||||
id: loader
|
||||
|
||||
sourceComponent: checkBox.checked ? emailAddressForm : phoneNumberForm
|
||||
source: 'AssistantUseLinphoneSipAccountWith' + (
|
||||
checkBox.checked ? 'Username' : 'PhoneNumber'
|
||||
) + '.qml'
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
|
|
@ -116,7 +37,10 @@ AssistantAbstractView {
|
|||
text: qsTr('useUsernameToLogin')
|
||||
width: AssistantUseLinphoneSipAccountStyle.checkBox.width
|
||||
|
||||
onClicked: requestBlock.stop('')
|
||||
onClicked: {
|
||||
assistantModel.reset()
|
||||
requestBlock.stop('')
|
||||
}
|
||||
}
|
||||
|
||||
RequestBlock {
|
||||
|
|
@ -127,13 +51,24 @@ AssistantAbstractView {
|
|||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Assistant.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
AssistantModel {
|
||||
id: assistantModel
|
||||
|
||||
onUsernameChanged: loader.item.usernameError = error
|
||||
onPasswordChanged: loader.item.passwordError = error
|
||||
onPasswordChanged: {
|
||||
if (checkBox.checked) {
|
||||
loader.item.passwordError = error
|
||||
}
|
||||
}
|
||||
|
||||
onUsernameChanged: {
|
||||
if (checkBox.checked) {
|
||||
loader.item.usernameError = error
|
||||
}
|
||||
}
|
||||
|
||||
onLoginStatusChanged: {
|
||||
requestBlock.stop(error)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
import Common 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
Form {
|
||||
property bool mainActionEnabled: country.currentIndex !== -1 && phoneNumber.text
|
||||
|
||||
dealWithErrors: true
|
||||
orientation: Qt.Vertical
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('countryLabel')
|
||||
|
||||
ComboBox {
|
||||
id: country
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('phoneNumberLabel')
|
||||
|
||||
TextField {
|
||||
id: phoneNumber
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
import Common 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
Form {
|
||||
property alias passwordError: password.error
|
||||
property alias usernameError: username.error
|
||||
|
||||
property bool mainActionEnabled: password.text &&
|
||||
username.length &&
|
||||
!passwordError.length &&
|
||||
!usernameError.length
|
||||
|
||||
dealWithErrors: true
|
||||
orientation: Qt.Vertical
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('usernameLabel')
|
||||
|
||||
TextField {
|
||||
id: username
|
||||
|
||||
onTextChanged: assistantModel.setUsername(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('passwordLabel')
|
||||
|
||||
TextField {
|
||||
id: password
|
||||
|
||||
onTextChanged: assistantModel.setPassword(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,20 +12,20 @@ QtObject {
|
|||
|
||||
property QtObject description: QtObject {
|
||||
property color color: Colors.g
|
||||
property int height: 40
|
||||
property int fontSize: 10
|
||||
property int height: 40
|
||||
}
|
||||
|
||||
property QtObject title: QtObject {
|
||||
property color color: Colors.g
|
||||
property int height: 40
|
||||
property int fontSize: 11
|
||||
property int height: 40
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject buttons: QtObject {
|
||||
property int maxWidth: 690
|
||||
property int height: 90
|
||||
property int maxWidth: 690
|
||||
property int spacing: 5
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit b5b5e00d49e000a84e69c473eb9cea7fdf5cab35
|
||||
Subproject commit 1d092f58ec8e04c617e2288577cbedfab7bf9e6a
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit b1ec18f963eca39cd8f4f8cac379b3c9598297e4
|
||||
Subproject commit a3fbb53b246b53f5c19a5a8a6a0b9f7947e9d970
|
||||
Loading…
Add table
Reference in a new issue