diff --git a/qml/CircleMeter.qml b/qml/CircleMeter.qml new file mode 100644 index 0000000..8d26ce0 --- /dev/null +++ b/qml/CircleMeter.qml @@ -0,0 +1,32 @@ +import QtQuick 2.0 + +/** + * Meter in half circle + */ + +Item { + /// current level + property double level: 0 + /// minimum level + property double min: -1 + /// maximum level + property double max: 1 + /// theme object + property QtObject theme + + Canvas { + id: canvas + anchors.fill: parent + onPaint: { + var ctx = canvas.getContext('2d'); + ctx.strokeStyle = theme.primaryColor + ctx.lineWidth = 1 + ctx.beginPath() + ctx.moveTo(0,height - 1) + ctx.bezierCurveTo(0, 0, width * 0.5 * (1 - Math.cos(Math.PI/4)), height * Math.sin(Math.PI/4), width / 2, 0) + //ctx.closePath() + ctx.stroke() + console.log("canvas done") + } + } +} diff --git a/qml/Scene.qml b/qml/Scene.qml new file mode 100644 index 0000000..b591a54 --- /dev/null +++ b/qml/Scene.qml @@ -0,0 +1,35 @@ +import QtQuick 2.0 + +/** + * display tuner screen with qmlscene + * to work on qml files + */ + +Item { + width: 600 + height: 400 + + Item { + 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 { + id: tuner + property int note: 2 + property int octave: 4 + property double freq: 440 + property double deviation: 0.1 + } + + TunerScreen { + tuner: tuner + theme: theme + } +} diff --git a/qml/TunerScreen.qml b/qml/TunerScreen.qml new file mode 100644 index 0000000..c4a3645 --- /dev/null +++ b/qml/TunerScreen.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +/** + * Main tuner screen + * + */ + +Item { + /// tuner object + property QtObject tuner + /// theme corresponding to Silica Theme object + property QtObject theme + + anchors.fill: parent + + CircleMeter { + theme: parent.theme + anchors.fill: parent + } +}