2016-01-03 19:32:36 +03:00
|
|
|
/* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-12-27 12:57:37 +03:00
|
|
|
import QtQuick 2.0
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
import harbour.sailtuner.tuner 1.0
|
2016-01-08 00:29:27 +03:00
|
|
|
import harbour.sailtuner.objectsaver 1.0
|
|
|
|
import "."
|
2015-12-27 12:57:37 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sailfish main page
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
ApplicationWindow {
|
|
|
|
id: app
|
|
|
|
allowedOrientations: Orientation.All
|
|
|
|
|
|
|
|
property bool userRunning: true
|
2016-01-13 14:30:17 +03:00
|
|
|
property bool userPlaying: false
|
|
|
|
|
2015-12-27 12:57:37 +03:00
|
|
|
property int dbFontSize: 100
|
|
|
|
property QtObject tuner
|
|
|
|
|
2016-01-08 00:29:27 +03:00
|
|
|
ObjectSaver {
|
2016-01-08 20:56:19 +03:00
|
|
|
id: saver
|
2016-01-08 00:29:27 +03:00
|
|
|
filename: "config.dat"
|
|
|
|
object: Config
|
|
|
|
}
|
|
|
|
|
2016-01-13 14:30:17 +03:00
|
|
|
Tuner {
|
|
|
|
id: tunerItem
|
|
|
|
temperament_idx: Config.temperament_idx
|
|
|
|
la: Config.la
|
|
|
|
|
|
|
|
running: Qt.application.active && app.userRunning
|
|
|
|
playing: Qt.application.active && app.userPlaying
|
|
|
|
|
|
|
|
Component.onCompleted: app.tuner = tunerItem
|
|
|
|
}
|
|
|
|
|
2015-12-27 12:57:37 +03:00
|
|
|
initialPage: Component {
|
2015-12-27 17:59:32 +03:00
|
|
|
Page {
|
|
|
|
id: page
|
|
|
|
allowedOrientations: Orientation.All
|
2016-01-13 14:30:17 +03:00
|
|
|
property bool running: true
|
|
|
|
property bool tunerRunning: running && status == PageStatus.Active
|
2016-01-08 20:56:19 +03:00
|
|
|
|
2015-12-27 17:59:32 +03:00
|
|
|
SilicaFlickable {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2016-01-08 20:56:19 +03:00
|
|
|
PullDownMenu {
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Configuration")
|
|
|
|
onClicked: {
|
2016-01-09 02:01:37 +03:00
|
|
|
var confpage = pageStack.push(Qt.resolvedUrl("ConfigurePageSailfish.qml"), { tuner: app.tuner })
|
|
|
|
confpage.configChanged.connect(saver.save)
|
2016-01-08 20:56:19 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-01 21:20:29 +03:00
|
|
|
TunerScreen {
|
2016-01-13 13:08:01 +03:00
|
|
|
id: screen
|
2016-01-01 21:20:29 +03:00
|
|
|
anchors.fill: parent
|
2015-12-27 17:59:32 +03:00
|
|
|
theme: Theme
|
|
|
|
tuner: app.tuner
|
2016-01-13 14:30:17 +03:00
|
|
|
|
|
|
|
onToggleRun: page.running ^= true
|
2016-01-08 20:56:19 +03:00
|
|
|
}
|
2015-12-27 17:59:32 +03:00
|
|
|
}
|
2016-01-13 14:30:17 +03:00
|
|
|
onTunerRunningChanged: app.userRunning = tunerRunning
|
2015-12-27 17:59:32 +03:00
|
|
|
|
2016-01-13 14:30:17 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: player
|
|
|
|
|
|
|
|
Page {
|
|
|
|
id: page
|
|
|
|
allowedOrientations: Orientation.All
|
|
|
|
property bool playing: false
|
|
|
|
property bool tunerPlaying: playing && status == PageStatus.Active
|
|
|
|
|
2016-01-14 18:51:42 +03:00
|
|
|
backNavigation: !screen.toisepressed
|
|
|
|
|
2016-01-13 14:30:17 +03:00
|
|
|
SilicaFlickable {
|
2016-01-14 18:51:42 +03:00
|
|
|
id: flick
|
2016-01-13 14:30:17 +03:00
|
|
|
anchors.fill: parent
|
2016-01-14 18:51:42 +03:00
|
|
|
interactive: !screen.toisepressed
|
2015-12-27 12:57:37 +03:00
|
|
|
|
2016-01-13 14:30:17 +03:00
|
|
|
PullDownMenu {
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Configuration")
|
|
|
|
onClicked: {
|
|
|
|
var confpage = pageStack.push(Qt.resolvedUrl("ConfigurePageSailfish.qml"), { tuner: app.tuner })
|
|
|
|
confpage.configChanged.connect(saver.save)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-01-05 18:02:03 +03:00
|
|
|
|
2016-01-13 14:30:17 +03:00
|
|
|
PlayerScreen {
|
|
|
|
id: screen
|
|
|
|
anchors.fill: parent
|
|
|
|
theme: Theme
|
|
|
|
tuner: app.tuner
|
|
|
|
|
|
|
|
onTogglePlay: page.playing ^= true
|
|
|
|
}
|
2015-12-27 12:57:37 +03:00
|
|
|
}
|
2016-01-13 14:30:17 +03:00
|
|
|
onTunerPlayingChanged: app.userPlaying = tunerPlaying
|
2016-01-14 19:09:48 +03:00
|
|
|
|
|
|
|
onStatusChanged: {
|
|
|
|
if (status == PageStatus.Active) screen.update()
|
|
|
|
}
|
2015-12-27 12:57:37 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-13 14:30:17 +03:00
|
|
|
|
2015-12-27 12:57:37 +03:00
|
|
|
cover: Component {
|
|
|
|
CoverBackground {
|
2015-12-27 17:59:32 +03:00
|
|
|
SimpleDisplay {
|
|
|
|
theme: Theme
|
|
|
|
tuner: app.tuner
|
2015-12-27 12:57:37 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-13 14:30:17 +03:00
|
|
|
Component.onCompleted: pageStack.pushAttached(player)
|
2015-12-27 12:57:37 +03:00
|
|
|
}
|