|
@ -183,228 +183,228 @@ Window { |
|
|
anchors.margins: 10 |
|
|
anchors.margins: 10 |
|
|
color: StateDialogStyle.generic.backgroundColor |
|
|
color: StateDialogStyle.generic.backgroundColor |
|
|
|
|
|
|
|
|
ColumnLayout { |
|
|
ColumnLayout { |
|
|
id: dialogContent |
|
|
id: dialogContent |
|
|
spacing: 30 |
|
|
spacing: 30 |
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
id: rowFunction |
|
|
id: rowFunction |
|
|
Layout.fillWidth: true |
|
|
Layout.fillWidth: true |
|
|
height: 150 |
|
|
height: 150 |
|
|
Label { |
|
|
Label { |
|
|
Layout.preferredWidth: 75 |
|
|
Layout.preferredWidth: 75 |
|
|
text: qsTr("Function") |
|
|
text: qsTr("Function") |
|
|
font.family: regularFont.name |
|
|
font.family: regularFont.name |
|
|
color: "#808080" |
|
|
color: "#808080" |
|
|
} |
|
|
|
|
|
ComboBox { |
|
|
|
|
|
id: functionComboBox |
|
|
|
|
|
Layout.preferredWidth: 350 |
|
|
|
|
|
currentIndex: -1 |
|
|
|
|
|
textRole: "text" |
|
|
|
|
|
editable: false |
|
|
|
|
|
model: ListModel { |
|
|
|
|
|
id: functionsModel |
|
|
|
|
|
} |
|
|
|
|
|
onCurrentIndexChanged: { |
|
|
|
|
|
loadParameters(); |
|
|
|
|
|
} |
|
|
} |
|
|
style: ComboBoxStyle |
|
|
ComboBox { |
|
|
{ |
|
|
id: functionComboBox |
|
|
font: regularFont.name |
|
|
Layout.preferredWidth: 350 |
|
|
|
|
|
currentIndex: -1 |
|
|
|
|
|
textRole: "text" |
|
|
|
|
|
editable: false |
|
|
|
|
|
model: ListModel { |
|
|
|
|
|
id: functionsModel |
|
|
|
|
|
} |
|
|
|
|
|
onCurrentIndexChanged: { |
|
|
|
|
|
loadParameters(); |
|
|
|
|
|
} |
|
|
|
|
|
style: ComboBoxStyle { |
|
|
|
|
|
font: regularFont.name |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
id: rowValue |
|
|
id: rowValue |
|
|
Layout.fillWidth: true |
|
|
Layout.fillWidth: true |
|
|
height: 150 |
|
|
height: 150 |
|
|
Label { |
|
|
Label { |
|
|
Layout.preferredWidth: 75 |
|
|
Layout.preferredWidth: 75 |
|
|
text: qsTr("Value") |
|
|
text: qsTr("Value") |
|
|
font.family: regularFont.name |
|
|
font.family: regularFont.name |
|
|
color: "#808080" |
|
|
color: "#808080" |
|
|
} |
|
|
} |
|
|
Ether { |
|
|
Ether { |
|
|
id: valueField |
|
|
id: valueField |
|
|
edit: true |
|
|
edit: true |
|
|
displayFormattedValue: true |
|
|
displayFormattedValue: true |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
id: rowGas |
|
|
id: rowGas |
|
|
Layout.fillWidth: true |
|
|
Layout.fillWidth: true |
|
|
height: 150 |
|
|
height: 150 |
|
|
Label { |
|
|
Label { |
|
|
Layout.preferredWidth: 75 |
|
|
Layout.preferredWidth: 75 |
|
|
text: qsTr("Gas") |
|
|
text: qsTr("Gas") |
|
|
font.family: regularFont.name |
|
|
font.family: regularFont.name |
|
|
color: "#808080" |
|
|
color: "#808080" |
|
|
|
|
|
} |
|
|
|
|
|
Ether { |
|
|
|
|
|
id: gasField |
|
|
|
|
|
edit: true |
|
|
|
|
|
displayFormattedValue: true |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
Ether { |
|
|
|
|
|
id: gasField |
|
|
RowLayout |
|
|
edit: true |
|
|
{ |
|
|
displayFormattedValue: true |
|
|
id: rowGasPrice |
|
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
|
height: 150 |
|
|
|
|
|
Label { |
|
|
|
|
|
Layout.preferredWidth: 75 |
|
|
|
|
|
text: qsTr("Gas Price") |
|
|
|
|
|
font.family: regularFont.name |
|
|
|
|
|
color: "#808080" |
|
|
|
|
|
} |
|
|
|
|
|
Ether { |
|
|
|
|
|
id: gasPriceField |
|
|
|
|
|
edit: true |
|
|
|
|
|
displayFormattedValue: true |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
RowLayout |
|
|
|
|
|
{ |
|
|
|
|
|
id: rowGasPrice |
|
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
|
height: 150 |
|
|
|
|
|
Label { |
|
|
Label { |
|
|
|
|
|
text: qsTr("Parameters") |
|
|
Layout.preferredWidth: 75 |
|
|
Layout.preferredWidth: 75 |
|
|
text: qsTr("Gas Price") |
|
|
|
|
|
font.family: regularFont.name |
|
|
font.family: regularFont.name |
|
|
color: "#808080" |
|
|
color: "#808080" |
|
|
|
|
|
visible: paramsModel.count > 0 |
|
|
} |
|
|
} |
|
|
Ether { |
|
|
|
|
|
id: gasPriceField |
|
|
|
|
|
edit: true |
|
|
|
|
|
displayFormattedValue: true |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Label { |
|
|
|
|
|
text: qsTr("Parameters") |
|
|
|
|
|
Layout.preferredWidth: 75 |
|
|
|
|
|
font.family: regularFont.name |
|
|
|
|
|
color: "#808080" |
|
|
|
|
|
visible: paramsModel.count > 0 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ScrollView |
|
|
ScrollView |
|
|
{ |
|
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
|
visible: paramsModel.count > 0 |
|
|
|
|
|
ColumnLayout |
|
|
|
|
|
{ |
|
|
{ |
|
|
id: paramRepeater |
|
|
|
|
|
Layout.fillWidth: true |
|
|
Layout.fillWidth: true |
|
|
spacing: 10 |
|
|
visible: paramsModel.count > 0 |
|
|
Repeater |
|
|
ColumnLayout |
|
|
{ |
|
|
{ |
|
|
anchors.fill: parent |
|
|
id: paramRepeater |
|
|
model: paramsModel |
|
|
Layout.fillWidth: true |
|
|
visible: paramsModel.count > 0 |
|
|
spacing: 10 |
|
|
RowLayout |
|
|
Repeater |
|
|
{ |
|
|
{ |
|
|
id: row |
|
|
anchors.fill: parent |
|
|
Layout.fillWidth: true |
|
|
model: paramsModel |
|
|
height: 150 |
|
|
visible: paramsModel.count > 0 |
|
|
|
|
|
RowLayout |
|
|
Label { |
|
|
|
|
|
id: typeLabel |
|
|
|
|
|
text: type |
|
|
|
|
|
font.family: regularFont.name |
|
|
|
|
|
Layout.preferredWidth: 50 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Label { |
|
|
|
|
|
id: nameLabel |
|
|
|
|
|
text: name |
|
|
|
|
|
font.family: regularFont.name |
|
|
|
|
|
Layout.preferredWidth: 50 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Label { |
|
|
|
|
|
id: equalLabel |
|
|
|
|
|
text: "=" |
|
|
|
|
|
font.family: regularFont.name |
|
|
|
|
|
Layout.preferredWidth: 15 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Loader |
|
|
|
|
|
{ |
|
|
{ |
|
|
id: typeLoader |
|
|
id: row |
|
|
Layout.preferredHeight: 50 |
|
|
Layout.fillWidth: true |
|
|
Layout.preferredWidth: 150 |
|
|
height: 150 |
|
|
function getCurrent() |
|
|
|
|
|
{ |
|
|
Label { |
|
|
return modalTransactionDialog.param(name); |
|
|
id: typeLabel |
|
|
|
|
|
text: type |
|
|
|
|
|
font.family: regularFont.name |
|
|
|
|
|
Layout.preferredWidth: 50 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Connections { |
|
|
Label { |
|
|
target: typeLoader.item |
|
|
id: nameLabel |
|
|
onTextChanged: { |
|
|
text: name |
|
|
typeLoader.getCurrent().value = typeLoader.item.text; |
|
|
font.family: regularFont.name |
|
|
} |
|
|
Layout.preferredWidth: 50 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
sourceComponent: |
|
|
Label { |
|
|
{ |
|
|
id: equalLabel |
|
|
if (type.indexOf("int") !== -1) |
|
|
text: "=" |
|
|
return intViewComp; |
|
|
font.family: regularFont.name |
|
|
else if (type.indexOf("bool") !== -1) |
|
|
Layout.preferredWidth: 15 |
|
|
return boolViewComp; |
|
|
|
|
|
else if (type.indexOf("string") !== -1) |
|
|
|
|
|
return stringViewComp; |
|
|
|
|
|
else if (type.indexOf("hash") !== -1) |
|
|
|
|
|
return hashViewComp; |
|
|
|
|
|
else |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Component |
|
|
Loader |
|
|
{ |
|
|
{ |
|
|
id: intViewComp |
|
|
id: typeLoader |
|
|
QIntTypeView |
|
|
Layout.preferredHeight: 50 |
|
|
|
|
|
Layout.preferredWidth: 150 |
|
|
|
|
|
function getCurrent() |
|
|
{ |
|
|
{ |
|
|
height: 50 |
|
|
return modalTransactionDialog.param(name); |
|
|
width: 150 |
|
|
|
|
|
id: intView |
|
|
|
|
|
text: typeLoader.getCurrent().value |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Component |
|
|
Connections { |
|
|
{ |
|
|
target: typeLoader.item |
|
|
id: boolViewComp |
|
|
onTextChanged: { |
|
|
QBoolTypeView |
|
|
typeLoader.getCurrent().value = typeLoader.item.text; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sourceComponent: |
|
|
{ |
|
|
{ |
|
|
height: 50 |
|
|
if (type.indexOf("int") !== -1) |
|
|
width: 150 |
|
|
return intViewComp; |
|
|
id: boolView |
|
|
else if (type.indexOf("bool") !== -1) |
|
|
defaultValue: "1" |
|
|
return boolViewComp; |
|
|
Component.onCompleted: |
|
|
else if (type.indexOf("string") !== -1) |
|
|
|
|
|
return stringViewComp; |
|
|
|
|
|
else if (type.indexOf("hash") !== -1) |
|
|
|
|
|
return hashViewComp; |
|
|
|
|
|
else |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Component |
|
|
|
|
|
{ |
|
|
|
|
|
id: intViewComp |
|
|
|
|
|
QIntTypeView |
|
|
{ |
|
|
{ |
|
|
var current = typeLoader.getCurrent().value; |
|
|
height: 50 |
|
|
(current === "" ? text = defaultValue : text = current); |
|
|
width: 150 |
|
|
|
|
|
id: intView |
|
|
|
|
|
text: typeLoader.getCurrent().value |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Component |
|
|
Component |
|
|
{ |
|
|
|
|
|
id: stringViewComp |
|
|
|
|
|
QStringTypeView |
|
|
|
|
|
{ |
|
|
{ |
|
|
height: 50 |
|
|
id: boolViewComp |
|
|
width: 150 |
|
|
QBoolTypeView |
|
|
id: stringView |
|
|
|
|
|
text: |
|
|
|
|
|
{ |
|
|
{ |
|
|
return typeLoader.getCurrent().value |
|
|
height: 50 |
|
|
|
|
|
width: 150 |
|
|
|
|
|
id: boolView |
|
|
|
|
|
defaultValue: "1" |
|
|
|
|
|
Component.onCompleted: |
|
|
|
|
|
{ |
|
|
|
|
|
var current = typeLoader.getCurrent().value; |
|
|
|
|
|
(current === "" ? text = defaultValue : text = current); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Component |
|
|
Component |
|
|
{ |
|
|
|
|
|
id: hashViewComp |
|
|
|
|
|
QHashTypeView |
|
|
|
|
|
{ |
|
|
{ |
|
|
height: 50 |
|
|
id: stringViewComp |
|
|
width: 150 |
|
|
QStringTypeView |
|
|
id: hashView |
|
|
{ |
|
|
text: typeLoader.getCurrent().value |
|
|
height: 50 |
|
|
|
|
|
width: 150 |
|
|
|
|
|
id: stringView |
|
|
|
|
|
text: |
|
|
|
|
|
{ |
|
|
|
|
|
return typeLoader.getCurrent().value |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Component |
|
|
|
|
|
{ |
|
|
|
|
|
id: hashViewComp |
|
|
|
|
|
QHashTypeView |
|
|
|
|
|
{ |
|
|
|
|
|
height: 50 |
|
|
|
|
|
width: 150 |
|
|
|
|
|
id: hashView |
|
|
|
|
|
text: typeLoader.getCurrent().value |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -412,89 +412,27 @@ Window { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
RowLayout |
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
anchors.bottom: parent.bottom |
|
|
anchors.bottom: parent.bottom |
|
|
anchors.right: parent.right; |
|
|
anchors.right: parent.right; |
|
|
|
|
|
|
|
|
Button { |
|
|
Button { |
|
|
text: qsTr("OK"); |
|
|
text: qsTr("OK"); |
|
|
onClicked: { |
|
|
onClicked: { |
|
|
close(); |
|
|
close(); |
|
|
accepted(); |
|
|
accepted(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
Button { |
|
|
|
|
|
text: qsTr("Cancel"); |
|
|
|
|
|
onClicked: close(); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
Button { |
|
|
|
|
|
text: qsTr("Cancel"); |
|
|
|
|
|
onClicked: close(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
ListModel { |
|
|
ListModel { |
|
|
id: paramsModel |
|
|
id: paramsModel |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Component { |
|
|
|
|
|
id: rowDelegate |
|
|
|
|
|
Item { |
|
|
|
|
|
height: 100 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Component { |
|
|
|
|
|
id: editableDelegate |
|
|
|
|
|
Item { |
|
|
|
|
|
Loader { |
|
|
|
|
|
id: loaderEditor |
|
|
|
|
|
anchors.fill: parent |
|
|
|
|
|
anchors.margins: 4 |
|
|
|
|
|
Connections { |
|
|
|
|
|
target: loaderEditor.item |
|
|
|
|
|
onTextChanged: { |
|
|
|
|
|
if (styleData.role === "value" && styleData.row < paramsModel.count) |
|
|
|
|
|
loaderEditor.updateValue(styleData.row, styleData.role, loaderEditor.item.text); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function updateValue(row, role, value) |
|
|
|
|
|
{ |
|
|
|
|
|
paramsModel.setProperty(styleData.row, styleData.role, value); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sourceComponent: |
|
|
|
|
|
{ |
|
|
|
|
|
if (styleData.role === "value") |
|
|
|
|
|
{ |
|
|
|
|
|
if (paramsModel.get(styleData.row) === undefined) |
|
|
|
|
|
return null; |
|
|
|
|
|
if (paramsModel.get(styleData.row).type.indexOf("int") !== -1) |
|
|
|
|
|
return intViewComp; |
|
|
|
|
|
else if (paramsModel.get(styleData.row).type.indexOf("bool") !== -1) |
|
|
|
|
|
return boolViewComp; |
|
|
|
|
|
else if (paramsModel.get(styleData.row).type.indexOf("string") !== -1) |
|
|
|
|
|
return stringViewComp; |
|
|
|
|
|
else if (paramsModel.get(styleData.row).type.indexOf("hash") !== -1) |
|
|
|
|
|
return hashViewComp; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
return editor; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Component { |
|
|
|
|
|
id: editor |
|
|
|
|
|
TextInput { |
|
|
|
|
|
id: textinput |
|
|
|
|
|
readOnly: true |
|
|
|
|
|
color: styleData.textColor |
|
|
|
|
|
text: styleData.value |
|
|
|
|
|
font.family: regularFont.name |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|