Remote provisioning + confirmation popup design

This commit is contained in:
Julien Wadel 2024-06-14 11:31:23 +02:00
parent 87b5315f54
commit ad38f3972e
8 changed files with 103 additions and 20 deletions

View file

@ -619,7 +619,7 @@ void ConferenceInfoCore::undo() {
ConferenceInfoCore *conf = new ConferenceInfoCore(*this); ConferenceInfoCore *conf = new ConferenceInfoCore(*this);
conf->writeFromModel(mConferenceInfoModel); conf->writeFromModel(mConferenceInfoModel);
conf->moveToThread(App::getInstance()->thread()); conf->moveToThread(App::getInstance()->thread());
mConfInfoModelConnection->invokeToCore([this, conf]() mutable { mConfInfoModelConnection->invokeToCore([this, conf]() {
this->reset(*conf); this->reset(*conf);
conf->deleteLater(); conf->deleteLater();
}); });

View file

@ -619,7 +619,7 @@ void FriendCore::undo() { // Retrieve values from model
FriendCore *contact = new FriendCore(*this); FriendCore *contact = new FriendCore(*this);
contact->writeFromModel(mFriendModel); contact->writeFromModel(mFriendModel);
contact->moveToThread(App::getInstance()->thread()); contact->moveToThread(App::getInstance()->thread());
mFriendModelConnection->invokeToCore([this, contact]() mutable { mFriendModelConnection->invokeToCore([this, contact]() {
this->reset(*contact); this->reset(*contact);
contact->deleteLater(); contact->deleteLater();
}); });

View file

@ -1252,3 +1252,6 @@ bool Utils::isUsername(const QString &txt) {
// bool Utils::isMe(const QString &address) { // bool Utils::isMe(const QString &address) {
// return !address.isEmpty() ? isMe(ToolModel::interpretUrl(address)) : false; // return !address.isEmpty() ? isMe(ToolModel::interpretUrl(address)) : false;
// } // }
void Utils::useFetchConfig(const QString &configUrl) {
App::getInstance()->receivedMessage(0, ("fetch-config=" + configUrl).toLocal8Bit());
}

View file

@ -113,6 +113,7 @@ public:
Q_INVOKABLE static bool isLocal(const QString &address); Q_INVOKABLE static bool isLocal(const QString &address);
Q_INVOKABLE static bool isUsername(const QString &txt); // Regex check Q_INVOKABLE static bool isUsername(const QString &txt); // Regex check
static QString getCountryName(const QLocale::Territory &p_country); static QString getCountryName(const QLocale::Territory &p_country);
Q_INVOKABLE static void useFetchConfig(const QString &configUrl);
static QString getApplicationProduct(); static QString getApplicationProduct();
static QString getOsProduct(); static QString getOsProduct();

View file

@ -17,8 +17,14 @@ Popup {
property color underlineColor: DefaultStyle.main1_500_main property color underlineColor: DefaultStyle.main1_500_main
property alias buttons: buttonsLayout.data property alias buttons: buttonsLayout.data
property alias content: contentLayout.data property alias content: contentLayout.data
property string title
property string text property string text
property string details property string details
property alias firstButton: firstButtonId
property alias secondButton: secondButtonId
property bool firstButtonAccept: true
property bool secondButtonAccept: false
signal accepted() signal accepted()
signal rejected() signal rejected()
@ -54,18 +60,30 @@ Popup {
contentItem: ColumnLayout { contentItem: ColumnLayout {
spacing: 20 * DefaultStyle.dp spacing: 20 * DefaultStyle.dp
Text{
ColumnLayout { id: titleText
id: contentLayout
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true visible: text.length != 0
Layout.alignment: Qt.AlignHCenter text: mainItem.title
font {
pixelSize: 16 * DefaultStyle.dp
weight: 800 * DefaultStyle.dp
}
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignLeft
} }
Rectangle{
Layout.fillWidth: true
Layout.preferredHeight: 1
color: DefaultStyle.main2_400
visible: titleText.visible
}
Text { Text {
id: defaultText id: defaultText
visible: text.length != 0 visible: text.length != 0
width: parent.width Layout.fillWidth: true
Layout.preferredWidth: 278 * DefaultStyle.dp //Layout.preferredWidth: 278 * DefaultStyle.dp
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
text: mainItem.text text: mainItem.text
font { font {
@ -73,13 +91,13 @@ Popup {
weight: 400 * DefaultStyle.dp weight: 400 * DefaultStyle.dp
} }
wrapMode: Text.Wrap wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter horizontalAlignment: titleText.visible ? Text.AlignLeft : Text.AlignHCenter
} }
Text { Text {
id: detailsText id: detailsText
visible: text.length != 0 visible: text.length != 0
width: parent.width Layout.fillWidth: true
Layout.preferredWidth: 278 * DefaultStyle.dp //Layout.preferredWidth: 278 * DefaultStyle.dp
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
text: mainItem.details text: mainItem.details
font { font {
@ -91,14 +109,22 @@ Popup {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
ColumnLayout {
id: contentLayout
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter
}
RowLayout { RowLayout {
id: buttonsLayout id: buttonsLayout
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom Layout.alignment: Qt.AlignBottom | ( titleText.visible ? Qt.AlignRight : Qt.AlignHCenter)
spacing: 10 * DefaultStyle.dp spacing: 10 * DefaultStyle.dp
// Default buttons only visible if no other children // Default buttons only visible if no other children
// have been set // have been set
Button { Button {
id:firstButtonId
visible: mainItem.buttons.length === 2 visible: mainItem.buttons.length === 2
text: qsTr("Oui") text: qsTr("Oui")
leftPadding: 20 * DefaultStyle.dp leftPadding: 20 * DefaultStyle.dp
@ -106,11 +132,15 @@ Popup {
topPadding: 11 * DefaultStyle.dp topPadding: 11 * DefaultStyle.dp
bottomPadding: 11 * DefaultStyle.dp bottomPadding: 11 * DefaultStyle.dp
onClicked: { onClicked: {
mainItem.accepted() if(firstButtonAccept)
mainItem.accepted()
else
mainItem.rejected()
mainItem.close() mainItem.close()
} }
} }
Button { Button {
id: secondButtonId
visible: mainItem.buttons.length === 2 visible: mainItem.buttons.length === 2
text: qsTr("Non") text: qsTr("Non")
leftPadding: 20 * DefaultStyle.dp leftPadding: 20 * DefaultStyle.dp
@ -118,7 +148,10 @@ Popup {
topPadding: 11 * DefaultStyle.dp topPadding: 11 * DefaultStyle.dp
bottomPadding: 11 * DefaultStyle.dp bottomPadding: 11 * DefaultStyle.dp
onClicked: { onClicked: {
mainItem.rejected() if(secondButtonAccept)
mainItem.accepted()
else
mainItem.rejected()
mainItem.close() mainItem.close()
} }
} }

View file

@ -12,6 +12,7 @@ Control.TextField {
echoMode: (hidden && !eyeButton.checked) ? TextInput.Password : TextInput.Normal echoMode: (hidden && !eyeButton.checked) ? TextInput.Password : TextInput.Normal
verticalAlignment: TextInput.AlignVCenter verticalAlignment: TextInput.AlignVCenter
color: DefaultStyle.main2_600 color: DefaultStyle.main2_600
placeholderTextColor: DefaultStyle.placeholders
font { font {
family: DefaultStyle.defaultFont family: DefaultStyle.defaultFont
pixelSize: 14 * DefaultStyle.dp pixelSize: 14 * DefaultStyle.dp

View file

@ -1,13 +1,16 @@
import QtQuick 2.15 import QtQuick
import QtQuick.Layouts 1.0 import QtQuick.Layouts
import QtQuick.Controls as Control import QtQuick.Controls as Control
import Linphone
import Linphone 1.0
import UtilsCpp 1.0
LoginLayout { LoginLayout {
id: mainItem id: mainItem
property bool showBackButton: false property bool showBackButton: false
signal goBack() signal goBack()
signal useSIPButtonClicked() signal useSIPButtonClicked()
signal useRemoteConfigButtonClicked()
signal goToRegister() signal goToRegister()
signal connectionSucceed() signal connectionSucceed()
@ -78,17 +81,27 @@ LoginLayout {
anchors.top: parent.top anchors.top: parent.top
anchors.leftMargin: 127 * DefaultStyle.dp anchors.leftMargin: 127 * DefaultStyle.dp
anchors.topMargin: 70 * DefaultStyle.dp anchors.topMargin: 70 * DefaultStyle.dp
spacing: 39 * DefaultStyle.dp spacing: 0
LoginForm { LoginForm {
id: loginForm
onConnectionSucceed: mainItem.connectionSucceed() onConnectionSucceed: mainItem.connectionSucceed()
} }
Button { Button {
inversedColors: true inversedColors: true
Layout.preferredWidth: 235 * DefaultStyle.dp Layout.preferredWidth: loginForm.width
Layout.preferredHeight: 47 * DefaultStyle.dp Layout.preferredHeight: 47 * DefaultStyle.dp
Layout.topMargin: 39 * DefaultStyle.dp
text: qsTr("Compte SIP tiers") text: qsTr("Compte SIP tiers")
onClicked: {mainItem.useSIPButtonClicked()} onClicked: {mainItem.useSIPButtonClicked()}
} }
Button {
inversedColors: true
Layout.preferredWidth: loginForm.width
Layout.preferredHeight: 47 * DefaultStyle.dp
Layout.topMargin: 25 * DefaultStyle.dp
text: qsTr("Configuration distante")
onClicked: {fetchConfigDialog.open()}
}
}, },
Image { Image {
anchors.top: parent.top anchors.top: parent.top
@ -101,5 +114,35 @@ LoginLayout {
source: AppIcons.loginImage source: AppIcons.loginImage
} }
] ]
Dialog{
id: fetchConfigDialog
height: 315 * DefaultStyle.dp
width: 637 * DefaultStyle.dp
leftPadding: 33 * DefaultStyle.dp
rightPadding: 33 * DefaultStyle.dp
topPadding: 41 * DefaultStyle.dp
bottomPadding: 29 * DefaultStyle.dp
radius: 0
title: qsTr('Télécharger une configuration distante')
text: qsTr('Veuillez entrer le lien de configuration qui vous a été fourni :')
firstButton.text: 'Annuler'
firstButtonAccept: false
firstButton.inversedColors: true
secondButton.text: 'Valider'
secondButtonAccept: true
onAccepted:{
UtilsCpp.useFetchConfig(configUrl.text)
}
content:[
TextField{
id: configUrl
Layout.fillWidth: true
Layout.preferredHeight: 49 * DefaultStyle.dp
placeholderText: qsTr('Lien de configuration distante')
}
]
}
} }

View file

@ -44,4 +44,6 @@ QtObject {
property color groupCallButtonColor: "#EEF7F8" property color groupCallButtonColor: "#EEF7F8"
property color placeholders: '#CACACA' // No name in design
} }