1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-04 14:55:43 +02:00

wizard: size NoUsernamePopup according to content size

Didn't use BaseModalDialog:
- class doesn't adapt to content size
- can't be changed without breaking other popups

Change-Id: Id62febfe7651481fe4fb666b2d09c624d7f4fb6d
Gitlab: #844
This commit is contained in:
Nicolas Vengeon 2022-09-29 13:32:24 -04:00 committed by Andreas Traczyk
parent c99d4967c6
commit d4bbcfbeb4
3 changed files with 84 additions and 19 deletions

View file

@ -46,6 +46,8 @@ AbstractButton {
iconSource.length !== 0 iconSource.length !== 0
property var preferredWidth property var preferredWidth
property real textLeftPadding
property real textRightPadding
Binding on width { Binding on width {
when: root.preferredWidth !== undefined || when: root.preferredWidth !== undefined ||
@ -173,6 +175,8 @@ AbstractButton {
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
leftPadding: textLeftPadding
rightPadding: textRightPadding
text: root.text text: root.text
font.weight: Font.Medium font.weight: Font.Medium
elide: Text.ElideRight elide: Text.ElideRight

View file

@ -434,11 +434,17 @@ Item {
property real tipBoxTitleFontSize: calcSize(13) property real tipBoxTitleFontSize: calcSize(13)
property real tipBoxContentFontSize: calcSize(12) property real tipBoxContentFontSize: calcSize(12)
//Popups
property real popuptextSize: calcSize(15)
property real popupButtonsMargin: 20
// MaterialLineEdit // MaterialLineEdit
property real materialLineEditPointSize: calcSize(10 + fontSizeOffset) property real materialLineEditPointSize: calcSize(10 + fontSizeOffset)
property real materialLineEditPadding: 16 property real materialLineEditPadding: 16
//MaterialButton
property real buttontextPadding: 10
// UsernameLineEdit // UsernameLineEdit
property real usernameLineEditPointSize:calcSize(9 + fontSizeOffset) property real usernameLineEditPointSize:calcSize(9 + fontSizeOffset)
property real usernameLineEditlookupInterval: 200 property real usernameLineEditlookupInterval: 200

View file

@ -28,49 +28,62 @@ import Qt5Compat.GraphicalEffects
import "../../commoncomponents" import "../../commoncomponents"
BaseModalDialog { Popup {
id: root id: root
width: 350
height: 240 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 signal joinClicked
popupContent: Item { modal:true
padding: 0
visible: false
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
Rectangle {
id: container
anchors.fill: parent
radius: JamiTheme.modalPopupRadius
color: JamiTheme.secondaryBackgroundColor
ColumnLayout { ColumnLayout {
id: popupContent
anchors.fill: parent Layout.alignment: Qt.AlignCenter
anchors.bottomMargin: 30
PushButton { PushButton {
id: btnClose id: btnClose
Layout.alignment: Qt.AlignRight
Layout.alignment: Qt.AlignRight
width: 30 width: 30
height: 30 height: 30
imageContainerWidth: 30 imageContainerWidth: 30
imageContainerHeight : 30 imageContainerHeight : 30
Layout.rightMargin: 8 Layout.margins: 8
radius : 5 radius : 5
imageColor: "grey" imageColor: "grey"
normalColor: JamiTheme.transparentColor normalColor: JamiTheme.transparentColor
source: JamiResources.round_close_24dp_svg source: JamiResources.round_close_24dp_svg
onClicked: { root.visible = false } onClicked: { root.visible = false }
} }
Text { Text {
Layout.preferredWidth: 280 Layout.preferredWidth: 280
Layout.leftMargin: 20 Layout.leftMargin: 20
Layout.rightMargin: 20 Layout.rightMargin: 20
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font.pixelSize: 15 font.pixelSize: JamiTheme.popuptextSize
font.weight: Font.Medium font.weight: Font.Medium
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
color: JamiTheme.textColor color: JamiTheme.textColor
@ -78,12 +91,13 @@ BaseModalDialog {
} }
RowLayout{ RowLayout{
Layout.margins: JamiTheme.popupButtonsMargin
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
MaterialButton { MaterialButton {
preferredWidth: 96 preferredWidth: text.contentWidth
Layout.alignment: Qt.AlignCenter textLeftPadding: JamiTheme.buttontextPadding
textRightPadding: JamiTheme.buttontextPadding
secondary: true secondary: true
color: JamiTheme.secAndTertiTextColor color: JamiTheme.secAndTertiTextColor
secHoveredColor: JamiTheme.secAndTertiHoveredBackgroundColor secHoveredColor: JamiTheme.secAndTertiHoveredBackgroundColor
@ -96,14 +110,55 @@ BaseModalDialog {
} }
MaterialButton { MaterialButton {
preferredWidth: 170 preferredWidth: text.contentWidth
Layout.alignment: Qt.AlignCenter textLeftPadding: JamiTheme.buttontextPadding
textRightPadding: JamiTheme.buttontextPadding
Layout.leftMargin: 20 Layout.leftMargin: 20
primary:true primary:true
text: JamiStrings.chooseAUsername text: JamiStrings.chooseAUsername
onClicked: root.close() 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
}
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
} }
} }
} }