Albert
Loading...
Searching...
No Matches
plugininstance.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 Manuel Schneider
2// SPDX-License-Identifier: MIT
3
4#pragma once
5#include <QDir>
6#include <QString>
7#include <albert/config.h>
8#include <albert/export.h>
9#include <memory>
10class QSettings;
11class QWidget;
12
13namespace albert
14{
15
16class ExtensionRegistry;
17class PluginLoader;
18
24class ALBERT_EXPORT PluginInstance
25{
26public:
27
31 const PluginLoader &loader() const;
32
37
40 virtual QWidget *buildConfigWidget();
41
45 QString cacheLocation() const;
46
50 QString configLocation() const;
51
55 QString dataLocation() const;
56
61 static QDir createOrThrow(const QString &path);
62
67 std::unique_ptr<QSettings> settings() const;
68
74 std::unique_ptr<QSettings> state() const;
75
76protected:
77
79 virtual ~PluginInstance();
80
81private:
82
83 class Private;
84 std::unique_ptr<Private> d;
85
86};
87
88}
89
101#define ALBERT_PLUGIN Q_OBJECT Q_PLUGIN_METADATA(IID ALBERT_PLUGIN_IID FILE "metadata.json")
The common extension pool.
Definition extensionregistry.h:23
Abstract plugin instance class.
Definition plugininstance.h:25
const PluginLoader & loader() const
The PluginLoader of this instance.
QString dataLocation() const
The recommended data location.
std::unique_ptr< QSettings > state() const
Persistent plugin state.
QString cacheLocation() const
The recommended cache location.
std::unique_ptr< QSettings > settings() const
Persistent plugin settings.
virtual QWidget * buildConfigWidget()
The widget used to configure the plugin in the settings.
static QDir createOrThrow(const QString &path)
Creates a directory, throws an exception if it fails.
albert::ExtensionRegistry & registry()
The associated ExtensionRegistry.
QString configLocation() const
The recommended config location.
Plugin loader interface class.
Definition pluginloader.h:17
Definition action.h:10