Audacity 3.2.0
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
audacity::cloud::audiocom::sync::CloudSyncStatusField Class Referencefinal

#include <CloudSyncStatusField.h>

Inheritance diagram for audacity::cloud::audiocom::sync::CloudSyncStatusField:
[legend]
Collaboration diagram for audacity::cloud::audiocom::sync::CloudSyncStatusField:
[legend]

Classes

class  StatusWidget
 

Public Member Functions

 CloudSyncStatusField (AudacityProject &project)
 
 ~CloudSyncStatusField () override
 
int GetWidth () const
 
void OnSize (const wxRect &rect)
 
bool IsVisible () const
 
TranslatableString GetText () const
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static CloudSyncStatusFieldGet (AudacityProject &project)
 
static const CloudSyncStatusFieldGet (const AudacityProject &project)
 

Private Types

enum class  State {
  Hidden , Dirty , Synced , Failed ,
  Uploading
}
 

Private Member Functions

void MarkDirty ()
 
void OnCloudStatusChanged (const CloudStatusChangedMessage &extension)
 
StatusWidgetGetStatusWidget ()
 
const StatusWidgetGetStatusWidget () const
 

Private Attributes

AudacityProjectmProject
 
ProjectCloudExtensionmCloudExtension
 
enum audacity::cloud::audiocom::sync::CloudSyncStatusField::State Hidden
 
int mProgress { 0 }
 
wxWeakRef< StatusWidgetmStatusWidget
 
Observer::Subscription mCloudStatusChangedSubscription
 

Detailed Description

Definition at line 30 of file CloudSyncStatusField.h.

Member Enumeration Documentation

◆ State

Enumerator
Hidden 
Dirty 
Synced 
Failed 
Uploading 

Definition at line 58 of file CloudSyncStatusField.h.

Constructor & Destructor Documentation

◆ CloudSyncStatusField()

audacity::cloud::audiocom::sync::CloudSyncStatusField::CloudSyncStatusField ( AudacityProject project)
explicit

Definition at line 339 of file CloudSyncStatusField.cpp.

340 : mProject { project }
343 [this](const auto& extension) { OnCloudStatusChanged(extension); },
344 true) }
345{
346}
const auto project
void OnCloudStatusChanged(const CloudStatusChangedMessage &extension)
static ProjectCloudExtension & Get(AudacityProject &project)
Observer::Subscription SubscribeStatusChanged(std::function< void(const CloudStatusChangedMessage &)> callback, bool onUIThread)

References anonymous_namespace{CloudProjectFileIOExtensions.cpp}::extension, and OnCloudStatusChanged().

Here is the call graph for this function:

◆ ~CloudSyncStatusField()

audacity::cloud::audiocom::sync::CloudSyncStatusField::~CloudSyncStatusField ( )
overridedefault

Member Function Documentation

◆ Get() [1/2]

CloudSyncStatusField & audacity::cloud::audiocom::sync::CloudSyncStatusField::Get ( AudacityProject project)
static

◆ Get() [2/2]

const CloudSyncStatusField & audacity::cloud::audiocom::sync::CloudSyncStatusField::Get ( const AudacityProject project)
static

Definition at line 356 of file CloudSyncStatusField.cpp.

357{
358 return Get(const_cast<AudacityProject&>(project));
359}
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 CloudSyncStatusField & Get(AudacityProject &project)

References project.

◆ GetStatusWidget() [1/2]

CloudSyncStatusField::StatusWidget & audacity::cloud::audiocom::sync::CloudSyncStatusField::GetStatusWidget ( )
private

Definition at line 431 of file CloudSyncStatusField.cpp.

432{
433 if (!mStatusWidget)
434 {
435 mStatusWidget = safenew StatusWidget(
436 *this, ProjectWindow::Get(mProject).GetStatusBar());
437
439 }
440
441 return *mStatusWidget;
442}
#define safenew
Definition: MemoryX.h:10
static ProjectWindow & Get(AudacityProject &project)

References ProjectWindow::Get(), and safenew.

Here is the call graph for this function:

◆ GetStatusWidget() [2/2]

const CloudSyncStatusField::StatusWidget & audacity::cloud::audiocom::sync::CloudSyncStatusField::GetStatusWidget ( ) const
private

Definition at line 445 of file CloudSyncStatusField.cpp.

446{
447 return const_cast<CloudSyncStatusField*>(this)->GetStatusWidget();
448}

