diff --git a/src/app/MainApplicationWindow.qml b/src/app/MainApplicationWindow.qml index 55776ccac3f4e9544b83e886c67020051ed2e49d..76e4e190562e597df695deeca7d9441ba805867a 100644 --- a/src/app/MainApplicationWindow.qml +++ b/src/app/MainApplicationWindow.qml @@ -273,7 +273,8 @@ ApplicationWindow { "infoText": infoText, "buttonTitles": [JamiStrings.optionOk], "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue], - "buttonCallBacks": [] + "buttonCallBacks": [], + "buttonRoles": [DialogButtonBox.AcceptRole] }); } @@ -285,7 +286,8 @@ ApplicationWindow { "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue, SimpleMessageDialog.ButtonStyle.TintedBlue], "buttonCallBacks": [function () { AppVersionManager.applyUpdates(switchToBeta); - }] + }], + "buttonRoles": [DialogButtonBox.AcceptRole, DialogButtonBox.RejectRole] }); } diff --git a/src/app/commoncomponents/BaseModalDialog.qml b/src/app/commoncomponents/BaseModalDialog.qml index 4259c68f0073ba9dbf870126332d88d81f6fe8d9..60d7dc78435a5d3f28526e5c8835ad30f6db352f 100644 --- a/src/app/commoncomponents/BaseModalDialog.qml +++ b/src/app/commoncomponents/BaseModalDialog.qml @@ -30,15 +30,24 @@ Popup { property alias backgroundColor: container.color property alias title: titleText.text property var popupcontainerSubContentLoader: containerSubContentLoader - property bool topLayoutVisible: true + + property bool closeButtonVisible: true + property int button1Role + property int button2Role + + property alias button1: action1 + property alias button2: action2 + property alias popupContentLoadStatus: containerSubContentLoader.status property alias popupContent: containerSubContentLoader.sourceComponent - property int popupContentMargins: JamiTheme.preferredMarginSize + + property int popupMargins: 30 + property int buttonMargin: 20 + property int maximumPopupWidth: 600 parent: Overlay.overlay anchors.centerIn: parent modal: true - padding: popupContentMargins focus: true closePolicy: autoClose ? (Popup.CloseOnEscape | Popup.CloseOnPressOutside) : Popup.NoAutoClose @@ -47,13 +56,13 @@ Popup { id: container property color color: JamiTheme.secondaryBackgroundColor - padding: popupContentMargins - anchors.margins: popupContentMargins anchors.centerIn: parent + leftPadding: popupMargins + bottomPadding: action1.visible || action2.visible ? 10 :popupMargins background: Rectangle { id: bgRect - radius: JamiTheme.modalPopupRadius + radius: 5 color: container.color layer.enabled: true layer.effect: DropShadow { @@ -70,37 +79,85 @@ Popup { contentItem: ColumnLayout { id: contentLayout - RowLayout { - Layout.preferredWidth: parent.width - Layout.bottomMargin: JamiTheme.preferredMarginSize - visible: topLayoutVisible + JamiPushButton { + id: closeButton - Label { - id: titleText + visible: closeButtonVisible - Layout.alignment: Qt.AlignTop | Qt.AlignLeft - font.pointSize: JamiTheme.menuFontSize - color: JamiTheme.textColor + Layout.alignment: Qt.AlignRight | Qt.AlignTop + Layout.preferredHeight: 20 + Layout.preferredWidth: 20 + Layout.topMargin: 5 + Layout.rightMargin: 5 + imageColor: hovered ? JamiTheme.textColor : JamiTheme.buttonTintedGreyHovered + normalColor: "transparent" - visible: text.length > 0 - } + source: JamiResources.round_close_24dp_svg + onClicked: close() + } - JamiPushButton { - id: closeButton - Layout.alignment: Qt.AlignRight - imageColor: "grey" - normalColor: "transparent" + Label { + id: titleText - source: JamiResources.round_close_24dp_svg - onClicked: close() - } + Layout.rightMargin: popupMargins + Layout.bottomMargin: 20 + Layout.topMargin: closeButtonVisible ? 0 : 30 + Layout.alignment: Qt.AlignLeft + + font.pointSize: JamiTheme.menuFontSize + color: JamiTheme.textColor + font.bold: true + + visible: text.length > 0 } Loader { id: containerSubContentLoader + Layout.rightMargin: popupMargins Layout.alignment: Qt.AlignCenter + Layout.maximumWidth: maximumPopupWidth - 2 * popupMargins + } + + DialogButtonBox { + id: buttonBox + Layout.alignment: Qt.AlignRight + spacing: 1.5 + + background: Rectangle { + + color: "transparent" + width: buttonBox.childrenRect.width + height: buttonBox.childrenRect.height + } + + visible: action1.text.length > 0 + contentHeight: childrenRect.height + 14 + + MaterialButton { + id: action1 + + visible: text.length > 0 + rightPadding: buttonMargin + leftPadding: buttonMargin + tertiary: true + autoAccelerator: true + + DialogButtonBox.buttonRole: root.button1Role + } + + MaterialButton { + id: action2 + + visible: text.length > 0 + rightPadding: buttonMargin + leftPadding: buttonMargin + tertiary: true + autoAccelerator: true + + DialogButtonBox.buttonRole: root.button2Role + } } } } diff --git a/src/app/commoncomponents/ChangePttKeyPopup.qml b/src/app/commoncomponents/ChangePttKeyPopup.qml index b785e6af0ef17511c1020a61d0122c15fb46271e..c5b29e05782c1753de51dd2166778174c17c996f 100644 --- a/src/app/commoncomponents/ChangePttKeyPopup.qml +++ b/src/app/commoncomponents/ChangePttKeyPopup.qml @@ -28,6 +28,22 @@ BaseModalDialog { property string accountId: "" property int pressedKey: Qt.Key_unknown + closeButtonVisible: false + + button1.text: JamiStrings.assign + button2.text: JamiStrings.cancel + + button1Role: DialogButtonBox.ApplyRole + button2Role: DialogButtonBox.RejectRole + button1.onClicked: { + if (!(pressedKey === Qt.Key_unknown)){ + PttListener.setPttKey(pressedKey); + choiceMade(pressedKey); + } + close(); + } + button2.onClicked: close(); + signal accepted signal choiceMade(int chosenKey) @@ -80,33 +96,6 @@ BaseModalDialog { border.color: JamiTheme.darkGreyColor radius: 4 } - - } - - MaterialButton { - id: btnAssign - - Layout.alignment: Qt.AlignHCenter - Layout.topMargin: JamiTheme.preferredMarginSize - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - buttontextHeightMargin: JamiTheme.buttontextHeightMargin - - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - - text: JamiStrings.assign - autoAccelerator: true - - onClicked: { - if (!(pressedKey === Qt.Key_unknown)){ - PttListener.setPttKey(pressedKey); - choiceMade(pressedKey); - } - close(); - } } Item { @@ -118,6 +107,4 @@ BaseModalDialog { } } } - - } diff --git a/src/app/commoncomponents/ConfirmDialog.qml b/src/app/commoncomponents/ConfirmDialog.qml index fb3c5942b0081dbb84b1067354b26f957da4f16a..ea6b38f01fd21b888e15133ad078f2e7278d80c1 100644 --- a/src/app/commoncomponents/ConfirmDialog.qml +++ b/src/app/commoncomponents/ConfirmDialog.qml @@ -30,6 +30,19 @@ BaseModalDialog { property string confirmLabel: "" property string textLabel: "" + closeButtonVisible: false + button1.text: confirmLabel + button1.contentColorProvider: JamiTheme.redButtonColor + button1.onClicked: { + close(); + accepted(); + } + button2.text: JamiStrings.optionCancel + button2.onClicked: close() + + button1Role: DialogButtonBox.AcceptRole + button2Role: DialogButtonBox.RejectRole + popupContent: ColumnLayout { id: column @@ -49,51 +62,5 @@ BaseModalDialog { verticalAlignment: Text.AlignVCenter wrapMode: Text.Wrap } - - RowLayout { - spacing: 16 - Layout.alignment: Qt.AlignCenter - Layout.topMargin: JamiTheme.preferredMarginSize - - MaterialButton { - id: primaryBtn - - Layout.alignment: Qt.AlignHCenter - text: root.confirmLabel - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - buttontextHeightMargin: JamiTheme.buttontextHeightMargin - - color: JamiTheme.buttonTintedRed - hoveredColor: JamiTheme.buttonTintedRedHovered - pressedColor: JamiTheme.buttonTintedRedPressed - secondary: true - autoAccelerator: true - - onClicked: { - close(); - accepted(); - } - } - - MaterialButton { - id: btnCancel - - Layout.alignment: Qt.AlignHCenter - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - buttontextHeightMargin: JamiTheme.buttontextHeightMargin - - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - autoAccelerator: true - - text: JamiStrings.optionCancel - - onClicked: close() - } - } } } diff --git a/src/app/commoncomponents/DaemonReconnectPopup.qml b/src/app/commoncomponents/DaemonReconnectPopup.qml index 6cf50caf552e5bc8bb511e484d810043f9c7266d..7172defb66799973b6442499f3b4e13739ece890 100644 --- a/src/app/commoncomponents/DaemonReconnectPopup.qml +++ b/src/app/commoncomponents/DaemonReconnectPopup.qml @@ -29,6 +29,11 @@ BaseModalDialog { autoClose: false + button1.text: JamiStrings.optionOk + button1Role: DialogButtonBox.AcceptRole + button1.visible: connectionFailed + button1.onClicked: Qt.quit() + Connections { target: { if (Qt.platform.os.toString() !== "windows" && Qt.platform.os.toString() !== "osx") @@ -51,10 +56,10 @@ BaseModalDialog { onPopupContentLoadStatusChanged: { if (popupContentLoadStatus === Loader.Ready) { root.height = Qt.binding(function () { - return popupContentLoader.item.implicitHeight + 50; + return popupContent.implicitHeight + 50; }); root.width = Qt.binding(function () { - return popupContentLoader.item.implicitWidth + 50; + return popupContent.implicitWidth + 50; }); } } @@ -94,24 +99,5 @@ BaseModalDialog { smooth: true fillMode: Image.PreserveAspectFit } - - MaterialButton { - id: btnOk - - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - - visible: connectionFailed - - text: JamiStrings.optionOk - color: JamiTheme.buttonTintedBlue - hoveredColor: JamiTheme.buttonTintedBlueHovered - pressedColor: JamiTheme.buttonTintedBluePressed - secondary: true - autoAccelerator: true - - onClicked: Qt.quit() - } } } diff --git a/src/app/commoncomponents/DeleteAccountDialog.qml b/src/app/commoncomponents/DeleteAccountDialog.qml index 7d508a5715a00110d1b4f5b8d3b6c72c09b91911..8dedfbe42f59ca17baf61b5fa910fe3f6555652c 100644 --- a/src/app/commoncomponents/DeleteAccountDialog.qml +++ b/src/app/commoncomponents/DeleteAccountDialog.qml @@ -33,6 +33,31 @@ BaseModalDialog { title: JamiStrings.deleteAccount + closeButtonVisible: false + button1.text: JamiStrings.optionDelete + button1Role: DialogButtonBox.DestructiveRole + button1.onClicked: { + button1.enabled = false; + busyInd.running = true; + AccountAdapter.deleteCurrentAccount(); + close(); + accepted(); + } + button2.text: JamiStrings.optionCancel + button2Role: DialogButtonBox.RejectRole + button2.onClicked: close(); + + BusyIndicator { + id: busyInd + running: false + Connections { + target: root + function onClosed() { + busyInd.running = false; + } + } + } + popupContent: ColumnLayout { id: deleteAccountContentColumnLayout anchors.centerIn: parent @@ -101,76 +126,5 @@ BaseModalDialog { color: JamiTheme.redColor } - - RowLayout { - spacing: 16 - Layout.fillWidth: true - Layout.alignment: Qt.AlignCenter - - MaterialButton { - id: btnDelete - - Layout.alignment: Qt.AlignHCenter - Layout.topMargin: JamiTheme.preferredMarginSize - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - buttontextHeightMargin: JamiTheme.buttontextHeightMargin - - color: JamiTheme.buttonTintedRed - hoveredColor: JamiTheme.buttonTintedRedHovered - pressedColor: JamiTheme.buttonTintedRedPressed - secondary: true - autoAccelerator: true - - text: JamiStrings.optionDelete - - Connections { - target: root - function onClosed() { - btnDelete.enabled = true; - } - } - - onClicked: { - btnDelete.enabled = false; - busyInd.running = true; - AccountAdapter.deleteCurrentAccount(); - close(); - accepted(); - } - } - - BusyIndicator { - id: busyInd - running: false - - Connections { - target: root - function onClosed() { - busyInd.running = false; - } - } - } - - MaterialButton { - id: btnCancel - - Layout.alignment: Qt.AlignHCenter - Layout.topMargin: JamiTheme.preferredMarginSize - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - buttontextHeightMargin: JamiTheme.buttontextHeightMargin - - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - - text: JamiStrings.optionCancel - autoAccelerator: true - - onClicked: close() - } - } } } diff --git a/src/app/commoncomponents/EditedPopup.qml b/src/app/commoncomponents/EditedPopup.qml index 49bab54da76fd74b924abfe9239b2ff14d52ca65..a398a2dd7ddcf2e6994a2b2e55faad4563c23188 100644 --- a/src/app/commoncomponents/EditedPopup.qml +++ b/src/app/commoncomponents/EditedPopup.qml @@ -25,25 +25,23 @@ import net.jami.Constants 1.1 BaseModalDialog { id: root - width: JamiTheme.secondaryDialogDimension - property var previousBodies: undefined popupContent: JamiListView { - width: root.width - 4 * JamiTheme.preferredMarginSize + width: 400 - 2 * root.popupMargins + height: Math.min(count * 50, 150) model: root.previousBodies delegate: Rectangle { - width: root.width - 2 * JamiTheme.preferredMarginSize + width: 400 - 2 * root.popupMargins height: Math.max(JamiTheme.menuItemsPreferredHeight, rowBody.implicitHeight) color: index % 2 === 0 ? JamiTheme.backgroundColor : JamiTheme.secondaryBackgroundColor RowLayout { id: rowBody spacing: JamiTheme.preferredMarginSize - width: parent.width anchors.centerIn: parent Text { @@ -58,7 +56,6 @@ BaseModalDialog { Text { Layout.alignment: Qt.AlignLeft - Layout.fillWidth: true TextMetrics { id: metrics diff --git a/src/app/commoncomponents/PasswordDialog.qml b/src/app/commoncomponents/PasswordDialog.qml index f008ec844a26d61588d38d38e3b696258445d43b..f9f31e15bc807da077bd48427bc0465654dc0346 100644 --- a/src/app/commoncomponents/PasswordDialog.qml +++ b/src/app/commoncomponents/PasswordDialog.qml @@ -64,11 +64,17 @@ BaseModalDialog { "title": title, "infoText": info, "buttonTitles": [JamiStrings.optionOk], - "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue] + "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue], + "buttonRoles": [DialogButtonBox.AcceptRole] }); done(success, purpose); } + button1.text: (purpose === PasswordDialog.ExportAccount) ? JamiStrings.exportAccount : JamiStrings.change + button1Role: DialogButtonBox.ApplyRole + button1.enabled: purpose === PasswordDialog.SetPassword + + popupContent: ColumnLayout { id: popupContentColumnLayout @@ -77,13 +83,13 @@ BaseModalDialog { function validatePassword() { switch (purpose) { case PasswordDialog.ExportAccount: - btnConfirm.enabled = currentPasswordEdit.dynamicText.length > 0; + button1.enabled = currentPasswordEdit.dynamicText.length > 0; break; case PasswordDialog.SetPassword: - btnConfirm.enabled = passwordEdit.dynamicText.length > 0 && passwordEdit.dynamicText === confirmPasswordEdit.dynamicText; + button1.enabled = passwordEdit.dynamicText.length > 0 && passwordEdit.dynamicText === confirmPasswordEdit.dynamicText; break; default: - btnConfirm.enabled = currentPasswordEdit.dynamicText.length > 0 && passwordEdit.dynamicText === confirmPasswordEdit.dynamicText; + button1.enabled = currentPasswordEdit.dynamicText.length > 0 && passwordEdit.dynamicText === confirmPasswordEdit.dynamicText; } } @@ -104,6 +110,13 @@ BaseModalDialog { onVisibleChanged: validatePassword() + Component.onCompleted: { + root.button1.clicked.connect(function() { + button1.enabled = false; + timerToOperate.restart(); + }); + } + Timer { id: timerToOperate @@ -165,26 +178,5 @@ BaseModalDialog { onDynamicTextChanged: popupContentColumnLayout.validatePassword() } - - MaterialButton { - id: btnConfirm - - Layout.alignment: Qt.AlignHCenter - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - - color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - autoAccelerator: true - enabled: purpose === PasswordDialog.SetPassword - - text: (purpose === PasswordDialog.ExportAccount) ? JamiStrings.exportAccount : JamiStrings.change - - onClicked: { - btnConfirm.enabled = false; - timerToOperate.restart(); - } - } } } diff --git a/src/app/commoncomponents/SimpleMessageDialog.qml b/src/app/commoncomponents/SimpleMessageDialog.qml index a47e9110dddd57f770365459656bc29b2b540753..15421e5a4db2e04f6c049f9f59b405f0e18a4165 100644 --- a/src/app/commoncomponents/SimpleMessageDialog.qml +++ b/src/app/commoncomponents/SimpleMessageDialog.qml @@ -36,6 +36,7 @@ BaseModalDialog { property var buttonStyles: [] property string infoText: "" property var innerContentData: [] + property int buttonRoles: [] function openWithParameters(title, info = "") { root.title = title; @@ -44,6 +45,45 @@ BaseModalDialog { open(); } + button1.text: buttonTitles[0] + button1Role: buttonRoles[0] + button2.text: buttonTitles[1] ? buttonTitles[1] : null + button2Role: buttonRoles[1] + button1.onClicked: { + if (buttonCallBacks[0]) + buttonCallBacks[0](); + close(); + } + button2.onClicked: { + if (buttonCallBacks[1]) + buttonCallBacks[1](); + close(); + } + + Component.onCompleted: { + for (var i = 0; i < buttonStyles.length; i++){ + + switch (buttonStyles[i]) { + + case SimpleMessageDialog.ButtonStyle.TintedBlue: + button1.color = JamiTheme.buttonTintedBlue; + button1.hoveredColor = JamiTheme.buttonTintedBlueHovered; + button1.pressedColor = JamiTheme.buttonTintedBluePressed; + break; + case SimpleMessageDialog.ButtonStyle.TintedBlack: + button1.color = JamiTheme.buttonTintedBlack; + button1.hoveredColor = JamiTheme.buttonTintedBlackHovered; + button1.pressedColor = JamiTheme.buttonTintedBlackPressed; + break; + case SimpleMessageDialog.ButtonStyle.TintedRed: + button1.color = JamiTheme.buttonTintedRed; + button1.hoveredColor = JamiTheme.buttonTintedRedHovered; + button1.pressedColor = JamiTheme.buttonTintedRedPressed; + break; + } + } + } + popupContent: ColumnLayout { Label { id: infoTextLabel @@ -69,63 +109,5 @@ BaseModalDialog { 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 - buttontextHeightMargin: JamiTheme.buttontextHeightMargin - - 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; - } - } - 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; - } - } - secondary: true - autoAccelerator: true - - text: buttonTitles[modelData] - - onClicked: { - if (buttonCallBacks[modelData]) - buttonCallBacks[modelData](); - close(); - } - } - } - } } } diff --git a/src/app/constant/JamiStrings.qml b/src/app/constant/JamiStrings.qml index dd4879a0c6d447925eb80b87ff9120d13221542f..ccc9d29675c397c750f7327359e87ab1cb6d5614 100644 --- a/src/app/constant/JamiStrings.qml +++ b/src/app/constant/JamiStrings.qml @@ -769,8 +769,9 @@ Item { property string joinCall: qsTr("Join call") property string wantToJoin: qsTr("A call is in progress. Do you want to join the call?") property string needsHost: qsTr("Current host for this swarm seems unreachable. Do you want to host the call?") - property string chooseHoster: qsTr("Choose a dedicated device for hosting future calls in this swarm. If not set, the device starting a call will host it.") - property string chooseThisDevice: qsTr("Choose this device") + property string selectHost: qsTr("Select dedicated device for hosting future calls in this swarm. If not set, the host will be the device starting a call.") + property string selectThisDevice: qsTr("Select this device") + property string selectDevice: qsTr("Select device") property string removeCurrentDevice: qsTr("Remove current device") property string becomeHostOneCall: qsTr("Host only this call") property string hostThisCall: qsTr("Host this call") diff --git a/src/app/constant/JamiTheme.qml b/src/app/constant/JamiTheme.qml index 64163825c1bdf6f335fbd186ec97993d2aaee1b4..042484f4bb39111573111c4f5a69ce18fcd16308 100644 --- a/src/app/constant/JamiTheme.qml +++ b/src/app/constant/JamiTheme.qml @@ -138,6 +138,8 @@ Item { property color secAndTertiHoveredBackgroundColor: darkTheme ? "#123F4A" : "#E5EEF5" property color closeButtonLighterBlack: "#4c4c4c" + property color redButtonColor: darkTheme ? "#FA2E30" : "#CC0022" + // Jami switch property color switchBackgroundCheckedColor: "#8dbaea" property color switchBackgroundColor: darkTheme ? "#626262" : "#E5EEF5" diff --git a/src/app/mainview/components/DevicesListPopup.qml b/src/app/mainview/components/DevicesListPopup.qml index 3c5efabc7f4504af6f05b7c2dd0952b2fdac259d..1d2830c1171e9b5e10c4878afd875d5aa01384e6 100644 --- a/src/app/mainview/components/DevicesListPopup.qml +++ b/src/app/mainview/components/DevicesListPopup.qml @@ -29,25 +29,45 @@ BaseModalDialog { width: JamiTheme.secondaryDialogDimension + property string currentDeviceId + title: JamiStrings.defaultCallHost + button1.text: JamiStrings.selectDevice + button1Role: DialogButtonBox.AcceptRole + button1.toolTipText: JamiStrings.selectThisDevice + button1.enabled: false + button1.onClicked : { + CurrentConversation.setInfo("rdvAccount", CurrentAccount.uri); + CurrentConversation.setInfo("rdvDevice", currentDeviceId); + root.close(); + } + + button2.text: JamiStrings.removeDevice + button2Role: DialogButtonBox.ResetRole + button2.toolTipText: JamiStrings.removeCurrentDevice + button2.enabled: CurrentConversation.rdvAccount !== "" + button2.onClicked: { + CurrentConversation.setInfo("rdvAccount", ""); + CurrentConversation.setInfo("rdvDevice", ""); + close(); + } + popupContent: ColumnLayout { id: mainLayout anchors.centerIn: parent - anchors.margins: JamiTheme.preferredMarginSize - spacing: JamiTheme.preferredMarginSize - + spacing: 10 + width: JamiTheme.preferredDialogWidth Label { id: informativeLabel Layout.alignment: Qt.AlignCenter - Layout.topMargin: JamiTheme.preferredMarginSize - Layout.preferredWidth: root.width - 4*JamiTheme.preferredMarginSize + Layout.fillWidth: true wrapMode: Text.Wrap - text: JamiStrings.chooseHoster + text: JamiStrings.selectHost color: JamiTheme.primaryForegroundColor } @@ -79,15 +99,27 @@ BaseModalDialog { property bool isCurrent: DeviceName implicitWidth: devicesListView.width - width: root.width - 4*JamiTheme.preferredMarginSize height: 70 - highlighted: ListView.isCurrentItem + highlighted: CurrentConversation.rdvDevice === deviceId MouseArea { anchors.fill: parent onClicked: { - devicesListView.currentIndex = index; + if (!highlighted){ + devicesListView.currentIndex = index; + for (var i = 0; i < devicesListView.count; i++) { + devicesListView.itemAtIndex(i).highlighted = false; + } + currentDeviceId = deviceId; + button1.enabled = true; + } + else { + devicesListView.currentIndex = -1; + button1.enabled = false; + } + + item.highlighted = !item.highlighted; } } @@ -154,65 +186,6 @@ BaseModalDialog { } } } - - ColumnLayout { - id: buttonLayout - spacing: JamiTheme.preferredMarginSize - Layout.preferredWidth: root.width - 240 - - MaterialButton { - id: chooseBtn - - TextMetrics { - id: chooseBtnTextSize - font.weight: Font.Bold - font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize - font.capitalization: Font.AllUppercase - text: chooseBtn.text - } - - Layout.alignment: Qt.AlignCenter - Layout.fillWidth: true - - primary: true - enabled: devicesListView.currentItem - - text: JamiStrings.chooseThisDevice - toolTipText: JamiStrings.chooseThisDevice - - onClicked: { - CurrentConversation.setInfo("rdvAccount", CurrentAccount.uri); - CurrentConversation.setInfo("rdvDevice", devicesListView.currentItem.deviceId); - close(); - } - } - - MaterialButton { - id: rmDeviceBtn - - TextMetrics { - id: rmDeviceBtnTextSize - font.weight: Font.Bold - font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize - font.capitalization: Font.AllUppercase - text: rmDeviceBtn.text - } - - Layout.alignment: Qt.AlignCenter - Layout.fillWidth: true - primary: true - enabled: devicesListView.currentItem - - text: JamiStrings.removeCurrentDevice - toolTipText: JamiStrings.removeCurrentDevice - - onClicked: { - CurrentConversation.setInfo("rdvAccount", ""); - CurrentConversation.setInfo("rdvDevice", ""); - close(); - } - } - } } - } +} diff --git a/src/app/mainview/components/HostPopup.qml b/src/app/mainview/components/HostPopup.qml index b278f87bf399e9d57d4b07f009b23e7c04445640..d63a29f37d1e0adfe5b8df08477942e29587b8a6 100644 --- a/src/app/mainview/components/HostPopup.qml +++ b/src/app/mainview/components/HostPopup.qml @@ -31,55 +31,39 @@ BaseModalDialog { return role === Member.Role.ADMIN; } - popupContent: ColumnLayout { - id: mainLayout - spacing: JamiTheme.preferredMarginSize - - Label { - id: informativeLabel - - Layout.alignment: Qt.AlignCenter - Layout.fillWidth: true - Layout.maximumWidth: root.parent.width - 4*JamiTheme.preferredMarginSize - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - text: JamiStrings.needsHost - color: JamiTheme.primaryForegroundColor - } - - MaterialButton { - id: becomeHostBtn - - Layout.alignment: Qt.AlignCenter - - Layout.margins: JamiTheme.preferredMarginSize - text: isAdmin ? JamiStrings.becomeHostOneCall : JamiStrings.hostThisCall - - onClicked: { - MessagesAdapter.joinCall(CurrentAccount.uri, CurrentAccount.deviceId, "0"); - close(); - } - } - - MaterialButton { - id: becomeDefaultHostBtn + button1.text: isAdmin ? JamiStrings.becomeHostOneCall : JamiStrings.hostThisCall + button1Role: DialogButtonBox.ApplyRole + button1.onClicked: { + MessagesAdapter.joinCall(CurrentAccount.uri, CurrentAccount.deviceId, "0"); + close(); + } - Layout.alignment: Qt.AlignCenter - Layout.margins: JamiTheme.preferredMarginSize + button2.text: JamiStrings.becomeDefaultHost + button2Role: DialogButtonBox.ApplyRole + button2.visible: isAdmin + button2.toolTipText: JamiStrings.becomeDefaultHost + button2.onClicked: { + CurrentConversation.setInfo("rdvAccount", CurrentAccount.uri); + CurrentConversation.setInfo("rdvDevice", CurrentAccount.deviceId); + MessagesAdapter.joinCall(CurrentAccount.uri, CurrentAccount.deviceId, "0"); + close(); + } - text: JamiStrings.becomeDefaultHost - toolTipText: JamiStrings.becomeDefaultHost + popupContent: ColumnLayout { + id: mainLayout - visible: isAdmin + Label { + id: informativeLabel - onClicked: { - CurrentConversation.setInfo("rdvAccount", CurrentAccount.uri); - CurrentConversation.setInfo("rdvDevice", devicesListView.currentItem.deviceId); - MessagesAdapter.joinCall(CurrentAccount.uri, CurrentAccount.deviceId, "0"); - close(); - } - } + Layout.alignment: Qt.AlignCenter + Layout.bottomMargin: 10 + Layout.fillWidth: true + Layout.maximumWidth: root.parent.width - 4*JamiTheme.preferredMarginSize + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: JamiStrings.needsHost + color: JamiTheme.primaryForegroundColor } } -//} +} diff --git a/src/app/mainview/components/WelcomePageQrDialog.qml b/src/app/mainview/components/WelcomePageQrDialog.qml index 1712941b592527524f63eb605e7bffac8fae3ab3..2d61e5348459dd34405bfb246f785c5fdbce3980 100644 --- a/src/app/mainview/components/WelcomePageQrDialog.qml +++ b/src/app/mainview/components/WelcomePageQrDialog.qml @@ -24,20 +24,25 @@ import "../../commoncomponents" BaseModalDialog { id: root - topLayoutVisible: false + backgroundColor: JamiTheme.darkTheme ? JamiTheme.blackColor : JamiTheme.whiteColor - backgroundColor: JamiTheme.whiteColor + popupContent: Rectangle{ + anchors.centerIn: parent + width: userQrImage.width + 10 + height: userQrImage.height + 10 + color: JamiTheme.whiteColor + radius: 5 - popupContent: Image { + Image { id: userQrImage property int size: JamiTheme.qrCodeImageSize width: size height: size anchors.centerIn: parent - smooth: false fillMode: Image.PreserveAspectFit source: "image://qrImage/account_" + CurrentAccount.id + } } } diff --git a/src/app/qmlregister.cpp b/src/app/qmlregister.cpp index da5681b3e9dba7fffcad286bb7b0e0c2328167de..47848256447ecf1e033197d56e0cbe635dfdf0cb 100644 --- a/src/app/qmlregister.cpp +++ b/src/app/qmlregister.cpp @@ -109,7 +109,7 @@ registerTypes(QQmlEngine* engine, AppSettingsManager* settingsManager, ConnectivityMonitor* connectivityMonitor, ScreenInfo* screenInfo, - MainApplication* app) + QObject* app) { // setup the adapters (their lifetimes are that of MainApplication) auto callAdapter = new CallAdapter(settingsManager, systemTray, lrcInstance, engine); diff --git a/src/app/qmlregister.h b/src/app/qmlregister.h index 41b8f2f8b8483933171d1714750dea93e98030a6..008c3be51b629bd609753c012cc3d2e6ba38c5d7 100644 --- a/src/app/qmlregister.h +++ b/src/app/qmlregister.h @@ -68,5 +68,5 @@ void registerTypes(QQmlEngine* engine, AppSettingsManager* appSettingsManager, ConnectivityMonitor* connectivityMonitor, ScreenInfo* screenInfo, - MainApplication* app); + QObject* app); } diff --git a/src/app/settingsview/components/InstallManuallyView.qml b/src/app/settingsview/components/InstallManuallyView.qml index 5c0d02eaf371dd402fc74dd8af9c31614dbf8e70..950813571f2eda7fa98bb10f6ec1ba5e8eb9a7ca 100644 --- a/src/app/settingsview/components/InstallManuallyView.qml +++ b/src/app/settingsview/components/InstallManuallyView.qml @@ -32,7 +32,8 @@ ColumnLayout { "infoText": JamiStrings.pluginInstallationFailed, "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue], "buttonTitles": [JamiStrings.optionOk], - "buttonCallBacks": [] + "buttonCallBacks": [], + "buttonRoles": [DialogButtonBox.AcceptRole] }); } diff --git a/src/app/settingsview/components/LinkedDevicesBase.qml b/src/app/settingsview/components/LinkedDevicesBase.qml index 1f6a1824de8507aabede5e7791799df8db07b4da..7e631edf4dc8f7ca338f8f08f85a679204657ff2 100644 --- a/src/app/settingsview/components/LinkedDevicesBase.qml +++ b/src/app/settingsview/components/LinkedDevicesBase.qml @@ -49,7 +49,8 @@ ColumnLayout { "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue, SimpleMessageDialog.ButtonStyle.TintedBlack], "buttonCallBacks": [function () { DeviceItemListModel.revokeDevice(deviceId, ""); - }] + }], + "buttonRoles": [DialogButtonBox.AcceptRole, DialogButtonBox.RejectRole] }); } } diff --git a/src/app/settingsview/components/ManageAccountPage.qml b/src/app/settingsview/components/ManageAccountPage.qml index 9c44878324679308e6b5224b63ed8a3a59b5ad06..8cbd7cdb3132d6e69b2597d13539c72ac419c653 100644 --- a/src/app/settingsview/components/ManageAccountPage.qml +++ b/src/app/settingsview/components/ManageAccountPage.qml @@ -366,7 +366,8 @@ SettingsPageBase { "title": success ? JamiStrings.success : JamiStrings.error, "infoText": success ? JamiStrings.backupSuccessful : JamiStrings.backupFailed, "buttonTitles": [JamiStrings.optionOk], - "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue] + "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue], + "buttonRoles": [DialogButtonBox.AcceptRole] }); } }); diff --git a/src/app/settingsview/components/NameRegistrationDialog.qml b/src/app/settingsview/components/NameRegistrationDialog.qml index f596b11fe5c1d44d590895461ef0b943d84d8f09..2d673bd0bb93b4e7ac060d3a4a9dafeda87dc15a 100644 --- a/src/app/settingsview/components/NameRegistrationDialog.qml +++ b/src/app/settingsview/components/NameRegistrationDialog.qml @@ -33,6 +33,8 @@ BaseModalDialog { title: JamiStrings.setUsername + button2.onClicked: close() + popupContent: StackLayout { id: stackedWidget @@ -74,6 +76,10 @@ BaseModalDialog { break; } stackedWidget.currentIndex = nameRegisterErrorPage.pageIndex; + root.button1.text = JamiStrings.close; + button1Role = DialogButtonBox.RejectRole; + root.button1.onClicked = close() + root.button2.visible = false; } } @@ -83,6 +89,16 @@ BaseModalDialog { passwordEdit.clear(); if (CurrentAccount.hasArchivePassword) { stackedWidget.currentIndex = nameRegisterEnterPasswordPage.pageIndex; + root.button1.text = JamiStrings.register; + button1Role = DialogButtonBox.AcceptRole; + root.button1.enabled = false + root.button1.clicked.connect(function() { + stackedWidget.startRegistration(); + }); + + root.button2.text = JamiStrings.optionCancel; + root.button2Role = DialogButtonBox.RejectRole + passwordEdit.forceActiveFocus(); } else { startRegistration(); @@ -124,52 +140,9 @@ BaseModalDialog { echoMode: TextInput.Password placeholderText: JamiStrings.password - onTextChanged: btnRegister.enabled = (text.length > 0) - - onAccepted: btnRegister.clicked() - } - - RowLayout { - spacing: 16 - Layout.alignment: Qt.AlignHCenter - Layout.fillWidth: true - - MaterialButton { - id: btnRegister - - Layout.alignment: Qt.AlignHCenter - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - buttontextHeightMargin: JamiTheme.buttontextHeightMargin - - color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - enabled: false - - text: JamiStrings.register - - onClicked: stackedWidget.startRegistration() - } - - MaterialButton { - id: btnCancel + onTextChanged: root.button1.enabled = (text.length > 0) - Layout.alignment: Qt.AlignHCenter - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - buttontextHeightMargin: JamiTheme.buttontextHeightMargin - - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - - text: JamiStrings.optionCancel - - onClicked: close() - } + onAccepted: root.button1.clicked() } } } @@ -225,8 +198,6 @@ BaseModalDialog { ColumnLayout { - spacing: 16 - Label { id: lblRegistrationError @@ -238,25 +209,6 @@ BaseModalDialog { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } - - MaterialButton { - id: btnClose - - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - Layout.bottomMargin: JamiTheme.preferredMarginSize - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - buttontextHeightMargin: JamiTheme.buttontextHeightMargin - - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - - text: JamiStrings.close - - onClicked: close() - } } } } diff --git a/src/app/settingsview/components/PluginAvailableDelegate.qml b/src/app/settingsview/components/PluginAvailableDelegate.qml index ee0a9ea9c2b115ac52e0d2c73caa86b6487f4999..e8ae7dcac94a6afa9ddfafb2578c1a3c8665fb72 100644 --- a/src/app/settingsview/components/PluginAvailableDelegate.qml +++ b/src/app/settingsview/components/PluginAvailableDelegate.qml @@ -62,7 +62,8 @@ ItemDelegate { "infoText": JamiStrings.pluginInstallationFailed, "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue], "buttonTitles": [JamiStrings.optionOk], - "buttonCallBacks": [] + "buttonCallBacks": [], + "buttonRoles": [DialogButtonBox.AcceptRole] }); } diff --git a/src/app/settingsview/components/PluginPreferencesListView.qml b/src/app/settingsview/components/PluginPreferencesListView.qml index b47bc3ef19d8c1efc212226334e24606e871dd56..41a20633fc07d604f7d9a4baf04ddab766f4869f 100644 --- a/src/app/settingsview/components/PluginPreferencesListView.qml +++ b/src/app/settingsview/components/PluginPreferencesListView.qml @@ -288,7 +288,8 @@ Rectangle { } preferencesPerCategoryModel.reset(); generalPreferencesModel.reset(); - }] + }], + "buttonRoles": [DialogButtonBox.AcceptRole, DialogButtonBox.RejectRole] }) } } diff --git a/src/app/settingsview/components/PluginPreferencesView.qml b/src/app/settingsview/components/PluginPreferencesView.qml index 79d8163ec132ddbd1c830f4e82feb106f9e55bc5..e17074b827213ae54499705853777dbf4e5f232a 100644 --- a/src/app/settingsview/components/PluginPreferencesView.qml +++ b/src/app/settingsview/components/PluginPreferencesView.qml @@ -295,7 +295,8 @@ Item { PluginAdapter.getPluginsFromStore(); // could not call root from here settings.ListView.view.parent.closed(); - }] + }], + "buttonRoles": [DialogButtonBox.AcceptRole, DialogButtonBox.RejectRole] }) } } diff --git a/src/app/settingsview/components/RevokeDevicePasswordDialog.qml b/src/app/settingsview/components/RevokeDevicePasswordDialog.qml index aae59f874ab093af498b5c126913c777fd715916..6559609742288563c51f684a9ccfc131d082b7c3 100644 --- a/src/app/settingsview/components/RevokeDevicePasswordDialog.qml +++ b/src/app/settingsview/components/RevokeDevicePasswordDialog.qml @@ -30,6 +30,19 @@ BaseModalDialog { title: JamiStrings.removeDevice + closeButtonVisible: false + + button1.text: JamiStrings.optionRemove + button1Role: DialogButtonBox.DestructiveRole + button1.enabled: false + button1.onClicked: { + DeviceItemListModel.revokeDevice(deviceId, passwordEdit.dynamicText); + close(); + } + button2.text: JamiStrings.optionCancel + button2Role: DialogButtonBox.RejectRole + button2.onClicked: close() + popupContent: ColumnLayout { id: revokeDeviceContentColumnLayout @@ -60,57 +73,7 @@ BaseModalDialog { placeholderText: JamiStrings.enterCurrentPassword - onDynamicTextChanged: btnRemove.enabled = dynamicText.length > 0 - } - - RowLayout { - spacing: 16 - Layout.alignment: Qt.AlignHCenter - - Layout.fillWidth: true - - MaterialButton { - id: btnRemove - - Layout.alignment: Qt.AlignHCenter - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - buttontextHeightMargin: JamiTheme.buttontextHeightMargin - - color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - autoAccelerator: true - enabled: false - - text: JamiStrings.optionRemove - - onClicked: { - DeviceItemListModel.revokeDevice(deviceId, passwordEdit.dynamicText); - close(); - } - } - - MaterialButton { - id: btnCancel - - Layout.alignment: Qt.AlignHCenter - - preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - buttontextHeightMargin: JamiTheme.buttontextHeightMargin - - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - autoAccelerator: true - enabled: true - - text: JamiStrings.optionCancel - - onClicked: close() - } + onDynamicTextChanged: root.button1.enabled = dynamicText.length > 0 } } } diff --git a/src/app/settingsview/components/UpdateDownloadDialog.qml b/src/app/settingsview/components/UpdateDownloadDialog.qml index 9607f7621813c0953754cc107d3b0fe15b846ac4..5b91cee2f2f1fc439aaf8234cc4a67b4ffde6284 100644 --- a/src/app/settingsview/components/UpdateDownloadDialog.qml +++ b/src/app/settingsview/components/UpdateDownloadDialog.qml @@ -33,6 +33,12 @@ SimpleMessageDialog { property string hTotalBytes: UtilsAdapter.humanFileSize(totalBytes) property alias progressBarValue: progressBar.value + closeButtonVisible: false + + button1.text: JamiStrings.optionCancel + button1Role: DialogButtonBox.RejectRole + button1.onClicked: function () { AppVersionManager.cancelUpdate();} + Connections { target: AppVersionManager diff --git a/src/app/webengine/map/StopSharingPositionPopup.qml b/src/app/webengine/map/StopSharingPositionPopup.qml index 153d81efcba9effdcc5f403579bcab4714de3f68..61a201f3855982f58c79653d71c7d49d1a007852 100644 --- a/src/app/webengine/map/StopSharingPositionPopup.qml +++ b/src/app/webengine/map/StopSharingPositionPopup.qml @@ -24,151 +24,21 @@ import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import "../../commoncomponents" -Popup { +BaseModalDialog { id: root - - width: popupContent.width - height: popupContent.height - - parent: Overlay.overlay - - // center in parent - x: Math.round((parent.width - width) / 2) - y: Math.round((parent.height - height) / 2) - - signal joinClicked - - modal: true - padding: 0 - - visible: false - focus: true - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - Rectangle { - id: container - - anchors.fill: parent - radius: JamiTheme.modalPopupRadius - color: JamiTheme.secondaryBackgroundColor - - ColumnLayout { - id: popupContent - - Layout.alignment: Qt.AlignCenter - - PushButton { - id: btnClose - - Layout.alignment: Qt.AlignRight - width: 30 - height: 30 - imageContainerWidth: 30 - imageContainerHeight: 30 - Layout.margins: 8 - radius: 5 - imageColor: "grey" - normalColor: JamiTheme.transparentColor - source: JamiResources.round_close_24dp_svg - onClicked: { - root.visible = false; - } - } - - Text { - Layout.leftMargin: 20 - Layout.rightMargin: 20 - Layout.fillWidth: true - Layout.alignment: Qt.AlignCenter - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - font.pixelSize: JamiTheme.popuptextSize - font.weight: Font.Medium - wrapMode: Text.WordWrap - color: JamiTheme.textColor - text: JamiStrings.stopSharingPopupBody - } - - RowLayout { - Layout.margins: JamiTheme.popupButtonsMargin - Layout.alignment: Qt.AlignCenter - - MaterialButton { - preferredWidth: text.contentWidth - textLeftPadding: JamiTheme.buttontextPadding - textRightPadding: JamiTheme.buttontextPadding - - color: JamiTheme.buttonTintedBlue - hoveredColor: JamiTheme.buttonTintedBlueHovered - pressedColor: JamiTheme.buttonTintedBluePressed - text: JamiStrings.stopConvSharing.arg(PositionManager.getmapTitle(attachedAccountId, CurrentConversation.id)) - - onClicked: { - PositionManager.stopSharingPosition(attachedAccountId, CurrentConversation.id); - root.close(); - } - } - - MaterialButton { - preferredWidth: text.contentWidth - textLeftPadding: JamiTheme.buttontextPadding - textRightPadding: JamiTheme.buttontextPadding - - color: JamiTheme.buttonTintedRed - hoveredColor: JamiTheme.buttonTintedRedHovered - pressedColor: JamiTheme.buttonTintedRedPressed - - text: JamiStrings.stopAllSharings - - onClicked: { - PositionManager.stopSharingPosition(); - root.close(); - } - } - } - } - } - - background: Rectangle { - color: JamiTheme.transparentColor + title: JamiStrings.stopSharingPopupBody + button1.text: JamiStrings.stopConvSharing.arg(PositionManager.getmapTitle(attachedAccountId, CurrentConversation.id)) + button1Role: DialogButtonBox.AcceptRole + button2.text: JamiStrings.stopAllSharings + button2Role: DialogButtonBox.DestructiveRole + button2.contentColorProvider: JamiTheme.redButtonColor + button1.onClicked: function() { + PositionManager.stopSharingPosition(attachedAccountId, CurrentConversation.id); + root.close(); } - - Overlay.modal: Rectangle { - color: JamiTheme.transparentColor - // Color animation for overlay when pop up is shown. - ColorAnimation on color { - to: JamiTheme.popupOverlayColor - duration: 500 - } + button2.onClicked: function() { + PositionManager.stopSharingPosition(); + root.close(); } - - DropShadow { - z: -1 - width: root.width - height: root.height - horizontalOffset: 3.0 - verticalOffset: 3.0 - radius: container.radius * 4 - color: JamiTheme.shadowColor - source: container - transparentBorder: true - samples: radius + 1 - } - - enter: Transition { - NumberAnimation { - properties: "opacity" - from: 0.0 - to: 1.0 - duration: JamiTheme.shortFadeDuration - } - } - - exit: Transition { - NumberAnimation { - properties: "opacity" - from: 1.0 - to: 0.0 - duration: JamiTheme.shortFadeDuration - } - } -} + signal joinClicked + } diff --git a/src/app/wizardview/components/NoUsernamePopup.qml b/src/app/wizardview/components/NoUsernamePopup.qml index 4bf79a2c7dcf0ebd9d70cf2548698bef43dc992c..a225097cf2ddebc851f37b3a3cc15617787b3e6a 100644 --- a/src/app/wizardview/components/NoUsernamePopup.qml +++ b/src/app/wizardview/components/NoUsernamePopup.qml @@ -24,17 +24,11 @@ import net.jami.Constants 1.1 import Qt5Compat.GraphicalEffects import "../../commoncomponents" -Popup { +BaseModalDialog { id: root - width: popupContent.width - height: popupContent.height - - parent: Overlay.overlay - - // center in parent - x: Math.round((parent.width - width) / 2) - y: Math.round((parent.height - height) / 2) + title: JamiStrings.chooseAUsername + closeButtonVisible: false signal joinClicked @@ -45,140 +39,28 @@ Popup { focus: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - Rectangle { - id: container - - anchors.fill: parent - radius: JamiTheme.modalPopupRadius - color: JamiTheme.secondaryBackgroundColor - - ColumnLayout { - id: popupContent - - Layout.alignment: Qt.AlignCenter - - PushButton { - id: btnClose - - Layout.alignment: Qt.AlignRight - width: 30 - height: 30 - imageContainerWidth: 30 - imageContainerHeight: 30 - Layout.margins: 8 - radius: 5 - imageColor: "grey" - normalColor: JamiTheme.transparentColor - source: JamiResources.round_close_24dp_svg - onClicked: { - root.visible = false; - } - } + button1.text: JamiStrings.chooseAUsername + button1Role: DialogButtonBox.NoRole + button2.text: JamiStrings.joinJami + button2Role: DialogButtonBox.YesRole + button2.objectName: "joinButton" + button2.onClicked: { + root.joinClicked(); + WizardViewStepModel.nextStep(); + root.close(); + } + button1.onClicked: root.close() - Text { + popupContent: Text { + Layout.fillWidth: true Layout.preferredWidth: 280 Layout.leftMargin: 20 Layout.rightMargin: 20 - Layout.alignment: Qt.AlignCenter - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter + Layout.alignment: Qt.AlignLeft font.pixelSize: JamiTheme.popuptextSize lineHeight: JamiTheme.wizardViewTextLineHeight wrapMode: Text.WordWrap color: JamiTheme.textColor text: JamiStrings.joinJamiNoPassword - } - - RowLayout { - Layout.topMargin: JamiTheme.popupButtonsMargin - Layout.bottomMargin: JamiTheme.popupButtonsMargin - - Layout.alignment: Qt.AlignCenter - spacing: JamiTheme.popupButtonsMargin - - MaterialButton { - - TextMetrics { - id: joinJamiSize - font.weight: Font.Bold - font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize - text: JamiStrings.joinJami - } - - Layout.leftMargin: JamiTheme.popupButtonsMargin - objectName: "joinButton" - preferredWidth: joinJamiSize.width + 2 * (JamiTheme.buttontextWizzardPadding + 1) - textLeftPadding: JamiTheme.buttontextWizzardPadding - textRightPadding: JamiTheme.buttontextWizzardPadding - secondary: true - text: JamiStrings.joinJami - onClicked: { - root.joinClicked(); - WizardViewStepModel.nextStep(); - root.close(); - } - } - - MaterialButton { - - TextMetrics { - id: chooseAUsernameSize - font.weight: Font.Bold - font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize - text: JamiStrings.chooseAUsername - } - - Layout.rightMargin: JamiTheme.popupButtonsMargin - preferredWidth: chooseAUsernameSize.width + 2 * JamiTheme.buttontextWizzardPadding - primary: true - text: JamiStrings.chooseAUsername - onClicked: root.close() - } - } - } - } - - 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 { - z: -1 - width: root.width - height: root.height - horizontalOffset: 3.0 - verticalOffset: 3.0 - radius: container.radius * 4 - color: JamiTheme.shadowColor - source: container - transparentBorder: true - samples: radius + 1 - } - - enter: Transition { - NumberAnimation { - properties: "opacity" - from: 0.0 - to: 1.0 - duration: JamiTheme.shortFadeDuration - } - } - - exit: Transition { - NumberAnimation { - properties: "opacity" - from: 1.0 - to: 0.0 - duration: JamiTheme.shortFadeDuration } } -} diff --git a/tests/qml/main.cpp b/tests/qml/main.cpp index 23edaa66a9ece6abb7a83e2947cbf2a9f5eb6d2b..da9d78faeb2a6140c3cef30ffad83137aec1725d 100644 --- a/tests/qml/main.cpp +++ b/tests/qml/main.cpp @@ -87,8 +87,8 @@ public Q_SLOTS: // Expose custom types to the QML engine. Utils::registerTypes(engine, - systemTray_.get(), lrcInstance_.get(), + systemTray_.get(), settingsManager_.get(), connectivityMonitor_.get(), &screenInfo_,