TunerScreen: display octave for portrait orientation
This commit is contained in:
parent
a808a5b1bd
commit
478b64ca8c
3 changed files with 64 additions and 6 deletions
|
@ -3,6 +3,7 @@ import QtQuick 2.0
|
|||
Item {
|
||||
property color primaryColor: "#000000"
|
||||
property color secondaryColor: "#777777"
|
||||
property color highlightColor: "#aa4422"
|
||||
property int paddingSmall: 4
|
||||
property int paddingLarge: 20
|
||||
property int fontSizeSmall: 10
|
||||
|
|
|
@ -9,10 +9,12 @@ import QtQuick 2.0
|
|||
Toise {
|
||||
id: scale
|
||||
|
||||
// note or note + 12 * octave
|
||||
// note
|
||||
property int note: 1
|
||||
// octave
|
||||
property int octave: 4
|
||||
// en or fr
|
||||
property int notes_style: 0
|
||||
property int notes_style: 1
|
||||
|
||||
property variant notes_fr: [
|
||||
"do", "do#", "ré", "mib", "mi", "fa", "fa#", "sol", "sol#", "la", "sib", "si"]
|
||||
|
@ -25,7 +27,7 @@ Toise {
|
|||
property color colorNatural: "transparent"
|
||||
|
||||
// Toise parameters
|
||||
index: note
|
||||
index: note + notes_en.length * octave
|
||||
marks: notes[notes_style]
|
||||
nb_marks_displayed: Math.min(nb_marks, width / theme.fontSizeLarge * 0.8)
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ Item {
|
|||
anchors.fill: parent
|
||||
property int h_margin: (height - meter.height - toise.height) / 3
|
||||
|
||||
// landscape / portrait
|
||||
property bool is_portrait: height > width
|
||||
|
||||
CircleMeter {
|
||||
id: meter
|
||||
theme: parent.theme
|
||||
|
@ -30,22 +33,74 @@ Item {
|
|||
}
|
||||
|
||||
Item {
|
||||
id: note_info
|
||||
|
||||
anchors.top: meter.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
property int toise_h: Math.max(width / 10, theme.fontSizeLarge * 1.8)
|
||||
property double margin_h: parent.is_portrait ? (height - toise_h * 2) / 7 : (height - toise_h) / 2
|
||||
|
||||
Text {
|
||||
id: title_note
|
||||
visible: main.is_portrait
|
||||
text: qsTr("Note")
|
||||
|
||||
font.pixelSize: theme.fontSizeMedium
|
||||
color: theme.highlightColor
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: parent.margin_h
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
ScaleToise {
|
||||
id: toise
|
||||
theme: main.theme
|
||||
|
||||
anchors.top: main.is_portrait ? title_note.bottom : parent.top
|
||||
anchors.topMargin: parent.margin_h
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
width: meter.width
|
||||
height: Math.max(width / 10, theme.fontSizeLarge * 1.8)
|
||||
height: parent.toise_h
|
||||
|
||||
note: tuner.note + toise.nb_notes * tuner.octave
|
||||
note: tuner.note
|
||||
octave: tuner.octave
|
||||
}
|
||||
|
||||
Text {
|
||||
id: title_octave
|
||||
visible: main.is_portrait
|
||||
text: qsTr("Octave")
|
||||
|
||||
font.pixelSize: theme.fontSizeMedium
|
||||
color: theme.highlightColor
|
||||
|
||||
anchors.top: toise.bottom
|
||||
anchors.topMargin: parent.margin_h
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
// octave toise
|
||||
Toise {
|
||||
anchors.top: main.is_portrait ? title_octave.bottom : toise.bottom
|
||||
anchors.topMargin: parent.margin_h
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
visible: main.is_portrait
|
||||
|
||||
theme: main.theme
|
||||
|
||||
marks: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
nb_marks_displayed: 4
|
||||
|
||||
width: meter.width / 2
|
||||
height: parent.toise_h
|
||||
|
||||
index: tuner.octave
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue