Audacity 3.2.0
|
#include <URLSchemesRegistry.h>
Public Member Functions | |
bool | IsURLHandlingSupported () const noexcept |
Returns true, if Audacity can handle custom URLs. More... | |
bool | RegisterScheme (std::string_view scheme) |
Associates a new scheme with Audacity. More... | |
void | HandleURL (std::string_view url) |
Public Member Functions inherited from Observer::Publisher< URLschemeHandlerMessage > | |
Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={}) | |
Constructor supporting type-erased custom allocation/deletion. More... | |
Publisher (Publisher &&)=default | |
Publisher & | operator= (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 URLSchemesRegistry & | Get () |
Retrieves the registry instance. More... | |
Private Member Functions | |
URLSchemesRegistry ()=default | |
URLSchemesRegistry (const URLSchemesRegistry &)=delete | |
URLSchemesRegistry & | operator= (const URLSchemesRegistry &)=delete |
Additional Inherited Members | |
Public Types inherited from Observer::Publisher< URLschemeHandlerMessage > | |
using | message_type = URLschemeHandlerMessage |
using | CallbackReturn = std::conditional_t< true, void, bool > |
using | Callback = std::function< CallbackReturn(const URLschemeHandlerMessage &) > |
Type of functions that can be connected to the Publisher. More... | |
Static Public Attributes inherited from Observer::Publisher< URLschemeHandlerMessage > | |
static constexpr bool | notifies_all |
Protected Member Functions inherited from Observer::Publisher< URLschemeHandlerMessage > | |
CallbackReturn | Publish (const URLschemeHandlerMessage &message) |
Send a message to connected callbacks. More... | |
Registry for custom URL schemes, that enables Audacity to handle open-url system requests
Definition at line 27 of file URLSchemesRegistry.h.
|
privatedefault |
|
privatedelete |
|
static |
Retrieves the registry instance.
Definition at line 39 of file URLSchemesRegistry.cpp.
Referenced by AudacityApp::InitPart2(), audacity::cloud::audiocom::UserPanel::OnLinkButtonPressed(), and AudacityApp::OnTimer().
void URLSchemesRegistry::HandleURL | ( | std::string_view | url | ) |
Called by the application main class when a custom-scheme URL is passed to Audacity, effectively sending URLschemeHandlerMessage to subscribers.
Definition at line 53 of file URLSchemesRegistry.cpp.
References Observer::Publisher< URLschemeHandlerMessage >::Publish().
Referenced by AudacityApp::InitPart2(), and AudacityApp::OnTimer().
|
noexcept |
Returns true, if Audacity can handle custom URLs.
Definition at line 34 of file URLSchemesRegistry.cpp.
References anonymous_namespace{URLSchemesRegistry.cpp}::SchemeRegistrar.
Referenced by audacity::cloud::audiocom::UserPanel::OnLinkButtonPressed().
|
privatedelete |
bool URLSchemesRegistry::RegisterScheme | ( | std::string_view | scheme | ) |
Associates a new scheme with Audacity.
On Windows, it is ensured that the last opened will handle the URL. Returns true if Audacity succeeded updating the registry.
On macOS, scheme registration is done using the Info.plist file and this function always returns true.
On other platforms - always returns false.
Definition at line 45 of file URLSchemesRegistry.cpp.
References anonymous_namespace{URLSchemesRegistry.cpp}::SchemeRegistrar.
Referenced by AudacityApp::InitPart2().