Audacity 3.2.0
|
#include <ProjectCloudExtension.h>
Classes | |
struct | CloudStatusChangedNotifier |
struct | UploadQueueElement |
Public Member Functions | |
ProjectCloudExtension (AudacityProject &project) | |
~ProjectCloudExtension () override | |
bool | IsCloudProject () const |
void | OnLoad () |
void | OnSyncStarted () |
This method is called from the UI thread. More... | |
void | OnSyncResumed (std::shared_ptr< ProjectUploadOperation > uploadOperation, int64_t missingBlocksCount, bool needsProjectUpload) |
This method is called from the UI thread. More... | |
void | OnUploadOperationCreated (std::shared_ptr< ProjectUploadOperation > uploadOperation) |
This method is called from the UI thread. More... | |
void | OnBlocksHashed (ProjectUploadOperation &uploadOperation) |
This method is called not from the UI thread. More... | |
void | OnSnapshotCreated (const ProjectUploadOperation &uploadOperation, const CreateSnapshotResponse &response) |
This method is called from the network thread. More... | |
void | OnProjectDataUploaded (const ProjectUploadOperation &uploadOperation) |
This method is called from the network thread. More... | |
void | OnBlockUploaded (const ProjectUploadOperation &uploadOperation, std::string_view blockID, bool successful) |
This method is called from the network thread. More... | |
void | OnSyncCompleted (const ProjectUploadOperation *uploadOperation, std::optional< CloudSyncError > error, AudiocomTrace trace) |
This method is called from any thread. More... | |
void | AbortLastUploadOperation () |
void | CancelSync () |
bool | IsSyncing () const |
std::string | GetCloudProjectId () const |
std::string | GetSnapshotId () const |
void | OnUpdateSaved (const ProjectSerializer &serializer) |
std::weak_ptr< AudacityProject > | GetProject () const |
int64_t | GetSavesCount () const |
Observer::Subscription | SubscribeStatusChanged (std::function< void(const CloudStatusChangedMessage &)> callback, bool onUIThread) |
std::string | GetCloudProjectPage (AudiocomTrace) const |
bool | IsBlockLocked (int64_t blockID) const |
ProjectSyncStatus | GetCurrentSyncStatus () const |
bool | IsFirstSyncDialogShown () const |
void | SetFirstSyncDialogShown (bool shown=true) |
Public Member Functions inherited from ClientData::Base | |
virtual | ~Base () |
Static Public Member Functions | |
static ProjectCloudExtension & | Get (AudacityProject &project) |
static const ProjectCloudExtension & | Get (const AudacityProject &project) |
Private Member Functions | |
void | UpdateIdFromDatabase () |
void | UnsafeUpdateProgress () |
void | Publish (CloudStatusChangedMessage cloudStatus, bool canMerge) |
void | MarkProjectSynced (bool success) |
UploadQueueElement * | UnsafeFindUploadQueueElement (const ProjectUploadOperation &uploadOperation) |
const UploadQueueElement * | UnsafeFindUploadQueueElement (const ProjectUploadOperation &uploadOperation) const |
void | OnProjectPathChanged () |
Private Attributes | |
AudacityProject & | mProject |
Observer::Subscription | mProjectPathChangedSubscription |
std::mutex | mIdentifiersMutex |
std::string | mProjectId |
std::string | mSnapshotId |
std::mutex | mUploadQueueMutex |
std::vector< std::shared_ptr< UploadQueueElement > > | mUploadQueue |
std::mutex | mStatusMutex |
CloudStatusChangedMessage | mLastStatus |
std::unique_ptr< CloudStatusChangedNotifier > | mAsyncStateNotifier |
std::unique_ptr< CloudStatusChangedNotifier > | mUIStateNotifier |
std::atomic< bool > | mUINotificationPending { false } |
Definition at line 58 of file ProjectCloudExtension.h.
|
explicit |
Definition at line 108 of file ProjectCloudExtension.cpp.
References OnProjectPathChanged(), and ProjectFilePathChange.
|
overridedefault |
void audacity::cloud::audiocom::sync::ProjectCloudExtension::AbortLastUploadOperation | ( | ) |
void audacity::cloud::audiocom::sync::ProjectCloudExtension::CancelSync | ( | ) |
Definition at line 357 of file ProjectCloudExtension.cpp.
References anonymous_namespace{NoteTrack.cpp}::swap().
|
static |
Definition at line 125 of file ProjectCloudExtension.cpp.
References audacity::cloud::audiocom::sync::anonymous_namespace{ProjectCloudExtension.cpp}::key, and project.
Referenced by audacity::cloud::audiocom::sync::GetOpenedProject(), audacity::cloud::audiocom::sync::OpenProjectFromCloud(), audacity::cloud::audiocom::sync::ReopenProject(), audacity::cloud::audiocom::sync::SaveToCloud(), and audacity::cloud::audiocom::sync::UploadMixdown().
|
static |
Definition at line 131 of file ProjectCloudExtension.cpp.
References project.
std::string audacity::cloud::audiocom::sync::ProjectCloudExtension::GetCloudProjectId | ( | ) | const |
Definition at line 385 of file ProjectCloudExtension.cpp.
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::ProjectBlocksLock::GetHash(), audacity::cloud::audiocom::sync::GetOpenedProject(), audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::Perform(), audacity::cloud::audiocom::sync::LocalProjectSnapshot::ProjectBlocksLock::ProjectBlocksLock(), audacity::cloud::audiocom::sync::ResumeProjectUpload(), audacity::cloud::audiocom::sync::LocalProjectSnapshot::ProjectBlocksLock::UpdateProjectHashesInCache(), and audacity::cloud::audiocom::sync::LocalProjectSnapshot::UpdateProjectSnapshot().
std::string audacity::cloud::audiocom::sync::ProjectCloudExtension::GetCloudProjectPage | ( | AudiocomTrace | trace | ) | const |
Definition at line 628 of file ProjectCloudExtension.cpp.
References BasicUI::Get(), audacity::cloud::audiocom::GetOAuthService(), audacity::cloud::audiocom::GetServiceConfig(), audacity::cloud::audiocom::GetUserService(), audacity::ToUTF8(), and audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::userId.
ProjectSyncStatus audacity::cloud::audiocom::sync::ProjectCloudExtension::GetCurrentSyncStatus | ( | ) | const |
Definition at line 660 of file ProjectCloudExtension.cpp.
std::weak_ptr< AudacityProject > audacity::cloud::audiocom::sync::ProjectCloudExtension::GetProject | ( | ) | const |
Definition at line 453 of file ProjectCloudExtension.cpp.
int64_t audacity::cloud::audiocom::sync::ProjectCloudExtension::GetSavesCount | ( | ) | const |
Definition at line 458 of file ProjectCloudExtension.cpp.
References BasicUI::Get().
std::string audacity::cloud::audiocom::sync::ProjectCloudExtension::GetSnapshotId | ( | ) | const |
Definition at line 392 of file ProjectCloudExtension.cpp.
Referenced by audacity::cloud::audiocom::sync::OpenProjectFromCloud(), and audacity::cloud::audiocom::sync::LocalProjectSnapshot::UpdateProjectSnapshot().
bool audacity::cloud::audiocom::sync::ProjectCloudExtension::IsBlockLocked | ( | int64_t | blockID | ) | const |
Definition at line 646 of file ProjectCloudExtension.cpp.
References BasicUI::Get().
bool audacity::cloud::audiocom::sync::ProjectCloudExtension::IsCloudProject | ( | ) | const |
Definition at line 136 of file ProjectCloudExtension.cpp.
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::ProjectBlocksLock::GetHash(), audacity::cloud::audiocom::sync::LocalProjectSnapshot::ProjectBlocksLock::ProjectBlocksLock(), audacity::cloud::audiocom::sync::LocalProjectSnapshot::ProjectBlocksLock::UpdateProjectHashesInCache(), and audacity::cloud::audiocom::sync::LocalProjectSnapshot::UpdateProjectSnapshot().
bool audacity::cloud::audiocom::sync::ProjectCloudExtension::IsFirstSyncDialogShown | ( | ) | const |
Definition at line 669 of file ProjectCloudExtension.cpp.
References BasicUI::Get().
bool audacity::cloud::audiocom::sync::ProjectCloudExtension::IsSyncing | ( | ) | const |
Definition at line 378 of file ProjectCloudExtension.cpp.
|
private |
Definition at line 565 of file ProjectCloudExtension.cpp.
References BasicUI::Get(), ProjectFileIO::Get(), audacity::cloud::audiocom::sync::DBProjectData::LastModified, audacity::cloud::audiocom::sync::DBProjectData::LastRead, audacity::cloud::audiocom::sync::DBProjectData::SyncStatus, and audacity::ToUTF8().
void audacity::cloud::audiocom::sync::ProjectCloudExtension::OnBlocksHashed | ( | ProjectUploadOperation & | uploadOperation | ) |
This method is called not from the UI thread.
Definition at line 196 of file ProjectCloudExtension.cpp.
References audacity::cloud::audiocom::sync::ProjectUploadOperation::Start().
void audacity::cloud::audiocom::sync::ProjectCloudExtension::OnBlockUploaded | ( | const ProjectUploadOperation & | uploadOperation, |
std::string_view | blockID, | ||
bool | successful | ||
) |
This method is called from the network thread.
Definition at line 270 of file ProjectCloudExtension.cpp.
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::OnSnapshotCreated().
void audacity::cloud::audiocom::sync::ProjectCloudExtension::OnLoad | ( | ) |
Definition at line 142 of file ProjectCloudExtension.cpp.
void audacity::cloud::audiocom::sync::ProjectCloudExtension::OnProjectDataUploaded | ( | const ProjectUploadOperation & | uploadOperation | ) |
This method is called from the network thread.
Definition at line 256 of file ProjectCloudExtension.cpp.
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::OnSnapshotCreated().
|
private |
Definition at line 607 of file ProjectCloudExtension.cpp.
References ignore.
Referenced by ProjectCloudExtension().
void audacity::cloud::audiocom::sync::ProjectCloudExtension::OnSnapshotCreated | ( | const ProjectUploadOperation & | uploadOperation, |
const CreateSnapshotResponse & | response | ||
) |
This method is called from the network thread.
Definition at line 209 of file ProjectCloudExtension.cpp.
References BasicUI::Get(), ProjectFileIO::Get(), audacity::cloud::audiocom::sync::SnapshotInfo::Id, audacity::cloud::audiocom::sync::ProjectInfo::Id, audacity::cloud::audiocom::sync::DBProjectData::LastModified, audacity::cloud::audiocom::sync::DBProjectData::LastRead, audacity::cloud::audiocom::sync::DBProjectData::LocalPath, audacity::cloud::audiocom::sync::ProjectSyncState::MissingBlocks, audacity::cloud::audiocom::sync::CreateSnapshotResponse::Project, audacity::cloud::audiocom::sync::DBProjectData::ProjectId, audacity::cloud::audiocom::sync::DBProjectData::SavesCount, audacity::cloud::audiocom::sync::CreateSnapshotResponse::Snapshot, audacity::cloud::audiocom::sync::DBProjectData::SnapshotId, audacity::cloud::audiocom::sync::CreateSnapshotResponse::SyncState, audacity::cloud::audiocom::sync::DBProjectData::SyncStatus, audacity::ToUTF8(), and audacity::cloud::audiocom::sync::ProjectInfo::Username.
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::OnSnapshotCreated().
void audacity::cloud::audiocom::sync::ProjectCloudExtension::OnSyncCompleted | ( | const ProjectUploadOperation * | uploadOperation, |
std::optional< CloudSyncError > | error, | ||
AudiocomTrace | trace | ||
) |
This method is called from any thread.
Definition at line 285 of file ProjectCloudExtension.cpp.
References BasicUI::Get(), ProjectFileIO::Get(), ignore, audacity::cloud::audiocom::sync::DBProjectData::SnapshotId, and audacity::ToUTF8().
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::MarkSnapshotSynced(), and audacity::cloud::audiocom::sync::LocalProjectSnapshot::UploadFailed().
void audacity::cloud::audiocom::sync::ProjectCloudExtension::OnSyncResumed | ( | std::shared_ptr< ProjectUploadOperation > | uploadOperation, |
int64_t | missingBlocksCount, | ||
bool | needsProjectUpload | ||
) |
This method is called from the UI thread.
Definition at line 165 of file ProjectCloudExtension.cpp.
Referenced by audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::Perform().
void audacity::cloud::audiocom::sync::ProjectCloudExtension::OnSyncStarted | ( | ) |
This method is called from the UI thread.
Definition at line 147 of file ProjectCloudExtension.cpp.
References TrackList::Create(), and TrackList::Get().
void audacity::cloud::audiocom::sync::ProjectCloudExtension::OnUpdateSaved | ( | const ProjectSerializer & | serializer | ) |
Definition at line 399 of file ProjectCloudExtension.cpp.
References BasicUI::Get(), ProjectFileIO::Get(), ProjectSerializer::GetData(), ProjectSerializer::GetDict(), MemoryStream::GetSize(), ignore, IsLittleEndian(), size, SwapIntBytes(), and audacity::ToUTF8().
void audacity::cloud::audiocom::sync::ProjectCloudExtension::OnUploadOperationCreated | ( | std::shared_ptr< ProjectUploadOperation > | uploadOperation | ) |
This method is called from the UI thread.
Definition at line 183 of file ProjectCloudExtension.cpp.
|
private |
Definition at line 536 of file ProjectCloudExtension.cpp.
References BasicUI::CallAfter(), and BasicUI::IsUiThread().
void audacity::cloud::audiocom::sync::ProjectCloudExtension::SetFirstSyncDialogShown | ( | bool | shown = true | ) |
Definition at line 679 of file ProjectCloudExtension.cpp.
References BasicUI::Get().
Observer::Subscription audacity::cloud::audiocom::sync::ProjectCloudExtension::SubscribeStatusChanged | ( | std::function< void(const CloudStatusChangedMessage &)> | callback, |
bool | onUIThread | ||
) |
Definition at line 474 of file ProjectCloudExtension.cpp.
|
private |
Definition at line 588 of file ProjectCloudExtension.cpp.
|
private |
Definition at line 600 of file ProjectCloudExtension.cpp.
|
private |
Definition at line 512 of file ProjectCloudExtension.cpp.
References ignore.
|
private |
Definition at line 482 of file ProjectCloudExtension.cpp.
References BasicUI::Get(), ProjectFileIO::Get(), ignore, and audacity::ToUTF8().
|
private |
Definition at line 157 of file ProjectCloudExtension.h.
|
mutableprivate |
Definition at line 147 of file ProjectCloudExtension.h.
|
private |
Definition at line 155 of file ProjectCloudExtension.h.
|
private |
Definition at line 143 of file ProjectCloudExtension.h.
|
private |
Definition at line 148 of file ProjectCloudExtension.h.
|
private |
Definition at line 145 of file ProjectCloudExtension.h.
|
private |
Definition at line 149 of file ProjectCloudExtension.h.
|
mutableprivate |
Definition at line 154 of file ProjectCloudExtension.h.
|
private |
Definition at line 159 of file ProjectCloudExtension.h.
|
private |
Definition at line 158 of file ProjectCloudExtension.h.
|
private |
Definition at line 152 of file ProjectCloudExtension.h.
|
private |
Definition at line 151 of file ProjectCloudExtension.h.