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: {
|
onLevelChanged: {
|
||||||
arrow.requestPaint()
|
arrow.requestPaint()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function redraw() {
|
||||||
|
ellipse.requestPaint()
|
||||||
|
arrow.requestPaint()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,12 +29,13 @@ CoverBackground {
|
||||||
id: cover
|
id: cover
|
||||||
|
|
||||||
property QtObject tuner
|
property QtObject tuner
|
||||||
|
property bool displayDeviation: true
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.topMargin: parent.height / 12
|
anchors.topMargin: parent.height / 6
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: coverLabel
|
id: coverLabel
|
||||||
|
@ -56,11 +57,18 @@ CoverBackground {
|
||||||
color: Theme.primaryColor
|
color: Theme.primaryColor
|
||||||
font.pixelSize: 35
|
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.top: coverNote.bottom
|
||||||
anchors.topMargin: Theme.paddingLarge
|
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 int dbFontSize: 100
|
||||||
property QtObject tuner
|
property QtObject tuner
|
||||||
|
property bool lastPagePlaying: false
|
||||||
|
|
||||||
ObjectSaver {
|
ObjectSaver {
|
||||||
id: saver
|
id: saver
|
||||||
|
@ -84,6 +85,20 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
onTunerRunningChanged: app.userRunning = tunerRunning
|
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
|
onTunerPlayingChanged: app.userPlaying = tunerPlaying
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status == PageStatus.Active) screen.update()
|
if (status == PageStatus.Active) {
|
||||||
|
app.lastPagePlaying = true
|
||||||
|
screen.update()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,6 +151,8 @@ ApplicationWindow {
|
||||||
|
|
||||||
cover: Component {
|
cover: Component {
|
||||||
CoverPageSailfish {
|
CoverPageSailfish {
|
||||||
|
tuner: app.tuner
|
||||||
|
displayDeviation: !app.lastPagePlaying
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ Item {
|
||||||
property QtObject theme
|
property QtObject theme
|
||||||
|
|
||||||
signal toggleRun()
|
signal toggleRun()
|
||||||
|
signal redraw()
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
property int h_margin: (height - meter.height - toise.height) / 3
|
property int h_margin: (height - meter.height - toise.height) / 3
|
||||||
|
@ -191,4 +192,8 @@ Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: toggleRun()
|
onClicked: toggleRun()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
redraw.connect(meter.redraw)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue