You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

502 lines
11 KiB

import QtQuick 2.2
import QtQuick.Controls.Styles 1.1
import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.1
import QtQuick.Layouts 1.1
import "js/Debugger.js" as Debugger
10 years ago
import "js/ErrorLocationFormater.js" as ErrorLocationFormater
Rectangle {
10 years ago
id: debugPanel
objectName: "debugPanel"
anchors.fill: parent;
10 years ago
color: "#ededed"
clip: true
10 years ago
Keys.onPressed:
{
if (event.key === Qt.Key_F10)
Debugger.moveSelection(1);
else if (event.key === Qt.Key_F9)
Debugger.moveSelection(-1);
}
function update()
10 years ago
{
if (statusPane.result.successful)
10 years ago
{
Debugger.init();
debugScrollArea.visible = true;
compilationErrorArea.visible = false;
machineStates.visible = true;
}
else
{
debugScrollArea.visible = false;
compilationErrorArea.visible = true;
machineStates.visible = false;
var errorInfo = ErrorLocationFormater.extractErrorInfo(statusPane.result.compilerMessage, false);
10 years ago
errorLocation.text = errorInfo.errorLocation;
errorDetail.text = errorInfo.errorDetail;
errorLine.text = errorInfo.errorLine;
}
}
Connections {
target: codeModel
onCompilationComplete: update()
10 years ago
}
10 years ago
Rectangle
{
visible: false;
id: compilationErrorArea
width: parent.width - 20
height: 500
color: "#ededed"
anchors.left: parent.left
anchors.top: parent.top
anchors.margins: 10
ColumnLayout
{
width: parent.width
anchors.top: parent.top
10 years ago
spacing: 25
RowLayout
{
height: 100
Image {
id: compileFailed
source: "qrc:/qml/img/compilfailed.png"
}
ColumnLayout
{
Text {
color: "red"
id: errorLocation
}
Text {
color: "#4a4a4a"
id: errorDetail
}
}
}
10 years ago
Rectangle
{
width: parent.width - 6
height: 2
color: "#d0d0d0"
}
10 years ago
RowLayout
{
Text
{
color: "#4a4a4a"
id: errorLine
}
}
}
10 years ago
}
10 years ago
Flickable {
property int firstColumnWidth: 170
property int secondColumnWidth: 250
10 years ago
id: debugScrollArea
flickableDirection: Flickable.VerticalFlick
anchors.fill: parent
contentHeight: machineStates.height + 300
10 years ago
contentWidth: machineStates.width
GridLayout
{
property int sideMargin: 10
id: machineStates
anchors.top: parent.top
anchors.topMargin: 15
10 years ago
anchors.left: parent.left;
anchors.leftMargin: machineStates.sideMargin
anchors.right: parent.right;
anchors.rightMargin: machineStates.sideMargin
flow: GridLayout.TopToBottom
rowSpacing: 15
RowLayout {
// step button + slider
spacing: machineStates.sideMargin
10 years ago
height: 27
width: debugPanel.width
Rectangle
{
10 years ago
height: parent.height
color: "transparent"
width: debugScrollArea.firstColumnWidth
RowLayout {
anchors.horizontalCenter: parent.horizontalCenter
id: jumpButtons
spacing: 3
StepActionImage
{
id: jumpoutbackaction;
enabledStateImg: "qrc:/qml/img/jumpoutback.png"
disableStateImg: "qrc:/qml/img/jumpoutbackdisabled.png"
onClicked: Debugger.stepOutBack()
}
10 years ago
StepActionImage
{
id: jumpintobackaction
enabledStateImg: "qrc:/qml/img/jumpintoback.png"
disableStateImg: "qrc:/qml/img/jumpintobackdisabled.png"
onClicked: Debugger.stepIntoBack()
}
10 years ago
StepActionImage
{
id: jumpoverbackaction
enabledStateImg: "qrc:/qml/img/jumpoverback.png"
disableStateImg: "qrc:/qml/img/jumpoverbackdisabled.png"
onClicked: Debugger.stepOverBack()
}
10 years ago
StepActionImage
{
id: jumpoverforwardaction
enabledStateImg: "qrc:/qml/img/jumpoverforward.png"
disableStateImg: "qrc:/qml/img/jumpoverforwarddisabled.png"
onClicked: Debugger.stepOverForward()
}
10 years ago
StepActionImage
{
id: jumpintoforwardaction
enabledStateImg: "qrc:/qml/img/jumpintoforward.png"
disableStateImg: "qrc:/qml/img/jumpintoforwarddisabled.png"
onClicked: Debugger.stepIntoForward()
}
10 years ago
StepActionImage
{
id: jumpoutforwardaction
enabledStateImg: "qrc:/qml/img/jumpoutforward.png"
disableStateImg: "qrc:/qml/img/jumpoutforwarddisabled.png"
onClicked: Debugger.stepOutForward()
}
10 years ago
}
}
Rectangle {
color: "transparent"
width: debugScrollArea.secondColumnWidth
10 years ago
height: parent.height
Slider {
id: statesSlider
anchors.fill: parent
tickmarksEnabled: true
stepSize: 1.0
onValueChanged: Debugger.jumpTo(value);
style: SliderStyle {
groove: Rectangle {
implicitHeight: 3
color: "#7da4cd"
radius: 8
}
handle: Rectangle {
anchors.centerIn: parent
color: control.pressed ? "white" : "lightgray"
border.color: "gray"
border.width: 2
implicitWidth: 10
implicitHeight: 10
radius: 12
}
}
}
}
}
10 years ago
RowLayout {
// Assembly code
width: debugPanel.width
height: 405
spacing: machineStates.sideMargin
10 years ago
Rectangle
{
width: debugScrollArea.firstColumnWidth
10 years ago
height: parent.height
border.width: 3
border.color: "#deddd9"
color: "white"
anchors.top: parent.top
10 years ago
ListView {
anchors.fill: parent
anchors.leftMargin: 3
anchors.rightMargin: 3
10 years ago
anchors.topMargin: 3
anchors.bottomMargin: 3
clip: true
id: statesList
delegate: renderDelegate
highlight: highlightBar
highlightFollowsCurrentItem: true
}
Component {
id: highlightBar
Rectangle {
radius: 4
10 years ago
height: statesList.currentItem.height
width: statesList.currentItem.width;
color: "#4A90E2"
10 years ago
Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } }
}
}
Component {
id: renderDelegate
RowLayout {
10 years ago
id: wrapperItem
height: 20
width: parent.width
spacing: 5
Text {
anchors.left: parent.left
anchors.leftMargin: 10
width: 15
color: "#b2b3ae"
text: line.split(' ')[0]
font.pointSize: 9
id: id
wrapMode: Text.NoWrap
}
10 years ago
Text {
wrapMode: Text.NoWrap
10 years ago
color: parent.ListView.isCurrentItem ? "white" : "black"
text: line.replace(line.split(' ')[0], '')
anchors.left: id.right
10 years ago
font.pointSize: 9
}
}
}
}
ColumnLayout {
width: debugScrollArea.secondColumnWidth
10 years ago
height: parent.height
Rectangle {
// Info
width: parent.width
id: basicInfoColumn
height: 125
10 years ago
color: "transparent"
ColumnLayout {
spacing: 0
width: parent.width
height: parent.height
DebugBasicInfo {
id: currentStep
titleStr: qsTr("Current step")
}
DebugBasicInfo {
id: mem
titleStr: qsTr("Adding memory")
}
DebugBasicInfo {
id: stepCost
titleStr: qsTr("Step cost")
}
DebugBasicInfo {
id: gasSpent
titleStr: qsTr("Total gas spent")
}
10 years ago
}
}
Rectangle {
// Stack
height: 275
10 years ago
width: parent.width
color: "transparent"
DebugInfoList
{
10 years ago
id: stack
width: parent.width
height: parent.height
collapsible: false
10 years ago
title : qsTr("Stack")
itemDelegate: Item {
id: renderedItem
height: 27
width: parent.width
RowLayout
{
anchors.fill: parent
Rectangle
{
id: indexColumn
color: "#f7f7f7"
Layout.fillWidth: true
Layout.minimumWidth: 30
Layout.preferredWidth: 30
Layout.maximumWidth: 30
Layout.minimumHeight: parent.height
Text {
anchors.centerIn: parent
anchors.leftMargin: 5
color: "#8b8b8b"
text: model.index;
font.pointSize: 9
}
}
Rectangle
{
anchors.left: indexColumn.right
Layout.fillWidth: true
Layout.minimumWidth: 15
Layout.preferredWidth: 15
Layout.maximumWidth: 60
Layout.minimumHeight: parent.height
Text {
anchors.left: parent.left
anchors.leftMargin: 5
anchors.verticalCenter: parent.verticalCenter
color: "#8b8b8b"
text: modelData
font.pointSize: 9
}
}
}
Rectangle {
id: separator
width: parent.width;
height: 1;
color: "#cccccc"
anchors.bottom: parent.bottom
}
}
10 years ago
}
}
}
}
10 years ago
Rectangle {
width: debugPanel.width - 2 * machineStates.sideMargin
height: 2;
color: "#e3e3e3"
radius: 3
}
10 years ago
DebugInfoList
{
10 years ago
id: storage
width: debugPanel.width - 2 * machineStates.sideMargin
height: 223
collapsible: true
10 years ago
title : qsTr("Storage")
itemDelegate:
Item {
height: 27
width: parent.width;
RowLayout
{
id: row
width: parent.width
height: 26
Rectangle
{
color: "#f7f7f7"
Layout.fillWidth: true
Layout.minimumWidth: parent.width / 2
Layout.preferredWidth: parent.width / 2
Layout.maximumWidth: parent.width / 2
Layout.minimumHeight: parent.height
Layout.maximumHeight: parent.height
Text {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 5
color: "#8b8b8b"
text: modelData.split(' ')[0].substring(0, 10);
font.pointSize: 9
}
}
Rectangle
{
color: "transparent"
Layout.fillWidth: true
Layout.minimumWidth: parent.width / 2
Layout.preferredWidth: parent.width / 2
Layout.maximumWidth: parent.width / 2
Layout.minimumHeight: parent.height
Layout.maximumHeight: parent.height
Text {
anchors.leftMargin: 5
width: parent.width - 5
wrapMode: Text.Wrap
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
color: "#8b8b8b"
text: modelData.split(' ')[1].substring(0, 10);
font.pointSize: 9
}
}
}
Rectangle {
anchors.top: row.bottom
width: parent.width;
height: 1;
color: "#cccccc"
anchors.bottom: parent.bottom
}
}
}
10 years ago
Rectangle {
width: debugPanel.width - 2 * machineStates.sideMargin
height: 2;
color: "#e3e3e3"
radius: 3
}
10 years ago
DebugInfoList {
10 years ago
id: memoryDump
width: debugPanel.width - 2 * machineStates.sideMargin
height: 223
collapsible: true
10 years ago
title: qsTr("Memory Dump")
itemDelegate:
Item {
height: 29
width: parent.width - 3;
ItemDelegateDataDump {}
}
}
10 years ago
Rectangle {
width: debugPanel.width - 2 * machineStates.sideMargin
height: 2;
color: "#e3e3e3"
radius: 3
}
10 years ago
DebugInfoList {
10 years ago
id: callDataDump
width: debugPanel.width - 2 * machineStates.sideMargin
height: 223
collapsible: true
10 years ago
title: qsTr("Call data")
itemDelegate:
Item {
height: 29
width: parent.width - 3;
ItemDelegateDataDump {}
}
}
}
}
}