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 "MenuRegistry.h"
17
20
21#include "ProjectWindow.h"
22
25
26#include "CommonCommandFlags.h"
27
28namespace
29{
30using namespace audacity::cloud::audiocom;
32
33void OnSaveToCloud(const CommandContext& context)
34{
35 SaveToCloud(context.project, UploadMode::Normal);
36}
37
38void OnOpenFromCloud(const CommandContext& context)
39{
41 &context.project };
42
43 dialog.ShowModal();
44}
45
46void OnUpdateMixdown(const CommandContext& context)
47{
49 context.project,
50 [](auto& project, auto state)
51 {
52 if (state != MixdownState::Succeeded)
53 return;
54
55 auto& projectCloudExtension = ProjectCloudExtension::Get(project);
56
57 BasicUI::OpenInDefaultBrowser(
58 projectCloudExtension.GetCloudProjectPage());
59 });
60}
61
62void OnShareAudio(const CommandContext& context)
63{
64 ShareAudioDialog dialog {
65 context.project,
67 };
68
69 dialog.ShowModal();
70}
71
73{
75 [](const AudacityProject& project)
76 { return ProjectCloudExtension::Get(project).IsCloudProject(); },
78 return XO("Previews can be updated only for Cloud projects");
79 } }.QuickTest()
80 .Priority(1)
81 };
82 return flag;
83}
84
85using namespace MenuRegistry;
86
88 wxT("SaveToCloud"), XXO("Save &To Cloud..."),
90 wxT("File/Save") };
91
93 wxT("UpdateMixdown"),
94 XXO("&Update Cloud Audio Preview"),
96 wxT("File/Save") };
97
99 wxT("OpenFromCloud"),
100 XXO("Open Fro&m Cloud..."), OnOpenFromCloud,
102 wxT("File/Basic") };
103
105 wxT("ShareAudio"), XXO("S&hare Audio..."),
107 wxT("File/Import-Export") };
108
109} // 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)