From 3eb6a40ce40757e2e36b856d0d80e78a667b7046 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 30 Jan 2018 00:33:44 +0100 Subject: Update PluginManager: implement plugin tags * move plugin-meta-data (status, tag) into dedicated sub-dir * load/save space separated tags * pre-seed tags with plugin-category (if unset) * breaking API change: PluginStatusesChanged() signal includes change --- libs/ardour/ardour/plugin_manager.h | 49 ++++++++++++++++++++++++++++++++++--- libs/ardour/ardour/types_convert.h | 1 + 2 files changed, 47 insertions(+), 3 deletions(-) (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/plugin_manager.h b/libs/ardour/ardour/plugin_manager.h index 70b49d3eac..b10c1a1f21 100644 --- a/libs/ardour/ardour/plugin_manager.h +++ b/libs/ardour/ardour/plugin_manager.h @@ -39,7 +39,7 @@ namespace ARDOUR { class Plugin; class LIBARDOUR_API PluginManager : public boost::noncopyable { - public: +public: static PluginManager& instance(); static std::string scanner_bin_path; @@ -64,6 +64,9 @@ class LIBARDOUR_API PluginManager : public boost::noncopyable { const std::string get_default_windows_vst_path() const { return windows_vst_path; } const std::string get_default_lxvst_path() const { return lxvst_path; } + /* always return LXVST for any VST subtype */ + static PluginType to_generic_vst (PluginType); + bool cancelled () { return _cancel_scan; } bool no_timeout () { return _cancel_timeout; } @@ -79,12 +82,52 @@ class LIBARDOUR_API PluginManager : public boost::noncopyable { void set_status (ARDOUR::PluginType type, std::string unique_id, PluginStatusType status); PluginStatusType get_status (const PluginInfoPtr&) const; + void load_tags (); + void save_tags (); + + void set_tags (ARDOUR::PluginType type, std::string unique_id, std::string tags, bool factory, bool force = false); + std::string get_tags_as_string (PluginInfoPtr const&) const; + std::vector get_tags (PluginInfoPtr const&) const; + std::vector get_all_tags (bool favorites_only) const; + /** plugins were added to or removed from one of the PluginInfoLists */ PBD::Signal0 PluginListChanged; + /** Plugin Hidden/Favorite status changed */ - PBD::Signal0 PluginStatusesChanged; + PBD::Signal3 PluginStatusesChanged; //PluginType t, string id, string tag + + PBD::Signal3 PluginTagsChanged; //PluginType t, string id, string tag + +private: + + struct PluginTag { + ARDOUR::PluginType type; + std::string unique_id; + std::string tags; + bool user_set; + + PluginTag (ARDOUR::PluginType t, std::string id, std::string s, bool user_set) + : type (t), unique_id (id), tags (s), user_set (user_set) {} + + bool operator== (PluginTag const& other) const { + return other.type == type && other.unique_id == unique_id; + } + + bool operator< (PluginTag const& other) const { + if (other.type < type) { + return true; + } else if (other.type == type && other.unique_id < unique_id) { + return true; + } + return false; + } + }; + + typedef std::set PluginTagList; + PluginTagList ptags; + + std::string sanitize_tag (const std::string) const; - private: struct PluginStatus { ARDOUR::PluginType type; std::string unique_id; diff --git a/libs/ardour/ardour/types_convert.h b/libs/ardour/ardour/types_convert.h index 25381516b6..8317614989 100644 --- a/libs/ardour/ardour/types_convert.h +++ b/libs/ardour/ardour/types_convert.h @@ -63,6 +63,7 @@ DEFINE_ENUM_CONVERT(ARDOUR::DiskIOPoint) DEFINE_ENUM_CONVERT(ARDOUR::NoteMode) DEFINE_ENUM_CONVERT(ARDOUR::ChannelMode) DEFINE_ENUM_CONVERT(ARDOUR::MonitorChoice) +DEFINE_ENUM_CONVERT(ARDOUR::PluginType) DEFINE_ENUM_CONVERT(ARDOUR::AlignStyle) DEFINE_ENUM_CONVERT(ARDOUR::AlignChoice) -- cgit v1.2.3