diff --git a/Linphone/core/conference/ConferenceInfoCore.cpp b/Linphone/core/conference/ConferenceInfoCore.cpp index c4ca68b3a..4e08eeb33 100644 --- a/Linphone/core/conference/ConferenceInfoCore.cpp +++ b/Linphone/core/conference/ConferenceInfoCore.cpp @@ -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(); }); diff --git a/Linphone/core/friend/FriendCore.cpp b/Linphone/core/friend/FriendCore.cpp index ed27e862e..5249d41d4 100644 --- a/Linphone/core/friend/FriendCore.cpp +++ b/Linphone/core/friend/FriendCore.cpp @@ -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(); }); diff --git a/Linphone/tool/Utils.cpp b/Linphone/tool/Utils.cpp index b70e31b7c..196602dbd 100644 --- a/Linphone/tool/Utils.cpp +++ b/Linphone/tool/Utils.cpp @@ -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()); +} diff --git a/Linphone/tool/Utils.hpp b/Linphone/tool/Utils.hpp index ec50b6955..23feaad70 100644 --- a/Linphone/tool/Utils.hpp +++ b/Linphone/tool/Utils.hpp @@ -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(); diff --git a/Linphone/view/Item/Dialog.qml b/Linphone/view/Item/Dialog.qml index 6ece8b261..ba68b6ff6 100644 --- a/Linphone/view/Item/Dialog.qml +++ b/Linphone/view/Item/Dialog.qml @@ -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() } } diff --git a/Linphone/view/Item/TextField.qml b/Linphone/view/Item/TextField.qml index 38053c519..dc195637a 100644 --- a/Linphone/view/Item/TextField.qml +++ b/Linphone/view/Item/TextField.qml @@ -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 diff --git a/Linphone/view/Page/Login/LoginPage.qml b/Linphone/view/Page/Login/LoginPage.qml index f720c3051..5aea98a53 100644 --- a/Linphone/view/Page/Login/LoginPage.qml +++ b/Linphone/view/Page/Login/LoginPage.qml @@ -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') + } + ] + } } diff --git a/Linphone/view/Style/DefaultStyle.qml b/Linphone/view/Style/DefaultStyle.qml index 99ba2108f..6d2dde2dd 100644 --- a/Linphone/view/Style/DefaultStyle.qml +++ b/Linphone/view/Style/DefaultStyle.qml @@ -44,4 +44,6 @@ QtObject { property color groupCallButtonColor: "#EEF7F8" + property color placeholders: '#CACACA' // No name in design + }