2023-07-17 10:49:06 +02:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Controls.Material
|
2022-05-04 15:01:50 +02:00
|
|
|
|
2022-07-26 10:45:22 +02:00
|
|
|
import "controls"
|
|
|
|
|
|
2022-07-26 16:20:17 +02:00
|
|
|
ElDialog {
|
2022-05-04 15:01:50 +02:00
|
|
|
id: dialog
|
|
|
|
|
|
|
|
|
|
property string text
|
2022-08-23 20:21:18 +02:00
|
|
|
property string text_qr
|
2023-07-10 11:22:50 +00:00
|
|
|
// If text is set, it is displayed as a string and also used as data in the QR code shown.
|
|
|
|
|
// text_qr can also be set if we want to show different data in the QR code.
|
|
|
|
|
// If only text_qr is set, the QR code is shown but the string itself is not,
|
|
|
|
|
// however the copy button still exposes the string.
|
|
|
|
|
|
2022-08-24 10:15:03 +02:00
|
|
|
property string text_help
|
2023-07-04 10:55:00 +02:00
|
|
|
property int helpTextIconStyle: InfoTextArea.IconStyle.Info
|
2022-05-04 15:01:50 +02:00
|
|
|
|
|
|
|
|
title: ''
|
2022-09-30 14:37:14 +02:00
|
|
|
|
2022-05-04 15:01:50 +02:00
|
|
|
width: parent.width
|
|
|
|
|
height: parent.height
|
|
|
|
|
|
2023-02-23 20:57:45 +01:00
|
|
|
padding: 0
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
2022-06-15 13:33:19 +02:00
|
|
|
anchors.fill: parent
|
2023-02-23 20:57:45 +01:00
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
|
|
Flickable {
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
contentHeight: rootLayout.height
|
|
|
|
|
clip:true
|
|
|
|
|
interactive: height < contentHeight
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: rootLayout
|
|
|
|
|
width: parent.width
|
|
|
|
|
spacing: constants.paddingMedium
|
|
|
|
|
|
|
|
|
|
TextHighlightPane {
|
2023-11-13 11:37:05 +01:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
Layout.fillWidth: true
|
2023-03-03 10:08:34 +01:00
|
|
|
Layout.leftMargin: constants.paddingMedium
|
|
|
|
|
Layout.rightMargin: constants.paddingMedium
|
2023-11-13 11:37:05 +01:00
|
|
|
|
|
|
|
|
ColumnLayout {
|
2023-02-23 20:57:45 +01:00
|
|
|
width: parent.width
|
2023-11-13 11:37:05 +01:00
|
|
|
|
|
|
|
|
QRImage {
|
|
|
|
|
id: qr
|
|
|
|
|
render: dialog.enter ? false : true
|
|
|
|
|
qrdata: dialog.text_qr ? dialog.text_qr : dialog.text
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
Layout.topMargin: constants.paddingMedium
|
|
|
|
|
Layout.bottomMargin: constants.paddingMedium
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextHighlightPane {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
visible: dialog.text
|
|
|
|
|
|
|
|
|
|
Label {
|
|
|
|
|
width: parent.width
|
|
|
|
|
text: dialog.text
|
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
font.pixelSize: constants.fontSizeLarge
|
|
|
|
|
font.family: FixedFont
|
|
|
|
|
maximumLineCount: 4
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-02-23 20:57:45 +01:00
|
|
|
}
|
|
|
|
|
}
|
2022-05-04 15:01:50 +02:00
|
|
|
|
2023-03-16 15:10:42 +01:00
|
|
|
InfoTextArea {
|
2023-03-03 10:08:34 +01:00
|
|
|
Layout.leftMargin: constants.paddingMedium
|
|
|
|
|
Layout.rightMargin: constants.paddingMedium
|
2023-07-04 10:55:00 +02:00
|
|
|
iconStyle: helpTextIconStyle
|
2023-02-23 20:57:45 +01:00
|
|
|
visible: dialog.text_help
|
|
|
|
|
text: dialog.text_help
|
|
|
|
|
Layout.fillWidth: true
|
2022-06-15 13:33:19 +02:00
|
|
|
}
|
2022-08-24 10:15:03 +02:00
|
|
|
}
|
2023-02-23 20:57:45 +01:00
|
|
|
}
|
2022-08-24 10:15:03 +02:00
|
|
|
|
2023-02-23 20:57:45 +01:00
|
|
|
ButtonContainer {
|
|
|
|
|
Layout.fillWidth: true
|
2022-10-19 14:15:24 +02:00
|
|
|
|
2023-02-23 20:57:45 +01:00
|
|
|
FlatButton {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredWidth: 1
|
2022-10-19 14:15:24 +02:00
|
|
|
|
2023-02-23 20:57:45 +01:00
|
|
|
text: qsTr('Copy')
|
|
|
|
|
icon.source: '../../icons/copy_bw.png'
|
|
|
|
|
onClicked: {
|
2023-07-10 11:22:50 +00:00
|
|
|
AppController.textToClipboard(dialog.text ? dialog.text : dialog.text_qr)
|
2023-02-23 20:57:45 +01:00
|
|
|
toaster.show(this, qsTr('Copied!'))
|
2022-06-15 13:33:19 +02:00
|
|
|
}
|
2023-02-23 20:57:45 +01:00
|
|
|
}
|
|
|
|
|
FlatButton {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredWidth: 1
|
|
|
|
|
|
|
|
|
|
text: qsTr('Share')
|
|
|
|
|
icon.source: '../../icons/share.png'
|
|
|
|
|
onClicked: {
|
2023-07-10 11:22:50 +00:00
|
|
|
AppController.doShare(dialog.text ? dialog.text : dialog.text_qr, dialog.title)
|
2022-05-10 14:29:43 +02:00
|
|
|
}
|
2022-05-04 15:01:50 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-31 13:33:58 +02:00
|
|
|
Connections {
|
|
|
|
|
target: dialog.enter
|
|
|
|
|
function onRunningChanged() {
|
|
|
|
|
if (!dialog.enter.running) {
|
|
|
|
|
qr.render = true
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-04 15:01:50 +02:00
|
|
|
}
|
2023-01-31 15:05:18 +01:00
|
|
|
|
|
|
|
|
Toaster {
|
|
|
|
|
id: toaster
|
|
|
|
|
}
|
2022-05-04 15:01:50 +02:00
|
|
|
}
|