magpie/qml/Application/Main.qml

86 lines
2.3 KiB
QML
Raw Normal View History

// SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Item {
2024-01-17 21:57:34 +00:00
signal addAsset
property string currentPage: "home"
RowLayout {
anchors.fill: parent
Column {
id: menu
Layout.fillWidth: true
Layout.minimumWidth: 50
Layout.preferredWidth: 100
Layout.maximumWidth: 100
Layout.alignment: Qt.AlignTop
MenuItem {
width: parent.width
text: qsTr("Home")
icon.name: "home"
highlighted: currentPage === "home"
onTriggered: {
if (!this.highlighted)
content.replace(home)
}
}
MenuItem {
width: parent.width
text: qsTr("Assets")
icon.name: "document-properties"
highlighted: currentPage === "assets"
onTriggered: {
if (!this.highlighted)
content.replace(assets)
}
}
MenuItem {
width: parent.width
text: qsTr("Records")
icon.name: "system-search"
highlighted: currentPage === "records"
onTriggered: {
if (!this.highlighted)
content.replace(records)
}
}
}
StackView {
id: content
initialItem: home
2024-01-17 21:57:34 +00:00
clip: true
Layout.fillWidth: true
Layout.fillHeight: true
Component {
id: home
Home {
StackView.onActivating: currentPage = "home"
}
}
Component {
id: assets
Assets {
StackView.onActivating: currentPage = "assets"
2024-01-17 21:57:34 +00:00
onAdd: addAsset()
}
}
Component {
id: records
Records {
StackView.onActivating: currentPage = "records"
}
}
}
}
}