95 lines
2.1 KiB
QML
95 lines
2.1 KiB
QML
import QtQuick 2.15
|
|
import QtQuick.Window 2.15
|
|
import QtQuick.Controls 2.15
|
|
import QtQuick.Layouts 1.15
|
|
import QtWebSockets
|
|
|
|
import ru.ded.beerlog 1.0
|
|
import "Components"
|
|
|
|
ApplicationWindow {
|
|
width: 640
|
|
height: 480
|
|
visible: true
|
|
title: qsTr("Beer Log")
|
|
|
|
header: ToolBar {
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
MenuBackButton {
|
|
state: "menu"//stackView.depth > 1 ? "back" : "menu"
|
|
onClicked: drawer.open()
|
|
onBack: {
|
|
state = "menu"
|
|
}
|
|
}
|
|
ToolButton {
|
|
text: usersModel.selectedUserName
|
|
Layout.fillWidth: true
|
|
onClicked: usersMenu.open()
|
|
}
|
|
}
|
|
|
|
Menu {
|
|
id: usersMenu
|
|
|
|
UsersViewModel {
|
|
id: usersModel
|
|
}
|
|
|
|
Repeater {
|
|
model: usersModel.users
|
|
|
|
MenuItem {
|
|
text: modelData.name
|
|
|
|
onClicked: {
|
|
usersModel.selectedUser = modelData.id
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Drawer {
|
|
id: drawer
|
|
|
|
width: parent.width * 0.66
|
|
height: parent.height
|
|
|
|
Column {
|
|
anchors.fill: parent
|
|
|
|
Row {
|
|
width: parent.width
|
|
height: 100
|
|
|
|
Image {
|
|
anchors.top: parent.top
|
|
anchors.bottom: parent.bottom
|
|
anchors.margins: 10
|
|
source: "logo.png"
|
|
}
|
|
|
|
Label {
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
font.pointSize: 20
|
|
text: qsTr("BeerLog v0.1")
|
|
}
|
|
}
|
|
|
|
ItemDelegate {
|
|
text: qsTr("Settings")
|
|
width: parent.width
|
|
onClicked: stackView.openPage("SettingsForm.qml")
|
|
}
|
|
|
|
ItemDelegate {
|
|
text: qsTr("Quit")
|
|
width: parent.width
|
|
onClicked: Qt.quit()
|
|
}
|
|
}
|
|
}
|
|
}
|