1111
1212namespace VisualEditor ::Internal {
1313
14+ static constexpr double kDefaultAutoPitchCurveDisplayPixelDensityThreshold = 0.07071 ;
15+
1416 class EditorPreferencePrivate {
1517 public:
1618 bool initialized{};
@@ -26,6 +28,8 @@ namespace VisualEditor::Internal {
2628 bool centerPianoRollOnClipDoubleClick{true };
2729 double pianoKeyboardBlackKeyLengthRatio{0.6 };
2830 EditorPreference::PianoKeyboardLabelPolicy pianoKeyboardLabelPolicy{};
31+ EditorPreference::NoteEditPitchCurveDisplayMode noteEditPitchCurveDisplayMode{};
32+ double autoPitchCurveDisplayPixelDensityThreshold{kDefaultAutoPitchCurveDisplayPixelDensityThreshold };
2933 bool displayPronunciationBelowNote{};
3034 int shortNoteThreshold{30 };
3135 bool warnOfOverlappingNotes{true };
@@ -76,6 +80,10 @@ namespace VisualEditor::Internal {
7680 emit pianoKeyboardBlackKeyLengthRatioChanged ();
7781 d->pianoKeyboardLabelPolicy = settings->value (" pianoKeyboardLabelPolicy" , QVariant::fromValue (LP_All)).value <PianoKeyboardLabelPolicy>();
7882 emit pianoKeyboardLabelPolicyChanged ();
83+ d->noteEditPitchCurveDisplayMode = settings->value (" noteEditPitchCurveDisplayMode" , QVariant::fromValue (PCDM_Automatic)).value <NoteEditPitchCurveDisplayMode>();
84+ Q_EMIT noteEditPitchCurveDisplayModeChanged ();
85+ d->autoPitchCurveDisplayPixelDensityThreshold = settings->value (" autoPitchCurveDisplayPixelDensityThreshold" , kDefaultAutoPitchCurveDisplayPixelDensityThreshold ).toDouble ();
86+ Q_EMIT autoPitchCurveDisplayPixelDensityThresholdChanged ();
7987 d->displayPronunciationBelowNote = settings->value (" displayPronunciationBelowNote" , false ).toBool ();
8088 emit displayPronunciationBelowNoteChanged ();
8189 d->shortNoteThreshold = settings->value (" shortNoteThreshold" , 30 ).toInt ();
@@ -110,6 +118,8 @@ namespace VisualEditor::Internal {
110118 settings->setValue (" centerPianoRollOnClipDoubleClick" , d->centerPianoRollOnClipDoubleClick );
111119 settings->setValue (" pianoKeyboardBlackKeyLengthRatio" , d->pianoKeyboardBlackKeyLengthRatio );
112120 settings->setValue (" pianoKeyboardLabelPolicy" , static_cast <int >(d->pianoKeyboardLabelPolicy ));
121+ settings->setValue (" noteEditPitchCurveDisplayMode" , static_cast <int >(d->noteEditPitchCurveDisplayMode ));
122+ settings->setValue (" autoPitchCurveDisplayPixelDensityThreshold" , d->autoPitchCurveDisplayPixelDensityThreshold );
113123 settings->setValue (" displayPronunciationBelowNote" , d->displayPronunciationBelowNote );
114124 settings->setValue (" shortNoteThreshold" , d->shortNoteThreshold );
115125 settings->setValue (" warnOfOverlappingNotes" , d->warnOfOverlappingNotes );
@@ -267,6 +277,32 @@ namespace VisualEditor::Internal {
267277 emit m_instance->pianoKeyboardLabelPolicyChanged ();
268278 }
269279
280+ EditorPreference::NoteEditPitchCurveDisplayMode EditorPreference::noteEditPitchCurveDisplayMode () {
281+ M_INSTANCE_D ;
282+ return d->noteEditPitchCurveDisplayMode ;
283+ }
284+
285+ void EditorPreference::setNoteEditPitchCurveDisplayMode (NoteEditPitchCurveDisplayMode noteEditPitchCurveDisplayMode) {
286+ M_INSTANCE_D ;
287+ if (d->noteEditPitchCurveDisplayMode == noteEditPitchCurveDisplayMode)
288+ return ;
289+ d->noteEditPitchCurveDisplayMode = noteEditPitchCurveDisplayMode;
290+ Q_EMIT m_instance->noteEditPitchCurveDisplayModeChanged ();
291+ }
292+
293+ double EditorPreference::autoPitchCurveDisplayPixelDensityThreshold () {
294+ M_INSTANCE_D ;
295+ return d->autoPitchCurveDisplayPixelDensityThreshold ;
296+ }
297+
298+ void EditorPreference::setAutoPitchCurveDisplayPixelDensityThreshold (double autoPitchCurveDisplayPixelDensityThreshold) {
299+ M_INSTANCE_D ;
300+ if (qFuzzyCompare (d->autoPitchCurveDisplayPixelDensityThreshold , autoPitchCurveDisplayPixelDensityThreshold))
301+ return ;
302+ d->autoPitchCurveDisplayPixelDensityThreshold = autoPitchCurveDisplayPixelDensityThreshold;
303+ Q_EMIT m_instance->autoPitchCurveDisplayPixelDensityThresholdChanged ();
304+ }
305+
270306 bool EditorPreference::displayPronunciationBelowNote () {
271307 M_INSTANCE_D ;
272308 return d->displayPronunciationBelowNote ;
0 commit comments