Sailfish: cover management
This commit is contained in:
parent
70f24d6bd0
commit
c985f7c93e
4 changed files with 43 additions and 5 deletions
|
@ -252,4 +252,9 @@ Item {
|
|||
onLevelChanged: {
|
||||
arrow.requestPaint()
|
||||
}
|
||||
|
||||
function redraw() {
|
||||
ellipse.requestPaint()
|
||||
arrow.requestPaint()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,12 +29,13 @@ CoverBackground {
|
|||
id: cover
|
||||
|
||||
property QtObject tuner
|
||||
property bool displayDeviation: true
|
||||
|
||||
Item {
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.topMargin: parent.height / 12
|
||||
anchors.topMargin: parent.height / 6
|
||||
|
||||
Label {
|
||||
id: coverLabel
|
||||
|
@ -56,11 +57,18 @@ CoverBackground {
|
|||
color: Theme.primaryColor
|
||||
font.pixelSize: 35
|
||||
}
|
||||
Led {
|
||||
|
||||
Text {
|
||||
id: coverDeviation
|
||||
text: (tuner.deviation > 0 ? "+" : "") + (tuner.deviation * 101).toFixed(2) + "%"
|
||||
visible: tuner.found && cover.displayDeviation
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: coverNote.bottom
|
||||
anchors.topMargin: Theme.paddingLarge
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
led_color: Math.abs(tuner.deviation) <= 0.05 ? "green" : "red"
|
||||
|
||||
color: Theme.secondaryColor
|
||||
font.pixelSize: 25
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ ApplicationWindow {
|
|||
|
||||
property int dbFontSize: 100
|
||||
property QtObject tuner
|
||||
property bool lastPagePlaying: false
|
||||
|
||||
ObjectSaver {
|
||||
id: saver
|
||||
|
@ -84,6 +85,20 @@ ApplicationWindow {
|
|||
}
|
||||
onTunerRunningChanged: app.userRunning = tunerRunning
|
||||
|
||||
property bool isVisible: Qt.application.active && status == PageStatus.Active
|
||||
property int countVisible: 0
|
||||
onIsVisibleChanged: {
|
||||
if (isVisible) {
|
||||
// don't redraw the first time
|
||||
if (countVisible > 0) screen.redraw()
|
||||
countVisible++
|
||||
}
|
||||
}
|
||||
onStatusChanged: {
|
||||
if (status == PageStatus.Active) {
|
||||
app.lastPagePlaying = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +140,10 @@ ApplicationWindow {
|
|||
onTunerPlayingChanged: app.userPlaying = tunerPlaying
|
||||
|
||||
onStatusChanged: {
|
||||
if (status == PageStatus.Active) screen.update()
|
||||
if (status == PageStatus.Active) {
|
||||
app.lastPagePlaying = true
|
||||
screen.update()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,6 +151,8 @@ ApplicationWindow {
|
|||
|
||||
cover: Component {
|
||||
CoverPageSailfish {
|
||||
tuner: app.tuner
|
||||
displayDeviation: !app.lastPagePlaying
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ Item {
|
|||
property QtObject theme
|
||||
|
||||
signal toggleRun()
|
||||
signal redraw()
|
||||
|
||||
anchors.fill: parent
|
||||
property int h_margin: (height - meter.height - toise.height) / 3
|
||||
|
@ -191,4 +192,8 @@ Item {
|
|||
anchors.fill: parent
|
||||
onClicked: toggleRun()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
redraw.connect(meter.redraw)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue