Skip to content
Snippets Groups Projects
Commit 75010f09 authored by SeeLook's avatar SeeLook :musical_note:
Browse files

Set clef either from score or instrument tuning page

- also increase minimal note duration when bass is set
- so keep instrument and clef variables above pages
- change instrument image dynamically
parent 4001981f
Branches
Tags
No related merge requests found
Pipeline #3135 passed
......@@ -18,7 +18,7 @@ Flickable {
contentHeight: instrCol.height + NOO.factor() * 2
contentWidth: Math.max(width, NOO.factor() * 35)
property bool first: true // read props first time from GLOB but when instrument changed then from its profile
property bool first: true // read props first time from GLOB but when instrument changes then from its profile
ScrollBar.vertical: ScrollBar { active: false; visible: active }
......@@ -36,19 +36,20 @@ Flickable {
if (first) {
transp.shift = GLOB.transposition
prefFlatRadio.checked = GLOB.preferFlats
first = false
} else {
settings.instrument = instrument
var ins = NOO.instr(instrument)
settings,clef = ins.clef
transp.shift = ins.transposition
prefFlatRadio.checked = ins.isSax ? true : false
prefSharpRadio.checked = ins.isSax ? false : true
tuningCombo.model = instrument === Tinstrument.BassGuitar ? NOO.bassTunings() : NOO.guitarTunings()
if (ins.isGuitar) {
score.clef = ins.clef
if (instrument === Tinstrument.BassGuitar)
setTuning(NOO.tuning(Ttune.Bass4_EADG))
else
setTuning(NOO.tuning(Ttune.Standard_EADGBE))
fretsNrSpin.value = ins.fretNumber
} else if (ins.type === Tinstrument.NoInstrument) {
setTuning(NOO.tuning(score.scoreObj.lowestNote(), score.scoreObj.highestNote(), NOO.emptyNote(), NOO.emptyNote(), NOO.emptyNote(), NOO.emptyNote()))
}
......@@ -57,6 +58,11 @@ Flickable {
}
}
Tile {
visible: instrSel.instrument <= Tinstrument.BassGuitar
Column {
spacing: NOO.factor()
width: parent.width
Grid {
visible: NOO.instr(instrSel.instrument).isGuitar
anchors.horizontalCenter: parent.horizontalCenter
......@@ -74,12 +80,7 @@ Flickable {
TspinBox { id: stringNrSpin; from: 3; to: 6; value: GLOB.stringNumber() }
}
}
Tile {
visible: instrSel.instrument <= Tinstrument.BassGuitar
Column {
spacing: NOO.factor()
width: parent.width
Item { width: NOO.factor(); height: NOO.factor() }
Row {
spacing: NOO.factor()
anchors.horizontalCenter: parent.horizontalCenter
......@@ -104,6 +105,8 @@ Flickable {
meter: Tmeter.NoMeter
scoreObj.onClicked: tuningCombo.currentIndex = tuningCombo.count - 1
scoreObj.editMode: true
clef: settings.clef
onClefChanged: settings.clef = clef
Component.onCompleted: {
stringNrSpin.valueModified.connect(strNrChanged)
tuningCombo.activated.connect(tuningSelected)
......@@ -204,16 +207,17 @@ Flickable {
showOtherPosChB.checked = GLOB.showOtherPos
fretDots.text = GLOB.markedFrets
var tmpTrans = GLOB.transposition
instrSel.instrument = GLOB.instrument.type - (GLOB.instrument.type === 0 ? -1 : 1) // FIXME: workaround for Qt 5.10.1 and above
score.clef = GLOB.clefType
instrSel.instrument = GLOB.instrument.type
transp.shift = tmpTrans
if (GLOB.instrument.isGuitar) {
if (GLOB.tuning.type === Ttune.Custom)
if (GLOB.tuning.type === Ttune.Custom) {
setTuning(NOO.tuning(GLOB.tuning.string(1), GLOB.tuning.string(2), GLOB.tuning.string(3),
GLOB.tuning.string(4), GLOB.tuning.string(5), GLOB.tuning.string(6)))
tuningCombo.currentIndex = tuningCombo.count - 1
else
} else
tuningCombo.currentIndex = GLOB.tuning.type - (GLOB.instrument.type === Tinstrument.BassGuitar ? 100 : 0)
}
first = false
}
}
......@@ -230,6 +234,7 @@ Flickable {
score.deleteLast()
}
}
stringNrSpin.value = t.stringNumber
}
function save() {
......
......@@ -23,7 +23,7 @@ Column {
StackLayout {
id: swipePages
height: parent.height - headList.height - NOO.factor() / 2
height: parent.height - headList.height
width: parent.width
Tflickable { // 1st page (general)
......@@ -174,6 +174,7 @@ Column {
width: parent.width
spacing: NOO.isAndroid() ? 2 : NOO.factor() / 2
Text {
id: clefText
text: qsTr("Select default clef for the application.") + "<br><b>"
+ qsTr("Remember! Not all clefs are suitable for some possible tunings or instrument types!") + "<b>"
textFormat: Text.StyledText
......@@ -184,8 +185,9 @@ Column {
}
ClefMenu {
id: clefs
width: parent.width; height: swipePages.height - NOO.factor() * 5
Component.onCompleted: selClef = GLOB.clefType
width: parent.width; height: swipePages.height - parent.spacing - clefText.height
selClef: settings.clef
onSelClefChanged: settings.clef = selClef
}
}
......@@ -296,7 +298,7 @@ Column {
GLOB.seventhIsB = is7BSelector.is7B
GLOB.namesOnScore = namesOnScoreChB.checked
GLOB.nameColor = nameColorButt.color
GLOB.clefType = clefs.selClef
// GLOB.clefType saved in TsettingsDialog.qml
if (GLOB.keySignatureEnabled) {
GLOB.showKeyName = showKeyNamesChB.checked
if (GLOB.showKeyName) {
......@@ -314,7 +316,7 @@ Column {
enharmNoteColor.color = Qt.rgba(0, 0.6352941176470588, 0.6352941176470588, 1)
doubleAccidsChB.checked = false
pointerColorButt.color = "pink"
clefs.selClef = GLOB.instrument.clef
settings.clef = GLOB.instrument.clef
enableKeyChB.checked = false
musicalRadio.checked = true
......
......@@ -81,7 +81,8 @@ Column {
TlabelText { text: qsTr("minimum note duration") }
TspinBox {
id: minDurSpin
from: 80; to: 1000
from: settings.instrument !== 3 ? 80 : 160 // longer note if bass
to: 1000
stepSize: 10
editable: true
}
......
......@@ -7,6 +7,16 @@ import QtQuick.Controls 2.2
Item {
id: settings
property int clef: GLOB.clefType
property int instrument: GLOB.instrument.typeINT
onInstrumentChanged: {
if (pages.buttons.length > 2)
pages.buttons[2].pixmap = NOO.pix("pane/i-0" + instrument)
}
width: parent.width
height: parent.height
......@@ -28,6 +38,7 @@ Item {
}
function apply() {
GLOB.clefType = clef // it can be changed either by score or instrument page
for (var i = 0; i < pages.pages.length; ++i) {
if (typeof(pages.pages[i]) === 'object')
pages.pages[i].save()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment