diff --git a/mix/qml.qrc b/mix/qml.qrc
index bed954741..5ceaaced6 100644
--- a/mix/qml.qrc
+++ b/mix/qml.qrc
@@ -61,5 +61,6 @@
qml/js/TransactionHelper.js
qml/main.qml
qml/qmldir
+ qml/StatesComboBox.qml
diff --git a/mix/qml/Debugger.qml b/mix/qml/Debugger.qml
index 358750b24..9ab2f03a4 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
new file mode 100644
index 000000000..34567d083
--- /dev/null
+++ b/mix/qml/StatesComboBox.qml
@@ -0,0 +1,245 @@
+/*
+ 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
+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))
+ }
+ }
+}
diff --git a/mix/qml/TransactionLog.qml b/mix/qml/TransactionLog.qml
index 43736a89a..3bcc6c270 100644
--- a/mix/qml/TransactionLog.qml
+++ b/mix/qml/TransactionLog.qml
@@ -6,30 +6,15 @@ 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{}
- 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);
- }
-
ColumnLayout {
anchors.fill: parent
RowLayout {
-
+ anchors.right: parent.right
+ anchors.left: parent.left
Connections
{
id: compilationStatus
@@ -60,37 +45,24 @@ Item {
projectModel.stateListModel.debugDefaultState();
}
}
-
- ComboBox {
+ StatesComboBox
+ {
id: statesCombo
- model: projectModel.stateListModel
- width: 150
- editable: false
- textRole: "title"
- onActivated: {
- model.runState(index);
- }
+ 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.currentIndex !== index)
- statesCombo.currentIndex = index;
+ if (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
@@ -163,16 +135,11 @@ Item {
Keys.onPressed: {
if ((event.modifiers & Qt.ControlModifier) && event.key === Qt.Key_C && currentRow >=0 && currentRow < logTable.model.count) {
var item = logTable.model.get(currentRow);
- clipboard.text = item.returned;
+ appContext.toClipboard(item.returned);
}
}
}
- Rectangle {
- height: 6
- color: "transparent"
- }
}
-
Connections {
target: clientModel
onStateCleared: {
diff --git a/mix/qml/img/edit_combox.png b/mix/qml/img/edit_combox.png
new file mode 100644
index 000000000..be3b35942
Binary files /dev/null and b/mix/qml/img/edit_combox.png differ
diff --git a/mix/qml/img/pause_button.png b/mix/qml/img/pause_button.png
new file mode 100755
index 000000000..e87889551
Binary files /dev/null and b/mix/qml/img/pause_button.png differ
diff --git a/mix/qml/img/pause_button2x.png b/mix/qml/img/pause_button2x.png
new file mode 100755
index 000000000..6f45b3236
Binary files /dev/null and b/mix/qml/img/pause_button2x.png differ
diff --git a/mix/qml/img/play_button.png b/mix/qml/img/play_button.png
new file mode 100755
index 000000000..01a5c85cb
Binary files /dev/null and b/mix/qml/img/play_button.png differ
diff --git a/mix/qml/img/play_button2x.png b/mix/qml/img/play_button2x.png
new file mode 100755
index 000000000..24eaa0659
Binary files /dev/null and b/mix/qml/img/play_button2x.png differ
diff --git a/mix/res.qrc b/mix/res.qrc
index 3a4254791..a7cf79fa4 100644
--- a/mix/res.qrc
+++ b/mix/res.qrc
@@ -48,10 +48,15 @@
qml/img/projecticon.png
qml/img/run.png
qml/img/search_filled.png
+ qml/img/play_button2x.png
+ qml/img/play_button.png
+ qml/img/pause_button2x.png
+ qml/img/pause_button.png
res/mix_256x256x32.png
stdc/config.sol
stdc/namereg.sol
stdc/std.sol
+ qml/img/edit_combox.png
qml/img/clearicon.png
qml/img/cleariconactive.png
qml/img/copyicon.png