45#include <albert/export.h>
49class QNetworkAccessManager;
64class ALBERT_EXPORT
App :
public QObject
76 virtual void show(
const QString &input_text = {}) = 0;
87 virtual const std::map<QString,Extension*> &
extensions()
const = 0;
93 std::map<QString, T*> results;
94 for (
auto &[
id, extension] : extensions())
95 if (T *t =
dynamic_cast<T*
>(extension))
96 results.emplace(
id, t);
105 return dynamic_cast<T*
>(extensions().at(
id));
106 }
catch (
const std::out_of_range &) {
151 static std::unique_ptr<QSettings>
state();
The public app instance interface.
Definition app.h:65
static std::unique_ptr< QSettings > settings()
Returns a QSettings object initialized with the application configuration file path.
T * extension(const QString &id) const
Get extension by id implicitly dynamic_cast'ed to type T.
Definition app.h:102
virtual const std::map< QString, Extension * > & extensions() const =0
Get map of all registered extensions.
static const std::filesystem::path & configLocation()
Returns the path to the application config directory.
static const std::filesystem::path & dataLocation()
Returns the path to the application data directory.
static App & instance()
Returns the global app instance.
void removed(albert::Extension *)
Emitted when an extension has been deregistered.
static void quit()
Quits the application.
std::map< QString, T * > extensions() const
Get map of all extensions of type T.
Definition app.h:91
virtual void show(const QString &input_text={})=0
Shows the frontend and optionally sets the text to input_text.
void added(albert::Extension *)
Emitted when an extension has been registered.
virtual void showSettings(QString plugin_id={})=0
Shows the settings window and optionally selects the plugin with plugin_id.
static std::unique_ptr< QSettings > state()
Returns a QSettings object initialized with the application state file path.
static const std::filesystem::path & cacheLocation()
Returns the path to the application cache directory.
static void restart()
Restarts the application.
Abstract extension class.
Definition extension.h:17
Modifies match scores according to user usage history and preferences.
Definition usagescoring.h:29
The Albert namespace.
Definition app.h:55