Files
pallectrum/electrum/gui/qml/components/GenericShareDialog.qml

112 lines
2.9 KiB
QML
Raw Normal View History

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"
ElDialog {
2022-05-04 15:01:50 +02:00
id: dialog
property string text
property string text_qr
// if text_qr is undefined text will be used
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
QRImage {
2022-06-15 13:33:19 +02:00
id: qr
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
maximumLineCount: 4
elide: Text.ElideRight
2022-06-15 13:33:19 +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
}
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'
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
}
}
}
Connections {
target: dialog.enter
function onRunningChanged() {
if (!dialog.enter.running) {
qr.render = true
}
}
2022-05-04 15:01:50 +02:00
}
Toaster {
id: toaster
}
2022-05-04 15:01:50 +02:00
}