2024-01-10 19:27:03 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
2024-01-18 22:14:33 +00:00
|
|
|
import QtQuick.Layouts
|
2024-04-08 22:46:26 +00:00
|
|
|
import Qt.labs.qmlmodels
|
2024-01-10 19:27:03 +00:00
|
|
|
|
2024-01-20 21:17:21 +00:00
|
|
|
import magpie
|
2024-01-18 22:14:33 +00:00
|
|
|
import magpie.Components as Components
|
2024-01-17 21:57:34 +00:00
|
|
|
|
2024-01-10 19:27:03 +00:00
|
|
|
Item {
|
2024-04-07 20:07:52 +00:00
|
|
|
signal add()
|
|
|
|
signal edit(id: int)
|
|
|
|
signal remove(id: int)
|
|
|
|
|
|
|
|
id: item
|
2024-01-17 21:57:34 +00:00
|
|
|
|
2024-01-18 22:14:33 +00:00
|
|
|
ColumnLayout {
|
|
|
|
id: column
|
2024-01-17 21:57:34 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
Label {
|
2024-01-18 22:14:33 +00:00
|
|
|
id: label
|
2024-04-08 22:46:26 +00:00
|
|
|
text: "Assets"
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2024-01-17 21:57:34 +00:00
|
|
|
font {
|
|
|
|
pixelSize: 24
|
|
|
|
bold: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ListView {
|
2024-01-18 22:14:33 +00:00
|
|
|
id: listView
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
2024-01-20 21:17:21 +00:00
|
|
|
model: Magpie.assets
|
|
|
|
spacing: 5
|
2024-04-08 22:46:26 +00:00
|
|
|
|
2024-01-18 22:14:33 +00:00
|
|
|
delegate: Components.AssetLine {
|
2024-04-08 22:46:26 +00:00
|
|
|
height: 40
|
2024-01-20 21:17:21 +00:00
|
|
|
width: listView.width
|
2024-04-07 20:07:52 +00:00
|
|
|
|
|
|
|
onRemove: id => item.remove(id)
|
|
|
|
onEdit: id => item.edit(id)
|
2024-01-17 21:57:34 +00:00
|
|
|
}
|
2024-04-08 22:46:26 +00:00
|
|
|
|
|
|
|
// model: TableModel {
|
|
|
|
// TableModelColumn { display: "icon"; decoration: "color" }
|
|
|
|
// TableModelColumn { display: "title" }
|
|
|
|
// TableModelColumn { display: "balance" }
|
|
|
|
// TableModelColumn { display: "currency" }
|
|
|
|
// TableModelColumn { display: "assetID" }
|
|
|
|
// TableModelColumn { display: "assetID" }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// delegate: DelegateChooser {
|
|
|
|
// property int iconSize: 40
|
|
|
|
|
|
|
|
// DelegateChoice {
|
|
|
|
// column: 0
|
|
|
|
// delegate: Rectangle {
|
|
|
|
// implicitWidth: iconSize
|
|
|
|
// implicitHeight: iconSize
|
|
|
|
// color: model.decoration
|
|
|
|
|
|
|
|
// Components.Icon {
|
|
|
|
// anchors.fill: parent
|
|
|
|
// anchors.margins: 2
|
|
|
|
// iconName: model.display
|
|
|
|
// color: pickColor(model.decoration)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// DelegateChoice {
|
|
|
|
// column: 1
|
|
|
|
// delegate: Label {
|
|
|
|
// text: model.display
|
|
|
|
// verticalAlignment: Text.AlignVCenter
|
|
|
|
// font.bold: true
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// DelegateChoice {
|
|
|
|
// column: 2
|
|
|
|
// delegate: Label {
|
|
|
|
// text: model.display
|
|
|
|
// verticalAlignment: Text.AlignVCenter
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// DelegateChoice {
|
|
|
|
// column: 3
|
|
|
|
// delegate: Label {
|
|
|
|
// text: model.display
|
|
|
|
// verticalAlignment: Text.AlignVCenter
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// DelegateChoice {
|
|
|
|
// column: 4
|
|
|
|
// delegate: Button {
|
|
|
|
// text: qsTr("Edit")
|
|
|
|
// icon.name: "entry-edit"
|
|
|
|
// flat: true
|
|
|
|
// onClicked: edit(model.display)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// DelegateChoice {
|
|
|
|
// column: 5
|
|
|
|
// delegate: Button {
|
|
|
|
// text: qsTr("Delete")
|
|
|
|
// icon.name: "delete"
|
|
|
|
// onClicked: remove(model.display)
|
|
|
|
// palette { //unfortunately doesn't work anymore
|
|
|
|
// button: "red"
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
2024-01-17 21:57:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
anchors {
|
|
|
|
bottom: parent.bottom
|
|
|
|
right: parent.right
|
|
|
|
bottomMargin: 20
|
|
|
|
rightMargin: 20
|
|
|
|
}
|
|
|
|
onClicked: add()
|
|
|
|
|
|
|
|
width: 50
|
|
|
|
height: 50
|
|
|
|
icon {
|
|
|
|
name: "list-add"
|
|
|
|
height: 50
|
|
|
|
width: 50
|
2024-01-10 19:27:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|