Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
anonymous_namespace{ProjectStatus.cpp}::Dispatcher Struct Referencefinal
Inheritance diagram for anonymous_namespace{ProjectStatus.cpp}::Dispatcher:
[legend]
Collaboration diagram for anonymous_namespace{ProjectStatus.cpp}::Dispatcher:
[legend]

Public Member Functions

void Dispatch (const AudacityProject &project, const StatusBarField &identifier)
 
Observer::Subscription Subscribe (std::function< void(const AudacityProject &, const StatusBarField &)> handler)
 
void NewFieldRegistered (const StatusBarField &identifier)
 
- Public Member Functions inherited from Observer::Publisher< Message >
 Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={})
 Constructor supporting type-erased custom allocation/deletion. More...
 
 Publisher (Publisher &&)=default
 
Publisheroperator= (Publisher &&)=default
 
Subscription Subscribe (Callback callback)
 Connect a callback to the Publisher; later-connected are called earlier. More...
 
Subscription Subscribe (Object &obj, Return(Object::*callback)(Args...))
 Overload of Subscribe takes an object and pointer-to-member-function. More...
 

Static Public Member Functions

static DispatcherGet ()
 

Private Attributes

std::vector< StatusBarFieldmNewFields
 
bool mCallEnqueued { false }
 

Additional Inherited Members

- Public Types inherited from Observer::Publisher< Message >
using message_type = Message
 
using CallbackReturn = std::conditional_t< true, void, bool >
 
using Callback = std::function< CallbackReturn(const Message &) >
 Type of functions that can be connected to the Publisher. More...
 
- Static Public Attributes inherited from Observer::Publisher< Message >
static constexpr bool notifies_all
 
- Protected Member Functions inherited from Observer::Publisher< Message >
CallbackReturn Publish (const Message &message)
 Send a message to connected callbacks. More...
 

Detailed Description

Definition at line 117 of file ProjectStatus.cpp.

Member Function Documentation

◆ Dispatch()

void anonymous_namespace{ProjectStatus.cpp}::Dispatcher::Dispatch ( const AudacityProject project,
const StatusBarField identifier 
)
inline

Definition at line 120 of file ProjectStatus.cpp.

121 {
122 Publish(Message { project, identifier });
123 }
const auto project
CallbackReturn Publish(const Message &message)
Send a message to connected callbacks.
Definition: Observer.h:207
TranslatableString Message(unsigned trackCount)

References project, and Observer::Publisher< StatusBarField >::Publish().

Here is the call graph for this function:

◆ Get()

static Dispatcher & anonymous_namespace{ProjectStatus.cpp}::Dispatcher::Get ( )
inlinestatic

Definition at line 134 of file ProjectStatus.cpp.

135 {
136 static Dispatcher dispatcher;
137 return dispatcher;
138 }
std::function< bool(const wxArrayStringEx &fields) > Dispatcher

◆ NewFieldRegistered()

void anonymous_namespace{ProjectStatus.cpp}::Dispatcher::NewFieldRegistered ( const StatusBarField identifier)
inline

Definition at line 141 of file ProjectStatus.cpp.

142 {
143 mCallEnqueued = true;
144 mNewFields.push_back(identifier);
145
147 [this]
148 {
149 if (mCallEnqueued)
150 {
152 [this]
153 {
154 for (auto& project : AllProjects {})
155 {
156 for (const auto& field : mNewFields)
158 }
159
160 mNewFields.clear();
161 mCallEnqueued = false;
162 });
163 }
164 });
165 }
#define field(n, t)
Definition: ImportAUP.cpp:165
void OnAppInitialized(std::function< void()> callback)
Definition: AppEvents.cpp:42
void CallAfter(Action action)
Schedule an action to be done later, and in the main thread.
Definition: BasicUI.cpp:214
void Dispatch(const AudacityProject &project, const StatusBarField &identifier)

References BasicUI::CallAfter(), TypeSwitch::Dispatch(), field, AppEvents::OnAppInitialized(), and project.

Here is the call graph for this function:

◆ Subscribe()

Observer::Subscription anonymous_namespace{ProjectStatus.cpp}::Dispatcher::Subscribe ( std::function< void(const AudacityProject &, const StatusBarField &)>  handler)
inline

Definition at line 126 of file ProjectStatus.cpp.

128 {
130 [handler = std::move(handler)](const auto& message)
131 { handler(message.project, message.identifier); });
132 }
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199

References audacity::cloud::audiocom::anonymous_namespace{AuthorizationHandler.cpp}::handler, and Observer::Publisher< Message, NotifyAll >::Subscribe().

Here is the call graph for this function:

Member Data Documentation

◆ mCallEnqueued

bool anonymous_namespace{ProjectStatus.cpp}::Dispatcher::mCallEnqueued { false }
private

Definition at line 169 of file ProjectStatus.cpp.

◆ mNewFields

std::vector<StatusBarField> anonymous_namespace{ProjectStatus.cpp}::Dispatcher::mNewFields
private

Definition at line 168 of file ProjectStatus.cpp.


The documentation for this struct was generated from the following file: