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. 68
      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
} }

68
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,16 +120,20 @@ 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
{
id: rowFunction
Layout.fillWidth: true
height: 150
Label { Label {
id: functionLabel; Layout.preferredWidth: 75
text: qsTr("Function") text: qsTr("Function")
} }
ComboBox { ComboBox {
@ -153,14 +149,19 @@ Window {
loadParameters(); loadParameters();
} }
} }
}
RowLayout
{
id: rowValue
Layout.fillWidth: true
Label { Label {
id: valueLabel Layout.preferredWidth: 75
text: qsTr("Value") text: qsTr("Value")
} }
Rectangle Rectangle
{ {
id: valueFieldRect
Layout.fillWidth: true Layout.fillWidth: true
Ether { Ether {
id: valueField id: valueField
@ -168,14 +169,19 @@ Window {
displayFormattedValue: true displayFormattedValue: true
} }
} }
}
RowLayout
{
id: rowGas
Layout.fillWidth: true
Label { Label {
id: gasLabel Layout.preferredWidth: 75
text: qsTr("Gas") text: qsTr("Gas")
} }
Rectangle Rectangle
{ {
id: gasFieldRect
Layout.fillWidth: true Layout.fillWidth: true
Ether { Ether {
id: gasField id: gasField
@ -183,14 +189,18 @@ Window {
displayFormattedValue: true displayFormattedValue: true
} }
} }
}
RowLayout
{
id: rowGasPrice
Layout.fillWidth: true
Label { Label {
id: gasPriceLabel Layout.preferredWidth: 75
text: qsTr("Gas Price") text: qsTr("Gas Price")
} }
Rectangle Rectangle
{ {
id: gasPriceRect
Layout.fillWidth: true Layout.fillWidth: true
Ether { Ether {
id: gasPriceField id: gasPriceField
@ -198,9 +208,14 @@ Window {
displayFormattedValue: true displayFormattedValue: true
} }
} }
}
RowLayout
{
Layout.fillWidth: true
Label { Label {
text: qsTr("Parameters") text: qsTr("Parameters")
Layout.preferredWidth: 75
} }
TableView { TableView {
model: paramsModel model: paramsModel
@ -227,6 +242,7 @@ Window {
} }
} }
} }
}
RowLayout RowLayout
{ {

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