Browse Source

- fix design bug

cl-refactor
yann300 10 years ago
committed by yann300
parent
commit
25279f0f8c
  1. 2
      mix/AssemblyDebuggerControl.h
  2. 2
      mix/StatusPane.cpp
  3. 3
      mix/StatusPane.h
  4. 1
      mix/qml/Debugger.qml
  5. 18
      mix/qml/ItemDelegateDataDump.qml
  6. 57
      mix/qml/MainContent.qml
  7. 48
      mix/qml/StatusPane.qml
  8. 17
      mix/qml/StepActionImage.qml
  9. 50
      mix/qml/js/Debugger.js

2
mix/AssemblyDebuggerControl.h

@ -50,7 +50,7 @@ public:
void start() const override; void start() const override;
QString title() const override; QString title() const override;
QString contentUrl() 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(); Q_INVOKABLE void updateDebugPanel();
private: private:

2
mix/StatusPane.cpp

@ -62,5 +62,5 @@ CompilationResult* StatusPane::result() const
void StatusPane::update() void StatusPane::update()
{ {
QObject* ctrl = m_view->findChild<QObject*>("statusPane", Qt::FindChildrenRecursively); QObject* ctrl = m_view->findChild<QObject*>("statusPane", Qt::FindChildrenRecursively);
QMetaObject::invokeMethod(ctrl, "update"); QMetaObject::invokeMethod(ctrl, "updateStatus");
} }

3
mix/StatusPane.h

@ -43,9 +43,6 @@ public:
QString contentUrl() const override; QString contentUrl() const override;
CompilationResult* result() const; CompilationResult* result() const;
private:
void resetOutPut();
public slots: public slots:
void update(); void update();
}; };

1
mix/qml/Debugger.qml

@ -34,7 +34,6 @@ Rectangle {
debugScrollArea.visible = false; debugScrollArea.visible = false;
compilationErrorArea.visible = true; compilationErrorArea.visible = true;
machineStates.visible = false; machineStates.visible = false;
console.log(constantCompilation.result.compilerMessage);
var errorInfo = ErrorLocationFormater.extractErrorInfo(statusPane.result.compilerMessage, false); var errorInfo = ErrorLocationFormater.extractErrorInfo(statusPane.result.compilerMessage, false);
errorLocation.text = errorInfo.errorLocation; errorLocation.text = errorInfo.errorLocation;
errorDetail.text = errorInfo.errorDetail; errorDetail.text = errorInfo.errorDetail;

18
mix/qml/ItemDelegateDataDump.qml

@ -7,10 +7,20 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
RowLayout RowLayout
{ {
id: row;
function formatData(data, index)
{
if (data.indexOf("_separator_") !== -1)
return modelData.split("_separator_")[index];
else
return "";
}
anchors.fill: parent anchors.fill: parent
spacing: 2 spacing: 2
Rectangle Rectangle
{ {
id: firstCol;
color: "#f7f7f7" color: "#f7f7f7"
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: 35 Layout.minimumWidth: 35
@ -21,8 +31,8 @@ Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
anchors.leftMargin: 5 anchors.leftMargin: 5
color: "#8b8b8b" color: "#8b8b8b"
text: modelData.split("_separator_")[0] text: row.formatData(modelData, 0)
font.pointSize: 9 font.pointSize: 9;
} }
} }
@ -38,7 +48,7 @@ Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: "#8b8b8b" color: "#8b8b8b"
text: modelData.split("_separator_")[1] text: row.formatData(modelData, 1)
font.pointSize: 9 font.pointSize: 9
} }
} }
@ -53,7 +63,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: "#ededed" color: "#ededed"
font.bold: true font.bold: true
text: modelData.split("_separator_")[2] text: row.formatData(modelData, 2)
font.pointSize: 10 font.pointSize: 10
} }
} }

57
mix/qml/MainContent.qml

