Audacity 3.2.0
AudioComMenus.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 AudioComMenus.cpp
7
8 Dmitry Vedenko
9
10**********************************************************************/
11
12#include "BasicUI.h"
15#include "CommandContext.h"
16#include "ExportUtils.h"
17#include "MenuRegistry.h"
18
21
22#include "ProjectWindow.h"
23
26
27#include "CommonCommandFlags.h"
28
29namespace
30{
31using namespace audacity::cloud::audiocom;
33
34void OnSaveToCloud(const CommandContext& context)
35{
36 SaveToCloud(context.project, UploadMode::Normal);
37}
38
39void OnOpenFromCloud(const CommandContext& context)
40{
42 &context.project };
43
44 dialog.ShowModal();
45}
46
47void OnUpdateMixdown(const CommandContext& context)
48{
50 context.project,
51 [](auto& project, auto state)
52 {
53 if (state != MixdownState::Succeeded)
54 return;
55
56 auto& projectCloudExtension = ProjectCloudExtension::Get(project);
57
58 BasicUI::OpenInDefaultBrowser(
59 projectCloudExtension.GetCloudProjectPage(
60 AudiocomTrace::UpdateCloudAudioPreviewMenu));
61 });
62}
63
64void OnShareAudio(const CommandContext& context)
65{
66 ShareAudioDialog dialog {
67 context.project,
70 };
71
72 dialog.ShowModal();
73}
74
76{
78 [](const AudacityProject& project)
79 { return ProjectCloudExtension::Get(project).IsCloudProject(); },
81 return XO("Previews can be updated only for Cloud projects");
82 } }.QuickTest()
83 .Priority(1)
84 };
85 return flag;
86}
87
88using namespace MenuRegistry;
89
91 wxT("SaveToCloud"), XXO("Save &To Cloud..."),
93 wxT("File/Save") };
94
96 wxT("UpdateMixdown"),
97 XXO("&Update Cloud Audio Preview"),
99 wxT("File/Save") };
100
102 wxT("OpenFromCloud"),
103 XXO("Open Fro&m Cloud..."), OnOpenFromCloud,
105 wxT("File/Basic") };
106
108 wxT("ShareAudio"), XXO("S&hare Audio..."),
110 wxT("File/Import-Export") };
111
112} // namespace
wxT("CloseDown"))
Toolkit-neutral facade for basic user interface services.
constexpr CommandFlag AlwaysEnabledFlag
Definition: CommandFlag.h:34
const ReservedCommandFlag & WaveTracksExistFlag()
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
const auto project
static std::once_flag flag
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
AudacityProject & project
static ProjectWindow * Find(AudacityProject *pProject)
Generates classes whose instances register items at construction.
Definition: Registry.h:388
Holds a msgid for the translation catalog; may also bind format arguments.
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:202
constexpr auto Command
Definition: MenuRegistry.h:456
void OnSaveToCloud(const CommandContext &context)
void OnOpenFromCloud(const CommandContext &context)
const ReservedCommandFlag & IsCloudProjectFlag()
void OnShareAudio(const CommandContext &context)
void OnUpdateMixdown(const CommandContext &context)
void UploadMixdown(AudacityProject &project, std::function< void(AudacityProject &, MixdownState)> onComplete)
void SaveToCloud(AudacityProject &project, UploadMode mode, CreateSnapshotCallback snapshotCallback)