|
@ -13,7 +13,7 @@ import "." |
|
|
Dialog { |
|
|
Dialog { |
|
|
id: modalTransactionDialog |
|
|
id: modalTransactionDialog |
|
|
modality: Qt.ApplicationModal |
|
|
modality: Qt.ApplicationModal |
|
|
width: 630 |
|
|
width: 580 |
|
|
height: 500 |
|
|
height: 500 |
|
|
visible: false |
|
|
visible: false |
|
|
title: qsTr("Edit Transaction") |
|
|
title: qsTr("Edit Transaction") |
|
@ -31,7 +31,7 @@ Dialog { |
|
|
property alias stateAccounts: senderComboBox.model |
|
|
property alias stateAccounts: senderComboBox.model |
|
|
property bool saveStatus |
|
|
property bool saveStatus |
|
|
signal accepted; |
|
|
signal accepted; |
|
|
|
|
|
property int rowWidth: 500 |
|
|
StateDialogStyle { |
|
|
StateDialogStyle { |
|
|
id: transactionDialogStyle |
|
|
id: transactionDialogStyle |
|
|
} |
|
|
} |
|
@ -39,8 +39,8 @@ Dialog { |
|
|
function open(index, blockIdx, item) { |
|
|
function open(index, blockIdx, item) { |
|
|
transactionIndex = index |
|
|
transactionIndex = index |
|
|
blockIndex = blockIdx |
|
|
blockIndex = blockIdx |
|
|
typeLoader.transactionIndex = index |
|
|
paramScroll.transactionIndex = index |
|
|
typeLoader.blockIndex = blockIdx |
|
|
paramScroll.blockIndex = blockIdx |
|
|
saveStatus = item.saveStatus |
|
|
saveStatus = item.saveStatus |
|
|
gasValueEdit.gasValue = item.gas; |
|
|
gasValueEdit.gasValue = item.gas; |
|
|
gasAutoCheck.checked = item.gasAuto ? true : false; |
|
|
gasAutoCheck.checked = item.gasAuto ? true : false; |
|
@ -139,10 +139,10 @@ Dialog { |
|
|
|
|
|
|
|
|
function initTypeLoader() |
|
|
function initTypeLoader() |
|
|
{ |
|
|
{ |
|
|
typeLoader.value = {} |
|
|
paramScroll.value = {} |
|
|
typeLoader.members = [] |
|
|
paramScroll.members = [] |
|
|
typeLoader.value = paramValues; |
|
|
paramScroll.value = paramValues; |
|
|
typeLoader.members = paramsModel; |
|
|
paramScroll.members = paramsModel; |
|
|
paramScroll.updateView() |
|
|
paramScroll.updateView() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -273,6 +273,7 @@ Dialog { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
contentItem: Rectangle { |
|
|
contentItem: Rectangle { |
|
|
|
|
|
id: containerRect |
|
|
color: transactionDialogStyle.generic.backgroundColor |
|
|
color: transactionDialogStyle.generic.backgroundColor |
|
|
anchors.fill: parent |
|
|
anchors.fill: parent |
|
|
ScrollView |
|
|
ScrollView |
|
@ -280,14 +281,18 @@ Dialog { |
|
|
anchors.top: parent.top |
|
|
anchors.top: parent.top |
|
|
anchors.fill: parent |
|
|
anchors.fill: parent |
|
|
ColumnLayout { |
|
|
ColumnLayout { |
|
|
width: modalTransactionDialog.width - 30 |
|
|
Layout.preferredWidth: rowWidth |
|
|
anchors.horizontalCenter: parent.horizontalCenter |
|
|
|
|
|
anchors.top: parent.top |
|
|
anchors.top: parent.top |
|
|
anchors.topMargin: 10 |
|
|
anchors.topMargin: 10 |
|
|
spacing: 10 |
|
|
anchors.left: parent.left |
|
|
|
|
|
width: 500 |
|
|
|
|
|
anchors.leftMargin: |
|
|
|
|
|
{ |
|
|
|
|
|
return (containerRect.width - 530) /2 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
Layout.fillWidth: true |
|
|
|
|
|
Rectangle |
|
|
Rectangle |
|
|
{ |
|
|
{ |
|
|
Layout.preferredWidth: 150 |
|
|
Layout.preferredWidth: 150 |
|
@ -318,7 +323,6 @@ Dialog { |
|
|
|
|
|
|
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
Layout.fillWidth: true |
|
|
|
|
|
Rectangle |
|
|
Rectangle |
|
|
{ |
|
|
{ |
|
|
Layout.preferredWidth: 150 |
|
|
Layout.preferredWidth: 150 |
|
@ -335,7 +339,7 @@ Dialog { |
|
|
|
|
|
|
|
|
Column |
|
|
Column |
|
|
{ |
|
|
{ |
|
|
Layout.preferredWidth: 150 |
|
|
Layout.preferredWidth: 350 |
|
|
Layout.preferredHeight: 90 |
|
|
Layout.preferredHeight: 90 |
|
|
ExclusiveGroup { |
|
|
ExclusiveGroup { |
|
|
id: rbbuttonList |
|
|
id: rbbuttonList |
|
@ -393,7 +397,6 @@ Dialog { |
|
|
|
|
|
|
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
Layout.fillWidth: true |
|
|
|
|
|
Rectangle |
|
|
Rectangle |
|
|
{ |
|
|
{ |
|
|
Layout.preferredWidth: 150 |
|
|
Layout.preferredWidth: 150 |
|
@ -436,7 +439,6 @@ Dialog { |
|
|
|
|
|
|
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
Layout.fillWidth: true |
|
|
|
|
|
Rectangle |
|
|
Rectangle |
|
|
{ |
|
|
{ |
|
|
Layout.preferredWidth: 150 |
|
|
Layout.preferredWidth: 150 |
|
@ -444,12 +446,14 @@ Dialog { |
|
|
|
|
|
|
|
|
function hide() |
|
|
function hide() |
|
|
{ |
|
|
{ |
|
|
|
|
|
parent.visible = false |
|
|
functionRect.visible = false |
|
|
functionRect.visible = false |
|
|
functionComboBox.visible = false |
|
|
functionComboBox.visible = false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function show() |
|
|
function show() |
|
|
{ |
|
|
{ |
|
|
|
|
|
parent.visible = true |
|
|
functionRect.visible = true |
|
|
functionRect.visible = true |
|
|
functionComboBox.visible = true |
|
|
functionComboBox.visible = true |
|
|
} |
|
|
} |
|
@ -476,37 +480,26 @@ Dialog { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
RowLayout |
|
|
StructView |
|
|
{ |
|
|
{ |
|
|
id: paramScroll |
|
|
id: paramScroll |
|
|
|
|
|
members: paramsModel; |
|
|
|
|
|
accounts: senderComboBox.model |
|
|
|
|
|
context: "parameter" |
|
|
Layout.fillWidth: true |
|
|
Layout.fillWidth: true |
|
|
|
|
|
|
|
|
function updateView() |
|
|
function updateView() |
|
|
{ |
|
|
{ |
|
|
paramScroll.visible = paramsModel.length > 0 |
|
|
paramScroll.visible = paramsModel.length > 0 |
|
|
typeLoader.visible = paramsModel.length > 0 |
|
|
paramScroll.Layout.preferredHeight = paramsModel.length < 6 ? paramsModel.length * 30 : 205 |
|
|
paramScroll.height = paramsModel.length < 6 ? paramsModel.length * 30 : 190 |
|
|
|
|
|
typeLoader.height = paramsModel.length < 6 ? paramsModel.length * 30 : 190 |
|
|
|
|
|
if (paramsModel.length === 0) |
|
|
if (paramsModel.length === 0) |
|
|
{ |
|
|
{ |
|
|
paramScroll.height = 0 |
|
|
paramScroll.height = 0 |
|
|
typeLoader.height = 0 |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
StructView |
|
|
|
|
|
{ |
|
|
|
|
|
id: typeLoader |
|
|
|
|
|
Layout.preferredWidth: 500 |
|
|
|
|
|
members: paramsModel; |
|
|
|
|
|
accounts: senderComboBox.model |
|
|
|
|
|
context: "parameter" |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
Layout.fillWidth: true |
|
|
|
|
|
Rectangle |
|
|
Rectangle |
|
|
{ |
|
|
{ |
|
|
Layout.preferredWidth: 150 |
|
|
Layout.preferredWidth: 150 |
|
@ -519,6 +512,7 @@ Dialog { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Ether { |
|
|
Ether { |
|
|
|
|
|
Layout.preferredWidth: 350 |
|
|
id: valueField |
|
|
id: valueField |
|
|
edit: true |
|
|
edit: true |
|
|
displayFormattedValue: false |
|
|
displayFormattedValue: false |
|
@ -542,20 +536,24 @@ Dialog { |
|
|
|
|
|
|
|
|
Rectangle |
|
|
Rectangle |
|
|
{ |
|
|
{ |
|
|
width: parent.width |
|
|
|
|
|
height: 20 |
|
|
height: 20 |
|
|
color: "transparent" |
|
|
color: "transparent" |
|
|
Label { |
|
|
Layout.preferredWidth: 500 |
|
|
text: qsTr("Transaction fees") |
|
|
Rectangle |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter |
|
|
anchors.horizontalCenter: parent.horizontalCenter |
|
|
|
|
|
Label { |
|
|
|
|
|
text: qsTr("Transaction fees") |
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
Layout.fillWidth: true |
|
|
Layout.preferredHeight: 45 |
|
|
Layout.preferredHeight: 40 |
|
|
|
|
|
|
|
|
|
|
|
Rectangle |
|
|
Rectangle |
|
|
{ |
|
|
{ |
|
|
Layout.preferredWidth: 150 |
|
|
Layout.preferredWidth: 150 |
|
@ -568,6 +566,7 @@ Dialog { |
|
|
|
|
|
|
|
|
Row |
|
|
Row |
|
|
{ |
|
|
{ |
|
|
|
|
|
Layout.preferredWidth: 350 |
|
|
DefaultTextField |
|
|
DefaultTextField |
|
|
{ |
|
|
{ |
|
|
property variant gasValue |
|
|
property variant gasValue |
|
@ -595,7 +594,10 @@ Dialog { |
|
|
{ |
|
|
{ |
|
|
var gasCost = codeModel.gasCostBy(contractName, functionName); |
|
|
var gasCost = codeModel.gasCostBy(contractName, functionName); |
|
|
if (gasCost && gasCost.length > 0) |
|
|
if (gasCost && gasCost.length > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
var gas = codeModel.txGas + codeModel.callStipend + parseInt(gasCost[0].gas) |
|
|
estimatedGas.text = qsTr("Estimated cost: ") + gasCost[0].gas + " gas" |
|
|
estimatedGas.text = qsTr("Estimated cost: ") + gasCost[0].gas + " gas" |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function updateView() |
|
|
function updateView() |
|
@ -635,8 +637,8 @@ Dialog { |
|
|
|
|
|
|
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
Layout.fillWidth: true |
|
|
Layout.preferredWidth: 500 |
|
|
Layout.preferredHeight: 40 |
|
|
Layout.preferredHeight: 45 |
|
|
Rectangle |
|
|
Rectangle |
|
|
{ |
|
|
{ |
|
|
Layout.preferredWidth: 150 |
|
|
Layout.preferredWidth: 150 |
|
@ -645,22 +647,23 @@ Dialog { |
|
|
anchors.verticalCenter: parent.verticalCenter |
|
|
anchors.verticalCenter: parent.verticalCenter |
|
|
anchors.right: parent.right |
|
|
anchors.right: parent.right |
|
|
text: qsTr("Gas Price") |
|
|
text: qsTr("Gas Price") |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Label { |
|
|
Label { |
|
|
id: gasPriceMarket |
|
|
id: gasPriceMarket |
|
|
anchors.top: gasPriceLabel.bottom |
|
|
anchors.top: gasPriceLabel.bottom |
|
|
Component.onCompleted: |
|
|
Component.onCompleted: |
|
|
{ |
|
|
|
|
|
NetworkDeployment.gasPrice(function(result) |
|
|
|
|
|
{ |
|
|
{ |
|
|
gasPriceMarket.text = qsTr("Current market: ") + " " + result + " Wei"; |
|
|
NetworkDeployment.gasPrice(function(result) |
|
|
}, function (){}); |
|
|
{ |
|
|
|
|
|
gasPriceMarket.text = qsTr("Current market: ") + " " + result + " Wei"; |
|
|
|
|
|
}, function (){}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Ether { |
|
|
Ether { |
|
|
|
|
|
Layout.preferredWidth: 350 |
|
|
id: gasPriceField |
|
|
id: gasPriceField |
|
|
edit: true |
|
|
edit: true |
|
|
displayFormattedValue: false |
|
|
displayFormattedValue: false |
|
@ -671,33 +674,38 @@ Dialog { |
|
|
|
|
|
|
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
anchors.right: parent.right |
|
|
|
|
|
|
|
|
|
|
|
Button { |
|
|
Layout.preferredWidth: 500 |
|
|
text: qsTr("Cancel"); |
|
|
Row |
|
|
onClicked: close(); |
|
|
{ |
|
|
} |
|
|
width: parent.width |
|
|
|
|
|
anchors.right: parent.right |
|
|
|
|
|
Button { |
|
|
|
|
|
id: updateBtn |
|
|
|
|
|
text: qsTr("Cancel"); |
|
|
|
|
|
onClicked: close(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Button { |
|
|
Button { |
|
|
text: qsTr("Update"); |
|
|
text: qsTr("Update"); |
|
|
onClicked: { |
|
|
onClicked: { |
|
|
var invalid = InputValidator.validate(paramsModel, paramValues); |
|
|
var invalid = InputValidator.validate(paramsModel, paramValues); |
|
|
if (invalid.length === 0) |
|
|
if (invalid.length === 0) |
|
|
{ |
|
|
{ |
|
|
close(); |
|
|
close(); |
|
|
accepted(); |
|
|
accepted(); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
errorDialog.text = qsTr("Some parameters are invalid:\n"); |
|
|
errorDialog.text = qsTr("Some parameters are invalid:\n"); |
|
|
for (var k in invalid) |
|
|
for (var k in invalid) |
|
|
errorDialog.text += invalid[k].message + "\n"; |
|
|
errorDialog.text += invalid[k].message + "\n"; |
|
|
errorDialog.open(); |
|
|
errorDialog.open(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MessageDialog { |
|
|
MessageDialog { |
|
|
id: errorDialog |
|
|
id: errorDialog |
|
|
standardButtons: StandardButton.Ok |
|
|
standardButtons: StandardButton.Ok |
|
@ -707,11 +715,10 @@ Dialog { |
|
|
|
|
|
|
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
|
|
|
Layout.preferredHeight: 30 |
|
|
anchors.bottom: parent.bottom |
|
|
anchors.bottom: parent.bottom |
|
|
Layout.preferredHeight: 20 |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|