22
33#include < QSettings>
44
5+ #include < QtGlobal>
6+
57#include < CoreApi/runtimeinterface.h>
68
79namespace VisualEditor ::Internal {
@@ -18,7 +20,7 @@ namespace VisualEditor::Internal {
1820 int autoDurationPositionAlignment{24 };
1921 bool enableTemporarySnapOff{true };
2022 bool trackListOnRight{};
21- bool pianoKeyboardUseSimpleStyle{ };
23+ double pianoKeyboardBlackKeyLengthRatio{ 0.6 };
2224 EditorPreference::PianoKeyboardLabelPolicy pianoKeyboardLabelPolicy{};
2325 bool displayPronunciationBelowNote{};
2426 int shortNoteThreshold{30 };
@@ -60,8 +62,8 @@ namespace VisualEditor::Internal {
6062 emit enableTemporarySnapOffChanged ();
6163 d->trackListOnRight = settings->value (" trackListOnRight" , false ).toBool ();
6264 emit trackListOnRightChanged ();
63- d->pianoKeyboardUseSimpleStyle = settings->value (" pianoKeyboardUseSimpleStyle " , false ). toBool ();
64- emit pianoKeyboardUseSimpleStyleChanged ();
65+ d->pianoKeyboardBlackKeyLengthRatio = settings->value (" pianoKeyboardBlackKeyLengthRatio " , 0.6 ). toDouble ();
66+ emit pianoKeyboardBlackKeyLengthRatioChanged ();
6567 d->pianoKeyboardLabelPolicy = settings->value (" pianoKeyboardLabelPolicy" , QVariant::fromValue (LP_All)).value <PianoKeyboardLabelPolicy>();
6668 emit pianoKeyboardLabelPolicyChanged ();
6769 d->displayPronunciationBelowNote = settings->value (" displayPronunciationBelowNote" , false ).toBool ();
@@ -85,7 +87,7 @@ namespace VisualEditor::Internal {
8587 settings->setValue (" autoDurationPositionAlignment" , d->autoDurationPositionAlignment );
8688 settings->setValue (" enableTemporarySnapOff" , d->enableTemporarySnapOff );
8789 settings->setValue (" trackListOnRight" , d->trackListOnRight );
88- settings->setValue (" pianoKeyboardUseSimpleStyle " , d->pianoKeyboardUseSimpleStyle );
90+ settings->setValue (" pianoKeyboardBlackKeyLengthRatio " , d->pianoKeyboardBlackKeyLengthRatio );
8991 settings->setValue (" pianoKeyboardLabelPolicy" , static_cast <int >(d->pianoKeyboardLabelPolicy ));
9092 settings->setValue (" displayPronunciationBelowNote" , d->displayPronunciationBelowNote );
9193 settings->setValue (" shortNoteThreshold" , d->shortNoteThreshold );
@@ -201,17 +203,17 @@ namespace VisualEditor::Internal {
201203 emit m_instance->trackListOnRightChanged ();
202204 }
203205
204- bool EditorPreference::pianoKeyboardUseSimpleStyle () {
206+ double EditorPreference::pianoKeyboardBlackKeyLengthRatio () {
205207 M_INSTANCE_D;
206- return d->pianoKeyboardUseSimpleStyle ;
208+ return d->pianoKeyboardBlackKeyLengthRatio ;
207209 }
208210
209- void EditorPreference::setPianoKeyboardUseSimpleStyle ( bool pianoKeyboardUseSimpleStyle ) {
211+ void EditorPreference::setPianoKeyboardBlackKeyLengthRatio ( double pianoKeyboardBlackKeyLengthRatio ) {
210212 M_INSTANCE_D;
211- if (d->pianoKeyboardUseSimpleStyle == pianoKeyboardUseSimpleStyle )
213+ if (qFuzzyCompare ( d->pianoKeyboardBlackKeyLengthRatio , pianoKeyboardBlackKeyLengthRatio) )
212214 return ;
213- d->pianoKeyboardUseSimpleStyle = pianoKeyboardUseSimpleStyle ;
214- emit m_instance->pianoKeyboardUseSimpleStyleChanged ();
215+ d->pianoKeyboardBlackKeyLengthRatio = pianoKeyboardBlackKeyLengthRatio ;
216+ emit m_instance->pianoKeyboardBlackKeyLengthRatioChanged ();
215217 }
216218
217219 EditorPreference::PianoKeyboardLabelPolicy EditorPreference::pianoKeyboardLabelPolicy () {
0 commit comments