mirror of
https://github.com/monero-project/monero-gui.git
synced 2026-04-02 09:57:26 -04:00
StandardDialog: make scrollable + close button
This commit is contained in:
@@ -47,6 +47,7 @@ Rectangle {
|
|||||||
property alias textArea: dialogContent
|
property alias textArea: dialogContent
|
||||||
property alias okText: okButton.text
|
property alias okText: okButton.text
|
||||||
property alias cancelText: cancelButton.text
|
property alias cancelText: cancelButton.text
|
||||||
|
property alias closeVisible: closeButton.visible
|
||||||
|
|
||||||
property var icon
|
property var icon
|
||||||
|
|
||||||
@@ -89,55 +90,63 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: implement without hardcoding sizes
|
// TODO: implement without hardcoding sizes
|
||||||
width: isMobile ? screenWidth : 520
|
width: isMobile ? screenWidth : 520 * scaleRatio
|
||||||
height: isMobile ? screenHeight : 380
|
height: isMobile ? screenHeight : 380 * scaleRatio
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: mainLayout
|
id: mainLayout
|
||||||
spacing: 10
|
spacing: 10 * scaleRatio
|
||||||
anchors { fill: parent; margins: 15 }
|
anchors.fill: parent
|
||||||
|
anchors.margins: (isMobile? 17 : 20) * scaleRatio
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: column
|
id: column
|
||||||
//anchors {fill: parent; margins: 16 }
|
|
||||||
Layout.topMargin: 14 * scaleRatio
|
Layout.topMargin: 14 * scaleRatio
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.fillWidth: true
|
||||||
|
|
||||||
MoneroComponents.Label {
|
MoneroComponents.Label {
|
||||||
id: dialogTitle
|
id: dialogTitle
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
fontSize: 18 * scaleRatio
|
fontSize: 18 * scaleRatio
|
||||||
fontFamily: "Arial"
|
fontFamily: "Arial"
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
color: MoneroComponents.Style.defaultFontColor
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
Item {
|
||||||
TextArea {
|
Layout.fillHeight: true
|
||||||
id : dialogContent
|
Layout.fillWidth: true
|
||||||
Layout.fillWidth: true
|
Layout.preferredHeight: 240 * scaleRatio
|
||||||
Layout.fillHeight: true
|
|
||||||
renderType: Text.QtRendering
|
|
||||||
font.family: MoneroComponents.Style.fontLight.name
|
|
||||||
textFormat: TextEdit.AutoText
|
|
||||||
readOnly: true
|
|
||||||
font.pixelSize: 14 * scaleRatio
|
|
||||||
selectByMouse: false
|
|
||||||
wrapMode: TextEdit.Wrap
|
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
|
||||||
|
|
||||||
MouseArea {
|
Flickable {
|
||||||
anchors.fill: parent
|
id: flickable
|
||||||
onClicked: {
|
anchors.fill: parent
|
||||||
appWindow.showStatusMessage(qsTr("Double tap to copy"),3)
|
ScrollBar.vertical: ScrollBar { }
|
||||||
}
|
|
||||||
onDoubleClicked: {
|
TextArea.flickable: TextArea {
|
||||||
parent.selectAll()
|
id: dialogContent
|
||||||
parent.copy()
|
Layout.fillWidth: true
|
||||||
parent.deselect()
|
Layout.fillHeight: true
|
||||||
console.log("copied to clipboard");
|
renderType: Text.QtRendering
|
||||||
appWindow.showStatusMessage(qsTr("Content copied to clipboard"),3)
|
font.family: MoneroComponents.Style.fontLight.name
|
||||||
|
textFormat: TextEdit.AutoText
|
||||||
|
readOnly: true
|
||||||
|
font.pixelSize: 14 * scaleRatio
|
||||||
|
selectByMouse: false
|
||||||
|
wrapMode: TextEdit.Wrap
|
||||||
|
color: MoneroComponents.Style.defaultFontColor
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
appWindow.showStatusMessage(qsTr("Double tap to copy"),3)
|
||||||
|
}
|
||||||
|
onDoubleClicked: {
|
||||||
|
parent.selectAll()
|
||||||
|
parent.copy()
|
||||||
|
parent.deselect()
|
||||||
|
console.log("copied to clipboard");
|
||||||
|
appWindow.showStatusMessage(qsTr("Content copied to clipboard"),3)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,7 +155,7 @@ Rectangle {
|
|||||||
// Ok/Cancel buttons
|
// Ok/Cancel buttons
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: buttons
|
id: buttons
|
||||||
spacing: 60
|
spacing: 60 * scaleRatio
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
MoneroComponents.StandardButton {
|
MoneroComponents.StandardButton {
|
||||||
@@ -160,20 +169,47 @@ Rectangle {
|
|||||||
|
|
||||||
MoneroComponents.StandardButton {
|
MoneroComponents.StandardButton {
|
||||||
id: okButton
|
id: okButton
|
||||||
text: qsTr("OK")
|
text: qsTr("OK") + translationManager.emptyString
|
||||||
KeyNavigation.tab: cancelButton
|
KeyNavigation.tab: cancelButton
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.close()
|
root.close()
|
||||||
root.accepted()
|
root.accepted()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// close icon
|
||||||
|
Rectangle {
|
||||||
|
id: closeButton
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
width: 48 * scaleRatio
|
||||||
|
height: 48 * scaleRatio
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
Image {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: 16 * scaleRatio
|
||||||
|
height: 16 * scaleRatio
|
||||||
|
source: "../images/close.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
root.close()
|
||||||
|
root.rejected()
|
||||||
|
}
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onEntered: closeButton.color = "#262626";
|
||||||
|
onExited: closeButton.color = "transparent";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// window borders
|
// window borders
|
||||||
Rectangle{
|
Rectangle{
|
||||||
width: 1
|
width: 1 * scaleRatio
|
||||||
color: MoneroComponents.Style.grey
|
color: MoneroComponents.Style.grey
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
@@ -181,7 +217,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
width: 1
|
width: 1 * scaleRatio
|
||||||
color: MoneroComponents.Style.grey
|
color: MoneroComponents.Style.grey
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
@@ -189,7 +225,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
height: 1
|
height: 1 * scaleRatio
|
||||||
color: MoneroComponents.Style.grey
|
color: MoneroComponents.Style.grey
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
@@ -197,7 +233,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
height: 1
|
height: 1 * scaleRatio
|
||||||
color: MoneroComponents.Style.grey
|
color: MoneroComponents.Style.grey
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|||||||
Reference in New Issue
Block a user