diff --git a/qml/Desktop.qml b/qml/Desktop.qml
index 5cbbfce..efb3cc9 100644
--- a/qml/Desktop.qml
+++ b/qml/Desktop.qml
@@ -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
}
}
diff --git a/qml/DesktopTheme.qml b/qml/DesktopTheme.qml
new file mode 100644
index 0000000..059b272
--- /dev/null
+++ b/qml/DesktopTheme.qml
@@ -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
+}
diff --git a/qml/Sailfish.qml b/qml/Sailfish.qml
index ba25acb..93680bd 100644
--- a/qml/Sailfish.qml
+++ b/qml/Sailfish.qml
@@ -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
}
}
}
diff --git a/qml/Scene.qml b/qml/Scene.qml
index b591a54..0e3baeb 100644
--- a/qml/Scene.qml
+++ b/qml/Scene.qml
@@ -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 {
diff --git a/qml/SimpleDisplay.qml b/qml/SimpleDisplay.qml
new file mode 100644
index 0000000..2d556ca
--- /dev/null
+++ b/qml/SimpleDisplay.qml
@@ -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" })
+ }
+}
diff --git a/qml/desktop.qrc b/qml/desktop.qrc
index ca5cc1e..711246e 100644
--- a/qml/desktop.qrc
+++ b/qml/desktop.qrc
@@ -1,5 +1,7 @@
Desktop.qml
+SimpleDisplay.qml
+DesktopTheme.qml
diff --git a/qml/sailfish.qrc b/qml/sailfish.qrc
index c96b56f..759e477 100644
--- a/qml/sailfish.qrc
+++ b/qml/sailfish.qrc
@@ -1,5 +1,6 @@
Sailfish.qml
+SimpleDisplay.qml
diff --git a/src/audio/ZeroCross.cpp b/src/audio/ZeroCross.cpp
index 75d7cac..1644d7c 100644
--- a/src/audio/ZeroCross.cpp
+++ b/src/audio/ZeroCross.cpp
@@ -69,7 +69,7 @@ pair FindPattern(const vector &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(0,0);
return best;
}