From 78e49abad32a6d489cbb0d9ebb40ff3dede4a19f Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 23 Jan 2015 14:42:10 +0100 Subject: [PATCH] - Changes on TransactionDialog.qml Layout - Move startF5Debugging => MainContent.qml --- mix/qml/Debugger.qml | 6 +- mix/qml/MainContent.qml | 38 +++++++ mix/qml/StatusPane.qml | 5 +- mix/qml/TransactionDialog.qml | 184 ++++++++++++++++++---------------- mix/qml/main.qml | 38 +------ 5 files changed, 148 insertions(+), 123 deletions(-) diff --git a/mix/qml/Debugger.qml b/mix/qml/Debugger.qml index 47975db83..3d0fba349 100644 --- a/mix/qml/Debugger.qml +++ b/mix/qml/Debugger.qml @@ -114,6 +114,7 @@ Rectangle { contentWidth: parent.width Rectangle { + color: "transparent" anchors.fill: parent ColumnLayout { @@ -317,7 +318,7 @@ Rectangle { Rectangle { Layout.fillWidth: true height: parent.height //- 2 * stateListContainer.border.width - + color: "transparent" ColumnLayout { width: parent.width @@ -431,6 +432,7 @@ Rectangle { Rectangle { id: storageRect + color: "transparent" width: parent.width Layout.minimumHeight: 25 Layout.maximumHeight: 223 @@ -506,6 +508,7 @@ Rectangle { Rectangle { id: memoryRect; + color: "transparent" height: 25 width: parent.width Layout.minimumHeight: 25 @@ -527,6 +530,7 @@ Rectangle { Rectangle { id: callDataRect + color: "transparent" height: 25 width: parent.width Layout.minimumHeight: 25 diff --git a/mix/qml/MainContent.qml b/mix/qml/MainContent.qml index 81771aa35..b29e2f4ea 100644 --- a/mix/qml/MainContent.qml +++ b/mix/qml/MainContent.qml @@ -4,6 +4,9 @@ import QtQuick.Layouts 1.0 import QtQuick.Controls.Styles 1.1 import CodeEditorExtensionManager 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 { @@ -26,6 +29,41 @@ Rectangle { 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() { if (!rightView.visible) diff --git a/mix/qml/StatusPane.qml b/mix/qml/StatusPane.qml index c6c531a80..5e1ec7c75 100644 --- a/mix/qml/StatusPane.qml +++ b/mix/qml/StatusPane.qml @@ -113,9 +113,10 @@ Rectangle { Action { id: debugRunActionIcon onTriggered: { - mainContent.toggleRightView(); if (mainContent.rightViewVisible()) - clientModel.debugDeployment(); + mainContent.hideRightView() + else + mainContent.startQuickDebugging(); } enabled: false } diff --git a/mix/qml/TransactionDialog.qml b/mix/qml/TransactionDialog.qml index 1ae36ebdb..f18db08a5 100644 --- a/mix/qml/TransactionDialog.qml +++ b/mix/qml/TransactionDialog.qml @@ -25,12 +25,10 @@ Window { signal accepted; function open(index, item) { - valueLabel.visible = !useTransactionDefaultValue; - valueField.visible = !useTransactionDefaultValue; - gasLabel.visible = !useTransactionDefaultValue; - gasFieldRect.visible = !useTransactionDefaultValue; - gasPriceLabel.visible = !useTransactionDefaultValue; - gasPriceRect.visible = !useTransactionDefaultValue; + rowFunction.visible = !useTransactionDefaultValue; + rowValue.visible = !useTransactionDefaultValue; + rowGas.visible = !useTransactionDefaultValue; + rowGasPrice.visible = !useTransactionDefaultValue; transactionIndex = index; gasField.value = item.gas; @@ -38,9 +36,7 @@ Window { valueField.value = item.value; var functionId = item.functionId; isConstructorTransaction = item.executeConstructor; - functionLabel.visible = !item.executeConstructor; - functionComboBox.visible = !item.executeConstructor; - console.log(item.executeConstructor); + rowFunction.visible = !item.executeConstructor; itemParams = item.parameters !== undefined ? item.parameters : {}; functionsModel.clear(); @@ -117,10 +113,6 @@ Window { var parameter = transactionDialog.transactionParams.get(p); var intComponent = Qt.createComponent("qrc:/qml/BigIntValue.qml"); 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); item.parameters[parameter.name] = param; @@ -128,102 +120,126 @@ Window { return item; } - GridLayout { + ColumnLayout { id: dialogContent - columns: 2 - anchors.fill: parent + width: parent.width + anchors.left: parent.left + anchors.right: parent.right anchors.margins: 10 - rowSpacing: 10 - columnSpacing: 10 - - Label { - id: functionLabel; - text: qsTr("Function") - } - ComboBox { - id: functionComboBox + spacing: 30 + RowLayout + { + id: rowFunction Layout.fillWidth: true - currentIndex: -1 - textRole: "text" - editable: false - model: ListModel { - id: functionsModel + height: 150 + Label { + Layout.preferredWidth: 75 + text: qsTr("Function") } - onCurrentIndexChanged: { - loadParameters(); + ComboBox { + id: functionComboBox + Layout.fillWidth: true + currentIndex: -1 + textRole: "text" + editable: false + model: ListModel { + id: functionsModel + } + onCurrentIndexChanged: { + loadParameters(); + } } } - Label { - id: valueLabel - text: qsTr("Value") - } - Rectangle + + RowLayout { - id: valueFieldRect + id: rowValue Layout.fillWidth: true - Ether { - id: valueField - edit: true - displayFormattedValue: true + Label { + Layout.preferredWidth: 75 + text: qsTr("Value") + } + Rectangle + { + Layout.fillWidth: true + Ether { + id: valueField + edit: true + displayFormattedValue: true + } } } - Label { - id: gasLabel - text: qsTr("Gas") - } - Rectangle + + RowLayout { - id: gasFieldRect + id: rowGas Layout.fillWidth: true - Ether { - id: gasField - edit: true - displayFormattedValue: true + Label { + Layout.preferredWidth: 75 + text: qsTr("Gas") + } + Rectangle + { + Layout.fillWidth: true + Ether { + id: gasField + edit: true + displayFormattedValue: true + } } } - Label { - id: gasPriceLabel - text: qsTr("Gas Price") - } - Rectangle + RowLayout { - id: gasPriceRect + id: rowGasPrice Layout.fillWidth: true - Ether { - id: gasPriceField - edit: true - displayFormattedValue: true + Label { + Layout.preferredWidth: 75 + text: qsTr("Gas Price") + } + Rectangle + { + Layout.fillWidth: true + Ether { + id: gasPriceField + edit: true + displayFormattedValue: true + } } } - Label { - text: qsTr("Parameters") - } - TableView { - model: paramsModel + RowLayout + { Layout.fillWidth: true - - TableViewColumn { - role: "name" - title: "Name" - width: 120 - } - TableViewColumn { - role: "type" - title: "Type" - width: 120 - } - TableViewColumn { - role: "value" - title: "Value" - width: 120 + Label { + text: qsTr("Parameters") + Layout.preferredWidth: 75 } + 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: { - return editableDelegate; + itemDelegate: { + return editableDelegate; + } } } } diff --git a/mix/qml/main.qml b/mix/qml/main.qml index 454f1e8fd..231dacf90 100644 --- a/mix/qml/main.qml +++ b/mix/qml/main.qml @@ -6,8 +6,6 @@ import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 import CodeEditorExtensionManager 1.0 import org.ethereum.qml.QEther 1.0 -import "js/QEtherHelper.js" as QEtherHelper -import "js/TransactionHelper.js" as TransactionHelper ApplicationWindow { id: mainApplication @@ -77,40 +75,8 @@ ApplicationWindow { id: debugRunAction text: "&Run" shortcut: "F5" - onTriggered: { - var item = TransactionHelper.defaultTransaction(); - 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 + onTriggered: mainContent.startQuickDebugging() + enabled: codeModel.hasContract && !clientModel.running } Action {