From 9d5c75aabe50e4fb93f7ac910c8efaee573f86f9 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 30 Mar 2015 16:46:14 +0200 Subject: [PATCH 01/18] Redesign of logs pane --- mix/qml/LogsPane.qml | 221 +++++++++++++++++++------------------- mix/qml/LogsPaneStyle.qml | 8 +- mix/qml/StatusPane.qml | 47 +++----- 3 files changed, 130 insertions(+), 146 deletions(-) diff --git a/mix/qml/LogsPane.qml b/mix/qml/LogsPane.qml index b40dfc4c7..73c56d4e9 100644 --- a/mix/qml/LogsPane.qml +++ b/mix/qml/LogsPane.qml @@ -10,19 +10,124 @@ Rectangle function push(_level, _type, _content) { _content = _content.replace(/\n/g, " ") - logsModel.insert(0, { "type": _type, "date": Qt.formatDateTime(new Date(), "hh:mm:ss dd.MM.yyyy"), "content": _content, "level": _level }); + logsModel.insert(0, { "type": _type, "date": Qt.formatDateTime(new Date(), "hh:mm:ss"), "content": _content, "level": _level }); } anchors.fill: parent radius: 5 color: LogsPaneStyle.generic.layout.backgroundColor - border.color: LogsPaneStyle.generic.layout.borderColor - border.width: LogsPaneStyle.generic.layout.borderWidth ColumnLayout { z: 2 height: parent.height width: parent.width spacing: 0 + + ListModel { + id: logsModel + } + + TableView { + id: logsTable + clip: true + Layout.fillWidth: true + Layout.preferredHeight: parent.height - rowAction.height + headerVisible : false + onDoubleClicked: + { + var log = logsModel.get(logsTable.currentRow); + if (log) + clipboard.text = (log.type + "\t" + log.level + "\t" + log.date + "\t" + log.content); + } + + model: SortFilterProxyModel { + id: proxyModel + source: logsModel + property var roles: ["-", "javascript", "run", "state"] + + Component.onCompleted: { + filterType = regEx(proxyModel.roles); + } + + function search(_value) + { + filterContent = _value; + } + + function toogleFilter(_value) + { + var count = roles.length; + for (var i in roles) + { + if (roles[i] === _value) + { + roles.splice(i, 1); + break; + } + } + if (count === roles.length) + roles.push(_value); + + filterType = regEx(proxyModel.roles); + } + + function regEx(_value) + { + return "(?:" + roles.join('|') + ")"; + } + + filterType: "(?:javascript|run|state)" + filterContent: "" + filterSyntax: SortFilterProxyModel.RegExp + filterCaseSensitivity: Qt.CaseInsensitive + } + TableViewColumn + { + role: "date" + title: qsTr("date") + width: LogsPaneStyle.generic.layout.dateWidth + delegate: itemDelegate + } + TableViewColumn + { + role: "type" + title: qsTr("type") + width: LogsPaneStyle.generic.layout.typeWidth + delegate: itemDelegate + } + TableViewColumn + { + role: "content" + title: qsTr("content") + width: LogsPaneStyle.generic.layout.contentWidth + delegate: itemDelegate + } + + rowDelegate: Item { + Rectangle { + width: logsTable.width - 4 + height: 17 + color: styleData.alternate ? "transparent" : LogsPaneStyle.generic.layout.logAlternateColor + } + } + } + + Component { + id: itemDelegate + DefaultLabel { + text: styleData.value; + font.family: LogsPaneStyle.generic.layout.logLabelFont + font.pointSize: Style.absoluteSize(-1) + color: { + if (proxyModel.get(styleData.row).level === "error") + return "red"; + else if (proxyModel.get(styleData.row).level === "warning") + return "orange"; + else + return "#808080"; + } + } + } + Row { id: rowAction @@ -178,7 +283,7 @@ Rectangle } } - DefaultTextField + /*DefaultTextField { id: searchBox height: LogsPaneStyle.generic.layout.headerButtonHeight @@ -190,113 +295,7 @@ Rectangle onTextChanged: { proxyModel.search(text); } - } - } - - ListModel { - id: logsModel - } - - TableView { - id: logsTable - clip: true - Layout.fillWidth: true - Layout.preferredHeight: parent.height - rowAction.height - headerVisible : false - onDoubleClicked: - { - var log = logsModel.get(logsTable.currentRow); - if (log) - clipboard.text = (log.type + "\t" + log.level + "\t" + log.date + "\t" + log.content); - } - - model: SortFilterProxyModel { - id: proxyModel - source: logsModel - property var roles: ["-", "javascript", "run", "state"] - - Component.onCompleted: { - filterType = regEx(proxyModel.roles); - } - - function search(_value) - { - filterContent = _value; - } - - function toogleFilter(_value) - { - var count = roles.length; - for (var i in roles) - { - if (roles[i] === _value) - { - roles.splice(i, 1); - break; - } - } - if (count === roles.length) - roles.push(_value); - - filterType = regEx(proxyModel.roles); - } - - function regEx(_value) - { - return "(?:" + roles.join('|') + ")"; - } - - filterType: "(?:javascript|run|state)" - filterContent: "" - filterSyntax: SortFilterProxyModel.RegExp - filterCaseSensitivity: Qt.CaseInsensitive - } - TableViewColumn - { - role: "date" - title: qsTr("date") - width: LogsPaneStyle.generic.layout.dateWidth - delegate: itemDelegate - } - TableViewColumn - { - role: "type" - title: qsTr("type") - width: LogsPaneStyle.generic.layout.typeWidth - delegate: itemDelegate - } - TableViewColumn - { - role: "content" - title: qsTr("content") - width: LogsPaneStyle.generic.layout.contentWidth - delegate: itemDelegate - } - - rowDelegate: Item { - Rectangle { - width: logsTable.width - 4 - height: 17 - color: styleData.alternate ? "transparent" : LogsPaneStyle.generic.layout.logAlternateColor - } - } - } - - Component { - id: itemDelegate - DefaultLabel { - text: styleData.value; - font.family: LogsPaneStyle.generic.layout.logLabelFont - font.pointSize: Style.absoluteSize(-1) - color: { - if (proxyModel.get(styleData.row).level === "error") - return "red"; - else if (proxyModel.get(styleData.row).level === "warning") - return "orange"; - else - return "#808080"; - } - } + }*/ } } } diff --git a/mix/qml/LogsPaneStyle.qml b/mix/qml/LogsPaneStyle.qml index 59b80653a..1c5e2f4f5 100644 --- a/mix/qml/LogsPaneStyle.qml +++ b/mix/qml/LogsPaneStyle.qml @@ -11,8 +11,6 @@ QtObject { property QtObject generic: QtObject { property QtObject layout: QtObject { property string backgroundColor: "#f7f7f7" - property string borderColor: "#5391d8" - property int borderWidth: 1 property int headerHeight: 35 property int headerButtonSpacing: 5 property int leftMargin: 10 @@ -20,9 +18,9 @@ QtObject { property string logLabelColor: "#5391d8" property string logLabelFont: "sans serif" property int headerInputWidth: 200 - property int dateWidth: 150 - property int typeWidth: 80 - property int contentWidth: 700 + property int dateWidth: 70 + property int typeWidth: 70 + property int contentWidth: 250 property string logAlternateColor: "#f0f0f0" } } diff --git a/mix/qml/StatusPane.qml b/mix/qml/StatusPane.qml index 6d4b5e7e1..151688cea 100644 --- a/mix/qml/StatusPane.qml +++ b/mix/qml/StatusPane.qml @@ -91,6 +91,7 @@ Rectangle { return formatted; } } + Connections { target:projectModel onDeploymentStarted: infoMessage(qsTr("Running deployment..."), "Deployment"); @@ -112,28 +113,9 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter radius: 3 - width: 500 + width: 650 height: 30 color: "#fcfbfc" - states: [ - State { - name: "logsOpened" - PropertyChanges { - target: statusContainer - border.color: "#5391d8" - border.width: 1 - } - }, - State { - name: "logsClosed" - PropertyChanges { - target: statusContainer - border.color: "#5391d8" - border.width: 0 - } - } - ] - Text { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter @@ -215,40 +197,45 @@ Rectangle { function toggle() { if (logsContainer.state === "opened") - { - statusContainer.state = "logsClosed"; logsContainer.state = "closed" - } else { - statusContainer.state = "logsOpened"; logsContainer.state = "opened"; logsContainer.focus = true; + calCoord(); forceActiveFocus(); } } id: logsContainer - width: 1000 - height: 0 + width: 650 + //height: 0 anchors.topMargin: 10 anchors.top: statusContainer.bottom + //anchors.left: statusContainer.left anchors.horizontalCenter: parent.horizontalCenter visible: false radius: 5 Component.onCompleted: + { + calCoord(); + } + + function calCoord() { var top = logsContainer; while (top.parent) top = top.parent - var coordinates = logsContainer.mapToItem(top, 0, 0) + var coordinates = logsContainer.mapToItem(top, 0, 0); logsContainer.parent = top; - logsContainer.x = coordinates.x - logsContainer.y = coordinates.y + //logsContainer.x = coordinates.x + 150; + logsContainer.y = coordinates.y; + console.log(logsContainer.x); } + LogsPane { - id: logPane + id: logPane; } states: [ State { From bcb76ac2a7593d93311fdbb5968a62938b45ca28 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 31 Mar 2015 16:56:02 +0200 Subject: [PATCH 02/18] logs window redesign --- mix/qml/LogsPane.qml | 395 +++++++++++++++++++++++--------- mix/qml/LogsPaneStyle.qml | 10 +- mix/qml/StatusPane.qml | 13 +- mix/qml/img/broom.png | Bin 501 -> 0 bytes mix/qml/img/clearicon.png | Bin 0 -> 2032 bytes mix/qml/img/cleariconactive.png | Bin 0 -> 2187 bytes mix/qml/img/copyicon.png | Bin 0 -> 871 bytes mix/qml/img/copyiconactive.png | Bin 0 -> 875 bytes mix/res.qrc | 5 +- 9 files changed, 295 insertions(+), 128 deletions(-) delete mode 100644 mix/qml/img/broom.png create mode 100644 mix/qml/img/clearicon.png create mode 100644 mix/qml/img/cleariconactive.png create mode 100644 mix/qml/img/copyicon.png create mode 100644 mix/qml/img/copyiconactive.png diff --git a/mix/qml/LogsPane.qml b/mix/qml/LogsPane.qml index 1d832c21a..739ebc674 100644 --- a/mix/qml/LogsPane.qml +++ b/mix/qml/LogsPane.qml @@ -15,10 +15,11 @@ Rectangle anchors.fill: parent radius: 5 - color: LogsPaneStyle.generic.layout.backgroundColor - ColumnLayout { + color: "transparent" + id: logsPane + Column { z: 2 - height: parent.height + height: parent.height - rowAction.height width: parent.width spacing: 0 @@ -26,91 +27,129 @@ Rectangle id: logsModel } - TableView { - id: logsTable - clip: true - Layout.fillWidth: true - Layout.preferredHeight: parent.height - rowAction.height - headerVisible : false - onDoubleClicked: + ScrollView + { + id: scrollView + height: parent.height + width: parent.width + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + ColumnLayout { - var log = logsModel.get(logsTable.currentRow); - if (log) - clipboard.text = (log.type + "\t" + log.level + "\t" + log.date + "\t" + log.content); - } + id: logsRect + spacing: 0 + Repeater { + clip: true + model: SortFilterProxyModel { + id: proxyModel + source: logsModel + property var roles: ["-", "javascript", "run", "state"] - model: SortFilterProxyModel { - id: proxyModel - source: logsModel - property var roles: ["-", "javascript", "run", "state"] + Component.onCompleted: { + filterType = regEx(proxyModel.roles); + } - Component.onCompleted: { - filterType = regEx(proxyModel.roles); - } + function search(_value) + { + filterContent = _value; + } - function search(_value) - { - filterContent = _value; - } + function toogleFilter(_value) + { + var count = roles.length; + for (var i in roles) + { + if (roles[i] === _value) + { + roles.splice(i, 1); + break; + } + } + if (count === roles.length) + roles.push(_value); - function toogleFilter(_value) - { - var count = roles.length; - for (var i in roles) - { - if (roles[i] === _value) + filterType = regEx(proxyModel.roles); + } + + function regEx(_value) { - roles.splice(i, 1); - break; + return "(?:" + roles.join('|') + ")"; } + + filterType: "(?:javascript|run|state)" + filterContent: "" + filterSyntax: SortFilterProxyModel.RegExp + filterCaseSensitivity: Qt.CaseInsensitive } - if (count === roles.length) - roles.push(_value); - filterType = regEx(proxyModel.roles); - } + Rectangle + { + width: 750 + height: 30 + color: + { + if (level === "warning" || level === "error") + return "#fffcd5"; + else + return index % 2 === 0 ? "transparent" : LogsPaneStyle.generic.layout.logAlternateColor; + } - function regEx(_value) - { - return "(?:" + roles.join('|') + ")"; - } - filterType: "(?:javascript|run|state)" - filterContent: "" - filterSyntax: SortFilterProxyModel.RegExp - filterCaseSensitivity: Qt.CaseInsensitive - } - TableViewColumn - { - role: "date" - title: qsTr("date") - width: LogsPaneStyle.generic.layout.dateWidth - delegate: itemDelegate - } - TableViewColumn - { - role: "type" - title: qsTr("type") - width: LogsPaneStyle.generic.layout.typeWidth - delegate: itemDelegate - } - TableViewColumn - { - role: "content" - title: qsTr("content") - width: LogsPaneStyle.generic.layout.contentWidth - delegate: itemDelegate - } + DefaultLabel { + text: date; + font.family: LogsPaneStyle.generic.layout.logLabelFont + width: LogsPaneStyle.generic.layout.dateWidth + font.pointSize: Style.absoluteSize(-1) + anchors.left: parent.left + anchors.leftMargin: 15 + anchors.verticalCenter: parent.verticalCenter + color: { + parent.getColor(level); + } + } - rowDelegate: Item { - Rectangle { - width: logsTable.width - 4 - height: 17 - color: styleData.alternate ? "transparent" : LogsPaneStyle.generic.layout.logAlternateColor + DefaultLabel { + text: type; + font.family: LogsPaneStyle.generic.layout.logLabelFont + width: LogsPaneStyle.generic.layout.typeWidth + font.pointSize: Style.absoluteSize(-1) + anchors.left: parent.left + anchors.leftMargin: 100 + anchors.verticalCenter: parent.verticalCenter + color: { + parent.getColor(level); + } + } + + DefaultLabel { + text: content; + font.family: LogsPaneStyle.generic.layout.logLabelFont + width: LogsPaneStyle.generic.layout.contentWidth + font.pointSize: Style.absoluteSize(-1) + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 190 + color: { + parent.getColor(level); + } + } + + function getColor() + { + if (level === "error") + return "red"; + else if (level === "warning") + return "orange"; + else + return "#808080"; + } + } } } + + } + Component { id: itemDelegate DefaultLabel { @@ -128,58 +167,43 @@ Rectangle } } + } + + Rectangle + { + gradient: Gradient { + GradientStop { position: 0.0; color: "#f1f1f1" } + GradientStop { position: 1.0; color: "#d9d7da" } + } + Layout.preferredHeight: LogsPaneStyle.generic.layout.headerHeight + height: LogsPaneStyle.generic.layout.headerHeight + width: logsPane.width + anchors.bottom: parent.bottom Row { id: rowAction - Layout.preferredHeight: LogsPaneStyle.generic.layout.headerHeight - height: LogsPaneStyle.generic.layout.headerHeight anchors.leftMargin: LogsPaneStyle.generic.layout.leftMargin anchors.left: parent.left spacing: LogsPaneStyle.generic.layout.headerButtonSpacing - Button - { - height: LogsPaneStyle.generic.layout.headerButtonHeight - anchors.verticalCenter: parent.verticalCenter - action: clearAction - iconSource: "qrc:/qml/img/broom.png" - } - - Action { - id: clearAction - enabled: logsModel.count > 0 - tooltip: qsTr("Clear") - onTriggered: { - logsModel.clear() - } - } - - Button + height: parent.height + Rectangle { - height: LogsPaneStyle.generic.layout.headerButtonHeight + color: "transparent" + height: 20 + width: 50 anchors.verticalCenter: parent.verticalCenter - action: copytoClipBoardAction - iconSource: "qrc:/qml/img/copy.png" - } - - Action { - id: copytoClipBoardAction - enabled: logsModel.count > 0 - tooltip: qsTr("Copy to Clipboard") - onTriggered: { - var content = ""; - for (var k = 0; k < logsModel.count; k++) - { - var log = logsModel.get(k); - content += log.type + "\t" + log.level + "\t" + log.date + "\t" + log.content + "\n"; - } - clipboard.text = content; + DefaultLabel + { + color: "#808080" + font.family: LogsPaneStyle.generic.layout.logLabelFont + text: qsTr("Show:") } } Rectangle { anchors.verticalCenter: parent.verticalCenter width: 1; - height: parent.height - 10 + height: parent.height color : "#808080" } @@ -187,6 +211,7 @@ Rectangle id: javascriptButton checkable: true height: LogsPaneStyle.generic.layout.headerButtonHeight + width: 20 anchors.verticalCenter: parent.verticalCenter checked: true onCheckedChanged: { @@ -202,16 +227,28 @@ Rectangle font.pointSize: Style.absoluteSize(-3) color: LogsPaneStyle.generic.layout.logLabelColor anchors.centerIn: parent - text: qsTr("JavaScript") + text: qsTr("JS") } } + background: + Rectangle { + color: javascriptButton.checked ? "#cfcfcf" : "transparent" + } } } + Rectangle { + anchors.verticalCenter: parent.verticalCenter + width: 1; + height: parent.height + color : "#808080" + } + ToolButton { id: runButton checkable: true height: LogsPaneStyle.generic.layout.headerButtonHeight + width: 30 anchors.verticalCenter: parent.verticalCenter checked: true onCheckedChanged: { @@ -230,14 +267,26 @@ Rectangle text: qsTr("Run") } } + background: + Rectangle { + color: runButton.checked ? "#cfcfcf" : "transparent" + } } } + Rectangle { + anchors.verticalCenter: parent.verticalCenter + width: 1; + height: parent.height + color : "#808080" + } + ToolButton { id: stateButton checkable: true height: LogsPaneStyle.generic.layout.headerButtonHeight anchors.verticalCenter: parent.verticalCenter + width: 35 checked: true onCheckedChanged: { proxyModel.toogleFilter("state") @@ -250,26 +299,144 @@ Rectangle DefaultLabel { font.family: LogsPaneStyle.generic.layout.logLabelFont font.pointSize: Style.absoluteSize(-3) - color: "#5391d8" + color: LogsPaneStyle.generic.layout.logLabelColor anchors.centerIn: parent text: qsTr("State") } } + background: + Rectangle { + color: stateButton.checked ? "#cfcfcf" : "transparent" + } + } + } + + Rectangle { + anchors.verticalCenter: parent.verticalCenter + width: 1; + height: parent.height + color : "#808080" + } + } + + Row + { + height: parent.height + anchors.right: parent.right + anchors.rightMargin: 4 + spacing: 4 + Button + { + id: clearButton + height: LogsPaneStyle.generic.layout.headerButtonHeight + anchors.verticalCenter: parent.verticalCenter + action: hideAction + iconSource: "qrc:/qml/img/cleariconactive.png" + style: + ButtonStyle { + background: + Rectangle { + height: LogsPaneStyle.generic.layout.headerButtonHeight + implicitHeight: LogsPaneStyle.generic.layout.headerButtonHeight + color: "transparent" + } + } + } + + Image { + id: clearImage + source: "qrc:/qml/img/cleariconactive.png" + anchors.centerIn: parent + fillMode: Image.PreserveAspectFit + width: 30 + height: 30 + } + + Button + { + id: exitButton + height: LogsPaneStyle.generic.layout.headerButtonHeight + anchors.verticalCenter: parent.verticalCenter + action: exitAction + iconSource: "qrc:/qml/img/exit.png" + style: + ButtonStyle { + background: + Rectangle { + height: LogsPaneStyle.generic.layout.headerButtonHeight + color: "transparent" + } + } + } + + Button + { + id: copyButton + height: LogsPaneStyle.generic.layout.headerButtonHeight + anchors.verticalCenter: parent.verticalCenter + action: copytoClipBoardAction + iconSource: "qrc:/qml/img/copyiconactive.png" + style: + ButtonStyle { + background: + Rectangle { + height: LogsPaneStyle.generic.layout.headerButtonHeight + color: "transparent" + } + } + } + + Action { + id: clearAction + tooltip: qsTr("Hide") + onTriggered: { + logsPane.parent.toggle(); + } + } + + Action { + id: hideAction + enabled: logsModel.count > 0 + tooltip: qsTr("Clear") + onTriggered: { + logsModel.clear() + } + } + + Action { + id: copytoClipBoardAction + enabled: logsModel.count > 0 + tooltip: qsTr("Copy to Clipboard") + onTriggered: { + var content = ""; + for (var k = 0; k < logsModel.count; k++) + { + var log = logsModel.get(k); + content += log.type + "\t" + log.level + "\t" + log.date + "\t" + log.content + "\n"; + } + clipboard.text = content; } } DefaultTextField { id: searchBox - height: LogsPaneStyle.generic.layout.headerButtonHeight + height: LogsPaneStyle.generic.layout.headerButtonHeight - 5 anchors.verticalCenter: parent.verticalCenter - width: LogsPaneStyle.generic.layout.headerInputWidth + width: LogsPaneStyle.generic.layout.headerInputWidth - 40 font.family: LogsPaneStyle.generic.layout.logLabelFont font.pointSize: Style.absoluteSize(-3) font.italic: true + text: qsTr("Search") onTextChanged: { proxyModel.search(text); } + style: + TextFieldStyle { + background: Rectangle { + radius: 10 + } + } } } } diff --git a/mix/qml/LogsPaneStyle.qml b/mix/qml/LogsPaneStyle.qml index 1c5e2f4f5..17d30ff6c 100644 --- a/mix/qml/LogsPaneStyle.qml +++ b/mix/qml/LogsPaneStyle.qml @@ -11,17 +11,17 @@ QtObject { property QtObject generic: QtObject { property QtObject layout: QtObject { property string backgroundColor: "#f7f7f7" - property int headerHeight: 35 - property int headerButtonSpacing: 5 + property int headerHeight: 30 + property int headerButtonSpacing: 1 property int leftMargin: 10 property int headerButtonHeight: 30 - property string logLabelColor: "#5391d8" + property string logLabelColor: "#808080" property string logLabelFont: "sans serif" property int headerInputWidth: 200 property int dateWidth: 70 - property int typeWidth: 70 + property int typeWidth: 90 property int contentWidth: 250 - property string logAlternateColor: "#f0f0f0" + property string logAlternateColor: "#f6f5f6" } } } diff --git a/mix/qml/StatusPane.qml b/mix/qml/StatusPane.qml index e097c866b..b42b13fef 100644 --- a/mix/qml/StatusPane.qml +++ b/mix/qml/StatusPane.qml @@ -45,7 +45,7 @@ Rectangle { function errorMessage(text, type) { status.state = "error"; - status.text = text + status.text = text; logPane.push("error", type, text); } @@ -76,7 +76,7 @@ Rectangle { function format(_message) { var formatted = _message.match(/(?:)/); - if (formatted) + if (!formatted) formatted = _message.match(/(?:)/); if (formatted && formatted.length > 1) formatted = formatted[1]; @@ -207,11 +207,9 @@ Rectangle { } id: logsContainer - width: 650 - //height: 0 - anchors.topMargin: 10 + width: 750 + anchors.topMargin: -30 anchors.top: statusContainer.bottom - //anchors.left: statusContainer.left anchors.horizontalCenter: parent.horizontalCenter visible: false radius: 5 @@ -227,9 +225,8 @@ Rectangle { top = top.parent var coordinates = logsContainer.mapToItem(top, 0, 0); logsContainer.parent = top; - //logsContainer.x = coordinates.x + 150; + logsContainer.x = coordinates.x + 150; logsContainer.y = coordinates.y; - console.log(logsContainer.x); } LogsPane diff --git a/mix/qml/img/broom.png b/mix/qml/img/broom.png deleted file mode 100644 index 76a9a0e0c90f9e671c3bbe3708f610c4a67f6383..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 501 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 literal 0 HcmV?d00001 diff --git a/mix/qml/img/copyiconactive.png b/mix/qml/img/copyiconactive.png new file mode 100644 index 0000000000000000000000000000000000000000..387d7f1fa62de3d8c41537c20f31479c09aa6ec5 GIT binary patch literal 875 zcmV-x1C;!UP)Px&B}qge5o6l<#K@`W|+k`Yl54{u-p=s2M9tvK(6+8%S>Ou4%h!+u0g3{!o zUbG-$Q7}RL2fSH(@E{u7i$899^I$JRXawoOixkB|viqD(8k-HfJCoU+-5s)fNOor4 zoA*BRW|RGfEWn5zsFL^8(z|Sa;_x{nxC#i9Qn4&}Rj(B8O8L4tWnKD0>&j0Q%Ld>> z1}lFUaAKj>%)MDG+?JnY&of9Wd$YKoVX4||AmTIuZ3DrUyP2~W0jJmkjT1o|klL)B z?^@7u7|_aqOV_`R;gPW&J6R%nRxcMWcN6!2U8puc0^%%NpdUo$CBV#UMA+B$3Jz`f zhmUu(UMYS6GS9GT|LJCex7hZ65G1Qa1KVI>Lnj_MY-lZj!-UobI4o$bfWv^+4mc>Z zmcT)vwFQ=iRtCI(_GsHcJfAVLa~Z?9ZzrhYaQmJvRX4AA#Zo37RxhB*g1+<$%<5FPF9nw10VYLn@)kiz9wt@l^~0U6ZXU~_v0?WSS$FE?>E89+ zZwAUfr5#aN!|l^FsMH&bA<~Wv*iI%1(2)Ws0XlNvxS?YKjuSdI;JBb;1&#wccHpR? z69F70bYg(Lp#7wt?KA8ldM`cfybgO+QqK`Yun`HcDyb*P=rBvvmUd*OsG+pNs->RH znkWTcs}x?yB-N36z}L1ibC2AXPJv~%iB3Lgg>|ZyOs*qWVWnS7G8ORiIs0Vmc*|;i z^|P_Z2GiYU%{SgI7T0_2!FR1HJdW94zp3?n5MsA&kwxn}+tvze zlZOpx1-yFW;7raPfq5&W`*>Pm-7Cn;Kdmrtg>)ZJE3A73dHJUm z=B<$K<3fLGu^~&f?_ZelOw_;@nDb2itc4Xqml/fonts/SourceSerifPro-Semibold.ttf qml/img/available_updates.png qml/img/b64.png - qml/img/broom.png qml/img/bugiconactive.png qml/img/bugiconinactive.png qml/img/closedtriangleindicator.png @@ -53,5 +52,9 @@ stdc/config.sol stdc/namereg.sol stdc/std.sol + qml/img/clearicon.png + qml/img/cleariconactive.png + qml/img/copyicon.png + qml/img/copyiconactive.png From 323a1aea0e6c81b58b757c95eaf67612c9c9eae9 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 31 Mar 2015 18:15:45 +0200 Subject: [PATCH 03/18] ui changes --- mix/qml/LogsPane.qml | 244 +++++++++++++++++++++++++------------- mix/qml/LogsPaneStyle.qml | 2 +- 2 files changed, 161 insertions(+), 85 deletions(-) diff --git a/mix/qml/LogsPane.qml b/mix/qml/LogsPane.qml index 739ebc674..765f905b1 100644 --- a/mix/qml/LogsPane.qml +++ b/mix/qml/LogsPane.qml @@ -189,12 +189,13 @@ Rectangle Rectangle { color: "transparent" - height: 20 - width: 50 - anchors.verticalCenter: parent.verticalCenter + height: parent.height + width: 40 DefaultLabel { + anchors.verticalCenter: parent.verticalCenter color: "#808080" + font.pointSize: Style.absoluteSize(-3) font.family: LogsPaneStyle.generic.layout.logLabelFont text: qsTr("Show:") } @@ -204,7 +205,7 @@ Rectangle anchors.verticalCenter: parent.verticalCenter width: 1; height: parent.height - color : "#808080" + color : "transparent" } ToolButton { @@ -232,7 +233,7 @@ Rectangle } background: Rectangle { - color: javascriptButton.checked ? "#cfcfcf" : "transparent" + color: javascriptButton.checked ? "#dcdcdc" : "transparent" } } } @@ -241,7 +242,14 @@ Rectangle anchors.verticalCenter: parent.verticalCenter width: 1; height: parent.height - color : "#808080" + color : "#d3d0d0" + } + + Rectangle { + anchors.verticalCenter: parent.verticalCenter + width: 1; + height: parent.height + color : "#f2f1f2" } ToolButton { @@ -269,7 +277,7 @@ Rectangle } background: Rectangle { - color: runButton.checked ? "#cfcfcf" : "transparent" + color: runButton.checked ? "#dcdcdc" : "transparent" } } } @@ -278,7 +286,14 @@ Rectangle anchors.verticalCenter: parent.verticalCenter width: 1; height: parent.height - color : "#808080" + color : "#d3d0d0" + } + + Rectangle { + anchors.verticalCenter: parent.verticalCenter + width: 1; + height: parent.height + color : "#f2f1f2" } ToolButton { @@ -306,7 +321,7 @@ Rectangle } background: Rectangle { - color: stateButton.checked ? "#cfcfcf" : "transparent" + color: stateButton.checked ? "#dcdcdc" : "transparent" } } } @@ -315,7 +330,14 @@ Rectangle anchors.verticalCenter: parent.verticalCenter width: 1; height: parent.height - color : "#808080" + color : "#d3d0d0" + } + + Rectangle { + anchors.verticalCenter: parent.verticalCenter + width: 1; + height: parent.height + color : "#f2f1f2" } } @@ -323,98 +345,97 @@ Rectangle { height: parent.height anchors.right: parent.right - anchors.rightMargin: 4 - spacing: 4 - Button + anchors.rightMargin: 10 + spacing: 10 + Rectangle { - id: clearButton height: LogsPaneStyle.generic.layout.headerButtonHeight anchors.verticalCenter: parent.verticalCenter - action: hideAction - iconSource: "qrc:/qml/img/cleariconactive.png" - style: - ButtonStyle { - background: - Rectangle { - height: LogsPaneStyle.generic.layout.headerButtonHeight - implicitHeight: LogsPaneStyle.generic.layout.headerButtonHeight - color: "transparent" + color: "transparent" + width: 20 + Button + { + id: clearButton + action: clearAction + anchors.fill: parent + anchors.verticalCenter: parent.verticalCenter + height: 25 + style: + ButtonStyle { + background: + Rectangle { + height: LogsPaneStyle.generic.layout.headerButtonHeight + implicitHeight: LogsPaneStyle.generic.layout.headerButtonHeight + color: "transparent" + } } } - } - Image { - id: clearImage - source: "qrc:/qml/img/cleariconactive.png" - anchors.centerIn: parent - fillMode: Image.PreserveAspectFit - width: 30 - height: 30 - } + Image { + id: clearImage + source: "qrc:/qml/img/cleariconactive.png" + anchors.centerIn: parent + fillMode: Image.PreserveAspectFit + width: 20 + height: 20 + } - Button - { - id: exitButton - height: LogsPaneStyle.generic.layout.headerButtonHeight - anchors.verticalCenter: parent.verticalCenter - action: exitAction - iconSource: "qrc:/qml/img/exit.png" - style: - ButtonStyle { - background: - Rectangle { - height: LogsPaneStyle.generic.layout.headerButtonHeight - color: "transparent" + Action { + id: clearAction + enabled: logsModel.count > 0 + tooltip: qsTr("Clear") + onTriggered: { + logsModel.clear(); } } } - Button + Rectangle { - id: copyButton height: LogsPaneStyle.generic.layout.headerButtonHeight anchors.verticalCenter: parent.verticalCenter - action: copytoClipBoardAction - iconSource: "qrc:/qml/img/copyiconactive.png" - style: - ButtonStyle { - background: - Rectangle { - height: LogsPaneStyle.generic.layout.headerButtonHeight - color: "transparent" + color: "transparent" + width: 20 + Button + { + id: copyButton + action: copyAction + anchors.fill: parent + anchors.verticalCenter: parent.verticalCenter + height: 25 + style: + ButtonStyle { + background: + Rectangle { + height: LogsPaneStyle.generic.layout.headerButtonHeight + implicitHeight: LogsPaneStyle.generic.layout.headerButtonHeight + color: "transparent" + } } } - } - - Action { - id: clearAction - tooltip: qsTr("Hide") - onTriggered: { - logsPane.parent.toggle(); - } - } - Action { - id: hideAction - enabled: logsModel.count > 0 - tooltip: qsTr("Clear") - onTriggered: { - logsModel.clear() + Image { + id: copyImage + source: "qrc:/qml/img/copyiconactive.png" + anchors.centerIn: parent + fillMode: Image.PreserveAspectFit + width: 20 + height: 20 } - } - Action { - id: copytoClipBoardAction - enabled: logsModel.count > 0 - tooltip: qsTr("Copy to Clipboard") - onTriggered: { - var content = ""; - for (var k = 0; k < logsModel.count; k++) - { - var log = logsModel.get(k); - content += log.type + "\t" + log.level + "\t" + log.date + "\t" + log.content + "\n"; + Action { + id: copyAction + enabled: logsModel.count > 0 + tooltip: qsTr("Copy to Clipboard") + onTriggered: { + var content = ""; + for (var k = 0; k < logsModel.count; k++) + { + var log = logsModel.get(k); + content += log.type + "\t" + log.level + "\t" + log.date + "\t" + log.content + "\n"; + } + clipboard.text = content; } - clipboard.text = content; } } @@ -427,10 +448,22 @@ Rectangle font.family: LogsPaneStyle.generic.layout.logLabelFont font.pointSize: Style.absoluteSize(-3) font.italic: true - text: qsTr("Search") + text: qsTr(" - Search - ") + onFocusChanged: + { + if (!focus && text === "") + text = qsTr(" - Search - "); + else if (focus && text === qsTr(" - Search - ")) + text = ""; + } + onTextChanged: { - proxyModel.search(text); + if (text === qsTr(" - Search - ")) + proxyModel.search(""); + else + proxyModel.search(text); } + style: TextFieldStyle { background: Rectangle { @@ -438,6 +471,49 @@ Rectangle } } } + + + Rectangle + { + height: LogsPaneStyle.generic.layout.headerButtonHeight + anchors.verticalCenter: parent.verticalCenter + color: "transparent" + width: 20 + Button + { + id: hideButton + action: hideAction + anchors.fill: parent + anchors.verticalCenter: parent.verticalCenter + height: 25 + style: + ButtonStyle { + background: + Rectangle { + height: LogsPaneStyle.generic.layout.headerButtonHeight + implicitHeight: LogsPaneStyle.generic.layout.headerButtonHeight + color: "transparent" + } + } + } + + Image { + id: hideImage + source: "qrc:/qml/img/exit.png" + anchors.centerIn: parent + fillMode: Image.PreserveAspectFit + width: 20 + height: 20 + } + + Action { + id: hideAction + tooltip: qsTr("Exit") + onTriggered: { + logsPane.parent.toggle(); + } + } + } } } } diff --git a/mix/qml/LogsPaneStyle.qml b/mix/qml/LogsPaneStyle.qml index 17d30ff6c..215f17bd7 100644 --- a/mix/qml/LogsPaneStyle.qml +++ b/mix/qml/LogsPaneStyle.qml @@ -12,7 +12,7 @@ QtObject { property QtObject layout: QtObject { property string backgroundColor: "#f7f7f7" property int headerHeight: 30 - property int headerButtonSpacing: 1 + property int headerButtonSpacing: 0 property int leftMargin: 10 property int headerButtonHeight: 30 property string logLabelColor: "#808080" From 3d7b28afb7a5ae740f5025056a4041d64420afcc Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 31 Mar 2015 18:20:31 +0200 Subject: [PATCH 04/18] add disabled clear button and copy button --- mix/qml/LogsPane.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mix/qml/LogsPane.qml b/mix/qml/LogsPane.qml index 765f905b1..21bd9fd96 100644 --- a/mix/qml/LogsPane.qml +++ b/mix/qml/LogsPane.qml @@ -373,7 +373,7 @@ Rectangle Image { id: clearImage - source: "qrc:/qml/img/cleariconactive.png" + source: clearAction.enabled ? "qrc:/qml/img/cleariconactive.png" : "qrc:/qml/img/clearicon.png" anchors.centerIn: parent fillMode: Image.PreserveAspectFit width: 20 @@ -416,7 +416,7 @@ Rectangle Image { id: copyImage - source: "qrc:/qml/img/copyiconactive.png" + source: copyAction.enabled ? "qrc:/qml/img/copyiconactive.png" : "qrc:/qml/img/copyicon.png" anchors.centerIn: parent fillMode: Image.PreserveAspectFit width: 20 From 7bc2251eed74de29862c3cdd37ca24e3840aaaa8 Mon Sep 17 00:00:00 2001 From: arkpar Date: Tue, 31 Mar 2015 18:46:01 +0200 Subject: [PATCH 05/18] debug highlighting filter --- mix/CodeModel.cpp | 22 +++++++++++++++++++--- mix/qml/CodeEditorView.qml | 9 --------- mix/qml/ProjectModel.qml | 1 + mix/qml/WebPreview.qml | 2 +- mix/qml/html/codeeditor.js | 2 -- mix/qml/js/ProjectModel.js | 10 +++++++++- 6 files changed, 30 insertions(+), 16 deletions(-) diff --git a/mix/CodeModel.cpp b/mix/CodeModel.cpp index a96ab8791..3d0f0c749 100644 --- a/mix/CodeModel.cpp +++ b/mix/CodeModel.cpp @@ -93,8 +93,24 @@ private: bool m_functionScope; uint m_storageSlot; }; + +dev::eth::AssemblyItems filterLocations(dev::eth::AssemblyItems const& _locations, dev::solidity::ContractDefinition const& _contract, QHash _functions) +{ + dev::eth::AssemblyItems result; + result.reserve(_locations.size()); + std::string sourceName = *_contract.getLocation().sourceName; + for (dev::eth::AssemblyItem item : _locations) + { + dev::SourceLocation const& l = item.getLocation(); + if (sourceName != *l.sourceName || _contract.getLocation() == l || _functions.contains(LocationPair(l.start, l.end))) + item.setLocation(dev::SourceLocation(-1, -1, l.sourceName)); + result.push_back(item); + } + return result; } +} //namespace + void BackgroundWorker::queueCodeChange(int _jobId) { m_model->runCompilationJob(_jobId); @@ -105,13 +121,11 @@ CompiledContract::CompiledContract(const dev::solidity::CompilerStack& _compiler m_sourceHash(qHash(_source)) { std::string name = _contractName.toStdString(); - auto const& contractDefinition = _compiler.getContractDefinition(name); + ContractDefinition const& contractDefinition = _compiler.getContractDefinition(name); m_contract.reset(new QContractDefinition(nullptr, &contractDefinition)); QQmlEngine::setObjectOwnership(m_contract.get(), QQmlEngine::CppOwnership); m_contract->moveToThread(QApplication::instance()->thread()); m_bytes = _compiler.getBytecode(_contractName.toStdString()); - m_assemblyItems = _compiler.getRuntimeAssemblyItems(name); - m_constructorAssemblyItems = _compiler.getAssemblyItems(name); dev::solidity::InterfaceHandler interfaceHandler; m_contractInterface = QString::fromStdString(*interfaceHandler.getABIInterface(contractDefinition)); @@ -122,6 +136,8 @@ CompiledContract::CompiledContract(const dev::solidity::CompilerStack& _compiler CollectDeclarationsVisitor visitor(&m_functions, &m_locals, &m_storage); contractDefinition.accept(visitor); + m_assemblyItems = filterLocations(_compiler.getRuntimeAssemblyItems(name), contractDefinition, m_functions); + m_constructorAssemblyItems = filterLocations(_compiler.getAssemblyItems(name), contractDefinition, m_functions); } QString CompiledContract::codeHex() const diff --git a/mix/qml/CodeEditorView.qml b/mix/qml/CodeEditorView.qml index 7ea1e30d9..25ecbc98c 100644 --- a/mix/qml/CodeEditorView.qml +++ b/mix/qml/CodeEditorView.qml @@ -11,15 +11,6 @@ Item { signal breakpointsChanged(string documentId) signal isCleanChanged(var isClean, string documentId) - function getDocumentIdByName(fileName) - { - for (var i = 0; i < editorListModel.count; i++) { - if (editorListModel.get(i).fileName === fileName) { - return editorListModel.get(i).documentId; - } - } - return null; - } function getDocumentText(documentId) { for (var i = 0; i < editorListModel.count; i++) { diff --git a/mix/qml/ProjectModel.qml b/mix/qml/ProjectModel.qml index f4b73b601..ec7681f16 100644 --- a/mix/qml/ProjectModel.qml +++ b/mix/qml/ProjectModel.qml @@ -64,6 +64,7 @@ Item { function renameDocument(documentId, newName) { ProjectModelCode.renameDocument(documentId, newName); } function removeDocument(documentId) { ProjectModelCode.removeDocument(documentId); } function getDocument(documentId) { return ProjectModelCode.getDocument(documentId); } + function getDocumentIdByName(documentName) { return ProjectModelCode.getDocumentIdByName(documentName); } function getDocumentIndex(documentId) { return ProjectModelCode.getDocumentIndex(documentId); } function addExistingFiles(paths) { ProjectModelCode.doAddExistingFiles(paths); } function deployProject() { ProjectModelCode.deployProject(false); } diff --git a/mix/qml/WebPreview.qml b/mix/qml/WebPreview.qml index 0bf31b326..768d188cb 100644 --- a/mix/qml/WebPreview.qml +++ b/mix/qml/WebPreview.qml @@ -156,7 +156,7 @@ Item { if (urlPath === "/") urlPath = "/index.html"; var documentName = urlPath.substr(urlPath.lastIndexOf("/") + 1); - var documentId = projectModel.codeEditor.getDocumentIdByName(documentName); + var documentId = projectModel.getDocumentIdByName(documentName); var content = ""; if (projectModel.codeEditor.isDocumentOpen(documentId)) content = projectModel.codeEditor.getDocumentText(documentId); diff --git a/mix/qml/html/codeeditor.js b/mix/qml/html/codeeditor.js index 5d63a7a83..d61d6e51f 100644 --- a/mix/qml/html/codeeditor.js +++ b/mix/qml/html/codeeditor.js @@ -124,8 +124,6 @@ var executionMark; highlightExecution = function(start, end) { if (executionMark) executionMark.clear(); - if (start === 0 && end + 1 === editor.getValue().length) - return; // Do not hightlight the whole document. if (debugWarning) debugWarning.clear(); executionMark = editor.markText(editor.posFromIndex(start), editor.posFromIndex(end), { className: "CodeMirror-exechighlight" }); diff --git a/mix/qml/js/ProjectModel.js b/mix/qml/js/ProjectModel.js index 177115f83..25e8dcb77 100644 --- a/mix/qml/js/ProjectModel.js +++ b/mix/qml/js/ProjectModel.js @@ -172,7 +172,7 @@ function getDocumentIndex(documentId) for (var i = 0; i < projectListModel.count; i++) if (projectListModel.get(i).documentId === documentId) return i; - console.error("Cant find document " + documentId); + console.error("Can't find document " + documentId); return -1; } @@ -291,6 +291,14 @@ function getDocument(documentId) { return projectListModel.get(i); } +function getDocumentIdByName(fileName) +{ + for (var i = 0; i < projectListModel.count; i++) + if (projectListModel.get(i).fileName === fileName) + return projectListModel.get(i).documentId; + return null; +} + function removeDocument(documentId) { var i = getDocumentIndex(documentId); var document = projectListModel.get(i); From d0825c2cd8b97397dfb293b97b61948ec2b2e887 Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 1 Apr 2015 11:03:20 +0200 Subject: [PATCH 06/18] re-enabled debugging into base contracts --- mix/CodeModel.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mix/CodeModel.cpp b/mix/CodeModel.cpp index 3d0f0c749..53ec34e2b 100644 --- a/mix/CodeModel.cpp +++ b/mix/CodeModel.cpp @@ -98,11 +98,10 @@ dev::eth::AssemblyItems filterLocations(dev::eth::AssemblyItems const& _location { dev::eth::AssemblyItems result; result.reserve(_locations.size()); - std::string sourceName = *_contract.getLocation().sourceName; for (dev::eth::AssemblyItem item : _locations) { dev::SourceLocation const& l = item.getLocation(); - if (sourceName != *l.sourceName || _contract.getLocation() == l || _functions.contains(LocationPair(l.start, l.end))) + if (_contract.getLocation() == l || _functions.contains(LocationPair(l.start, l.end))) item.setLocation(dev::SourceLocation(-1, -1, l.sourceName)); result.push_back(item); } From d6cf8492312341bbbd8df0cc80cb1aa74e26b5f5 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 1 Apr 2015 11:48:34 +0200 Subject: [PATCH 07/18] Moved semantic information to its own file. --- libevmcore/CommonSubexpressionEliminator.cpp | 75 +------------ libevmcore/CommonSubexpressionEliminator.h | 17 +-- libevmcore/SemanticInformation.cpp | 107 +++++++++++++++++++ libevmcore/SemanticInformation.h | 50 +++++++++ 4 files changed, 160 insertions(+), 89 deletions(-) create mode 100644 libevmcore/SemanticInformation.cpp create mode 100644 libevmcore/SemanticInformation.h diff --git a/libevmcore/CommonSubexpressionEliminator.cpp b/libevmcore/CommonSubexpressionEliminator.cpp index 47bb5b512..5c6ba95af 100644 --- a/libevmcore/CommonSubexpressionEliminator.cpp +++ b/libevmcore/CommonSubexpressionEliminator.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include using namespace std; using namespace dev; @@ -248,79 +248,6 @@ ExpressionClasses::Id CommonSubexpressionEliminator::loadFromMemory(ExpressionCl return m_memoryContent[_slot] = m_expressionClasses.find(Instruction::MLOAD, {_slot}, true, m_sequenceNumber); } -bool SemanticInformation::breaksBasicBlock(AssemblyItem const& _item) -{ - switch (_item.type()) - { - default: - case UndefinedItem: - case Tag: - return true; - case Push: - case PushString: - case PushTag: - case PushSub: - case PushSubSize: - case PushProgramSize: - case PushData: - return false; - case Operation: - { - if (isSwapInstruction(_item) || isDupInstruction(_item)) - return false; - if (_item.instruction() == Instruction::GAS || _item.instruction() == Instruction::PC) - return true; // GAS and PC assume a specific order of opcodes - if (_item.instruction() == Instruction::MSIZE) - return true; // msize is modified already by memory access, avoid that for now - if (_item.instruction() == Instruction::SHA3) - return true; //@todo: we have to compare sha3's not based on their memory addresses but on the memory content. - InstructionInfo info = instructionInfo(_item.instruction()); - if (_item.instruction() == Instruction::SSTORE) - return false; - if (_item.instruction() == Instruction::MSTORE) - return false; - //@todo: We do not handle the following memory instructions for now: - // calldatacopy, codecopy, extcodecopy, mstore8, - // msize (note that msize also depends on memory read access) - - // the second requirement will be lifted once it is implemented - return info.sideEffects || info.args > 2; - } - } -} - -bool SemanticInformation::isCommutativeOperation(AssemblyItem const& _item) -{ - if (_item.type() != Operation) - return false; - switch (_item.instruction()) - { - case Instruction::ADD: - case Instruction::MUL: - case Instruction::EQ: - case Instruction::AND: - case Instruction::OR: - case Instruction::XOR: - return true; - default: - return false; - } -} - -bool SemanticInformation::isDupInstruction(AssemblyItem const& _item) -{ - if (_item.type() != Operation) - return false; - return Instruction::DUP1 <= _item.instruction() && _item.instruction() <= Instruction::DUP16; -} - -bool SemanticInformation::isSwapInstruction(AssemblyItem const& _item) -{ - if (_item.type() != Operation) - return false; - return Instruction::SWAP1 <= _item.instruction() && _item.instruction() <= Instruction::SWAP16; -} - CSECodeGenerator::CSECodeGenerator( ExpressionClasses& _expressionClasses, vector const& _storeOperations diff --git a/libevmcore/CommonSubexpressionEliminator.h b/libevmcore/CommonSubexpressionEliminator.h index a9a0c60a4..0dbb47b29 100644 --- a/libevmcore/CommonSubexpressionEliminator.h +++ b/libevmcore/CommonSubexpressionEliminator.h @@ -31,6 +31,7 @@ #include #include #include +#include namespace dev { @@ -139,20 +140,6 @@ private: AssemblyItem const* m_breakingItem = nullptr; }; -/** - * Helper functions to provide context-independent information about assembly items. - */ -struct SemanticInformation -{ - /// @returns true if the given items starts a new basic block - static bool breaksBasicBlock(AssemblyItem const& _item); - /// @returns true if the item is a two-argument operation whose value does not depend on the - /// order of its arguments. - static bool isCommutativeOperation(AssemblyItem const& _item); - static bool isDupInstruction(AssemblyItem const& _item); - static bool isSwapInstruction(AssemblyItem const& _item); -}; - /** * Unit that generates code from current stack layout, target stack layout and information about * the equivalence classes. @@ -230,7 +217,7 @@ _AssemblyItemIterator CommonSubexpressionEliminator::feedItems( _AssemblyItemIterator _end ) { - for (; _iterator != _end && !SemanticInformation::breaksBasicBlock(*_iterator); ++_iterator) + for (; _iterator != _end && !SemanticInformation::breaksCSEAnalysisBlock(*_iterator); ++_iterator) feedItem(*_iterator); if (_iterator != _end) m_breakingItem = &(*_iterator++); diff --git a/libevmcore/SemanticInformation.cpp b/libevmcore/SemanticInformation.cpp new file mode 100644 index 000000000..e561e7554 --- /dev/null +++ b/libevmcore/SemanticInformation.cpp @@ -0,0 +1,107 @@ +/* + 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 SemanticInformation.cpp + * @author Christian + * @date 2015 + * Helper to provide semantic information about assembly items. + */ + +#include +#include + +using namespace std; +using namespace dev; +using namespace dev::eth; + +bool SemanticInformation::breaksCSEAnalysisBlock(AssemblyItem const& _item) +{ + switch (_item.type()) + { + default: + case UndefinedItem: + case Tag: + return true; + case Push: + case PushString: + case PushTag: + case PushSub: + case PushSubSize: + case PushProgramSize: + case PushData: + return false; + case Operation: + { + if (isSwapInstruction(_item) || isDupInstruction(_item)) + return false; + if (_item.instruction() == Instruction::GAS || _item.instruction() == Instruction::PC) + return true; // GAS and PC assume a specific order of opcodes + if (_item.instruction() == Instruction::MSIZE) + return true; // msize is modified already by memory access, avoid that for now + if (_item.instruction() == Instruction::SHA3) + return true; //@todo: we have to compare sha3's not based on their memory addresses but on the memory content. + InstructionInfo info = instructionInfo(_item.instruction()); + if (_item.instruction() == Instruction::SSTORE) + return false; + if (_item.instruction() == Instruction::MSTORE) + return false; + //@todo: We do not handle the following memory instructions for now: + // calldatacopy, codecopy, extcodecopy, mstore8, + // msize (note that msize also depends on memory read access) + + // the second requirement will be lifted once it is implemented + return info.sideEffects || info.args > 2; + } + } +} + +bool SemanticInformation::isCommutativeOperation(AssemblyItem const& _item) +{ + if (_item.type() != Operation) + return false; + switch (_item.instruction()) + { + case Instruction::ADD: + case Instruction::MUL: + case Instruction::EQ: + case Instruction::AND: + case Instruction::OR: + case Instruction::XOR: + return true; + default: + return false; + } +} + +bool SemanticInformation::isDupInstruction(AssemblyItem const& _item) +{ + if (_item.type() != Operation) + return false; + return Instruction::DUP1 <= _item.instruction() && _item.instruction() <= Instruction::DUP16; +} + +bool SemanticInformation::isSwapInstruction(AssemblyItem const& _item) +{ + if (_item.type() != Operation) + return false; + return Instruction::SWAP1 <= _item.instruction() && _item.instruction() <= Instruction::SWAP16; +} + +bool SemanticInformation::isJumpInstruction(AssemblyItem const& _item) +{ + return _item == AssemblyItem(Instruction::JUMP) || _item == AssemblyItem(Instruction::JUMPI); +} diff --git a/libevmcore/SemanticInformation.h b/libevmcore/SemanticInformation.h new file mode 100644 index 000000000..7497dc651 --- /dev/null +++ b/libevmcore/SemanticInformation.h @@ -0,0 +1,50 @@ +/* + 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 SemanticInformation.h + * @author Christian + * @date 2015 + * Helper to provide semantic information about assembly items. + */ + +#pragma once + + +namespace dev +{ +namespace eth +{ + +class AssemblyItem; + +/** + * Helper functions to provide context-independent information about assembly items. + */ +struct SemanticInformation +{ + /// @returns true if the given items starts a new block for common subexpression analysis. + static bool breaksCSEAnalysisBlock(AssemblyItem const& _item); + /// @returns true if the item is a two-argument operation whose value does not depend on the + /// order of its arguments. + static bool isCommutativeOperation(AssemblyItem const& _item); + static bool isDupInstruction(AssemblyItem const& _item); + static bool isSwapInstruction(AssemblyItem const& _item); + static bool isJumpInstruction(AssemblyItem const& _item); +}; + +} +} From 600b12ab783cf36ec34e04df9b915088c7b6b4a9 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 1 Apr 2015 11:53:57 +0200 Subject: [PATCH 08/18] LogsPanel --- mix/qml/LogsPane.qml | 43 +++++++++++++++++++++++++++++++-------- mix/qml/LogsPaneStyle.qml | 2 +- mix/qml/StatusPane.qml | 10 +++------ 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/mix/qml/LogsPane.qml b/mix/qml/LogsPane.qml index 21bd9fd96..f600f9f9d 100644 --- a/mix/qml/LogsPane.qml +++ b/mix/qml/LogsPane.qml @@ -13,6 +13,11 @@ Rectangle logsModel.insert(0, { "type": _type, "date": Qt.formatDateTime(new Date(), "hh:mm:ss"), "content": _content, "level": _level }); } + Keys.onEscapePressed: + { + parent.toggle(); + } + anchors.fill: parent radius: 5 color: "transparent" @@ -33,7 +38,7 @@ Rectangle height: parent.height width: parent.width horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - ColumnLayout + Column { id: logsRect spacing: 0 @@ -93,6 +98,26 @@ Rectangle return index % 2 === 0 ? "transparent" : LogsPaneStyle.generic.layout.logAlternateColor; } + MouseArea + { + anchors.fill: parent + onClicked: + { + if (logContent.elide === Text.ElideNone) + { + logContent.elide = Text.ElideRight; + logContent.wrapMode = Text.NoWrap + parent.height = 30; + } + else + { + logContent.elide = Text.ElideNone; + logContent.wrapMode = Text.WordWrap; + parent.height = logContent.lineCount * 30; + } + } + } + DefaultLabel { text: date; @@ -120,12 +145,16 @@ Rectangle } } - DefaultLabel { + Text { + id: logContent text: content; font.family: LogsPaneStyle.generic.layout.logLabelFont width: LogsPaneStyle.generic.layout.contentWidth font.pointSize: Style.absoluteSize(-1) anchors.verticalCenter: parent.verticalCenter + elide: Text.ElideRight + + maximumLineCount: 10 anchors.left: parent.left anchors.leftMargin: 190 color: { @@ -145,11 +174,8 @@ Rectangle } } } - - } - Component { id: itemDelegate DefaultLabel { @@ -166,7 +192,6 @@ Rectangle } } } - } Rectangle @@ -377,7 +402,7 @@ Rectangle anchors.centerIn: parent fillMode: Image.PreserveAspectFit width: 20 - height: 20 + height: 25 } Action { @@ -420,7 +445,7 @@ Rectangle anchors.centerIn: parent fillMode: Image.PreserveAspectFit width: 20 - height: 20 + height: 25 } Action { @@ -503,7 +528,7 @@ Rectangle anchors.centerIn: parent fillMode: Image.PreserveAspectFit width: 20 - height: 20 + height: 25 } Action { diff --git a/mix/qml/LogsPaneStyle.qml b/mix/qml/LogsPaneStyle.qml index 215f17bd7..8e0dfd5f4 100644 --- a/mix/qml/LogsPaneStyle.qml +++ b/mix/qml/LogsPaneStyle.qml @@ -20,7 +20,7 @@ QtObject { property int headerInputWidth: 200 property int dateWidth: 70 property int typeWidth: 90 - property int contentWidth: 250 + property int contentWidth: 560 property string logAlternateColor: "#f6f5f6" } } diff --git a/mix/qml/StatusPane.qml b/mix/qml/StatusPane.qml index b42b13fef..3d366021f 100644 --- a/mix/qml/StatusPane.qml +++ b/mix/qml/StatusPane.qml @@ -112,7 +112,7 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter radius: 3 - width: 650 + width: 600 height: 30 color: "#fcfbfc" Text { @@ -201,8 +201,8 @@ Rectangle { { logsContainer.state = "opened"; logsContainer.focus = true; - calCoord(); forceActiveFocus(); + calCoord(); } } @@ -213,10 +213,6 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter visible: false radius: 5 - Component.onCompleted: - { - calCoord(); - } function calCoord() { @@ -225,7 +221,7 @@ Rectangle { top = top.parent var coordinates = logsContainer.mapToItem(top, 0, 0); logsContainer.parent = top; - logsContainer.x = coordinates.x + 150; + logsContainer.x = coordinates.x; logsContainer.y = coordinates.y; } From 0e247e0282edaaf1f2cff9b424407be60c481a67 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Fri, 27 Mar 2015 17:07:32 +0100 Subject: [PATCH 09/18] style fixes --- libsolidity/AST.cpp | 2 +- libsolidity/Types.cpp | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index e3c9bc964..7fe3a9825 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -337,7 +337,7 @@ void FunctionDefinition::checkTypeRequirements() { if (!var->getType()->canLiveOutsideStorage()) BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to live outside storage.")); - if (!(var->getType()->externalType()) && getVisibility() >= Visibility::Public) + if (getVisibility() >= Visibility::Public && !(var->getType()->externalType())) BOOST_THROW_EXCEPTION(var->createTypeError("Internal type is not allowed for function with external visibility")); } for (ASTPointer const& modifier: m_functionModifiers) diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp index 5fd7d24a6..e784c6b8c 100644 --- a/libsolidity/Types.cpp +++ b/libsolidity/Types.cpp @@ -1103,11 +1103,16 @@ TypePointer FunctionType::externalType() const TypePointers paramTypes; TypePointers retParamTypes; - for (auto it = m_parameterTypes.cbegin(); it != m_parameterTypes.cend(); ++it) - paramTypes.push_back((*it)->externalType()); - for (auto it = m_returnParameterTypes.cbegin(); it != m_returnParameterTypes.cend(); ++it) - retParamTypes.push_back((*it)->externalType()); - + for(auto type: m_parameterTypes) + { + solAssert(!!type->externalType(), "To be included in external type of the function, the argument should have external type."); + paramTypes.push_back(type->externalType()); + } + for(auto param: m_returnParameterTypes) + { + solAssert(!!param->externalType(), "To be included in external type of the function, the argument should have external type."); + retParamTypes.push_back(param->externalType()); + } return make_shared(paramTypes, retParamTypes, m_location, m_arbitraryParameters); } From 4173a71846c7e35002c56a7c990aace40e9579cd Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 30 Mar 2015 14:34:38 +0200 Subject: [PATCH 10/18] changed checking for external type in VariableDeclaration::checkTypeRequirements() changed error msg --- libsolidity/AST.cpp | 17 ++++++++++++++++- test/SolidityNameAndTypeResolution.cpp | 14 ++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index 7fe3a9825..a111a6f88 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -338,7 +338,14 @@ void FunctionDefinition::checkTypeRequirements() if (!var->getType()->canLiveOutsideStorage()) BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to live outside storage.")); if (getVisibility() >= Visibility::Public && !(var->getType()->externalType())) - BOOST_THROW_EXCEPTION(var->createTypeError("Internal type is not allowed for function with external visibility")); + { + // todo delete when arrays as parameter type in internal functions will be implemented + ArrayType const* type = dynamic_cast(var->getType().get()); + if (getVisibility() == Visibility::Public && type) + BOOST_THROW_EXCEPTION(var->createTypeError("Array type is not allowed as parameter for internal functions.")); + else + BOOST_THROW_EXCEPTION(var->createTypeError("Internal type is not allowed for function with external visibility.")); + } } for (ASTPointer const& modifier: m_functionModifiers) modifier->checkTypeRequirements(isConstructor() ? @@ -379,6 +386,14 @@ void VariableDeclaration::checkTypeRequirements() m_value->expectType(*m_type); if (m_isStateVariable && !m_type->externalType() && getVisibility() >= Visibility::Public) BOOST_THROW_EXCEPTION(createTypeError("Internal type is not allowed for state variables.")); + + auto sharedToExternalTypes = FunctionType(*this).externalType(); // do not distroy the shared pointer. + auto externalFunctionTypes = dynamic_cast(sharedToExternalTypes.get()); + TypePointers retParamTypes = externalFunctionTypes->getReturnParameterTypes(); + TypePointers parameterTypes = externalFunctionTypes->getParameterTypes(); + for (auto parameter: parameterTypes + retParamTypes) + if (!parameter && !(parameter->externalType())) + BOOST_THROW_EXCEPTION(createTypeError("Internal type is not allowed for state variables.")); } else { // no type declared and no previous assignment, infer the type diff --git a/test/SolidityNameAndTypeResolution.cpp b/test/SolidityNameAndTypeResolution.cpp index ddcf36140..531f3bc13 100644 --- a/test/SolidityNameAndTypeResolution.cpp +++ b/test/SolidityNameAndTypeResolution.cpp @@ -460,7 +460,7 @@ BOOST_AUTO_TEST_CASE(function_external_types) uint a; } contract Test { - function boo(uint arg2, bool arg3, bytes8 arg4, bool[2] pairs, uint[] dynamic, C carg) external returns (uint ret) { + function boo(uint arg2, bool arg3, bytes8 arg4, bool[2] pairs, uint[] dynamic, C carg, address[] addresses) external returns (uint ret) { ret = 5; } })"; @@ -471,7 +471,7 @@ BOOST_AUTO_TEST_CASE(function_external_types) auto functions = contract->getDefinedFunctions(); if (functions.empty()) continue; - BOOST_CHECK_EQUAL("boo(uint256,bool,bytes8,bool[2],uint256[],address)", functions[0]->externalSignature()); + BOOST_CHECK_EQUAL("boo(uint256,bool,bytes8,bool[2],uint256[],address,address[])", functions[0]->externalSignature()); } } @@ -503,6 +503,16 @@ BOOST_AUTO_TEST_CASE(function_external_call_not_allowed_conversion) BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); } +// todo delete when implemented +BOOST_AUTO_TEST_CASE(arrays_in_internal_functions) +{ + char const* text = R"( + contract Test { + function foo(address[] addresses) {} + })"; + BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); +} + BOOST_AUTO_TEST_CASE(function_internal_allowed_conversion) { char const* text = R"( From 4352423fea12a3896af3580f2b3097674cdd1ae9 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Wed, 1 Apr 2015 15:19:33 +0200 Subject: [PATCH 11/18] miner changes in the implementation of the externalTypes function of FunctionType. better error messages for exeptions style fixes after review --- libsolidity/AST.cpp | 18 ++++++++---------- libsolidity/Types.cpp | 12 +++++++----- libsolidity/Types.h | 2 ++ 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index a111a6f88..d489a4489 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -339,12 +339,11 @@ void FunctionDefinition::checkTypeRequirements() BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to live outside storage.")); if (getVisibility() >= Visibility::Public && !(var->getType()->externalType())) { - // todo delete when arrays as parameter type in internal functions will be implemented - ArrayType const* type = dynamic_cast(var->getType().get()); - if (getVisibility() == Visibility::Public && type) + // todo delete when will be implemented arrays as parameter type in internal functions + if (getVisibility() == Visibility::Public && var->getType()->getCategory() == Type::Category::Array) BOOST_THROW_EXCEPTION(var->createTypeError("Array type is not allowed as parameter for internal functions.")); else - BOOST_THROW_EXCEPTION(var->createTypeError("Internal type is not allowed for function with external visibility.")); + BOOST_THROW_EXCEPTION(var->createTypeError("Internal type is not allowed for public and external functions.")); } } for (ASTPointer const& modifier: m_functionModifiers) @@ -389,12 +388,11 @@ void VariableDeclaration::checkTypeRequirements() auto sharedToExternalTypes = FunctionType(*this).externalType(); // do not distroy the shared pointer. auto externalFunctionTypes = dynamic_cast(sharedToExternalTypes.get()); - TypePointers retParamTypes = externalFunctionTypes->getReturnParameterTypes(); - TypePointers parameterTypes = externalFunctionTypes->getParameterTypes(); - for (auto parameter: parameterTypes + retParamTypes) - if (!parameter && !(parameter->externalType())) - BOOST_THROW_EXCEPTION(createTypeError("Internal type is not allowed for state variables.")); - } else + for (auto parameter: externalFunctionTypes->getParameterTypes() + externalFunctionTypes->getReturnParameterTypes()) + if (!parameter || !(parameter->externalType())) + BOOST_THROW_EXCEPTION(createTypeError("Internal type is not allowed for public state variables.")); + } + else { // no type declared and no previous assignment, infer the type m_value->checkTypeRequirements(); diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp index e784c6b8c..86b740262 100644 --- a/libsolidity/Types.cpp +++ b/libsolidity/Types.cpp @@ -1103,15 +1103,17 @@ TypePointer FunctionType::externalType() const TypePointers paramTypes; TypePointers retParamTypes; - for(auto type: m_parameterTypes) + for (auto type: m_parameterTypes) { - solAssert(!!type->externalType(), "To be included in external type of the function, the argument should have external type."); + if(!type->externalType()) + return TypePointer(); paramTypes.push_back(type->externalType()); } - for(auto param: m_returnParameterTypes) + for (auto type: m_returnParameterTypes) { - solAssert(!!param->externalType(), "To be included in external type of the function, the argument should have external type."); - retParamTypes.push_back(param->externalType()); + if(!type->externalType()) + return TypePointer(); + retParamTypes.push_back(type->externalType()); } return make_shared(paramTypes, retParamTypes, m_location, m_arbitraryParameters); } diff --git a/libsolidity/Types.h b/libsolidity/Types.h index 99fd878f0..cea711991 100644 --- a/libsolidity/Types.h +++ b/libsolidity/Types.h @@ -512,6 +512,8 @@ public: virtual Category getCategory() const override { return Category::Function; } + /// @returns TypePointer of a new FunctionType object. All input/return parameters are an appropriate external types of input/return parameters of current function. + /// Returns an empty shared pointer if one of input/return parameters does not have an externaltype. virtual TypePointer externalType() const override; explicit FunctionType(FunctionDefinition const& _function, bool _isInternal = true); From b4e869acfaac4a4313c19bb634b842ce6cd65ff6 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 1 Apr 2015 15:25:32 +0200 Subject: [PATCH 12/18] ui changes --- mix/qml/LogsPane.qml | 55 +++++++++++++++++++++++++++------------ mix/qml/LogsPaneStyle.qml | 2 +- mix/qml/StatusPane.qml | 27 ++++++++++++------- 3 files changed, 58 insertions(+), 26 deletions(-) diff --git a/mix/qml/LogsPane.qml b/mix/qml/LogsPane.qml index f600f9f9d..23ab8e682 100644 --- a/mix/qml/LogsPane.qml +++ b/mix/qml/LogsPane.qml @@ -7,19 +7,29 @@ import "." Rectangle { + property variant currentStatus; function push(_level, _type, _content) { _content = _content.replace(/\n/g, " ") logsModel.insert(0, { "type": _type, "date": Qt.formatDateTime(new Date(), "hh:mm:ss"), "content": _content, "level": _level }); } - Keys.onEscapePressed: + onVisibleChanged: { - parent.toggle(); + if (visible && (logsModel.count === 0 || (logsModel.get(0).date !== currentStatus.date && logsModel.get(0).content !== currentStatus.content))) + logsModel.insert(0, { "type": currentStatus.type, "date": currentStatus.date, "content": currentStatus.content, "level": currentStatus.level }); + else if (!visible) + { + for (var k = 0; k < logsModel.count; k++) + { + if (logsModel.get(k).type === "Comp") //do not keep compilation logs. + logsModel.remove(k); + } + } } anchors.fill: parent - radius: 5 + radius: 10 color: "transparent" id: logsPane Column { @@ -43,11 +53,13 @@ Rectangle id: logsRect spacing: 0 Repeater { + id: logsRepeater clip: true + property string frontColor: "transparent" model: SortFilterProxyModel { id: proxyModel source: logsModel - property var roles: ["-", "javascript", "run", "state"] + property var roles: ["-", "javascript", "run", "state", "comp"] Component.onCompleted: { filterType = regEx(proxyModel.roles); @@ -80,7 +92,7 @@ Rectangle return "(?:" + roles.join('|') + ")"; } - filterType: "(?:javascript|run|state)" + filterType: "(?:javascript|run|state|comp)" filterContent: "" filterSyntax: SortFilterProxyModel.RegExp filterCaseSensitivity: Qt.CaseInsensitive @@ -92,12 +104,17 @@ Rectangle height: 30 color: { + var cl; if (level === "warning" || level === "error") - return "#fffcd5"; + cl = "#fffcd5"; else - return index % 2 === 0 ? "transparent" : LogsPaneStyle.generic.layout.logAlternateColor; + cl = index % 2 === 0 ? "transparent" : LogsPaneStyle.generic.layout.logAlternateColor; + if (index === 0) + logsRepeater.frontColor = cl; + return cl; } + MouseArea { anchors.fill: parent @@ -148,13 +165,11 @@ Rectangle Text { id: logContent text: content; - font.family: LogsPaneStyle.generic.layout.logLabelFont + font.family: "sans serif" width: LogsPaneStyle.generic.layout.contentWidth font.pointSize: Style.absoluteSize(-1) anchors.verticalCenter: parent.verticalCenter elide: Text.ElideRight - - maximumLineCount: 10 anchors.left: parent.left anchors.leftMargin: 190 color: { @@ -230,7 +245,14 @@ Rectangle anchors.verticalCenter: parent.verticalCenter width: 1; height: parent.height - color : "transparent" + color : "#d3d0d0" + } + + Rectangle { + anchors.verticalCenter: parent.verticalCenter + width: 2; + height: parent.height + color : "#f2f1f2" } ToolButton { @@ -272,7 +294,7 @@ Rectangle Rectangle { anchors.verticalCenter: parent.verticalCenter - width: 1; + width: 2; height: parent.height color : "#f2f1f2" } @@ -311,14 +333,14 @@ Rectangle anchors.verticalCenter: parent.verticalCenter width: 1; height: parent.height - color : "#d3d0d0" + color: "#d3d0d0" } Rectangle { anchors.verticalCenter: parent.verticalCenter - width: 1; + width: 2; height: parent.height - color : "#f2f1f2" + color: "#f2f1f2" } ToolButton { @@ -360,7 +382,7 @@ Rectangle Rectangle { anchors.verticalCenter: parent.verticalCenter - width: 1; + width: 2; height: parent.height color : "#f2f1f2" } @@ -541,4 +563,5 @@ Rectangle } } } + } diff --git a/mix/qml/LogsPaneStyle.qml b/mix/qml/LogsPaneStyle.qml index 8e0dfd5f4..e4985b70e 100644 --- a/mix/qml/LogsPaneStyle.qml +++ b/mix/qml/LogsPaneStyle.qml @@ -15,7 +15,7 @@ QtObject { property int headerButtonSpacing: 0 property int leftMargin: 10 property int headerButtonHeight: 30 - property string logLabelColor: "#808080" + property string logLabelColor: "#4a4a4a" property string logLabelFont: "sans serif" property int headerInputWidth: 200 property int dateWidth: 70 diff --git a/mix/qml/StatusPane.qml b/mix/qml/StatusPane.qml index 3d366021f..4a9287bec 100644 --- a/mix/qml/StatusPane.qml +++ b/mix/qml/StatusPane.qml @@ -9,7 +9,7 @@ Rectangle { id: statusHeader objectName: "statusPane" property variant webPreview - + property alias currentStatus: logPane.currentStatus function updateStatus(message) { if (!message) @@ -17,6 +17,7 @@ Rectangle { status.state = ""; status.text = qsTr("Compile successfully."); debugImg.state = "active"; + currentStatus = { "type": "Comp", "date": Qt.formatDateTime(new Date(), "hh:mm:ss"), "content": status.text, "level": "info" } } else { @@ -24,6 +25,7 @@ Rectangle { var errorInfo = ErrorLocationFormater.extractErrorInfo(message, true); status.text = errorInfo.errorLocation + " " + errorInfo.errorDetail; debugImg.state = ""; + currentStatus = { "type": "Comp", "date": Qt.formatDateTime(new Date(), "hh:mm:ss"), "content": status.text, "level": "error" } } debugRunActionIcon.enabled = codeModel.hasContract; } @@ -33,6 +35,7 @@ Rectangle { status.state = ""; status.text = text logPane.push("info", type, text); + currentStatus = { "type": type, "date": Qt.formatDateTime(new Date(), "hh:mm:ss"), "content": text, "level": "info" } } function warningMessage(text, type) @@ -40,6 +43,7 @@ Rectangle { status.state = "warning"; status.text = text logPane.push("warning", type, text); + currentStatus = { "type": type, "date": Qt.formatDateTime(new Date(), "hh:mm:ss"), "content": text, "level": "warning" } } function errorMessage(text, type) @@ -47,6 +51,7 @@ Rectangle { status.state = "error"; status.text = text; logPane.push("error", type, text); + currentStatus = { "type": type, "date": Qt.formatDateTime(new Date(), "hh:mm:ss"), "content": text, "level": "error" } } Connections { @@ -118,7 +123,7 @@ Rectangle { Text { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter - font.pointSize: StatusPaneStyle.general.statusFontSize + font.pointSize: Style.absoluteSize(-1) height: 15 font.family: "sans serif" objectName: "status" @@ -196,7 +201,9 @@ Rectangle { function toggle() { if (logsContainer.state === "opened") + { logsContainer.state = "closed" + } else { logsContainer.state = "opened"; @@ -208,11 +215,10 @@ Rectangle { id: logsContainer width: 750 - anchors.topMargin: -30 anchors.top: statusContainer.bottom - anchors.horizontalCenter: parent.horizontalCenter + anchors.topMargin: 4 visible: false - radius: 5 + radius: 10 function calCoord() { @@ -221,28 +227,31 @@ Rectangle { top = top.parent var coordinates = logsContainer.mapToItem(top, 0, 0); logsContainer.parent = top; - logsContainer.x = coordinates.x; - logsContainer.y = coordinates.y; + logsContainer.x = status.x + statusContainer.x - LogsPaneStyle.generic.layout.dateWidth - LogsPaneStyle.generic.layout.typeWidth - 30 } LogsPane { id: logPane; } + states: [ State { name: "opened"; PropertyChanges { target: logsContainer; height: 500; visible: true } + PropertyChanges { target: statusContainer; width: 100; height: 25 } }, State { name: "closed"; PropertyChanges { target: logsContainer; height: 0; visible: false } + PropertyChanges { target: statusContainer; width: 600; height: 30 } } ] transitions: Transition { NumberAnimation { properties: "height"; easing.type: Easing.InOutQuad; duration: 200 } - NumberAnimation { properties: "visible"; 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 } + } } } From f4ea6b8e8d2f8c72223372113ddcf84cecbc1c23 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Wed, 1 Apr 2015 15:26:37 +0200 Subject: [PATCH 13/18] Update Types.h --- libsolidity/Types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsolidity/Types.h b/libsolidity/Types.h index cea711991..e1852bc7f 100644 --- a/libsolidity/Types.h +++ b/libsolidity/Types.h @@ -513,7 +513,7 @@ public: virtual Category getCategory() const override { return Category::Function; } /// @returns TypePointer of a new FunctionType object. All input/return parameters are an appropriate external types of input/return parameters of current function. - /// Returns an empty shared pointer if one of input/return parameters does not have an externaltype. + /// Returns an empty shared pointer if one of the input/return parameters does not have an externaltype. virtual TypePointer externalType() const override; explicit FunctionType(FunctionDefinition const& _function, bool _isInternal = true); From c5df9e205b8c9c76d74a7337db02e62956765873 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Wed, 1 Apr 2015 15:41:24 +0200 Subject: [PATCH 14/18] Update AST.cpp --- libsolidity/AST.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index d489a4489..fec123f75 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -341,7 +341,7 @@ void FunctionDefinition::checkTypeRequirements() { // todo delete when will be implemented arrays as parameter type in internal functions if (getVisibility() == Visibility::Public && var->getType()->getCategory() == Type::Category::Array) - BOOST_THROW_EXCEPTION(var->createTypeError("Array type is not allowed as parameter for internal functions.")); + BOOST_THROW_EXCEPTION(var->createTypeError("Arrays only implemented for external functions.")); else BOOST_THROW_EXCEPTION(var->createTypeError("Internal type is not allowed for public and external functions.")); } @@ -386,7 +386,7 @@ void VariableDeclaration::checkTypeRequirements() if (m_isStateVariable && !m_type->externalType() && getVisibility() >= Visibility::Public) BOOST_THROW_EXCEPTION(createTypeError("Internal type is not allowed for state variables.")); - auto sharedToExternalTypes = FunctionType(*this).externalType(); // do not distroy the shared pointer. + auto sharedToExternalTypes = FunctionType(*this).externalType(); // do not destroy the shared pointer. auto externalFunctionTypes = dynamic_cast(sharedToExternalTypes.get()); for (auto parameter: externalFunctionTypes->getParameterTypes() + externalFunctionTypes->getReturnParameterTypes()) if (!parameter || !(parameter->externalType())) From ab0b92242f58503e3a7f5732a0adf0b0b790fa8d Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Wed, 1 Apr 2015 15:42:30 +0200 Subject: [PATCH 15/18] Update Types.cpp --- libsolidity/Types.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp index 86b740262..78649cc95 100644 --- a/libsolidity/Types.cpp +++ b/libsolidity/Types.cpp @@ -1105,13 +1105,13 @@ TypePointer FunctionType::externalType() const for (auto type: m_parameterTypes) { - if(!type->externalType()) + if (!type->externalType()) return TypePointer(); paramTypes.push_back(type->externalType()); } for (auto type: m_returnParameterTypes) { - if(!type->externalType()) + if (!type->externalType()) return TypePointer(); retParamTypes.push_back(type->externalType()); } From 119101812103b7123b86d7f293d3c690a0456530 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 1 Apr 2015 15:43:01 +0200 Subject: [PATCH 16/18] style --- mix/qml/LogsPane.qml | 28 ++++++++++++++-------------- mix/qml/LogsPaneStyle.qml | 4 ++++ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/mix/qml/LogsPane.qml b/mix/qml/LogsPane.qml index 23ab8e682..86378ff17 100644 --- a/mix/qml/LogsPane.qml +++ b/mix/qml/LogsPane.qml @@ -106,7 +106,7 @@ Rectangle { var cl; if (level === "warning" || level === "error") - cl = "#fffcd5"; + cl = LogsPaneStyle.generic.layout.errorColor; else cl = index % 2 === 0 ? "transparent" : LogsPaneStyle.generic.layout.logAlternateColor; if (index === 0) @@ -165,7 +165,7 @@ Rectangle Text { id: logContent text: content; - font.family: "sans serif" + font.family: LogsPaneStyle.generic.layout.logLabelFont width: LogsPaneStyle.generic.layout.contentWidth font.pointSize: Style.absoluteSize(-1) anchors.verticalCenter: parent.verticalCenter @@ -234,7 +234,7 @@ Rectangle DefaultLabel { anchors.verticalCenter: parent.verticalCenter - color: "#808080" + color: LogsPaneStyle.generic.layout.logLabelColor font.pointSize: Style.absoluteSize(-3) font.family: LogsPaneStyle.generic.layout.logLabelFont text: qsTr("Show:") @@ -245,14 +245,14 @@ Rectangle anchors.verticalCenter: parent.verticalCenter width: 1; height: parent.height - color : "#d3d0d0" + color: LogsPaneStyle.generic.layout.buttonSeparatorColor1 } Rectangle { anchors.verticalCenter: parent.verticalCenter width: 2; height: parent.height - color : "#f2f1f2" + color: LogsPaneStyle.generic.layout.buttonSeparatorColor2 } ToolButton { @@ -280,7 +280,7 @@ Rectangle } background: Rectangle { - color: javascriptButton.checked ? "#dcdcdc" : "transparent" + color: javascriptButton.checked ? LogsPaneStyle.generic.layout.buttonSelected : "transparent" } } } @@ -289,14 +289,14 @@ Rectangle anchors.verticalCenter: parent.verticalCenter width: 1; height: parent.height - color : "#d3d0d0" + color: LogsPaneStyle.generic.layout.buttonSeparatorColor1 } Rectangle { anchors.verticalCenter: parent.verticalCenter width: 2; height: parent.height - color : "#f2f1f2" + color: LogsPaneStyle.generic.layout.buttonSeparatorColor2 } ToolButton { @@ -324,7 +324,7 @@ Rectangle } background: Rectangle { - color: runButton.checked ? "#dcdcdc" : "transparent" + color: runButton.checked ? LogsPaneStyle.generic.layout.buttonSelected : "transparent" } } } @@ -333,14 +333,14 @@ Rectangle anchors.verticalCenter: parent.verticalCenter width: 1; height: parent.height - color: "#d3d0d0" + color: LogsPaneStyle.generic.layout.buttonSeparatorColor1 } Rectangle { anchors.verticalCenter: parent.verticalCenter width: 2; height: parent.height - color: "#f2f1f2" + color: LogsPaneStyle.generic.layout.buttonSeparatorColor2 } ToolButton { @@ -368,7 +368,7 @@ Rectangle } background: Rectangle { - color: stateButton.checked ? "#dcdcdc" : "transparent" + color: stateButton.checked ? LogsPaneStyle.generic.layout.buttonSelected : "transparent" } } } @@ -377,14 +377,14 @@ Rectangle anchors.verticalCenter: parent.verticalCenter width: 1; height: parent.height - color : "#d3d0d0" + color: LogsPaneStyle.generic.layout.buttonSeparatorColor1 } Rectangle { anchors.verticalCenter: parent.verticalCenter width: 2; height: parent.height - color : "#f2f1f2" + color: LogsPaneStyle.generic.layout.buttonSeparatorColor2 } } diff --git a/mix/qml/LogsPaneStyle.qml b/mix/qml/LogsPaneStyle.qml index e4985b70e..19f6a653e 100644 --- a/mix/qml/LogsPaneStyle.qml +++ b/mix/qml/LogsPaneStyle.qml @@ -22,6 +22,10 @@ QtObject { property int typeWidth: 90 property int contentWidth: 560 property string logAlternateColor: "#f6f5f6" + property string errorColor: "#fffcd5" + property string buttonSeparatorColor1: "#d3d0d0" + property string buttonSeparatorColor2: "#f2f1f2" + property string buttonSelected: "#dcdcdc" } } } From 7d9d8fe200afc53061456f360e91a5d1d2406dbf Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 1 Apr 2015 15:50:01 +0200 Subject: [PATCH 17/18] small change --- mix/qml/LogsPane.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mix/qml/LogsPane.qml b/mix/qml/LogsPane.qml index 86378ff17..c619080bf 100644 --- a/mix/qml/LogsPane.qml +++ b/mix/qml/LogsPane.qml @@ -489,9 +489,8 @@ Rectangle DefaultTextField { id: searchBox - height: LogsPaneStyle.generic.layout.headerButtonHeight - 5 anchors.verticalCenter: parent.verticalCenter - width: LogsPaneStyle.generic.layout.headerInputWidth - 40 + width: LogsPaneStyle.generic.layout.headerInputWidth - 50 font.family: LogsPaneStyle.generic.layout.logLabelFont font.pointSize: Style.absoluteSize(-3) font.italic: true From 065d9a9e68b3e4ca8413ff5eca15ccca18633080 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Wed, 1 Apr 2015 15:57:39 +0200 Subject: [PATCH 18/18] VariableDeclaration::checkTypeRequirements() refactoring --- libsolidity/AST.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index fec123f75..095ba7bf1 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -386,11 +386,8 @@ void VariableDeclaration::checkTypeRequirements() if (m_isStateVariable && !m_type->externalType() && getVisibility() >= Visibility::Public) BOOST_THROW_EXCEPTION(createTypeError("Internal type is not allowed for state variables.")); - auto sharedToExternalTypes = FunctionType(*this).externalType(); // do not destroy the shared pointer. - auto externalFunctionTypes = dynamic_cast(sharedToExternalTypes.get()); - for (auto parameter: externalFunctionTypes->getParameterTypes() + externalFunctionTypes->getReturnParameterTypes()) - if (!parameter || !(parameter->externalType())) - BOOST_THROW_EXCEPTION(createTypeError("Internal type is not allowed for public state variables.")); + if (!FunctionType(*this).externalType()) + BOOST_THROW_EXCEPTION(createTypeError("Internal type is not allowed for public state variables.")); } else {