From f2dece3b3c21ef2b84f2aef3a77c416278e40337 Mon Sep 17 00:00:00 2001 From: Louis-Joseph Fournier Date: Tue, 5 Jan 2016 21:50:51 +0100 Subject: [PATCH] Screen: display octave in landscape Also fix a bug for octave display --- qml/ScaleToise.qml | 2 +- qml/Scene.qml | 2 +- qml/Toise.qml | 5 +++-- qml/TunerScreen.qml | 23 ++++++++++++----------- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/qml/ScaleToise.qml b/qml/ScaleToise.qml index b68d252..7ef1ffb 100644 --- a/qml/ScaleToise.qml +++ b/qml/ScaleToise.qml @@ -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; diff --git a/qml/Scene.qml b/qml/Scene.qml index 8225bd2..60b4e63 100644 --- a/qml/Scene.qml +++ b/qml/Scene.qml @@ -24,7 +24,7 @@ import QtQuick 2.0 Item { width: 600 - height: 450 + height: 200 DesktopTheme { id: theme diff --git a/qml/Toise.qml b/qml/Toise.qml index 3f5fc83..cd4445c 100644 --- a/qml/Toise.qml +++ b/qml/Toise.qml @@ -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 diff --git a/qml/TunerScreen.qml b/qml/TunerScreen.qml index 8b3b927..acf2e10 100644 --- a/qml/TunerScreen.qml +++ b/qml/TunerScreen.qml @@ -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