Audacity 3.2.0
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
audacity::cloud::audiocom::sync Namespace Reference

Namespaces

namespace  anonymous_namespace{AudioComDialogBase.cpp}
 
namespace  anonymous_namespace{CloudLocationDialog.cpp}
 
namespace  anonymous_namespace{CloudProjectOpenUtils.cpp}
 
namespace  anonymous_namespace{CloudProjectsDatabase.cpp}
 
namespace  anonymous_namespace{CloudSyncDTO.cpp}
 
namespace  anonymous_namespace{CloudSyncHousekeeper.cpp}
 
namespace  anonymous_namespace{CloudSyncStatusField.cpp}
 
namespace  anonymous_namespace{MixdownUploader.cpp}
 
namespace  anonymous_namespace{ProjectCloudExtension.cpp}
 
namespace  anonymous_namespace{ProjectCloudUIExtension.cpp}
 
namespace  anonymous_namespace{ProjectsListDialog.cpp}
 
namespace  anonymous_namespace{ProjectVersionConflictDialog.cpp}
 
namespace  anonymous_namespace{RemoteProjectSnapshot.cpp}
 
namespace  anonymous_namespace{ResumedSnaphotUploadOperation.cpp}
 
namespace  anonymous_namespace{SyncFailedDialog.cpp}
 
namespace  anonymous_namespace{WavPackCompressor.cpp}
 

Classes

class  AudioComDialogBase
 
class  BlockHashCache
 
class  BlockHasher
 
struct  BlockUploadTask
 
class  CloudLocationDialog
 
class  CloudProjectPropertiesDialog
 
class  CloudProjectsDatabase
 
struct  CloudStatusChangedMessage
 
struct  CloudSyncError
 
class  CloudSyncStatusField
 
class  ConnectionIssuesDialog
 
struct  CreateSnapshotResponse
 
class  DataUploader
 
struct  DBProjectData
 
struct  DecompressedBlock
 
struct  DialogButtonIdentifierTag
 
struct  DialogIdentifierTag
 
class  LinkAccountDialog
 
class  LocalProjectSnapshot
 
struct  LockedBlock
 
struct  MinMaxRMS
 
class  MissingBlocksUploader
 
struct  MissingBlocksUploadProgress
 
struct  MixdownResult
 
class  MixdownUploader
 
struct  NetworkStats
 
class  NotCloudProjectDialog
 
struct  OnCloseHook
 
struct  PaginatedProjectsResponse
 
struct  PaginationInfo
 
struct  PendingProjectBlobData
 
struct  PendingProjectBlockData
 
struct  PendingSnapshotData
 
class  ProjectCloudExtension
 
class  ProjectCloudUIExtension
 
struct  ProjectForm
 
struct  ProjectInfo
 
class  ProjectLimitDialog
 
class  ProjectsListDialog
 
struct  ProjectSyncResult
 
struct  ProjectSyncState
 
struct  ProjectUploadData
 
class  ProjectUploadOperation
 
class  ProjectVersionConflictDialog
 
class  RemoteProjectSnapshot
 
struct  RemoteProjectSnapshotState
 
struct  SnapshotBlockInfo
 
struct  SnapshotInfo
 
class  SyncFailedDialog
 
class  SyncInBackroundDialog
 
class  SyncSucceededDialog
 
class  UnsyncedProjectDialog
 
class  UploadCanceledDialog
 
struct  UploadUrls
 
struct  VersionInfo
 
class  WaitForActionDialog
 

Typedefs

using ProgressCallback = std::function< bool(double)>
 
using GetProjectsResult = std::variant< sync::PaginatedProjectsResponse, ResponseResult >
 
using GetHeadSnapshotIDResult = std::variant< std::string, ResponseResult >
 
using BlockID = int64_t
 
using BlockHash = std::string
 
using SampleBlockHashes = std::vector< BlockHash >
 
using UploadData = std::variant< std::vector< uint8_t >, std::string >
 
using MissingBlocksUploadProgressCallback = std::function< void(const MissingBlocksUploadProgress &, const LockedBlock &, ResponseResult blockResponseResult)>
 
using MixdownProgressCallback = std::function< void(double progress)>
 
using RemoteProjectSnapshotStateCallback = std::function< void(RemoteProjectSnapshotState)>
 
using CreateSnapshotCallback = std::function< void(const CreateSnapshotResponse &)>
 
using DialogIdentifier = TaggedIdentifier< DialogIdentifierTag >
 
using DialogButtonIdentifier = TaggedIdentifier< DialogButtonIdentifierTag >
 

Enumerations

enum class  MixdownState : uint32_t {
  Exporting , WaitingForUrls , Uploading , Succeeded ,
  Cancelled , Failed , Empty
}
 
enum class  ProjectSyncStatus {
  Local , Unsynced , Synced , Failed ,
  Syncing
}
 
enum class  UploadMode { Normal , CreateNew , ForceOverwrite }
 
enum class  CloudLocationMode { Ask , Local , Cloud }
 
enum class  LocationDialogResult { Local , Cloud , Cancel }
 
enum class  LocationDialogType { Save , Export }
 
enum class  ProjectVersionConflictDialogMode { Save , OpenDirty , OpenActive }
 

Functions

std::string Serialize (const ProjectForm &form)
 
std::optional< ProjectSyncStateDeserializeProjectSyncState (const std::string &data)
 
std::optional< CreateSnapshotResponseDeserializeCreateSnapshotResponse (const std::string &data)
 
std::optional< PaginatedProjectsResponseDeserializePaginatedProjectsResponse (const std::string &data)
 
std::optional< ProjectInfoDeserializeProjectInfo (const std::string &data)
 
std::optional< SnapshotInfoDeserializeSnapshotInfo (const std::string &data)
 
wxString MakeSafeProjectPath (const wxString &rootDir, const wxString &projectName)
 
std::string Serialize (NetworkStats stats)
 
CLOUD_AUDIOCOM_API CloudSyncError DeduceUploadError (audacity::network_manager::IResponse &response)
 
CloudSyncError MakeClientFailure (const TranslatableString &message)
 
CloudSyncError MakeClientFailure (const std::string &message)
 
CloudSyncError MakeClientFailure (const char *message)
 
CloudSyncError::ErrorType DeduceError (SyncResultCode code)
 
void ResumeProjectUpload (ProjectCloudExtension &projectCloudExtension, std::function< void(AudiocomTrace)> onBeforeUploadStarts)
 
std::vector< uint8_t > CompressBlock (const LockedBlock &block)
 
std::optional< DecompressedBlockDecompressBlock (const void *data, const std::size_t size)
 
