@@ -43,7 +43,6 @@ using namespace mu::engraving;
4343static const Settings::Key DEFAULT_STYLE_FILE_PATH (" engraving" , " engraving/style/defaultStyleFile" );
4444static const Settings::Key PART_STYLE_FILE_PATH (" engraving" , " engraving/style/partStyleFile" );
4545
46- static const Settings::Key INVERT_SCORE_COLOR (" engraving" , " engraving/scoreColorInversion" );
4746static const Settings::Key SCORE_COLOR_INVERSION_MODE (" engraving" , " engraving/scoreColorInversionMode" );
4847
4948static const Settings::Key ALL_VOICES_COLOR (" engraving" , " engraving/colors/allVoicesColor" );
@@ -86,17 +85,22 @@ void EngravingConfiguration::init()
8685 m_partStyleFilePathChanged.send (val.toPath ());
8786 });
8887
89- // TODO: How to upgrade old setting to new one?
90- settings ()->setDefaultValue (INVERT_SCORE_COLOR, Val (false ));
91- settings ()->valueChanged (INVERT_SCORE_COLOR).onReceive (nullptr , [this ](const Val&) {
92- m_scoreInversionChanged.notify ();
93- });
94-
9588 settings ()->setDefaultValue (SCORE_COLOR_INVERSION_MODE, Val (ScoreInversionMode::Disabled));
9689 settings ()->valueChanged (SCORE_COLOR_INVERSION_MODE).onReceive (nullptr , [this ](const Val&) {
9790 m_scoreInversionChanged.notify ();
9891 });
9992
93+ // Upgrade old scoreColorInversion setting to new inversion mode
94+ {
95+ static const Settings::Key INVERT_SCORE_COLOR_deprecated (" engraving" , " engraving/scoreColorInversion" );
96+ if (!settings ()->contains (SCORE_COLOR_INVERSION_MODE) && settings ()->contains (INVERT_SCORE_COLOR_deprecated)) {
97+ ScoreInversionMode mode
98+ = settings ()->value (INVERT_SCORE_COLOR_deprecated).toBool () ? ScoreInversionMode::Always : ScoreInversionMode::Disabled;
99+ settings ()->setSharedValue (SCORE_COLOR_INVERSION_MODE, Val (mode));
100+ settings ()->remove (INVERT_SCORE_COLOR_deprecated);
101+ }
102+ }
103+
100104 for (voice_idx_t voice = 0 ; voice < VOICES; ++voice) {
101105 Settings::Key key (" engraving" , " engraving/colors/voice" + std::to_string (voice + 1 ));
102106
0 commit comments