SailTime/qml/pages/FirstPage.qml

101 lines
2.7 KiB
QML
Raw Normal View History

2013-12-15 21:08:15 +00:00
/*
* © Mikko Ahlroth 2013
* SailTime is open source software. For licensing information, please check
* the LICENCE file.
*/
2013-12-12 21:08:36 +00:00
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: page
property alias page : page
Component.onCompleted: {
updateDisplay();
}
function updatePage(uptime) {
days.text = uptime.days + " days"
time.text = uptime.hours + " h " + uptime.minutes + " min"
load1.text = uptime.load1.toFixed(2)
load5_15.text = uptime.load5.toFixed(2) + " " + uptime.load15
.toFixed(2)
}
// To enable PullDownMenu, place our content in a SilicaFlickable
SilicaFlickable {
anchors.fill: parent
// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
PullDownMenu {
MenuItem {
text: "Settings"
onClicked: pageStack.push(secondpage)
}
MenuItem {
text: "Refresh"
onClicked: updateDisplay();
}
}
// Tell SilicaFlickable the height of its content.
contentHeight: column.height
// Place our content in a Column. The PageHeader is always placed at the top
// of the page, followed by our content.
Column {
id: column
width: page.width
spacing: Theme.paddingLarge
PageHeader {
title: "SailTime"
}
Label {
id: days
anchors.horizontalCenter: parent.horizontalCenter
text: "Refreshing..."
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
}
Label {
id: time
anchors.horizontalCenter: parent.horizontalCenter
text: ""
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
}
Separator {
x: Theme.paddingLarge
width: parent.width - Theme.paddingLarge * 2
horizontalAlignment: Qt.AlignCenter
color: Theme.highlightColor
}
Label {
id: load1
anchors.horizontalCenter: parent.horizontalCenter
text: ""
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
}
Label {
id: load5_15
anchors.horizontalCenter: parent.horizontalCenter
text: ""
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
}
}
}
}