void SaveToCloud (AudacityProject &project, UploadMode mode, CreateSnapshotCallback snapshotCallback)
 
bool ResaveLocally (AudacityProject &project)
 
bool HandleMixdownLink (std::string_view uri)
 
void UploadMixdown (AudacityProject &project, std::function< void(AudacityProject &, MixdownState)> onComplete)
 
AudacityProjectGetPotentialTarget ()
 
AudacityProjectGetOpenedProject (std::string_view projectId)
 
AudacityProjectOpenProjectFromCloud (AudacityProject *potentialTarget, std::string_view projectId, std::string_view snapshotId, CloudSyncService::SyncMode mode)
 
AudacityProjectOpenProjectFromCloud (AudacityProject *potentialTarget, std::string_view projectId, std::string_view snapshotId, bool forceNew)
 
bool SyncCloudProject (AudacityProject &project, std::string_view path, AudiocomTrace trace, bool force)
 
bool HandleProjectLink (std::string_view uri)
 
void ReopenProject (AudacityProject &project)
 
void ShowDialogOn (std::function< bool()> condition, std::function< void()> dialogFactory)
 

Variables

constexpr int RetriesCount { 3 }
 
constexpr auto UNASSIGNED_PROJECT_ID = -1
 
EnumSetting< CloudLocationModeSaveLocationMode
 
EnumSetting< CloudLocationModeExportLocationMode
 
BoolSetting MixdownDialogShown
 

Detailed Description


Audacity: A Digital Audio Editor

BlockHasher.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

BlockHasher.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

CloudProjectsDatabase.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

CloudProjectsDatabase.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

CloudSyncDTO.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

CloudSyncError.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

CloudSyncHousekeeper.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

CloudProjectSnapshot.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

MissingBlocksUploader.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

MixdownUploader.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

ProjectCloudExtension.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

RemoteProjectSnapshot.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

ResumedSnaphotUploadOperation.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

WavPackCompressor.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

ModulePrefs.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

ModulePrefs.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

CloudProjectMixdownUtils.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

CloudProjectOpenUtils.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

CloudSyncStatusField.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

AudioComDialogBase.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

CloudLocationDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

CloudLocationDialog.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

CloudProjectPropertiesDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

UploadCancelledDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

ConnectionIssuesDialog.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

LinkAccountDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

LinkAccountDialog.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

ProjectVersionConflictDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

NotCloudProjectDialog.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

ProjectLimitDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

ProjectLimitDialog.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

ProjectsListDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

NotCloudProjectDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

ProjectVersionConflictDialog.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

SyncFailedDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

SyncFailedDialog.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

SyncInBackroundDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

SyncInBackroundDialog.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

SyncSucceededDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

SyncSucceededDialog.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

UnsyncedProjectDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

UnsyncedProjectDialog.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

UploadCanceledDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

UploadCancelledDialog.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

WaitForActionDialog.cpp

Dmitry Vedenko


Audacity: A Digital Audio Editor

WaitForActionDialog.h

Dmitry Vedenko


Audacity: A Digital Audio Editor

ProjectCloudUIExtension.cpp

Dmitry Vedenko

Typedef Documentation

◆ BlockHash

using audacity::cloud::audiocom::sync::BlockHash = typedef std::string

Definition at line 33 of file CloudSyncDTO.h.

◆ BlockID

Definition at line 32 of file CloudSyncDTO.h.

◆ CreateSnapshotCallback

Definition at line 30 of file CloudProjectFileIOExtensions.h.

◆ DialogButtonIdentifier

Definition at line 35 of file AudioComDialogBase.h.

◆ DialogIdentifier

Definition at line 30 of file AudioComDialogBase.h.

◆ GetHeadSnapshotIDResult

Definition at line 58 of file CloudSyncService.h.

◆ GetProjectsResult

Definition at line 55 of file CloudSyncService.h.

◆ MissingBlocksUploadProgressCallback

Definition at line 59 of file MissingBlocksUploader.h.

◆ MixdownProgressCallback

using audacity::cloud::audiocom::sync::MixdownProgressCallback = typedef std::function<void(double progress)>

Definition at line 57 of file MixdownUploader.h.

◆ ProgressCallback

using audacity::cloud::audiocom::sync::ProgressCallback = typedef std::function<bool(double)>

Definition at line 53 of file CloudSyncService.h.

◆ RemoteProjectSnapshotStateCallback

Definition at line 48 of file RemoteProjectSnapshot.h.

◆ SampleBlockHashes

Definition at line 34 of file CloudSyncDTO.h.

◆ UploadData

using audacity::cloud::audiocom::sync::UploadData = typedef std::variant<std::vector<uint8_t>, std::string>

Definition at line 34 of file DataUploader.cpp.

Enumeration Type Documentation

◆ CloudLocationMode

◆ LocationDialogResult

Enumerator
Local 
Cloud 
Cancel 

Definition at line 17 of file CloudLocationDialog.h.

18{
19 Local,
20 Cloud,
21 Cancel,
22};

◆ LocationDialogType

Enumerator
Save 
Export 

Definition at line 24 of file CloudLocationDialog.h.

25{
26 Save,
27 Export,
28};
Main class to control the export function.

◆ MixdownState

enum class audacity::cloud::audiocom::sync::MixdownState : uint32_t
strong
Enumerator
Exporting 
WaitingForUrls 
Uploading 
Succeeded 
Cancelled 
Failed 
Empty 

Definition at line 40 of file MixdownUploader.h.

◆ ProjectSyncStatus

Enumerator
Local 
Unsynced 
Synced 
Failed 
Syncing 

Definition at line 39 of file ProjectCloudExtension.h.

◆ ProjectVersionConflictDialogMode

◆ UploadMode

Function Documentation

◆ CompressBlock()

std::vector< uint8_t > audacity::cloud::audiocom::sync::CompressBlock ( const LockedBlock block)

Definition at line 491 of file WavPackCompressor.cpp.

492{
493 Exporter exporter { block };
494 return exporter.Compress();
495}

Referenced by audacity::cloud::audiocom::sync::MissingBlocksUploader::ProduceBlock(), and audacity::cloud::audiocom::sync::MissingBlocksUploader::ProducerThread().

Here is the caller graph for this function:

◆ DecompressBlock()

std::optional< DecompressedBlock > audacity::cloud::audiocom::sync::DecompressBlock ( const void *  data,
const std::size_t  size 
)

Definition at line 498 of file WavPackCompressor.cpp.

