commit 6242063465e48c5955af6b4166180f3edae2ed16 parent 3ac99ea1d5e7c22b2d8b45ee6ffa1637300f6508 Author: dsp56300 <dsp56300@users.noreply.github.com> Date: Sat, 2 Nov 2024 19:02:32 +0100 do not pass root dir for patch manager as contructor argument, patch manager can figure that out on its own Diffstat:
14 files changed, 24 insertions(+), 29 deletions(-)
diff --git a/source/jucePluginEditorLib/patchmanager/patchmanager.cpp b/source/jucePluginEditorLib/patchmanager/patchmanager.cpp @@ -28,7 +28,14 @@ namespace jucePluginEditorLib::patchManager constexpr auto g_searchBarHeight = 32; constexpr int g_padding = 4; - PatchManager::PatchManager(Editor& _editor, Component* _root, const juce::File& _dir, const std::initializer_list<GroupType>& _groupTypes) : DB(_dir), m_editor(_editor), m_state(*this) + juce::File initRootDirectory(const Editor& _editor) + { + const auto configOptions = _editor.getProcessor().getConfigOptions(); + const auto dir = configOptions.getDefaultFile().getParentDirectory(); + return dir; + } + + PatchManager::PatchManager(Editor& _editor, Component* _root, const std::initializer_list<GroupType>& _groupTypes) : DB(initRootDirectory(_editor)), m_editor(_editor), m_state(*this) { setTagTypeName(pluginLib::patchDB::TagType::Category, "Category"); setTagTypeName(pluginLib::patchDB::TagType::Tag, "Tag"); diff --git a/source/jucePluginEditorLib/patchmanager/patchmanager.h b/source/jucePluginEditorLib/patchmanager/patchmanager.h @@ -45,7 +45,7 @@ namespace jucePluginEditorLib::patchManager static constexpr std::initializer_list<GroupType> DefaultGroupTypes{GroupType::Favourites, GroupType::LocalStorage, GroupType::Factory, GroupType::DataSources}; - explicit PatchManager(Editor& _editor, Component* _root, const juce::File& _dir, const std::initializer_list<GroupType>& _groupTypes = DefaultGroupTypes); + explicit PatchManager(Editor& _editor, Component* _root, const std::initializer_list<GroupType>& _groupTypes = DefaultGroupTypes); ~PatchManager() override; void timerCallback() override; diff --git a/source/mqJucePlugin/mqEditor.cpp b/source/mqJucePlugin/mqEditor.cpp @@ -35,10 +35,7 @@ namespace mqJucePlugin container->setSize(static_cast<int>(w / scale),static_cast<int>(h / scale)); container->setTopLeftPosition(static_cast<int>(x / scale),static_cast<int>(y / scale)); - const auto configOptions = getProcessor().getConfigOptions(); - const auto dir = configOptions.getDefaultFile().getParentDirectory(); - - setPatchManager(new PatchManager(*this, container, dir)); + setPatchManager(new PatchManager(*this, container)); } auto disableButton = [](juce::Component* _comp) diff --git a/source/mqJucePlugin/mqPatchManager.cpp b/source/mqJucePlugin/mqPatchManager.cpp @@ -13,8 +13,8 @@ namespace mqJucePlugin jucePluginEditorLib::patchManager::GroupType::DataSources, }; - PatchManager::PatchManager(Editor& _editor, juce::Component* _root, const juce::File& _dir) - : jucePluginEditorLib::patchManager::PatchManager(_editor, _root, _dir, g_groupTypes) + PatchManager::PatchManager(Editor& _editor, juce::Component* _root) + : jucePluginEditorLib::patchManager::PatchManager(_editor, _root, g_groupTypes) , m_editor(_editor) , m_controller(_editor.getMqController()) { diff --git a/source/mqJucePlugin/mqPatchManager.h b/source/mqJucePlugin/mqPatchManager.h @@ -10,7 +10,7 @@ namespace mqJucePlugin class PatchManager : public jucePluginEditorLib::patchManager::PatchManager { public: - PatchManager(Editor& _editor, juce::Component* _root, const juce::File& _dir); + PatchManager(Editor& _editor, juce::Component* _root); ~PatchManager() override; // PatchManager overrides diff --git a/source/nord/n2x/n2xJucePlugin/n2xEditor.cpp b/source/nord/n2x/n2xJucePlugin/n2xEditor.cpp @@ -44,10 +44,7 @@ namespace n2xJucePlugin container->setSize(static_cast<int>(w / scale),static_cast<int>(h / scale)); container->setTopLeftPosition(static_cast<int>(x / scale),static_cast<int>(y / scale)); - const auto configOptions = getProcessor().getConfigOptions(); - const auto dir = configOptions.getDefaultFile().getParentDirectory(); - - setPatchManager(new PatchManager(*this, container, dir)); + setPatchManager(new PatchManager(*this, container)); } if(auto* versionNumber = findComponentT<juce::Label>("VersionNumber", false)) diff --git a/source/nord/n2x/n2xJucePlugin/n2xPatchManager.cpp b/source/nord/n2x/n2xJucePlugin/n2xPatchManager.cpp @@ -18,8 +18,8 @@ namespace n2xJucePlugin jucePluginEditorLib::patchManager::GroupType::DataSources, }; - PatchManager::PatchManager(Editor& _editor, Component* _root, const juce::File& _dir) - : jucePluginEditorLib::patchManager::PatchManager(_editor, _root, _dir, g_groupTypes) + PatchManager::PatchManager(Editor& _editor, Component* _root) + : jucePluginEditorLib::patchManager::PatchManager(_editor, _root, g_groupTypes) , m_editor(_editor) , m_controller(_editor.getN2xController()) { diff --git a/source/nord/n2x/n2xJucePlugin/n2xPatchManager.h b/source/nord/n2x/n2xJucePlugin/n2xPatchManager.h @@ -10,7 +10,7 @@ namespace n2xJucePlugin class PatchManager : public jucePluginEditorLib::patchManager::PatchManager { public: - PatchManager(Editor& _editor, Component* _root, const juce::File& _dir); + PatchManager(Editor& _editor, Component* _root); ~PatchManager() override; // PatchManager overrides diff --git a/source/virusJucePlugin/PatchManager.cpp b/source/virusJucePlugin/PatchManager.cpp @@ -22,7 +22,7 @@ namespace virus namespace genericVirusUI { - PatchManager::PatchManager(VirusEditor& _editor, juce::Component* _root, const juce::File& _dir) : jucePluginEditorLib::patchManager::PatchManager(_editor, _root, _dir), m_controller(_editor.getController()) + PatchManager::PatchManager(VirusEditor& _editor, juce::Component* _root) : jucePluginEditorLib::patchManager::PatchManager(_editor, _root), m_controller(_editor.getController()) { setTagTypeName(pluginLib::patchDB::TagType::CustomA, "Virus Model"); setTagTypeName(pluginLib::patchDB::TagType::CustomB, "Virus Features"); diff --git a/source/virusJucePlugin/PatchManager.h b/source/virusJucePlugin/PatchManager.h @@ -17,7 +17,7 @@ namespace genericVirusUI class PatchManager : public jucePluginEditorLib::patchManager::PatchManager { public: - PatchManager(VirusEditor& _editor, juce::Component* _root, const juce::File& _dir); + PatchManager(VirusEditor& _editor, juce::Component* _root); ~PatchManager() override; // PatchDB impl diff --git a/source/virusJucePlugin/VirusEditor.cpp b/source/virusJucePlugin/VirusEditor.cpp @@ -41,16 +41,13 @@ namespace genericVirusUI if(!getConditionCountRecursive()) m_fxPage.reset(new FxPage(*this)); - const auto configOptions = getProcessor().getConfigOptions(); - const auto dir = configOptions.getDefaultFile().getParentDirectory(); - { auto pmParent = findComponent("ContainerPatchManager", false); if(!pmParent) pmParent = findComponent("page_presets", false); if(!pmParent) pmParent = findComponent("page_2_browser"); - setPatchManager(new PatchManager(*this, pmParent, dir)); + setPatchManager(new PatchManager(*this, pmParent)); } m_presetName = findComponentT<juce::Label>("PatchName"); diff --git a/source/xtJucePlugin/xtEditor.cpp b/source/xtJucePlugin/xtEditor.cpp @@ -44,10 +44,7 @@ namespace xtJucePlugin container->setSize(static_cast<int>(w / scale),static_cast<int>(h / scale)); container->setTopLeftPosition(static_cast<int>(x / scale),static_cast<int>(y / scale)); - const auto configOptions = getProcessor().getConfigOptions(); - const auto dir = configOptions.getDefaultFile().getParentDirectory(); - - setPatchManager(new PatchManager(*this, container, dir)); + setPatchManager(new PatchManager(*this, container)); } m_btMultiMode = findComponentT<juce::Button>("MultiModeButton"); diff --git a/source/xtJucePlugin/xtPatchManager.cpp b/source/xtJucePlugin/xtPatchManager.cpp @@ -16,8 +16,8 @@ namespace xtJucePlugin jucePluginEditorLib::patchManager::GroupType::DataSources, }; - PatchManager::PatchManager(Editor& _editor, juce::Component* _root, const juce::File& _dir) - : jucePluginEditorLib::patchManager::PatchManager(_editor, _root, _dir, g_groupTypes) + PatchManager::PatchManager(Editor& _editor, juce::Component* _root) + : jucePluginEditorLib::patchManager::PatchManager(_editor, _root, g_groupTypes) , m_editor(_editor) , m_controller(_editor.getXtController()) { diff --git a/source/xtJucePlugin/xtPatchManager.h b/source/xtJucePlugin/xtPatchManager.h @@ -10,7 +10,7 @@ namespace xtJucePlugin class PatchManager : public jucePluginEditorLib::patchManager::PatchManager { public: - PatchManager(Editor& _editor, juce::Component* _root, const juce::File& _dir); + PatchManager(Editor& _editor, juce::Component* _root); ~PatchManager() override; // PatchManager overrides