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