1
mirror of https://github.com/monero-project/monero-gui synced 2024-11-29 09:05:11 +01:00

Enable clipboard copy functionality on XMR amounts

This commit is contained in:
mmbyday 2018-12-03 17:54:44 -05:00
parent 9f6b4334a1
commit 4bfd8560cd
3 changed files with 74 additions and 18 deletions

View File

@ -31,7 +31,8 @@ import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0
import moneroComponents.Wallet 1.0
import moneroComponents.NetworkType 1.0
import "components"
import moneroComponents.Clipboard 1.0
import "components" as MoneroComponents
Rectangle {
id: panel
@ -46,6 +47,8 @@ Rectangle {
property alias daemonProgressBar : daemonProgressBar
property alias minutesToUnlockTxt: unlockedBalanceLabel.text
property int titleBarHeight: 50
property string copyValue: ""
Clipboard { id: clipboard }
signal dashboardClicked()
signal historyClicked()
@ -202,6 +205,23 @@ Rectangle {
}
return defaultSize;
}
MouseArea {
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onEntered: {
parent.color = MoneroComponents.Style.orange
}
onExited: {
parent.color = MoneroComponents.Style.white
}
onClicked: {
console.log("Copied to clipboard");
clipboard.setText(parent.text);
appWindow.showStatusMessage(qsTr("Copied to clipboard"),3)
}
}
}
Text {
@ -223,9 +243,26 @@ Rectangle {
}
return defaultSize;
}
MouseArea {
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onEntered: {
parent.color = MoneroComponents.Style.orange
}
onExited: {
parent.color = MoneroComponents.Style.white
}
onClicked: {
console.log("Copied to clipboard");
clipboard.setText(parent.text);
appWindow.showStatusMessage(qsTr("Copied to clipboard"),3)
}
}
}
Label {
MoneroComponents.Label {
id: unlockedBalanceLabel
visible: true
text: qsTr("Unlocked balance") + translationManager.emptyString
@ -236,7 +273,7 @@ Rectangle {
anchors.topMargin: 110
}
Label {
MoneroComponents.Label {
visible: !isMobile
id: balanceLabel
text: qsTr("Balance") + translationManager.emptyString
@ -334,7 +371,7 @@ Rectangle {
}
// ------------- Transfer tab ---------------
MenuButton {
MoneroComponents.MenuButton {
id: transferButton
anchors.left: parent.left
anchors.right: parent.right
@ -359,7 +396,7 @@ Rectangle {
// ------------- AddressBook tab ---------------
MenuButton {
MoneroComponents.MenuButton {
id: addressBookButton
anchors.left: parent.left
anchors.right: parent.right
@ -384,7 +421,7 @@ Rectangle {
}
// ------------- Receive tab ---------------
MenuButton {
MoneroComponents.MenuButton {
id: receiveButton
anchors.left: parent.left
anchors.right: parent.right
@ -408,7 +445,7 @@ Rectangle {
// ------------- History tab ---------------
MenuButton {
MoneroComponents.MenuButton {
id: historyButton
anchors.left: parent.left
anchors.right: parent.right
@ -431,7 +468,7 @@ Rectangle {
}
// ------------- Advanced tab ---------------
MenuButton {
MoneroComponents.MenuButton {
id: advancedButton
anchors.left: parent.left
anchors.right: parent.right
@ -453,7 +490,7 @@ Rectangle {
}
// ------------- Mining tab ---------------
MenuButton {
MoneroComponents.MenuButton {
id: miningButton
visible: !isAndroid && !isIOS
anchors.left: parent.left
@ -478,7 +515,7 @@ Rectangle {
height: 1
}
// ------------- TxKey tab ---------------
MenuButton {
MoneroComponents.MenuButton {
id: txkeyButton
anchors.left: parent.left
anchors.right: parent.right
@ -501,7 +538,7 @@ Rectangle {
height: 1
}
// ------------- Shared RingDB tab ---------------
MenuButton {
MoneroComponents.MenuButton {
id: sharedringdbButton
anchors.left: parent.left
anchors.right: parent.right
@ -526,7 +563,7 @@ Rectangle {
// ------------- Sign/verify tab ---------------
MenuButton {
MoneroComponents.MenuButton {
id: signButton
anchors.left: parent.left
anchors.right: parent.right
@ -549,7 +586,7 @@ Rectangle {
height: 1
}
// ------------- Settings tab ---------------
MenuButton {
MoneroComponents.MenuButton {
id: settingsButton
anchors.left: parent.left
anchors.right: parent.right
@ -571,7 +608,7 @@ Rectangle {
height: 1
}
// ------------- Sign/verify tab ---------------
MenuButton {
MoneroComponents.MenuButton {
id: keysButton
anchors.left: parent.left
anchors.right: parent.right
@ -609,7 +646,7 @@ Rectangle {
color: "transparent"
}
NetworkStatusItem {
MoneroComponents.NetworkStatusItem {
id: networkStatus
anchors.left: parent.left
anchors.right: parent.right
@ -620,7 +657,7 @@ Rectangle {
height: 48 * scaleRatio
}
ProgressBar {
MoneroComponents.ProgressBar {
id: progressBar
anchors.left: parent.left
anchors.right: parent.right
@ -630,7 +667,7 @@ Rectangle {
visible: networkStatus.connected
}
ProgressBar {
MoneroComponents.ProgressBar {
id: daemonProgressBar
anchors.left: parent.left
anchors.right: parent.right

View File

@ -175,7 +175,23 @@ ListView {
return _amount + " XMR";
}
color: isOut ? "white" : "#2eb358"
color: isOut ? MoneroComponents.Style.white : MoneroComponents.Style.green
MouseArea {
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onEntered: {
parent.color = MoneroComponents.Style.orange
}
onExited: {
parent.color = isOut ? MoneroComponents.Style.white : MoneroComponents.Style.green }
onClicked: {
console.log("Copied to clipboard");
clipboard.setText(parent.text.split(" ")[0]);
appWindow.showStatusMessage(qsTr("Copied to clipboard"),3)
}
}
}
Rectangle {

View File

@ -9,6 +9,9 @@ QtObject {
property QtObject fontRegular: FontLoader { id: _fontRegular; source: "qrc:/fonts/Roboto-Regular.ttf"; }
property string grey: "#404040"
property string orange: "#FF6C3C"
property string white: "#FFFFFF"
property string green: "#2EB358"
property string defaultFontColor: "white"
property string dimmedFontColor: "#BBBBBB"