Browse Source

- Scenario Panel UI changes

cl-refactor
yann300 9 years ago
parent
commit
ec71a9c69f
  1. 2
      libethereum/BlockChain.cpp
  2. 106
      mix/qml/Block.qml
  3. 24
      mix/qml/BlockChain.qml
  4. 1
      mix/qml/ScenarioButton.qml
  5. 3
      mix/qml/ScenarioExecution.qml
  6. 44
      mix/qml/ScenarioLoader.qml

2
libethereum/BlockChain.cpp

@ -391,7 +391,7 @@ ImportRoute BlockChain::import(bytes const& _block, OverlayDB const& _db, Import
try try
#endif #endif
{ {
block = verifyBlock(_block, m_onBad); block = verifyBlock(_block, m_onBad, _ir);
} }
#if ETH_CATCH #if ETH_CATCH
catch (Exception& ex) catch (Exception& ex)

106
mix/qml/Block.qml

@ -47,7 +47,7 @@ ColumnLayout
Layout.preferredHeight: trHeight Layout.preferredHeight: trHeight
Layout.preferredWidth: blockWidth Layout.preferredWidth: blockWidth
id: rowHeader id: rowHeader
spacing: 0
Rectangle Rectangle
{ {
Layout.preferredWidth: blockWidth Layout.preferredWidth: blockWidth
@ -55,7 +55,7 @@ ColumnLayout
color: "#DEDCDC" color: "#DEDCDC"
radius: 4 radius: 4
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: statusWidth + 5 anchors.leftMargin: statusWidth
Label { Label {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
@ -99,6 +99,7 @@ ColumnLayout
{ {
id: rowTransaction id: rowTransaction
Layout.preferredHeight: trHeight Layout.preferredHeight: trHeight
spacing: 0
function displayContent() function displayContent()
{ {
logsText.text = "" logsText.text = ""
@ -138,7 +139,7 @@ ColumnLayout
Image { Image {
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: -7 anchors.topMargin: -10
id: saveStatusImage id: saveStatusImage
source: "qrc:/qml/img/recyclediscard@2x.png" source: "qrc:/qml/img/recyclediscard@2x.png"
width: statusWidth width: statusWidth
@ -179,14 +180,27 @@ ColumnLayout
color: "#DEDCDC" color: "#DEDCDC"
id: rowContentTr id: rowContentTr
anchors.top: parent.top anchors.top: parent.top
MouseArea
{
anchors.fill: parent
onDoubleClicked:
{
transactionDialog.stateAccounts = scenario.accounts
transactionDialog.execute = false
transactionDialog.open(index, blockIndex, transactions.get(index))
}
}
ColumnLayout ColumnLayout
{ {
anchors.top: parent.top anchors.top: parent.top
width: parent.width
spacing: 10 spacing: 10
RowLayout RowLayout
{ {
anchors.top: parent.top anchors.top: parent.top
anchors.verticalCenter: parent.verticalCenter Layout.fillWidth: true
spacing: cellSpacing spacing: cellSpacing
Text Text
{ {
@ -275,59 +289,7 @@ ColumnLayout
} }
} }
Rectangle
{
Layout.preferredWidth: debugActionWidth
Layout.preferredHeight: trHeight - 10
color: "transparent"
Image {
source: "qrc:/qml/img/edit.png"
width: 18
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
}
MouseArea
{
anchors.fill: parent
onClicked:
{
transactionDialog.stateAccounts = scenario.accounts
transactionDialog.execute = false
transactionDialog.open(index, blockIndex, transactions.get(index))
}
}
}
Rectangle
{
Layout.preferredWidth: debugActionWidth
Layout.preferredHeight: trHeight - 10
color: "transparent"
Image {
id: debugImg
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
{
anchors.fill: parent
onClicked:
{
if (transactions.get(index).recordIndex !== undefined)
{
debugTrRequested = [ blockIndex, index ]
clientModel.debugRecord(transactions.get(index).recordIndex);
}
}
}
}
} }
RowLayout RowLayout
@ -363,6 +325,38 @@ ColumnLayout
} }
} }
} }
Rectangle
{
width: debugActionWidth
height: trHeight - 10
anchors.left: rowContentTr.right
anchors.top: rowContentTr.top
anchors.leftMargin: -50
color: "transparent"
Image {
id: debugImg
source: "qrc:/qml/img/rightarrow@2x.png"
width: debugActionWidth
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
visible: transactions.get(index).recordIndex !== undefined
}
MouseArea
{
anchors.fill: parent
onClicked:
{
if (transactions.get(index).recordIndex !== undefined)
{
debugTrRequested = [ blockIndex, index ]
clientModel.debugRecord(transactions.get(index).recordIndex);
}
}
}
}
} }
} }
} }

24
mix/qml/BlockChain.qml

