livello dati C++ (datastore JSON, 33 controlli) e schermate Home, scheda ordine e cover; .gitignore per gli artefatti
This commit is contained in:
+61
-7
@@ -1,7 +1,40 @@
|
||||
import QtQuick 2.2
|
||||
import Sailfish.Silica 1.0
|
||||
import "../js/henflow.js" as HF
|
||||
import "../js/i18n.js" as I18N
|
||||
import "../js/catalog.js" as Catalog
|
||||
|
||||
// Cover: produzione stimata del giorno e ordini ancora da consegnare.
|
||||
CoverBackground {
|
||||
id: cover
|
||||
|
||||
property string lang: "en"
|
||||
property real production: 0
|
||||
property int pending: 0
|
||||
|
||||
function tr(key, arg) { return I18N.t(key, arg, cover.lang) }
|
||||
|
||||
function refresh() {
|
||||
cover.lang = I18N.langFor(appSettings.language, Qt.locale().name)
|
||||
cover.production = HF.totalDailyProduction(appData.breedSettings(), Catalog.HF_BREEDS)
|
||||
|
||||
var list = appData.reservations()
|
||||
var n = 0
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
if (!list[i].isDelivered)
|
||||
n++
|
||||
}
|
||||
cover.pending = n
|
||||
}
|
||||
|
||||
Component.onCompleted: refresh()
|
||||
|
||||
// i dati cambiano quando si salvano ordini o galline
|
||||
Connections {
|
||||
target: appData
|
||||
onChanged: cover.refresh()
|
||||
}
|
||||
|
||||
Label {
|
||||
id: title
|
||||
anchors {
|
||||
@@ -9,17 +42,38 @@ CoverBackground {
|
||||
topMargin: Theme.paddingLarge
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
text: qsTr("Henflow")
|
||||
text: cover.tr("app_title")
|
||||
color: Theme.primaryColor
|
||||
}
|
||||
|
||||
Label {
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width - 2 * Theme.paddingLarge
|
||||
text: qsTr("Eggs, hens and orders")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.secondaryColor
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WordWrap
|
||||
spacing: Theme.paddingSmall
|
||||
|
||||
Label {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: cover.production.toFixed(1)
|
||||
font.pixelSize: Theme.fontSizeHuge
|
||||
color: Theme.highlightColor
|
||||
}
|
||||
|
||||
Label {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: cover.tr("eggs_per_day")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.secondaryColor
|
||||
}
|
||||
|
||||
Label {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WordWrap
|
||||
text: cover.tr("reservations") + ": " + cover.pending
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
color: Theme.secondaryColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user