◆ GetText()

TranslatableString audacity::cloud::audiocom::sync::CloudSyncStatusField::GetText ( ) const

Definition at line 379 of file CloudSyncStatusField.cpp.

380{
381 return {};
382}

Referenced by audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncStatusField.cpp}::CloudSyncStatusBarFieldItem::GetText().

Here is the caller graph for this function:

◆ GetWidth()

int audacity::cloud::audiocom::sync::CloudSyncStatusField::GetWidth ( ) const

◆ IsVisible()

bool audacity::cloud::audiocom::sync::CloudSyncStatusField::IsVisible ( ) const

Definition at line 374 of file CloudSyncStatusField.cpp.

375{
376 return mState != State::Hidden;
377}

References mState.

Referenced by audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncStatusField.cpp}::CloudSyncStatusBarFieldItem::IsVisible().

Here is the caller graph for this function:

◆ MarkDirty()

void audacity::cloud::audiocom::sync::CloudSyncStatusField::MarkDirty ( )
private

Definition at line 384 of file CloudSyncStatusField.cpp.

385{
386 auto field = dynamic_cast<CloudSyncStatusBarFieldItem*>(
388
389 if (field)
390 field->MarkDirty(mProject);
391
392 auto& statusWidget = GetStatusWidget();
393
394 statusWidget.Show(mState != State::Hidden);
395 statusWidget.UpdateName();
396
397 if (statusWidget.GetParent())
398 statusWidget.GetParent()->Refresh();
399 else
400 statusWidget.Refresh();
401}
#define field(n, t)
Definition: ImportAUP.cpp:165
static StatusBarFieldItem * Get(const StatusBarField &identifier)
Returns the field with the given identifier or nullptr if field is not present.

References field, audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncStatusField.cpp}::FieldId, ProjectStatusFieldsRegistry::Get(), and mState.

Here is the call graph for this function:

◆ OnCloudStatusChanged()

void audacity::cloud::audiocom::sync::CloudSyncStatusField::OnCloudStatusChanged ( const CloudStatusChangedMessage extension)
private

Definition at line 403 of file CloudSyncStatusField.cpp.

405{
406 mState = [](ProjectSyncStatus status)
407 {
408 switch (status)
409 {
411 return State::Hidden;
413 return State::Dirty;
415 return State::Synced;
417 return State::Failed;
419 return State::Uploading;
420 default:
421 return State::Hidden;
422 }
423 }(message.Status);
424
426 mProgress = static_cast<int>(message.Progress * 100.0);
427
428 MarkDirty();
429}

References mState, audacity::cloud::audiocom::sync::CloudStatusChangedMessage::Progress, and audacity::cloud::audiocom::sync::CloudStatusChangedMessage::Status.

Referenced by CloudSyncStatusField().

Here is the caller graph for this function:

◆ OnSize()

void audacity::cloud::audiocom::sync::CloudSyncStatusField::OnSize ( const wxRect &  rect)

Definition at line 369 of file CloudSyncStatusField.cpp.

Referenced by audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncStatusField.cpp}::CloudSyncStatusBarFieldItem::OnSize().

Here is the caller graph for this function:

Member Data Documentation

◆ Hidden

enum audacity::cloud::audiocom::sync::CloudSyncStatusField::State audacity::cloud::audiocom::sync::CloudSyncStatusField::Hidden
private

◆ mCloudExtension

ProjectCloudExtension& audacity::cloud::audiocom::sync::CloudSyncStatusField::mCloudExtension
private

Definition at line 56 of file CloudSyncStatusField.h.

◆ mCloudStatusChangedSubscription

Observer::Subscription audacity::cloud::audiocom::sync::CloudSyncStatusField::mCloudStatusChangedSubscription
private

Definition at line 71 of file CloudSyncStatusField.h.

◆ mProgress

int audacity::cloud::audiocom::sync::CloudSyncStatusField::mProgress { 0 }
private

◆ mProject

AudacityProject& audacity::cloud::audiocom::sync::CloudSyncStatusField::mProject
private

Definition at line 55 of file CloudSyncStatusField.h.

◆ mStatusWidget

wxWeakRef<StatusWidget> audacity::cloud::audiocom::sync::CloudSyncStatusField::mStatusWidget
private

Definition at line 69 of file CloudSyncStatusField.h.


The documentation for this class was generated from the following files: