2023-04-23 11:05:43 +00:00
|
|
|
import QtCore
|
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
2023-04-24 03:56:33 +00:00
|
|
|
import QtQuick.Controls.Basic
|
2023-04-23 11:05:43 +00:00
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
Dialog {
|
2023-04-23 11:35:38 +00:00
|
|
|
id: popupDialog
|
2023-04-23 11:05:43 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
opacity: 0.9
|
|
|
|
padding: 20
|
|
|
|
property alias text: textField.text
|
2023-04-25 15:20:51 +00:00
|
|
|
property bool shouldTimeOut: true
|
|
|
|
property bool shouldShowBusy: false
|
|
|
|
modal: shouldShowBusy
|
|
|
|
closePolicy: shouldShowBusy ? Popup.NoAutoClose : (Popup.CloseOnEscape | Popup.CloseOnPressOutside)
|
2023-04-23 13:42:35 +00:00
|
|
|
|
|
|
|
Theme {
|
|
|
|
id: theme
|
|
|
|
}
|
|
|
|
|
2023-04-25 15:20:51 +00:00
|
|
|
Row {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
spacing: 20
|
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
Label {
|
2023-04-25 15:20:51 +00:00
|
|
|
id: textField
|
2023-05-25 14:40:10 +00:00
|
|
|
width: Math.min(1024, implicitWidth)
|
|
|
|
height: Math.min(600, implicitHeight)
|
|
|
|
anchors.verticalCenter: shouldShowBusy ? busyIndicator.verticalCenter : parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
2023-06-22 19:44:49 +00:00
|
|
|
textFormat: Text.StyledText
|
2023-05-25 14:40:10 +00:00
|
|
|
wrapMode: Text.WordWrap
|
2023-04-25 15:20:51 +00:00
|
|
|
color: theme.textColor
|
2023-06-22 19:44:49 +00:00
|
|
|
linkColor: theme.linkColor
|
2023-04-25 15:20:51 +00:00
|
|
|
Accessible.role: Accessible.HelpBalloon
|
|
|
|
Accessible.name: text
|
|
|
|
Accessible.description: qsTr("Reveals a shortlived help balloon")
|
2023-06-26 17:37:18 +00:00
|
|
|
onLinkActivated: function(link) { Qt.openUrlExternally(link) }
|
2023-04-25 15:20:51 +00:00
|
|
|
}
|
|
|
|
|
2023-05-31 23:28:09 +00:00
|
|
|
MyBusyIndicator {
|
2023-04-25 15:20:51 +00:00
|
|
|
id: busyIndicator
|
|
|
|
visible: shouldShowBusy
|
|
|
|
running: shouldShowBusy
|
|
|
|
|
|
|
|
Accessible.role: Accessible.Animation
|
|
|
|
Accessible.name: qsTr("Busy indicator")
|
|
|
|
Accessible.description: qsTr("Displayed when the popup is showing busy")
|
|
|
|
}
|
2023-04-23 11:05:43 +00:00
|
|
|
}
|
2023-04-25 15:20:51 +00:00
|
|
|
|
2023-04-23 11:05:43 +00:00
|
|
|
background: Rectangle {
|
|
|
|
anchors.fill: parent
|
2023-04-23 13:42:35 +00:00
|
|
|
color: theme.backgroundDarkest
|
2023-04-23 11:05:43 +00:00
|
|
|
border.width: 1
|
2023-04-23 13:42:35 +00:00
|
|
|
border.color: theme.dialogBorder
|
2023-04-23 11:05:43 +00:00
|
|
|
radius: 10
|
|
|
|
}
|
|
|
|
|
|
|
|
exit: Transition {
|
|
|
|
NumberAnimation { duration: 500; property: "opacity"; from: 1.0; to: 0.0 }
|
|
|
|
}
|
2023-04-23 11:35:38 +00:00
|
|
|
|
|
|
|
onOpened: {
|
2023-04-25 15:20:51 +00:00
|
|
|
if (shouldTimeOut)
|
|
|
|
timer.start()
|
2023-04-23 11:35:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Timer {
|
|
|
|
id: timer
|
|
|
|
interval: 500; running: false; repeat: false
|
|
|
|
onTriggered: popupDialog.close()
|
|
|
|
}
|
2023-04-23 11:05:43 +00:00
|
|
|
}
|