From e329364af4eff20f1ddee47a94ea54cff25067f3 Mon Sep 17 00:00:00 2001 From: Ali Mashatan Date: Fri, 20 Mar 2015 01:46:39 +0330 Subject: [PATCH 01/12] Adding StatusComboBox --- mix/qml/StatesComboBox.qml | 185 ++++++++++++++++++++++++++++++++++++ mix/qml/TransactionLog.qml | 21 +++- mix/qml/img/edit_combox.png | Bin 0 -> 406 bytes mix/res.qrc | 2 + 4 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 mix/qml/StatesComboBox.qml create mode 100644 mix/qml/img/edit_combox.png diff --git a/mix/qml/StatesComboBox.qml b/mix/qml/StatesComboBox.qml new file mode 100644 index 000000000..c89df5de5 --- /dev/null +++ b/mix/qml/StatesComboBox.qml @@ -0,0 +1,185 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file StatesComboBox.qml + * @author Ali Mashatan ali@ethdev.com + * @date 2015 + * Ethereum IDE client. + */ + +import QtQuick 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.1 + +Rectangle { + id:statesComboBox + + width:200; + height: 20; + + Component.onCompleted: + { + var top = dropDownList; + while (top.parent) + { + top = top.parent + if (top.objectName == "debugPanel") + break; + } + var coordinates = dropDownList.mapToItem(top, 0, 0) + dropDownList.parent = top; + dropDownList.x = coordinates.x + dropDownList.y = coordinates.y + } + + signal selectItem(real item); + signal editItem(real item); + + property variant items; + property alias selectedItem: chosenItemText.text; + property alias selectedIndex: listView.currentRow; + signal comboClicked; + + property variant colorItem; + property variant colorSelect; + + smooth:true; + Rectangle { + id:chosenItem + width:parent.width; + height:statesComboBox.height; + color: statesComboBox.color; + smooth:true; + Text { + anchors.top: parent.top; + anchors.left: parent.left; + anchors.margins: 2; + color: statesComboBox.colorItem; + id:chosenItemText + text:statesComboBox.items.get(0).title; + smooth:true + } + + MouseArea { + anchors.fill: parent; + onClicked: { + statesComboBox.state = statesComboBox.state==="dropDown"?"":"dropDown" + } + } + } + + Rectangle { + id:dropDownList + width:statesComboBox.width; + height:0; + clip:true; + radius:4; + anchors.top: chosenItem.bottom; + anchors.margins: 2; + color: statesComboBox.color + + TableView { + id:listView + height:500; + width:statesComboBox.width; + model: statesComboBox.items + currentRow: 0 + headerVisible: false; + backgroundVisible: false + alternatingRowColors : false; + frameVisible: false + + TableViewColumn { + role: "title" + title: "" + width: statesComboBox.width; + delegate: mainItemDelegate + //elideMode: Text.ElideNone + } + + Component { + id: mainItemDelegate + Item{ + id: itemDelegate + width:statesComboBox.width; + height: statesComboBox.height; + Text { + id: textItemid + text: styleData.value + color: statesComboBox.colorItem; + anchors.top: parent.top; + anchors.left: parent.left; + anchors.margins: 5; + + } + Rectangle + { + id: spaceItemid + anchors.top: textItemid.top; + anchors.left: textItemid.right + width: parent.width - textItemid.width - imageItemid.width - textItemid.anchors.margins- textItemid.anchors.margins + } + Image { + id: imageItemid + height:20 + width:20; + visible: false; + fillMode: Image.PreserveAspectFit + source: "img/edit_combox.png" + anchors.top: spaceItemid.top; + anchors.left: spaceItemid.right; + } + + MouseArea { + anchors.fill: parent; + hoverEnabled : true + + onEntered: { + imageItemid.visible = true; + textItemid.color = statesComboBox.colorSelect; + } + onExited: { + imageItemid.visible = false; + textItemid.color = statesComboBox.colorItem; + } + onClicked: { + if (mouseX > imageItemid.x && mouseX < imageItemid.x+ imageItemid.width + && mouseY > imageItemid.y && mouseY < imageItemid.y+ imageItemid.height) + statesComboBox.editItem(styleData.row); + else { + statesComboBox.state = "" + var prevSelection = chosenItemText.text + chosenItemText.text = modelData + if(chosenItemText.text != prevSelection) + statesComboBox.comboClicked(); + listView.currentRow = styleData.row; + statesComboBox.selectItem(styleData.row); + } + } + } + }//Item + }//Component + } + } + states: State { + name: "dropDown"; + PropertyChanges { target: dropDownList; height:20*statesComboBox.items.count } + } + + transitions: Transition { + NumberAnimation { target: dropDownList; properties: "height"; easing.type: Easing.OutExpo; duration: 1000 } + } +} diff --git a/mix/qml/TransactionLog.qml b/mix/qml/TransactionLog.qml index 315028c74..d7bda8fc4 100644 --- a/mix/qml/TransactionLog.qml +++ b/mix/qml/TransactionLog.qml @@ -61,7 +61,7 @@ Item { } } - ComboBox { + /*ComboBox { id: statesCombo model: projectModel.stateListModel width: 150 @@ -77,7 +77,24 @@ Item { statesCombo.currentIndex = index; } } - } + }*/ + StatesComboBox + { + id: statesCombo + items:projectModel.stateListModel + onSelectItem: console.log("Combobox Select Item: " + item ) + onEditItem: console.log("Combobox Edit Item: " + item ) + colorItem: "black" + colorSelect: "yellow" + color: "gray" + Connections { + target: projectModel.stateListModel + onStateRun: { + if (statesCombo.selectedIndex !== index) + statesCombo.selectedIndex = index; + } + } + } Button { anchors.rightMargin: 9 diff --git a/mix/qml/img/edit_combox.png b/mix/qml/img/edit_combox.png new file mode 100644 index 0000000000000000000000000000000000000000..be3b359429d9191aee8366978092ddbbe37be67b GIT binary patch literal 406 zcmeAS@N?(olHy`uVBq!ia0vp^av;pX0wgC|rfC8xmUKs7M+SzC{oH>NS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fF5lweBoc6VX;-`;;_Kaj^> z;_2(kexFf>&z!H+DD?|aXr8BwV~EA+J{d9U}xl-c#Q+N3{xm--e>HF>))CL_vxqQs|r zwi;2M<$qR`Wo5=c(R41^vJgnCar>}edXmAO{WbKscMO9L`h0wNvc(HQ7VvP zFfuSS)ip5GHL?gXG_f)@wK6o*HZZg@FqmUJ^9PEC-29Zxv`Q=*OduMnJ{sf#H86O( L`njxgN@xNAav_Q1 literal 0 HcmV?d00001 diff --git a/mix/res.qrc b/mix/res.qrc index fa50d6dd8..51f2b49c6 100644 --- a/mix/res.qrc +++ b/mix/res.qrc @@ -9,8 +9,10 @@ qml/ProjectList.qml qml/StateDialog.qml qml/StateList.qml + qml/StatesComboBox.qml qml/StateListModel.qml qml/img/dappProjectIcon.png + qml/img/edit_combox.png qml/img/jumpintoback.png qml/img/jumpintoforward.png qml/img/jumpoutback.png From 99a5df6b268d4c417ed6a835f5442ea8e06318a8 Mon Sep 17 00:00:00 2001 From: Ali Mashatan Date: Sun, 22 Mar 2015 12:59:19 +0430 Subject: [PATCH 02/12] - Bug fix: When a state was selected, the state is not being showed in the combobox. - Removing animation --- mix/qml/StatesComboBox.qml | 21 ++- mix/qml/TransactionLog.qml | 334 ++++++++++++++++++------------------- 2 files changed, 170 insertions(+), 185 deletions(-) diff --git a/mix/qml/StatesComboBox.qml b/mix/qml/StatesComboBox.qml index c89df5de5..24bd57866 100644 --- a/mix/qml/StatesComboBox.qml +++ b/mix/qml/StatesComboBox.qml @@ -49,8 +49,14 @@ Rectangle { signal editItem(real item); property variant items; - property alias selectedItem: chosenItemText.text; - property alias selectedIndex: listView.currentRow; + readonly property alias selectedItem: chosenItemText.text; + readonly property alias selectedIndex: listView.currentRow; + function setSelectedIndex(index) + { + listView.currentRow = index; + chosenItemText.text = statesComboBox.items.get(0).title; + } + signal comboClicked; property variant colorItem; @@ -64,12 +70,12 @@ Rectangle { color: statesComboBox.color; smooth:true; Text { + id:chosenItemText anchors.top: parent.top; anchors.left: parent.left; anchors.margins: 2; color: statesComboBox.colorItem; - id:chosenItemText - text:statesComboBox.items.get(0).title; + text:"" smooth:true } @@ -96,7 +102,7 @@ Rectangle { height:500; width:statesComboBox.width; model: statesComboBox.items - currentRow: 0 + currentRow: -1 headerVisible: false; backgroundVisible: false alternatingRowColors : false; @@ -162,7 +168,7 @@ Rectangle { else { statesComboBox.state = "" var prevSelection = chosenItemText.text - chosenItemText.text = modelData + chosenItemText.text = styleData.value if(chosenItemText.text != prevSelection) statesComboBox.comboClicked(); listView.currentRow = styleData.row; @@ -179,7 +185,4 @@ Rectangle { PropertyChanges { target: dropDownList; height:20*statesComboBox.items.count } } - transitions: Transition { - NumberAnimation { target: dropDownList; properties: "height"; easing.type: Easing.OutExpo; duration: 1000 } - } } diff --git a/mix/qml/TransactionLog.qml b/mix/qml/TransactionLog.qml index d7bda8fc4..d0386706e 100644 --- a/mix/qml/TransactionLog.qml +++ b/mix/qml/TransactionLog.qml @@ -7,202 +7,184 @@ import org.ethereum.qml.RecordLogEntry 1.0 Item { - property ListModel fullModel: ListModel{} - property ListModel transactionModel: ListModel{} - property ListModel callModel: ListModel{} + property ListModel fullModel: ListModel{} + property ListModel transactionModel: ListModel{} + property ListModel callModel: ListModel{} - Action { - id: addStateAction - text: "Add State" - shortcut: "Ctrl+Alt+T" - enabled: codeModel.hasContract && !clientModel.running; - onTriggered: projectModel.stateListModel.addState(); - } - Action { - id: editStateAction - text: "Edit State" - shortcut: "Ctrl+Alt+T" - enabled: codeModel.hasContract && !clientModel.running && statesCombo.currentIndex >= 0 && projectModel.stateListModel.count > 0; - onTriggered: projectModel.stateListModel.editState(statesCombo.currentIndex); - } + Action { + id: addStateAction + text: "Add State" + shortcut: "Ctrl+Alt+T" + enabled: codeModel.hasContract && !clientModel.running; + onTriggered: projectModel.stateListModel.addState(); + } + Action { + id: editStateAction + text: "Edit State" + shortcut: "Ctrl+Alt+T" + enabled: codeModel.hasContract && !clientModel.running && statesCombo.selectedIndex >= 0 && projectModel.stateListModel.count > 0; + onTriggered: projectModel.stateListModel.editState(statesCombo.selectedIndex); + } - ColumnLayout { - anchors.fill: parent - RowLayout { + ColumnLayout { + anchors.fill: parent + RowLayout { - Connections - { - id: compilationStatus - target: codeModel - property bool compilationComplete: false - onCompilationComplete: compilationComplete = true - onCompilationError: compilationComplete = false - } - - Connections - { - target: projectModel - onProjectSaved: - { - if (projectModel.appIsClosing) - return; - if (compilationStatus.compilationComplete && codeModel.hasContract && !clientModel.running) - projectModel.stateListModel.debugDefaultState(); - } - onProjectClosed: - { - fullModel.clear(); - transactionModel.clear(); - callModel.clear(); - } - onContractSaved: { - if (compilationStatus.compilationComplete && codeModel.hasContract && !clientModel.running) - projectModel.stateListModel.debugDefaultState(); - } - } + Connections + { + id: compilationStatus + target: codeModel + property bool compilationComplete: false + onCompilationComplete: compilationComplete = true + onCompilationError: compilationComplete = false + } - /*ComboBox { - id: statesCombo - model: projectModel.stateListModel - width: 150 - editable: false - textRole: "title" - onActivated: { - model.runState(index); - } - Connections { - target: projectModel.stateListModel - onStateRun: { - if (statesCombo.currentIndex !== index) - statesCombo.currentIndex = index; - } - } - }*/ - StatesComboBox + Connections + { + target: projectModel + onProjectSaved: + { + if (projectModel.appIsClosing) + return; + if (compilationStatus.compilationComplete && codeModel.hasContract && !clientModel.running) + projectModel.stateListModel.debugDefaultState(); + } + onProjectClosed: + { + fullModel.clear(); + transactionModel.clear(); + callModel.clear(); + } + onContractSaved: { + if (compilationStatus.compilationComplete && codeModel.hasContract && !clientModel.running) + projectModel.stateListModel.debugDefaultState(); + } + } + StatesComboBox { id: statesCombo items:projectModel.stateListModel onSelectItem: console.log("Combobox Select Item: " + item ) - onEditItem: console.log("Combobox Edit Item: " + item ) + onEditItem: projectModel.stateListModel.editState(item) colorItem: "black" - colorSelect: "yellow" - color: "gray" + colorSelect: "blue" + color: "white" Connections { target: projectModel.stateListModel onStateRun: { if (statesCombo.selectedIndex !== index) - statesCombo.selectedIndex = index; + statesCombo.setSelectedIndex( index ); } } } - Button - { - anchors.rightMargin: 9 - anchors.verticalCenter: parent.verticalCenter - action: editStateAction - } - Button - { - anchors.rightMargin: 9 - anchors.verticalCenter: parent.verticalCenter - action: addStateAction - } - Button - { - anchors.rightMargin: 9 - anchors.verticalCenter: parent.verticalCenter - action: mineAction - } + Button + { + anchors.rightMargin: 9 + anchors.verticalCenter: parent.verticalCenter + action: editStateAction + } + Button + { + anchors.rightMargin: 9 + anchors.verticalCenter: parent.verticalCenter + action: addStateAction + } + Button + { + anchors.rightMargin: 9 + anchors.verticalCenter: parent.verticalCenter + action: mineAction + } - ComboBox { - id: itemFilter + ComboBox { + id: itemFilter - function getCurrentModel() - { - return currentIndex === 0 ? fullModel : currentIndex === 1 ? transactionModel : currentIndex === 2 ? callModel : fullModel; - } + function getCurrentModel() + { + return currentIndex === 0 ? fullModel : currentIndex === 1 ? transactionModel : currentIndex === 2 ? callModel : fullModel; + } - model: ListModel { - ListElement { text: qsTr("Calls and Transactions"); value: 0; } - ListElement { text: qsTr("Only Transactions"); value: 1; } - ListElement { text: qsTr("Only Calls"); value: 2; } - } + model: ListModel { + ListElement { text: qsTr("Calls and Transactions"); value: 0; } + ListElement { text: qsTr("Only Transactions"); value: 1; } + ListElement { text: qsTr("Only Calls"); value: 2; } + } - onCurrentIndexChanged: - { - logTable.model = itemFilter.getCurrentModel(); - } - } - } - TableView { - id: logTable - Layout.fillWidth: true - Layout.fillHeight: true - model: fullModel + onCurrentIndexChanged: + { + logTable.model = itemFilter.getCurrentModel(); + } + } + } + TableView { + id: logTable + Layout.fillWidth: true + Layout.fillHeight: true + model: fullModel - TableViewColumn { - role: "transactionIndex" - title: qsTr("#") - width: 40 - } - TableViewColumn { - role: "contract" - title: qsTr("Contract") - width: 100 - } - TableViewColumn { - role: "function" - title: qsTr("Function") - width: 120 - } - TableViewColumn { - role: "value" - title: qsTr("Value") - width: 60 - } - TableViewColumn { - role: "address" - title: qsTr("Destination") - width: 130 - } - TableViewColumn { - role: "returned" - title: qsTr("Returned") - width: 120 - } - onActivated: { - var item = logTable.model.get(row); - if (item.type === RecordLogEntry.Transaction) - clientModel.debugRecord(item.recordIndex); - else - clientModel.emptyRecord(); - } - Keys.onPressed: { - if ((event.modifiers & Qt.ControlModifier) && event.key === Qt.Key_C && currentRow >=0 && currentRow < logTable.model.count) { - var item = logTable.model.get(currentRow); - appContext.toClipboard(item.returned); - } - } - } - } + TableViewColumn { + role: "transactionIndex" + title: qsTr("#") + width: 40 + } + TableViewColumn { + role: "contract" + title: qsTr("Contract") + width: 100 + } + TableViewColumn { + role: "function" + title: qsTr("Function") + width: 120 + } + TableViewColumn { + role: "value" + title: qsTr("Value") + width: 60 + } + TableViewColumn { + role: "address" + title: qsTr("Destination") + width: 130 + } + TableViewColumn { + role: "returned" + title: qsTr("Returned") + width: 120 + } + onActivated: { + var item = logTable.model.get(row); + if (item.type === RecordLogEntry.Transaction) + clientModel.debugRecord(item.recordIndex); + else + clientModel.emptyRecord(); + } + Keys.onPressed: { + if ((event.modifiers & Qt.ControlModifier) && event.key === Qt.Key_C && currentRow >=0 && currentRow < logTable.model.count) { + var item = logTable.model.get(currentRow); + appContext.toClipboard(item.returned); + } + } + } + } - Connections { - target: clientModel - onStateCleared: { - fullModel.clear(); - transactionModel.clear(); - callModel.clear(); - } - onNewRecord: { - fullModel.append(_r); - if (!_r.call) - transactionModel.append(_r); - else - callModel.append(_r); - } - onMiningComplete: { - fullModel.append(clientModel.lastBlock); - transactionModel.append(clientModel.lastBlock); - } - } + Connections { + target: clientModel + onStateCleared: { + fullModel.clear(); + transactionModel.clear(); + callModel.clear(); + } + onNewRecord: { + fullModel.append(_r); + if (!_r.call) + transactionModel.append(_r); + else + callModel.append(_r); + } + onMiningComplete: { + fullModel.append(clientModel.lastBlock); + transactionModel.append(clientModel.lastBlock); + } + } } From b9a7f0815f49237030a06df42b4eac64f6f13a74 Mon Sep 17 00:00:00 2001 From: Ali Mashatan Date: Wed, 25 Mar 2015 02:47:15 +0430 Subject: [PATCH 03/12] Adding "create state" minor correction --- mix/qml/StatesComboBox.qml | 169 ++++++++++++++++++++++--------------- mix/qml/TransactionLog.qml | 7 +- 2 files changed, 104 insertions(+), 72 deletions(-) diff --git a/mix/qml/StatesComboBox.qml b/mix/qml/StatesComboBox.qml index 24bd57866..ada5e00d5 100644 --- a/mix/qml/StatesComboBox.qml +++ b/mix/qml/StatesComboBox.qml @@ -47,6 +47,7 @@ Rectangle { signal selectItem(real item); signal editItem(real item); + signal selectCreate(); property variant items; readonly property alias selectedItem: chosenItemText.text; @@ -86,7 +87,7 @@ Rectangle { } } } - +//ToDo: We need scrollbar for items Rectangle { id:dropDownList width:statesComboBox.width; @@ -96,93 +97,123 @@ Rectangle { anchors.top: chosenItem.bottom; anchors.margins: 2; color: statesComboBox.color + ColumnLayout{ + spacing: 2 + TableView { + id:listView + height:20; + implicitHeight: 0 + width:statesComboBox.width; + model: statesComboBox.items + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff; + currentRow: -1 + headerVisible: false; + backgroundVisible: false + alternatingRowColors : false; + frameVisible: false + + TableViewColumn { + role: "title" + title: "" + width: statesComboBox.width; + delegate: mainItemDelegate + } + + Component { + id: mainItemDelegate + Item{ + id: itemDelegate + width:statesComboBox.width; + height: statesComboBox.height; + Text { + id: textItemid + text: styleData.value + color: statesComboBox.colorItem; + anchors.top: parent.top; + anchors.left: parent.left; + anchors.margins: 5; - TableView { - id:listView - height:500; - width:statesComboBox.width; - model: statesComboBox.items - currentRow: -1 - headerVisible: false; - backgroundVisible: false - alternatingRowColors : false; - frameVisible: false - - TableViewColumn { - role: "title" - title: "" - width: statesComboBox.width; - delegate: mainItemDelegate - //elideMode: Text.ElideNone - } + } + Rectangle + { + id: spaceItemid + anchors.top: textItemid.top; + anchors.left: textItemid.right + width: parent.width - textItemid.width - imageItemid.width - textItemid.anchors.margins- textItemid.anchors.margins + } + Image { + id: imageItemid + height:20 + width:20; + visible: false; + fillMode: Image.PreserveAspectFit + source: "img/edit_combox.png" + anchors.top: spaceItemid.top; + anchors.left: spaceItemid.right; + } - Component { - id: mainItemDelegate - Item{ - id: itemDelegate + MouseArea { + anchors.fill: parent; + hoverEnabled : true + + onEntered: { + imageItemid.visible = true; + textItemid.color = statesComboBox.colorSelect; + } + onExited: { + imageItemid.visible = false; + textItemid.color = statesComboBox.colorItem; + } + onClicked: { + if (mouseX > imageItemid.x && mouseX < imageItemid.x+ imageItemid.width + && mouseY > imageItemid.y && mouseY < imageItemid.y+ imageItemid.height) + statesComboBox.editItem(styleData.row); + else { + statesComboBox.state = "" + var prevSelection = chosenItemText.text + chosenItemText.text = styleData.value + listView.currentRow = styleData.row; + statesComboBox.selectItem(styleData.row); + } + } + } + }//Item + }//Component + }//Table View + RowLayout{ + Rectangle{ + width: 1 + } + Text{ + id:createStateText width:statesComboBox.width; height: statesComboBox.height; - Text { - id: textItemid - text: styleData.value - color: statesComboBox.colorItem; - anchors.top: parent.top; - anchors.left: parent.left; - anchors.margins: 5; - - } - Rectangle + font.pointSize: 10 + text:"Create State ..." + MouseArea { - id: spaceItemid - anchors.top: textItemid.top; - anchors.left: textItemid.right - width: parent.width - textItemid.width - imageItemid.width - textItemid.anchors.margins- textItemid.anchors.margins - } - Image { - id: imageItemid - height:20 - width:20; - visible: false; - fillMode: Image.PreserveAspectFit - source: "img/edit_combox.png" - anchors.top: spaceItemid.top; - anchors.left: spaceItemid.right; - } - - MouseArea { anchors.fill: parent; hoverEnabled : true onEntered: { - imageItemid.visible = true; - textItemid.color = statesComboBox.colorSelect; + createStateText.color = statesComboBox.colorSelect; } onExited: { - imageItemid.visible = false; - textItemid.color = statesComboBox.colorItem; + createStateText.color = statesComboBox.colorItem; } onClicked: { - if (mouseX > imageItemid.x && mouseX < imageItemid.x+ imageItemid.width - && mouseY > imageItemid.y && mouseY < imageItemid.y+ imageItemid.height) - statesComboBox.editItem(styleData.row); - else { - statesComboBox.state = "" - var prevSelection = chosenItemText.text - chosenItemText.text = styleData.value - if(chosenItemText.text != prevSelection) - statesComboBox.comboClicked(); - listView.currentRow = styleData.row; - statesComboBox.selectItem(styleData.row); - } + statesComboBox.state = "" + statesComboBox.selectCreate(); } } - }//Item - }//Component + } + } } } states: State { name: "dropDown"; - PropertyChanges { target: dropDownList; height:20*statesComboBox.items.count } + PropertyChanges { target: dropDownList; height:(20*(statesComboBox.items.count+1)) } + PropertyChanges { target:listView; height:20; implicitHeight: (20*(statesComboBox.items.count)) } } } diff --git a/mix/qml/TransactionLog.qml b/mix/qml/TransactionLog.qml index d0386706e..e0aec1a32 100644 --- a/mix/qml/TransactionLog.qml +++ b/mix/qml/TransactionLog.qml @@ -64,7 +64,8 @@ Item { { id: statesCombo items:projectModel.stateListModel - onSelectItem: console.log("Combobox Select Item: " + item ) + //onSelectItem: console.log("Combobox Select Item: " + item ) + onSelectCreate: projectModel.stateListModel.addState(); onEditItem: projectModel.stateListModel.editState(item) colorItem: "black" colorSelect: "blue" @@ -77,7 +78,7 @@ Item { } } } - Button + /*Button { anchors.rightMargin: 9 anchors.verticalCenter: parent.verticalCenter @@ -88,7 +89,7 @@ Item { anchors.rightMargin: 9 anchors.verticalCenter: parent.verticalCenter action: addStateAction - } + }*/ Button { anchors.rightMargin: 9 From f72d91b444aa082f506431c17b8f71043577403e Mon Sep 17 00:00:00 2001 From: Ali Mashatan Date: Sat, 28 Mar 2015 00:21:24 +0430 Subject: [PATCH 04/12] Adding "play" button Changes in the appearance and behavior of StatesComboBox --- mix/qml/StatesComboBox.qml | 55 +++++++++++++++++++++++---------- mix/qml/TransactionLog.qml | 41 +++++++++++++++--------- mix/qml/img/pause_button.png | Bin 0 -> 200 bytes mix/qml/img/pause_button2x.png | Bin 0 -> 414 bytes mix/qml/img/play_button.png | Bin 0 -> 531 bytes mix/qml/img/play_button2x.png | Bin 0 -> 904 bytes mix/res.qrc | 6 +++- 7 files changed, 70 insertions(+), 32 deletions(-) create mode 100755 mix/qml/img/pause_button.png create mode 100755 mix/qml/img/pause_button2x.png create mode 100755 mix/qml/img/play_button.png create mode 100755 mix/qml/img/play_button2x.png diff --git a/mix/qml/StatesComboBox.qml b/mix/qml/StatesComboBox.qml index ada5e00d5..2c61863ec 100644 --- a/mix/qml/StatesComboBox.qml +++ b/mix/qml/StatesComboBox.qml @@ -23,6 +23,7 @@ import QtQuick 2.0 import QtQuick.Controls 1.0 import QtQuick.Layouts 1.1 +import QtGraphicalEffects 1.0 Rectangle { id:statesComboBox @@ -40,7 +41,13 @@ Rectangle { break; } var coordinates = dropDownList.mapToItem(top, 0, 0) + //the order is important + dropDownShowdowList.parent = top; dropDownList.parent = top; + + dropDownShowdowList.x = coordinates.x + dropDownShowdowList.y = coordinates.y + dropDownList.x = coordinates.x dropDownList.y = coordinates.y } @@ -48,7 +55,7 @@ Rectangle { signal selectItem(real item); signal editItem(real item); signal selectCreate(); - + property variant rowHeight:25; property variant items; readonly property alias selectedItem: chosenItemText.text; readonly property alias selectedIndex: listView.currentRow; @@ -87,16 +94,30 @@ Rectangle { } } } -//ToDo: We need scrollbar for items + + Rectangle { + id:dropDownShowdowList + width:statesComboBox.width; + opacity: 0.3 + height:0; + clip:true; + radius:4; + anchors.top: chosenItem.top; + anchors.margins: 2; + color: "gray" + } + //ToDo: We need scrollbar for items Rectangle { id:dropDownList width:statesComboBox.width; height:0; clip:true; radius:4; - anchors.top: chosenItem.bottom; + anchors.top: chosenItem.top; anchors.margins: 2; color: statesComboBox.color + + ColumnLayout{ spacing: 2 TableView { @@ -118,10 +139,13 @@ Rectangle { width: statesComboBox.width; delegate: mainItemDelegate } - + rowDelegate: Rectangle { + width:statesComboBox.width; + height: statesComboBox.rowHeight; + } Component { id: mainItemDelegate - Item{ + Rectangle { id: itemDelegate width:statesComboBox.width; height: statesComboBox.height; @@ -134,22 +158,16 @@ Rectangle { anchors.margins: 5; } - Rectangle - { - id: spaceItemid - anchors.top: textItemid.top; - anchors.left: textItemid.right - width: parent.width - textItemid.width - imageItemid.width - textItemid.anchors.margins- textItemid.anchors.margins - } Image { id: imageItemid height:20 width:20; + anchors.right:parent.right + anchors.top: parent.top; + anchors.margins: 5; visible: false; fillMode: Image.PreserveAspectFit source: "img/edit_combox.png" - anchors.top: spaceItemid.top; - anchors.left: spaceItemid.right; } MouseArea { @@ -180,6 +198,7 @@ Rectangle { }//Item }//Component }//Table View + RowLayout{ Rectangle{ width: 1 @@ -188,7 +207,7 @@ Rectangle { id:createStateText width:statesComboBox.width; height: statesComboBox.height; - font.pointSize: 10 + font.bold: true text:"Create State ..." MouseArea { @@ -208,12 +227,14 @@ Rectangle { } } } + } } states: State { name: "dropDown"; - PropertyChanges { target: dropDownList; height:(20*(statesComboBox.items.count+1)) } - PropertyChanges { target:listView; height:20; implicitHeight: (20*(statesComboBox.items.count)) } + PropertyChanges { target: dropDownList; height:(statesComboBox.rowHeight*(statesComboBox.items.count+1)) } + PropertyChanges { target: dropDownShowdowList; width:statesComboBox.width+3; height:(statesComboBox.rowHeight*(statesComboBox.items.count+1))+3 } + PropertyChanges { target:listView; height:20; implicitHeight: (statesComboBox.rowHeight*(statesComboBox.items.count)) } } } diff --git a/mix/qml/TransactionLog.qml b/mix/qml/TransactionLog.qml index e0aec1a32..48b166eca 100644 --- a/mix/qml/TransactionLog.qml +++ b/mix/qml/TransactionLog.qml @@ -6,7 +6,6 @@ import QtQuick.Layouts 1.1 import org.ethereum.qml.RecordLogEntry 1.0 Item { - property ListModel fullModel: ListModel{} property ListModel transactionModel: ListModel{} property ListModel callModel: ListModel{} @@ -25,11 +24,29 @@ Item { enabled: codeModel.hasContract && !clientModel.running && statesCombo.selectedIndex >= 0 && projectModel.stateListModel.count > 0; onTriggered: projectModel.stateListModel.editState(statesCombo.selectedIndex); } + Action { + id: playAndPauseAction + checkable: true; + checked: false; + iconSource: "qrc:/qml/img/play_button.png" + onToggled: { + if (checked) + { + this.iconSource = "qrc:/qml/img/pause_button2x.png" + console.log("play"); + }else{ + this.iconSource = "qrc:/qml/img/play_button2x.png" + console.log("pause"); + } + } + enabled: true + } ColumnLayout { anchors.fill: parent RowLayout { - + anchors.right: parent.right + anchors.left: parent.left Connections { id: compilationStatus @@ -78,18 +95,6 @@ Item { } } } - /*Button - { - anchors.rightMargin: 9 - anchors.verticalCenter: parent.verticalCenter - action: editStateAction - } - Button - { - anchors.rightMargin: 9 - anchors.verticalCenter: parent.verticalCenter - action: addStateAction - }*/ Button { anchors.rightMargin: 9 @@ -116,6 +121,14 @@ Item { logTable.model = itemFilter.getCurrentModel(); } } + Button + { + id: playPauseBtn + anchors.right: parent.right + anchors.rightMargin: 1 + anchors.verticalCenter: parent.verticalCenter + action: playAndPauseAction + } } TableView { id: logTable diff --git a/mix/qml/img/pause_button.png b/mix/qml/img/pause_button.png new file mode 100755 index 0000000000000000000000000000000000000000..e87889551dc9239887d84bd1511f2ce0f57904e1 GIT binary patch literal 200 zcmeAS@N?(olHy`uVBq!ia0vp^=0L2+!3HFIm>NZa6k~CayA#8@b22Z1oF-2f$B+!x zx0f8b8WcoW0$xv%yBIB|$9ypJd+YTex4-*Vn#waWv2X||I5aRYGDSCL&;B9#Vz2#b z-Q=G0v6*?LVY|wf9~3T@D^JQUPCJ{qZb8HSO$nM8J!W;!;A%4o-!LUZ<*cg@tMe@F o2rrXK&y>^@5vH+lOcAbNY*gb=vpC{%3FsOIPgg&ebxsLQ0RFK*6951J literal 0 HcmV?d00001 diff --git a/mix/qml/img/pause_button2x.png b/mix/qml/img/pause_button2x.png new file mode 100755 index 0000000000000000000000000000000000000000..6f45b3236ab4e8debdc79082f4fa04df0f852786 GIT binary patch literal 414 zcmeAS@N?(olHy`uVBq!ia0vp^c|aV)!3HGzUpB-7DaPU;cPEB*=VV?2*%6*Djv*C{ zZ!aF?ZFUe~aeSkp@3Lu&v4d0A+0}oJZ4Ri7tz+R3P;h8qU}Pea5y4$^js5;T>*s&& z{dvCc{qg)&-|y{-{`qFR%;v4a0(t3k^6K@cI~C=!=Q6_XB1e!{xYdR^Ld`nj=7~(o;#)#o2%V9XSG))=G0DU lVOkp}rA&&~Vc}%LRIk&@;p1(W6b}q=22WQ%mvv4FO#n*Mm`DHs literal 0 HcmV?d00001 diff --git a/mix/qml/img/play_button.png b/mix/qml/img/play_button.png new file mode 100755 index 0000000000000000000000000000000000000000..01a5c85cb2123f6b78e4a7914e18aab8b60f8fea GIT binary patch literal 531 zcmV+u0_^>XP)Px$%}GQ-RA>e5mc38HKp4j9M@$G4j;zkIx#&)qSQ=;-abVD06Wv_Ze?a^XEQF;C zq@#&0Ov22{%0!xwe)yF177}7>@2;4cR;I{g( zir3X@^}EyQT<{W{C67?JSO@@5R8{=|;1jm$Q5JD|V}-*d0>P)=W2;UL!>H#Ko%VZK za7<5K*YzoS@c|RUYb&fOuhFusC{3;?ioOunwQYNmCjKum!rj{^3cYxaH$H4`_Qm9# zFAOdbUO_LuVztMuR;!j5X7~G|;h3Igxm=#37cDlyV>}eNEep13s(wuiuBQzY95?Yi zuje?#n6z zCB;O+EwKfA!{KmJ1Qe^uz2~r6Ho#7c24jFUk^|%bIY17O1LOcXKn{=t{z>Ug}i6zkYRuPT8rapDbDIzSXX+Tz9^@P_t*Zzz@++eXqX$@|)LCV>?}> zP`Yly_cdXw|K@DJ-Cx5x>-sL2PVWT{_x1*@{KEU`p5phrC%LEOKNnQjW92Acdi_ML z`q{MN`{pYu*SN2;IGnaWXyqJ*?|Tn2zPz5aPBS?AjL9o|zE@?tU+XN7Uw_@+;GIF& zqHdkXOZx*qYr4Lx?np0s{3&MF6rI=M%6fZm$UfQE-*L%v@x>dbnH*k8+Oy!o>KDIz1}lQ$v^jqR`nuuAq^Y_Gm+I?1+F-g$BXZ}7P0u@o*fX=d!nUzY-zQS| z$}3E7(;Lfs&n;YLo&qXutQAsVqzFxLe4xMh>o;G?TQN_7S&PBb)z4*}Q$iB}AKit7 literal 0 HcmV?d00001 diff --git a/mix/res.qrc b/mix/res.qrc index 51f2b49c6..6397555db 100644 --- a/mix/res.qrc +++ b/mix/res.qrc @@ -12,7 +12,7 @@ qml/StatesComboBox.qml qml/StateListModel.qml qml/img/dappProjectIcon.png - qml/img/edit_combox.png + qml/img/edit_combox.png qml/img/jumpintoback.png qml/img/jumpintoforward.png qml/img/jumpoutback.png @@ -115,5 +115,9 @@ qml/StructView.qml qml/img/console.png qml/VariablesView.qml + qml/img/play_button2x.png + qml/img/play_button.png + qml/img/pause_button2x.png + qml/img/pause_button.png From deaabe142a51fb14a64a8e912c45af49a531a810 Mon Sep 17 00:00:00 2001 From: Ali Mashatan Date: Tue, 31 Mar 2015 13:41:37 +0430 Subject: [PATCH 05/12] Bug fix. --- mix/qml/TransactionLog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix/qml/TransactionLog.qml b/mix/qml/TransactionLog.qml index 83e64ebf1..e5787f19b 100644 --- a/mix/qml/TransactionLog.qml +++ b/mix/qml/TransactionLog.qml @@ -61,7 +61,7 @@ Item { target: projectModel onProjectSaved: { - if (projectModel.appIsClosing) + if (projectModel.appIsClosing || projectModel.projectIsClosing) return; if (compilationStatus.compilationComplete && codeModel.hasContract && !clientModel.running) projectModel.stateListModel.debugDefaultState(); From 9d2a23b51e881d316ca34fbc1e6d093868628c3a Mon Sep 17 00:00:00 2001 From: Ali Mashatan Date: Tue, 31 Mar 2015 18:15:38 +0430 Subject: [PATCH 06/12] fix #1472 --- mix/qml/Debugger.qml | 27 +++++++++++++ mix/qml/StatesComboBox.qml | 78 +++++++++++++++++++------------------- mix/qml/TransactionLog.qml | 35 +---------------- 3 files changed, 66 insertions(+), 74 deletions(-) diff --git a/mix/qml/Debugger.qml b/mix/qml/Debugger.qml index 358750b24..202d27a0c 100644 --- a/mix/qml/Debugger.qml +++ b/mix/qml/Debugger.qml @@ -219,6 +219,33 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter id: jumpButtons spacing: 3 + + StepActionImage + { + id: playAction + enabledStateImg: "qrc:/qml/img/play_button.png" + disableStateImg: "qrc:/qml/img/play_button.png" + onClicked: console.log("play"); + width: 30 + height: 30 + buttonShortcut: "Ctrl+Shift+F8" + buttonTooltip: qsTr("Play") + visible: true + } + + StepActionImage + { + id: pauseAction + enabledStateImg: "qrc:/qml/img/pause_button.png" + disableStateImg: "qrc:/qml/img/pause_button.png" + onClicked: console.log("pause"); + width: 30 + height: 30 + buttonShortcut: "Ctrl+Shift+F9" + buttonTooltip: qsTr("Pause") + visible: true + } + StepActionImage { id: runBackAction; diff --git a/mix/qml/StatesComboBox.qml b/mix/qml/StatesComboBox.qml index 2c61863ec..26f41aa8d 100644 --- a/mix/qml/StatesComboBox.qml +++ b/mix/qml/StatesComboBox.qml @@ -26,9 +26,9 @@ import QtQuick.Layouts 1.1 import QtGraphicalEffects 1.0 Rectangle { - id:statesComboBox + id: statesComboBox - width:200; + width: 200; height: 20; Component.onCompleted: @@ -72,19 +72,19 @@ Rectangle { smooth:true; Rectangle { - id:chosenItem - width:parent.width; - height:statesComboBox.height; - color: statesComboBox.color; - smooth:true; + id: chosenItem + width: parent.width; + height: statesComboBox.height; + color: statesComboBox.color; + smooth: true; Text { - id:chosenItemText + id: chosenItemText anchors.top: parent.top; anchors.left: parent.left; anchors.margins: 2; color: statesComboBox.colorItem; - text:"" - smooth:true + text: "" + smooth: true } MouseArea { @@ -96,35 +96,34 @@ Rectangle { } Rectangle { - id:dropDownShowdowList - width:statesComboBox.width; + id: dropDownShowdowList + width: statesComboBox.width; opacity: 0.3 - height:0; - clip:true; - radius:4; + height: 0; + clip: true; + radius: 4; anchors.top: chosenItem.top; anchors.margins: 2; color: "gray" } //ToDo: We need scrollbar for items Rectangle { - id:dropDownList - width:statesComboBox.width; - height:0; - clip:true; - radius:4; + id: dropDownList + width: statesComboBox.width; + height: 0; + clip: true; + radius: 4; anchors.top: chosenItem.top; anchors.margins: 2; color: statesComboBox.color - - ColumnLayout{ + ColumnLayout { spacing: 2 TableView { - id:listView - height:20; + id: listView + height: 20; implicitHeight: 0 - width:statesComboBox.width; + width: statesComboBox.width; model: statesComboBox.items horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff; currentRow: -1 @@ -140,14 +139,14 @@ Rectangle { delegate: mainItemDelegate } rowDelegate: Rectangle { - width:statesComboBox.width; + width: statesComboBox.width; height: statesComboBox.rowHeight; } Component { id: mainItemDelegate Rectangle { id: itemDelegate - width:statesComboBox.width; + width: statesComboBox.width; height: statesComboBox.height; Text { id: textItemid @@ -156,13 +155,12 @@ Rectangle { anchors.top: parent.top; anchors.left: parent.left; anchors.margins: 5; - } Image { id: imageItemid - height:20 - width:20; - anchors.right:parent.right + height: 20 + width: 20; + anchors.right: parent.right anchors.top: parent.top; anchors.margins: 5; visible: false; @@ -199,20 +197,20 @@ Rectangle { }//Component }//Table View - RowLayout{ - Rectangle{ + RowLayout { + Rectangle { width: 1 } Text{ - id:createStateText - width:statesComboBox.width; + id: createStateText + width: statesComboBox.width; height: statesComboBox.height; font.bold: true - text:"Create State ..." + text: "Create State ..." MouseArea { anchors.fill: parent; - hoverEnabled : true + hoverEnabled: true onEntered: { createStateText.color = statesComboBox.colorSelect; @@ -232,9 +230,9 @@ Rectangle { } states: State { name: "dropDown"; - PropertyChanges { target: dropDownList; height:(statesComboBox.rowHeight*(statesComboBox.items.count+1)) } - PropertyChanges { target: dropDownShowdowList; width:statesComboBox.width+3; height:(statesComboBox.rowHeight*(statesComboBox.items.count+1))+3 } - PropertyChanges { target:listView; height:20; implicitHeight: (statesComboBox.rowHeight*(statesComboBox.items.count)) } + PropertyChanges { target: dropDownList; height: (statesComboBox.rowHeight*(statesComboBox.items.count+1)) } + PropertyChanges { target: dropDownShowdowList; width: statesComboBox.width+3; height: (statesComboBox.rowHeight*(statesComboBox.items.count+1))+3 } + PropertyChanges { target: listView; height: 20; implicitHeight: (statesComboBox.rowHeight*(statesComboBox.items.count)) } } } diff --git a/mix/qml/TransactionLog.qml b/mix/qml/TransactionLog.qml index e5787f19b..1772c7f18 100644 --- a/mix/qml/TransactionLog.qml +++ b/mix/qml/TransactionLog.qml @@ -10,38 +10,6 @@ Item { property ListModel transactionModel: ListModel{} property ListModel callModel: ListModel{} - Action { - id: addStateAction - text: "Add State" - shortcut: "Ctrl+Alt+T" - enabled: codeModel.hasContract && !clientModel.running; - onTriggered: projectModel.stateListModel.addState(); - } - Action { - id: editStateAction - text: "Edit State" - shortcut: "Ctrl+Alt+T" - enabled: codeModel.hasContract && !clientModel.running && statesCombo.selectedIndex >= 0 && projectModel.stateListModel.count > 0; - onTriggered: projectModel.stateListModel.editState(statesCombo.selectedIndex); - } - Action { - id: playAndPauseAction - checkable: true; - checked: false; - iconSource: "qrc:/qml/img/play_button.png" - onToggled: { - if (checked) - { - this.iconSource = "qrc:/qml/img/pause_button2x.png" - console.log("play"); - }else{ - this.iconSource = "qrc:/qml/img/play_button2x.png" - console.log("pause"); - } - } - enabled: true - } - ColumnLayout { anchors.fill: parent RowLayout { @@ -80,8 +48,7 @@ Item { StatesComboBox { id: statesCombo - items:projectModel.stateListModel - //onSelectItem: console.log("Combobox Select Item: " + item ) + items: projectModel.stateListModel onSelectCreate: projectModel.stateListModel.addState(); onEditItem: projectModel.stateListModel.editState(item) colorItem: "black" From ed62ee21f3592464fe5bab06425945bf7357309e Mon Sep 17 00:00:00 2001 From: Ali Mashatan Date: Wed, 1 Apr 2015 04:20:17 +0430 Subject: [PATCH 07/12] -Bug fix: get first item of list in setSelectedIndex function. -Putting qsTr for all user-visible strings. --- mix/qml/StatesComboBox.qml | 201 +++++++++++++++++++------------------ 1 file changed, 104 insertions(+), 97 deletions(-) diff --git a/mix/qml/StatesComboBox.qml b/mix/qml/StatesComboBox.qml index 26f41aa8d..246b3e93b 100644 --- a/mix/qml/StatesComboBox.qml +++ b/mix/qml/StatesComboBox.qml @@ -28,22 +28,20 @@ import QtGraphicalEffects 1.0 Rectangle { id: statesComboBox - width: 200; - height: 20; - - Component.onCompleted: - { - var top = dropDownList; - while (top.parent) - { + width: 200 + height: 20 + + Component.onCompleted: { + var top = dropDownList + while (top.parent) { top = top.parent if (top.objectName == "debugPanel") - break; + break } var coordinates = dropDownList.mapToItem(top, 0, 0) //the order is important - dropDownShowdowList.parent = top; - dropDownList.parent = top; + dropDownShowdowList.parent = top + dropDownList.parent = top dropDownShowdowList.x = coordinates.x dropDownShowdowList.y = coordinates.y @@ -52,187 +50,196 @@ Rectangle { dropDownList.y = coordinates.y } - signal selectItem(real item); - signal editItem(real item); - signal selectCreate(); - property variant rowHeight:25; - property variant items; - readonly property alias selectedItem: chosenItemText.text; - readonly property alias selectedIndex: listView.currentRow; - function setSelectedIndex(index) - { - listView.currentRow = index; - chosenItemText.text = statesComboBox.items.get(0).title; + signal selectItem(real item) + signal editItem(real item) + signal selectCreate + property variant rowHeight: 25 + property variant items + property alias selectedItem: chosenItemText.text + property alias selectedIndex: listView.currentRow + function setSelectedIndex(index) { + listView.currentRow = index + chosenItemText.text = statesComboBox.items.get(index).title } - signal comboClicked; + signal comboClicked - property variant colorItem; - property variant colorSelect; + property variant colorItem + property variant colorSelect - smooth:true; + smooth: true Rectangle { id: chosenItem - width: parent.width; - height: statesComboBox.height; - color: statesComboBox.color; - smooth: true; + width: parent.width + height: statesComboBox.height + color: statesComboBox.color + smooth: true Text { id: chosenItemText - anchors.top: parent.top; - anchors.left: parent.left; - anchors.margins: 2; - color: statesComboBox.colorItem; + anchors.top: parent.top + anchors.left: parent.left + anchors.margins: 2 + color: statesComboBox.colorItem text: "" smooth: true } MouseArea { - anchors.fill: parent; + anchors.fill: parent onClicked: { - statesComboBox.state = statesComboBox.state==="dropDown"?"":"dropDown" + statesComboBox.state = statesComboBox.state === "dropDown" ? "" : "dropDown" } } } Rectangle { id: dropDownShowdowList - width: statesComboBox.width; + width: statesComboBox.width opacity: 0.3 - height: 0; - clip: true; - radius: 4; - anchors.top: chosenItem.top; - anchors.margins: 2; + height: 0 + clip: true + radius: 4 + anchors.top: chosenItem.top + anchors.margins: 2 color: "gray" } //ToDo: We need scrollbar for items Rectangle { id: dropDownList - width: statesComboBox.width; - height: 0; - clip: true; - radius: 4; - anchors.top: chosenItem.top; - anchors.margins: 2; + width: statesComboBox.width + height: 0 + clip: true + radius: 4 + anchors.top: chosenItem.top + anchors.margins: 2 color: statesComboBox.color ColumnLayout { spacing: 2 TableView { id: listView - height: 20; + height: 20 implicitHeight: 0 - width: statesComboBox.width; + width: statesComboBox.width model: statesComboBox.items - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff; + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff currentRow: -1 - headerVisible: false; + headerVisible: false backgroundVisible: false - alternatingRowColors : false; + alternatingRowColors: false frameVisible: false TableViewColumn { role: "title" title: "" - width: statesComboBox.width; + width: statesComboBox.width delegate: mainItemDelegate } - rowDelegate: Rectangle { - width: statesComboBox.width; - height: statesComboBox.rowHeight; + rowDelegate: Rectangle { + width: statesComboBox.width + height: statesComboBox.rowHeight } Component { id: mainItemDelegate Rectangle { id: itemDelegate - width: statesComboBox.width; - height: statesComboBox.height; + width: statesComboBox.width + height: statesComboBox.height Text { id: textItemid text: styleData.value - color: statesComboBox.colorItem; - anchors.top: parent.top; - anchors.left: parent.left; - anchors.margins: 5; + color: statesComboBox.colorItem + anchors.top: parent.top + anchors.left: parent.left + anchors.margins: 5 } Image { id: imageItemid height: 20 - width: 20; + width: 20 anchors.right: parent.right - anchors.top: parent.top; - anchors.margins: 5; - visible: false; + anchors.top: parent.top + anchors.margins: 5 + visible: false fillMode: Image.PreserveAspectFit source: "img/edit_combox.png" } MouseArea { - anchors.fill: parent; - hoverEnabled : true + anchors.fill: parent + hoverEnabled: true onEntered: { - imageItemid.visible = true; - textItemid.color = statesComboBox.colorSelect; + imageItemid.visible = true + textItemid.color = statesComboBox.colorSelect } onExited: { - imageItemid.visible = false; - textItemid.color = statesComboBox.colorItem; + imageItemid.visible = false + textItemid.color = statesComboBox.colorItem } onClicked: { - if (mouseX > imageItemid.x && mouseX < imageItemid.x+ imageItemid.width - && mouseY > imageItemid.y && mouseY < imageItemid.y+ imageItemid.height) - statesComboBox.editItem(styleData.row); + if (mouseX > imageItemid.x + && mouseX < imageItemid.x + imageItemid.width + && mouseY > imageItemid.y + && mouseY < imageItemid.y + imageItemid.height) + statesComboBox.editItem(styleData.row) else { statesComboBox.state = "" var prevSelection = chosenItemText.text chosenItemText.text = styleData.value - listView.currentRow = styleData.row; - statesComboBox.selectItem(styleData.row); + listView.currentRow = styleData.row + statesComboBox.selectItem(styleData.row) } } } - }//Item - }//Component - }//Table View + } //Item + } //Component + } //Table View RowLayout { Rectangle { width: 1 } - Text{ + Text { id: createStateText - width: statesComboBox.width; - height: statesComboBox.height; + width: statesComboBox.width + height: statesComboBox.height font.bold: true - text: "Create State ..." - MouseArea - { - anchors.fill: parent; + text: qsTr("Create State ...") + MouseArea { + anchors.fill: parent hoverEnabled: true onEntered: { - createStateText.color = statesComboBox.colorSelect; + createStateText.color = statesComboBox.colorSelect } onExited: { - createStateText.color = statesComboBox.colorItem; + createStateText.color = statesComboBox.colorItem } onClicked: { statesComboBox.state = "" - statesComboBox.selectCreate(); + statesComboBox.selectCreate() } } } } - } } states: State { - name: "dropDown"; - PropertyChanges { target: dropDownList; height: (statesComboBox.rowHeight*(statesComboBox.items.count+1)) } - PropertyChanges { target: dropDownShowdowList; width: statesComboBox.width+3; height: (statesComboBox.rowHeight*(statesComboBox.items.count+1))+3 } - PropertyChanges { target: listView; height: 20; implicitHeight: (statesComboBox.rowHeight*(statesComboBox.items.count)) } + name: "dropDown" + PropertyChanges { + target: dropDownList + height: (statesComboBox.rowHeight * (statesComboBox.items.count + 1)) + } + PropertyChanges { + target: dropDownShowdowList + width: statesComboBox.width + 3 + height: (statesComboBox.rowHeight * (statesComboBox.items.count + 1)) + 3 + } + PropertyChanges { + target: listView + height: 20 + implicitHeight: (statesComboBox.rowHeight * (statesComboBox.items.count)) + } } - } From 11670e68d3e51151057cfcfb10ec4ed44b199615 Mon Sep 17 00:00:00 2001 From: Ali Mashatan Date: Thu, 2 Apr 2015 00:20:27 +0430 Subject: [PATCH 08/12] fix #1472 --- mix/qml/Debugger.qml | 50 ++-- mix/qml/StatesComboBox.qml | 454 ++++++++++++++++++------------------- mix/qml/TransactionLog.qml | 292 ++++++++++++------------ 3 files changed, 398 insertions(+), 398 deletions(-) diff --git a/mix/qml/Debugger.qml b/mix/qml/Debugger.qml index 202d27a0c..9ab2f03a4 100644 --- a/mix/qml/Debugger.qml +++ b/mix/qml/Debugger.qml @@ -220,31 +220,31 @@ Rectangle { id: jumpButtons spacing: 3 - StepActionImage - { - id: playAction - enabledStateImg: "qrc:/qml/img/play_button.png" - disableStateImg: "qrc:/qml/img/play_button.png" - onClicked: console.log("play"); - width: 30 - height: 30 - buttonShortcut: "Ctrl+Shift+F8" - buttonTooltip: qsTr("Play") - visible: true - } - - StepActionImage - { - id: pauseAction - enabledStateImg: "qrc:/qml/img/pause_button.png" - disableStateImg: "qrc:/qml/img/pause_button.png" - onClicked: console.log("pause"); - width: 30 - height: 30 - buttonShortcut: "Ctrl+Shift+F9" - buttonTooltip: qsTr("Pause") - visible: true - } + StepActionImage + { + id: playAction + enabledStateImg: "qrc:/qml/img/play_button.png" + disableStateImg: "qrc:/qml/img/play_button.png" + onClicked: console.log("play"); + width: 30 + height: 30 + buttonShortcut: "Ctrl+Shift+F8" + buttonTooltip: qsTr("Play") + visible: true + } + + StepActionImage + { + id: pauseAction + enabledStateImg: "qrc:/qml/img/pause_button.png" + disableStateImg: "qrc:/qml/img/pause_button.png" + onClicked: console.log("pause"); + width: 30 + height: 30 + buttonShortcut: "Ctrl+Shift+F9" + buttonTooltip: qsTr("Pause") + visible: true + } StepActionImage { diff --git a/mix/qml/StatesComboBox.qml b/mix/qml/StatesComboBox.qml index 246b3e93b..34567d083 100644 --- a/mix/qml/StatesComboBox.qml +++ b/mix/qml/StatesComboBox.qml @@ -1,18 +1,18 @@ /* - This file is part of cpp-ethereum. + This file is part of cpp-ethereum. - cpp-ethereum is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - cpp-ethereum is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . */ /** @file StatesComboBox.qml * @author Ali Mashatan ali@ethdev.com @@ -26,220 +26,220 @@ import QtQuick.Layouts 1.1 import QtGraphicalEffects 1.0 Rectangle { - id: statesComboBox - - width: 200 - height: 20 - - Component.onCompleted: { - var top = dropDownList - while (top.parent) { - top = top.parent - if (top.objectName == "debugPanel") - break - } - var coordinates = dropDownList.mapToItem(top, 0, 0) - //the order is important - dropDownShowdowList.parent = top - dropDownList.parent = top - - dropDownShowdowList.x = coordinates.x - dropDownShowdowList.y = coordinates.y - - dropDownList.x = coordinates.x - dropDownList.y = coordinates.y - } - - signal selectItem(real item) - signal editItem(real item) - signal selectCreate - property variant rowHeight: 25 - property variant items - property alias selectedItem: chosenItemText.text - property alias selectedIndex: listView.currentRow - function setSelectedIndex(index) { - listView.currentRow = index - chosenItemText.text = statesComboBox.items.get(index).title - } - - signal comboClicked - - property variant colorItem - property variant colorSelect - - smooth: true - Rectangle { - id: chosenItem - width: parent.width - height: statesComboBox.height - color: statesComboBox.color - smooth: true - Text { - id: chosenItemText - anchors.top: parent.top - anchors.left: parent.left - anchors.margins: 2 - color: statesComboBox.colorItem - text: "" - smooth: true - } - - MouseArea { - anchors.fill: parent - onClicked: { - statesComboBox.state = statesComboBox.state === "dropDown" ? "" : "dropDown" - } - } - } - - Rectangle { - id: dropDownShowdowList - width: statesComboBox.width - opacity: 0.3 - height: 0 - clip: true - radius: 4 - anchors.top: chosenItem.top - anchors.margins: 2 - color: "gray" - } - //ToDo: We need scrollbar for items - Rectangle { - id: dropDownList - width: statesComboBox.width - height: 0 - clip: true - radius: 4 - anchors.top: chosenItem.top - anchors.margins: 2 - color: statesComboBox.color - - ColumnLayout { - spacing: 2 - TableView { - id: listView - height: 20 - implicitHeight: 0 - width: statesComboBox.width - model: statesComboBox.items - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - currentRow: -1 - headerVisible: false - backgroundVisible: false - alternatingRowColors: false - frameVisible: false - - TableViewColumn { - role: "title" - title: "" - width: statesComboBox.width - delegate: mainItemDelegate - } - rowDelegate: Rectangle { - width: statesComboBox.width - height: statesComboBox.rowHeight - } - Component { - id: mainItemDelegate - Rectangle { - id: itemDelegate - width: statesComboBox.width - height: statesComboBox.height - Text { - id: textItemid - text: styleData.value - color: statesComboBox.colorItem - anchors.top: parent.top - anchors.left: parent.left - anchors.margins: 5 - } - Image { - id: imageItemid - height: 20 - width: 20 - anchors.right: parent.right - anchors.top: parent.top - anchors.margins: 5 - visible: false - fillMode: Image.PreserveAspectFit - source: "img/edit_combox.png" - } - - MouseArea { - anchors.fill: parent - hoverEnabled: true - - onEntered: { - imageItemid.visible = true - textItemid.color = statesComboBox.colorSelect - } - onExited: { - imageItemid.visible = false - textItemid.color = statesComboBox.colorItem - } - onClicked: { - if (mouseX > imageItemid.x - && mouseX < imageItemid.x + imageItemid.width - && mouseY > imageItemid.y - && mouseY < imageItemid.y + imageItemid.height) - statesComboBox.editItem(styleData.row) - else { - statesComboBox.state = "" - var prevSelection = chosenItemText.text - chosenItemText.text = styleData.value - listView.currentRow = styleData.row - statesComboBox.selectItem(styleData.row) - } - } - } - } //Item - } //Component - } //Table View - - RowLayout { - Rectangle { - width: 1 - } - Text { - id: createStateText - width: statesComboBox.width - height: statesComboBox.height - font.bold: true - text: qsTr("Create State ...") - MouseArea { - anchors.fill: parent - hoverEnabled: true - - onEntered: { - createStateText.color = statesComboBox.colorSelect - } - onExited: { - createStateText.color = statesComboBox.colorItem - } - onClicked: { - statesComboBox.state = "" - statesComboBox.selectCreate() - } - } - } - } - } - } - states: State { - name: "dropDown" - PropertyChanges { - target: dropDownList - height: (statesComboBox.rowHeight * (statesComboBox.items.count + 1)) - } - PropertyChanges { - target: dropDownShowdowList - width: statesComboBox.width + 3 - height: (statesComboBox.rowHeight * (statesComboBox.items.count + 1)) + 3 - } - PropertyChanges { - target: listView - height: 20 - implicitHeight: (statesComboBox.rowHeight * (statesComboBox.items.count)) - } - } + id: statesComboBox + + width: 200 + height: 20 + + Component.onCompleted: { + var top = dropDownList + while (top.parent) { + top = top.parent + if (top.objectName == "debugPanel") + break + } + var coordinates = dropDownList.mapToItem(top, 0, 0) + //the order is important + dropDownShowdowList.parent = top + dropDownList.parent = top + + dropDownShowdowList.x = coordinates.x + dropDownShowdowList.y = coordinates.y + + dropDownList.x = coordinates.x + dropDownList.y = coordinates.y + } + + signal selectItem(real item) + signal editItem(real item) + signal selectCreate + property variant rowHeight: 25 + property variant items + property alias selectedItem: chosenItemText.text + property alias selectedIndex: listView.currentRow + function setSelectedIndex(index) { + listView.currentRow = index + chosenItemText.text = statesComboBox.items.get(index).title + } + + signal comboClicked + + property variant colorItem + property variant colorSelect + + smooth: true + Rectangle { + id: chosenItem + width: parent.width + height: statesComboBox.height + color: statesComboBox.color + smooth: true + Text { + id: chosenItemText + anchors.top: parent.top + anchors.left: parent.left + anchors.margins: 2 + color: statesComboBox.colorItem + text: "" + smooth: true + } + + MouseArea { + anchors.fill: parent + onClicked: { + statesComboBox.state = statesComboBox.state === "dropDown" ? "" : "dropDown" + } + } + } + + Rectangle { + id: dropDownShowdowList + width: statesComboBox.width + opacity: 0.3 + height: 0 + clip: true + radius: 4 + anchors.top: chosenItem.top + anchors.margins: 2 + color: "gray" + } + //ToDo: We need scrollbar for items + Rectangle { + id: dropDownList + width: statesComboBox.width + height: 0 + clip: true + radius: 4 + anchors.top: chosenItem.top + anchors.margins: 2 + color: statesComboBox.color + + ColumnLayout { + spacing: 2 + TableView { + id: listView + height: 20 + implicitHeight: 0 + width: statesComboBox.width + model: statesComboBox.items + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + currentRow: -1 + headerVisible: false + backgroundVisible: false + alternatingRowColors: false + frameVisible: false + + TableViewColumn { + role: "title" + title: "" + width: statesComboBox.width + delegate: mainItemDelegate + } + rowDelegate: Rectangle { + width: statesComboBox.width + height: statesComboBox.rowHeight + } + Component { + id: mainItemDelegate + Rectangle { + id: itemDelegate + width: statesComboBox.width + height: statesComboBox.height + Text { + id: textItemid + text: styleData.value + color: statesComboBox.colorItem + anchors.top: parent.top + anchors.left: parent.left + anchors.margins: 5 + } + Image { + id: imageItemid + height: 20 + width: 20 + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: 5 + visible: false + fillMode: Image.PreserveAspectFit + source: "img/edit_combox.png" + } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + + onEntered: { + imageItemid.visible = true + textItemid.color = statesComboBox.colorSelect + } + onExited: { + imageItemid.visible = false + textItemid.color = statesComboBox.colorItem + } + onClicked: { + if (mouseX > imageItemid.x + && mouseX < imageItemid.x + imageItemid.width + && mouseY > imageItemid.y + && mouseY < imageItemid.y + imageItemid.height) + statesComboBox.editItem(styleData.row) + else { + statesComboBox.state = "" + var prevSelection = chosenItemText.text + chosenItemText.text = styleData.value + listView.currentRow = styleData.row + statesComboBox.selectItem(styleData.row) + } + } + } + } //Item + } //Component + } //Table View + + RowLayout { + Rectangle { + width: 1 + } + Text { + id: createStateText + width: statesComboBox.width + height: statesComboBox.height + font.bold: true + text: qsTr("Create State ...") + MouseArea { + anchors.fill: parent + hoverEnabled: true + + onEntered: { + createStateText.color = statesComboBox.colorSelect + } + onExited: { + createStateText.color = statesComboBox.colorItem + } + onClicked: { + statesComboBox.state = "" + statesComboBox.selectCreate() + } + } + } + } + } + } + states: State { + name: "dropDown" + PropertyChanges { + target: dropDownList + height: (statesComboBox.rowHeight * (statesComboBox.items.count + 1)) + } + PropertyChanges { + target: dropDownShowdowList + width: statesComboBox.width + 3 + height: (statesComboBox.rowHeight * (statesComboBox.items.count + 1)) + 3 + } + PropertyChanges { + target: listView + height: 20 + implicitHeight: (statesComboBox.rowHeight * (statesComboBox.items.count)) + } + } } diff --git a/mix/qml/TransactionLog.qml b/mix/qml/TransactionLog.qml index 1772c7f18..3bcc6c270 100644 --- a/mix/qml/TransactionLog.qml +++ b/mix/qml/TransactionLog.qml @@ -6,157 +6,157 @@ import QtQuick.Layouts 1.1 import org.ethereum.qml.RecordLogEntry 1.0 Item { - property ListModel fullModel: ListModel{} - property ListModel transactionModel: ListModel{} - property ListModel callModel: ListModel{} + property ListModel fullModel: ListModel{} + property ListModel transactionModel: ListModel{} + property ListModel callModel: ListModel{} - ColumnLayout { - anchors.fill: parent - RowLayout { - anchors.right: parent.right - anchors.left: parent.left - Connections - { - id: compilationStatus - target: codeModel - property bool compilationComplete: false - onCompilationComplete: compilationComplete = true - onCompilationError: compilationComplete = false - } + ColumnLayout { + anchors.fill: parent + RowLayout { + anchors.right: parent.right + anchors.left: parent.left + Connections + { + id: compilationStatus + target: codeModel + property bool compilationComplete: false + onCompilationComplete: compilationComplete = true + onCompilationError: compilationComplete = false + } - Connections - { - target: projectModel - onProjectSaved: - { - if (projectModel.appIsClosing || projectModel.projectIsClosing) - return; - if (compilationStatus.compilationComplete && codeModel.hasContract && !clientModel.running) - projectModel.stateListModel.debugDefaultState(); - } - onProjectClosed: - { - fullModel.clear(); - transactionModel.clear(); - callModel.clear(); - } - onContractSaved: { - if (compilationStatus.compilationComplete && codeModel.hasContract && !clientModel.running) - projectModel.stateListModel.debugDefaultState(); - } - } - StatesComboBox - { - id: statesCombo - items: projectModel.stateListModel - onSelectCreate: projectModel.stateListModel.addState(); - onEditItem: projectModel.stateListModel.editState(item) - colorItem: "black" - colorSelect: "blue" - color: "white" - Connections { - target: projectModel.stateListModel - onStateRun: { - if (statesCombo.selectedIndex !== index) - statesCombo.setSelectedIndex( index ); - } - } - } - Button - { - anchors.rightMargin: 9 - anchors.verticalCenter: parent.verticalCenter - action: mineAction - } + Connections + { + target: projectModel + onProjectSaved: + { + if (projectModel.appIsClosing || projectModel.projectIsClosing) + return; + if (compilationStatus.compilationComplete && codeModel.hasContract && !clientModel.running) + projectModel.stateListModel.debugDefaultState(); + } + onProjectClosed: + { + fullModel.clear(); + transactionModel.clear(); + callModel.clear(); + } + onContractSaved: { + if (compilationStatus.compilationComplete && codeModel.hasContract && !clientModel.running) + projectModel.stateListModel.debugDefaultState(); + } + } + StatesComboBox + { + id: statesCombo + items: projectModel.stateListModel + onSelectCreate: projectModel.stateListModel.addState(); + onEditItem: projectModel.stateListModel.editState(item) + colorItem: "black" + colorSelect: "blue" + color: "white" + Connections { + target: projectModel.stateListModel + onStateRun: { + if (statesCombo.selectedIndex !== index) + statesCombo.setSelectedIndex( index ); + } + } + } + Button + { + anchors.rightMargin: 9 + anchors.verticalCenter: parent.verticalCenter + action: mineAction + } - ComboBox { - id: itemFilter + ComboBox { + id: itemFilter - function getCurrentModel() - { - return currentIndex === 0 ? fullModel : currentIndex === 1 ? transactionModel : currentIndex === 2 ? callModel : fullModel; - } + function getCurrentModel() + { + return currentIndex === 0 ? fullModel : currentIndex === 1 ? transactionModel : currentIndex === 2 ? callModel : fullModel; + } - model: ListModel { - ListElement { text: qsTr("Calls and Transactions"); value: 0; } - ListElement { text: qsTr("Only Transactions"); value: 1; } - ListElement { text: qsTr("Only Calls"); value: 2; } - } + model: ListModel { + ListElement { text: qsTr("Calls and Transactions"); value: 0; } + ListElement { text: qsTr("Only Transactions"); value: 1; } + ListElement { text: qsTr("Only Calls"); value: 2; } + } - onCurrentIndexChanged: - { - logTable.model = itemFilter.getCurrentModel(); - } - } - } - TableView { - id: logTable - Layout.fillWidth: true - Layout.fillHeight: true - model: fullModel + onCurrentIndexChanged: + { + logTable.model = itemFilter.getCurrentModel(); + } + } + } + TableView { + id: logTable + Layout.fillWidth: true + Layout.fillHeight: true + model: fullModel - TableViewColumn { - role: "transactionIndex" - title: qsTr("#") - width: 40 - } - TableViewColumn { - role: "contract" - title: qsTr("Contract") - width: 100 - } - TableViewColumn { - role: "function" - title: qsTr("Function") - width: 120 - } - TableViewColumn { - role: "value" - title: qsTr("Value") - width: 60 - } - TableViewColumn { - role: "address" - title: qsTr("Destination") - width: 130 - } - TableViewColumn { - role: "returned" - title: qsTr("Returned") - width: 120 - } - onActivated: { - var item = logTable.model.get(row); - if (item.type === RecordLogEntry.Transaction) - clientModel.debugRecord(item.recordIndex); - else - clientModel.emptyRecord(); - } - Keys.onPressed: { - if ((event.modifiers & Qt.ControlModifier) && event.key === Qt.Key_C && currentRow >=0 && currentRow < logTable.model.count) { - var item = logTable.model.get(currentRow); - appContext.toClipboard(item.returned); - } - } - } - } - Connections { - target: clientModel - onStateCleared: { - fullModel.clear(); - transactionModel.clear(); - callModel.clear(); - } - onNewRecord: { - fullModel.append(_r); - if (!_r.call) - transactionModel.append(_r); - else - callModel.append(_r); - } - onMiningComplete: { - fullModel.append(clientModel.lastBlock); - transactionModel.append(clientModel.lastBlock); - } - } + TableViewColumn { + role: "transactionIndex" + title: qsTr("#") + width: 40 + } + TableViewColumn { + role: "contract" + title: qsTr("Contract") + width: 100 + } + TableViewColumn { + role: "function" + title: qsTr("Function") + width: 120 + } + TableViewColumn { + role: "value" + title: qsTr("Value") + width: 60 + } + TableViewColumn { + role: "address" + title: qsTr("Destination") + width: 130 + } + TableViewColumn { + role: "returned" + title: qsTr("Returned") + width: 120 + } + onActivated: { + var item = logTable.model.get(row); + if (item.type === RecordLogEntry.Transaction) + clientModel.debugRecord(item.recordIndex); + else + clientModel.emptyRecord(); + } + Keys.onPressed: { + if ((event.modifiers & Qt.ControlModifier) && event.key === Qt.Key_C && currentRow >=0 && currentRow < logTable.model.count) { + var item = logTable.model.get(currentRow); + appContext.toClipboard(item.returned); + } + } + } + } + Connections { + target: clientModel + onStateCleared: { + fullModel.clear(); + transactionModel.clear(); + callModel.clear(); + } + onNewRecord: { + fullModel.append(_r); + if (!_r.call) + transactionModel.append(_r); + else + callModel.append(_r); + } + onMiningComplete: { + fullModel.append(clientModel.lastBlock); + transactionModel.append(clientModel.lastBlock); + } + } } From 04d0584bc537bf94334c1766d14b93b80141ffaf Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 2 Apr 2015 10:20:33 +0200 Subject: [PATCH 09/12] - add Search icon. - fix animation bad behavior --- mix/qml/LogsPane.qml | 71 +++++++++++++++++++++++-------------- mix/qml/LogsPaneStyle.qml | 4 +-- mix/qml/StatusPane.qml | 4 +-- mix/qml/img/searchicon.png | Bin 0 -> 1439 bytes mix/res.qrc | 1 + 5 files changed, 49 insertions(+), 31 deletions(-) create mode 100644 mix/qml/img/searchicon.png diff --git a/mix/qml/LogsPane.qml b/mix/qml/LogsPane.qml index c619080bf..ca123f6a0 100644 --- a/mix/qml/LogsPane.qml +++ b/mix/qml/LogsPane.qml @@ -37,7 +37,6 @@ Rectangle height: parent.height - rowAction.height width: parent.width spacing: 0 - ListModel { id: logsModel } @@ -100,7 +99,7 @@ Rectangle Rectangle { - width: 750 + width: LogsPaneStyle.generic.layout.dateWidth + LogsPaneStyle.generic.layout.contentWidth + LogsPaneStyle.generic.layout.typeWidth height: 30 color: { @@ -171,7 +170,7 @@ Rectangle anchors.verticalCenter: parent.verticalCenter elide: Text.ElideRight anchors.left: parent.left - anchors.leftMargin: 190 + anchors.leftMargin: 230 color: { parent.getColor(level); } @@ -486,39 +485,59 @@ Rectangle } } - DefaultTextField + Rectangle { - id: searchBox + width: 120 + radius: 10 + height: 25 + color: "white" anchors.verticalCenter: parent.verticalCenter - width: LogsPaneStyle.generic.layout.headerInputWidth - 50 - font.family: LogsPaneStyle.generic.layout.logLabelFont - font.pointSize: Style.absoluteSize(-3) - font.italic: true - text: qsTr(" - Search - ") - onFocusChanged: + + Image { - if (!focus && text === "") - text = qsTr(" - Search - "); - else if (focus && text === qsTr(" - Search - ")) - text = ""; + id: searchImg + source: "qrc:/qml/img/searchicon.png" + fillMode: Image.PreserveAspectFit + width: 20 + height: 25 + z: 3 } - onTextChanged: { - if (text === qsTr(" - Search - ")) - proxyModel.search(""); - else - proxyModel.search(text); - } + DefaultTextField + { + id: searchBox + z: 2 + width: 100 + anchors.left: searchImg.right + anchors.leftMargin: -7 + font.family: LogsPaneStyle.generic.layout.logLabelFont + font.pointSize: Style.absoluteSize(-3) + font.italic: true + text: qsTr(" - Search - ") + onFocusChanged: + { + if (!focus && text === "") + text = qsTr(" - Search - "); + else if (focus && text === qsTr(" - Search - ")) + text = ""; + } - style: - TextFieldStyle { - background: Rectangle { - radius: 10 + onTextChanged: { + if (text === qsTr(" - Search - ")) + proxyModel.search(""); + else + proxyModel.search(text); + } + + style: + TextFieldStyle { + background: Rectangle { + radius: 10 + } } } } - Rectangle { height: LogsPaneStyle.generic.layout.headerButtonHeight diff --git a/mix/qml/LogsPaneStyle.qml b/mix/qml/LogsPaneStyle.qml index 19f6a653e..0bbdfcee4 100644 --- a/mix/qml/LogsPaneStyle.qml +++ b/mix/qml/LogsPaneStyle.qml @@ -18,8 +18,8 @@ QtObject { property string logLabelColor: "#4a4a4a" property string logLabelFont: "sans serif" property int headerInputWidth: 200 - property int dateWidth: 70 - property int typeWidth: 90 + property int dateWidth: 150 + property int typeWidth: 150 property int contentWidth: 560 property string logAlternateColor: "#f6f5f6" property string errorColor: "#fffcd5" diff --git a/mix/qml/StatusPane.qml b/mix/qml/StatusPane.qml index 4a9287bec..6d8042add 100644 --- a/mix/qml/StatusPane.qml +++ b/mix/qml/StatusPane.qml @@ -227,7 +227,7 @@ Rectangle { top = top.parent var coordinates = logsContainer.mapToItem(top, 0, 0); logsContainer.parent = top; - logsContainer.x = status.x + statusContainer.x - LogsPaneStyle.generic.layout.dateWidth - LogsPaneStyle.generic.layout.typeWidth - 30 + logsContainer.x = status.x + statusContainer.x - LogsPaneStyle.generic.layout.dateWidth - LogsPaneStyle.generic.layout.typeWidth + 70 } LogsPane @@ -239,7 +239,6 @@ Rectangle { State { name: "opened"; PropertyChanges { target: logsContainer; height: 500; visible: true } - PropertyChanges { target: statusContainer; width: 100; height: 25 } }, State { name: "closed"; @@ -250,7 +249,6 @@ Rectangle { transitions: Transition { NumberAnimation { properties: "height"; easing.type: Easing.InOutQuad; duration: 200 } NumberAnimation { target: logsContainer; properties: "visible"; easing.type: Easing.InOutQuad; duration: 200 } - NumberAnimation { target: statusContainer; properties: "width"; easing.type: Easing.InOutQuad; duration: 500 } } } } diff --git a/mix/qml/img/searchicon.png b/mix/qml/img/searchicon.png new file mode 100644 index 0000000000000000000000000000000000000000..c10dc9228e7f7ccf39670ea9c7f6c4acbd19caa4 GIT binary patch literal 1439 zcmV;Q1z`G#P)Px)SxH1eRA>e5nq6pIMHI)oNwd4H4@#r9jbBJg5%M7RK}scr65pFdi@-Fdi@-Fdi@-Fdit62V&)bO{dez zcs#x*7K`lye=Fr?OV4bvSe#v6UY=ZBTs+CRTsidnVMa>0udi==MMcG1ka`Z18~qeB zW`QxI5Knh^cVF}y8)aW4gqf+0$z(DEiNlasZy8viJWJb;l$U6yTHH+eAmvVb9Q7sg zdvkMhuMZ9m{u3oRFRajnA$xBkkvI;4M=S+D6SBS3M>{$?e)m#}%pHXMK4iMc+hq)- z&lL)V=exSPe)W=xsx1`Z{{H@L82lB+Y#|pgx-*~84?^f#5Ca*vp2&C=xePdQWU|!j zQ>oN+5P6+3+JpxN25!f=Z!q*B%0E$l07J)gjNsjWjCcQIWbYA)@m{p zs|{GGACkv}Ed6=v&*+jBd_sSc;tBHK#c6NU22d>k{CgcKgXDnG;mkyMt zj51+XQ(0UjefD2bmcJ!zBFWYjnG$8fXue;x6V9^8lqC_;Hg-u@luDEc^KF#zcUcBp ziqa4#7Bg#O+lLNkcc{7&;raRb4QQ(rjm*N;P?~*&9oSVZEiDP3p~_uKgfp3pYz#^p zd}hI(X=SAW1WMQtUlJv=tFn9AmgL->Ti;QgoMv~we5=oUFRm%hK0C!C}Aqrpy45JTAHV_?I_c)#B$O$`)h!N_wklRX|{Nf-xsLO^ugA`Yd_iMc%}W zjx)3S0G4xj9oyM)-sd}Y6|MOhwuw1snzi6OxsjRn{ISlK@hWc`!eYFO^mjBh@;Q^= zwF0L#AJR@H&hTc@m!D_ld#yBSHx*$aZ<8jZz`vN;5AGfAv@!qy002ovPDHLkV1lXRpyU7m literal 0 HcmV?d00001 diff --git a/mix/res.qrc b/mix/res.qrc index 3a4254791..e981f22ae 100644 --- a/mix/res.qrc +++ b/mix/res.qrc @@ -56,5 +56,6 @@ qml/img/cleariconactive.png qml/img/copyicon.png qml/img/copyiconactive.png + qml/img/searchicon.png From 877380bf586ae755487ede47dc507c4478613005 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 2 Apr 2015 12:30:03 +0200 Subject: [PATCH 10/12] - Add actions for play and stop debugging. - Small change in layout of statecombobox. --- mix/qml/Debugger.qml | 12 +++++------ mix/qml/StatesComboBox.qml | 39 +++++++++++++++++++++++----------- mix/qml/TransactionLog.qml | 6 ++++-- mix/qml/img/stop_button2x.png | Bin 0 -> 235 bytes mix/res.qrc | 1 + 5 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 mix/qml/img/stop_button2x.png diff --git a/mix/qml/Debugger.qml b/mix/qml/Debugger.qml index 9ab2f03a4..836bbaf94 100644 --- a/mix/qml/Debugger.qml +++ b/mix/qml/Debugger.qml @@ -225,24 +225,24 @@ Rectangle { id: playAction enabledStateImg: "qrc:/qml/img/play_button.png" disableStateImg: "qrc:/qml/img/play_button.png" - onClicked: console.log("play"); + onClicked: projectModel.stateListModel.runState(transactionLog.selectedStateIndex) width: 30 height: 30 buttonShortcut: "Ctrl+Shift+F8" - buttonTooltip: qsTr("Play") + buttonTooltip: qsTr("Start Debugging") visible: true } StepActionImage { id: pauseAction - enabledStateImg: "qrc:/qml/img/pause_button.png" - disableStateImg: "qrc:/qml/img/pause_button.png" - onClicked: console.log("pause"); + enabledStateImg: "qrc:/qml/img/stop_button2x.png" + disableStateImg: "qrc:/qml/img/stop_button2x.png" + onClicked: Debugger.init(null); width: 30 height: 30 buttonShortcut: "Ctrl+Shift+F9" - buttonTooltip: qsTr("Pause") + buttonTooltip: qsTr("Stop Debugging") visible: true } diff --git a/mix/qml/StatesComboBox.qml b/mix/qml/StatesComboBox.qml index 34567d083..bc7a4853d 100644 --- a/mix/qml/StatesComboBox.qml +++ b/mix/qml/StatesComboBox.qml @@ -29,7 +29,7 @@ Rectangle { id: statesComboBox width: 200 - height: 20 + height: 23 Component.onCompleted: { var top = dropDownList @@ -53,7 +53,7 @@ Rectangle { signal selectItem(real item) signal editItem(real item) signal selectCreate - property variant rowHeight: 25 + property int rowHeight: 25 property variant items property alias selectedItem: chosenItemText.text property alias selectedIndex: listView.currentRow @@ -67,21 +67,31 @@ Rectangle { property variant colorItem property variant colorSelect + SourceSansProRegular + { + id: regularFont + } + + SourceSansProBold + { + id: boldFont + } + smooth: true Rectangle { id: chosenItem width: parent.width height: statesComboBox.height color: statesComboBox.color - smooth: true + Text { id: chosenItemText - anchors.top: parent.top anchors.left: parent.left - anchors.margins: 2 + anchors.leftMargin: 10 + anchors.verticalCenter: parent.verticalCenter color: statesComboBox.colorItem text: "" - smooth: true + font.family: regularFont.name } MouseArea { @@ -111,7 +121,7 @@ Rectangle { clip: true radius: 4 anchors.top: chosenItem.top - anchors.margins: 2 + anchors.topMargin: 23 color: statesComboBox.color ColumnLayout { @@ -151,7 +161,9 @@ Rectangle { color: statesComboBox.colorItem anchors.top: parent.top anchors.left: parent.left - anchors.margins: 5 + anchors.leftMargin: 10 + anchors.topMargin: 5 + font.family: regularFont.name } Image { id: imageItemid @@ -197,15 +209,18 @@ Rectangle { } //Table View RowLayout { - Rectangle { - width: 1 - } + anchors.top: listView.bottom + anchors.topMargin: 4 + anchors.left: parent.left + anchors.leftMargin: 10 Text { id: createStateText width: statesComboBox.width height: statesComboBox.height - font.bold: true + font.family: boldFont.name + color: "#808080" text: qsTr("Create State ...") + font.weight: Font.DemiBold MouseArea { anchors.fill: parent hoverEnabled: true diff --git a/mix/qml/TransactionLog.qml b/mix/qml/TransactionLog.qml index 3bcc6c270..5668c6e05 100644 --- a/mix/qml/TransactionLog.qml +++ b/mix/qml/TransactionLog.qml @@ -9,6 +9,7 @@ Item { property ListModel fullModel: ListModel{} property ListModel transactionModel: ListModel{} property ListModel callModel: ListModel{} + property int selectedStateIndex: statesCombo.selectedIndex ColumnLayout { anchors.fill: parent @@ -45,14 +46,15 @@ Item { projectModel.stateListModel.debugDefaultState(); } } + StatesComboBox { id: statesCombo items: projectModel.stateListModel onSelectCreate: projectModel.stateListModel.addState(); onEditItem: projectModel.stateListModel.editState(item) - colorItem: "black" - colorSelect: "blue" + colorItem: "#808080" + colorSelect: "#4a90e2" color: "white" Connections { target: projectModel.stateListModel diff --git a/mix/qml/img/stop_button2x.png b/mix/qml/img/stop_button2x.png new file mode 100644 index 0000000000000000000000000000000000000000..1727b729a391be03065cecb0146a086d9c34ceb4 GIT binary patch literal 235 zcmeAS@N?(olHy`uVBq!ia0vp^c|aV)!3HGzUpB-7DYhhUcNd2LAh=-f^2tCE&H|6f zVg?3oVGw3ym^DWND9B#o>FdgVpM{CTifz*yho?ZH3QrfukcwMxFER2mC~z=1ny3n9 zuGAISzMIKl9tTh!3L5gVe>Kglj61h})kO1Kb>ICDakdw5sLLEuoKwI-h;>L2tPW-t ai2kzU%1ag>C*>4l5YN-q&t;ucLK6TB13`2E literal 0 HcmV?d00001 diff --git a/mix/res.qrc b/mix/res.qrc index 24bbc3830..0149b96e4 100644 --- a/mix/res.qrc +++ b/mix/res.qrc @@ -62,5 +62,6 @@ qml/img/copyicon.png qml/img/copyiconactive.png qml/img/searchicon.png + qml/img/stop_button2x.png From 8781061b1fd7a16254d2e7e3d65d8f83fd38e3de Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Thu, 2 Apr 2015 14:20:33 +0200 Subject: [PATCH 11/12] fix max stack size 1024 --- libevm/VM.h | 2 +- test/stMemoryTestFiller.json | 114 +++++++++++++++++++++++++++++++++-- 2 files changed, 109 insertions(+), 7 deletions(-) diff --git a/libevm/VM.h b/libevm/VM.h index b14a117df..1cf06b78b 100644 --- a/libevm/VM.h +++ b/libevm/VM.h @@ -56,7 +56,7 @@ public: virtual bytesConstRef go(ExtVMFace& _ext, OnOpFunc const& _onOp = {}, uint64_t _steps = (uint64_t)-1) override final; - void require(u256 _n, u256 _d) { if (m_stack.size() < _n) { if (m_onFail) m_onFail(); BOOST_THROW_EXCEPTION(StackUnderflow() << RequirementError((bigint)_n, (bigint)m_stack.size())); } if (m_stack.size() - _n + _d >= c_stackLimit) { if (m_onFail) m_onFail(); BOOST_THROW_EXCEPTION(OutOfStack() << RequirementError((bigint)(_d - _n), (bigint)m_stack.size())); } } + void require(u256 _n, u256 _d) { if (m_stack.size() < _n) { if (m_onFail) m_onFail(); BOOST_THROW_EXCEPTION(StackUnderflow() << RequirementError((bigint)_n, (bigint)m_stack.size())); } if (m_stack.size() - _n + _d > c_stackLimit) { if (m_onFail) m_onFail(); BOOST_THROW_EXCEPTION(OutOfStack() << RequirementError((bigint)(_d - _n), (bigint)m_stack.size())); } } void requireMem(unsigned _n) { if (m_temp.size() < _n) { m_temp.resize(_n); } } u256 curPC() const { return m_curPC; } diff --git a/test/stMemoryTestFiller.json b/test/stMemoryTestFiller.json index c1754d52f..23f52b657 100644 --- a/test/stMemoryTestFiller.json +++ b/test/stMemoryTestFiller.json @@ -1461,7 +1461,7 @@ } }, - "stackLimitPush32_1024": { + "stackLimitPush32_1023": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", @@ -1495,7 +1495,7 @@ } }, - "stackLimitPush32_1025": { + "stackLimitPush32_1024": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", @@ -1529,7 +1529,41 @@ } }, - "stackLimitPush31_1024": { + "stackLimitPush32_1025": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "42949672960", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "(asm 1023 0x00 MSTORE JUMPDEST 0x0102030405060708090a0102030405060708090a0102030405060708090a0102 0x01 0x00 MLOAD SUB 0x00 MSTORE 0x00 MLOAD 0x06 JUMPI STOP )", + "storage": {} + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "429496729600", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "100000", + "to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "value" : "10", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + + "stackLimitPush31_1023": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", @@ -1563,7 +1597,7 @@ } }, - "stackLimitPush31_1025": { + "stackLimitPush31_1024": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", @@ -1597,7 +1631,41 @@ } }, - "stackLimitGas_1024": { + "stackLimitPush31_1025": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "42949672960", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "(asm 1023 0x00 MSTORE JUMPDEST 0x0102030405060708090a0102030405060708090a0102030405060708090a01 0x01 0x00 MLOAD SUB 0x00 MSTORE 0x00 MLOAD 0x06 JUMPI STOP )", + "storage": {} + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "429496729600", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "100000", + "to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "value" : "10", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + + "stackLimitGas_1023": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", @@ -1631,7 +1699,7 @@ } }, - "stackLimitGas_1025": { + "stackLimitGas_1024": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", @@ -1665,6 +1733,40 @@ } }, + "stackLimitGas_1025": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "42949672960", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "(asm 1023 0x00 MSTORE JUMPDEST GAS 0x01 0x00 MLOAD SUB 0x00 MSTORE 0x00 MLOAD 0x06 JUMPI STOP )", + "storage": {} + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "429496729600", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "100000", + "to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "value" : "10", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + "mstroe8_dejavu": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", From 6485fa07590c2a4bb70ec4d2ad03566ef9540a7e Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 2 Apr 2015 16:03:05 +0200 Subject: [PATCH 12/12] PV bump to 60. --- libethcore/Common.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libethcore/Common.cpp b/libethcore/Common.cpp index d3ecbcc5f..ef4da1dd7 100644 --- a/libethcore/Common.cpp +++ b/libethcore/Common.cpp @@ -34,7 +34,7 @@ namespace eth { const unsigned c_ethashVersion = c_ethashRevision; -const unsigned c_protocolVersion = 59; +const unsigned c_protocolVersion = 60; const unsigned c_databaseBaseVersion = 8; #if ETH_FATDB const unsigned c_databaseVersionModifier = 1;