Desktop version with player fully working
Double-click on upper part of tuner screen to launch player
This commit is contained in:
parent
6850095533
commit
48afd68d06
8 changed files with 68 additions and 21 deletions
|
@ -16,12 +16,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.0
|
||||||
|
import QtQuick.Layouts 1.0
|
||||||
import LJTuner 1.0
|
import LJTuner 1.0
|
||||||
import LJUtils 1.0
|
import LJUtils 1.0
|
||||||
|
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
id: root
|
||||||
width: 600
|
width: 600
|
||||||
height: 500
|
height: 500
|
||||||
|
|
||||||
|
@ -50,11 +53,45 @@ Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
theme: theme
|
theme: theme
|
||||||
tuner: tuner
|
tuner: tuner
|
||||||
}
|
onToggleRun: tuner.running ^= true
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: parent.height / 8
|
||||||
|
|
||||||
|
onDoubleClicked: {
|
||||||
|
var win = player.createObject(player, {theme: theme, tuner: tuner})
|
||||||
|
win.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// player
|
||||||
|
Component {
|
||||||
|
id: player
|
||||||
|
|
||||||
|
ApplicationWindow {
|
||||||
|
id: player_app
|
||||||
|
|
||||||
|
width: 600
|
||||||
|
height: 500
|
||||||
|
property QtObject tuner
|
||||||
|
property QtObject theme
|
||||||
|
|
||||||
|
Image {
|
||||||
|
source: "../images/bg_portrait.png"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: tuner.running = (tuner.running ^ true)
|
}
|
||||||
|
PlayerScreen {
|
||||||
|
tuner: player_app.tuner
|
||||||
|
theme: player_app.theme
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
onTogglePlay: tuner.playing ^= true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,19 +29,15 @@ Item {
|
||||||
/// theme corresponding to Silica Theme object
|
/// theme corresponding to Silica Theme object
|
||||||
property QtObject theme
|
property QtObject theme
|
||||||
|
|
||||||
|
/// called wher user clicked for play/pause
|
||||||
|
signal togglePlay()
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
property int h_margin: (height - toise.height * 2 - image_play.height) / 5
|
property int h_margin: (height - toise.height * 2 - image_play.height) / 5
|
||||||
|
|
||||||
// landscape / portrait
|
// landscape / portrait
|
||||||
property bool is_portrait: height > width
|
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
|
// frequency and temperament
|
||||||
Column {
|
Column {
|
||||||
id: freq_temp
|
id: freq_temp
|
||||||
|
@ -115,8 +111,8 @@ Item {
|
||||||
//octave: tuner.octave
|
//octave: tuner.octave
|
||||||
|
|
||||||
onReleased: {
|
onReleased: {
|
||||||
octave = tuner.octave = index / 12
|
|
||||||
note = tuner.note = index % 12
|
note = tuner.note = index % 12
|
||||||
|
octave = tuner.octave = index / 12
|
||||||
toise_octave.index = tuner.octave - 1
|
toise_octave.index = tuner.octave - 1
|
||||||
toise_octave.updateFlickable()
|
toise_octave.updateFlickable()
|
||||||
}
|
}
|
||||||
|
@ -162,6 +158,15 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// play/pause area
|
||||||
|
MouseArea {
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: note_info.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
onClicked: togglePlay()
|
||||||
|
}
|
||||||
|
|
||||||
/// update toise indexes if tuner note and octave changed from exterior
|
/// update toise indexes if tuner note and octave changed from exterior
|
||||||
function update() {
|
function update() {
|
||||||
toise.note = tuner.note
|
toise.note = tuner.note
|
||||||
|
|
|
@ -45,8 +45,6 @@ ApplicationWindow {
|
||||||
id: page
|
id: page
|
||||||
allowedOrientations: Orientation.All
|
allowedOrientations: Orientation.All
|
||||||
|
|
||||||
signal togglePause()
|
|
||||||
|
|
||||||
SilicaFlickable {
|
SilicaFlickable {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
@ -61,14 +59,10 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
TunerScreen {
|
TunerScreen {
|
||||||
|
id: screen
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
theme: Theme
|
theme: Theme
|
||||||
tuner: app.tuner
|
tuner: app.tuner
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: togglePause()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -83,7 +77,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
app.tuner = tunerObject
|
app.tuner = tunerObject
|
||||||
togglePause.connect(app.togglePause)
|
screen.toggleRun.connect(app.toggleRun)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +91,7 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function togglePause() {
|
function toggleRun() {
|
||||||
app.userRunning = app.userRunning ? false : true
|
app.userRunning = app.userRunning ? false : true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,8 +63,8 @@ ToiseFlickable {
|
||||||
max: notes_en.length * 9 - 1 // si 8
|
max: notes_en.length * 9 - 1 // si 8
|
||||||
|
|
||||||
onOctaveChanged: {
|
onOctaveChanged: {
|
||||||
|
if (!flik_enable) return
|
||||||
index = note + notes_en.length * octave
|
index = note + notes_en.length * octave
|
||||||
updateFlickable()
|
updateFlickable()
|
||||||
}
|
}
|
||||||
onNoteChanged: console.log(note)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,5 +48,7 @@ Image {
|
||||||
PlayerScreen {
|
PlayerScreen {
|
||||||
tuner: tuner
|
tuner: tuner
|
||||||
theme: theme
|
theme: theme
|
||||||
|
|
||||||
|
onTogglePlay: tuner.playing ^= true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@ Item {
|
||||||
/// theme corresponding to Silica Theme object
|
/// theme corresponding to Silica Theme object
|
||||||
property QtObject theme
|
property QtObject theme
|
||||||
|
|
||||||
|
signal toggleRun()
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
@ -183,4 +185,9 @@ Item {
|
||||||
height: width
|
height: width
|
||||||
source: theme.icon_pause ? theme.icon_pause : "image://theme/icon-m-pause?" + theme.secondaryColor
|
source: theme.icon_pause ? theme.icon_pause : "image://theme/icon-m-pause?" + theme.secondaryColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: toggleRun()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<file>Desktop.qml</file>
|
<file>Desktop.qml</file>
|
||||||
<file>SimpleDisplay.qml</file>
|
<file>SimpleDisplay.qml</file>
|
||||||
<file>DesktopTheme.qml</file>
|
<file>DesktopTheme.qml</file>
|
||||||
|
<file>PlayerScreen.qml</file>
|
||||||
<file>TunerScreen.qml</file>
|
<file>TunerScreen.qml</file>
|
||||||
<file>CircleMeter.qml</file>
|
<file>CircleMeter.qml</file>
|
||||||
<file>ScaleToise.qml</file>
|
<file>ScaleToise.qml</file>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<qresource prefix="/qml/">
|
<qresource prefix="/qml/">
|
||||||
<file>Sailfish.qml</file>
|
<file>Sailfish.qml</file>
|
||||||
<file>SimpleDisplay.qml</file>
|
<file>SimpleDisplay.qml</file>
|
||||||
|
<file>PlayerScreen.qml</file>
|
||||||
<file>TunerScreen.qml</file>
|
<file>TunerScreen.qml</file>
|
||||||
<file>CircleMeter.qml</file>
|
<file>CircleMeter.qml</file>
|
||||||
<file>ScaleToise.qml</file>
|
<file>ScaleToise.qml</file>
|
||||||
|
|
Loading…
Reference in a new issue