Skip to content

Commit

Permalink
Merge pull request musescore#16361 from Eism/score_upload_corruption_…
Browse files Browse the repository at this point in the history
…part2

fixed musescore#16360: Tidy-up two aspects of new "corrupted score" messaging flows for unsaved scores
  • Loading branch information
RomanPudashkin authored Feb 16, 2023
2 parents c8755fb + ad1bb41 commit 802f36d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions src/project/internal/projectactionscontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ void ProjectActionsController::warnSaveIsNotAvailable(const Ret& ret, const Save
warnScoreWithoutPartsCannotBeSaved();
break;
case Err::CorruptionUponOpenningError:
warnCorruptedScoreUponOpenningCannotBeSaved(location, ret.text());
showErrCorruptedScoreCannotBeSaved(location, ret.text());
break;
case Err::CorruptionError: {
auto project = currentNotationProject();
Expand All @@ -946,9 +946,15 @@ void ProjectActionsController::warnCorruptedScoreCannotBeSaved(const SaveLocatio
bool newlyCreated)
{
switch (location.type) {
case SaveLocationType::Cloud:
warnCorruptedScoreCannotBeSavedOnCloud(errorText, newlyCreated);
case SaveLocationType::Cloud: {
if (newlyCreated) {
showErrCorruptedScoreCannotBeSaved(location, errorText);
} else {
warnCorruptedScoreCannotBeSavedOnCloud(errorText, newlyCreated);
}

break;
}
case SaveLocationType::Local:
warnCorruptedScoreCannotBeSavedLocally(location, errorText, newlyCreated);
case SaveLocationType::Undefined:
Expand Down Expand Up @@ -993,9 +999,11 @@ void ProjectActionsController::warnCorruptedScoreCannotBeSavedLocally(const Save
bool newlyCreated)
{
std::string title = trc("project", "This score has become corrupted and contains errors");
std::string body = trc("project", "You can continue saving it locally, although the file may become unusable. "
"To preserve your score, revert to the last saved version, or fix the errors manually. "
"You can also get help for this issue on musescore.org.");
std::string body = newlyCreated ? trc("project", "You can continue saving it locally, although the file may become unusable. "
"You can try to fix the errors manually, or get help for this issue on musescore.org.")
: trc("project", "You can continue saving it locally, although the file may become unusable. "
"To preserve your score, revert to the last saved version, or fix the errors manually. "
"You can also get help for this issue on musescore.org.");

IInteractive::ButtonDatas buttons;
buttons.push_back(interactive()->buttonData(IInteractive::Button::Cancel));
Expand All @@ -1021,7 +1029,7 @@ void ProjectActionsController::warnCorruptedScoreCannotBeSavedLocally(const Save
}
}

void ProjectActionsController::warnCorruptedScoreUponOpenningCannotBeSaved(const SaveLocation& location, const std::string& errorText)
void ProjectActionsController::showErrCorruptedScoreCannotBeSaved(const SaveLocation& location, const std::string& errorText)
{
std::string title = location.isLocal() ? trc("project", "Your score cannot be saved")
: trc("project", "Your score cannot be uploaded to the cloud");
Expand Down
2 changes: 1 addition & 1 deletion src/project/internal/projectactionscontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class ProjectActionsController : public IProjectFilesController, public QObject,
void warnCorruptedScoreCannotBeSaved(const SaveLocation& location, const std::string& errorText, bool newlyCreated);
void warnCorruptedScoreCannotBeSavedOnCloud(const std::string& errorText, bool newlyCreated);
void warnCorruptedScoreCannotBeSavedLocally(const SaveLocation& location, const std::string& errorText, bool newlyCreated);
void warnCorruptedScoreUponOpenningCannotBeSaved(const SaveLocation& location, const std::string& errorText);
void showErrCorruptedScoreCannotBeSaved(const SaveLocation& location, const std::string& errorText);

void revertCorruptedScoreToLastSaved();

Expand Down

0 comments on commit 802f36d

Please sign in to comment.