Sailfish cover developpement

This commit is contained in:
Louis-Joseph Fournier 2016-01-15 17:46:44 +01:00
parent 1f397fa47f
commit 70f24d6bd0
4 changed files with 69 additions and 6 deletions

66
qml/CoverPageSailfish.qml Normal file
View file

@ -0,0 +1,66 @@
/* Copyright 2016 (C) Louis-Joseph Fournier
* louisjoseph.fournier@gmail.com
*
* This file is part of SailTuner.
*
* SailTuner is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SailTuner is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import "."
/**
* CoverPage
*
* Cover for Sailfish OS
*/
CoverBackground {
id: cover
property QtObject tuner
Item {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: parent.height / 12
Label {
id: coverLabel
text: "Tuner"
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: Theme.paddingLarge
anchors.bottomMargin: Theme.paddingLarge
}
Text {
id: coverNote
text: NoteNames.name(tuner.note) + " " + tuner.octave
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: coverLabel.bottom
anchors.topMargin: Theme.paddingLarge
color: Theme.primaryColor
font.pixelSize: 35
}
Led {
anchors.top: coverNote.bottom
anchors.topMargin: Theme.paddingLarge
anchors.horizontalCenter: parent.horizontalCenter
led_color: Math.abs(tuner.deviation) <= 0.05 ? "green" : "red"
}
}
}

View file

@ -39,5 +39,5 @@ QtObject {
property int nb: notes_fr.length property int nb: notes_fr.length
property variant notes: notesTab[notes_style] property variant notes: notesTab[notes_style]
function noteName(note) { return notes[note]; } function name(note) { return notes[note]; }
} }

View file

@ -132,11 +132,7 @@ ApplicationWindow {
cover: Component { cover: Component {
CoverBackground { CoverPageSailfish {
SimpleDisplay {
theme: Theme
tuner: app.tuner
}
} }
} }

View file

@ -10,6 +10,7 @@
<file>ToiseFlickable.qml</file> <file>ToiseFlickable.qml</file>
<file>Led.qml</file> <file>Led.qml</file>
<file>ConfigurePageSailfish.qml</file> <file>ConfigurePageSailfish.qml</file>
<file>CoverPageSailfish.qml</file>
<file>Config.qml</file> <file>Config.qml</file>
<file>NoteNames.qml</file> <file>NoteNames.qml</file>
<file>qmldir</file> <file>qmldir</file>