diff --git a/images/icon-l-pause.svg b/images/icon-l-pause.svg new file mode 100644 index 0000000..d186815 --- /dev/null +++ b/images/icon-l-pause.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + diff --git a/images/icon-l-play.svg b/images/icon-l-play.svg new file mode 100644 index 0000000..2091e20 --- /dev/null +++ b/images/icon-l-play.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/images/icon-m-play.svg b/images/icon-m-play.svg new file mode 100644 index 0000000..43568b6 --- /dev/null +++ b/images/icon-m-play.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/images/images.qrc b/images/images.qrc index a32a726..21d1e57 100644 --- a/images/images.qrc +++ b/images/images.qrc @@ -1,6 +1,8 @@ icon-m-pause.svg +icon-l-pause.svg +icon-l-play.svg bg_portrait.png diff --git a/qml/DesktopTheme.qml b/qml/DesktopTheme.qml index 509c6a6..f7abece 100644 --- a/qml/DesktopTheme.qml +++ b/qml/DesktopTheme.qml @@ -29,4 +29,7 @@ Item { property int fontSizeExtraLarge: 40 property string icon_pause: "../images/icon-m-pause.svg" + + property string icon_pause_large: "../images/icon-l-pause.svg" + property string icon_play_large: "../images/icon-l-play.svg" } diff --git a/qml/PlayerScreen.qml b/qml/PlayerScreen.qml new file mode 100644 index 0000000..fb59f45 --- /dev/null +++ b/qml/PlayerScreen.qml @@ -0,0 +1,150 @@ +/* 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 + +/** + * Main tuner screen + * + */ + +Item { + id: main + /// tuner object + property QtObject tuner + /// theme corresponding to Silica Theme object + property QtObject theme + + anchors.fill: parent + property int h_margin: (height - toise.height * 2 - image_play.height) / 5 + + // landscape / portrait + property bool is_portrait: height > width + + // maximum absolute deviation to display green led + property double deviation_ok: 0.05 + property color led_green: "green" + property color led_red: "red" + + property bool dev_is_ok: Math.abs(tuner.deviation) <= deviation_ok + + // frequency and temperament + Column { + id: freq_temp + x: theme.paddingLarge + y: theme.paddingLarge + width: parent.width * 0.4 + height: width / 2 + + Text { + text: tuner.la + " hz" + font.pixelSize: theme.fontSizeSmall + color: theme.secondaryColor + } + Text { + text: tuner.temperament_list[tuner.temperament_idx] + font.pixelSize: theme.fontSizeSmall + color: theme.secondaryColor + } + } + + // icon for pause status + Image { + id: image_play + anchors.top: parent.top + anchors.topMargin: h_margin + anchors.horizontalCenter: parent.horizontalCenter + width: theme.iconSizeLarge + height: width + source: tuner.playing ? (theme.icon_play_large ? theme.icon_play_large : "image://theme/icon-l-play?" + theme.secondaryColor) : (theme.icon_pause_large ? theme.icon_pause_large : "image://theme/icon-l-pause?" + theme.secondaryColor) + } + + Item { + id: note_info + + anchors.top: image_play.bottom + anchors.topMargin: h_margin + + width: parent.width + height: parent.height - image_play.height - image_play.y - h_margin * 2 + + property int toise_h: Math.max(width / 10, theme.fontSizeLarge * 1.8) + property double margin_h: parent.is_portrait ? (height - toise_h * 2) / 7 : (height - toise_h) / 6 + + Text { + id: title_note + visible: main.is_portrait + text: qsTr("Note") + + font.pixelSize: theme.fontSizeMedium + color: theme.highlightColor + + anchors.top: parent.top + anchors.topMargin: parent.margin_h + anchors.horizontalCenter: parent.horizontalCenter + } + + ScaleToise { + id: toise + theme: main.theme + + anchors.top: main.is_portrait ? title_note.bottom : parent.top + anchors.topMargin: parent.margin_h + + anchors.left: parent.left + anchors.leftMargin: parent.width * 0.1 + + width: parent.width * 0.8 + height: parent.toise_h + + note: tuner.note + octave: tuner.octave + } + + Text { + id: title_octave + visible: main.is_portrait + text: qsTr("Octave") + + font.pixelSize: theme.fontSizeMedium + color: theme.highlightColor + + anchors.top: toise.bottom + anchors.topMargin: parent.margin_h + anchors.horizontalCenter: parent.horizontalCenter + } + + // octave toise + Toise { + anchors.top: main.is_portrait ? title_octave.bottom : toise.bottom + anchors.topMargin: parent.margin_h + + anchors.left: parent.left + anchors.leftMargin: parent.width * 0.2 + + theme: main.theme + + marks: [1, 2, 3, 4, 5, 6, 7, 9] + //nb_marks_displayed: is_portrait ? 4 : 3 + + width: parent.width * 0.6 + height: parent.toise_h + + index: tuner.octave + } + } +} diff --git a/qml/Scene.qml b/qml/Scene.qml index 1e54f4d..af16c8b 100644 --- a/qml/Scene.qml +++ b/qml/Scene.qml @@ -41,9 +41,11 @@ Image { property bool found: true property variant temperament_list: ["Weikmeister III", "equal"] property int temperament_idx: 0 + property bool running: false + property bool playing: false } - TunerScreen { + PlayerScreen { tuner: tuner theme: theme }