499{
500 if (data == nullptr || size == 0)
501 return {};
502
503 Importer importer { data, static_cast<int64_t>(size) };
504
505 if (!importer.Unpack())
506 return {};
507
508 DecompressedBlock result {};
509
510 result.BlockId = importer.BlockId;
511 result.Format = importer.Format;
512
513 const auto sampleSize = SAMPLE_SIZE(importer.Format);
514
515 result.Data.resize(importer.SamplesCount * sampleSize);
516
517 if (importer.Format == int16Sample)
518 {
519 std::memcpy(
520 result.Data.data(), importer.Int16Buffer.data(), result.Data.size());
521 UpdateRMS(result, importer.Int16Buffer);
522 }
523 else if (importer.Format == sampleFormat::int24Sample)
524 {
525 std::memcpy(
526 result.Data.data(), importer.Int32Buffer.data(), result.Data.size());
527 UpdateRMS(result, importer.Int32Buffer);
528 }
529 else if (importer.Format == floatSample)
530 {
531 std::memcpy(
532 result.Data.data(), importer.FloatBuffer.data(), result.Data.size());
533 UpdateRMS(result, importer.FloatBuffer);
534 }
535 else
536 {
537 assert(false);
538 return {};
539 }
540
541 return result;
542}
constexpr sampleFormat int16Sample
Definition: SampleFormat.h:43
constexpr sampleFormat floatSample
Definition: SampleFormat.h:45
#define SAMPLE_SIZE(SampleFormat)
Definition: SampleFormat.h:52
Singleton class which actually imports the audio, using ImportPlugin objects that are registered by m...
Definition: Import.h:84
void UpdateRMS(DecompressedBlock &block, const std::vector< T > &data)

References audacity::cloud::audiocom::sync::DecompressedBlock::BlockId, floatSample, int16Sample, int24Sample, SAMPLE_SIZE, size, and audacity::cloud::audiocom::sync::anonymous_namespace{WavPackCompressor.cpp}::UpdateRMS().

Referenced by audacity::cloud::audiocom::sync::RemoteProjectSnapshot::OnBlockDownloaded().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeduceError()

CLOUD_AUDIOCOM_API CloudSyncError::ErrorType audacity::cloud::audiocom::sync::DeduceError ( SyncResultCode  code)

Definition at line 88 of file CloudSyncError.cpp.

89{
90 switch (code)
91 {
92 case SyncResultCode::Success:
93 return CloudSyncError::None;
96 case SyncResultCode::Expired:
97 return CloudSyncError::DataUploadFailed;
99 return CloudSyncError::ProjectVersionConflict;
100 case SyncResultCode::ConnectionFailed:
101 return CloudSyncError::Network;
103 return CloudSyncError::ProjectStorageLimitReached;
104 case SyncResultCode::TooLarge:
105 return CloudSyncError::ProjectStorageLimitReached;
111 return CloudSyncError::ProjectNotFound;
112 case SyncResultCode::UnexpectedResponse:
113 return CloudSyncError::Server;
114 case SyncResultCode::InternalClientError:
115 return CloudSyncError::ClientFailure;
116 case SyncResultCode::UnknownError:
117 return CloudSyncError::DataUploadFailed;
118 }
119
120 return CloudSyncError::DataUploadFailed;
121}

References audacity::cloud::audiocom::sync::CloudSyncError::Authorization, audacity::cloud::audiocom::Cancelled, audacity::cloud::audiocom::sync::CloudSyncError::Cancelled, audacity::cloud::audiocom::sync::CloudSyncError::ClientFailure, audacity::cloud::audiocom::Conflict, audacity::cloud::audiocom::ConnectionFailed, audacity::cloud::audiocom::sync::CloudSyncError::DataUploadFailed, audacity::cloud::audiocom::Expired, audacity::cloud::audiocom::Forbidden, audacity::cloud::audiocom::InternalClientError, audacity::cloud::audiocom::sync::CloudSyncError::Network, audacity::cloud::audiocom::sync::CloudSyncError::None, audacity::cloud::audiocom::NotFound, audacity::cloud::audiocom::PaymentRequired, audacity::cloud::audiocom::sync::CloudSyncError::ProjectNotFound, audacity::cloud::audiocom::sync::CloudSyncError::ProjectStorageLimitReached, audacity::cloud::audiocom::sync::CloudSyncError::ProjectVersionConflict, audacity::cloud::audiocom::sync::CloudSyncError::Server, audacity::cloud::audiocom::Success, audacity::cloud::audiocom::TooLarge, audacity::cloud::audiocom::Unauthorized, audacity::cloud::audiocom::UnexpectedResponse, and audacity::cloud::audiocom::UnknownError.

Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::DataUploadFailed(), and audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::FailSync().

Here is the caller graph for this function:

◆ DeduceUploadError()

CLOUD_AUDIOCOM_API CloudSyncError audacity::cloud::audiocom::sync::DeduceUploadError ( audacity::network_manager::IResponse response)

Definition at line 23 of file CloudSyncError.cpp.

24{
25 using namespace audacity::network_manager;
26
27 const auto error = response.getError();
28
29 if (error == NetworkError::NoError)
30 return {};
31
32 CloudSyncError result;
33
34 if (error != NetworkError::HTTPError)
35 {
36 result.Type = error == NetworkError::OperationCancelled ?
38 CloudSyncError::Network;
39
40 result.ErrorMessage = response.getErrorString();
41
42 return result;
43 }
44
45 const auto statusCode = response.getHTTPCode();
46
47 static const std::unordered_map<int, CloudSyncError::ErrorType> errors {
49 { HttpCode::PaymentRequired, CloudSyncError::ProjectLimitReached },
51 { HttpCode::NotFound, CloudSyncError::ProjectNotFound },
52 { HttpCode::RequestTimeout, CloudSyncError::Network },
53 { HttpCode::Conflict, CloudSyncError::ProjectVersionConflict },
54 { HttpCode::Gone, CloudSyncError::ProjectNotFound },
55 { HttpCode::PayloadTooLarge, CloudSyncError::ProjectStorageLimitReached },
56 { HttpCode::UnprocessableEntity, CloudSyncError::ProjectVersionConflict },
57 { HttpCode::GatewayTimeout, CloudSyncError::Network },
58 { HttpCode::HTTPVersionNotSupported, CloudSyncError::Network },
59 { HttpCode::NetworkAuthenticationRequired, CloudSyncError::Network },
60 };
61
62 const auto it = errors.find(statusCode);
63
64 result.Type = it == errors.end() ? CloudSyncError::Server : it->second;
65
66 result.ErrorMessage = std::string("HTTP ") + std::to_string(statusCode) +
67 std::string("\n") + response.readAll<std::string>();
68
69 return result;
70}
virtual std::string getErrorString() const =0
virtual unsigned getHTTPCode() const noexcept=0
virtual NetworkError getError() const noexcept=0

