Audacity 3.2.0
SyncFailedDialog.cpp
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 SyncFailedDialog.cpp
7
8 Dmitry Vedenko
9
10**********************************************************************/
11#include "SyncFailedDialog.h"
12
13#include "CodeConversions.h"
14
16{
17namespace
18{
20 XO("You are not authorized to access this project.");
21const auto MessageExpired =
22 XO("You tried to access a project that has expired.");
24 XO("Audacity had trouble connecting to the server.");
25const auto MessageTooLarge = XO(
26 "The project is too large to upload. Please save it to your computer instead.");
27const auto MessageForbidden = XO("You don't have access to this project.");
28const auto MessageNotFound = XO("The project could not be found.");
30 XO("The server responded with something Audacity could not understand.");
32 XO("Audacity encountered an internal error.");
34 XO("Audio.com encountered an internal error.");
35const auto MessageUnknownError = XO("Audacity encountered an unknown error.");
36
38{
39 switch (error.Type)
40 {
49 default:
51 }
52}
53
55{
56 switch (error.Code)
57 {
61 return MessageExpired;
65 return MessageTooLarge;
67 return MessageForbidden;
69 return MessageNotFound;
74 default:
76 }
77}
78} // namespace
79
81{
82 if (error.Type == CloudSyncError::None)
83 return;
84
85 auto message = GetMessage(error);
86
87 SyncFailedDialog dialog { nullptr, message, error.ErrorMessage,
89 dialog.ShowDialog();
90}
91
93{
94 if (error.Type == CloudSyncError::None)
95 return;
96
97 auto message = GetMessage(error);
98
99 SyncFailedDialog dialog { nullptr, message, error.ErrorMessage,
101 dialog.ShowDialog();
102}
103
105{
106 if (error.Code == SyncResultCode::Success)
107 return;
108
109 auto message = GetMessage(error);
110
111 SyncFailedDialog dialog { nullptr, message, error.Content,
113 dialog.ShowDialog();
114}
115
117{
118 if (error.Code == SyncResultCode::Success)
119 return;
120
121 auto message = GetMessage(error);
122
123 SyncFailedDialog dialog { nullptr, message, error.Content,
125 dialog.ShowDialog();
126}
127
129 const AudacityProject* project, const TranslatableString& message,
130 const std::string& log, DialogMode dialogMode)
131 : AudioComDialogBase { project, {}, dialogMode }
132{
133 AddTitle(XO("Sync failed"));
134
135 AddParagraph(message);
136
137 if (!log.empty())
138 AddParagraph(XO("Error details:\n%s").Format(ToWXString(log)));
139
140 AddButton(CancelButtonIdentifier(), XO("OK"), DefaultButton | EscButton);
141}
142
143} // namespace audacity::cloud::audiocom::sync
Declare functions to perform UTF-8 to std::wstring conversions.
XO("Cut/Copy/Paste")
const auto project
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
Abstract base class used in importing a file.
Holds a msgid for the translation catalog; may also bind format arguments.
SyncFailedDialog(const AudacityProject *project, const TranslatableString &message, const std::string &log, DialogMode dialogMode)
static void OnOpen(const CloudSyncError &error)
static void OnSave(const CloudSyncError &error)
wxString ToWXString(const std::string &str)