Display labels next to load averages and make cover prettier. Closes #3, #4

This commit is contained in:
Mikko Ahlroth 2014-02-04 15:05:22 +02:00
parent 0c463f24bf
commit 3f125400e2
2 changed files with 125 additions and 54 deletions

View file

@ -16,43 +16,29 @@ CoverBackground {
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)
load5.text = uptime.load5.toFixed(2)
load15.text = uptime.load15.toFixed(2)
}
Column {
width: cover.width
spacing: Theme.paddingSmall
Label {
id: heading
anchors.horizontalCenter: parent.horizontalCenter
text: "Uptime"
color: "white"
font.pixelSize: Theme.fontSizeMedium
}
Separator {
x: Theme.paddingLarge
width: parent.width - Theme.paddingLarge * 2
horizontalAlignment: Qt.AlignCenter
color: Theme.highlightColor
}
y: Theme.paddingLarge
Label {
id: days
anchors.horizontalCenter: parent.horizontalCenter
text: "Refreshing..."
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeSmall
color: Theme.primaryColor
font.family: Theme.fontFamilyHeading
}
Label {
id: time
anchors.horizontalCenter: parent.horizontalCenter
text: ""
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeSmall
color: Theme.primaryColor
font.family: Theme.fontFamilyHeading
}
Separator {
@ -62,20 +48,73 @@ CoverBackground {
color: Theme.highlightColor
}
Label {
id: load1
Row {
width: parent.width - Theme.paddingLarge * 2
anchors.horizontalCenter: parent.horizontalCenter
text: ""
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeSmall
spacing: 15
Label {
text: "1"
color: Theme.secondaryColor
horizontalAlignment: Qt.AlignRight
width: parent.width / 4
font.family: Theme.fontFamilyHeading
}
Label {
id: load1
text: ""
color: Theme.primaryColor
horizontalAlignment: Qt.AlignLeft
width: 3 * parent.width / 4
font.family: Theme.fontFamilyHeading
}
}
Label {
id: load5_15
Row {
width: parent.width - Theme.paddingLarge * 2
anchors.horizontalCenter: parent.horizontalCenter
text: ""
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeSmall
spacing: 15
Label {
text: "5"
color: Theme.secondaryColor
horizontalAlignment: Qt.AlignRight
width: parent.width / 4
font.family: Theme.fontFamilyHeading
}
Label {
id: load5
text: ""
color: Theme.primaryColor
horizontalAlignment: Qt.AlignLeft
width: 3 * parent.width / 4
font.family: Theme.fontFamilyHeading
}
}
Row {
width: parent.width - Theme.paddingLarge * 2
anchors.horizontalCenter: parent.horizontalCenter
spacing: 15
Label {
text: "15"
color: Theme.secondaryColor
horizontalAlignment: Qt.AlignRight
width: parent.width / 4
font.family: Theme.fontFamilyHeading
}
Label {
id: load15
text: ""
color: Theme.primaryColor
horizontalAlignment: Qt.AlignLeft
width: 3 * parent.width / 4
font.family: Theme.fontFamilyHeading
}
}
}

View file

@ -24,8 +24,8 @@ Page {
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)
load5.text = uptime.load5.toFixed(2)
load15.text = uptime.load15.toFixed(2)
}
// To enable PullDownMenu, place our content in a SilicaFlickable
@ -61,14 +61,14 @@ Page {
width: page.width
spacing: Theme.paddingLarge
PageHeader {
title: "SailTime"
title: "Uptime"
}
Label {
id: days
anchors.horizontalCenter: parent.horizontalCenter
text: "Refreshing..."
color: Theme.highlightColor
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeLarge
}
@ -76,31 +76,63 @@ Page {
id: time
anchors.horizontalCenter: parent.horizontalCenter
text: ""
color: Theme.highlightColor
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeLarge
}
Separator {
x: Theme.paddingLarge
PageHeader {
title: "Load averages"
}
Row
{
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
}
spacing: 18
Label {
id: load5_15
anchors.horizontalCenter: parent.horizontalCenter
text: ""
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
Label {
text: "1"
color: Theme.secondaryColor
horizontalAlignment: Qt.AlignRight
width: parent.width / 24
}
Label {
id: load1
text: ""
color: Theme.primaryColor
width: 3 * parent.width / 12
horizontalAlignment: Qt.AlignLeft
}
Label {
text: "5"
color: Theme.secondaryColor
horizontalAlignment: Qt.AlignRight
width: parent.width / 24
}
Label {
id: load5
text: ""
color: Theme.primaryColor
width: 3 * parent.width / 12
horizontalAlignment: Qt.AlignLeft
}
Label {
text: "15"
color: Theme.secondaryColor
horizontalAlignment: Qt.AlignRight
width: parent.width / 24
}
Label {
id: load15
text: ""
color: Theme.primaryColor
width: 3 * parent.width / 12
horizontalAlignment: Qt.AlignLeft
}
}
}
}