Compare commits
No commits in common. "f241ad0f092207e0eed6a916c1c03e3002a38e04" and "ce52d1970c4a22c0ad4d52709e18af13a8e9fcdc" have entirely different histories.
f241ad0f09
...
ce52d1970c
1 changed files with 9 additions and 78 deletions
|
@ -3,38 +3,25 @@ import QtQuick.Controls 2.15 as Controls
|
|||
import QtQuick.Layouts 1.15
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
|
||||
|
||||
|
||||
|
||||
Kirigami.ApplicationWindow {
|
||||
id: root
|
||||
title: i18nc("@title:window", "HelloWorld")
|
||||
|
||||
function getDate(date) {
|
||||
return i18n("%1 days", Math.round((date-Date.now())/86400000))
|
||||
}
|
||||
|
||||
globalDrawer: Kirigami.GlobalDrawer {
|
||||
isMenu: true
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Quit")
|
||||
icon.name: "gtk-quit"
|
||||
shortcut: StandardKey.Quit
|
||||
onTriggered: Qt.quit()
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: kountdownModel
|
||||
ListElement {
|
||||
name: "Meow"
|
||||
description: "Meowy!"
|
||||
date: 420
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: kountdownDelegate
|
||||
Kirigami.AbstractCard {
|
||||
contentItem: Item {
|
||||
|
||||
implicitWidth: delegateLayout.implicitWidth
|
||||
implicitHeight: delegateLayout.implicitHeight
|
||||
GridLayout {
|
||||
id: delegateLayout
|
||||
anchors {
|
||||
|
@ -49,7 +36,7 @@ Kirigami.ApplicationWindow {
|
|||
Kirigami.Heading {
|
||||
Layout.fillHeight: true
|
||||
level: 1
|
||||
text: getDate(date)
|
||||
text: (date < 100000) ? date : i18n("%1 days", Math.round((date-Date.now()/86400000)))
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
|
@ -76,68 +63,12 @@ Kirigami.ApplicationWindow {
|
|||
text: i18n("Edit")
|
||||
}
|
||||
}
|
||||
|
||||
implicitWidth: delegateLayout.implicitWidth
|
||||
implicitHeight: delegateLayout.implicitHeight
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Kirigami.OverlaySheet {
|
||||
id: addSheet
|
||||
header: Kirigami.Heading {
|
||||
text: i18nc("@title:window", "Add meowdown")
|
||||
}
|
||||
Kirigami.FormLayout {
|
||||
Controls.TextField {
|
||||
id: nameField
|
||||
Kirigami.FormData.label: i18nc("@label:textbox", "Name:")
|
||||
placeholderText: i18n("Event Name (susquired)")
|
||||
onAccepted: descriptionField.forceActiveFocus()
|
||||
}
|
||||
Controls.TextField {
|
||||
id: descriptionField
|
||||
Kirigami.FormData.label: i18nc("@label:textbox", "Description:")
|
||||
placeholderText: i18n("Optional")
|
||||
onAccepted: dateField.forceActiveFocus()
|
||||
}
|
||||
Controls.TextField {
|
||||
id: dateField
|
||||
Kirigami.FormData.label: i18nc("@label:textbox", "Date:")
|
||||
placeholderText: i18n("YYYY-MM-DD")
|
||||
inputMask: "0000-00-00"
|
||||
}
|
||||
Controls.Button {
|
||||
id: doneButton
|
||||
Layout.fillWidth: true
|
||||
text: i18nc("@action:button", "Done")
|
||||
enabled: nameField.text.length > 0
|
||||
onClicked: {
|
||||
kountdownModel.append({
|
||||
name: nameField.text,
|
||||
description: descriptionField.text,
|
||||
date: Date.parse(dateField.text)
|
||||
})
|
||||
nameField.text = ""
|
||||
descriptionField.text = ""
|
||||
dateField.text = ""
|
||||
addSheet.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pageStack.initialPage: Kirigami.ScrollablePage {
|
||||
title: i18nc("@title", "Meowdown")
|
||||
|
||||
actions.main: Kirigami.Action {
|
||||
id: addAction
|
||||
icon.name: "list-add"
|
||||
text: i18nc("@action:button", "add meowdown")
|
||||
onTriggered: addSheet.open()
|
||||
}
|
||||
|
||||
title: i18nc("@title", "Kountdown")
|
||||
Kirigami.CardsListView {
|
||||
id: cardsView
|
||||
model: kountdownModel
|
||||
|
|
Loading…
Reference in a new issue