References audacity::cloud::audiocom::sync::CloudSyncError::Authorization, audacity::cloud::audiocom::sync::CloudSyncError::Cancelled, audacity::network_manager::HttpCode::Conflict, audacity::cloud::audiocom::sync::CloudSyncError::ErrorMessage, audacity::network_manager::HttpCode::Forbidden, audacity::network_manager::HttpCode::GatewayTimeout, audacity::network_manager::IResponse::getError(), audacity::network_manager::IResponse::getErrorString(), audacity::network_manager::IResponse::getHTTPCode(), audacity::network_manager::HttpCode::Gone, audacity::network_manager::HttpCode::HTTPVersionNotSupported, audacity::cloud::audiocom::sync::CloudSyncError::Network, audacity::network_manager::HttpCode::NetworkAuthenticationRequired, audacity::network_manager::HttpCode::NotFound, audacity::network_manager::HttpCode::PayloadTooLarge, audacity::network_manager::HttpCode::PaymentRequired, audacity::cloud::audiocom::sync::CloudSyncError::ProjectLimitReached, audacity::cloud::audiocom::sync::CloudSyncError::ProjectNotFound, audacity::cloud::audiocom::sync::CloudSyncError::ProjectStorageLimitReached, audacity::cloud::audiocom::sync::CloudSyncError::ProjectVersionConflict, audacity::network_manager::IResponse::readAll(), audacity::network_manager::HttpCode::RequestTimeout, audacity::cloud::audiocom::sync::CloudSyncError::Server, audacity::cloud::audiocom::sync::CloudSyncError::Type, audacity::network_manager::HttpCode::Unauthorized, and audacity::network_manager::HttpCode::UnprocessableEntity.

Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::MarkSnapshotSynced(), audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::MarkSnapshotSynced(), and audacity::cloud::audiocom::sync::LocalProjectSnapshot::UpdateProjectSnapshot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeserializeCreateSnapshotResponse()

std::optional< CreateSnapshotResponse > audacity::cloud::audiocom::sync::DeserializeCreateSnapshotResponse ( const std::string &  data)

Definition at line 422 of file CloudSyncDTO.cpp.

423{
425
426 if (Deserialize(data, result))
427 return std::move(result);
428
429 return {};
430}

References audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize().

Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::UpdateProjectSnapshot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeserializePaginatedProjectsResponse()

std::optional< PaginatedProjectsResponse > audacity::cloud::audiocom::sync::DeserializePaginatedProjectsResponse ( const std::string &  data)

Definition at line 433 of file CloudSyncDTO.cpp.

434{
436
437 if (Deserialize(data, result))
438 return std::move(result);
439
440 return {};
441}

References audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize().

Referenced by audacity::cloud::audiocom::CloudSyncService::GetProjects().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeserializeProjectInfo()

std::optional< ProjectInfo > audacity::cloud::audiocom::sync::DeserializeProjectInfo ( const std::string &  data)

Definition at line 443 of file CloudSyncDTO.cpp.

444{
445 ProjectInfo result;
446
447 if (Deserialize(data, result))
448 return std::move(result);
449
450 return {};
451}

References audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize().

Referenced by audacity::cloud::audiocom::anonymous_namespace{CloudSyncService.cpp}::GetProjectInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeserializeProjectSyncState()

std::optional< ProjectSyncState > audacity::cloud::audiocom::sync::DeserializeProjectSyncState ( const std::string &  data)

Definition at line 411 of file CloudSyncDTO.cpp.

412{
413 ProjectSyncState result;
414
415 if (Deserialize(data, result))
416 return std::move(result);
417
418 return {};
419}

References audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize().

Referenced by audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::RefreshUrls().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeserializeSnapshotInfo()

std::optional< SnapshotInfo > audacity::cloud::audiocom::sync::DeserializeSnapshotInfo ( const std::string &  data)

Definition at line 453 of file CloudSyncDTO.cpp.

454{
455 SnapshotInfo result;
456
457 if (Deserialize(data, result))
458 return std::move(result);
459
460 return {};
461}

References audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize().

Referenced by audacity::cloud::audiocom::anonymous_namespace{CloudSyncService.cpp}::GetSnapshotInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetOpenedProject()

AudacityProject * audacity::cloud::audiocom::sync::GetOpenedProject ( std::string_view  projectId)

Definition at line 138 of file CloudProjectOpenUtils.cpp.

139{
140 const auto begin = AllProjects {}.begin(), end = AllProjects {}.end();
141 auto iter = std::find_if(
142 begin, end,
143 [projectId](const AllProjects::value_type& ptr) {
144 return projectId ==
145 ProjectCloudExtension::Get(*ptr).GetCloudProjectId();
146 });
147
148 if (iter == end)
149 return nullptr;
150
151 return iter->get();
152}
const_iterator end() const
Definition: Project.cpp:27
Container::value_type value_type
Definition: Project.h:57
const_iterator begin() const
Definition: Project.cpp:22
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:202
const char * end(const char *str) noexcept
Definition: StringUtils.h:106
const char * begin(const char *str) noexcept
Definition: StringUtils.h:101

References AllProjects::begin(), details::begin(), AllProjects::end(), details::end(), audacity::cloud::audiocom::sync::ProjectCloudExtension::Get(), and audacity::cloud::audiocom::sync::ProjectCloudExtension::GetCloudProjectId().

Referenced by HandleMixdownLink(), and OpenProjectFromCloud().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPotentialTarget()

AudacityProject * audacity::cloud::audiocom::sync::GetPotentialTarget ( )

Definition at line 133 of file CloudProjectOpenUtils.cpp.

134{
135 return AllProjects {}.empty() ? nullptr : AllProjects {}.rbegin()->get();
136}
const_reverse_iterator rbegin() const
Definition: Project.cpp:32
bool empty() const
Definition: Project.h:47

References AllProjects::empty(), and AllProjects::rbegin().

Referenced by HandleMixdownLink(), HandleProjectLink(), and OpenProjectFromCloud().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleMixdownLink()

bool audacity::cloud::audiocom::sync::HandleMixdownLink ( std::string_view  uri)

Definition at line 28 of file CloudProjectMixdownUtils.cpp.

