X-Git-Url: https://www.flypig.org.uk/git/?p=harbour-pedalo.git;a=blobdiff_plain;f=qml%2Fcover%2FCoverPage.qml;fp=qml%2Fcover%2FCoverPage.qml;h=67d6a83067c1d5cfb7b2f1e7b41fc25dc0f5fe9a;hp=a4a911b8937afd813b921f8186ae1f1afa18a413;hb=851af6c4deb0aabedf01ddc9e23511dca8ccbf7a;hpb=3e42fe6d6d8c784a05300add5613f5cee5571b30 diff --git a/qml/cover/CoverPage.qml b/qml/cover/CoverPage.qml index a4a911b..67d6a83 100644 --- a/qml/cover/CoverPage.qml +++ b/qml/cover/CoverPage.qml @@ -11,6 +11,13 @@ CoverBackground { stopwatchtrigger.restart() } + allowResize: true + + property int _maximumItems: height >= Theme.coverSizeLarge.height + ? 2 + : height >= Theme.coverSizeSmall.height ? 1 : 0 + + Item { id: stopwatch property int seconds: 0 @@ -45,46 +52,47 @@ CoverBackground { yScale: root.height / contents.height } - ClockView { - id: clockView - - anchors { - top: parent.top - left: parent.left - right: parent.right - margins: Theme.paddingLarge - } - height: width - } + ClockView { + id: clockView - LargeItem { - id: stopwatchView - - anchors { - top: clockView.bottom - topMargin: Theme.paddingMedium - leftMargin: Theme.paddingLarge - rightMargin: Theme.paddingLarge + anchors { + top: parent.top + left: parent.left + right: parent.right + margins: Theme.paddingLarge + } + height: width } - textVisible: root.update + LargeItem { + id: stopwatchView - title: qsTr("Pedalo") + anchors { + top: clockView.bottom + topMargin: Theme.paddingMedium + leftMargin: Theme.paddingLarge + rightMargin: Theme.paddingLarge + } - text: { - if (stopwatch.seconds < 60) { - return qsTr("%n seconds", "", stopwatch.seconds) - } else if (stopwatch.seconds < 60*60) { - return qsTr("%1 minutes").arg(Math.floor(stopwatch.seconds/60)) - } else { - var minutes = Math.floor(stopwatch.seconds/60) - var hours = Math.floor(minutes/60) - minutes = minutes % 60 - return qsTrId("%1h %2min").arg(hours).arg(minutes) + titleVisible: ((!root.update) && _maximumItems > 0) || (_maximumItems > 1) + textVisible: (root.update && (_maximumItems > 0)) + + title: qsTr("Pedalo") + + text: { + if (stopwatch.seconds < 60) { + return qsTr("%n seconds", "", stopwatch.seconds) + } else if (stopwatch.seconds < 60*60) { + return qsTr("%1 minutes").arg(Math.floor(stopwatch.seconds/60)) + } else { + var minutes = Math.floor(stopwatch.seconds/60) + var hours = Math.floor(minutes/60) + minutes = minutes % 60 + return qsTrId("%1h %2min").arg(hours).arg(minutes) + } } } } - } CoverActionList { id: coverAction