forked from carver/mix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- toggle between (only tx / tx + calls)
- Loading branch information
Showing
21 changed files
with
1,065 additions
and
418 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,9 +52,21 @@ ColumnLayout | |
transactionDialog.open(txIndex, blockIndex, transactions.get(txIndex)) | ||
} | ||
|
||
function select(txIndex) | ||
function select(txIndex, direction) | ||
{ | ||
transactionRepeater.itemAt(txIndex).select() | ||
transactionRepeater.itemAt(txIndex).changeSelection([blockIndex, txIndex], [blockIndex, txIndex], direction) | ||
//transactionRepeater.itemAt(txIndex).select(direction) | ||
} | ||
|
||
function displayNextCalls(trIndex, calls) | ||
{ | ||
transactionRepeater.itemAt(trIndex).displayCalls(calls) | ||
} | ||
|
||
function hideNextCalls() | ||
{ | ||
for (var k = 0; k < transactionRepeater.count; k++) | ||
transactionRepeater.itemAt(k).hideCalls() | ||
} | ||
|
||
onOpenedTrChanged: | ||
|
@@ -125,245 +137,123 @@ ColumnLayout | |
// load edit block panel | ||
projectModel.stateListModel.editState(scenarioIndex) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
Repeater // List of transactions | ||
{ | ||
id: transactionRepeater | ||
|
||
|
||
|
||
model: transactions | ||
RowLayout | ||
ColumnLayout | ||
{ | ||
id: rowTransaction | ||
Layout.preferredHeight: trHeight | ||
spacing: 0 | ||
spacing: 1 | ||
property int selectedIndex: -1 | ||
property bool selected: false | ||
id: columnTx | ||
|
||
function select() | ||
{ | ||
rowContentTr.select() | ||
tx.select() | ||
} | ||
|
||
function displayContent() | ||
function changeSelection(current, next, direction) | ||
{ | ||
logsText.text = "" | ||
if (index >= 0 && transactions.get(index).logs && transactions.get(index).logs.count) | ||
console.log("change " ) | ||
if (current[0] === blockIndex && current[1] === index) | ||
{ | ||
for (var k = 0; k < transactions.get(index).logs.count; k++) | ||
if (!selected) | ||
{ | ||
var log = transactions.get(index).logs.get(k) | ||
if (log.name) | ||
logsText.text += log.name + ":\n" | ||
selected = true | ||
if (direction === +1) | ||
{ | ||
selectedIndex = -1 | ||
} | ||
else | ||
logsText.text += "log:\n" | ||
|
||
if (log.param) | ||
for (var i = 0; i < log.param.count; i++) | ||
{ | ||
var p = log.param.get(i) | ||
logsText.text += p.name + " = " + p.value + " - indexed:" + p.indexed + "\n" | ||
} | ||
else { | ||
logsText.text += "From : " + log.address + "\n" | ||
{ | ||
selectedIndex = callsModel.count - 1 | ||
} | ||
} | ||
logsText.text += "\n\n" | ||
} | ||
rowDetailedContent.visible = !rowDetailedContent.visible | ||
} | ||
|
||
Rectangle | ||
{ | ||
id: trSaveStatus | ||
Layout.preferredWidth: statusWidth | ||
Layout.preferredHeight: parent.height | ||
color: "transparent" | ||
anchors.top: parent.top | ||
property bool saveStatus | ||
Image { | ||
anchors.top: parent.top | ||
anchors.left: parent.left | ||
anchors.leftMargin: -4 | ||
anchors.topMargin: 0 | ||
id: saveStatusImage | ||
source: "qrc:/qml/img/[email protected]" | ||
width: statusWidth + 10 | ||
fillMode: Image.PreserveAspectFit | ||
} | ||
|
||
Component.onCompleted: | ||
{ | ||
if (index >= 0) | ||
saveStatus = transactions.get(index).saveStatus | ||
} | ||
|
||
onSaveStatusChanged: | ||
{ | ||
if (saveStatus) | ||
saveStatusImage.source = "qrc:/qml/img/[email protected]" | ||
} | ||
else | ||
saveStatusImage.source = "qrc:/qml/img/[email protected]" | ||
|
||
if (index >= 0) | ||
transactions.get(index).saveStatus = saveStatus | ||
transactionModel[index].saveStatus = saveStatus | ||
} | ||
{ | ||
selectedIndex = selectedIndex + direction | ||
} | ||
|
||
MouseArea { | ||
id: statusMouseArea | ||
anchors.fill: parent | ||
onClicked: | ||
if (selectedIndex === -1) | ||
{ | ||
tx.select() | ||
} | ||
else if (selectedIndex > -1 && selectedIndex < callsModel.count) | ||
{ | ||
callsRepeater.itemAt(selectedIndex).select() | ||
tx.de | ||
} | ||
else | ||
{ | ||
parent.saveStatus = !parent.saveStatus | ||
//hightlight the next tr | ||
blockChainPanel.blockChainRepeater.select(next[0], next[1], direction); | ||
selected = false | ||
} | ||
} | ||
else | ||
selected = false | ||
} | ||
|
||
Rectangle | ||
Connections | ||
{ | ||
Layout.preferredWidth: blockWidth | ||
Layout.preferredHeight: trHeight | ||
height: trHeight | ||
color: "#DEDCDC" | ||
id: rowContentTr | ||
anchors.top: parent.top | ||
|
||
property bool selected: false | ||
Connections | ||
target: blockChainPanel | ||
onChangeSelection: | ||
{ | ||
target: blockChainPanel | ||
onTxSelected: { | ||
if (root.blockIndex !== blockIndex || index !== txIndex) | ||
rowContentTr.deselect() | ||
} | ||
columnTx.changeSelection(current, next) | ||
} | ||
} | ||
|
||
function select() | ||
{ | ||
rowContentTr.selected = true | ||
rowContentTr.color = selectedBlockColor | ||
hash.color = selectedBlockForeground | ||
func.color = selectedBlockForeground | ||
txSelected(index) | ||
|
||
} | ||
Transaction | ||
{ | ||
id: tx | ||
tx: transactions.get(index) | ||
isCall: false | ||
|
||
function deselect() | ||
function select(direction) | ||
{ | ||
rowContentTr.selected = false | ||
rowContentTr.color = "#DEDCDC" | ||
hash.color = labelColor | ||
func.color = labelColor | ||
highlight() | ||
} | ||
|
||
MouseArea | ||
function deselect() | ||
{ | ||
anchors.fill: parent | ||
onClicked: { | ||
if (!rowContentTr.selected) | ||
rowContentTr.select() | ||
} | ||
onDoubleClicked: | ||
{ | ||
root.editTx(index) | ||
} | ||
highlight() | ||
} | ||
} | ||
|
||
RowLayout | ||
{ | ||
Layout.fillWidth: true | ||
Layout.preferredHeight: trHeight - 10 | ||
anchors.verticalCenter: parent.verticalCenter | ||
Rectangle | ||
{ | ||
Layout.preferredWidth: fromWidth | ||
anchors.left: parent.left | ||
anchors.leftMargin: horizontalMargin | ||
Text | ||
{ | ||
id: hash | ||
width: parent.width - 30 | ||
elide: Text.ElideRight | ||
anchors.verticalCenter: parent.verticalCenter | ||
maximumLineCount: 1 | ||
color: labelColor | ||
font.pointSize: dbgStyle.absoluteSize(1) | ||
font.bold: true | ||
text: { | ||
if (index >= 0) | ||
return clientModel.resolveAddress(transactions.get(index).sender) | ||
else | ||
return "" | ||
} | ||
} | ||
} | ||
|
||
Rectangle | ||
{ | ||
Layout.preferredWidth: toWidth | ||
Text | ||
{ | ||
id: func | ||
text: { | ||
if (index >= 0) | ||
parent.parent.userFrienldyToken(transactions.get(index).label) | ||
else | ||
return "" | ||
} | ||
elide: Text.ElideRight | ||
anchors.verticalCenter: parent.verticalCenter | ||
color: labelColor | ||
font.pointSize: dbgStyle.absoluteSize(1) | ||
font.bold: true | ||
maximumLineCount: 1 | ||
width: parent.width | ||
} | ||
} | ||
function displayCalls(calls) | ||
{ | ||
for (var k in calls) | ||
callsModel.append(calls[k]) | ||
} | ||
|
||
function userFrienldyToken(value) | ||
{ | ||
if (value && value.indexOf("<") === 0) | ||
{ | ||
if (value.split("> ")[1] === " - ") | ||
return value.split(" - ")[0].replace("<", "") | ||
else | ||
return value.split(" - ")[0].replace("<", "") + "." + value.split("> ")[1] + "()"; | ||
} | ||
else | ||
return value | ||
} | ||
} | ||
function hideCalls() | ||
{ | ||
callsModel.clear() | ||
} | ||
|
||
Rectangle | ||
ListModel | ||
{ | ||
width: debugActionWidth | ||
height: trHeight - 10 | ||
anchors.right: rowContentTr.right | ||
anchors.top: rowContentTr.top | ||
anchors.rightMargin: 10 | ||
color: "transparent" | ||
id: callsModel | ||
} | ||
|
||
Image { | ||
id: debugImg | ||
source: "qrc:/qml/img/rightarrowcircle.png" | ||
width: debugActionWidth | ||
fillMode: Image.PreserveAspectFit | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
visible: transactions.get(index).recordIndex !== undefined | ||
} | ||
MouseArea | ||
Repeater | ||
{ | ||
id: callsRepeater | ||
model: callsModel | ||
Transaction | ||
{ | ||
anchors.fill: parent | ||
onClicked: | ||
{ | ||
if (transactions.get(index).recordIndex !== undefined) | ||
{ | ||
debugTrRequested = [ blockIndex, index ] | ||
clientModel.debugRecord(transactions.get(index).recordIndex); | ||
} | ||
} | ||
tx: callsModel.get(index) | ||
isCall: true | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.