78 lines
2.1 KiB
QML
78 lines
2.1 KiB
QML
import QtQuick 2.6
|
|
import QtQuick.Controls 2.0 as Controls
|
|
import QtQuick.Layouts 1.2
|
|
import org.kde.kirigami 2.13 as Kirigami
|
|
|
|
// Base element, provides basic features needed for all kirigami applications
|
|
Kirigami.ApplicationWindow {
|
|
// ID provides unique identifier to reference this element
|
|
id: root
|
|
title: "Metar Weather"
|
|
|
|
// Initial page to be loaded on app load
|
|
pageStack.initialPage: Kirigami.Page {
|
|
actions {
|
|
main: Kirigami.Action {
|
|
icon.name: "refresh"
|
|
text: "Refresh"
|
|
onTriggered: logic.refresh()
|
|
}
|
|
right: Kirigami.Action {
|
|
icon.name: "plus"
|
|
text: "Add Airport"
|
|
onTriggered: addAirport.open()
|
|
}
|
|
}
|
|
Kirigami.CardsListView {
|
|
anchors.fill: parent
|
|
id: cardLayout
|
|
model: logic.metarList
|
|
delegate: metarListDelegate
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: metarListDelegate
|
|
Kirigami.AbstractCard {
|
|
contentItem: Item {
|
|
implicitWidth: delegateLayout.implicitWidth
|
|
implicitHeight: delegateLayout.implicitHeight
|
|
RowLayout {
|
|
id: delegateLayout
|
|
anchors {
|
|
left: parent.left
|
|
top: parent.top
|
|
right: parent.right
|
|
}
|
|
Kirigami.Heading {
|
|
text: flightCategory
|
|
}
|
|
Controls.Label {
|
|
text: rawMetar
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Kirigami.OverlaySheet {
|
|
id: addAirport
|
|
|
|
Kirigami.FormLayout {
|
|
Controls.TextField {
|
|
id: airportCode
|
|
Kirigami.FormData.label: "airport code"
|
|
}
|
|
Controls.Button {
|
|
text: "Add"
|
|
onClicked: {
|
|
logic.addAirport(airportCode.text)
|
|
addAirport.close()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|