2019-03-31 20:57:57 +00:00
|
|
|
import QtQuick 2.0
|
2019-04-01 00:24:25 +00:00
|
|
|
import QtQuick.Controls 2.2
|
2019-04-01 02:05:38 +00:00
|
|
|
import QtQuick.Layouts 1.2
|
2019-03-31 20:57:57 +00:00
|
|
|
|
2019-04-01 00:24:25 +00:00
|
|
|
NavigableDialog {
|
|
|
|
id: dialog
|
|
|
|
|
2019-04-01 02:32:17 +00:00
|
|
|
property alias text: dialogLabel.dialogText
|
2020-08-09 03:25:26 +00:00
|
|
|
property alias showSpinner: dialogSpinner.visible
|
|
|
|
property alias imageSrc: dialogImage.source
|
2019-04-01 00:24:25 +00:00
|
|
|
|
|
|
|
property string helpText
|
|
|
|
property string helpUrl : "https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting"
|
2019-04-01 03:10:56 +00:00
|
|
|
property string helpTextSeparator : " "
|
2019-04-01 00:24:25 +00:00
|
|
|
|
2019-04-01 02:32:17 +00:00
|
|
|
onOpened: {
|
|
|
|
// Force keyboard focus on the label so keyboard navigation works
|
|
|
|
dialogLabel.forceActiveFocus()
|
|
|
|
}
|
|
|
|
|
2019-04-01 02:05:38 +00:00
|
|
|
RowLayout {
|
2019-04-01 00:24:25 +00:00
|
|
|
spacing: 10
|
|
|
|
|
2020-08-09 03:25:26 +00:00
|
|
|
BusyIndicator {
|
|
|
|
id: dialogSpinner
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
2019-04-01 00:24:25 +00:00
|
|
|
Image {
|
2020-08-09 03:25:26 +00:00
|
|
|
id: dialogImage
|
2019-04-01 00:24:25 +00:00
|
|
|
source: (standardButtons & Dialog.Yes) ?
|
|
|
|
"qrc:/res/baseline-help_outline-24px.svg" :
|
|
|
|
"qrc:/res/baseline-error_outline-24px.svg"
|
|
|
|
sourceSize {
|
|
|
|
// The icon should be square so use the height as the width too
|
|
|
|
width: 50
|
|
|
|
height: 50
|
2019-03-31 20:57:57 +00:00
|
|
|
}
|
2020-08-09 03:25:26 +00:00
|
|
|
visible: !showSpinner
|
2019-04-01 00:24:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
property string dialogText
|
|
|
|
|
2019-04-01 02:32:17 +00:00
|
|
|
id: dialogLabel
|
2019-04-01 03:10:56 +00:00
|
|
|
text: dialogText + ((helpText && (standardButtons & Dialog.Help)) ? (helpTextSeparator + helpText) : "")
|
2019-04-02 01:31:13 +00:00
|
|
|
wrapMode: Text.Wrap
|
|
|
|
elide: Label.ElideRight
|
2019-04-01 00:24:25 +00:00
|
|
|
|
2019-04-01 02:05:38 +00:00
|
|
|
// Cap the width so the dialog doesn't grow horizontally forever. This
|
|
|
|
// will cause word wrap to kick in.
|
|
|
|
Layout.maximumWidth: 400
|
2019-04-02 01:31:13 +00:00
|
|
|
Layout.maximumHeight: 400
|
2019-04-01 00:24:25 +00:00
|
|
|
|
|
|
|
Keys.onReturnPressed: {
|
|
|
|
accept()
|
2019-03-31 20:57:57 +00:00
|
|
|
}
|
2019-04-01 02:40:30 +00:00
|
|
|
|
|
|
|
Keys.onEscapePressed: {
|
|
|
|
reject()
|
|
|
|
}
|
2019-03-31 20:57:57 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-01 00:24:25 +00:00
|
|
|
|
|
|
|
footer: DialogButtonBox {
|
|
|
|
id: dialogButtonBox
|
|
|
|
standardButtons: dialog.standardButtons
|
|
|
|
|
|
|
|
onHelpRequested: {
|
|
|
|
Qt.openUrlExternally(helpUrl)
|
|
|
|
close()
|
|
|
|
}
|
|
|
|
}
|
2019-03-31 20:57:57 +00:00
|
|
|
}
|