From 70f24d6bd055ec5aa8eca30948b51eace30038e8 Mon Sep 17 00:00:00 2001 From: Louis-Joseph Fournier Date: Fri, 15 Jan 2016 17:46:44 +0100 Subject: [PATCH] Sailfish cover developpement --- qml/CoverPageSailfish.qml | 66 +++++++++++++++++++++++++++++++++++++++ qml/NoteNames.qml | 2 +- qml/Sailfish.qml | 6 +--- qml/sailfish.qrc | 1 + 4 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 qml/CoverPageSailfish.qml diff --git a/qml/CoverPageSailfish.qml b/qml/CoverPageSailfish.qml new file mode 100644 index 0000000..318a260 --- /dev/null +++ b/qml/CoverPageSailfish.qml @@ -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" + } + } +} diff --git a/qml/NoteNames.qml b/qml/NoteNames.qml index 8a49cc0..2c92984 100644 --- a/qml/NoteNames.qml +++ b/qml/NoteNames.qml @@ -39,5 +39,5 @@ QtObject { property int nb: notes_fr.length property variant notes: notesTab[notes_style] - function noteName(note) { return notes[note]; } + function name(note) { return notes[note]; } } diff --git a/qml/Sailfish.qml b/qml/Sailfish.qml index 679f387..54ed984 100644 --- a/qml/Sailfish.qml +++ b/qml/Sailfish.qml @@ -132,11 +132,7 @@ ApplicationWindow { cover: Component { - CoverBackground { - SimpleDisplay { - theme: Theme - tuner: app.tuner - } + CoverPageSailfish { } } diff --git a/qml/sailfish.qrc b/qml/sailfish.qrc index 9e4c120..ced5d38 100644 --- a/qml/sailfish.qrc +++ b/qml/sailfish.qrc @@ -10,6 +10,7 @@ ToiseFlickable.qml Led.qml ConfigurePageSailfish.qml +CoverPageSailfish.qml Config.qml NoteNames.qml qmldir