monero-gui/pages/merchant/MerchantTrackingList.qml

232 lines
7.9 KiB
QML
Raw Normal View History

2019-04-11 01:17:29 +00:00
import QtQuick 2.9
2018-12-08 15:55:29 +00:00
import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
import "../../js/Utils.js" as Utils
import "../../components" as MoneroComponents
ListView {
id: trackingListView
// items will not be drawn when a message is set
property string message: ""
boundsBehavior: ListView.StopAtBounds
Layout.fillWidth: true
clip: true
signal hideAmountToggled(string txid)
function viewTx(txid){
// @TODO: implement blockexplorer-like page. Redirect to history for now
appWindow.showPageRequest("History");
}
TextEdit {
// message box
visible: parent.message !== ""
anchors.fill: parent
2019-04-25 19:09:23 +00:00
anchors.margins: 20
anchors.topMargin: 10
2018-12-08 15:55:29 +00:00
wrapMode: Text.Wrap
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2018-12-08 15:55:29 +00:00
font.bold: false
color: "#767676"
textFormat: Text.RichText
text: parent.message
2019-04-11 01:17:29 +00:00
selectionColor: MoneroComponents.Style.textSelectionColor
2018-12-08 15:55:29 +00:00
selectByMouse: true
readOnly: true
onFocusChanged: {if(focus === false) deselect() }
}
delegate: Item {
id: trackingTableItem
visible: trackingListView.message === ""
2019-04-25 19:09:23 +00:00
height: 53
2018-12-08 15:55:29 +00:00
width: parent.width
Layout.fillWidth: true
RowLayout {
id: container
height: parent.height
width: parent.width
spacing: 0
Item {
Layout.preferredHeight: parent.height
2019-04-25 19:09:23 +00:00
Layout.preferredWidth: 20
2018-12-08 15:55:29 +00:00
}
ColumnLayout {
spacing: 0
2019-04-25 19:09:23 +00:00
Layout.preferredHeight: 40
Layout.preferredWidth: 240
2018-12-08 15:55:29 +00:00
Item {
Layout.preferredWidth: parent.width
2019-04-25 19:09:23 +00:00
Layout.preferredHeight: 18
2018-12-08 15:55:29 +00:00
TextEdit {
id: dateString
anchors.verticalCenter: parent.verticalCenter
2019-04-25 19:09:23 +00:00
font.pixelSize: 13
2018-12-08 15:55:29 +00:00
font.bold: false
color: "#707070"
text: time_date + " (" + Utils.ago(time_epoch) + ") "
2019-04-11 01:17:29 +00:00
selectionColor: MoneroComponents.Style.textSelectionColor
2018-12-08 15:55:29 +00:00
selectByMouse: true
readOnly: true
onFocusChanged: {if(focus === false) deselect() }
}
Rectangle {
anchors.left: dateString.right
anchors.leftMargin: 2
width: hideAmount.width + 2
height: 20
color: 'transparent'
TextEdit {
id: hideAmount
anchors.top: parent.top
2019-04-25 19:09:23 +00:00
anchors.topMargin: 1
2018-12-08 15:55:29 +00:00
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
readOnly: true
2019-04-25 19:09:23 +00:00
font.pixelSize: 12
2018-12-08 15:55:29 +00:00
font.bold: false
color: "#707070"
text: (hide_amount ? "(" + qsTr("show") + ")" : "(" + qsTr("hide") + ")") + translationManager.emptyString
2018-12-08 15:55:29 +00:00
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
trackingListView.hideAmountToggled(txid);
hide_amount = !hide_amount;
}
}
}
}
Item {
Layout.preferredWidth: parent.width
2019-04-25 19:09:23 +00:00
Layout.preferredHeight: 18
2018-12-08 15:55:29 +00:00
TextEdit {
id: amountText
anchors.verticalCenter: parent.verticalCenter
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2018-12-08 15:55:29 +00:00
font.bold: true
color: hide_amount ? "#707070" : "#009F1E"
text: hide_amount ? '-' : '+' + amount
2019-04-11 01:17:29 +00:00
selectionColor: MoneroComponents.Style.textSelectionColor
2018-12-08 15:55:29 +00:00
selectByMouse: true
readOnly: true
onFocusChanged: {if(focus === false) deselect() }
}
}
}
Item {
Layout.fillWidth: true
}
RowLayout {
spacing: 0
Layout.preferredHeight: parent.height
2019-04-25 19:09:23 +00:00
Layout.preferredWidth: 240
2018-12-08 15:55:29 +00:00
Item {
Layout.fillWidth: true
Layout.preferredHeight: parent.height
}
Item {
2019-04-25 19:09:23 +00:00
Layout.preferredWidth: 150
2018-12-08 15:55:29 +00:00
Layout.preferredHeight: parent.height
TextEdit {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
2019-04-25 19:09:23 +00:00
font.pixelSize: 12
2018-12-08 15:55:29 +00:00
font.bold: false
color: "#a8a8a8"
text: {
if(in_txpool){
return qsTr("Awaiting in txpool") + translationManager.emptyString;
} else {
if(confirmations > 1){
if(confirmations > 100){
return "100+ " + qsTr("confirmations") + translationManager.emptyString;
} else {
return confirmations + " " + qsTr("confirmations") + translationManager.emptyString;
}
} else {
return "1 " + qsTr("confirmation") + translationManager.emptyString;
}
}
}
2019-04-11 01:17:29 +00:00
selectionColor: MoneroComponents.Style.textSelectionColor
2018-12-08 15:55:29 +00:00
selectByMouse: true
readOnly: true
onFocusChanged: {if(focus === false) deselect() }
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
viewTx(txid);
}
}
}
Item {
2019-04-25 19:09:23 +00:00
Layout.preferredWidth: 30
2018-12-08 15:55:29 +00:00
Layout.preferredHeight: parent.height
Image {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
2019-04-25 19:09:23 +00:00
Layout.preferredWidth: 12
Layout.preferredHeight: 21
2019-04-11 01:17:29 +00:00
source: "qrc:///images/merchant/arrow_right.png"
2018-12-08 15:55:29 +00:00
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
viewTx(txid);
}
}
}
Item {
2019-04-25 19:09:23 +00:00
Layout.preferredWidth: 10
2018-12-08 15:55:29 +00:00
Layout.preferredHeight: parent.height
}
}
}
Rectangle {
anchors.right: parent.right
anchors.left: parent.left
anchors.top: container.bottom
height: 1
color: "#F0F0F0"
}
}
}