PlayerScreen: gui for player

This commit is contained in:
Louis-Joseph Fournier 2016-01-11 12:38:05 +01:00
parent 0703aabbf1
commit 1d14fe935e
7 changed files with 209 additions and 1 deletions

20
images/icon-l-pause.svg Normal file
View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 17.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="96px" height="96px" viewBox="0 0 96 96" style="enable-background:new 0 0 96 96;" xml:space="preserve">
<g id="icon-l-pause_1_">
<g>
<circle style="opacity:0.15;fill:#FFFFFF;" cx="48" cy="48.001" r="44"/>
<path style="fill:#FFFFFF;" d="M39.398,67.047h-6.797c-1.986,0-3.602-1.616-3.602-3.603V32.648c0-1.986,1.616-3.602,3.602-3.602
h6.797c1.986,0,3.602,1.616,3.602,3.602v30.796C43,65.431,41.384,67.047,39.398,67.047z M32.602,31.046
c-0.883,0-1.602,0.718-1.602,1.602v30.796c0,0.884,0.718,1.603,1.602,1.603h6.797c0.883,0,1.602-0.719,1.602-1.603V32.648
c0-0.883-0.718-1.602-1.602-1.602H32.602z"/>
<path style="fill:#FFFFFF;" d="M63.398,67.047h-6.797c-1.986,0-3.602-1.616-3.602-3.603V32.648c0-1.986,1.615-3.602,3.602-3.602
h6.797c1.986,0,3.602,1.616,3.602,3.602v30.796C67,65.431,65.385,67.047,63.398,67.047z M56.602,31.046
c-0.883,0-1.602,0.718-1.602,1.602v30.796c0,0.884,0.719,1.603,1.602,1.603h6.797c0.883,0,1.602-0.719,1.602-1.603V32.648
c0-0.883-0.719-1.602-1.602-1.602H56.602z"/>
</g>
<rect id="icon-l-pause_3_" style="opacity:0;fill:#FFFFFF;" width="96" height="96"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

17
images/icon-l-play.svg Normal file
View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 17.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="96px" height="96px" viewBox="0 0 96 96" style="enable-background:new 0 0 96 96;" xml:space="preserve">
<g id="icon-l-play_2_">
<rect id="icon-l-play_3_" style="opacity:0;fill:#FFFFFF;" width="96" height="96"/>
<g>
<circle style="opacity:0.15;fill:#FFFFFF;" cx="48" cy="48.001" r="44"/>
<path style="fill:#FFFFFF;" d="M40.211,66.561c-1.193,0-2.585-0.857-2.585-3.273V32.713c0-2.416,1.393-3.273,2.585-3.273
c0.72,0,1.469,0.284,2.228,0.843l19.709,14.539c1.103,0.813,1.734,1.972,1.734,3.18c0,1.207-0.633,2.366-1.734,3.179
L42.438,65.718C41.68,66.277,40.93,66.561,40.211,66.561z M40.21,31.439c-0.543,0-0.585,0.975-0.585,1.273v30.574
c0,0.299,0.042,1.273,0.585,1.273c0.271,0,0.65-0.165,1.04-0.452L60.96,49.57c0.595-0.438,0.922-0.996,0.922-1.569
c0-0.574-0.327-1.132-0.922-1.57L41.251,31.892C40.861,31.604,40.482,31.439,40.21,31.439z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

14
images/icon-m-play.svg Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 17.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="64px" height="64px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve">
<g id="icon-m-play_2_">
<rect id="icon-m-play_3_" style="opacity:0;fill:#FFFFFF;" width="64" height="64"/>
<g>
<circle style="opacity:0.2;fill:#FFFFFF;" cx="32" cy="32" r="24"/>
<path style="fill:#FFFFFF;" d="M25.926,24.112c0-2.2,1.449-2.931,3.219-1.626l9.679,7.14c1.77,1.306,1.77,3.443,0,4.749
l-9.679,7.14c-1.77,1.306-3.219,0.574-3.219-1.626V24.112z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 872 B

View file

@ -1,6 +1,8 @@
<!DOCTYPE RCC><RCC version="1.0"> <!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/images/"> <qresource prefix="/images/">
<file>icon-m-pause.svg</file> <file>icon-m-pause.svg</file>
<file>icon-l-pause.svg</file>
<file>icon-l-play.svg</file>
<file>bg_portrait.png</file> <file>bg_portrait.png</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -29,4 +29,7 @@ Item {
property int fontSizeExtraLarge: 40 property int fontSizeExtraLarge: 40
property string icon_pause: "../images/icon-m-pause.svg" 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"
} }

150
qml/PlayerScreen.qml Normal file
View file

@ -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
}
}
}

View file

@ -41,9 +41,11 @@ Image {
property bool found: true property bool found: true
property variant temperament_list: ["Weikmeister III", "equal"] property variant temperament_list: ["Weikmeister III", "equal"]
property int temperament_idx: 0 property int temperament_idx: 0
property bool running: false
property bool playing: false
} }
TunerScreen { PlayerScreen {
tuner: tuner tuner: tuner
theme: theme theme: theme
} }