29{
31
32 const auto parsedUri = ParseUri(uri);
33
34 if (parsedUri.Scheme != "audacity" || parsedUri.Host != "generate-audio")
35 return false;
36
37 const auto queryParameters = ParseUriQuery(parsedUri.Query);
38
39 if (queryParameters.empty())
40 return false;
41
42 const auto projectId = queryParameters.find("projectId");
43
44 if (projectId == queryParameters.end())
45 return false;
46
47 auto openedProject = GetOpenedProject(projectId->second);
48
49 const auto hasOpenProject = openedProject != nullptr;
50
51 const auto project = hasOpenProject ?
52 openedProject :
54 GetPotentialTarget(), projectId->second,
55 std::string_view {}, false);
56
57 if (project == nullptr)
58 return false;
59
61 *project,
62 [hasOpenProject](AudacityProject& project, MixdownState state)
63 {
64 if (!hasOpenProject)
65 ProjectWindow::Get(project).Close(true);
66 });
67
68 return true;
69}
#define ASSERT_MAIN_THREAD()
Definition: BasicUI.h:414
const auto project
QueryFields ParseUriQuery(std::string_view query, std::string_view delimiter) noexcept
Parses URI query and returns QueryFields structure with parsed fields.
Definition: UriParser.cpp:59
UriFields ParseUri(std::string_view uri) noexcept
Definition: UriParser.cpp:9
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
static ProjectWindow & Get(AudacityProject &project)
void UploadMixdown(AudacityProject &project, std::function< void(AudacityProject &, MixdownState)> onComplete)
AudacityProject * OpenProjectFromCloud(AudacityProject *potentialTarget, std::string_view projectId, std::string_view snapshotId, CloudSyncService::SyncMode mode)
AudacityProject * GetOpenedProject(std::string_view projectId)

References ASSERT_MAIN_THREAD, ProjectWindow::Get(), GetOpenedProject(), GetPotentialTarget(), OpenProjectFromCloud(), ParseUri(), ParseUriQuery(), project, and UploadMixdown().

Here is the call graph for this function:

◆ HandleProjectLink()

bool audacity::cloud::audiocom::sync::HandleProjectLink ( std::string_view  uri)

Definition at line 308 of file CloudProjectOpenUtils.cpp.

309{
311
312 const auto parsedUri = ParseUri(uri);
313
314 if (parsedUri.Scheme != "audacity" || parsedUri.Host != "open")
315 return false;
316
317 const auto queryParameters = ParseUriQuery(parsedUri.Query);
318
319 if (queryParameters.empty())
320 return false;
321
322 const auto projectId = queryParameters.find("projectId");
323
324 if (projectId == queryParameters.end())
325 return false;
326
327 const auto snapshotId = queryParameters.find("snapshotId");
328
329 const auto forceNew = queryParameters.find("new") != queryParameters.end();
330
332 GetPotentialTarget(), projectId->second,
333 snapshotId != queryParameters.end() ? snapshotId->second :
334 std::string_view {},
335 forceNew);
336
337 return true;
338}
AudacityProject * OpenProjectFromCloud(AudacityProject *potentialTarget, std::string_view projectId, std::string_view snapshotId, bool forceNew)

References ASSERT_MAIN_THREAD, GetPotentialTarget(), OpenProjectFromCloud(), ParseUri(), and ParseUriQuery().

Here is the call graph for this function:

◆ MakeClientFailure() [1/3]

CLOUD_AUDIOCOM_API CloudSyncError audacity::cloud::audiocom::sync::MakeClientFailure ( const char *  message)

Definition at line 83 of file CloudSyncError.cpp.

84{
85 return { CloudSyncError::ClientFailure, message };
86}

References audacity::cloud::audiocom::sync::CloudSyncError::ClientFailure.

◆ MakeClientFailure() [2/3]

CLOUD_AUDIOCOM_API CloudSyncError audacity::cloud::audiocom::sync::MakeClientFailure ( const std::string &  message)

Definition at line 78 of file CloudSyncError.cpp.

79{
80 return { CloudSyncError::ClientFailure, message };
81}

References audacity::cloud::audiocom::sync::CloudSyncError::ClientFailure.

◆ MakeClientFailure() [3/3]

CLOUD_AUDIOCOM_API CloudSyncError audacity::cloud::audiocom::sync::MakeClientFailure ( const TranslatableString message)

Definition at line 72 of file CloudSyncError.cpp.

73{
74 return { CloudSyncError::ClientFailure,
75 audacity::ToUTF8(message.Translation()) };
76}
wxString Translation() const
std::string ToUTF8(const std::wstring &wstr)

References audacity::cloud::audiocom::sync::CloudSyncError::ClientFailure, audacity::ToUTF8(), and TranslatableString::Translation().

Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::OnSnapshotCreated(), audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::RefreshUrls(), and audacity::cloud::audiocom::sync::LocalProjectSnapshot::UpdateProjectSnapshot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MakeSafeProjectPath()

CLOUD_AUDIOCOM_API wxString audacity::cloud::audiocom::sync::MakeSafeProjectPath ( const wxString &  rootDir,
const wxString &  projectName 
)

Definition at line 483 of file CloudSyncDTO.cpp.

484{
485 const auto safeName = SafeName(projectName);
486
487 auto path = wxFileNameWrapper { rootDir, safeName, "aup3" };
488
489 int iteration = 0;
490 while (path.FileExists())
491 path.SetName(wxString::Format("%s_%d", safeName, ++iteration));
492
493 return path.GetFullPath();
494}

References audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::SafeName().

Referenced by anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnSave(), and audacity::cloud::audiocom::CloudSyncService::SyncCloudSnapshot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OpenProjectFromCloud() [1/2]

AudacityProject * audacity::cloud::audiocom::sync::OpenProjectFromCloud ( AudacityProject potentialTarget,
std::string_view  projectId,
std::string_view  snapshotId,
bool  forceNew 
)

Definition at line 256 of file CloudProjectOpenUtils.cpp.

259{
261 potentialTarget, projectId, snapshotId,
262 forceNew ? CloudSyncService::SyncMode::ForceNew :
263 CloudSyncService::SyncMode::Normal);
264}

References audacity::cloud::audiocom::CloudSyncService::ForceNew, audacity::cloud::audiocom::CloudSyncService::Normal, and OpenProjectFromCloud().

Here is the call graph for this function:

◆ OpenProjectFromCloud() [2/2]

AudacityProject * audacity::cloud::audiocom::sync::OpenProjectFromCloud ( AudacityProject potentialTarget,
std::string_view  projectId,
std::string_view  snapshotId,
CloudSyncService::SyncMode  mode 
)

Definition at line 154 of file CloudProjectOpenUtils.cpp.

