2020-06-17 19:31:01 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2020-05-29 16:27:50 +00:00
|
|
|
import "../imports"
|
|
|
|
|
2020-05-29 18:38:11 +00:00
|
|
|
Popup {
|
2020-06-11 21:23:27 +00:00
|
|
|
property string title
|
|
|
|
default property alias content: popupContent.children
|
|
|
|
property alias header: headerContent.children
|
2020-05-29 16:27:50 +00:00
|
|
|
|
2020-06-11 21:23:27 +00:00
|
|
|
id: popup
|
|
|
|
modal: true
|
|
|
|
property alias footer: footerContent.children
|
2020-05-29 16:27:50 +00:00
|
|
|
|
2020-06-11 21:23:27 +00:00
|
|
|
Overlay.modal: Rectangle {
|
|
|
|
color: "#60000000"
|
|
|
|
}
|
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
|
|
|
parent: Overlay.overlay
|
|
|
|
x: Math.round((parent.width - width) / 2)
|
|
|
|
y: Math.round((parent.height - height) / 2)
|
|
|
|
width: 480
|
|
|
|
height: 510 // TODO find a way to make this dynamic
|
|
|
|
background: Rectangle {
|
2020-07-02 15:14:31 +00:00
|
|
|
color: Style.current.white
|
2020-06-11 21:23:27 +00:00
|
|
|
radius: 8
|
|
|
|
}
|
|
|
|
padding: 0
|
|
|
|
contentItem: Item {
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: headerContent
|
|
|
|
width: parent.width
|
|
|
|
height: {
|
|
|
|
var idx = !!title ? 0 : 1
|
2020-07-02 15:14:31 +00:00
|
|
|
return children[idx] && children[idx].height + Style.current.padding
|
2020-06-11 21:23:27 +00:00
|
|
|
}
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.bottomMargin: Style.current.padding
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-06-09 10:01:19 +00:00
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-11 21:23:27 +00:00
|
|
|
text: title
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
font.bold: true
|
|
|
|
font.pixelSize: 17
|
|
|
|
anchors.leftMargin: 16
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.bottomMargin: Style.current.padding
|
2020-06-11 21:23:27 +00:00
|
|
|
visible: !!title
|
|
|
|
}
|
2020-06-09 10:01:19 +00:00
|
|
|
}
|
2020-05-29 16:27:50 +00:00
|
|
|
|
2020-06-11 21:23:27 +00:00
|
|
|
Rectangle {
|
|
|
|
id: closeButton
|
|
|
|
height: 32
|
|
|
|
width: 32
|
|
|
|
anchors.top: parent.top
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.rightMargin: Style.current.padding
|
2020-06-11 21:23:27 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
radius: 8
|
2020-05-29 16:27:50 +00:00
|
|
|
|
2020-06-25 13:23:17 +00:00
|
|
|
SVGImage {
|
2020-06-11 21:23:27 +00:00
|
|
|
id: closeModalImg
|
|
|
|
source: "./img/close.svg"
|
2020-06-25 13:23:17 +00:00
|
|
|
width: 25
|
|
|
|
height: 25
|
2020-06-11 21:23:27 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2020-05-29 16:27:50 +00:00
|
|
|
|
2020-06-11 21:23:27 +00:00
|
|
|
MouseArea {
|
|
|
|
id: closeModalMouseArea
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
onExited: {
|
2020-07-02 15:14:31 +00:00
|
|
|
closeButton.color = Style.current.white
|
2020-06-11 21:23:27 +00:00
|
|
|
}
|
|
|
|
onEntered: {
|
2020-07-02 15:14:31 +00:00
|
|
|
closeButton.color = Style.current.grey
|
2020-06-11 21:23:27 +00:00
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
popup.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-29 16:27:50 +00:00
|
|
|
|
2020-06-11 21:23:27 +00:00
|
|
|
Separator {
|
|
|
|
id: separator
|
|
|
|
anchors.top: headerContent.bottom
|
|
|
|
}
|
2020-05-29 16:27:50 +00:00
|
|
|
|
2020-06-11 21:23:27 +00:00
|
|
|
Item {
|
|
|
|
id: popupContent
|
|
|
|
anchors.top: separator.bottom
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.topMargin: Style.current.padding
|
2020-06-11 21:23:27 +00:00
|
|
|
anchors.bottom: separator2.top
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.bottomMargin: Style.current.padding
|
2020-06-11 21:23:27 +00:00
|
|
|
anchors.left: parent.left
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-06-11 21:23:27 +00:00
|
|
|
anchors.right: parent.right
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.rightMargin: Style.current.padding
|
2020-06-11 21:23:27 +00:00
|
|
|
}
|
2020-05-29 18:38:11 +00:00
|
|
|
|
2020-06-11 21:23:27 +00:00
|
|
|
Separator {
|
|
|
|
id: separator2
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 75
|
|
|
|
}
|
2020-05-29 18:38:11 +00:00
|
|
|
|
2020-06-11 21:23:27 +00:00
|
|
|
Item {
|
2020-06-11 08:22:20 +00:00
|
|
|
id: footerContent
|
|
|
|
height: children[0] && children[0].height
|
|
|
|
width: parent.width
|
|
|
|
anchors.top: separator2.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.bottomMargin: Style.current.padding
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-06-11 21:23:27 +00:00
|
|
|
}
|
2020-06-11 08:22:20 +00:00
|
|
|
}
|
2020-06-11 21:23:27 +00:00
|
|
|
}
|