Skip to content

Commit

Permalink
partial fix for #306911
Browse files Browse the repository at this point in the history
* clarify the "don't ask again"
* mention the current MuseScore version (that way the same dialog still
works in MuseScore 4)
* don't mark the score dirty if the reset is taken
  • Loading branch information
Jojo-Schmitz committed Jun 24, 2020
1 parent 67e0829 commit b07cd7c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2110,11 +2110,13 @@ static void resetElementPosition(void*, Element* e)
// cmdResetAllPositions
//---------------------------------------------------------

void Score::cmdResetAllPositions()
void Score::cmdResetAllPositions(bool undoable)
{
startCmd();
if (undoable)
startCmd();
scanElements(nullptr, resetElementPosition);
endCmd();
if (undoable)
endCmd();
}

//---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion libmscore/score.h
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ class Score : public QObject, public ScoreElement {
void cmdAddOttava(OttavaType);
void cmdAddStretch(qreal);
void cmdResetNoteAndRestGroupings();
void cmdResetAllPositions();
void cmdResetAllPositions(bool undoable = true);
void cmdDoubleDuration() { cmdIncDecDuration(-1, false); }
void cmdHalfDuration() { cmdIncDecDuration( 1, false); }
void cmdIncDurationDotted() { cmdIncDecDuration(-1, true); }
Expand Down
10 changes: 5 additions & 5 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2575,25 +2575,25 @@ void MuseScore::askResetOldScorePositions(Score* score)
if (resPref == "No")
return;
else if (resPref == "Yes")
score->cmdResetAllPositions();
score->cmdResetAllPositions(false);
else { // either set to "Ask" or not at all
QMessageBox msgBox;
QCheckBox ask;
ask.setText(tr("Don't ask me again."));
ask.setText(tr("Remember my choice and don't ask again."));
ask.setToolTip(tr("You can change this behaviour any time in 'Preferences… > Import > Reset Element Positions'"));
msgBox.setCheckBox(&ask);
QString question = tr("Reset the positions of all elements?");
msgBox.setWindowTitle(question);
msgBox.setText(tr("To best take advantage of automatic placement in MuseScore 3 when importing '%1' from MuseScore %2, it is recommended to reset the positions of all elements.")
.arg(score->masterScore()->fileInfo()->completeBaseName(), score->mscoreVersion()) + "\n\n" + question);
msgBox.setText(tr("To best take advantage of automatic placement in MuseScore %1 when importing '%2' from MuseScore %3, it is recommended to reset the positions of all elements.")
.arg(VERSION).arg(score->masterScore()->fileInfo()->completeBaseName(), score->mscoreVersion()) + "\n\n" + question);
msgBox.setIcon(QMessageBox::Question);
msgBox.setStandardButtons(
QMessageBox::Yes | QMessageBox::No
);

int res = msgBox.exec();
if (res == QMessageBox::Yes)
score->cmdResetAllPositions();
score->cmdResetAllPositions(false);
if (ask.checkState() == Qt::Checked)
preferences.setPreference(PREF_IMPORT_COMPATIBILITY_RESET_ELEMENT_POSITIONS, res == QMessageBox::No? "Yes" : "No");
}
Expand Down

0 comments on commit b07cd7c

Please sign in to comment.