157{
159
160 auto authResult =
162
163 if (authResult.Result != AuthResult::Status::Authorised)
164 {
165 LinkFailedDialog dialog { potentialTarget != nullptr ?
166 &ProjectWindow::Get(*potentialTarget) :
167 nullptr,
169 dialog.ShowModal();
170 return nullptr;
171 }
172
173 auto openedProject = GetOpenedProject(projectId);
174
175 if (openedProject != nullptr && mode != CloudSyncService::SyncMode::ForceNew)
176 {
177 if (mode == CloudSyncService::SyncMode::ForceOverwrite)
178 {
179 ProjectWindow::Get(*openedProject).Close(true);
180 }
181 else
182 {
183 auto snapshotIdFuture =
184 CloudSyncService::Get().GetHeadSnapshotID(std::string(projectId));
185
186 auto snapshotIdResult = GetResult(snapshotIdFuture);
187
188 if (std::holds_alternative<std::string>(snapshotIdResult))
189 {
190 const auto headSnapshotId =
191 *std::get_if<std::string>(&snapshotIdResult);
192
193 if (
194 headSnapshotId !=
195 ProjectCloudExtension::Get(*openedProject).GetSnapshotId())
196 {
197 auto dialog = std::make_unique<ProjectVersionConflictDialog>(
198 openedProject, ProjectVersionConflictDialogMode::OpenActive);
199
200 const auto result = dialog->ShowDialog();
201 dialog.reset();
202
203 if (
204 result == ProjectVersionConflictDialog::UseRemoteIdentifier())
205 {
206 auto newProject = ProjectManager::New();
208 newProject, projectId, headSnapshotId,
209 CloudSyncService::SyncMode::ForceOverwrite);
210 }
211 }
212 }
213
214 ProjectWindow::Get(*openedProject).Raise();
215 return openedProject;
216 }
217 }
218
219 auto progressDialog = MakeProgress();
220
221 auto future = CloudSyncService::Get().OpenFromCloud(
222 std::string(projectId), std::string(snapshotId), mode,
223 MakePoller(*progressDialog));
224
225 auto result = GetResult(future);
226 LogTransferStats(result.Stats);
227
228 progressDialog.reset();
229
230 const auto conflictResolution =
231 GetConfilctResolution(potentialTarget, result);
232
233 if (conflictResolution == ConflictResolution::Stop)
234 return nullptr;
235
236 if (conflictResolution == ConflictResolution::Remote)
237 {
239 potentialTarget, projectId, snapshotId,
240 CloudSyncService::SyncMode::ForceOverwrite);
241 }
242
243 if (HandleFailure(result))
244 return nullptr;
245
247 GetPotentialTarget(), audacity::ToWXString(result.ProjectPath), true,
248 false);
249
250 if (project != nullptr && mode == CloudSyncService::SyncMode::ForceNew)
252
253 return project;
254}
AudiocomTrace
Definition: ExportUtils.h:27
static ProjectFileIO & Get(AudacityProject &project)
static AudacityProject * New()
static AudacityProject * OpenProject(AudacityProject *pGivenProject, const FilePath &fileNameArg, bool addtohistory, bool reuseNonemptyProject)
Open a file into an AudacityProject, returning the project, or nullptr for failure.
ConflictResolution GetConfilctResolution(AudacityProject *project, const ProjectSyncResult &result)
AuthResult PerformBlockingAuth(AudacityProject *project, AudiocomTrace trace, const TranslatableString &alternativeActionLabel)
wxString ToWXString(const std::string &str)

