From 99bb10060f36dbb7898dce3a0b78e7730551e731 Mon Sep 17 00:00:00 2001 From: kshitij98 Date: Tue, 29 May 2018 18:43:23 +0530 Subject: [PATCH] Updated TestEffectBackend --- src/effects/effectmanifest.h | 2 ++ src/effects/effectsmanager.cpp | 7 ++++--- src/effects/effectsmanager.h | 2 -- src/preferences/dialog/dlgprefeffects.cpp | 4 ++++ src/test/baseeffecttest.h | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/effects/effectmanifest.h b/src/effects/effectmanifest.h index e7a400b02cf..538cecdae7a 100644 --- a/src/effects/effectmanifest.h +++ b/src/effects/effectmanifest.h @@ -144,6 +144,8 @@ class EffectManifest final { return QString("Unknown"); } } + + // Use this when showing the string in the GUI QString translatedBackendName() { switch (m_backendType) { case EffectBackendType::BuiltIn: diff --git a/src/effects/effectsmanager.cpp b/src/effects/effectsmanager.cpp index f4aadc71d0e..533c7c046b7 100644 --- a/src/effects/effectsmanager.cpp +++ b/src/effects/effectsmanager.cpp @@ -70,9 +70,10 @@ EffectsManager::~EffectsManager() { bool alphabetizeEffectManifests(EffectManifestPointer pManifest1, EffectManifestPointer pManifest2) { - int dNameComp = QString::localeAwareCompare(pManifest1->displayName(), pManifest2->displayName()); - int bNameComp = static_cast(pManifest1->backendType()) - static_cast(pManifest2->backendType()); - return (bNameComp ? (bNameComp < 0) : (dNameComp < 0)); + // Sort built-in effects first before external plugins + int backendNameComparision = static_cast(pManifest1->backendType()) - static_cast(pManifest2->backendType()); + int displayNameComparision = QString::localeAwareCompare(pManifest1->displayName(), pManifest2->displayName()); + return (backendNameComparision ? (backendNameComparision < 0) : (displayNameComparision < 0)); } void EffectsManager::addEffectsBackend(EffectsBackend* pBackend) { diff --git a/src/effects/effectsmanager.h b/src/effects/effectsmanager.h index 357bb3daa1d..09db79b5693 100644 --- a/src/effects/effectsmanager.h +++ b/src/effects/effectsmanager.h @@ -8,8 +8,6 @@ #include #include -#include - #include "preferences/usersettings.h" #include "control/controlpotmeter.h" #include "control/controlpushbutton.h" diff --git a/src/preferences/dialog/dlgprefeffects.cpp b/src/preferences/dialog/dlgprefeffects.cpp index 2a6e44afd3c..90c6c27a62a 100644 --- a/src/preferences/dialog/dlgprefeffects.cpp +++ b/src/preferences/dialog/dlgprefeffects.cpp @@ -62,6 +62,10 @@ void DlgPrefEffects::slotApply() { for (EffectProfilePtr profile : m_availableEffectsModel.profiles()) { EffectManifestPointer pManifest = profile->pManifest; m_pEffectsManager->setEffectVisibility(pManifest, profile->bIsVisible); + + // Effects from different backends can have same Effect IDs. + // Add backend name to group to uniquely identify those effects. + // Use untranslated value to keep the group language independent. m_pConfig->set(ConfigKey("[Visible " + pManifest->backendName() + " Effects]", pManifest->id()), ConfigValue(profile->bIsVisible)); } diff --git a/src/test/baseeffecttest.h b/src/test/baseeffecttest.h index 412918aa118..0102f5fc8dd 100644 --- a/src/test/baseeffecttest.h +++ b/src/test/baseeffecttest.h @@ -19,7 +19,7 @@ class TestEffectBackend : public EffectsBackend { public: - TestEffectBackend() : EffectsBackend(NULL, "TestBackend") { + TestEffectBackend() : EffectsBackend(NULL, EffectBackendType::Unknown) { } // Expose as public