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;
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:

2
mix/StatusPane.cpp

@ -62,5 +62,5 @@ CompilationResult* StatusPane::result() const
void StatusPane::update()
{
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;
CompilationResult* result() const;
private:
void resetOutPut();
public slots:
void update();
};

1
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;

18
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
}
}

57
mix/qml/MainContent.qml

@ -25,26 +25,20 @@ Rectangle {
debugModel.updateDebugPanel();
}
else
{
rightView.hide();
}
}
function ensureRightView()
{
if (!rightView.visible)
{
rightView.show();
}
}
function hideRightView()
{
if (rightView.visible)
{
rightView.hide();
}
}
CodeEditorExtensionManager {
headerView: headerPaneTabs;
@ -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"

48
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"
}
}
}
}
}
}

17
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
}
}
}

50
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);
}
}

Loading…
Cancel
Save