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);
conf->writeFromModel(mConferenceInfoModel);
conf->moveToThread(App::getInstance()->thread());
mConfInfoModelConnection->invokeToCore([this, conf]() mutable {
mConfInfoModelConnection->invokeToCore([this, conf]() {
this->reset(*conf);
conf->deleteLater();
});

View file

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

View file

@ -1252,3 +1252,6 @@ bool Utils::isUsername(const QString &txt) {
// bool Utils::isMe(const QString &address) {
// 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 isUsername(const QString &txt); // Regex check
static QString getCountryName(const QLocale::Territory &p_country);
Q_INVOKABLE static void useFetchConfig(const QString &configUrl);
static QString getApplicationProduct();
static QString getOsProduct();

View file

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

View file

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

View file

@ -1,13 +1,16 @@
import QtQuick 2.15
import QtQuick.Layouts 1.0
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as Control
import Linphone
import Linphone 1.0
import UtilsCpp 1.0
LoginLayout {
id: mainItem
property bool showBackButton: false
signal goBack()
signal useSIPButtonClicked()
signal useRemoteConfigButtonClicked()
signal goToRegister()
signal connectionSucceed()
@ -78,17 +81,27 @@ LoginLayout {
anchors.top: parent.top
anchors.leftMargin: 127 * DefaultStyle.dp
anchors.topMargin: 70 * DefaultStyle.dp
spacing: 39 * DefaultStyle.dp
spacing: 0
LoginForm {
id: loginForm
onConnectionSucceed: mainItem.connectionSucceed()
}
Button {
inversedColors: true
Layout.preferredWidth: 235 * DefaultStyle.dp
Layout.preferredWidth: loginForm.width
Layout.preferredHeight: 47 * DefaultStyle.dp
Layout.topMargin: 39 * DefaultStyle.dp
text: qsTr("Compte SIP tiers")
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 {
anchors.top: parent.top
@ -101,5 +114,35 @@ LoginLayout {
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 placeholders: '#CACACA' // No name in design
}