diff --git a/qml/Desktop.qml b/qml/Desktop.qml
index 65894e2..8c05057 100644
--- a/qml/Desktop.qml
+++ b/qml/Desktop.qml
@@ -16,12 +16,15 @@
*/
import QtQuick 2.0
+import QtQuick.Controls 1.0
+import QtQuick.Layouts 1.0
import LJTuner 1.0
import LJUtils 1.0
import "."
Item {
+ id: root
width: 600
height: 500
@@ -50,11 +53,45 @@ Item {
anchors.fill: parent
theme: theme
tuner: tuner
+ onToggleRun: tuner.running ^= true
+ }
+
+ 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()
+ }
}
}
- MouseArea {
- anchors.fill: parent
- onClicked: tuner.running = (tuner.running ^ true)
+ // 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
+ }
+ PlayerScreen {
+ tuner: player_app.tuner
+ theme: player_app.theme
+
+ anchors.fill: parent
+ onTogglePlay: tuner.playing ^= true
+ }
+ }
}
}
diff --git a/qml/PlayerScreen.qml b/qml/PlayerScreen.qml
index 024b277..b395f69 100644
--- a/qml/PlayerScreen.qml
+++ b/qml/PlayerScreen.qml
@@ -29,19 +29,15 @@ Item {
/// theme corresponding to Silica Theme object
property QtObject theme
+ /// called wher user clicked for play/pause
+ signal togglePlay()
+
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
@@ -115,8 +111,8 @@ Item {
//octave: tuner.octave
onReleased: {
- octave = tuner.octave = index / 12
note = tuner.note = index % 12
+ octave = tuner.octave = index / 12
toise_octave.index = tuner.octave - 1
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
function update() {
toise.note = tuner.note
diff --git a/qml/Sailfish.qml b/qml/Sailfish.qml
index ddafe49..59800ac 100644
--- a/qml/Sailfish.qml
+++ b/qml/Sailfish.qml
@@ -45,8 +45,6 @@ ApplicationWindow {
id: page
allowedOrientations: Orientation.All
- signal togglePause()
-
SilicaFlickable {
anchors.fill: parent
@@ -61,14 +59,10 @@ ApplicationWindow {
}
TunerScreen {
+ id: screen
anchors.fill: parent
theme: Theme
tuner: app.tuner
-
- MouseArea {
- anchors.fill: parent
- onClicked: togglePause()
- }
}
}
@@ -83,7 +77,7 @@ ApplicationWindow {
Component.onCompleted: {
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
}
}
diff --git a/qml/ScaleToise.qml b/qml/ScaleToise.qml
index 7b81b86..43165e7 100644
--- a/qml/ScaleToise.qml
+++ b/qml/ScaleToise.qml
@@ -63,8 +63,8 @@ ToiseFlickable {
max: notes_en.length * 9 - 1 // si 8
onOctaveChanged: {
+ if (!flik_enable) return
index = note + notes_en.length * octave
updateFlickable()
}
- onNoteChanged: console.log(note)
}
diff --git a/qml/Scene.qml b/qml/Scene.qml
index af16c8b..2bd9a32 100644
--- a/qml/Scene.qml
+++ b/qml/Scene.qml
@@ -48,5 +48,7 @@ Image {
PlayerScreen {
tuner: tuner
theme: theme
+
+ onTogglePlay: tuner.playing ^= true
}
}
diff --git a/qml/TunerScreen.qml b/qml/TunerScreen.qml
index 3089e26..655e18e 100644
--- a/qml/TunerScreen.qml
+++ b/qml/TunerScreen.qml
@@ -29,6 +29,8 @@ Item {
/// theme corresponding to Silica Theme object
property QtObject theme
+ signal toggleRun()
+
anchors.fill: parent
property int h_margin: (height - meter.height - toise.height) / 3
@@ -183,4 +185,9 @@ Item {
height: width
source: theme.icon_pause ? theme.icon_pause : "image://theme/icon-m-pause?" + theme.secondaryColor
}
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: toggleRun()
+ }
}
diff --git a/qml/desktop.qrc b/qml/desktop.qrc
index 79decb0..51aa83a 100644
--- a/qml/desktop.qrc
+++ b/qml/desktop.qrc
@@ -3,6 +3,7 @@
Desktop.qml
SimpleDisplay.qml
DesktopTheme.qml
+PlayerScreen.qml
TunerScreen.qml
CircleMeter.qml
ScaleToise.qml
diff --git a/qml/sailfish.qrc b/qml/sailfish.qrc
index 7cd8717..da7d06b 100644
--- a/qml/sailfish.qrc
+++ b/qml/sailfish.qrc
@@ -2,6 +2,7 @@
Sailfish.qml
SimpleDisplay.qml
+PlayerScreen.qml
TunerScreen.qml
CircleMeter.qml
ScaleToise.qml