Screen: display octave in landscape

Also fix a bug for octave display
This commit is contained in:
Louis-Joseph Fournier 2016-01-05 21:50:51 +01:00
parent 28fb75d41e
commit f2dece3b3c
4 changed files with 17 additions and 15 deletions

View file

@ -46,7 +46,7 @@ Toise {
// Toise parameters
index: note + notes_en.length * octave
marks: notes[notes_style]
nb_marks_displayed: Math.min(nb_marks, width / theme.fontSizeLarge * 0.8)
nb_marks_displayed: width > 100 ? Math.min(nb_marks, width / theme.fontSizeLarge * 0.8) : 1
mark_color: function(note) {
if (isAltered(note)) return colorAltered;

View file

@ -24,7 +24,7 @@ import QtQuick 2.0
Item {
width: 600
height: 450
height: 200
DesktopTheme {
id: theme

View file

@ -40,6 +40,7 @@ Item {
property int nb_marks: marks.length
property int nb_marks_displayed: nb_marks
property bool is_pair: nb_marks_displayed % 2 == 0
/// current mark is on the middle
property double position: index - (nb_marks_displayed - 1) / 2
@ -58,7 +59,7 @@ Item {
id: toise
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: - cellWidth * delta
anchors.leftMargin: is_pair ? - cellWidth * delta : 0
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.topMargin: h_margin
@ -67,7 +68,7 @@ Item {
property double cellWidth: parent.width / nb_marks_displayed
Repeater {
model: nb_marks_displayed + 1
model: is_pair ? nb_marks_displayed + 1 : nb_marks_displayed
Rectangle {
width: toise.cellWidth
height: toise.height

View file

@ -84,8 +84,8 @@ Item {
id: note_info
anchors.top: meter.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.left: meter.left
anchors.right: meter.right
anchors.bottom: parent.bottom
property int toise_h: Math.max(width / 10, theme.fontSizeLarge * 1.8)
@ -110,9 +110,11 @@ Item {
anchors.top: main.is_portrait ? title_note.bottom : parent.top
anchors.topMargin: parent.margin_h
anchors.horizontalCenter: parent.horizontalCenter
width: meter.width
anchors.left: parent.left
anchors.leftMargin: is_portrait ? 0 : parent.width / 20
width: is_portrait ? meter.width : meter.width * 2 / 3
height: parent.toise_h
note: tuner.note
@ -134,18 +136,17 @@ Item {
// octave toise
Toise {
anchors.top: main.is_portrait ? title_octave.bottom : toise.bottom
anchors.top: main.is_portrait ? title_octave.bottom : parent.top
anchors.topMargin: parent.margin_h
anchors.horizontalCenter: parent.horizontalCenter
visible: main.is_portrait
anchors.right: parent.right
anchors.rightMargin: is_portrait ? (parent.width - width) / 2 : parent.width / 20
theme: main.theme
marks: [1, 2, 3, 4, 5, 6, 7, 8, 9]
nb_marks_displayed: 4
marks: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
nb_marks_displayed: is_portrait ? 4 : 3
width: meter.width / 2
width: is_portrait ? meter.width / 2 : parent.width / 6
height: parent.toise_h
index: tuner.octave