Screen: display octave in landscape
Also fix a bug for octave display
This commit is contained in:
parent
28fb75d41e
commit
f2dece3b3c
4 changed files with 17 additions and 15 deletions
|
@ -46,7 +46,7 @@ Toise {
|
||||||
// Toise parameters
|
// Toise parameters
|
||||||
index: note + notes_en.length * octave
|
index: note + notes_en.length * octave
|
||||||
marks: notes[notes_style]
|
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) {
|
mark_color: function(note) {
|
||||||
if (isAltered(note)) return colorAltered;
|
if (isAltered(note)) return colorAltered;
|
||||||
|
|
|
@ -24,7 +24,7 @@ import QtQuick 2.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: 600
|
width: 600
|
||||||
height: 450
|
height: 200
|
||||||
|
|
||||||
DesktopTheme {
|
DesktopTheme {
|
||||||
id: theme
|
id: theme
|
||||||
|
|
|
@ -40,6 +40,7 @@ Item {
|
||||||
property int nb_marks: marks.length
|
property int nb_marks: marks.length
|
||||||
|
|
||||||
property int nb_marks_displayed: nb_marks
|
property int nb_marks_displayed: nb_marks
|
||||||
|
property bool is_pair: nb_marks_displayed % 2 == 0
|
||||||
|
|
||||||
/// current mark is on the middle
|
/// current mark is on the middle
|
||||||
property double position: index - (nb_marks_displayed - 1) / 2
|
property double position: index - (nb_marks_displayed - 1) / 2
|
||||||
|
@ -58,7 +59,7 @@ Item {
|
||||||
id: toise
|
id: toise
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: - cellWidth * delta
|
anchors.leftMargin: is_pair ? - cellWidth * delta : 0
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.topMargin: h_margin
|
anchors.topMargin: h_margin
|
||||||
|
@ -67,7 +68,7 @@ Item {
|
||||||
property double cellWidth: parent.width / nb_marks_displayed
|
property double cellWidth: parent.width / nb_marks_displayed
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: nb_marks_displayed + 1
|
model: is_pair ? nb_marks_displayed + 1 : nb_marks_displayed
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: toise.cellWidth
|
width: toise.cellWidth
|
||||||
height: toise.height
|
height: toise.height
|
||||||
|
|
|
@ -84,8 +84,8 @@ Item {
|
||||||
id: note_info
|
id: note_info
|
||||||
|
|
||||||
anchors.top: meter.bottom
|
anchors.top: meter.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: meter.left
|
||||||
anchors.right: parent.right
|
anchors.right: meter.right
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
property int toise_h: Math.max(width / 10, theme.fontSizeLarge * 1.8)
|
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.top: main.is_portrait ? title_note.bottom : parent.top
|
||||||
anchors.topMargin: parent.margin_h
|
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
|
height: parent.toise_h
|
||||||
|
|
||||||
note: tuner.note
|
note: tuner.note
|
||||||
|
@ -134,18 +136,17 @@ Item {
|
||||||
|
|
||||||
// octave toise
|
// octave toise
|
||||||
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.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
|
theme: main.theme
|
||||||
|
|
||||||
marks: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
marks: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||||
nb_marks_displayed: 4
|
nb_marks_displayed: is_portrait ? 4 : 3
|
||||||
|
|
||||||
width: meter.width / 2
|
width: is_portrait ? meter.width / 2 : parent.width / 6
|
||||||
height: parent.toise_h
|
height: parent.toise_h
|
||||||
|
|
||||||
index: tuner.octave
|
index: tuner.octave
|
||||||
|
|
Loading…
Reference in a new issue