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 <QString>
6#include <albert/config.h>
7#include <albert/export.h>
8#include <filesystem>
9#include <memory>
10#include <vector>
11class QSettings;
12class QWidget;
13
14namespace albert
15{
16class Extension;
17class PluginLoader;
18
24class ALBERT_EXPORT PluginInstance
25{
26public:
27
30 virtual QWidget *buildConfigWidget();
31
35 virtual std::vector<albert::Extension*> extensions();
36
37public:
38
42 [[nodiscard]] const PluginLoader &loader() const;
43
47 [[nodiscard]] std::filesystem::path cacheLocation() const;
48
52 [[nodiscard]] std::filesystem::path configLocation() const;
53
57 [[nodiscard]] std::filesystem::path dataLocation() const;
58
62 [[nodiscard]] std::vector<std::filesystem::path> dataLocations() const;
63
68 [[nodiscard]] std::unique_ptr<QSettings> settings() const;
69
75 [[nodiscard]] std::unique_ptr<QSettings> state() const;
76
77protected:
78
80 virtual ~PluginInstance();
81
82private:
83
84 class Private;
85 std::unique_ptr<Private> d;
86
87};
88
89}
90
102#define ALBERT_PLUGIN Q_OBJECT Q_PLUGIN_METADATA(IID ALBERT_PLUGIN_IID FILE "metadata.json")
Abstract plugin instance class.
Definition plugininstance.h:25
const PluginLoader & loader() const
The PluginLoader of this instance.
std::vector< std::filesystem::path > dataLocations() const
The existing data locations of this plugin.
std::unique_ptr< QSettings > state() const
Persistent plugin state.
std::filesystem::path dataLocation() const
The recommended data location.
std::unique_ptr< QSettings > settings() const
Persistent plugin settings.
std::filesystem::path cacheLocation() const
The recommended cache location.
virtual QWidget * buildConfigWidget()
The widget used to configure the plugin in the settings.
std::filesystem::path configLocation() const
The recommended config location.
virtual std::vector< albert::Extension * > extensions()
The extensions provided by this plugin.
Plugin loader interface class.
Definition pluginloader.h:17
Definition action.h:10