Browse Source

- add new icons

- display tr name in debug Panel
cl-refactor
yann300 10 years ago
parent
commit
950cded071
  1. 1
      mix/MixClient.cpp
  2. 33
      mix/qml/Block.qml
  3. 16
      mix/qml/BlockChain.qml
  4. 108
      mix/qml/Debugger.qml
  5. 4
      mix/qml/MainContent.qml
  6. 1
      mix/qml/ScenarioExecution.qml
  7. 11
      mix/qml/ScenarioLoader.qml
  8. 12
      mix/qml/StateListModel.qml
  9. BIN
      mix/qml/img/duplicateIcon.png
  10. BIN
      mix/qml/img/duplicateIcon@2x.png
  11. BIN
      mix/qml/img/recycle-discard.png
  12. BIN
      mix/qml/img/recycle-discard@2x.png
  13. BIN
      mix/qml/img/recycle-icon.png
  14. BIN
      mix/qml/img/recycle-icon@2x.png
  15. BIN
      mix/qml/img/recycle-keep.png
  16. BIN
      mix/qml/img/recycle-keep@2x.png
  17. BIN
      mix/qml/img/restoreIcon.png
  18. BIN
      mix/qml/img/restoreIcon@2x.png
  19. BIN
      mix/qml/img/saveIcon.png
  20. BIN
      mix/qml/img/saveIcon@2x.png
  21. 34
      mix/res.qrc

1
mix/MixClient.cpp

