15#include <wx/checkbox.h>
17#include <wx/statbmp.h>
18#include <wx/statline.h>
19#include <wx/stattext.h>
25#include "../images/CloudImages.hpp"
62 XO(
"How would you like to save?"),
64 XO(
"Save to the Cloud (free)"),
65 XO(
"Your project is backed up privately on audio.com. You can access your work from any device and collaborate on your project with others. Cloud saving is free for a limited number of projects."),
66 XXO(
"&Save to Cloud"),
68 XO(
"On your computer"),
69 XO(
"Files are saved on your device.\nNote: To export MP3 and WAV files, use File > Export Audio instead."),
70 XXO(
"Save to &computer"),
71 XO(
"&Remember my choice and don't show again"),
79 XO(
"How would you like to export?"),
81 XO(
"Share to audio.com"),
82 XO(
"Uploads an uncompressed audio file and generates a shareable link. This link allows others to download the file in either .wav or .mp3 format."),
83 XXO(
"&Share to audio.com"),
85 XO(
"On your computer"),
86 XO(
"Export MP3s, WAVs, FLACs and other formats to your computer."),
87 XXO(
"Export to &computer"),
88 XO(
"&Don't show again"),
101 wxStaticBitmap* image, wxStaticText*
title, wxStaticText* description,
104 const auto leftPaddingFlags = wxSizerFlags {}.Border(wxLEFT,
leftPadding);
106 auto sizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
109 sizer->AddSpacer(24);
110 sizer->Add(
title, leftPaddingFlags);
111 sizer->AddSpacer(12);
112 sizer->Add(description, leftPaddingFlags);
113 sizer->AddSpacer(40);
114 sizer->AddStretchSpacer(1);
115 sizer->Add(button, leftPaddingFlags);
125 auto button =
safenew wxButton(parent, wxID_ANY, transalatedLabel);
127 button->SetFont(font);
129 const auto textSize = button->GetTextExtent(transalatedLabel);
131 button->SetMinSize({ textSize.x + 12 * 2, 32 });
141 XO(
"Audacity"), wxDefaultPosition,
142 { 442, -1 }, wxDEFAULT_DIALOG_STYLE }
145 auto& description = type == LocationDialogType::Save ?
149 wxFont titleFont = GetFont();
150 titleFont.SetWeight(wxFONTWEIGHT_BOLD);
151 titleFont.SetPixelSize({ 0, 18 });
153 wxFont descriptionFont = GetFont();
154 descriptionFont.SetPixelSize({ 0, 14 });
157 this, wxID_ANY, description.DialogTitle.Translation());
158 title->SetFont(titleFont);
160 auto saveToCloudImage =
161 safenew wxStaticBitmap(
this, wxID_ANY, **description.RemoteImage);
163 auto saveToCloudTitle =
safenew wxStaticText(
164 this, wxID_ANY, description.RemoteTitle.Translation());
165 saveToCloudTitle->SetFont(titleFont);
167 auto saveToCloudDescription =
safenew wxStaticText(
168 this, wxID_ANY, description.RemoteDescription.Translation());
169 saveToCloudDescription->SetFont(descriptionFont);
172 auto saveToCloudButton =
173 CreateButton(
this, descriptionFont, description.RemoteButtonLabel);
175 auto saveToComputerImage =
176 safenew wxStaticBitmap(
this, wxID_ANY, **description.LocalImage);
178 auto saveToComputerTitle =
safenew wxStaticText(
179 this, wxID_ANY, description.LocalTitle.Translation());
180 saveToComputerTitle->SetFont(titleFont);
182 auto saveToComputerDescription =
safenew wxStaticText(
183 this, wxID_ANY, description.LocalDescription.Translation());
184 saveToComputerDescription->SetFont(descriptionFont);
187 auto saveToComputerButton =
188 CreateButton(
this, descriptionFont, description.LocalButtonTitle);
190 auto rememberChoiceCheckbox =
safenew wxCheckBox(
192 description.DoNotShowLabel.Translation());
194 mDoNotShow = description.LocationMode.ReadEnum() != CloudLocationMode::Ask;
195 rememberChoiceCheckbox->SetValue(mDoNotShow);
197 auto sizer =
safenew wxBoxSizer(wxVERTICAL);
199 sizer->Add(
title, wxSizerFlags {}.CenterHorizontal().Border(wxTOP, 16));
201 auto topSizer =
safenew wxBoxSizer(wxHORIZONTAL);
204 saveToCloudImage, saveToCloudTitle, saveToCloudDescription,
207 topSizer->Add(cloudSizer.release(), wxSizerFlags {}.Expand());
210 saveToComputerImage, saveToComputerTitle, saveToComputerDescription,
211 saveToComputerButton);
214 computerSizer.release(), wxSizerFlags {}.Expand().Border(wxLEFT, 8));
216 sizer->Add(topSizer, wxSizerFlags {}.Expand().Border(wxALL, 16));
218 sizer->Add(
safenew wxStaticLine(
this), wxSizerFlags {}.Expand());
220 sizer->Add(rememberChoiceCheckbox, wxSizerFlags {}.Border(wxALL, 16));
222 SetSizerAndFit(sizer);
231 if (!IsEscapeKey(evt))
237 EndModal(wxID_CANCEL);
240 rememberChoiceCheckbox->Bind(
241 wxEVT_CHECKBOX, [
this, rememberChoiceCheckbox](
auto)
242 { mDoNotShow = rememberChoiceCheckbox->GetValue(); });
244 saveToCloudButton->Bind(wxEVT_BUTTON, [
this](
auto) { EndModal(wxID_SAVE); });
245 saveToComputerButton->Bind(
246 wxEVT_BUTTON, [
this](
auto) { EndModal(wxID_OK); });
249CloudLocationDialog::~CloudLocationDialog()
255 auto& description = mType == LocationDialogType::Save ?
259 if (description.LocationMode.ReadEnum() != CloudLocationMode::Ask)
261 LocationDialogResult::Cloud :
262 LocationDialogResult::Local;
264 const auto result = ShowModal();
266 if (result == wxID_OK)
270 description.LocationMode.WriteEnum(CloudLocationMode::Local);
273 return LocationDialogResult::Local;
276 if (result == wxID_SAVE)
280 description.LocationMode.WriteEnum(
281 description.RememberChoiceMode == ChoiceMode::User ?
282 CloudLocationMode::Cloud :
283 CloudLocationMode::Local);
287 return LocationDialogResult::Cloud;
290 return LocationDialogResult::Cancel;
void SetupAccessibility(wxWindow *window)
wxBitmap * bin2c_ExportLocally_png
wxBitmap * bin2c_SaveRemote_png
wxBitmap * bin2c_SaveLocally_png
wxBitmap * bin2c_ExportRemote_png
XXO("&Cut/Copy/Paste Toolbar")
audacity::BasicSettings * gPrefs
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
virtual bool Flush() noexcept=0
CloudLocationDialog(wxWindow *parent, LocationDialogType type)
constexpr auto leftPadding
std::unique_ptr< wxBoxSizer > SetupVerticalSizer(wxStaticBitmap *image, wxStaticText *title, wxStaticText *description, wxButton *button)
wxButton * CreateButton(wxWindow *parent, const wxFont &font, const TranslatableString &label)
const DialogDescription ExportDialogDescription
const DialogDescription SaveDialogDescription
EnumSetting< CloudLocationMode > SaveLocationMode
EnumSetting< CloudLocationMode > ExportLocationMode
TranslatableString LocalButtonTitle
TranslatableString DoNotShowLabel
EnumSetting< CloudLocationMode > & LocationMode
TranslatableString DialogTitle
TranslatableString RemoteTitle
ChoiceMode RememberChoiceMode
TranslatableString LocalDescription
TranslatableString LocalTitle
TranslatableString RemoteButtonLabel
TranslatableString RemoteDescription