2024-05-29 11:10:19 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2023-01-04 16:05:07 +00:00
|
|
|
|
|
|
|
import Monitoring 1.0
|
2024-05-29 11:10:19 +00:00
|
|
|
import Qt.labs.settings 1.0
|
2023-01-04 16:05:07 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
import AppLayouts.Wallet.stores 1.0 as WalletStores
|
2023-01-04 16:05:07 +00:00
|
|
|
|
|
|
|
Component {
|
2024-05-29 11:10:19 +00:00
|
|
|
ColumnLayout {
|
|
|
|
spacing: 0
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
Settings {
|
|
|
|
property alias tabIndex: tabBar.currentIndex
|
|
|
|
property alias modelObjectName: objectNameTextFiled.text
|
|
|
|
}
|
|
|
|
|
|
|
|
TabBar {
|
|
|
|
id: tabBar
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.bottomMargin: 10
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
TabButton {
|
|
|
|
text: "Context properties inspection"
|
|
|
|
}
|
|
|
|
TabButton {
|
|
|
|
text: "Models inspection"
|
2023-01-13 13:36:12 +00:00
|
|
|
}
|
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
currentIndex: swipeView.currentIndex
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
StackLayout {
|
|
|
|
id: swipeView
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
currentIndex: tabBar.currentIndex
|
|
|
|
//anchors.fill: parent
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
SplitView {
|
|
|
|
id: root
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
ColumnLayout {
|
|
|
|
SplitView.fillHeight: true
|
|
|
|
SplitView.preferredWidth: 450
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
spacing: 5
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
Label {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.margins: 5
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
text: "Context properties:"
|
|
|
|
font.bold: true
|
2023-01-13 13:36:12 +00:00
|
|
|
}
|
2023-01-04 16:05:07 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
ListView {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.margins: 5
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
model: Monitor.contexPropertiesModel
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
clip: true
|
|
|
|
spacing: 5
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
delegate: Item {
|
|
|
|
implicitWidth: delegateRow.implicitWidth
|
|
|
|
implicitHeight: delegateRow.implicitHeight
|
2023-01-04 16:05:07 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
readonly property var contextPropertyValue:
|
2024-10-31 22:52:08 +00:00
|
|
|
MonitorUtils.contextPropertyBindingHelper(name, this).value
|
2023-01-04 16:05:07 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
Row {
|
|
|
|
id: delegateRow
|
2023-01-04 16:05:07 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
Label {
|
|
|
|
text: name
|
|
|
|
}
|
2024-04-26 07:43:24 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
Label {
|
|
|
|
text: ` [${MonitorUtils.typeName(contextPropertyValue)}]`
|
|
|
|
color: "darkgreen"
|
|
|
|
}
|
2023-01-04 16:05:07 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
Label {
|
|
|
|
text: ` (${MonitorUtils.valueToString(contextPropertyValue)})`
|
|
|
|
color: "darkred"
|
|
|
|
}
|
|
|
|
}
|
2023-01-04 16:05:07 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
2024-04-26 07:43:24 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
onClicked: {
|
|
|
|
inspectionStackView.clear()
|
2024-10-31 22:52:08 +00:00
|
|
|
headerModel.clear()
|
2023-01-04 16:05:07 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
const props = {
|
|
|
|
name: name,
|
|
|
|
objectForInspection: contextPropertyValue
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
inspectionStackView.push(inspectionList, props)
|
2024-10-31 22:52:08 +00:00
|
|
|
headerModel.append({ name })
|
2024-05-29 11:10:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-04-26 07:43:24 +00:00
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
}
|
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
Component {
|
|
|
|
id: modelInspectionComponent
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
ModelInspectionPane {}
|
2023-01-13 13:36:12 +00:00
|
|
|
}
|
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
Component {
|
|
|
|
id: inspectionList
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
ListView {
|
2024-05-29 11:10:19 +00:00
|
|
|
property var objectForInspection
|
|
|
|
property string name
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
ScrollBar.vertical: ScrollBar {}
|
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
onObjectForInspectionChanged: {
|
|
|
|
inspectionModel.clear()
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
if (!objectForInspection)
|
|
|
|
return
|
2024-04-26 07:43:24 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
const items = []
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
for (const property in objectForInspection) {
|
|
|
|
const type = typeof objectForInspection[property]
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
if (type === "function") {
|
|
|
|
items.push({
|
|
|
|
name: property,
|
|
|
|
category: "functions",
|
|
|
|
isModel: false,
|
|
|
|
type: type
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
const value = objectForInspection[property]
|
|
|
|
const detailedType = MonitorUtils.typeName(value)
|
|
|
|
const isModel = Monitor.isModel(value)
|
2024-04-26 07:43:24 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
items.push({
|
|
|
|
name: property,
|
|
|
|
type: detailedType,
|
|
|
|
category: isModel? "models" : "properties",
|
|
|
|
isModel: isModel
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
items.sort((a, b) => {
|
|
|
|
const nameA = a.category
|
|
|
|
const nameB = b.category
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
if (nameA === nameB)
|
|
|
|
return 0
|
2024-04-26 07:43:24 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
if (nameA === "models")
|
|
|
|
return -1
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
if (nameB === "models")
|
|
|
|
return 1
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
if (nameA < nameB)
|
|
|
|
return -1
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
if (nameA > nameB)
|
|
|
|
return 1
|
|
|
|
})
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
inspectionModel.append(items)
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
anchors.fill: parent
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
spacing: 5
|
|
|
|
clip: true
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
model: ListModel {
|
|
|
|
id: inspectionModel
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
delegate: Item {
|
|
|
|
implicitWidth: delegateRow.implicitWidth
|
|
|
|
implicitHeight: delegateRow.implicitHeight
|
2024-04-26 07:43:24 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
Row {
|
|
|
|
id: delegateRow
|
2024-04-26 07:43:24 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
readonly property var object: objectForInspection[name]
|
|
|
|
|
|
|
|
Label {
|
|
|
|
text: name
|
2024-05-29 11:10:19 +00:00
|
|
|
}
|
2024-04-26 07:43:24 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
Loader {
|
|
|
|
active: type !== "function"
|
|
|
|
sourceComponent: Label {
|
|
|
|
text: ` [${type}]`
|
|
|
|
color: "darkgreen"
|
|
|
|
}
|
|
|
|
}
|
2024-04-26 07:43:24 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
Loader {
|
|
|
|
active: type !== "function"
|
|
|
|
sourceComponent: Label {
|
|
|
|
text: ` (${MonitorUtils.valueToString(delegateRow.object)})`
|
|
|
|
color: "darkred"
|
|
|
|
}
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
Loader {
|
|
|
|
active: isModel
|
|
|
|
sourceComponent: Label {
|
|
|
|
text: `, ${delegateRow.object.rowCount()} items`
|
|
|
|
color: "darkred"
|
|
|
|
font.bold: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
onClicked: {
|
|
|
|
if (isModel) {
|
|
|
|
const props = {
|
|
|
|
name: name,
|
|
|
|
model: objectForInspection[name]
|
2023-01-13 13:36:12 +00:00
|
|
|
}
|
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
inspectionStackView.push(modelInspectionComponent,
|
|
|
|
props, StackView.Immediate)
|
|
|
|
headerModel.append({ name })
|
|
|
|
} else if (type !== "function") {
|
|
|
|
const props = {
|
|
|
|
name: name,
|
|
|
|
objectForInspection: objectForInspection[name]
|
2024-04-26 07:43:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
inspectionStackView.push(inspectionList, props, StackView.Immediate)
|
|
|
|
headerModel.append({ name })
|
2023-01-13 13:36:12 +00:00
|
|
|
}
|
2024-10-31 22:52:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
section.property: "category"
|
|
|
|
section.delegate: Pane {
|
|
|
|
leftPadding: 0
|
|
|
|
|
|
|
|
Label {
|
|
|
|
text: section
|
|
|
|
font.bold: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
Pane {
|
|
|
|
SplitView.fillHeight: true
|
|
|
|
SplitView.minimumWidth: 100
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: false
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
RoundButton {
|
|
|
|
text: "⬅️"
|
|
|
|
|
|
|
|
visible: headerRepeater.count > 1
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
inspectionStackView.pop(StackView.Immediate)
|
|
|
|
headerModel.remove(headerModel.count - 1)
|
2024-05-29 11:10:19 +00:00
|
|
|
}
|
2024-10-31 22:52:08 +00:00
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
Repeater {
|
|
|
|
id: headerRepeater
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
model: ListModel {
|
|
|
|
id: headerModel
|
|
|
|
}
|
|
|
|
|
|
|
|
delegate: TextInput {
|
|
|
|
readonly property bool last: headerRepeater.count - 1 === index
|
|
|
|
|
|
|
|
text: model.name + (last ? "" : " -> ")
|
|
|
|
font.pixelSize: 20
|
|
|
|
font.bold: true
|
|
|
|
|
|
|
|
selectByMouse: true
|
|
|
|
readOnly: true
|
2023-01-13 13:36:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
MenuSeparator {
|
|
|
|
visible: headerRepeater.count
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-10-31 22:52:08 +00:00
|
|
|
StackView {
|
|
|
|
id: inspectionStackView
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
}
|
2024-05-29 11:10:19 +00:00
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-06-28 08:41:51 +00:00
|
|
|
Pane {
|
2023-01-13 13:36:12 +00:00
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
RowLayout {
|
|
|
|
Layout.fillHeight: false
|
2023-01-13 13:36:12 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
Label {
|
|
|
|
text: "Model's object name:"
|
|
|
|
}
|
|
|
|
|
|
|
|
TextField {
|
|
|
|
id: objectNameTextFiled
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-06-28 08:41:51 +00:00
|
|
|
Layout.fillWidth: true
|
2024-05-29 11:10:19 +00:00
|
|
|
|
|
|
|
selectByMouse: true
|
2024-06-28 08:41:51 +00:00
|
|
|
onAccepted: searchButton.clicked()
|
2024-05-29 11:10:19 +00:00
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
Button {
|
2024-06-28 08:41:51 +00:00
|
|
|
id: searchButton
|
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
text: "Search"
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
onClicked: {
|
2024-06-28 08:41:51 +00:00
|
|
|
const roots = [
|
|
|
|
applicationWindow,
|
2024-10-02 21:02:57 +00:00
|
|
|
WalletStores.RootStore
|
2024-06-28 08:41:51 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
let obj = null
|
|
|
|
|
|
|
|
for (let root of roots) {
|
|
|
|
obj = Monitor.findChild(root, objectNameTextFiled.text)
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-06-28 08:41:51 +00:00
|
|
|
if (obj)
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!obj) {
|
|
|
|
objLabel.objStr = "Model not found"
|
|
|
|
rolesModelContent.model = null
|
2024-05-29 11:10:19 +00:00
|
|
|
return
|
2023-01-13 13:36:12 +00:00
|
|
|
}
|
|
|
|
|
2024-06-28 08:41:51 +00:00
|
|
|
if (!Monitor.isModel(obj)) {
|
|
|
|
objLabel.objStr = "Found object is not a model"
|
|
|
|
rolesModelContent.model = null
|
|
|
|
return
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-06-28 08:41:51 +00:00
|
|
|
objLabel.objStr = obj.toString()
|
2024-05-29 11:10:19 +00:00
|
|
|
rolesModelContent.model = obj
|
2023-01-13 13:36:12 +00:00
|
|
|
}
|
2024-05-29 11:10:19 +00:00
|
|
|
}
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
Label {
|
|
|
|
id: objLabel
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
property string objStr
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
visible: objStr !== ""
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
text: "Object: " + objStr
|
|
|
|
}
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
ModelInspectionPane {
|
|
|
|
id: rolesModelContent
|
2023-01-13 13:36:12 +00:00
|
|
|
|
2024-05-29 11:10:19 +00:00
|
|
|
showControls: false
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2023-01-13 13:36:12 +00:00
|
|
|
}
|
|
|
|
}
|
2023-01-04 16:05:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|