References ASSERT_MAIN_THREAD, audacity::cloud::audiocom::AuthResult::Authorised, audacity::cloud::audiocom::CloudSyncService::ForceNew, audacity::cloud::audiocom::CloudSyncService::ForceOverwrite, audacity::cloud::audiocom::CloudSyncService::Get(), audacity::cloud::audiocom::sync::ProjectCloudExtension::Get(), ProjectFileIO::Get(), ProjectWindow::Get(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::GetConfilctResolution(), audacity::cloud::audiocom::CloudSyncService::GetHeadSnapshotID(), GetOpenedProject(), GetPotentialTarget(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::GetResult(), audacity::cloud::audiocom::sync::ProjectCloudExtension::GetSnapshotId(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::HandleFailure(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::LogTransferStats(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::MakePoller(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::MakeProgress(), ProjectFileIO::MarkTemporary(), ProjectManager::New(), OpenActive, audacity::cloud::audiocom::CloudSyncService::OpenFromCloud(), OpenFromCloudMenu, ProjectManager::OpenProject(), OpenProjectFromCloud(), audacity::cloud::audiocom::PerformBlockingAuth(), project, audacity::ToWXString(), and audacity::cloud::audiocom::sync::ProjectVersionConflictDialog::UseRemoteIdentifier().

Referenced by HandleMixdownLink(), HandleProjectLink(), and OpenProjectFromCloud().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReopenProject()

void audacity::cloud::audiocom::sync::ReopenProject ( AudacityProject project)

Definition at line 340 of file CloudProjectOpenUtils.cpp.

341{
342 auto& projectCloudExtension = ProjectCloudExtension::Get(project);
343
344 if (!projectCloudExtension.IsCloudProject())
345 return;
346
348 [&project,
349 projectId = std::string(projectCloudExtension.GetCloudProjectId())]
350 {
351 auto newProject = ProjectManager::New();
352 ProjectWindow::Get(project).Close(true);
353 OpenProjectFromCloud(
354 newProject, projectId, {},
355 CloudSyncService::SyncMode::ForceOverwrite);
356 });
357}
void CallAfter(Action action)
Schedule an action to be done later, and in the main thread.
Definition: BasicUI.cpp:214

References BasicUI::CallAfter(), audacity::cloud::audiocom::CloudSyncService::ForceOverwrite, audacity::cloud::audiocom::sync::ProjectCloudExtension::Get(), and project.

Referenced by audacity::cloud::audiocom::sync::ProjectCloudUIExtension::OnCloudStatusChanged().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResaveLocally()

bool audacity::cloud::audiocom::sync::ResaveLocally ( AudacityProject project)

Definition at line 332 of file CloudProjectFileIOExtensions.cpp.

333{
334 // TODO: Delete the old file immediately?
336}
bool SaveAs(bool allowOverwrite=false)
static ProjectFileManager & Get(AudacityProject &project)

References ProjectFileManager::Get(), project, and ProjectFileManager::SaveAs().

Referenced by audacity::cloud::audiocom::sync::ProjectCloudUIExtension::OnCloudStatusChanged().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResumeProjectUpload()

void CLOUD_AUDIOCOM_API audacity::cloud::audiocom::sync::ResumeProjectUpload ( ProjectCloudExtension projectCloudExtension,
std::function< void(AudiocomTrace)>  onBeforeUploadStarts 
)

Definition at line 446 of file ResumedSnaphotUploadOperation.cpp.

449{
450 auto& cloudProjectsDatabase = CloudProjectsDatabase::Get();
451
452 auto pendingSnapshots = cloudProjectsDatabase.GetPendingSnapshots(
453 projectCloudExtension.GetCloudProjectId());
454
455 if (!pendingSnapshots.empty() && onBeforeUploadStarts)
457
458 for (const auto& snapshot : pendingSnapshots)
459 ResumedSnaphotUploadOperation::Perform(
460 projectCloudExtension, snapshot.SnapshotId, snapshot.ConfirmUrl);
461}
@ ProjectOpenedAndUploadResumed

References audacity::cloud::audiocom::sync::CloudProjectsDatabase::Get(), audacity::cloud::audiocom::sync::ProjectCloudExtension::GetCloudProjectId(), and ProjectOpenedAndUploadResumed.

Referenced by audacity::cloud::audiocom::sync::ProjectCloudUIExtension::OnCloudStatusChanged(), and anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnLoad().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SaveToCloud()

void audacity::cloud::audiocom::sync::SaveToCloud ( AudacityProject project,
UploadMode  mode,
CreateSnapshotCallback  snapshotCallback 
)

Definition at line 315 of file CloudProjectFileIOExtensions.cpp.

318{
320
321 auto& projectCloudExtension = ProjectCloudExtension::Get(project);
322
323 auto& ioExtension = GetExtension();
324
325 ioExtension.ForceCloudSave();
326 ioExtension.SetUploadModeForNextSave(mode);
327 ioExtension.SetSnapshotCallbackForNextSave(std::move(snapshotCallback));
328
330}

References ASSERT_MAIN_THREAD, audacity::cloud::audiocom::sync::ProjectCloudExtension::Get(), ProjectFileManager::Get(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::GetExtension(), project, and ProjectFileManager::Save().

Referenced by audacity::cloud::audiocom::sync::ProjectCloudUIExtension::OnCloudStatusChanged(), anonymous_namespace{AudioComMenus.cpp}::OnSaveToCloud(), and UploadMixdown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Serialize() [1/2]

std::string audacity::cloud::audiocom::sync::Serialize ( const ProjectForm form)

Definition at line 377 of file CloudSyncDTO.cpp.

378{
379 using namespace rapidjson;
380
381 Document document;
382 document.SetObject();
383
384 if (!form.Name.empty())
385 document.AddMember(
386 "name", StringRef(form.Name.c_str()), document.GetAllocator());
387
388 if (!form.HeadSnapshotId.empty())
389 document.AddMember(
390 "head_snapshot_id", StringRef(form.HeadSnapshotId.c_str()),
391 document.GetAllocator());
392
393 Value hashesArray(kArrayType);
394
395 for (const auto& hash : form.Hashes)
396 hashesArray.PushBack(StringRef(hash.c_str()), document.GetAllocator());
397
398 document.AddMember("blocks", hashesArray, document.GetAllocator());
399
400 if (form.Force)
401 document.AddMember("force", form.Force, document.GetAllocator());
402
403 StringBuffer buffer;
404 Writer<StringBuffer> writer(buffer);
405 document.Accept(writer);
406
407 return buffer.GetString();
408}

References audacity::cloud::audiocom::sync::ProjectForm::Force, audacity::cloud::audiocom::sync::ProjectForm::Hashes, audacity::cloud::audiocom::sync::ProjectForm::HeadSnapshotId, and audacity::cloud::audiocom::sync::ProjectForm::Name.

Referenced by audacity::cloud::audiocom::CloudSyncService::ReportUploadStats(), and audacity::cloud::audiocom::sync::LocalProjectSnapshot::UpdateProjectSnapshot().

Here is the caller graph for this function:

◆ Serialize() [2/2]

std::string audacity::cloud::audiocom::sync::Serialize ( NetworkStats  stats)

Definition at line 496 of file CloudSyncDTO.cpp.

497{
498 using namespace rapidjson;
499
500 Document document;
501 document.SetObject();
502
503 document.AddMember("is_download", stats.IsDownload, document.GetAllocator());
504 document.AddMember("bytes", stats.Bytes, document.GetAllocator());
505 document.AddMember("blocks", stats.Blocks, document.GetAllocator());
506 document.AddMember("mixes", stats.Mixes, document.GetAllocator());
507 document.AddMember("files", stats.Files, document.GetAllocator());
508
509 StringBuffer buffer;
510 Writer<StringBuffer> writer(buffer);
511 document.Accept(writer);
512
513 return buffer.GetString();
514}

References audacity::cloud::audiocom::sync::NetworkStats::Blocks, audacity::cloud::audiocom::sync::NetworkStats::Bytes, audacity::cloud::audiocom::sync::NetworkStats::Files, audacity::cloud::audiocom::sync::NetworkStats::IsDownload, and audacity::cloud::audiocom::sync::NetworkStats::Mixes.

◆ ShowDialogOn()

void audacity::cloud::audiocom::sync::ShowDialogOn ( std::function< bool()>  condition,
std::function< void()>  dialogFactory 
)

Definition at line 273 of file AudioComDialogBase.cpp.

275{
276 static Idler idler;
277
278 idler.Items.push_back({ std::move(condition), std::move(dialogFactory) });
279}

Referenced by anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnUpdateSaved().

Here is the caller graph for this function:

◆ SyncCloudProject()

bool audacity::cloud::audiocom::sync::SyncCloudProject ( AudacityProject project,
std::string_view  path,
AudiocomTrace  trace,
bool  force 
)

Definition at line 266 of file CloudProjectOpenUtils.cpp.

269{
271
272 if (!CloudSyncService::Get().IsCloudProject(std::string(path)))
273 return true;
274
275 auto authResult = PerformBlockingAuth(&project, trace);
276
277 if (authResult.Result != AuthResult::Status::Authorised)
278 {
279 LinkFailedDialog dialog { &ProjectWindow::Get(project), trace };
280 dialog.ShowModal();
281 return false;
282 }
283
284 auto progressDialog = MakeProgress();
285
286 auto future = CloudSyncService::Get().SyncProject(
287 project, std::string(path), force, MakePoller(*progressDialog));
288
289 auto result = GetResult(future);
290 LogTransferStats(result.Stats);
291
292 progressDialog.reset();
293
294 const auto conflictResolution = GetConfilctResolution(&project, result);
295
296 if (conflictResolution == ConflictResolution::Stop)
297 return false;
298
299 if (conflictResolution == ConflictResolution::Remote)
300 return SyncCloudProject(project, path, trace, true);
301
302 if (HandleFailure(result))
303 return false;
304
305 return true;
306}
bool SyncCloudProject(AudacityProject &project, std::string_view path, AudiocomTrace trace, bool force)

References ASSERT_MAIN_THREAD, audacity::cloud::audiocom::AuthResult::Authorised, audacity::cloud::audiocom::CloudSyncService::Get(), ProjectWindow::Get(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::GetConfilctResolution(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::GetResult(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::HandleFailure(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::LogTransferStats(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::MakePoller(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::MakeProgress(), audacity::cloud::audiocom::PerformBlockingAuth(), project, SyncCloudProject(), and audacity::cloud::audiocom::CloudSyncService::SyncProject().

Referenced by anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnOpen(), and SyncCloudProject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UploadMixdown()

void audacity::cloud::audiocom::sync::UploadMixdown ( AudacityProject project,
std::function< void(AudacityProject &, MixdownState)>  onComplete 
)

Definition at line 71 of file CloudProjectMixdownUtils.cpp.

74{
76 project, UploadMode::Normal,
77 [&project, onComplete = std::move(onComplete)](const auto& response)
78 {
79 auto cancellationContext = concurrency::CancellationContext::Create();
80
81 auto progressDialog = BasicUI::MakeProgress(
82 XO("Save to audio.com"), XO("Generating audio preview..."),
84
85 auto mixdownUploader = MixdownUploader::Upload(
86 cancellationContext, GetServiceConfig(), project,
87 [progressDialog = progressDialog.get(),
88 cancellationContext](auto progress)
89 {
90 if (
91 progressDialog->Poll(
92 static_cast<unsigned>(progress * 10000), 10000) !=
93 BasicUI::ProgressResult::Success)
94 cancellationContext->Cancel();
95 });
96
97 mixdownUploader->SetUrls(response.SyncState.MixdownUrls);
98
100 [&project,
101 progressDialog = std::shared_ptr { std::move(progressDialog) },
102 mixdownUploader, cancellationContext, onComplete]() mutable
103 {
104 auto& projectCloudExtension =
106
107 auto subscription = projectCloudExtension.SubscribeStatusChanged(
108 [progressDialog = progressDialog.get(), mixdownUploader,
109 cancellationContext](
110 const CloudStatusChangedMessage& message)
111 {
112 if (message.Status != ProjectSyncStatus::Failed)
113 return;
114
115 cancellationContext->Cancel();
116 },
117 true);
118
119 auto future = mixdownUploader->GetResultFuture();
120
121 while (future.wait_for(std::chrono::milliseconds(50)) !=
122 std::future_status::ready)
124
125 auto result = future.get();
126
127 progressDialog.reset();
128
129 if (onComplete)
130 onComplete(project, result.State);
131 });
132 });
133}
XO("Cut/Copy/Paste")
@ ProgressShowCancel
Definition: BasicUI.h:142
void Yield()
Dispatch waiting events, including actions enqueued by CallAfter.
Definition: BasicUI.cpp:225
std::unique_ptr< ProgressDialog > MakeProgress(const TranslatableString &title, const TranslatableString &message, unsigned flags=(ProgressShowStop|ProgressShowCancel), const TranslatableString &remainingLabelText={})
Create and display a progress dialog.
Definition: BasicUI.h:302
void SaveToCloud(AudacityProject &project, UploadMode mode, CreateSnapshotCallback snapshotCallback)
const ServiceConfig & GetServiceConfig()
Returns the instance of the ServiceConfig.

References BasicUI::CallAfter(), audacity::concurrency::CancellationContext::Create(), audacity::cloud::audiocom::sync::ProjectCloudExtension::Get(), audacity::cloud::audiocom::GetServiceConfig(), BasicUI::MakeProgress(), Normal, BasicUI::ProgressShowCancel, project, SaveToCloud(), anonymous_namespace{LinkUrlHandler.cpp}::subscription, audacity::cloud::audiocom::sync::MixdownUploader::Upload(), XO(), and BasicUI::Yield().

Referenced by HandleMixdownLink(), and anonymous_namespace{AudioComMenus.cpp}::OnUpdateMixdown().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ ExportLocationMode

EnumSetting< CloudLocationMode > audacity::cloud::audiocom::sync::ExportLocationMode
Initial value:
{
"/cloud/audiocom/ExportLocationMode",
EnumValueSymbols { L"ask", L"local", L"cloud" },
0,
{ CloudLocationMode::Ask, CloudLocationMode::Local,
CloudLocationMode::Cloud }
}

Definition at line 24 of file CloudModuleSettings.cpp.

Referenced by anonymous_namespace{AudioComPrefsPanel.cpp}::AudioComPrefsPanel::AudioComPrefsPanel(), anonymous_namespace{AudioComPrefsPanel.cpp}::AudioComPrefsPanel::Cancel(), and anonymous_namespace{AudioComPrefsPanel.cpp}::AudioComPrefsPanel::PopulateOrExchange().

◆ MixdownDialogShown

BoolSetting audacity::cloud::audiocom::sync::MixdownDialogShown
Initial value:
{
"/cloud/audiocom/MixdownDialogShown", false
}

Definition at line 32 of file CloudModuleSettings.cpp.

Referenced by anonymous_namespace{AudioComPrefsPanel.cpp}::AudioComPrefsPanel::Commit().

◆ RetriesCount

constexpr int audacity::cloud::audiocom::sync::RetriesCount { 3 }
constexpr

◆ SaveLocationMode

EnumSetting< CloudLocationMode > audacity::cloud::audiocom::sync::SaveLocationMode
Initial value:
{
"/cloud/audiocom/SaveLocationMode",
EnumValueSymbols { L"ask", L"local", L"cloud" },
0,
{ CloudLocationMode::Ask, CloudLocationMode::Local,
CloudLocationMode::Cloud }
}

Definition at line 16 of file CloudModuleSettings.cpp.

Referenced by anonymous_namespace{AudioComPrefsPanel.cpp}::AudioComPrefsPanel::AudioComPrefsPanel(), anonymous_namespace{AudioComPrefsPanel.cpp}::AudioComPrefsPanel::Cancel(), and anonymous_namespace{AudioComPrefsPanel.cpp}::AudioComPrefsPanel::PopulateOrExchange().

◆ UNASSIGNED_PROJECT_ID

constexpr auto audacity::cloud::audiocom::sync::UNASSIGNED_PROJECT_ID = -1
constexpr

Definition at line 38 of file LocalProjectSnapshot.h.