1 /*
2  * Xournal++
3  *
4  * Plugin main controller
5  *
6  * @author Xournal++ Team
7  * https://github.com/xournalpp/xournalpp
8  *
9  * @license GNU GPLv2 or later
10  */
11 
12 #pragma once
13 
14 #include <memory>
15 #include <string>
16 #include <vector>
17 
18 #include "Plugin.h"
19 #include "filesystem.h"
20 
21 class Control;
22 
23 class PluginController final {
24 public:
25     explicit PluginController(Control* control);
26 
27 public:
28     /**
29      * Load all plugins within this folder
30      *
31      * @param path The path which contains the plugin folders
32      */
33     void loadPluginsFrom(fs::path const& path);
34 
35     /**
36      * Register toolbar item and all other UI stuff
37      */
38     void registerToolbar();
39 
40     /**
41      * Register menu stuff
42      */
43     void registerMenu();
44 
45     /**
46      * Show Plugin manager Dialog
47      */
48     void showPluginManager() const;
49 
50     /**
51      * Return the plugin list
52      */
53     auto getPlugins() const -> std::vector<Plugin*>;
54 
55 private:
56     /**
57      * The main controller
58      */
59     Control* control;
60 
61     /**
62      * All loaded Plugins
63      */
64     std::vector<std::unique_ptr<Plugin>> plugins;
65 };
66