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. 3
      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
#endif
{
block = verifyBlock(_block, m_onBad);
block = verifyBlock(_block, m_onBad, _ir);
}
#if ETH_CATCH
catch (Exception& ex)

106
mix/qml/Block.qml

@ -47,7 +47,7 @@ ColumnLayout
Layout.preferredHeight: trHeight
Layout.preferredWidth: blockWidth
id: rowHeader
spacing: 0
Rectangle
{
Layout.preferredWidth: blockWidth
@ -55,7 +55,7 @@ ColumnLayout
color: "#DEDCDC"
radius: 4
anchors.left: parent.left
anchors.leftMargin: statusWidth + 5
anchors.leftMargin: statusWidth
Label {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
@ -99,6 +99,7 @@ ColumnLayout
{
id: rowTransaction
Layout.preferredHeight: trHeight
spacing: 0
function displayContent()
{
logsText.text = ""
@ -138,7 +139,7 @@ ColumnLayout
Image {
anchors.top: parent.top
anchors.topMargin: -7
anchors.topMargin: -10
id: saveStatusImage
source: "qrc:/qml/img/recyclediscard@2x.png"
width: statusWidth
@ -179,14 +180,27 @@ ColumnLayout
color: "#DEDCDC"
id: rowContentTr
anchors.top: parent.top
MouseArea
{
anchors.fill: parent
onDoubleClicked:
{
transactionDialog.stateAccounts = scenario.accounts
transactionDialog.execute = false
transactionDialog.open(index, blockIndex, transactions.get(index))
}
}
ColumnLayout
{
anchors.top: parent.top
width: parent.width
spacing: 10
RowLayout
{
anchors.top: parent.top
anchors.verticalCenter: parent.verticalCenter
Layout.fillWidth: true
spacing: cellSpacing
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
@ -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 variant debugTrRequested: []
signal chainChanged
signal chainReloaded
Connections
{
target: codeModel
onContractRenamed: {
rebuild.startBlinking()
}
onNewContractCompiled: {
rebuild.startBlinking()
}
}
onChainChanged: {
rebuild.startBlinking()
@ -30,14 +42,14 @@ ColumnLayout {
{
fromWidth = 100
toWidth = 100
valueWidth = 200
valueWidth = 250
}
else
{
var diff = (width - previousWidth) / 3;
fromWidth = fromWidth + diff < 100 ? 100 : fromWidth + diff
toWidth = toWidth + diff < 100 ? 100 : toWidth + diff
valueWidth = valueWidth + diff < 200 ? 200 : valueWidth + diff
valueWidth = valueWidth + diff < 250 ? 250 : valueWidth + diff
}
previousWidth = width
}
@ -47,7 +59,7 @@ ColumnLayout {
if (!scenario)
return;
if (model)
chainChanged()
rebuild.startBlinking()
model = scenario
blockModel.clear()
for (var b in model.blocks)
@ -55,10 +67,10 @@ ColumnLayout {
previousWidth = width
}
property int statusWidth: 40
property int statusWidth: 50
property int fromWidth: 100
property int toWidth: 100
property int valueWidth: 200
property int valueWidth: 250
property int logsWidth: 40
property int debugActionWidth: 40
property int horizontalMargin: 10
@ -68,7 +80,7 @@ ColumnLayout {
{
id: header
spacing: 0
Layout.preferredHeight: 30
Layout.preferredHeight: 40
Image {
id: debugImage
source: "qrc:/qml/img/recycleicon@2x.png"

3
mix/qml/ScenarioButton.qml

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

3
mix/qml/ScenarioExecution.qml

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

44
mix/qml/ScenarioLoader.qml

@ -17,6 +17,7 @@ ColumnLayout
signal saved(variant scenario)
signal duplicated(variant scenario)
signal loaded(variant scenario)
signal renamed(variant scenario)
spacing: 0
function init()
{
@ -28,8 +29,6 @@ ColumnLayout
editStatus.visible = true
}
//anchors.margins: 10
//width: parent.width
Rectangle
{
Layout.fillWidth: true
@ -75,6 +74,9 @@ ColumnLayout
projectModel.stateListModel.getState(scenarioList.currentIndex).title = scenarioName.text
projectModel.saveProjectFile()
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
textRole: "title"
height: 30
width: 150
onCurrentIndexChanged:
{
restoreScenario.restore()
@ -159,6 +162,43 @@ ColumnLayout
var state = projectModel.stateListModel.getState(currentIndex)
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 {

Loading…
Cancel
Save