@ -25,25 +25,19 @@ Rectangle {
debugModel.updateDebugPanel(); debugModel.updateDebugPanel();
} }
else else
{
rightView.hide(); rightView.hide();
}
} }
function ensureRightView() function ensureRightView()
{ {
if (!rightView.visible) if (!rightView.visible)
{
rightView.show(); rightView.show();
}
} }
function hideRightView() function hideRightView()
{ {
if (rightView.visible) if (rightView.visible)
{
rightView.hide(); rightView.hide();
}
} }
CodeEditorExtensionManager { 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 { SplitView {
@ -188,7 +141,6 @@ Rectangle {
font.family: "Monospace" font.family: "Monospace"
font.pointSize: 12 font.pointSize: 12
width: parent.width width: parent.width
//anchors.centerIn: parent
tabChangesFocus: false tabChangesFocus: false
Keys.onPressed: { Keys.onPressed: {
if (event.key === Qt.Key_Tab) { if (event.key === Qt.Key_Tab) {
@ -201,13 +153,16 @@ Rectangle {
} }
Rectangle { Rectangle {
visible: false;
id: rightView;
Keys.onEscapePressed: Keys.onEscapePressed:
{ {
hide(); hide();
} }
visible: false;
id: rightView;
property real panelRelWidth: 0.38 property real panelRelWidth: 0.38
function show() { function show() {
visible = true; visible = true;
contentView.width = parent.width * (1 - 0.38) contentView.width = parent.width * (1 - 0.38)
@ -231,12 +186,10 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
style: TabViewStyle { style: TabViewStyle {
frameOverlap: 1 frameOverlap: 1
tabBar: tabBar:
Rectangle { Rectangle {
color: "#ededed" color: "#ededed"
id: background id: background
} }
tab: Rectangle { tab: Rectangle {
color: "#ededed" color: "#ededed"

48
mix/qml/StatusPane.qml

@ -4,9 +4,10 @@ import QtQuick.Layouts 1.1
import "js/ErrorLocationFormater.js" as ErrorLocationFormater import "js/ErrorLocationFormater.js" as ErrorLocationFormater
Rectangle { Rectangle {
id: constantCompilationStatus id: statusHeader
objectName: "statusPane" objectName: "statusPane"
function update()
function updateStatus()
{ {
if (statusPane.result.successfull) if (statusPane.result.successfull)
{ {
@ -23,7 +24,9 @@ Rectangle {
status.text = errorInfo.errorLocation + " " + errorInfo.errorDetail; status.text = errorInfo.errorLocation + " " + errorInfo.errorDetail;
logslink.visible = true; logslink.visible = true;
} }
debugRunActionIcon.enabled = statusPane.result.successfull;
} }
color: "transparent" color: "transparent"
anchors.fill: parent anchors.fill: parent
Rectangle { 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"
}
}
}
}
}
} }

17
mix/qml/StepActionImage.qml

@ -9,6 +9,16 @@ Rectangle {
property string disableStateImg property string disableStateImg
property string enabledStateImg property string enabledStateImg
signal clicked signal clicked
function enabled(state)
{
buttonAction.enabled = state;
if (state)
debugImg.iconSource = enabledStateImg;
else
debugImg.iconSource = disableStateImg;
}
width: 15 width: 15
height: 15 height: 15
color: "transparent" color: "transparent"
@ -34,12 +44,5 @@ Rectangle {
onTriggered: { onTriggered: {
buttonActionContainer.clicked(); buttonActionContainer.clicked();
} }
enabled: codeModel.hasContract && !debugModel.running;
onEnabledChanged: {
if (enabled)
iconSource = enabledStateImg
else
iconSource = disableStateImg
}
} }
} }

50
mix/qml/js/Debugger.js

@ -17,11 +17,10 @@ function init()
select(currentSelectedState); select(currentSelectedState);
//displayReturnValue(); //displayReturnValue();
jumpoutbackaction.state = "disabled"; jumpoutbackaction.enabled(false);
jumpintobackaction.state = "disabled"; jumpintobackaction.enabled(false);
jumpintoforwardaction.state = "disabled" jumpintoforwardaction.enabled(false);
jumpoutforwardaction.state = "disabled" jumpoutforwardaction.enabled(false);
} }
function moveSelection(incr) function moveSelection(incr)
@ -29,13 +28,8 @@ function moveSelection(incr)
if (currentSelectedState + incr >= 0) if (currentSelectedState + incr >= 0)
{ {
if (currentSelectedState + incr < debugStates.length) if (currentSelectedState + incr < debugStates.length)
{
select(currentSelectedState + incr); select(currentSelectedState + incr);
}
else
{
//endOfDebug();
}
statesSlider.value = currentSelectedState; statesSlider.value = currentSelectedState;
} }
} }
@ -47,18 +41,16 @@ function select(stateIndex)
highlightSelection(codeLine); highlightSelection(codeLine);
currentSelectedState = stateIndex; currentSelectedState = stateIndex;
completeCtxInformation(state); completeCtxInformation(state);
//levelList.model = state.levels;
//levelList.update();
if (state.instruction === "JUMP") if (state.instruction === "JUMP")
jumpintoforwardaction.state = ""; jumpintoforwardaction.enabled(true);
else else
jumpintoforwardaction.state = "disabled"; jumpintoforwardaction.enabled(false);
if (state.instruction === "JUMPDEST") if (state.instruction === "JUMPDEST")
jumpintobackaction.state = ""; jumpintobackaction.enabled(true);
else else
jumpintobackaction.state = "disabled"; jumpintobackaction.enabled(false);
} }
function codeStr(stateIndex) function codeStr(stateIndex)
@ -78,23 +70,13 @@ function completeCtxInformation(state)
basicInfo.mem = state.newMemSize + " " + qsTr("words"); basicInfo.mem = state.newMemSize + " " + qsTr("words");
basicInfo.stepCost = state.gasCost; basicInfo.stepCost = state.gasCost;
basicInfo.gasSpent = debugStates[0].gas - state.gas; basicInfo.gasSpent = debugStates[0].gas - state.gas;
// This is available in all editors.
stack.listModel = state.debugStack; stack.listModel = state.debugStack;
storage.listModel = state.debugStorage; storage.listModel = state.debugStorage;
memoryDump.listModel = state.debugMemory; memoryDump.listModel = state.debugMemory;
callDataDump.listModel = state.debugCallData; 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() function displayReturnValue()
{ {
headerReturnList.model = contractCallReturnParameters; headerReturnList.model = contractCallReturnParameters;
@ -107,8 +89,8 @@ function stepOutBack()
{ {
select(jumpStartingPoint); select(jumpStartingPoint);
jumpStartingPoint = null; jumpStartingPoint = null;
jumpoutbackaction.state = "disabled"; jumpoutbackaction.enabled(false);
jumpoutforwardaction.state = "disabled"; jumpoutforwardaction.enabled(false);
} }
} }
@ -162,8 +144,8 @@ function stepIntoForward()
{ {
jumpStartingPoint = currentSelectedState; jumpStartingPoint = currentSelectedState;
moveSelection(1); moveSelection(1);
jumpoutbackaction.state = ""; jumpoutbackaction.enabled(true);
jumpoutforwardaction.state = ""; jumpoutforwardaction.enabled(true);
} }
} }
@ -173,8 +155,8 @@ function stepOutForward()
{ {
stepOutBack(); stepOutBack();
stepOverForward(); stepOverForward();
jumpoutbackaction.state = "disabled"; jumpoutbackaction.enabled(false);
jumpoutforwardaction.state = "disabled"; jumpoutforwardaction.enabled(false);
} }
} }

Loading…
Cancel
Save