SimpleDisplay to debug back-end
This commit is contained in:
parent
18a910595d
commit
4ec3a83db1
8 changed files with 72 additions and 30 deletions
|
@ -2,15 +2,20 @@ import QtQuick 2.0
|
|||
import LJTuner 1.0
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
width: 400
|
||||
height: 300
|
||||
|
||||
Tuner {
|
||||
id: tuner
|
||||
running: true
|
||||
}
|
||||
Text {
|
||||
text: tuner.freq.toFixed(2) + " Hz"
|
||||
font.pixelSize: parent.height / 4
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
DesktopTheme {
|
||||
id: theme
|
||||
}
|
||||
|
||||
SimpleDisplay {
|
||||
theme: theme
|
||||
tuner: tuner
|
||||
}
|
||||
}
|
||||
|
|
12
qml/DesktopTheme.qml
Normal file
12
qml/DesktopTheme.qml
Normal file
|
@ -0,0 +1,12 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
property color primaryColor: "#000000"
|
||||
property color secondaryColor: "#444444"
|
||||
property int paddingSmall: 4
|
||||
property int paddingLarge: 20
|
||||
property int fontSizeSmall: 10
|
||||
property int fontSizeMedium: 16
|
||||
property int fontSizeLarge: 25
|
||||
property int fontSizeExtraLarge: 40
|
||||
}
|
|
@ -16,22 +16,25 @@ ApplicationWindow {
|
|||
property QtObject tuner
|
||||
|
||||
initialPage: Component {
|
||||
ApplicationWindow {
|
||||
Page {
|
||||
id: page
|
||||
allowedOrientations: Orientation.All
|
||||
|
||||
SilicaFlickable {
|
||||
anchors.fill: parent
|
||||
|
||||
SimpleDisplay {
|
||||
theme: Theme
|
||||
tuner: app.tuner
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Tuner {
|
||||
id: tunerObject
|
||||
running: Qt.application.active && app.userRunning
|
||||
}
|
||||
|
||||
property QtObject tuner: tunerObject
|
||||
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: tuner.freq.toFixed(2) + " Hz"
|
||||
font.pixelSize: 90
|
||||
color: Theme.primaryColor
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
app.tuner = tunerObject
|
||||
//togglePause.connect(app.togglePause)
|
||||
|
@ -41,10 +44,9 @@ ApplicationWindow {
|
|||
|
||||
cover: Component {
|
||||
CoverBackground {
|
||||
Text {
|
||||
color: Theme.primaryColor
|
||||
font.pixelSize: 40
|
||||
text: app.tuner.freq.toFixed(2) + " Hz"
|
||||
SimpleDisplay {
|
||||
theme: Theme
|
||||
tuner: app.tuner
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,15 +9,8 @@ Item {
|
|||
width: 600
|
||||
height: 400
|
||||
|
||||
Item {
|
||||
DesktopTheme {
|
||||
id: theme
|
||||
property color primaryColor: "#000000"
|
||||
property color secondaryColor: "#444444"
|
||||
property int paddingSmall: 4
|
||||
property int paddingLarge: 20
|
||||
property int fontSizeSmall: 10
|
||||
property int fontSizeMedium: 16
|
||||
property int fontSizeLarge: 25
|
||||
}
|
||||
|
||||
Item {
|
||||
|
|
27
qml/SimpleDisplay.qml
Normal file
27
qml/SimpleDisplay.qml
Normal file
|
@ -0,0 +1,27 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
/**
|
||||
* Simple display for tuner test without gui
|
||||
*/
|
||||
|
||||
Column {
|
||||
property QtObject tuner
|
||||
property QtObject theme
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Component {
|
||||
id: simpleText
|
||||
Text {
|
||||
font.pixelSize: theme.fontSizeExtraLarge
|
||||
color: theme.primaryColor
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
var freq = simpleText.createObject(this)
|
||||
freq.text = Qt.binding(function () { return tuner ? tuner.freq.toFixed(2) + " Hz" : "NaN" })
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/qml/">
|
||||
<file>Desktop.qml</file>
|
||||
<file>SimpleDisplay.qml</file>
|
||||
<file>DesktopTheme.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/qml/">
|
||||
<file>Sailfish.qml</file>
|
||||
<file>SimpleDisplay.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -69,7 +69,7 @@ pair<double,double> FindPattern(const vector<double> &values, double pattern_min
|
|||
best = res;
|
||||
}
|
||||
}
|
||||
cerr << " -> " << best.first << " " << best.second << endl;
|
||||
//cerr << " -> " << best.first << " " << best.second << endl;
|
||||
if (best.second > CORRECT_DEVIATION) return pair<double,double>(0,0);
|
||||
return best;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue