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

View file

@ -175,7 +175,23 @@ ListView {
return _amount + " XMR"; 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 { Rectangle {

View file

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