1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*!********************************************************************
Audacity: A Digital Audio Editor
NotCloudProjectDialog.cpp
Dmitry Vedenko
**********************************************************************/
#include "ProjectVersionConflictDialog.h"
namespace audacity::cloud::audiocom::sync
{
namespace
{
struct DialogProperties final
{
TranslatableString Title;
TranslatableString Message;
TranslatableString LocalButtonText;
TranslatableString RemoteButtonText;
bool HasCancelButton {};
};
const DialogProperties dialogProperties[] = {
{ XO("Project version conflict detected"),
XO("There's a newer version of this Audacity project on Audio.com. Saving this project will replace it as the newest version instead."),
XO("Save this project"), XO("Discard and open latest version"), false },
{ XO("Project version conflict detected"),
XO("Project contains unsaved changes. There's a newer version of this Audacity project on Audio.com. Discarding changes will open the latest version instead."),
XO("Open local project"), XO("Discard and open latest version"), true },
{ XO("Cloud project conflict"),
XO("You are attempting to open a new active version of this project when there is already one open. Please select which version you wish to remain open."),
XO("Keep currently open version"), XO("Open new version"), false },
};
} // namespace
ProjectVersionConflictDialog::ProjectVersionConflictDialog(
const AudacityProject* project, ProjectVersionConflictDialogMode openMode)
: AudioComDialogBase { project }
{
const auto& properties = dialogProperties[static_cast<int>(openMode)];
AddTitle(properties.Title);
AddParagraph(properties.Message);
if (properties.HasCancelButton)
AddButton(CancelButtonIdentifier(), XO("Cancel"), EscButton);
AddButton(
UseLocalIdentifier(), properties.LocalButtonText,
!properties.HasCancelButton ? EscButton : 0);
AddButton(UseRemoteIdentifier(), properties.RemoteButtonText, DefaultButton);
}
DialogButtonIdentifier ProjectVersionConflictDialog::UseLocalIdentifier()
{
return { L"local" };
}
DialogButtonIdentifier ProjectVersionConflictDialog::UseRemoteIdentifier()
{
return { L"remote" };
}
} // namespace audacity::cloud::audiocom::sync
|