Audacity
3.2.0
modules
sharing
mod-cloud-audiocom
menus
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
"
13
#include "
CloudProjectFileIOExtensions.h
"
14
#include "
CloudProjectMixdownUtils.h
"
15
#include "
CommandContext.h
"
16
#include "
ExportUtils.h
"
17
#include "
MenuRegistry.h
"
18
19
#include "
sync/MixdownUploader.h
"
20
#include "
sync/ProjectCloudExtension.h
"
21
22
#include "
ProjectWindow.h
"
23
24
#include "
ui/dialogs/ProjectsListDialog.h
"
25
#include "
ui/dialogs/ShareAudioDialog.h
"
26
27
#include "
CommonCommandFlags.h
"
28
29
namespace
30
{
31
using namespace
audacity::cloud::audiocom
;
32
using namespace
audacity::cloud::audiocom::sync
;
33
34
void
OnSaveToCloud
(
const
CommandContext
& context)
35
{
36
SaveToCloud
(context.
project
, UploadMode::Normal);
37
}
38
39
void
OnOpenFromCloud
(
const
CommandContext
& context)
40
{
41
ProjectsListDialog
dialog {
ProjectWindow::Find
(&context.
project
),
42
&context.
project
};
43
44
dialog.ShowModal();
45
}
46
47
void
OnUpdateMixdown
(
const
CommandContext
& context)
48
{
49
UploadMixdown
(
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
64
void
OnShareAudio
(
const
CommandContext
& context)
65
{
66
ShareAudioDialog
dialog {
67
context.
project
,
68
AudiocomTrace::ShareAudioMenu
,
69
ProjectWindow::Find
(&context.
project
),
70
};
71
72
dialog.ShowModal();
73
}
74
75
const
ReservedCommandFlag
&
IsCloudProjectFlag
()
76
{
77
static
ReservedCommandFlag
flag
{
78
[](
const
AudacityProject
&
project
)
79
{
return
ProjectCloudExtension::Get
(
project
).IsCloudProject(); },
80
CommandFlagOptions
{ [](
const
TranslatableString
&) {
81
return
XO
(
"Previews can be updated only for Cloud projects"
);
82
} }.QuickTest()
83
.Priority(1)
84
};
85
return
flag
;
86
}
87
88
using namespace
MenuRegistry
;
89
90
AttachedItem
sSaveAttachment
{
Command
(
91
wxT
(
"SaveToCloud"
),
XXO
(
"Save &To Cloud..."
),
92
OnSaveToCloud
,
AlwaysEnabledFlag
),
93
wxT
(
"File/Save"
) };
94
95
AttachedItem
sMixdownAttachment
{
Command
(
96
wxT
(
"UpdateMixdown"
),
97
XXO
(
"&Update Cloud Audio Preview"
),
98
OnUpdateMixdown
,
IsCloudProjectFlag
()),
99
wxT
(
"File/Save"
) };
100
101
AttachedItem
sOpenAttachment
{
Command
(
102
wxT
(
"OpenFromCloud"
),
103
XXO
(
"Open Fro&m Cloud..."
),
OnOpenFromCloud
,
104
AlwaysEnabledFlag
),
105
wxT
(
"File/Basic"
) };
106
107
AttachedItem
sShareAttachment
{
Command
(
108
wxT
(
"ShareAudio"
),
XXO
(
"S&hare Audio..."
),
109
OnShareAudio
,
WaveTracksExistFlag
()),
110
wxT
(
"File/Import-Export"
) };
111
112
}
// namespace
wxT
wxT("CloseDown"))
BasicUI.h
Toolkit-neutral facade for basic user interface services.
CloudProjectFileIOExtensions.h
CloudProjectMixdownUtils.h
CommandContext.h
AlwaysEnabledFlag
constexpr CommandFlag AlwaysEnabledFlag
Definition:
CommandFlag.h:34
WaveTracksExistFlag
const ReservedCommandFlag & WaveTracksExistFlag()
Definition:
CommonCommandFlags.cpp:254
CommonCommandFlags.h
ExportUtils.h
AudiocomTrace::ShareAudioMenu
@ ShareAudioMenu
XO
XO("Cut/Copy/Paste")
XXO
XXO("&Cut/Copy/Paste Toolbar")
MenuRegistry.h
MixdownUploader.h
ProjectCloudExtension.h
ProjectWindow.h
ProjectsListDialog.h
ShareAudioDialog.h
project
const auto project
Definition:
TestWaveTrackMaker.cpp:18
flag
static std::once_flag flag
Definition:
WaveformView.cpp:1121
AudacityProject
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
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Definition:
CommandContext.h:37
CommandContext::project
AudacityProject & project
Definition:
CommandContext.h:71
ProjectWindow::Find
static ProjectWindow * Find(AudacityProject *pProject)
Definition:
ProjectWindow.cpp:418
Registry::RegisteredItem
Generates classes whose instances register items at construction.
Definition:
Registry.h:388
ReservedCommandFlag
Definition:
CommandFlag.h:88
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition:
TranslatableString.h:32
audacity::cloud::audiocom::ShareAudioDialog
Definition:
ShareAudioDialog.h:42
audacity::cloud::audiocom::sync::ProjectsListDialog
Definition:
ProjectsListDialog.h:34
BasicUI::Get
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition:
BasicUI.cpp:202
MenuRegistry
Definition:
MenuRegistry.cpp:19
MenuRegistry::Command
constexpr auto Command
Definition:
MenuRegistry.h:456
anonymous_namespace{AudioComMenus.cpp}::OnSaveToCloud
void OnSaveToCloud(const CommandContext &context)
Definition:
AudioComMenus.cpp:34
anonymous_namespace{AudioComMenus.cpp}::sMixdownAttachment
AttachedItem sMixdownAttachment
Definition:
AudioComMenus.cpp:95
anonymous_namespace{AudioComMenus.cpp}::sSaveAttachment
AttachedItem sSaveAttachment
Definition:
AudioComMenus.cpp:90
anonymous_namespace{AudioComMenus.cpp}::OnOpenFromCloud
void OnOpenFromCloud(const CommandContext &context)
Definition:
AudioComMenus.cpp:39
anonymous_namespace{AudioComMenus.cpp}::IsCloudProjectFlag
const ReservedCommandFlag & IsCloudProjectFlag()
Definition:
AudioComMenus.cpp:75
anonymous_namespace{AudioComMenus.cpp}::sShareAttachment
AttachedItem sShareAttachment
Definition:
AudioComMenus.cpp:107
anonymous_namespace{AudioComMenus.cpp}::OnShareAudio
void OnShareAudio(const CommandContext &context)
Definition:
AudioComMenus.cpp:64
anonymous_namespace{AudioComMenus.cpp}::sOpenAttachment
AttachedItem sOpenAttachment
Definition:
AudioComMenus.cpp:101
anonymous_namespace{AudioComMenus.cpp}::OnUpdateMixdown
void OnUpdateMixdown(const CommandContext &context)
Definition:
AudioComMenus.cpp:47
audacity::cloud::audiocom::sync
Definition:
CloudSyncService.h:31
audacity::cloud::audiocom::sync::UploadMixdown
void UploadMixdown(AudacityProject &project, std::function< void(AudacityProject &, MixdownState)> onComplete)
Definition:
CloudProjectMixdownUtils.cpp:71
audacity::cloud::audiocom::sync::SaveToCloud
void SaveToCloud(AudacityProject &project, UploadMode mode, CreateSnapshotCallback snapshotCallback)
Definition:
CloudProjectFileIOExtensions.cpp:315
audacity::cloud::audiocom
Definition:
CloudLibrarySettings.cpp:17
CommandFlagOptions
Definition:
CommandFlag.h:37
Generated by
1.9.3