2022-05-04 15:01:50 +02:00
|
|
|
import QtQuick 2.6
|
|
|
|
|
import QtQuick.Layouts 1.0
|
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
|
import QtQuick.Controls.Material 2.0
|
|
|
|
|
|
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
|
|
|
|
|
// if text_qr is undefined text will be used
|
2022-08-24 10:15:03 +02:00
|
|
|
property string text_help
|
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
|
|
|
parent: Overlay.overlay
|
|
|
|
|
modal: true
|
|
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
|
|
Overlay.modal: Rectangle {
|
|
|
|
|
color: "#aa000000"
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-15 13:33:19 +02:00
|
|
|
Flickable {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
contentHeight: rootLayout.height
|
|
|
|
|
clip:true
|
|
|
|
|
interactive: height < contentHeight
|
2022-05-04 15:01:50 +02:00
|
|
|
|
2022-06-15 13:33:19 +02:00
|
|
|
ColumnLayout {
|
|
|
|
|
id: rootLayout
|
|
|
|
|
width: parent.width
|
|
|
|
|
spacing: constants.paddingMedium
|
2022-05-04 15:01:50 +02:00
|
|
|
|
2022-07-21 10:19:07 +02:00
|
|
|
QRImage {
|
2022-06-15 13:33:19 +02:00
|
|
|
id: qr
|
2022-08-31 13:33:58 +02:00
|
|
|
render: dialog.enter ? false : true
|
|
|
|
|
qrdata: dialog.text_qr ? dialog.text_qr : dialog.text
|
2022-06-15 13:33:19 +02:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
Layout.topMargin: constants.paddingSmall
|
|
|
|
|
Layout.bottomMargin: constants.paddingSmall
|
2022-05-04 15:01:50 +02:00
|
|
|
}
|
|
|
|
|
|
2022-06-15 13:33:19 +02:00
|
|
|
TextHighlightPane {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Label {
|
|
|
|
|
width: parent.width
|
|
|
|
|
text: dialog.text
|
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
font.pixelSize: constants.fontSizeLarge
|
|
|
|
|
font.family: FixedFont
|
2022-08-24 10:15:03 +02:00
|
|
|
maximumLineCount: 4
|
|
|
|
|
elide: Text.ElideRight
|
2022-06-15 13:33:19 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-24 10:15:03 +02:00
|
|
|
Label {
|
|
|
|
|
visible: dialog.text_help
|
|
|
|
|
text: dialog.text_help
|
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-19 14:15:24 +02:00
|
|
|
Rectangle {
|
|
|
|
|
height: 1
|
|
|
|
|
Layout.preferredWidth: qr.width
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
color: Material.accentColor
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-03 13:42:37 +01:00
|
|
|
ButtonContainer {
|
2022-06-15 13:33:19 +02:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2022-10-19 14:15:24 +02:00
|
|
|
|
|
|
|
|
FlatButton {
|
2023-02-07 11:49:57 +01:00
|
|
|
Layout.minimumWidth: dialog.width * 1/4
|
2022-06-15 13:33:19 +02:00
|
|
|
text: qsTr('Copy')
|
2022-07-28 11:53:20 +02:00
|
|
|
icon.source: '../../icons/copy_bw.png'
|
2023-01-31 15:05:18 +01:00
|
|
|
onClicked: {
|
|
|
|
|
AppController.textToClipboard(dialog.text)
|
|
|
|
|
toaster.show(this, qsTr('Copied!'))
|
|
|
|
|
}
|
2022-06-15 13:33:19 +02:00
|
|
|
}
|
2022-10-19 14:15:24 +02:00
|
|
|
FlatButton {
|
2023-02-07 11:49:57 +01:00
|
|
|
Layout.minimumWidth: dialog.width * 1/4
|
2022-06-15 13:33:19 +02:00
|
|
|
text: qsTr('Share')
|
2022-07-28 11:53:20 +02:00
|
|
|
icon.source: '../../icons/share.png'
|
2022-06-15 13:33:19 +02:00
|
|
|
onClicked: {
|
|
|
|
|
AppController.doShare(dialog.text, 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
|
|
|
}
|