8#include "plugins/plugin_descriptor.h"
16namespace zrythm::gui::old_dsp::plugins
27 std::string get_name ()
const {
return name_; }
29 void set_name (std::string_view name) {
name_ = name; }
59 static constexpr auto kNameKey =
"name"sv;
60 static constexpr auto kDescriptionKey =
"description"sv;
61 static constexpr auto kDescriptorsKey =
"descriptors"sv;
65 { kNameKey, p.
name_ },
70 friend void from_json (
const nlohmann::json &j, PluginCollection &p)
72 j.at (kNameKey).get_to (p.name_);
73 j.at (kDescriptionKey).get_to (p.description_);
74 j.at (kDescriptorsKey).get_to (p.descriptors_);
121 z_warning (e.what ());
125 std::string get_document_type ()
const {
return "Zrythm Plugin Collections"; }
126 int get_format_major_version ()
const {
return 3; }
127 int get_format_minor_version ()
const {
return 0; }
151 static constexpr auto kCollectionsKey =
"collections"sv;
166 static void delete_file ();
168 static fs::path get_file_path ();
Plugin collection used in the plugin browser.
friend void init_from(PluginCollection &obj, const PluginCollection &other, utils::ObjectCloneType clone_type)
Generates a context menu for the collection.
void remove_descriptor(const PluginDescriptor &descr)
Removes the descriptor matching the given one from the collection.
std::vector< std::unique_ptr< PluginDescriptor > > descriptors_
Plugin descriptors.
std::string description_
Description of the collection (optional).
void add_descriptor(const PluginDescriptor &descr)
Appends a descriptor to the collection.
std::string name_
Name of the collection.
bool contains_descriptor(const PluginDescriptor &descr) const
Returns whether the collection contains the given descriptor.
Serializable plugin collections.
static std::unique_ptr< PluginCollections > read_or_new()
Returns a new instance with the cache pre-filled from the cache file, or an empty instance if there i...
std::vector< std::unique_ptr< PluginCollection > > collections_
Plugin collections.
void serialize_to_file() const
Serializes the cached descriptors to the standard file.
void add(const PluginCollection &collection, bool serialize)
Appends a collection.
void remove(PluginCollection &collection, bool serialize)
Removes the given collection.
const PluginCollection * find_from_name(std::string_view name) const
Finds a collection by name.
void serialize_to_file_no_throw() const
Wrapper over serialize_to_file that ignores exceptions.
The PluginDescriptor class provides a set of static utility functions and member functions to work wi...
Base class for exceptions in Zrythm.