diff --git a/mix/AssemblyDebuggerControl.h b/mix/AssemblyDebuggerControl.h index fdfa94cde..b8bd344e5 100644 --- a/mix/AssemblyDebuggerControl.h +++ b/mix/AssemblyDebuggerControl.h @@ -50,7 +50,7 @@ public: void start() const override; QString title() const override; QString contentUrl() const override; - /// Display without managing machine states result. Displayed in the right side tab. + /// show panel without managing machine states result. Displayed in the right side tab. Q_INVOKABLE void updateDebugPanel(); private: diff --git a/mix/StatusPane.cpp b/mix/StatusPane.cpp index e1a33f1a9..f74b8f22b 100644 --- a/mix/StatusPane.cpp +++ b/mix/StatusPane.cpp @@ -62,5 +62,5 @@ CompilationResult* StatusPane::result() const void StatusPane::update() { QObject* ctrl = m_view->findChild("statusPane", Qt::FindChildrenRecursively); - QMetaObject::invokeMethod(ctrl, "update"); + QMetaObject::invokeMethod(ctrl, "updateStatus"); } diff --git a/mix/StatusPane.h b/mix/StatusPane.h index c0db286a3..ee65252b5 100644 --- a/mix/StatusPane.h +++ b/mix/StatusPane.h @@ -43,9 +43,6 @@ public: QString contentUrl() const override; CompilationResult* result() const; -private: - void resetOutPut(); - public slots: void update(); }; diff --git a/mix/qml/Debugger.qml b/mix/qml/Debugger.qml index 822c7346a..ed9134cdd 100644 --- a/mix/qml/Debugger.qml +++ b/mix/qml/Debugger.qml @@ -34,7 +34,6 @@ Rectangle { debugScrollArea.visible = false; compilationErrorArea.visible = true; machineStates.visible = false; - console.log(constantCompilation.result.compilerMessage); var errorInfo = ErrorLocationFormater.extractErrorInfo(statusPane.result.compilerMessage, false); errorLocation.text = errorInfo.errorLocation; errorDetail.text = errorInfo.errorDetail; diff --git a/mix/qml/ItemDelegateDataDump.qml b/mix/qml/ItemDelegateDataDump.qml index da7159779..fefd482f9 100644 --- a/mix/qml/ItemDelegateDataDump.qml +++ b/mix/qml/ItemDelegateDataDump.qml @@ -7,10 +7,20 @@ Rectangle { anchors.fill: parent RowLayout { + id: row; + function formatData(data, index) + { + if (data.indexOf("_separator_") !== -1) + return modelData.split("_separator_")[index]; + else + return ""; + } + anchors.fill: parent spacing: 2 Rectangle { + id: firstCol; color: "#f7f7f7" Layout.fillWidth: true Layout.minimumWidth: 35 @@ -21,8 +31,8 @@ Rectangle { anchors.centerIn: parent anchors.leftMargin: 5 color: "#8b8b8b" - text: modelData.split("_separator_")[0] - font.pointSize: 9 + text: row.formatData(modelData, 0) + font.pointSize: 9; } } @@ -38,7 +48,7 @@ Rectangle { anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter color: "#8b8b8b" - text: modelData.split("_separator_")[1] + text: row.formatData(modelData, 1) font.pointSize: 9 } } @@ -53,7 +63,7 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter color: "#ededed" font.bold: true - text: modelData.split("_separator_")[2] + text: row.formatData(modelData, 2) font.pointSize: 10 } } diff --git a/mix/qml/MainContent.qml b/mix/qml/MainContent.qml index b80e5bc53..568fd7d0d 100644 --- a/mix/qml/MainContent.qml +++ b/mix/qml/MainContent.qml @@ -25,25 +25,19 @@ Rectangle { debugModel.updateDebugPanel(); } else - { rightView.hide(); - } } function ensureRightView() { if (!rightView.visible) - { rightView.show(); - } } function hideRightView() { if (rightView.visible) - { rightView.hide(); - } } CodeEditorExtensionManager { @@ -86,47 +80,6 @@ Rectangle { } } } - - Rectangle - { - color: "transparent" - width: 100 - height: parent.height - anchors.top: headerView.top - anchors.right: headerView.right - RowLayout - { - anchors.fill: parent - Rectangle { - color: "transparent" - anchors.fill: parent - Button - { - anchors.right: parent.right - anchors.rightMargin: 15 - anchors.verticalCenter: parent.verticalCenter - id: debugImg - iconSource: "qrc:/qml/img/bugiconinactive.png" - action: debugRunActionIcon - } - Action { - id: debugRunActionIcon - shortcut: "F5" - onTriggered: { - mainContent.ensureRightView(); - debugModel.debugDeployment(); - } - enabled: codeModel.hasContract && !debugModel.running; - onEnabledChanged: { - if (enabled) - debugImg.iconSource = "qrc:/qml/img/bugiconactive.png" - else - debugImg.iconSource = "qrc:/qml/img/bugiconinactive.png" - } - } - } - } - } } SplitView { @@ -188,7 +141,6 @@ Rectangle { font.family: "Monospace" font.pointSize: 12 width: parent.width - //anchors.centerIn: parent tabChangesFocus: false Keys.onPressed: { if (event.key === Qt.Key_Tab) { @@ -201,13 +153,16 @@ Rectangle { } Rectangle { + visible: false; + id: rightView; + Keys.onEscapePressed: { hide(); } - visible: false; - id: rightView; + property real panelRelWidth: 0.38 + function show() { visible = true; contentView.width = parent.width * (1 - 0.38) @@ -231,12 +186,10 @@ Rectangle { anchors.fill: parent style: TabViewStyle { frameOverlap: 1 - tabBar: Rectangle { color: "#ededed" id: background - } tab: Rectangle { color: "#ededed" diff --git a/mix/qml/StatusPane.qml b/mix/qml/StatusPane.qml index 0a828a0d0..36820a6e6 100644 --- a/mix/qml/StatusPane.qml +++ b/mix/qml/StatusPane.qml @@ -4,9 +4,10 @@ import QtQuick.Layouts 1.1 import "js/ErrorLocationFormater.js" as ErrorLocationFormater Rectangle { - id: constantCompilationStatus + id: statusHeader objectName: "statusPane" - function update() + + function updateStatus() { if (statusPane.result.successfull) { @@ -23,7 +24,9 @@ Rectangle { status.text = errorInfo.errorLocation + " " + errorInfo.errorDetail; logslink.visible = true; } + debugRunActionIcon.enabled = statusPane.result.successfull; } + color: "transparent" anchors.fill: parent Rectangle { @@ -93,4 +96,45 @@ Rectangle { } } } + + Rectangle + { + color: "transparent" + width: 100 + height: parent.height + anchors.top: statusHeader.top + anchors.right: statusHeader.right + RowLayout + { + anchors.fill: parent + Rectangle { + color: "transparent" + anchors.fill: parent + Button + { + anchors.right: parent.right + anchors.rightMargin: 15 + anchors.verticalCenter: parent.verticalCenter + id: debugImg + iconSource: "qrc:/qml/img/bugiconinactive.png" + action: debugRunActionIcon + } + Action { + id: debugRunActionIcon + onTriggered: { + mainContent.ensureRightView(); + debugModel.debugDeployment(); + } + enabled: false + onEnabledChanged: { + console.log(debugRunActionIcon.enabled) + if (debugRunActionIcon.enabled) + debugImg.iconSource = "qrc:/qml/img/bugiconactive.png" + else + debugImg.iconSource = "qrc:/qml/img/bugiconinactive.png" + } + } + } + } + } } diff --git a/mix/qml/StepActionImage.qml b/mix/qml/StepActionImage.qml index 13a8968a0..bd39d7959 100644 --- a/mix/qml/StepActionImage.qml +++ b/mix/qml/StepActionImage.qml @@ -9,6 +9,16 @@ Rectangle { property string disableStateImg property string enabledStateImg signal clicked + + function enabled(state) + { + buttonAction.enabled = state; + if (state) + debugImg.iconSource = enabledStateImg; + else + debugImg.iconSource = disableStateImg; + } + width: 15 height: 15 color: "transparent" @@ -34,12 +44,5 @@ Rectangle { onTriggered: { buttonActionContainer.clicked(); } - enabled: codeModel.hasContract && !debugModel.running; - onEnabledChanged: { - if (enabled) - iconSource = enabledStateImg - else - iconSource = disableStateImg - } } } diff --git a/mix/qml/js/Debugger.js b/mix/qml/js/Debugger.js index 7fb840fab..ebdd77873 100644 --- a/mix/qml/js/Debugger.js +++ b/mix/qml/js/Debugger.js @@ -17,11 +17,10 @@ function init() select(currentSelectedState); //displayReturnValue(); - jumpoutbackaction.state = "disabled"; - jumpintobackaction.state = "disabled"; - jumpintoforwardaction.state = "disabled" - jumpoutforwardaction.state = "disabled" - + jumpoutbackaction.enabled(false); + jumpintobackaction.enabled(false); + jumpintoforwardaction.enabled(false); + jumpoutforwardaction.enabled(false); } function moveSelection(incr) @@ -29,13 +28,8 @@ function moveSelection(incr) if (currentSelectedState + incr >= 0) { if (currentSelectedState + incr < debugStates.length) - { select(currentSelectedState + incr); - } - else - { - //endOfDebug(); - } + statesSlider.value = currentSelectedState; } } @@ -47,18 +41,16 @@ function select(stateIndex) highlightSelection(codeLine); currentSelectedState = stateIndex; completeCtxInformation(state); - //levelList.model = state.levels; - //levelList.update(); if (state.instruction === "JUMP") - jumpintoforwardaction.state = ""; + jumpintoforwardaction.enabled(true); else - jumpintoforwardaction.state = "disabled"; + jumpintoforwardaction.enabled(false); if (state.instruction === "JUMPDEST") - jumpintobackaction.state = ""; + jumpintobackaction.enabled(true); else - jumpintobackaction.state = "disabled"; + jumpintobackaction.enabled(false); } function codeStr(stateIndex) @@ -78,23 +70,13 @@ function completeCtxInformation(state) basicInfo.mem = state.newMemSize + " " + qsTr("words"); basicInfo.stepCost = state.gasCost; basicInfo.gasSpent = debugStates[0].gas - state.gas; - // This is available in all editors. + stack.listModel = state.debugStack; storage.listModel = state.debugStorage; memoryDump.listModel = state.debugMemory; callDataDump.listModel = state.debugCallData; } -function endOfDebug() -{ - var state = debugStates[debugStates.length - 1]; - debugStorageTxt.text = ""; - debugCallDataTxt.text = ""; - debugStackTxt.text = ""; - debugMemoryTxt.text = state.endOfDebug; - headerInfoLabel.text = "EXIT | GAS: " + state.gasLeft; -} - function displayReturnValue() { headerReturnList.model = contractCallReturnParameters; @@ -107,8 +89,8 @@ function stepOutBack() { select(jumpStartingPoint); jumpStartingPoint = null; - jumpoutbackaction.state = "disabled"; - jumpoutforwardaction.state = "disabled"; + jumpoutbackaction.enabled(false); + jumpoutforwardaction.enabled(false); } } @@ -162,8 +144,8 @@ function stepIntoForward() { jumpStartingPoint = currentSelectedState; moveSelection(1); - jumpoutbackaction.state = ""; - jumpoutforwardaction.state = ""; + jumpoutbackaction.enabled(true); + jumpoutforwardaction.enabled(true); } } @@ -173,8 +155,8 @@ function stepOutForward() { stepOutBack(); stepOverForward(); - jumpoutbackaction.state = "disabled"; - jumpoutforwardaction.state = "disabled"; + jumpoutbackaction.enabled(false); + jumpoutforwardaction.enabled(false); } }