From 5b267c9a463954224cfdbf3190bdfda737e4544c Mon Sep 17 00:00:00 2001 From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com> Date: Tue, 21 Sep 2021 15:38:30 -0400 Subject: [PATCH] dialog: use popup dialogs to replace the existing Qt.labs.platform ones Dialog in Qt.labs.platform which is used to be native in Qt 5.15 cannnot be accessed in Qt 6.2 for now, use popup dialogs instead 1. Add tittle 2. DropShadow revisit 3. Dim properly Change-Id: I8804ae0c30e3450c9a800d9a1c3946ff0bf44b46 --- qml.qrc | 3 +- src/DaemonReconnectWindow.qml | 11 - src/MainApplicationWindow.qml | 11 - src/commoncomponents/BaseDialog.qml | 26 - .../{ModalPopup.qml => BaseModalDialog.qml} | 61 ++- src/commoncomponents/DaemonReconnectPopup.qml | 102 ++-- src/commoncomponents/DeleteAccountDialog.qml | 187 ++++--- src/commoncomponents/PasswordDialog.qml | 258 +++++----- src/commoncomponents/SimpleMessageDialog.qml | 153 +++--- src/constant/JamiStrings.qml | 1 + src/constant/JamiTheme.qml | 3 + src/mainview/components/AboutPopUp.qml | 308 ++++++------ src/mainview/components/UserProfile.qml | 17 +- .../components/WelcomePageQrDialog.qml | 29 +- .../components/CurrentAccountSettings.qml | 2 +- .../components/LinkDeviceDialog.qml | 463 +++++++++--------- src/settingsview/components/LinkedDevices.qml | 6 +- .../components/NameRegistrationDialog.qml | 325 ++++++------ .../components/RevokeDevicePasswordDialog.qml | 137 +++--- src/wizardview/components/BackupKeyPage.qml | 8 +- 20 files changed, 1037 insertions(+), 1074 deletions(-) delete mode 100644 src/commoncomponents/BaseDialog.qml rename src/commoncomponents/{ModalPopup.qml => BaseModalDialog.qml} (56%) diff --git a/qml.qrc b/qml.qrc index b096a67f7..1718e8d4f 100644 --- a/qml.qrc +++ b/qml.qrc @@ -21,8 +21,7 @@ <file>src/commoncomponents/UsernameLineEdit.qml</file> <file>src/commoncomponents/Scaffold.qml</file> <file>src/commoncomponents/LineEditContextMenu.qml</file> - <file>src/commoncomponents/BaseDialog.qml</file> - <file>src/commoncomponents/ModalPopup.qml</file> + <file>src/commoncomponents/BaseModalDialog.qml</file> <file>src/commoncomponents/SimpleMessageDialog.qml</file> <file>src/commoncomponents/ResponsiveImage.qml</file> <file>src/commoncomponents/PresenceIndicator.qml</file> diff --git a/src/DaemonReconnectWindow.qml b/src/DaemonReconnectWindow.qml index 9890ba288..30df00b2d 100644 --- a/src/DaemonReconnectWindow.qml +++ b/src/DaemonReconnectWindow.qml @@ -198,17 +198,6 @@ ApplicationWindow { } } - Overlay.modal: ColorOverlay { - source: root.contentItem - color: "transparent" - - // Color animation for overlay when pop up is shown. - ColorAnimation on color { - to: Qt.rgba(0, 0, 0, 0.33) - duration: 500 - } - } - Component.onCompleted: { DBusErrorHandler.setActive(true) diff --git a/src/MainApplicationWindow.qml b/src/MainApplicationWindow.qml index 5efde1979..85e19cf72 100644 --- a/src/MainApplicationWindow.qml +++ b/src/MainApplicationWindow.qml @@ -202,17 +202,6 @@ ApplicationWindow { } } - Overlay.modal: ColorOverlay { - source: root.contentItem - color: "transparent" - - // Color animation for overlay when pop up is shown. - ColorAnimation on color { - to: Qt.rgba(0, 0, 0, 0.33) - duration: 500 - } - } - onClosing: root.close() onScreenChanged: JamiQmlUtils.mainApplicationScreen = root.screen diff --git a/src/commoncomponents/BaseDialog.qml b/src/commoncomponents/BaseDialog.qml deleted file mode 100644 index fba277166..000000000 --- a/src/commoncomponents/BaseDialog.qml +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2020 by Savoir-faire Linux - * Author: Albert Babà <albert.babi@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -import QtQuick -import QtQuick.Controls - -Dialog { - id: root - - visible: false -} diff --git a/src/commoncomponents/ModalPopup.qml b/src/commoncomponents/BaseModalDialog.qml similarity index 56% rename from src/commoncomponents/ModalPopup.qml rename to src/commoncomponents/BaseModalDialog.qml index fe8b64600..074c6855d 100644 --- a/src/commoncomponents/ModalPopup.qml +++ b/src/commoncomponents/BaseModalDialog.qml @@ -18,6 +18,7 @@ import QtQuick import QtQuick.Controls +import QtQuick.Layouts import Qt5Compat.GraphicalEffects import net.jami.Constants 1.1 @@ -28,6 +29,12 @@ Popup { // convient access to closePolicy property bool autoClose: true property alias backgroundColor: container.color + property alias title: titleText.text + property var popupContentLoader: containerSubContentLoader + property alias popupContentLoadStatus: containerSubContentLoader.status + property alias popupContent: containerSubContentLoader.sourceComponent + property int popupContentPreferredHeight: 0 + property int popupContentPreferredWidth: 0 parent: Overlay.overlay @@ -37,20 +44,64 @@ Popup { modal: true + padding: 0 + // A popup is invisible until opened. visible: false closePolicy: autoClose ? (Popup.CloseOnEscape | Popup.CloseOnPressOutside) : Popup.NoAutoClose - padding: 0 - - background: Rectangle { + Rectangle { id: container + anchors.fill: parent + + ColumnLayout { + anchors.fill: parent + + spacing: 0 + + Text { + id: titleText + + Layout.alignment: Qt.AlignTop | Qt.AlignLeft + Layout.margins: text.length === 0 ? 0 : 10 + + Layout.preferredHeight: text.length === 0 ? 0 : contentHeight + + font.pointSize: 12 + color: JamiTheme.textColor + } + + Loader { + id: containerSubContentLoader + + Layout.alignment: Qt.AlignCenter + + Layout.fillWidth: popupContentPreferredWidth === 0 + Layout.fillHeight: popupContentPreferredHeight === 0 + Layout.preferredHeight: popupContentPreferredHeight + Layout.preferredWidth: popupContentPreferredWidth + } + } + radius: JamiTheme.modalPopupRadius - width: root.width - height: root.height + color: JamiTheme.secondaryBackgroundColor + } + + background: Rectangle { + color: JamiTheme.transparentColor + } + + Overlay.modal: Rectangle { + color: JamiTheme.transparentColor + + // Color animation for overlay when pop up is shown. + ColorAnimation on color { + to: JamiTheme.popupOverlayColor + duration: 500 + } } DropShadow { diff --git a/src/commoncomponents/DaemonReconnectPopup.qml b/src/commoncomponents/DaemonReconnectPopup.qml index 8753fd190..eb592fb87 100644 --- a/src/commoncomponents/DaemonReconnectPopup.qml +++ b/src/commoncomponents/DaemonReconnectPopup.qml @@ -23,7 +23,7 @@ import QtQuick.Layouts import net.jami.Constants 1.1 import net.jami.Models 1.1 -ModalPopup { +BaseModalDialog { id: root property bool connectionFailed: false @@ -31,73 +31,69 @@ ModalPopup { autoClose: false - contentItem: Rectangle { - id: contentRect - - implicitHeight: daemonReconnectPopupColumnLayout.implicitHeight + 50 - - color: JamiTheme.secondaryBackgroundColor - - ColumnLayout { - id: daemonReconnectPopupColumnLayout - - anchors.fill: parent + onPopupContentLoadStatusChanged: { + if (popupContentLoadStatus === Loader.Ready) { + root.height = Qt.binding(function() { + return popupContentLoader.item.implicitHeight + 50 + }) + root.width = Qt.binding(function() { + return popupContentLoader.item.implicitWidth + 50 + }) + } + } - spacing: 0 + popupContent: ColumnLayout { + id: daemonReconnectPopupColumnLayout - Text { - id: daemonReconnectPopupTextLabel + spacing: 0 - Layout.alignment: Qt.AlignHCenter | Qt.AlignTop - Layout.topMargin: preferredMargin + Text { + id: daemonReconnectPopupTextLabel - text: connectionFailed ? JamiStrings.reconnectionFailed : - JamiStrings.reconnectDaemon - font.pointSize: JamiTheme.textFontSize + 2 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: JamiTheme.textColor + Layout.alignment: Qt.AlignHCenter | Qt.AlignTop + Layout.topMargin: preferredMargin - Component.onCompleted: { - contentRect.implicitWidth = JamiQmlUtils.getTextBoundingRect( - font, text).width + 100 - } - } + text: connectionFailed ? JamiStrings.reconnectionFailed : + JamiStrings.reconnectDaemon + font.pointSize: JamiTheme.textFontSize + 2 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: JamiTheme.textColor + } - AnimatedImage { - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - Layout.preferredHeight: 30 - Layout.preferredWidth: 30 - Layout.bottomMargin: preferredMargin + AnimatedImage { + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.preferredHeight: 30 + Layout.preferredWidth: 30 + Layout.bottomMargin: preferredMargin - visible: !connectionFailed + visible: !connectionFailed - source: JamiResources.jami_rolling_spinner_gif + source: JamiResources.jami_rolling_spinner_gif - playing: true - paused: false - mipmap: true - smooth: true - fillMode: Image.PreserveAspectFit - } + playing: true + paused: false + mipmap: true + smooth: true + fillMode: Image.PreserveAspectFit + } - MaterialButton { - id: btnOk + MaterialButton { + id: btnOk - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - preferredWidth: JamiTheme.preferredFieldWidth / 2 + preferredWidth: JamiTheme.preferredFieldWidth / 2 - visible: connectionFailed + visible: connectionFailed - text: qsTr("Ok") - color: JamiTheme.buttonTintedBlue - hoveredColor: JamiTheme.buttonTintedBlueHovered - pressedColor: JamiTheme.buttonTintedBluePressed - outlined: true + text: JamiStrings.optionOk + color: JamiTheme.buttonTintedBlue + hoveredColor: JamiTheme.buttonTintedBlueHovered + pressedColor: JamiTheme.buttonTintedBluePressed + outlined: true - onClicked: Qt.quit() - } + onClicked: Qt.quit() } } } diff --git a/src/commoncomponents/DeleteAccountDialog.qml b/src/commoncomponents/DeleteAccountDialog.qml index d908b8d68..5e1bf6b49 100644 --- a/src/commoncomponents/DeleteAccountDialog.qml +++ b/src/commoncomponents/DeleteAccountDialog.qml @@ -26,7 +26,7 @@ import net.jami.Constants 1.1 import "../commoncomponents" -BaseDialog { +BaseModalDialog { id: root property bool isSIP: { @@ -42,140 +42,131 @@ BaseDialog { title: JamiStrings.deleteAccount - contentItem: Rectangle { - id: deleteAccountContentRect + width: JamiTheme.preferredDialogWidth + height: JamiTheme.preferredDialogHeight - implicitWidth: JamiTheme.preferredDialogWidth - implicitHeight: JamiTheme.preferredDialogHeight - color: JamiTheme.secondaryBackgroundColor + popupContent: ColumnLayout { + id: deleteAccountContentColumnLayout - ColumnLayout { - anchors.centerIn: parent - anchors.fill: parent - anchors.margins: JamiTheme.preferredMarginSize + Label { + id: labelDeletion - Label { - id: labelDeletion + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: deleteAccountContentColumnLayout.width - + JamiTheme.preferredMarginSize * 2 - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: deleteAccountContentRect.width - - JamiTheme.preferredMarginSize * 2 - - color: JamiTheme.textColor - text: JamiStrings.confirmDeleteQuestion + color: JamiTheme.textColor + text: JamiStrings.confirmDeleteQuestion - font.pointSize: JamiTheme.textFontSize - font.kerning: true + font.pointSize: JamiTheme.textFontSize + font.kerning: true - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.Wrap - } + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + wrapMode: Text.Wrap + } - Label { - id: labelBestId + Label { + id: labelBestId - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: deleteAccountContentRect.width - - JamiTheme.preferredMarginSize * 2 + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: deleteAccountContentColumnLayout.width - + JamiTheme.preferredMarginSize * 2 - color: JamiTheme.textColor - text: CurrentAccount.bestName + color: JamiTheme.textColor + text: CurrentAccount.bestName - font.pointSize: JamiTheme.textFontSize - font.kerning: true - font.bold: true + font.pointSize: JamiTheme.textFontSize + font.kerning: true + font.bold: true - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.Wrap - } + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + wrapMode: Text.Wrap + } - Label { - id: labelAccountHash + Label { + id: labelAccountHash - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: deleteAccountContentRect.width - - JamiTheme.preferredMarginSize * 2 + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: deleteAccountContentColumnLayout.width - + JamiTheme.preferredMarginSize * 2 - color: JamiTheme.textColor - text: CurrentAccount.uri + color: JamiTheme.textColor + text: CurrentAccount.uri - font.pointSize: JamiTheme.textFontSize - font.kerning: true + font.pointSize: JamiTheme.textFontSize + font.kerning: true - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.Wrap - } + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + wrapMode: Text.Wrap + } - Label { - id: labelWarning + Label { + id: labelWarning - visible: !isSIP + visible: !isSIP - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: deleteAccountContentRect.width - - JamiTheme.preferredMarginSize * 2 + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: deleteAccountContentColumnLayout.width - + JamiTheme.preferredMarginSize * 2 - text: JamiStrings.deleteAccountInfos + text: JamiStrings.deleteAccountInfos - font.pointSize: JamiTheme.textFontSize - font.kerning: true + font.pointSize: JamiTheme.textFontSize + font.kerning: true - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.Wrap + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + wrapMode: Text.Wrap - color: "red" - } + color: JamiTheme.redColor + } - RowLayout { - spacing: 16 - Layout.fillWidth: true - Layout.alignment: Qt.AlignCenter + RowLayout { + spacing: 16 + Layout.fillWidth: true + Layout.alignment: Qt.AlignCenter - MaterialButton { - id: btnDelete + MaterialButton { + id: btnDelete - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 + preferredHeight: JamiTheme.preferredFieldHeight - color: JamiTheme.buttonTintedRed - hoveredColor: JamiTheme.buttonTintedRedHovered - pressedColor: JamiTheme.buttonTintedRedPressed - outlined: true + color: JamiTheme.buttonTintedRed + hoveredColor: JamiTheme.buttonTintedRedHovered + pressedColor: JamiTheme.buttonTintedRedPressed + outlined: true - text: qsTr("Delete") + text: JamiStrings.optionDelete - onClicked: { - AccountAdapter.deleteCurrentAccount() - accepted() - close() - } + onClicked: { + AccountAdapter.deleteCurrentAccount() + accepted() + close() } + } - MaterialButton { - id: btnCancel + MaterialButton { + id: btnCancel - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 + preferredHeight: JamiTheme.preferredFieldHeight - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - outlined: true + color: JamiTheme.buttonTintedBlack + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + outlined: true - text: qsTr("Cancel") + text: JamiStrings.optionCancel - onClicked: { - close() - } - } + onClicked: close() } } } diff --git a/src/commoncomponents/PasswordDialog.qml b/src/commoncomponents/PasswordDialog.qml index 97b680533..871beb0e4 100644 --- a/src/commoncomponents/PasswordDialog.qml +++ b/src/commoncomponents/PasswordDialog.qml @@ -23,7 +23,7 @@ import net.jami.Adapters 1.1 import net.jami.Constants 1.1 // PasswordDialog for changing password and exporting account -BaseDialog { +BaseModalDialog { id: root enum PasswordEnteringPurpose { @@ -40,52 +40,12 @@ BaseDialog { function openDialog(purposeIn, exportPathIn = "") { purpose = purposeIn path = exportPathIn - currentPasswordEdit.clear() - passwordEdit.clear() - confirmPasswordEdit.clear() - validatePassword() - open() - } - - function validatePassword() { - switch (purpose) { - case PasswordDialog.ExportAccount: - btnConfirm.enabled = currentPasswordEdit.length > 0 - break - case PasswordDialog.SetPassword: - btnConfirm.enabled = passwordEdit.length > 0 && - passwordEdit.text === confirmPasswordEdit.text - break - default: - btnConfirm.enabled = currentPasswordEdit.length > 0 && - passwordEdit.text === confirmPasswordEdit.text - } - } - function exportAccountQML() { - var success = false - if (path.length > 0) { - success = AccountAdapter.exportToFile( - LRCInstance.currentAccountId, - path, - currentPasswordEdit.text) - } - doneSignal(success, purpose) - close() + open() } - function savePasswordQML() { - var success = false - success = AccountAdapter.savePassword( - LRCInstance.currentAccountId, - currentPasswordEdit.text, - passwordEdit.text) - if (success) { - AccountAdapter.setArchiveHasPassword(passwordEdit.text.length !== 0) - } - doneSignal(success, purpose) - close() - } + height: JamiTheme.preferredDialogHeight + width: JamiTheme.preferredDialogWidth title: { switch(purpose){ @@ -98,131 +58,161 @@ BaseDialog { } } - Timer { - id: timerToOperate + popupContent: ColumnLayout { + id: popupContentColumnLayout + + spacing: 0 + + function validatePassword() { + switch (purpose) { + case PasswordDialog.ExportAccount: + btnConfirm.enabled = currentPasswordEdit.length > 0 + break + case PasswordDialog.SetPassword: + btnConfirm.enabled = passwordEdit.length > 0 && + passwordEdit.text === confirmPasswordEdit.text + break + default: + btnConfirm.enabled = currentPasswordEdit.length > 0 && + passwordEdit.text === confirmPasswordEdit.text + } + } - interval: 200 - repeat: false + function exportAccountQML() { + var success = false + if (path.length > 0) { + success = AccountAdapter.exportToFile( + LRCInstance.currentAccountId, + path, + currentPasswordEdit.text) + } + doneSignal(success, purpose) + close() + } - onTriggered: { - if (purpose === PasswordDialog.ExportAccount) { - exportAccountQML() - } else { - savePasswordQML() + function savePasswordQML() { + var success = false + success = AccountAdapter.savePassword( + LRCInstance.currentAccountId, + currentPasswordEdit.text, + passwordEdit.text) + if (success) { + AccountAdapter.setArchiveHasPassword(passwordEdit.text.length !== 0) } + doneSignal(success, purpose) + close() } - } - contentItem: Rectangle { - id: passwordDialogContentRect + onVisibleChanged: validatePassword() - implicitWidth: JamiTheme.preferredDialogWidth - implicitHeight: JamiTheme.preferredDialogHeight - color: JamiTheme.secondaryBackgroundColor + Timer { + id: timerToOperate - ColumnLayout { - anchors.centerIn: parent - anchors.fill: parent - anchors.margins: JamiTheme.preferredMarginSize + interval: 200 + repeat: false - MaterialLineEdit { - id: currentPasswordEdit + onTriggered: { + if (purpose === PasswordDialog.ExportAccount) { + popupContentColumnLayout.exportAccountQML() + } else { + popupContentColumnLayout.savePasswordQML() + } + } + } - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: JamiTheme.preferredFieldWidth - Layout.preferredHeight: visible ? 48 : 0 + MaterialLineEdit { + id: currentPasswordEdit - visible: purpose === PasswordDialog.ChangePassword || - purpose === PasswordDialog.ExportAccount - echoMode: TextInput.Password - placeholderText: JamiStrings.enterCurrentPassword + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: JamiTheme.preferredFieldWidth + Layout.preferredHeight: visible ? 48 : 0 - onTextChanged: { - validatePassword() - } - } + visible: purpose === PasswordDialog.ChangePassword || + purpose === PasswordDialog.ExportAccount + echoMode: TextInput.Password + placeholderText: JamiStrings.enterCurrentPassword - MaterialLineEdit { - id: passwordEdit + onVisibleChanged: clear() - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: JamiTheme.preferredFieldWidth - Layout.preferredHeight: visible ? 48 : 0 + onTextChanged: popupContentColumnLayout.validatePassword() + } - visible: purpose === PasswordDialog.ChangePassword || - purpose === PasswordDialog.SetPassword - echoMode: TextInput.Password + MaterialLineEdit { + id: passwordEdit - placeholderText: JamiStrings.enterNewPassword + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: JamiTheme.preferredFieldWidth + Layout.preferredHeight: visible ? 48 : 0 - onTextChanged: { - validatePassword() - } - } + visible: purpose === PasswordDialog.ChangePassword || + purpose === PasswordDialog.SetPassword + echoMode: TextInput.Password + placeholderText: JamiStrings.enterNewPassword - MaterialLineEdit { - id: confirmPasswordEdit + onVisibleChanged: clear() - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: JamiTheme.preferredFieldWidth - Layout.preferredHeight: visible ? 48 : 0 + onTextChanged: popupContentColumnLayout.validatePassword() + } - visible: purpose === PasswordDialog.ChangePassword || - purpose === PasswordDialog.SetPassword - echoMode: TextInput.Password + MaterialLineEdit { + id: confirmPasswordEdit - placeholderText: JamiStrings.confirmNewPassword + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: JamiTheme.preferredFieldWidth + Layout.preferredHeight: visible ? 48 : 0 - onTextChanged: { - validatePassword() - } - } + visible: purpose === PasswordDialog.ChangePassword || + purpose === PasswordDialog.SetPassword + echoMode: TextInput.Password + placeholderText: JamiStrings.confirmNewPassword - RowLayout { - spacing: 16 - Layout.fillWidth: true - Layout.alignment: Qt.AlignCenter + onVisibleChanged: clear() - MaterialButton { - id: btnConfirm + onTextChanged: popupContentColumnLayout.validatePassword() + } - Layout.alignment: Qt.AlignHCenter + RowLayout { + spacing: 16 + Layout.fillWidth: true + Layout.alignment: Qt.AlignCenter - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 + MaterialButton { + id: btnConfirm + + Layout.alignment: Qt.AlignHCenter - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - outlined: true - enabled: purpose === PasswordDialog.SetPassword + preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - text: (purpose === PasswordDialog.ExportAccount) ? JamiStrings.exportAccount : - JamiStrings.change + color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + outlined: true + enabled: purpose === PasswordDialog.SetPassword - onClicked: { - btnConfirm.enabled = false - timerToOperate.restart() - } + text: (purpose === PasswordDialog.ExportAccount) ? JamiStrings.exportAccount : + JamiStrings.change + + onClicked: { + btnConfirm.enabled = false + timerToOperate.restart() } + } - MaterialButton { - id: btnCancel + MaterialButton { + id: btnCancel - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 + preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - outlined: true + color: JamiTheme.buttonTintedBlack + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + outlined: true - text: qsTr("Cancel") + text: JamiStrings.optionCancel - onClicked: { - close() - } - } + onClicked: close() } } } diff --git a/src/commoncomponents/SimpleMessageDialog.qml b/src/commoncomponents/SimpleMessageDialog.qml index 80c710f35..c848ddbe2 100644 --- a/src/commoncomponents/SimpleMessageDialog.qml +++ b/src/commoncomponents/SimpleMessageDialog.qml @@ -23,7 +23,7 @@ import QtQuick.Layouts import net.jami.Adapters 1.1 import net.jami.Constants 1.1 -BaseDialog { +BaseModalDialog { id: root // TODO: make MaterialButton ButtonStyle @@ -36,8 +36,8 @@ BaseDialog { property var buttonTitles: [] property var buttonCallBacks: [] property var buttonStyles: [] - property alias infoText: infoText.text - property alias innerContentData: innerContent.data + property string infoText: "" + property var innerContentData: [] function openWithParameters(title, info = "") { root.title = title @@ -46,94 +46,89 @@ BaseDialog { open() } - contentItem: Rectangle { - id: container + width: Math.max(JamiTheme.preferredDialogWidth, + buttonTitles.length * (JamiTheme.preferredFieldWidth / 2 + + JamiTheme.preferredMarginSize)) + height: JamiTheme.preferredDialogHeight / 2 - JamiTheme.preferredMarginSize - implicitWidth: Math.max(JamiTheme.preferredDialogWidth, - buttonTitles.length * (JamiTheme.preferredFieldWidth / 2 - + JamiTheme.preferredMarginSize)) - implicitHeight: JamiTheme.preferredDialogHeight / 2 - JamiTheme.preferredMarginSize + popupContent: ColumnLayout { + Label { + id: infoTextLabel - color: JamiTheme.secondaryBackgroundColor + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: JamiTheme.preferredDialogWidth - JamiTheme.preferredMarginSize - ColumnLayout { - anchors.fill: parent - - Label { - id: infoText + text: infoText + font.pointSize: JamiTheme.menuFontSize - 2 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: JamiTheme.textColor + } - Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: JamiTheme.preferredDialogWidth - JamiTheme.preferredMarginSize - Layout.topMargin: JamiTheme.preferredMarginSize + Item { + id: innerContent - font.pointSize: JamiTheme.menuFontSize - 2 - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: JamiTheme.textColor - } + Layout.topMargin: JamiTheme.preferredMarginSize / 2 + Layout.fillWidth: true + Layout.fillHeight: true - Item { - id: innerContent - Layout.topMargin: JamiTheme.preferredMarginSize / 2 - Layout.fillWidth: true - Layout.fillHeight: true - } + data: innerContentData + } - RowLayout { - spacing: JamiTheme.preferredMarginSize - - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - Layout.bottomMargin: JamiTheme.preferredMarginSize - - Repeater { - model: buttonTitles.length - MaterialButton { - Layout.alignment: Qt.AlignVCenter - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - preferredHeight: JamiTheme.preferredFieldHeight - - color: { - switch(buttonStyles[modelData]) { - case SimpleMessageDialog.ButtonStyle.TintedBlue: - return JamiTheme.buttonTintedBlue - case SimpleMessageDialog.ButtonStyle.TintedBlack: - return JamiTheme.buttonTintedBlack - case SimpleMessageDialog.ButtonStyle.TintedRed: - return JamiTheme.buttonTintedRed - } + RowLayout { + spacing: JamiTheme.preferredMarginSize + + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: JamiTheme.preferredMarginSize + + Repeater { + model: buttonTitles.length + MaterialButton { + Layout.alignment: Qt.AlignVCenter + + preferredWidth: JamiTheme.preferredFieldWidth / 2 + preferredHeight: JamiTheme.preferredFieldHeight + + color: { + switch(buttonStyles[modelData]) { + case SimpleMessageDialog.ButtonStyle.TintedBlue: + return JamiTheme.buttonTintedBlue + case SimpleMessageDialog.ButtonStyle.TintedBlack: + return JamiTheme.buttonTintedBlack + case SimpleMessageDialog.ButtonStyle.TintedRed: + return JamiTheme.buttonTintedRed } - hoveredColor: { - switch(buttonStyles[modelData]) { - case SimpleMessageDialog.ButtonStyle.TintedBlue: - return JamiTheme.buttonTintedBlueHovered - case SimpleMessageDialog.ButtonStyle.TintedBlack: - return JamiTheme.buttonTintedBlackHovered - case SimpleMessageDialog.ButtonStyle.TintedRed: - return JamiTheme.buttonTintedRedHovered - } + } + hoveredColor: { + switch(buttonStyles[modelData]) { + case SimpleMessageDialog.ButtonStyle.TintedBlue: + return JamiTheme.buttonTintedBlueHovered + case SimpleMessageDialog.ButtonStyle.TintedBlack: + return JamiTheme.buttonTintedBlackHovered + case SimpleMessageDialog.ButtonStyle.TintedRed: + return JamiTheme.buttonTintedRedHovered } - pressedColor: { - switch(buttonStyles[modelData]) { - case SimpleMessageDialog.ButtonStyle.TintedBlue: - return JamiTheme.buttonTintedBluePressed - case SimpleMessageDialog.ButtonStyle.TintedBlack: - return JamiTheme.buttonTintedBlackPressed - case SimpleMessageDialog.ButtonStyle.TintedRed: - return JamiTheme.buttonTintedRedPressed - } + } + pressedColor: { + switch(buttonStyles[modelData]) { + case SimpleMessageDialog.ButtonStyle.TintedBlue: + return JamiTheme.buttonTintedBluePressed + case SimpleMessageDialog.ButtonStyle.TintedBlack: + return JamiTheme.buttonTintedBlackPressed + case SimpleMessageDialog.ButtonStyle.TintedRed: + return JamiTheme.buttonTintedRedPressed } - outlined: true + } + outlined: true - text: buttonTitles[modelData] + text: buttonTitles[modelData] - onClicked: { - if (buttonCallBacks[modelData]) - buttonCallBacks[modelData]() - close() - } + onClicked: { + if (buttonCallBacks[modelData]) + buttonCallBacks[modelData]() + close() } } } diff --git a/src/constant/JamiStrings.qml b/src/constant/JamiStrings.qml index 4029dd758..df49e8616 100644 --- a/src/constant/JamiStrings.qml +++ b/src/constant/JamiStrings.qml @@ -544,6 +544,7 @@ Item { property string optionCancel: qsTr("Cancel") property string optionUpgrade: qsTr("Upgrade") property string optionLater: qsTr("Later") + property string optionDelete: qsTr("Delete") // Conference moderation property string setModerator: qsTr("Set moderator") diff --git a/src/constant/JamiTheme.qml b/src/constant/JamiTheme.qml index 4d4a40302..fc71dea52 100644 --- a/src/constant/JamiTheme.qml +++ b/src/constant/JamiTheme.qml @@ -54,6 +54,8 @@ Item { property color editBackgroundColor: darkTheme ? "#373737" : lightGrey_ property color textColor: primaryForegroundColor property color tabbarBorderColor: darkTheme ? blackColor : "#e3e3e3" + property color popupOverlayColor: darkTheme ? Qt.rgba(255, 255, 255, 0.22) : + Qt.rgba(0, 0, 0, 0.33) // Side panel property color presenceGreen: "#4cd964" @@ -206,6 +208,7 @@ Item { property int smartListTransitionDuration: 120 // Sizes + property real qrCodeImageSize: 256 property real splitViewHandlePreferredWidth: 4 property real indicatorFontSize: 6 property real tinyFontSize: 7 diff --git a/src/mainview/components/AboutPopUp.qml b/src/mainview/components/AboutPopUp.qml index 6e2a3295b..73bd3f93f 100644 --- a/src/mainview/components/AboutPopUp.qml +++ b/src/mainview/components/AboutPopUp.qml @@ -26,221 +26,219 @@ import net.jami.Constants 1.1 import "../../commoncomponents" -ModalPopup { +BaseModalDialog { id: root - property alias preferredHeight: aboutPopUpContentRectColumnLayout.implicitHeight + property int preferredHeight: 0 - contentItem: Rectangle { - id: contentRect + width: 400 - implicitWidth: 400 - color: JamiTheme.backgroundColor - - JamiFlickable { - id: aboutPopUpScrollView + onPopupContentLoadStatusChanged: { + if (popupContentLoadStatus === Loader.Ready) + preferredHeight = Qt.binding(function() { + return popupContentLoader.item.contentHeight + }) + } - anchors.fill: parent + popupContent: JamiFlickable { + id: aboutPopUpScrollView - contentHeight: aboutPopUpContentRectColumnLayout.implicitHeight + contentHeight: aboutPopUpContentRectColumnLayout.implicitHeight - ColumnLayout { - id: aboutPopUpContentRectColumnLayout + ColumnLayout { + id: aboutPopUpContentRectColumnLayout - width: Math.max(root.width, implicitWidth) - height: Math.max(aboutPopUpScrollView.height, implicitHeight) + width: Math.max(root.width, implicitWidth) + height: Math.max(aboutPopUpScrollView.height, implicitHeight) - ResponsiveImage { - id: aboutPopUPJamiLogoImage + ResponsiveImage { + id: aboutPopUPJamiLogoImage - Layout.alignment: Qt.AlignCenter - Layout.topMargin: JamiTheme.preferredMarginSize - Layout.preferredWidth: 250 - Layout.preferredHeight: 88 + Layout.alignment: Qt.AlignCenter + Layout.topMargin: JamiTheme.preferredMarginSize + Layout.preferredWidth: 250 + Layout.preferredHeight: 88 - source: JamiTheme.darkTheme ? - JamiResources.logo_jami_standard_coul_white_svg : - JamiResources.logo_jami_standard_coul_svg - } + source: JamiTheme.darkTheme ? + JamiResources.logo_jami_standard_coul_white_svg : + JamiResources.logo_jami_standard_coul_svg + } - MaterialLineEdit { - id: jamiVersionText + MaterialLineEdit { + id: jamiVersionText - Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: contentRect.width + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: aboutPopUpScrollView.width - font.pointSize: JamiTheme.textFontSize + font.pointSize: JamiTheme.textFontSize - padding: 0 - readOnly: true - selectByMouse: true + padding: 0 + readOnly: true + selectByMouse: true - text: JamiStrings.version + ": " + UtilsAdapter.getVersionStr() - color: JamiTheme.textColor + text: JamiStrings.version + ": " + UtilsAdapter.getVersionStr() + color: JamiTheme.textColor - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } - Label { - id: jamiSlogansText + Label { + id: jamiSlogansText - Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: contentRect.width - Layout.preferredHeight: textMetricsjamiSlogansText.boundingRect.height - Layout.topMargin: 5 + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: aboutPopUpScrollView.width + Layout.preferredHeight: textMetricsjamiSlogansText.boundingRect.height + Layout.topMargin: 5 - wrapMode: Text.WordWrap - font.pointSize: JamiTheme.textFontSize + wrapMode: Text.WordWrap + font.pointSize: JamiTheme.textFontSize - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter - text: textMetricsjamiSlogansText.text - color: JamiTheme.textColor + text: textMetricsjamiSlogansText.text + color: JamiTheme.textColor - TextMetrics { - id: textMetricsjamiSlogansText - font: jamiSlogansText.font - text: JamiStrings.slogan - } + TextMetrics { + id: textMetricsjamiSlogansText + font: jamiSlogansText.font + text: JamiStrings.slogan } + } - Label { - id: jamiDeclarationText + Label { + id: jamiDeclarationText - Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: contentRect.width - Layout.preferredHeight: 40 - Layout.topMargin: 5 + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: aboutPopUpScrollView.width + Layout.preferredHeight: 40 + Layout.topMargin: 5 - wrapMode: Text.WordWrap - font.pointSize: JamiTheme.textFontSize - color: JamiTheme.textColor + wrapMode: Text.WordWrap + font.pointSize: JamiTheme.textFontSize + color: JamiTheme.textColor - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter - // TextMetrics does not work for multi-line. - text: JamiStrings.declaration - } + // TextMetrics does not work for multi-line. + text: JamiStrings.declaration + } - Label { - id: jamiDeclarationHyperText + Label { + id: jamiDeclarationHyperText - Layout.alignment: Qt.AlignCenter + Layout.alignment: Qt.AlignCenter - // Strangely, hoveredLink works badly when width grows too large - Layout.preferredWidth: 50 - Layout.preferredHeight: textMetricsjamiDeclarationHyperText.boundingRect.height - Layout.topMargin: 5 - Layout.bottomMargin: 5 - color: JamiTheme.textColor + // Strangely, hoveredLink works badly when width grows too large + Layout.preferredWidth: 50 + Layout.preferredHeight: textMetricsjamiDeclarationHyperText.boundingRect.height + Layout.topMargin: 5 + Layout.bottomMargin: 5 + color: JamiTheme.textColor - font.pointSize: JamiTheme.textFontSize - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter + font.pointSize: JamiTheme.textFontSize + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter - text: textMetricsjamiDeclarationHyperText.text - onLinkActivated: Qt.openUrlExternally(link) + text: textMetricsjamiDeclarationHyperText.text + onLinkActivated: Qt.openUrlExternally(link) - TextMetrics { - id: textMetricsjamiDeclarationHyperText - font: jamiDeclarationHyperText.font - text: '<html><style type="text/css"></style><a href="https://jami.net">jami.net</a></html>' - } + TextMetrics { + id: textMetricsjamiDeclarationHyperText + font: jamiDeclarationHyperText.font + text: '<html><style type="text/css"></style><a href="https://jami.net">jami.net</a></html>' + } - MouseArea { - anchors.fill: parent + MouseArea { + anchors.fill: parent - // We don't want to eat clicks on the Text. - acceptedButtons: Qt.NoButton - cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor - } + // We don't want to eat clicks on the Text. + acceptedButtons: Qt.NoButton + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor } + } - Label { - id: jamiDeclarationYearText + Label { + id: jamiDeclarationYearText - Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: contentRect.width - Layout.preferredHeight: textMetricsjamiDeclarationYearText.boundingRect.height - Layout.bottomMargin: 5 + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: aboutPopUpScrollView.width + Layout.preferredHeight: textMetricsjamiDeclarationYearText.boundingRect.height + Layout.bottomMargin: 5 - font.pointSize: JamiTheme.textFontSize - color: JamiTheme.textColor + font.pointSize: JamiTheme.textFontSize + color: JamiTheme.textColor - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter - text: textMetricsjamiDeclarationYearText.text + text: textMetricsjamiDeclarationYearText.text - TextMetrics { - id: textMetricsjamiDeclarationYearText - font: jamiDeclarationYearText.font - text: JamiStrings.companyDeclarationYear - } + TextMetrics { + id: textMetricsjamiDeclarationYearText + font: jamiDeclarationYearText.font + text: JamiStrings.companyDeclarationYear } + } - Label { - id: jamiNoneWarrantyHyperText + Label { + id: jamiNoneWarrantyHyperText - Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: 300 - Layout.preferredHeight: textMetricsjamiNoneWarrantyHyperText.boundingRect.height * 2 - Layout.bottomMargin: 10 + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: 300 + Layout.preferredHeight: textMetricsjamiNoneWarrantyHyperText.boundingRect.height * 2 + Layout.bottomMargin: 10 - wrapMode: Text.WordWrap - font.pointSize: JamiTheme.tinyFontSize + wrapMode: Text.WordWrap + font.pointSize: JamiTheme.tinyFontSize - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: JamiTheme.textColor + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: JamiTheme.textColor - text: textMetricsjamiNoneWarrantyHyperText.text - onLinkActivated: Qt.openUrlExternally(link) + text: textMetricsjamiNoneWarrantyHyperText.text + onLinkActivated: Qt.openUrlExternally(link) - TextMetrics { - id: textMetricsjamiNoneWarrantyHyperText - font: jamiDeclarationHyperText.font - text: '<html><style type="text/css"></style>This program comes with absolutely no warranty.<br\>See the <a href="http://www.gnu.org/licenses/gpl-3.0.html">GNU General Public License, version 3 or later</a> for details.</html>' - } + TextMetrics { + id: textMetricsjamiNoneWarrantyHyperText + font: jamiDeclarationHyperText.font + text: '<html><style type="text/css"></style>This program comes with absolutely no warranty.<br\>See the <a href="http://www.gnu.org/licenses/gpl-3.0.html">GNU General Public License, version 3 or later</a> for details.</html>' + } - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.NoButton - cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor - } + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor } + } - ProjectCreditsScrollView { - id: projectCreditsScrollView + ProjectCreditsScrollView { + id: projectCreditsScrollView - Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: contentRect.width - JamiTheme.preferredMarginSize * 2 - Layout.preferredHeight: 128 - Layout.margins: JamiTheme.preferredMarginSize - } + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: aboutPopUpScrollView.width - JamiTheme.preferredMarginSize * 2 + Layout.preferredHeight: 128 + Layout.margins: JamiTheme.preferredMarginSize + } - MaterialButton { - id: btnClose + MaterialButton { + id: btnClose - Layout.alignment: Qt.AlignHCenter - Layout.bottomMargin: JamiTheme.preferredMarginSize + Layout.alignment: Qt.AlignHCenter + Layout.bottomMargin: JamiTheme.preferredMarginSize - preferredWidth: JamiTheme.preferredFieldWidth / 2 - preferredHeight: JamiTheme.preferredFieldHeight + preferredWidth: JamiTheme.preferredFieldWidth / 2 + preferredHeight: JamiTheme.preferredFieldHeight - text: qsTr("Close") - color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - outlined: true + text: JamiStrings.close + color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + outlined: true - onClicked: { - close() - } - } + onClicked: close() } } } diff --git a/src/mainview/components/UserProfile.qml b/src/mainview/components/UserProfile.qml index 0a82fbd4d..9e3e795e1 100644 --- a/src/mainview/components/UserProfile.qml +++ b/src/mainview/components/UserProfile.qml @@ -24,7 +24,7 @@ import net.jami.Constants 1.1 import "../../commoncomponents" -BaseDialog { +BaseModalDialog { id: root property string convId @@ -35,13 +35,14 @@ BaseDialog { property int preferredImgSize: 80 - contentItem: Rectangle { - id: userProfileContentRect + width: 480 + height: 480 - implicitWidth: 480 - implicitHeight: 400 + popupContent: Rectangle { + id: userProfileContentRect color: JamiTheme.backgroundColor + radius: JamiTheme.modalPopupRadius GridLayout { id: userProfileDialogLayout @@ -143,7 +144,7 @@ BaseDialog { id: textMetricsContactDisplayNameText font: contactDisplayName.font text: registeredNameText - elideWidth: userProfileContentRect.width-200 + elideWidth: userProfileContentRect.width - 200 elide: Qt.ElideMiddle } } @@ -236,9 +237,7 @@ BaseDialog { text: JamiStrings.close - onClicked: { - close() - } + onClicked: close() } } } diff --git a/src/mainview/components/WelcomePageQrDialog.qml b/src/mainview/components/WelcomePageQrDialog.qml index 5efd84cb1..0e877fa01 100644 --- a/src/mainview/components/WelcomePageQrDialog.qml +++ b/src/mainview/components/WelcomePageQrDialog.qml @@ -19,33 +19,28 @@ import QtQuick import net.jami.Adapters 1.1 +import net.jami.Constants 1.1 import "../../commoncomponents" -ModalPopup { +BaseModalDialog { id: root - modal: true - //Content height + margin. - property int size: userQrImage.height + 30 + property int size: JamiTheme.qrCodeImageSize + 30 + width: size height: size - Item { - anchors.fill: parent - - Image { - id: userQrImage - - anchors.centerIn: parent + backgroundColor: JamiTheme.whiteColor - width: 256 - height: 256 - smooth: false + popupContentPreferredHeight: JamiTheme.qrCodeImageSize + popupContentPreferredWidth: JamiTheme.qrCodeImageSize + popupContent: Image { + id: userQrImage - fillMode: Image.PreserveAspectFit - source: "image://qrImage/account_" + CurrentAccount.id - } + smooth: false + fillMode: Image.PreserveAspectFit + source: "image://qrImage/account_" + CurrentAccount.id } } diff --git a/src/settingsview/components/CurrentAccountSettings.qml b/src/settingsview/components/CurrentAccountSettings.qml index d71b5cc32..636808d2e 100644 --- a/src/settingsview/components/CurrentAccountSettings.qml +++ b/src/settingsview/components/CurrentAccountSettings.qml @@ -101,7 +101,7 @@ Rectangle { PasswordDialog { id: passwordDialog - onDoneSignal: { + onDoneSignal: function (success, currentPurpose) { var title = success ? qsTr("Success") : qsTr("Error") var info diff --git a/src/settingsview/components/LinkDeviceDialog.qml b/src/settingsview/components/LinkDeviceDialog.qml index 1cdff81e3..224686951 100644 --- a/src/settingsview/components/LinkDeviceDialog.qml +++ b/src/settingsview/components/LinkDeviceDialog.qml @@ -27,329 +27,326 @@ import net.jami.Constants 1.1 import "../../commoncomponents" -BaseDialog { +BaseModalDialog { id: root signal accepted - function openLinkDeviceDialog() { - infoLabel.text = JamiStrings.pinTimerInfos - passwordEdit.clear() + title: JamiStrings.addDevice - open() + width: JamiTheme.preferredDialogWidth + height: JamiTheme.preferredDialogHeight - if(AccountAdapter.hasPassword()) { - stackedWidget.currentIndex = enterPasswordPage.pageIndex - passwordEdit.forceActiveFocus() - } else { - setGeneratingPage() - } - } + popupContent: StackLayout { + id: stackedWidget - function setGeneratingPage() { - if(passwordEdit.length === 0 && AccountAdapter.hasPassword()){ - setExportPage(NameDirectory.ExportOnRingStatus.WRONG_PASSWORD, "") - return - } + function setGeneratingPage() { + if(passwordEdit.length === 0 && AccountAdapter.hasPassword()){ + setExportPage(NameDirectory.ExportOnRingStatus.WRONG_PASSWORD, "") + return + } - stackedWidget.currentIndex = exportingSpinnerPage.pageIndex - spinnerMovie.playing = true + stackedWidget.currentIndex = exportingSpinnerPage.pageIndex + spinnerMovie.playing = true - timerForExport.restart() - } + timerForExport.restart() + } - function setExportPage(status, pin) { - if (status === NameDirectory.ExportOnRingStatus.SUCCESS) { - infoLabel.success = true - infoLabelsRowLayout.visible = true - infoLabel.text = JamiStrings.pinTimerInfos - exportedPIN.text = pin - } else { - infoLabel.success = false - infoLabelsRowLayout.visible = false - - switch(status) { - case NameDirectory.ExportOnRingStatus.WRONG_PASSWORD: - infoLabel.text = JamiStrings.incorrectPassword - break - case NameDirectory.ExportOnRingStatus.NETWORK_ERROR: - infoLabel.text = JamiStrings.linkDeviceNetWorkError - break - case NameDirectory.ExportOnRingStatus.INVALID: - infoLabel.text = JamiStrings.somethingWentWrong - break + function setExportPage(status, pin) { + if (status === NameDirectory.ExportOnRingStatus.SUCCESS) { + infoLabel.success = true + infoLabelsRowLayout.visible = true + infoLabel.text = JamiStrings.pinTimerInfos + exportedPIN.text = pin + } else { + infoLabel.success = false + infoLabelsRowLayout.visible = false + + switch(status) { + case NameDirectory.ExportOnRingStatus.WRONG_PASSWORD: + infoLabel.text = JamiStrings.incorrectPassword + break + case NameDirectory.ExportOnRingStatus.NETWORK_ERROR: + infoLabel.text = JamiStrings.linkDeviceNetWorkError + break + case NameDirectory.ExportOnRingStatus.INVALID: + infoLabel.text = JamiStrings.somethingWentWrong + break + } } + stackedWidget.currentIndex = exportingInfoPage.pageIndex } - stackedWidget.currentIndex = exportingInfoPage.pageIndex - } - title: JamiStrings.addDevice - - Timer{ - id: timerForExport + Timer{ + id: timerForExport - repeat: false - interval: 200 + repeat: false + interval: 200 - onTriggered: { - AccountAdapter.model.exportOnRing(LRCInstance.currentAccountId, - passwordEdit.text) + onTriggered: { + AccountAdapter.model.exportOnRing(LRCInstance.currentAccountId, + passwordEdit.text) + } } - } - Connections { - target: NameDirectory + Connections { + target: NameDirectory - function onExportOnRingEnded(status, pin) { - setExportPage(status, pin) + function onExportOnRingEnded(status, pin) { + stackedWidget.setExportPage(status, pin) + } } - } - contentItem: Rectangle { - id: linkDeviceContentRect + onVisibleChanged: { + if (visible) { + infoLabel.text = JamiStrings.pinTimerInfos + passwordEdit.clear() - color: JamiTheme.secondaryBackgroundColor - implicitWidth: JamiTheme.preferredDialogWidth - implicitHeight: JamiTheme.preferredDialogHeight - - StackLayout { - id: stackedWidget - - anchors.centerIn: parent - anchors.fill: parent - anchors.margins: JamiTheme.preferredMarginSize + if(AccountAdapter.hasPassword()) { + stackedWidget.currentIndex = enterPasswordPage.pageIndex + passwordEdit.forceActiveFocus() + } else { + setGeneratingPage() + } + } + } - // Index = 0 - Item { - id: enterPasswordPage + // Index = 0 + Item { + id: enterPasswordPage - readonly property int pageIndex: 0 + readonly property int pageIndex: 0 - ColumnLayout { - anchors.fill: parent + ColumnLayout { + anchors.fill: parent - spacing: 16 + spacing: 16 - Label { - Layout.alignment: Qt.AlignHCenter + Label { + Layout.alignment: Qt.AlignHCenter - text: JamiStrings.enterAccountPassword - color: JamiTheme.textColor - font.pointSize: JamiTheme.textFontSize - font.kerning: true - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - - MaterialLineEdit { - id: passwordEdit + text: JamiStrings.enterAccountPassword + color: JamiTheme.textColor + font.pointSize: JamiTheme.textFontSize + font.kerning: true + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } - Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: JamiTheme.preferredFieldWidth - Layout.preferredHeight: 48 + MaterialLineEdit { + id: passwordEdit - echoMode: TextInput.Password - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: JamiTheme.preferredFieldWidth + Layout.preferredHeight: 48 - placeholderText: JamiStrings.enterCurrentPassword + echoMode: TextInput.Password + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter - onTextChanged: { - btnConfirm.enabled = text.length > 0 - } + placeholderText: JamiStrings.enterCurrentPassword - onAccepted: btnConfirm.clicked() + onTextChanged: { + btnConfirm.enabled = text.length > 0 } - RowLayout { - Layout.alignment: Qt.AlignCenter - Layout.fillWidth: true - spacing: 16 + onAccepted: btnConfirm.clicked() + } - MaterialButton { - id: btnConfirm + RowLayout { + Layout.alignment: Qt.AlignCenter + Layout.fillWidth: true + spacing: 16 - Layout.alignment: Qt.AlignHCenter + MaterialButton { + id: btnConfirm - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + Layout.alignment: Qt.AlignHCenter - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - outlined: true - enabled: false + preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 + preferredHeight: JamiTheme.preferredFieldHeight - text: JamiStrings.exportAccount + color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + outlined: true + enabled: false - onClicked: setGeneratingPage() - } + text: JamiStrings.exportAccount - MaterialButton { - id: btnCancel + onClicked: stackedWidget.setGeneratingPage() + } - Layout.alignment: Qt.AlignHCenter + MaterialButton { + id: btnCancel - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + Layout.alignment: Qt.AlignHCenter - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - outlined: true - enabled: true + preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 + preferredHeight: JamiTheme.preferredFieldHeight + + color: JamiTheme.buttonTintedBlack + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + outlined: true + enabled: true - text: JamiStrings.optionCancel + text: JamiStrings.optionCancel - onClicked: close() - } + onClicked: close() } } } + } - // Index = 1 - Item { - id: exportingSpinnerPage + // Index = 1 + Item { + id: exportingSpinnerPage - readonly property int pageIndex: 1 + readonly property int pageIndex: 1 - ColumnLayout { - anchors.fill: parent + ColumnLayout { + anchors.fill: parent - spacing: 16 + spacing: 16 - Label { - Layout.alignment: Qt.AlignCenter + Label { + Layout.alignment: Qt.AlignCenter - text: JamiStrings.backupAccount - color: JamiTheme.textColor - font.pointSize: JamiTheme.headerFontSize - font.kerning: true - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } + text: JamiStrings.backupAccount + color: JamiTheme.textColor + font.pointSize: JamiTheme.headerFontSize + font.kerning: true + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } - AnimatedImage { - id: spinnerMovie + AnimatedImage { + id: spinnerMovie - Layout.alignment: Qt.AlignCenter + Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: 30 - Layout.preferredHeight: 30 + Layout.preferredWidth: 30 + Layout.preferredHeight: 30 - source: JamiResources.jami_rolling_spinner_gif - playing: visible - fillMode: Image.PreserveAspectFit - mipmap: true - } + source: JamiResources.jami_rolling_spinner_gif + playing: visible + fillMode: Image.PreserveAspectFit + mipmap: true } } + } - // Index = 2 - Item { - id: exportingInfoPage + // Index = 2 + Item { + id: exportingInfoPage - readonly property int pageIndex: 2 + readonly property int pageIndex: 2 - ColumnLayout { - anchors.fill: parent + ColumnLayout { + anchors.fill: parent - spacing: 16 + spacing: 16 - RowLayout { - id: infoLabelsRowLayout + Item { + id: infoLabelsRowLayout - Layout.alignment: Qt.AlignCenter - Layout.fillWidth: true - Layout.margins: JamiTheme.preferredMarginSize + Layout.alignment: Qt.AlignCenter + Layout.margins: JamiTheme.preferredMarginSize + Layout.preferredWidth: yourPinLabel.contentWidth + + exportedPIN.contentWidth + 5 + Label { + id: yourPinLabel - spacing: 16 + anchors.left: infoLabelsRowLayout.left + anchors.verticalCenter: infoLabelsRowLayout.verticalCenter - Label { - id: yourPinLabel + text: JamiStrings.yourPinIs + color: JamiTheme.textColor + font.pointSize: JamiTheme.headerFontSize + font.kerning: true + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } - Layout.alignment: Qt.AlignHCenter + MaterialLineEdit { + id: exportedPIN - text: JamiStrings.yourPinIs - color: JamiTheme.textColor - font.pointSize: JamiTheme.headerFontSize - font.kerning: true - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } + anchors.left: yourPinLabel.right + anchors.leftMargin: 5 + anchors.verticalCenter: infoLabelsRowLayout.verticalCenter - MaterialLineEdit { - id: exportedPIN + padding: 0 - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: fieldLayoutWidth + text: JamiStrings.pin + wrapMode: Text.NoWrap - text: JamiStrings.pin - color: JamiTheme.textColor - selectByMouse: true - readOnly: true - font.pointSize: JamiTheme.headerFontSize - font.kerning: true - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } + color: JamiTheme.textColor + selectByMouse: true + readOnly: true + font.pointSize: JamiTheme.headerFontSize + font.kerning: true + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter } + } - Label { - id: infoLabel + Label { + id: infoLabel - property bool success: false - property int borderWidth : success? 1 : 0 - property int borderRadius : success? 15 : 0 - property string backgroundColor : success? "whitesmoke" : "transparent" - property string borderColor : success? "lightgray" : "transparent" + property bool success: false + property int borderWidth : success? 1 : 0 + property int borderRadius : success? 15 : 0 + property string backgroundColor : success? "whitesmoke" : "transparent" + property string borderColor : success? "lightgray" : "transparent" - Layout.maximumWidth: linkDeviceContentRect.width - - JamiTheme.preferredMarginSize * 2 + Layout.maximumWidth: stackedWidget.width - + JamiTheme.preferredMarginSize * 2 - Layout.alignment: Qt.AlignCenter + Layout.alignment: Qt.AlignCenter - color: success ? JamiTheme.successLabelColor : JamiTheme.redColor - padding: success ? 8 : 0 + color: success ? JamiTheme.successLabelColor : JamiTheme.redColor + padding: success ? 8 : 0 - wrapMode: Text.Wrap - text: JamiStrings.pinTimerInfos - font.pointSize: JamiTheme.textFontSize - font.kerning: true - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter + wrapMode: Text.Wrap + text: JamiStrings.pinTimerInfos + font.pointSize: success ? JamiTheme.textFontSize : + JamiTheme.textFontSize + 3 + font.kerning: true + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter - background: Rectangle { - id: infoLabelBackground + background: Rectangle { + id: infoLabelBackground - border.width: infoLabel.borderWidth - border.color: infoLabel.borderColor - radius: infoLabel.borderRadius - color: JamiTheme.secondaryBackgroundColor - } + border.width: infoLabel.borderWidth + border.color: infoLabel.borderColor + radius: infoLabel.borderRadius + color: JamiTheme.secondaryBackgroundColor } + } - MaterialButton { - id: btnCloseExportDialog + MaterialButton { + id: btnCloseExportDialog - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: JamiTheme.preferredMarginSize - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 + preferredHeight: JamiTheme.preferredFieldHeight - color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - outlined: true - enabled: true + color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + outlined: true + enabled: true - text: JamiStrings.close + text: JamiStrings.close - onClicked: { - if (infoLabel.success) - accepted() - close() - } + onClicked: { + if (infoLabel.success) + accepted() + close() } } } diff --git a/src/settingsview/components/LinkedDevices.qml b/src/settingsview/components/LinkedDevices.qml index a35eacede..b897a0009 100644 --- a/src/settingsview/components/LinkedDevices.qml +++ b/src/settingsview/components/LinkedDevices.qml @@ -48,7 +48,9 @@ ColumnLayout { RevokeDevicePasswordDialog{ id: revokeDevicePasswordDialog - onRevokeDeviceWithPassword: deviceItemListModel.sourceModel.revokeDevice(idOfDevice, password) + onRevokeDeviceWithPassword: function(idOfDevice, password) { + deviceItemListModel.sourceModel.revokeDevice(idOfDevice, password) + } } SimpleMessageDialog { @@ -121,6 +123,6 @@ ColumnLayout { text: JamiStrings.linkAnotherDevice - onClicked: linkDeviceDialog.openLinkDeviceDialog() + onClicked: linkDeviceDialog.open() } } diff --git a/src/settingsview/components/NameRegistrationDialog.qml b/src/settingsview/components/NameRegistrationDialog.qml index 96d62ed7e..53bc51e72 100644 --- a/src/settingsview/components/NameRegistrationDialog.qml +++ b/src/settingsview/components/NameRegistrationDialog.qml @@ -27,7 +27,7 @@ import net.jami.Constants 1.1 import "../../commoncomponents" -BaseDialog { +BaseModalDialog { id: root property string registerdName : "" @@ -36,237 +36,234 @@ BaseDialog { function openNameRegistrationDialog(registerNameIn) { registerdName = registerNameIn - lblRegistrationError.text = JamiStrings.somethingWentWrong - passwordEdit.clear() open() - - if(AccountAdapter.hasPassword()){ - stackedWidget.currentIndex = nameRegisterEnterPasswordPage.pageIndex - passwordEdit.forceActiveFocus() - } else { - startRegistration() - } } - function startRegistration() { - stackedWidget.currentIndex = nameRegisterSpinnerPage.pageIndex - spinnerMovie.visible = true + width: JamiTheme.preferredDialogWidth + height: JamiTheme.preferredDialogHeight - timerForStartRegistration.restart() - } + title: JamiStrings.setUsername - Timer { - id: timerForStartRegistration + popupContent: StackLayout { + id: stackedWidget - interval: 100 - repeat: false + function startRegistration() { + stackedWidget.currentIndex = nameRegisterSpinnerPage.pageIndex + spinnerMovie.visible = true - onTriggered: { - AccountAdapter.model.registerName(LRCInstance.currentAccountId, - passwordEdit.text, registerdName) + timerForStartRegistration.restart() } - } - Connections{ - target: NameDirectory - - function onNameRegistrationEnded(status, name) { - switch(status) { - case NameDirectory.RegisterNameStatus.SUCCESS: - accepted() - close() - return - case NameDirectory.RegisterNameStatus.WRONG_PASSWORD: - lblRegistrationError.text = JamiStrings.incorrectPassword - break - case NameDirectory.RegisterNameStatus.NETWORK_ERROR: - lblRegistrationError.text = JamiStrings.networkError - break - default: - break - } + Timer { + id: timerForStartRegistration - stackedWidget.currentIndex = nameRegisterErrorPage.pageIndex + interval: 100 + repeat: false + + onTriggered: { + AccountAdapter.model.registerName(LRCInstance.currentAccountId, + passwordEdit.text, registerdName) + } } - } - title: JamiStrings.setUsername + Connections{ + target: NameDirectory + + function onNameRegistrationEnded(status, name) { + switch(status) { + case NameDirectory.RegisterNameStatus.SUCCESS: + accepted() + close() + return + case NameDirectory.RegisterNameStatus.WRONG_PASSWORD: + lblRegistrationError.text = JamiStrings.incorrectPassword + break + case NameDirectory.RegisterNameStatus.NETWORK_ERROR: + lblRegistrationError.text = JamiStrings.networkError + break + default: + break + } - contentItem: Rectangle { - id: nameRegistrationContentRect + stackedWidget.currentIndex = nameRegisterErrorPage.pageIndex + } + } - implicitWidth: JamiTheme.preferredDialogWidth - implicitHeight: JamiTheme.preferredDialogHeight + onVisibleChanged: { + if (visible) { + lblRegistrationError.text = JamiStrings.somethingWentWrong + passwordEdit.clear() - color: JamiTheme.primaryBackgroundColor + if (AccountAdapter.hasPassword()){ + stackedWidget.currentIndex = nameRegisterEnterPasswordPage.pageIndex + passwordEdit.forceActiveFocus() + } else { + startRegistration() + } + } + } - StackLayout { - id: stackedWidget + // Index = 0 + Item { + id: nameRegisterEnterPasswordPage - anchors.fill: parent - anchors.margins: JamiTheme.preferredMarginSize + readonly property int pageIndex: 0 - // Index = 0 - Item { - id: nameRegisterEnterPasswordPage + ColumnLayout { + anchors.fill: parent - readonly property int pageIndex: 0 + spacing: 16 - ColumnLayout { - anchors.fill: parent + Label { + Layout.alignment: Qt.AlignCenter - spacing: 16 + text: JamiStrings.enterAccountPassword + color: JamiTheme.textColor + font.pointSize: JamiTheme.textFontSize + font.kerning: true + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } - Label { - Layout.alignment: Qt.AlignCenter + MaterialLineEdit { + id: passwordEdit - text: JamiStrings.enterAccountPassword - color: JamiTheme.textColor - font.pointSize: JamiTheme.textFontSize - font.kerning: true - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: JamiTheme.preferredFieldWidth + Layout.preferredHeight: 48 - MaterialLineEdit { - id: passwordEdit + echoMode: TextInput.Password + placeholderText: JamiStrings.password - Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: JamiTheme.preferredFieldWidth - Layout.preferredHeight: 48 + onTextChanged: btnRegister.enabled = (text.length > 0) - echoMode: TextInput.Password - placeholderText: JamiStrings.password + onAccepted: btnRegister.clicked() + } - onTextChanged: btnRegister.enabled = (text.length > 0) + RowLayout { + spacing: 16 + Layout.alignment: Qt.AlignHCenter + Layout.fillWidth: true - onAccepted: btnRegister.clicked() - } + MaterialButton { + id: btnRegister - RowLayout { - spacing: 16 Layout.alignment: Qt.AlignHCenter - Layout.fillWidth: true - - MaterialButton { - id: btnRegister - Layout.alignment: Qt.AlignHCenter - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 + preferredHeight: JamiTheme.preferredFieldHeight - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - outlined: true - enabled: false + color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + outlined: true + enabled: false - text: JamiStrings.register + text: JamiStrings.register - onClicked: startRegistration() - } + onClicked: stackedWidget.startRegistration() + } - MaterialButton { - id: btnCancel + MaterialButton { + id: btnCancel - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 + preferredHeight: JamiTheme.preferredFieldHeight - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - outlined: true + color: JamiTheme.buttonTintedBlack + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + outlined: true - text: JamiStrings.optionCancel + text: JamiStrings.optionCancel - onClicked: close() - } + onClicked: close() } } } + } - // Index = 1 - Item { - id: nameRegisterSpinnerPage + // Index = 1 + Item { + id: nameRegisterSpinnerPage - readonly property int pageIndex: 1 + readonly property int pageIndex: 1 - ColumnLayout { - anchors.fill: parent + ColumnLayout { + anchors.fill: parent - spacing: 16 + spacing: 16 - Label { - Layout.alignment: Qt.AlignCenter + Label { + Layout.alignment: Qt.AlignCenter - text: JamiStrings.registeringName - color: JamiTheme.textColor - font.pointSize: JamiTheme.textFontSize - font.kerning: true - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } + text: JamiStrings.registeringName + color: JamiTheme.textColor + font.pointSize: JamiTheme.textFontSize + 3 + font.kerning: true + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } - AnimatedImage { - id: spinnerMovie + AnimatedImage { + id: spinnerMovie - Layout.alignment: Qt.AlignCenter + Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: 30 - Layout.preferredHeight: 30 + Layout.preferredWidth: 30 + Layout.preferredHeight: 30 - source: JamiResources.jami_rolling_spinner_gif - playing: visible - fillMode: Image.PreserveAspectFit - mipmap: true - } + source: JamiResources.jami_rolling_spinner_gif + playing: visible + fillMode: Image.PreserveAspectFit + mipmap: true } } + } - // Index = 2 - Item { - id: nameRegisterErrorPage + // Index = 2 + Item { + id: nameRegisterErrorPage - readonly property int pageIndex: 2 + readonly property int pageIndex: 2 - ColumnLayout { - anchors.fill: parent + ColumnLayout { + anchors.fill: parent - spacing: 16 + spacing: 16 - Label { - id: lblRegistrationError + Label { + id: lblRegistrationError - Layout.alignment: Qt.AlignCenter - text: JamiStrings.somethingWentWrong - font.pointSize: JamiTheme.textFontSize - font.kerning: true - color: JamiTheme.redColor - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } + Layout.alignment: Qt.AlignCenter + text: JamiStrings.somethingWentWrong + font.pointSize: JamiTheme.textFontSize + 3 + font.kerning: true + color: JamiTheme.redColor + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } - MaterialButton { - id: btnClose + MaterialButton { + id: btnClose - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: JamiTheme.preferredMarginSize - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 + preferredHeight: JamiTheme.preferredFieldHeight - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - outlined: true + color: JamiTheme.buttonTintedBlack + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + outlined: true - text: JamiStrings.close + text: JamiStrings.close - onClicked: close() - } + onClicked: close() } } } diff --git a/src/settingsview/components/RevokeDevicePasswordDialog.qml b/src/settingsview/components/RevokeDevicePasswordDialog.qml index e5e4362c0..cc3a56c93 100644 --- a/src/settingsview/components/RevokeDevicePasswordDialog.qml +++ b/src/settingsview/components/RevokeDevicePasswordDialog.qml @@ -25,7 +25,7 @@ import net.jami.Constants 1.1 import "../../commoncomponents" -BaseDialog { +BaseModalDialog { id: root property string deviceId : "" @@ -34,105 +34,100 @@ BaseDialog { function openRevokeDeviceDialog(deviceIdIn) { deviceId = deviceIdIn - passwordEdit.clear() + open() } - title: qsTr("Remove device") + width: JamiTheme.preferredDialogWidth + height: JamiTheme.preferredDialogHeight - contentItem: Rectangle { - id: revokeDeviceContentRect + title: JamiStrings.removeDevice - color: JamiTheme.secondaryBackgroundColor - implicitWidth: JamiTheme.preferredDialogWidth - implicitHeight: JamiTheme.preferredDialogHeight + popupContent: ColumnLayout { + id: revokeDeviceContentColumnLayout - ColumnLayout { - anchors.centerIn: parent - anchors.fill: parent - anchors.margins: JamiTheme.preferredMarginSize - spacing: 16 + spacing: 16 - Label { - id: labelDeletion + Label { + id: labelDeletion - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: revokeDeviceContentRect.width - JamiTheme.preferredMarginSize * 2 + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: revokeDeviceContentColumnLayout.width - + JamiTheme.preferredMarginSize * 2 - color: JamiTheme.textColor - text: JamiStrings.confirmRemoval - font.pointSize: JamiTheme.textFontSize - font.kerning: true - wrapMode: Text.Wrap + text: JamiStrings.confirmRemoval + color: JamiTheme.textColor + font.pointSize: JamiTheme.textFontSize + font.kerning: true + wrapMode: Text.Wrap - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } - MaterialLineEdit { - id: passwordEdit + MaterialLineEdit { + id: passwordEdit - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: JamiTheme.preferredFieldWidth - Layout.preferredHeight: visible ? 48 : 0 + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: JamiTheme.preferredFieldWidth + Layout.preferredHeight: visible ? 48 : 0 - echoMode: TextInput.Password - placeholderText: JamiStrings.enterCurrentPassword + echoMode: TextInput.Password + placeholderText: JamiStrings.enterCurrentPassword - onTextChanged: { - btnRemove.enabled = text.length > 0 - } + onVisibleChanged: passwordEdit.clear() + + onTextChanged: { + btnRemove.enabled = text.length > 0 } + } - RowLayout { - spacing: 16 - Layout.alignment: Qt.AlignHCenter + RowLayout { + spacing: 16 + Layout.alignment: Qt.AlignHCenter - Layout.fillWidth: true + Layout.fillWidth: true - MaterialButton { - id: btnRemove + MaterialButton { + id: btnRemove - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 + preferredHeight: JamiTheme.preferredFieldHeight - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - outlined: true - enabled: false + color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + outlined: true + enabled: false - text: qsTr("Remove") + text: qsTr("Remove") - onClicked: { - revokeDeviceWithPassword(deviceId, passwordEdit.text) - close() - } + onClicked: { + revokeDeviceWithPassword(deviceId, passwordEdit.text) + close() } + } - MaterialButton { - id: btnCancel + MaterialButton { + id: btnCancel - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 + preferredHeight: JamiTheme.preferredFieldHeight - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - outlined: true - enabled: true + color: JamiTheme.buttonTintedBlack + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + outlined: true + enabled: true - text: qsTr("Cancel") + text: JamiStrings.optionCancel - onClicked: { - close() - } - } - } - } + onClicked: close() + } + } } } diff --git a/src/wizardview/components/BackupKeyPage.qml b/src/wizardview/components/BackupKeyPage.qml index a73d2f6fc..1f22da0d7 100644 --- a/src/wizardview/components/BackupKeyPage.qml +++ b/src/wizardview/components/BackupKeyPage.qml @@ -59,8 +59,8 @@ Rectangle { buttonTitles: [JamiStrings.optionOk] buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue] - onVisibleChanged: { - if (title === JamiStrings.success && !visible) + onClosed: { + if (title === JamiStrings.success) WizardViewStepModel.nextStep() } } @@ -71,7 +71,9 @@ Rectangle { visible: false purpose: PasswordDialog.ExportAccount - onDoneSignal: showBackupStatusDialog(success) + onDoneSignal: function (success) { + showBackupStatusDialog(success) + } } // JamiFileDialog for exporting account -- GitLab