@ -18,6 +18,18 @@ ColumnLayout {
property int previousWidth property int previousWidth
property variant debugTrRequested: [] property variant debugTrRequested: []
signal chainChanged signal chainChanged
signal chainReloaded
Connections
{
target: codeModel
onContractRenamed: {
rebuild.startBlinking()
}
onNewContractCompiled: {
rebuild.startBlinking()
}
}
onChainChanged: { onChainChanged: {
rebuild.startBlinking() rebuild.startBlinking()
@ -30,14 +42,14 @@ ColumnLayout {
{ {
fromWidth = 100 fromWidth = 100
toWidth = 100 toWidth = 100
valueWidth = 200 valueWidth = 250
} }
else else
{ {
var diff = (width - previousWidth) / 3; var diff = (width - previousWidth) / 3;
fromWidth = fromWidth + diff < 100 ? 100 : fromWidth + diff fromWidth = fromWidth + diff < 100 ? 100 : fromWidth + diff
toWidth = toWidth + diff < 100 ? 100 : toWidth + diff toWidth = toWidth + diff < 100 ? 100 : toWidth + diff
valueWidth = valueWidth + diff < 200 ? 200 : valueWidth + diff valueWidth = valueWidth + diff < 250 ? 250 : valueWidth + diff
} }
previousWidth = width previousWidth = width
} }
@ -47,7 +59,7 @@ ColumnLayout {
if (!scenario) if (!scenario)
return; return;
if (model) if (model)
chainChanged() rebuild.startBlinking()
model = scenario model = scenario
blockModel.clear() blockModel.clear()
for (var b in model.blocks) for (var b in model.blocks)
@ -55,10 +67,10 @@ ColumnLayout {
previousWidth = width previousWidth = width
} }
property int statusWidth: 40 property int statusWidth: 50
property int fromWidth: 100 property int fromWidth: 100
property int toWidth: 100 property int toWidth: 100
property int valueWidth: 200 property int valueWidth: 250
property int logsWidth: 40 property int logsWidth: 40
property int debugActionWidth: 40 property int debugActionWidth: 40
property int horizontalMargin: 10 property int horizontalMargin: 10
@ -68,7 +80,7 @@ ColumnLayout {
{ {
id: header id: header
spacing: 0 spacing: 0
Layout.preferredHeight: 30 Layout.preferredHeight: 40
Image { Image {
id: debugImage id: debugImage
source: "qrc:/qml/img/recycleicon@2x.png" source: "qrc:/qml/img/recycleicon@2x.png"

1
mix/qml/ScenarioButton.qml

@ -13,6 +13,7 @@ Rectangle {
function startBlinking() function startBlinking()
{ {
if (!blinkTimer.running)
blinkTimer.start() blinkTimer.start()
} }

3
mix/qml/ScenarioExecution.qml

@ -52,7 +52,8 @@ Rectangle {
Connections Connections
{ {
target: loader target: loader
onLoaded: { onLoaded:
{
blockChain.load(scenario) blockChain.load(scenario)
} }
} }

44
mix/qml/ScenarioLoader.qml

@ -17,6 +17,7 @@ ColumnLayout
signal saved(variant scenario) signal saved(variant scenario)
signal duplicated(variant scenario) signal duplicated(variant scenario)
signal loaded(variant scenario) signal loaded(variant scenario)
signal renamed(variant scenario)
spacing: 0 spacing: 0
function init() function init()
{ {
@ -28,8 +29,6 @@ ColumnLayout
editStatus.visible = true editStatus.visible = true
} }
//anchors.margins: 10
//width: parent.width
Rectangle Rectangle
{ {
Layout.fillWidth: true Layout.fillWidth: true
@ -75,6 +74,9 @@ ColumnLayout
projectModel.stateListModel.getState(scenarioList.currentIndex).title = scenarioName.text projectModel.stateListModel.getState(scenarioList.currentIndex).title = scenarioName.text
projectModel.saveProjectFile() projectModel.saveProjectFile()
saved(state) saved(state)
scenarioList.model.get(scenarioList.currentIndex).title = scenarioName.text
scenarioList.currentIndex = scenarioList.currentIndex
renamed(projectModel.stateListModel.getState(scenarioList.currentIndex))
} }
} }
@ -149,6 +151,7 @@ ColumnLayout
model: projectModel.stateListModel model: projectModel.stateListModel
textRole: "title" textRole: "title"
height: 30 height: 30
width: 150
onCurrentIndexChanged: onCurrentIndexChanged:
{ {
restoreScenario.restore() restoreScenario.restore()
@ -159,6 +162,43 @@ ColumnLayout
var state = projectModel.stateListModel.getState(currentIndex) var state = projectModel.stateListModel.getState(currentIndex)
loaded(state) loaded(state)
} }
style: ComboBoxStyle {
background: Rectangle {
color: "white"
border.color: "#cccccc"
border.width: 1
radius: 4
anchors.fill: parent
}
label: Rectangle {
anchors.fill: parent
color: "white"
Text {
id: comboLabel
maximumLineCount: 1
elide: Text.ElideRight
width: parent.width
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
text: {
if (projectModel.stateListModel.getState(scenarioList.currentIndex))
return projectModel.stateListModel.getState(scenarioList.currentIndex).title
else
return ""
}
Connections {
target: blockChainSelector
onLoaded: {
comboLabel.text = projectModel.stateListModel.getState(scenarioList.currentIndex).title
}
onRenamed: {
comboLabel.text = scenario.title
}
}
}
}
}
} }
ScenarioButton { ScenarioButton {

Loading…
Cancel
Save