@ -131,7 +131,6 @@ Transaction MixClient::replaceGas(Transaction const& _t, u256 const& _gas, Secre
void MixClient::executeTransaction(Transaction const& _t, State& _state, bool _call, bool _gasAuto, Secret const& _secret) void MixClient::executeTransaction(Transaction const& _t, State& _state, bool _call, bool _gasAuto, Secret const& _secret)
{ {
<<<<<<< HEAD
Transaction t = _gasAuto ? replaceGas(_t, m_state.gasLimitRemaining()) : _t; Transaction t = _gasAuto ? replaceGas(_t, m_state.gasLimitRemaining()) : _t;
// do debugging run first // do debugging run first
LastHashes lastHashes(256); LastHashes lastHashes(256);

33
mix/qml/Block.qml

@ -19,6 +19,7 @@ ColumnLayout
property int trHeight: 30 property int trHeight: 30
spacing: 0 spacing: 0
property int openedTr: 0 property int openedTr: 0
property int blockIndex
function calculateHeight() function calculateHeight()
{ {
@ -117,7 +118,7 @@ ColumnLayout
Image { Image {
id: saveStatusImage id: saveStatusImage
source: "qrc:/qml/img/recycle-discard@2x.png" source: "qrc:/qml/img/recyclediscard@2x.png"
width: statusWidth width: statusWidth
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -133,9 +134,9 @@ ColumnLayout
onSaveStatusChanged: onSaveStatusChanged:
{ {
if (saveStatus) if (saveStatus)
saveStatusImage.source = "qrc:/qml/img/recycle-keep@2x.png" saveStatusImage.source = "qrc:/qml/img/recyclekeep@2x.png"
else else
saveStatusImage.source = "qrc:/qml/img/recycle-discard@2x.png" saveStatusImage.source = "qrc:/qml/img/recyclediscard@2x.png"
if (index >= 0) if (index >= 0)
transactions.get(index).saveStatus = saveStatus transactions.get(index).saveStatus = saveStatus
@ -245,14 +246,30 @@ ColumnLayout
} }
} }
Button Rectangle
{ {
id: debug
Layout.preferredWidth: debugActionWidth Layout.preferredWidth: debugActionWidth
text: "debug" Layout.preferredHeight: trHeight - 10
onClicked: color: "transparent"
Image {
source: "qrc:/qml/img/rightarrow@2x.png"
width: statusWidth
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
visible: transactions.get(index).recordIndex !== undefined
}
MouseArea
{ {
clientModel.debugRecord(transactions.get(index).recordIndex); anchors.fill: parent
onClicked:
{
if (transactions.get(index).recordIndex)
{
debugTrRequested = [ blockIndex, index ]
clientModel.debugRecord(transactions.get(index).recordIndex);
}
}
} }
} }
} }

16
mix/qml/BlockChain.qml

@ -16,6 +16,7 @@ ColumnLayout {
property variant model property variant model
spacing: 0 spacing: 0
property int previousWidth property int previousWidth
property variant debugTrRequested: []
onWidthChanged: onWidthChanged:
{ {
@ -62,7 +63,7 @@ ColumnLayout {
Layout.preferredHeight: 25 Layout.preferredHeight: 25
Image { Image {
id: debugImage id: debugImage
source: "qrc:/qml/img/recycle-icon@2x.png" source: "qrc:/qml/img/recycleicon@2x.png"
Layout.preferredWidth: statusWidth Layout.preferredWidth: statusWidth
Layout.preferredHeight: 25 Layout.preferredHeight: 25
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
@ -95,7 +96,7 @@ ColumnLayout {
} }
Label Label
{ {
text: "Action" text: ""
Layout.preferredWidth: debugActionWidth Layout.preferredWidth: debugActionWidth
} }
} }
@ -128,7 +129,7 @@ ColumnLayout {
{ {
return calculateHeight() return calculateHeight()
} }
blockIndex: index
transactions: transactions:
{ {
if (index >= 0) if (index >= 0)
@ -260,7 +261,7 @@ ColumnLayout {
Layout.preferredWidth: 100 Layout.preferredWidth: 100
Layout.preferredHeight: 30 Layout.preferredHeight: 30
buttonShortcut: "" buttonShortcut: ""
sourceImg: "qrc:/qml/img/recycle-icon@2x.png" sourceImg: "qrc:/qml/img/recycleicon@2x.png"
} }
ScenarioButton { ScenarioButton {
@ -278,7 +279,7 @@ ColumnLayout {
Layout.preferredWidth: 100 Layout.preferredWidth: 100
Layout.preferredHeight: 30 Layout.preferredHeight: 30
buttonShortcut: "" buttonShortcut: ""
sourceImg: "qrc:/qml/img/recycle-icon@2x.png" sourceImg: "qrc:/qml/img/sendtransactionicon@2x.png"
} }
Timer Timer
@ -324,7 +325,7 @@ ColumnLayout {
Layout.preferredWidth: 100 Layout.preferredWidth: 100
Layout.preferredHeight: 30 Layout.preferredHeight: 30
buttonShortcut: "" buttonShortcut: ""
sourceImg: "qrc:/qml/img/recycle-icon@2x.png" sourceImg: "qrc:/qml/img/addblock@2x.png"
} }
Connections Connections
@ -380,7 +381,6 @@ ColumnLayout {
itemTr.isFunctionCall = itemTr.functionId !== "" itemTr.isFunctionCall = itemTr.functionId !== ""
itemTr.returned = _r.returned itemTr.returned = _r.returned
itemTr.value = QEtherHelper.createEther(_r.value, QEther.Wei) itemTr.value = QEtherHelper.createEther(_r.value, QEther.Wei)
console.log("sender " + _r.sender)
itemTr.sender = _r.sender itemTr.sender = _r.sender
itemTr.recordIndex = _r.recordIndex itemTr.recordIndex = _r.recordIndex
itemTr.logs = _r.logs itemTr.logs = _r.logs
@ -401,7 +401,7 @@ ColumnLayout {
Layout.preferredWidth: 100 Layout.preferredWidth: 100
Layout.preferredHeight: 30 Layout.preferredHeight: 30
buttonShortcut: "" buttonShortcut: ""
sourceImg: "qrc:/qml/img/recycle-icon@2x.png" sourceImg: "qrc:/qml/img/newaccounticon@2x.png"
} }
} }
} }

108
mix/qml/Debugger.qml

@ -11,7 +11,7 @@ import "."
Rectangle { Rectangle {
id: debugPanel id: debugPanel
property alias debugSlider: statesSlider property alias debugSlider: statesSlider
property alias solLocals: solLocals property alias solLocals: solLocals
property alias solStorage: solStorage property alias solStorage: solStorage
property alias solCallStack: solCallStack property alias solCallStack: solCallStack
@ -39,6 +39,11 @@ Rectangle {
machineStates.updateHeight(); machineStates.updateHeight();
} }
function setTr(tr)
{
trName.text = tr.label
}
function displayCompilationErrorIfAny() function displayCompilationErrorIfAny()
{ {
debugScrollArea.visible = false; debugScrollArea.visible = false;
@ -104,28 +109,67 @@ Rectangle {
property alias solLocalsHeightSettings: solLocalsRect.height property alias solLocalsHeightSettings: solLocalsRect.height
} }
Splitter { ColumnLayout {
id: debugScrollArea id: debugScrollArea
anchors.fill: parent anchors.fill: parent
orientation: Qt.Vertical //orientation: Qt.Vertical
spacing: 0
RowLayout
{
Layout.preferredWidth: parent.width
Layout.preferredHeight: 30
Rectangle
{
Layout.preferredWidth: parent.width
Layout.preferredHeight: parent.height
color: "transparent"
Text {
anchors.centerIn: parent
text: qsTr("Current Transaction")
}
Rectangle
{
anchors.left: parent.left
anchors.leftMargin: 10
width: 30
height: parent.height
color: "transparent"
anchors.verticalCenter: parent.verticalCenter
Image {
source: "qrc:/qml/img/leftarrow@2x.png"
width: parent.width
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
MouseArea
{
anchors.fill: parent
onClicked:
{
Debugger.init(null);
panelClosed()
}
}
}
}
}
/*TransactionLog { RowLayout
id: transactionLog
Layout.fillWidth: true
Layout.minimumHeight: 130
height: 250
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: machineStates.sideMargin
anchors.rightMargin: machineStates.sideMargin
anchors.topMargin: machineStates.sideMargin
}*/
Button
{ {
text: qsTr("close") Layout.preferredWidth: parent.width
onClicked: panelClosed() Layout.preferredHeight: 30
Rectangle
{
Layout.preferredWidth: parent.width
Layout.preferredHeight: parent.height
color: "#2C79D3"
Text {
id: trName
color: "white"
anchors.centerIn: parent
}
}
} }
ScrollView ScrollView
@ -170,32 +214,6 @@ Rectangle {
spacing: 3 spacing: 3
layoutDirection: Qt.LeftToRight layoutDirection: Qt.LeftToRight
/*StepActionImage
{
id: playAction
enabledStateImg: "qrc:/qml/img/play_button.png"
disableStateImg: "qrc:/qml/img/play_button.png"
buttonLeft: true
onClicked: projectModel.stateListModel.runState(transactionLog.selectedStateIndex)
width: 23
buttonShortcut: "Ctrl+Shift+F8"
buttonTooltip: qsTr("Start Debugging")
visible: true
Layout.alignment: Qt.AlignLeft
}
StepActionImage
{
id: pauseAction
enabledStateImg: "qrc:/qml/img/stop_button2x.png"
disableStateImg: "qrc:/qml/img/stop_button2x.png"
onClicked: Debugger.init(null);
width: 23
buttonShortcut: "Ctrl+Shift+F9"
buttonTooltip: qsTr("Stop Debugging")
visible: true
}*/
StepActionImage StepActionImage
{ {
id: runBackAction; id: runBackAction;

4
mix/qml/MainContent.qml

@ -224,6 +224,10 @@ Rectangle {
onDebugDataReady: { onDebugDataReady: {
scenarioExe.visible = false scenarioExe.visible = false
debugPanel.visible = true debugPanel.visible = true
if (scenarioExe.bc.debugTrRequested)
{
debugPanel.setTr(scenarioExe.bc.model.blocks[scenarioExe.bc.debugTrRequested[0]].transactions[scenarioExe.bc.debugTrRequested[1]])
}
} }
} }

1
mix/qml/ScenarioExecution.qml

@ -10,6 +10,7 @@ import "."
Rectangle { Rectangle {
color: "#ededed" color: "#ededed"
property alias bc: blockChain
Connections Connections
{ {

11
mix/qml/ScenarioLoader.qml

@ -48,7 +48,7 @@ RowLayout
width: 100 width: 100
height: 30 height: 30
buttonShortcut: "" buttonShortcut: ""
sourceImg: "qrc:/qml/img/restoreIcon@2x.png" sourceImg: "qrc:/qml/img/restoreicon@2x.png"
onClicked: { onClicked: {
restore() restore()
} }
@ -71,7 +71,7 @@ RowLayout
width: 100 width: 100
height: 30 height: 30
buttonShortcut: "" buttonShortcut: ""
sourceImg: "qrc:/qml/img/saveIcon@2x.png" sourceImg: "qrc:/qml/img/saveicon@2x.png"
} }
ScenarioButton ScenarioButton
@ -79,16 +79,13 @@ RowLayout
id: duplicateScenario id: duplicateScenario
text: qsTr("Duplicate") text: qsTr("Duplicate")
onClicked: { onClicked: {
var state = JSON.parse(JSON.stringify(projectModel.stateListModel.getState(scenarioList.currentIndex))) projectModel.stateListModel.duplicateState(scenarioList.currentIndex)
state.title = qsTr("Copy of ") + state.title;
projectModel.stateListModel.appendState(state)
projectModel.stateListModel.save()
duplicated(state) duplicated(state)
} }
width: 100 width: 100
height: 30 height: 30
buttonShortcut: "" buttonShortcut: ""
sourceImg: "qrc:/qml/img/duplicateIcon@2x.png" sourceImg: "qrc:/qml/img/duplicateicon@2x.png"
} }
} }
} }

12
mix/qml/StateListModel.qml

@ -16,6 +16,7 @@ Item {
property string defaultAccount: "cb73d9408c4720e230387d956eb0f829d8a4dd2c1055f96257167e14e7169074" //support for old project property string defaultAccount: "cb73d9408c4720e230387d956eb0f829d8a4dd2c1055f96257167e14e7169074" //support for old project
function fromPlainStateItem(s) { function fromPlainStateItem(s) {
console.log("ggg " + s)
if (!s.accounts) if (!s.accounts)
s.accounts = [stateListModel.newAccount("1000000", QEther.Ether, defaultAccount)]; //support for old project s.accounts = [stateListModel.newAccount("1000000", QEther.Ether, defaultAccount)]; //support for old project
if (!s.contracts) if (!s.contracts)
@ -242,6 +243,15 @@ Item {
return { name: name, secret: _secret, balance: QEtherHelper.createEther(_balance, _unit), address: address }; return { name: name, secret: _secret, balance: QEtherHelper.createEther(_balance, _unit), address: address };
} }
function duplicateState(index)
{
var state = stateList[index]
var item = fromPlainStateItem(toPlainStateItem(state))
item.title = qsTr("Copy of") + " " + state.title
appendState(item)
save()
}
function createEmptyBlock() function createEmptyBlock()
{ {
return { return {
@ -380,11 +390,9 @@ Item {
function reloadStateFromFromProject(index) function reloadStateFromFromProject(index)
{ {
console.log(JSON.stringify(data))
if (data) if (data)
{ {
var item = fromPlainStateItem(data.states[index]) var item = fromPlainStateItem(data.states[index])
stateListModel.set(index, item) stateListModel.set(index, item)
stateList[index] = item stateList[index] = item
return item return item

BIN
mix/qml/img/duplicateIcon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1020 B

BIN
mix/qml/img/duplicateIcon@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

BIN
mix/qml/img/recycle-discard.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 B

BIN
mix/qml/img/recycle-discard@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

BIN
mix/qml/img/recycle-icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 697 B

BIN
mix/qml/img/recycle-icon@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

BIN
mix/qml/img/recycle-keep.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 904 B

BIN
mix/qml/img/recycle-keep@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

BIN
mix/qml/img/restoreIcon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
mix/qml/img/restoreIcon@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

BIN
mix/qml/img/saveIcon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

BIN
mix/qml/img/saveIcon@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

34
mix/res.qrc

@ -68,17 +68,27 @@
<file>qml/img/warningicon.png</file> <file>qml/img/warningicon.png</file>
<file>qml/img/warningicon@2x.png</file> <file>qml/img/warningicon@2x.png</file>
<file>qml/QAddressView.qml</file> <file>qml/QAddressView.qml</file>
<file>qml/img/recycle-discard.png</file> <file>qml/img/addblock.png</file>
<file>qml/img/recycle-discard@2x.png</file> <file>qml/img/addblock@2x.png</file>
<file>qml/img/recycle-icon.png</file> <file>qml/img/duplicateicon.png</file>
<file>qml/img/recycle-icon@2x.png</file> <file>qml/img/duplicateicon@2x.png</file>
<file>qml/img/recycle-keep.png</file> <file>qml/img/leftarrow.png</file>
<file>qml/img/recycle-keep@2x.png</file> <file>qml/img/leftarrow@2x.png</file>
<file>qml/img/restoreIcon.png</file> <file>qml/img/newaccounticon.png</file>
<file>qml/img/restoreIcon@2x.png</file> <file>qml/img/newaccounticon@2x.png</file>
<file>qml/img/saveIcon.png</file> <file>qml/img/recyclediscard.png</file>
<file>qml/img/saveIcon@2x.png</file> <file>qml/img/recyclediscard@2x.png</file>
<file>qml/img/duplicateIcon.png</file> <file>qml/img/recycleicon.png</file>
<file>qml/img/duplicateIcon@2x.png</file> <file>qml/img/recycleicon@2x.png</file>
<file>qml/img/recyclekeep.png</file>
<file>qml/img/recyclekeep@2x.png</file>
<file>qml/img/restoreicon.png</file>
<file>qml/img/restoreicon@2x.png</file>
<file>qml/img/rightarrow.png</file>
<file>qml/img/rightarrow@2x.png</file>
<file>qml/img/saveicon.png</file>
<file>qml/img/saveicon@2x.png</file>
<file>qml/img/sendtransactionicon.png</file>
<file>qml/img/sendtransactionicon@2x.png</file>
</qresource> </qresource>
</RCC> </RCC>

Loading…
Cancel
Save