Display: gui with backend for desktop and sailfish
This commit is contained in:
parent
252cb1521e
commit
d45f9b5dc7
9 changed files with 39 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
||||||
QT += qml quick gui multimedia dbus
|
QT += qml quick gui multimedia dbus
|
||||||
TARGET = harbour-sailtuner
|
TARGET = harbour-sailtuner
|
||||||
|
|
||||||
CONFIG += c++11 sailfishapp sailfishapp_i18n
|
CONFIG += c++11 sailfishapp sailfishapp_i18n sailfishapp_no_deploy_qml
|
||||||
|
|
||||||
DEFINES += TARGET=\""$(TARGET")\"
|
DEFINES += TARGET=\""$(TARGET")\"
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,9 @@ Item {
|
||||||
function find_region() {
|
function find_region() {
|
||||||
var l1 = min
|
var l1 = min
|
||||||
var l2
|
var l2
|
||||||
|
|
||||||
|
if (!marks) return [0,0,0]
|
||||||
|
|
||||||
for (var i = 0; i < marks.length; i++) {
|
for (var i = 0; i < marks.length; i++) {
|
||||||
if (i == marks.length - 1) l2 = max
|
if (i == marks.length - 1) l2 = max
|
||||||
else l2 = (marks[i] + marks[i+1]) / 2
|
else l2 = (marks[i] + marks[i+1]) / 2
|
||||||
|
@ -138,6 +141,7 @@ Item {
|
||||||
line_mark(ctx, j, r_circle_min - l_submarker, r_circle_min + l_submarker)
|
line_mark(ctx, j, r_circle_min - l_submarker, r_circle_min + l_submarker)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.fillStyle = theme.primaryColor
|
||||||
for (var i = 0; i < marks.length; i++) {
|
for (var i = 0; i < marks.length; i++) {
|
||||||
ctx.strokeStyle = theme.secondaryColor
|
ctx.strokeStyle = theme.secondaryColor
|
||||||
ctx.lineWidth = h_marker
|
ctx.lineWidth = h_marker
|
||||||
|
@ -287,11 +291,11 @@ Item {
|
||||||
arrow.requestPaint()
|
arrow.requestPaint()
|
||||||
regions.update_level()
|
regions.update_level()
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
level = Math.random() * (max - min) + min
|
level = Math.random() * (max - min) + min
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ import QtQuick 2.0
|
||||||
import LJTuner 1.0
|
import LJTuner 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: 400
|
width: 600
|
||||||
height: 300
|
height: 500
|
||||||
|
|
||||||
Tuner {
|
Tuner {
|
||||||
id: tuner
|
id: tuner
|
||||||
|
@ -14,7 +14,8 @@ Item {
|
||||||
id: theme
|
id: theme
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleDisplay {
|
TunerScreen {
|
||||||
|
anchors.fill: parent
|
||||||
theme: theme
|
theme: theme
|
||||||
tuner: tuner
|
tuner: tuner
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ ApplicationWindow {
|
||||||
SilicaFlickable {
|
SilicaFlickable {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
SimpleDisplay {
|
TunerScreen {
|
||||||
|
anchors.fill: parent
|
||||||
theme: Theme
|
theme: Theme
|
||||||
tuner: app.tuner
|
tuner: app.tuner
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import QtQuick 2.0
|
||||||
Item {
|
Item {
|
||||||
id: scale
|
id: scale
|
||||||
|
|
||||||
|
property QtObject theme
|
||||||
|
|
||||||
// note or note + 12 * octave
|
// note or note + 12 * octave
|
||||||
property int note: 1
|
property int note: 1
|
||||||
|
|
||||||
|
@ -20,6 +22,7 @@ Item {
|
||||||
property int notes_style: 0
|
property int notes_style: 0
|
||||||
|
|
||||||
property color colorAltered: "#40888888"
|
property color colorAltered: "#40888888"
|
||||||
|
property color colorNatural: "transparent"
|
||||||
|
|
||||||
property int h_margin: Math.max(height / 8, main_note.border_d)
|
property int h_margin: Math.max(height / 8, main_note.border_d)
|
||||||
|
|
||||||
|
@ -63,21 +66,25 @@ Item {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
border.width: 1
|
border.width: 1
|
||||||
property int note: (index + nb_notes + first_note) % nb_notes
|
property int note: (index + nb_notes + first_note) % nb_notes
|
||||||
color: isAltered(note) ? colorAltered : "transparent"
|
color: isAltered(note) ? colorAltered : colorNatural
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: note_name(note)
|
text: note_name(note)
|
||||||
|
color: theme.primaryColor
|
||||||
|
font.pixelSize: parent.height / 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: note = Math.random() * 100
|
onClicked: note = Math.random() * 100
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Screen for actual note
|
// Screen for actual note
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -20,17 +20,25 @@ Item {
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: h_margin
|
anchors.topMargin: h_margin
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
width: parent.width
|
width: Math.min(parent.width, parent.height * 1.5)
|
||||||
height: width / 2
|
height: width / 2
|
||||||
|
|
||||||
|
level: tuner.deviation * 100
|
||||||
}
|
}
|
||||||
|
|
||||||
ScaleToise {
|
ScaleToise {
|
||||||
id: toise
|
id: toise
|
||||||
|
theme: parent.theme
|
||||||
|
|
||||||
anchors.top: meter.bottom
|
anchors.top: meter.bottom
|
||||||
anchors.topMargin: h_margin
|
anchors.topMargin: h_margin
|
||||||
anchors.left: parent.left
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
width: parent.width
|
|
||||||
|
width: meter.width
|
||||||
height: width / 10
|
height: width / 10
|
||||||
|
|
||||||
|
note: tuner.note * tuner.octave
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,8 @@
|
||||||
<file>Desktop.qml</file>
|
<file>Desktop.qml</file>
|
||||||
<file>SimpleDisplay.qml</file>
|
<file>SimpleDisplay.qml</file>
|
||||||
<file>DesktopTheme.qml</file>
|
<file>DesktopTheme.qml</file>
|
||||||
|
<file>TunerScreen.qml</file>
|
||||||
|
<file>CircleMeter.qml</file>
|
||||||
|
<file>ScaleToise.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -2,5 +2,8 @@
|
||||||
<qresource prefix="/qml/">
|
<qresource prefix="/qml/">
|
||||||
<file>Sailfish.qml</file>
|
<file>Sailfish.qml</file>
|
||||||
<file>SimpleDisplay.qml</file>
|
<file>SimpleDisplay.qml</file>
|
||||||
|
<file>TunerScreen.qml</file>
|
||||||
|
<file>CircleMeter.qml</file>
|
||||||
|
<file>ScaleToise.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -41,6 +41,7 @@ Q_DECL_EXPORT int main(int argc, char* argv[])
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
QQuickView view;
|
QQuickView view;
|
||||||
view.setSource(QUrl("qrc:///qml/Desktop.qml"));
|
view.setSource(QUrl("qrc:///qml/Desktop.qml"));
|
||||||
|
view.setResizeMode(view.SizeRootObjectToView);
|
||||||
view.show();
|
view.show();
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue