1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-09-05 22:53:18 +02:00

BaseModalDialog: redesign popups and add standard buttons

GitLab: #1417
Change-Id: I8693ff36d313c730b6d8fa2ea7586d1a71d582d7
This commit is contained in:
cberthet 2023-11-07 11:29:49 -05:00 committed by Sébastien Blin
parent 7f414f652e
commit 23413a8f45
28 changed files with 380 additions and 812 deletions

View file

@ -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]
});
}

View file

@ -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
}
}
}
}

View file

@ -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 {
}
}
}
}

View file

@ -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()
}
}
}
}

View file

@ -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()
}
}
}

View file

@ -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()
}
}
}
}

View file

@ -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

View file

@ -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();
}
}
}
}

View file

@ -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();
}
}
}
}
}
}

View file

@ -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")

View file

@ -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"

View file

@ -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();
}
}
}
}
}
}

View file

@ -31,55 +31,39 @@ BaseModalDialog {
return role === Member.Role.ADMIN;
}
button1.text: isAdmin ? JamiStrings.becomeHostOneCall : JamiStrings.hostThisCall
button1Role: DialogButtonBox.ApplyRole
button1.onClicked: {
MessagesAdapter.joinCall(CurrentAccount.uri, CurrentAccount.deviceId, "0");
close();
}
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();
}
popupContent: ColumnLayout {
id: mainLayout
spacing: JamiTheme.preferredMarginSize
id: mainLayout
Label {
id: informativeLabel
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
Layout.alignment: Qt.AlignCenter
Layout.margins: JamiTheme.preferredMarginSize
text: JamiStrings.becomeDefaultHost
toolTipText: JamiStrings.becomeDefaultHost
visible: isAdmin
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
}
}
//}
}

View file

@ -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
}
}
}

View file

@ -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);

View file

@ -68,5 +68,5 @@ void registerTypes(QQmlEngine* engine,
AppSettingsManager* appSettingsManager,
ConnectivityMonitor* connectivityMonitor,
ScreenInfo* screenInfo,
MainApplication* app);
QObject* app);
}

View file

@ -32,7 +32,8 @@ ColumnLayout {
"infoText": JamiStrings.pluginInstallationFailed,
"buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue],
"buttonTitles": [JamiStrings.optionOk],
"buttonCallBacks": []
"buttonCallBacks": [],
"buttonRoles": [DialogButtonBox.AcceptRole]
});
}

View file

@ -49,7 +49,8 @@ ColumnLayout {
"buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue, SimpleMessageDialog.ButtonStyle.TintedBlack],
"buttonCallBacks": [function () {
DeviceItemListModel.revokeDevice(deviceId, "");
}]
}],
"buttonRoles": [DialogButtonBox.AcceptRole, DialogButtonBox.RejectRole]
});
}
}

View file

@ -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]
});
}
});

View file

@ -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)
onTextChanged: root.button1.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
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()
}
}
}
}

View file

@ -62,7 +62,8 @@ ItemDelegate {
"infoText": JamiStrings.pluginInstallationFailed,
"buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue],
"buttonTitles": [JamiStrings.optionOk],
"buttonCallBacks": []
"buttonCallBacks": [],
"buttonRoles": [DialogButtonBox.AcceptRole]
});
}

View file

@ -288,7 +288,8 @@ Rectangle {
}
preferencesPerCategoryModel.reset();
generalPreferencesModel.reset();
}]
}],
"buttonRoles": [DialogButtonBox.AcceptRole, DialogButtonBox.RejectRole]
})
}
}

View file

@ -295,7 +295,8 @@ Item {
PluginAdapter.getPluginsFromStore();
// could not call root from here
settings.ListView.view.parent.closed();
}]
}],
"buttonRoles": [DialogButtonBox.AcceptRole, DialogButtonBox.RejectRole]
})
}
}

View file

@ -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
}
}
}

View file

@ -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

View file

@ -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)
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();
}
button2.onClicked: function() {
PositionManager.stopSharingPosition();
root.close();
}
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
}
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
}
}
}
}

View file

@ -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
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()
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 {
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
}
}
}

View file

@ -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_,