Loading...
Searching...
No Matches
score-plugin-clap/Clap/ApplicationPlugin.hpp
1#pragma once
2#include <score/plugins/application/GUIApplicationPlugin.hpp>
3
4#include <QObject>
5#include <QtCore/qglobal.h>
6
7#include <score_plugin_clap_export.h>
8
9#include <memory>
10#include <vector>
11#include <verdigris>
12
13namespace Library
14{
15class ProcessesItemModel;
16}
17namespace Media
18{
19class PluginScanner;
20}
21
22class QTimer;
23class QJsonObject;
24
25namespace Clap
26{
28{
29 QString path;
30 QString id;
31 QString name;
32 QString vendor;
33 QString version;
34 QString url;
35 QString manual_url;
36 QString support_url;
37 QString description;
38
39 QList<QString> features;
40 bool valid{};
41};
42
45SCORE_PLUGIN_CLAP_EXPORT
46std::vector<PluginInfo> parseClapReply(const QString& path, const QJsonObject& obj);
47
52SCORE_PLUGIN_CLAP_EXPORT
53QString resolveClapEntry(const QString& path);
54
55class SCORE_PLUGIN_CLAP_EXPORT ApplicationPlugin
56 : public QObject
58{
59 W_OBJECT(ApplicationPlugin)
60
61public:
64
65 void initialize() override;
66
67 const std::vector<PluginInfo>& plugins() const noexcept { return m_plugins; }
68
69 void rescanPlugins();
71 void forceRescan();
72
73public:
74 void pluginsChanged() E_SIGNAL(SCORE_PLUGIN_CLAP_EXPORT, pluginsChanged);
75
76private:
77 void onScanned(const QString& path, const QJsonObject& obj);
78 void onScanFailed(const QString& path, const QString& reason);
79 void removeEntriesForPath(const QString& path);
80 void persistCache();
81 void schedulePersist();
82
83#if QT_CONFIG(process)
84 std::unique_ptr<Media::PluginScanner> m_scanner;
85#endif
86 QTimer* m_persistTimer{};
87 bool m_scanRan{};
88
89 std::vector<PluginInfo> m_plugins;
90};
91}
92
93Q_DECLARE_METATYPE(Clap::PluginInfo)
94Q_DECLARE_METATYPE(std::vector<Clap::PluginInfo>)
Definition score-plugin-clap/Clap/ApplicationPlugin.hpp:58
Used to extend the software with application-wide data.
Definition GUIApplicationPlugin.hpp:89
Definition score-plugin-clap/Clap/ApplicationPlugin.hpp:28
Specializes ApplicationContext with the QMainWindow.
Definition GUIApplicationContext.hpp:15