Albert
Loading...
Searching...
No Matches
albert::PluginInstance Class Reference

#include <albert/plugininstance.h>

Description

Abstract plugin instance class.

The class every plugin has to inherit.

If the plugin instantiation fails you are supposed to print errors in english to the logs and throw a localized message that will be shown to the user.

Inheritance diagram for albert::PluginInstance:
[legend]

Public Member Functions

virtual QWidget * buildConfigWidget ()
 Creates a widget that can be used to configure the plugin properties.
 
virtual std::vector< albert::Extension * > extensions ()
 Returns the extensions provided by this plugin.
 
const PluginLoaderloader () const
 Returns the loader of this plugin.
 
std::filesystem::path cacheLocation () const
 Returns the writable cache location for this plugin.
 
std::filesystem::path configLocation () const
 Returns the writable config location for this plugin.
 
std::filesystem::path dataLocation () const
 Returns the writable data location for this plugin.
 
std::vector< std::filesystem::path > dataLocations () const
 Returns the existing data locations for this plugin.
 
std::unique_ptr< QSettings > settings () const
 Creates a preconfigured QSettings object for plugin config data.
 
std::unique_ptr< QSettings > state () const
 Creates a preconfigured QSettings object for plugin state data.
 
void readKeychain (const QString &key, std::function< void(const QString &value)> onSuccess, std::function< void(const QString &error)> onError) const
 Reads the keychain value for key asynchronously.
 
void writeKeychain (const QString &key, const QString &value, std::function< void()> onSuccess, std::function< void(const QString &error)> onError) const
 Sets the keychain value of key to value asynchronously.
 

Protected Member Functions

 PluginInstance ()
 Constructs a plugin instance.
 
virtual ~PluginInstance ()
 Destructs the plugin instance.
 

Constructor & Destructor Documentation

◆ PluginInstance()

albert::PluginInstance::PluginInstance ( )
protected

Constructs a plugin instance.

◆ ~PluginInstance()

virtual albert::PluginInstance::~PluginInstance ( )
protectedvirtual

Destructs the plugin instance.

Member Function Documentation

◆ buildConfigWidget()

virtual QWidget * albert::PluginInstance::buildConfigWidget ( )
virtual

Creates a widget that can be used to configure the plugin properties.

The caller takes ownership of the returned object.

◆ cacheLocation()

std::filesystem::path albert::PluginInstance::cacheLocation ( ) const

Returns the writable cache location for this plugin.

◆ configLocation()

std::filesystem::path albert::PluginInstance::configLocation ( ) const

Returns the writable config location for this plugin.

◆ dataLocation()

std::filesystem::path albert::PluginInstance::dataLocation ( ) const

Returns the writable data location for this plugin.

◆ dataLocations()

std::vector< std::filesystem::path > albert::PluginInstance::dataLocations ( ) const

Returns the existing data locations for this plugin.

This includes user, vendor, and system locations.

◆ extensions()

virtual std::vector< albert::Extension * > albert::PluginInstance::extensions ( )
virtual

Returns the extensions provided by this plugin.

The caller does not take ownership of the returned objects.

Reimplemented in albert::ExtensionPlugin.

◆ loader()

const PluginLoader & albert::PluginInstance::loader ( ) const

Returns the loader of this plugin.

◆ readKeychain()

void albert::PluginInstance::readKeychain ( const QString &  key,
std::function< void(const QString &value)>  onSuccess,
std::function< void(const QString &error)>  onError 
) const

Reads the keychain value for key asynchronously.

Calls onSuccess with the value of the key on success and onError with an error message on failure.

◆ settings()

std::unique_ptr< QSettings > albert::PluginInstance::settings ( ) const

Creates a preconfigured QSettings object for plugin config data.

Configured to use the group <plugin-id> in albert::config().

◆ state()

std::unique_ptr< QSettings > albert::PluginInstance::state ( ) const

Creates a preconfigured QSettings object for plugin state data.

Configured to use the group <plugin-id> in albert::state().

◆ writeKeychain()

void albert::PluginInstance::writeKeychain ( const QString &  key,
const QString &  value,
std::function< void()>  onSuccess,
std::function< void(const QString &error)>  onError 
) const

Sets the keychain value of key to value asynchronously.

Calls onSuccess on success and onError with an error message on failure.


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