Browse Source

- Changes on TransactionDialog.qml Layout

- Move startF5Debugging => MainContent.qml
cl-refactor
yann300 10 years ago
parent
commit
78e49abad3
  1. 6
      mix/qml/Debugger.qml
  2. 38
      mix/qml/MainContent.qml
  3. 5
      mix/qml/StatusPane.qml
  4. 184
      mix/qml/TransactionDialog.qml
  5. 38
      mix/qml/main.qml

6
mix/qml/Debugger.qml

@ -114,6 +114,7 @@ Rectangle {
contentWidth: parent.width contentWidth: parent.width
Rectangle Rectangle
{ {
color: "transparent"
anchors.fill: parent anchors.fill: parent
ColumnLayout ColumnLayout
{ {
@ -317,7 +318,7 @@ Rectangle {
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
height: parent.height //- 2 * stateListContainer.border.width height: parent.height //- 2 * stateListContainer.border.width
color: "transparent"
ColumnLayout ColumnLayout
{ {
width: parent.width width: parent.width
@ -431,6 +432,7 @@ Rectangle {
Rectangle Rectangle
{ {
id: storageRect id: storageRect
color: "transparent"
width: parent.width width: parent.width
Layout.minimumHeight: 25 Layout.minimumHeight: 25
Layout.maximumHeight: 223 Layout.maximumHeight: 223
@ -506,6 +508,7 @@ Rectangle {
Rectangle Rectangle
{ {
id: memoryRect; id: memoryRect;
color: "transparent"
height: 25 height: 25
width: parent.width width: parent.width
Layout.minimumHeight: 25 Layout.minimumHeight: 25
@ -527,6 +530,7 @@ Rectangle {
Rectangle Rectangle
{ {
id: callDataRect id: callDataRect
color: "transparent"
height: 25 height: 25
width: parent.width width: parent.width
Layout.minimumHeight: 25 Layout.minimumHeight: 25

38
mix/qml/MainContent.qml

@ -4,6 +4,9 @@ import QtQuick.Layouts 1.0
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import CodeEditorExtensionManager 1.0 import CodeEditorExtensionManager 1.0
import Qt.labs.settings 1.0 import Qt.labs.settings 1.0
import org.ethereum.qml.QEther 1.0
import "js/QEtherHelper.js" as QEtherHelper
import "js/TransactionHelper.js" as TransactionHelper
Rectangle { Rectangle {
@ -26,6 +29,41 @@ Rectangle {
contentView.width = parent.width - projectList.width; contentView.width = parent.width - projectList.width;
} }
function startQuickDebugging()
{
var item = TransactionHelper.defaultTransaction();
item.executeConstructor = true;
if (codeModel.code.contract.constructor.parameters.length === 0)
{
ensureRightView();
startF5Debugging(item);
}
else
transactionDialog.open(0, item);
}
function startF5Debugging(transaction)
{
var ether = QEtherHelper.createEther("100000000000000000000000000", QEther.Wei);
var state = {
title: "",
balance: ether,
transactions: [transaction]
};
clientModel.debugState(state);
}
TransactionDialog {
id: transactionDialog
onAccepted: {
ensureRightView();
var item = transactionDialog.getItem();
item.executeConstructor = true;
startF5Debugging(item);
}
useTransactionDefaultValue: true
}
function toggleRightView() function toggleRightView()
{ {
if (!rightView.visible) if (!rightView.visible)

5
mix/qml/StatusPane.qml

@ -113,9 +113,10 @@ Rectangle {
Action { Action {
id: debugRunActionIcon id: debugRunActionIcon
onTriggered: { onTriggered: {
mainContent.toggleRightView();
if (mainContent.rightViewVisible()) if (mainContent.rightViewVisible())
clientModel.debugDeployment(); mainContent.hideRightView()
else
mainContent.startQuickDebugging();
} }
enabled: false enabled: false
} }

184
mix/qml/TransactionDialog.qml

@ -25,12 +25,10 @@ Window {
signal accepted; signal accepted;
function open(index, item) { function open(index, item) {
valueLabel.visible = !useTransactionDefaultValue; rowFunction.visible = !useTransactionDefaultValue;
valueField.visible = !useTransactionDefaultValue; rowValue.visible = !useTransactionDefaultValue;
gasLabel.visible = !useTransactionDefaultValue; rowGas.visible = !useTransactionDefaultValue;
gasFieldRect.visible = !useTransactionDefaultValue; rowGasPrice.visible = !useTransactionDefaultValue;
gasPriceLabel.visible = !useTransactionDefaultValue;
gasPriceRect.visible = !useTransactionDefaultValue;
transactionIndex = index; transactionIndex = index;
gasField.value = item.gas; gasField.value = item.gas;
@ -38,9 +36,7 @@ Window {
valueField.value = item.value; valueField.value = item.value;
var functionId = item.functionId; var functionId = item.functionId;
isConstructorTransaction = item.executeConstructor; isConstructorTransaction = item.executeConstructor;
functionLabel.visible = !item.executeConstructor; rowFunction.visible = !item.executeConstructor;
functionComboBox.visible = !item.executeConstructor;
console.log(item.executeConstructor);
itemParams = item.parameters !== undefined ? item.parameters : {}; itemParams = item.parameters !== undefined ? item.parameters : {};
functionsModel.clear(); functionsModel.clear();
@ -117,10 +113,6 @@ Window {
var parameter = transactionDialog.transactionParams.get(p); var parameter = transactionDialog.transactionParams.get(p);
var intComponent = Qt.createComponent("qrc:/qml/BigIntValue.qml"); var intComponent = Qt.createComponent("qrc:/qml/BigIntValue.qml");
var param = intComponent.createObject(modalTransactionDialog); var param = intComponent.createObject(modalTransactionDialog);
console.log(param);
console.log(JSON.stringify(param));
console.log(item);
console.log(JSON.stringify(item));
param.setValue(parameter.value); param.setValue(parameter.value);
item.parameters[parameter.name] = param; item.parameters[parameter.name] = param;
@ -128,102 +120,126 @@ Window {
return item; return item;
} }
GridLayout { ColumnLayout {
id: dialogContent id: dialogContent
columns: 2 width: parent.width
anchors.fill: parent anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 10 anchors.margins: 10
rowSpacing: 10 spacing: 30
columnSpacing: 10 RowLayout
{
Label { id: rowFunction
id: functionLabel;
text: qsTr("Function")
}
ComboBox {
id: functionComboBox
Layout.fillWidth: true Layout.fillWidth: true
currentIndex: -1 height: 150
textRole: "text" Label {
editable: false Layout.preferredWidth: 75
model: ListModel { text: qsTr("Function")
id: functionsModel
} }
onCurrentIndexChanged: { ComboBox {
loadParameters(); id: functionComboBox
Layout.fillWidth: true
currentIndex: -1
textRole: "text"
editable: false
model: ListModel {
id: functionsModel
}
onCurrentIndexChanged: {
loadParameters();
}
} }
} }
Label {
id: valueLabel RowLayout
text: qsTr("Value")
}
Rectangle
{ {
id: valueFieldRect id: rowValue
Layout.fillWidth: true Layout.fillWidth: true
Ether { Label {
id: valueField Layout.preferredWidth: 75
edit: true text: qsTr("Value")
displayFormattedValue: true }
Rectangle
{
Layout.fillWidth: true
Ether {
id: valueField
edit: true
displayFormattedValue: true
}
} }
} }
Label {
id: gasLabel RowLayout
text: qsTr("Gas")
}
Rectangle
{ {
id: gasFieldRect id: rowGas
Layout.fillWidth: true Layout.fillWidth: true
Ether { Label {
id: gasField Layout.preferredWidth: 75
edit: true text: qsTr("Gas")
displayFormattedValue: true }
Rectangle
{
Layout.fillWidth: true
Ether {
id: gasField
edit: true
displayFormattedValue: true
}
} }
} }
Label { RowLayout
id: gasPriceLabel
text: qsTr("Gas Price")
}
Rectangle
{ {
id: gasPriceRect id: rowGasPrice
Layout.fillWidth: true Layout.fillWidth: true
Ether { Label {
id: gasPriceField Layout.preferredWidth: 75
edit: true text: qsTr("Gas Price")
displayFormattedValue: true }
Rectangle
{
Layout.fillWidth: true
Ether {
id: gasPriceField
edit: true
displayFormattedValue: true
}
} }
} }
Label { RowLayout
text: qsTr("Parameters") {
}
TableView {
model: paramsModel
Layout.fillWidth: true Layout.fillWidth: true
Label {
TableViewColumn { text: qsTr("Parameters")
role: "name" Layout.preferredWidth: 75
title: "Name"
width: 120
}
TableViewColumn {
role: "type"
title: "Type"
width: 120
}
TableViewColumn {
role: "value"
title: "Value"
width: 120
} }
TableView {
model: paramsModel
Layout.fillWidth: true
TableViewColumn {
role: "name"
title: "Name"
width: 120
}
TableViewColumn {
role: "type"
title: "Type"
width: 120
}
TableViewColumn {
role: "value"
title: "Value"
width: 120
}
itemDelegate: { itemDelegate: {
return editableDelegate; return editableDelegate;
}
} }
} }
} }

38
mix/qml/main.qml

@ -6,8 +6,6 @@ import QtQuick.Layouts 1.1
import QtQuick.Window 2.1 import QtQuick.Window 2.1
import CodeEditorExtensionManager 1.0 import CodeEditorExtensionManager 1.0
import org.ethereum.qml.QEther 1.0 import org.ethereum.qml.QEther 1.0
import "js/QEtherHelper.js" as QEtherHelper
import "js/TransactionHelper.js" as TransactionHelper
ApplicationWindow { ApplicationWindow {
id: mainApplication id: mainApplication
@ -77,40 +75,8 @@ ApplicationWindow {
id: debugRunAction id: debugRunAction
text: "&Run" text: "&Run"
shortcut: "F5" shortcut: "F5"
onTriggered: { onTriggered: mainContent.startQuickDebugging()
var item = TransactionHelper.defaultTransaction(); enabled: codeModel.hasContract && !clientModel.running
item.executeConstructor = true;
if (codeModel.code.contract.constructor.parameters.length === 0)
{
mainContent.ensureRightView();
startF5Debugging(item);
}
else
transactionDialog.open(0, item);
}
enabled: codeModel.hasContract && !clientModel.running;
}
function startF5Debugging(transaction)
{
var ether = QEtherHelper.createEther("100000000000000000000000000", QEther.Wei);
var state = {
title: "",
balance: ether,
transactions: [transaction]
};
clientModel.debugState(state);
}
TransactionDialog {
id: transactionDialog
onAccepted: {
mainContent.ensureRightView();
var item = transactionDialog.getItem();
item.executeConstructor = true;
startF5Debugging(item);
}
useTransactionDefaultValue: true
} }
Action { Action {

Loading…
Cancel
Save