Skip to content

Commit

Permalink
Updated TestEffectBackend
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitij98 committed May 29, 2018
1 parent b87b2bb commit 99bb100
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/effects/effectmanifest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions src/effects/effectsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ EffectsManager::~EffectsManager() {

bool alphabetizeEffectManifests(EffectManifestPointer pManifest1,
EffectManifestPointer pManifest2) {
int dNameComp = QString::localeAwareCompare(pManifest1->displayName(), pManifest2->displayName());
int bNameComp = static_cast<int>(pManifest1->backendType()) - static_cast<int>(pManifest2->backendType());
return (bNameComp ? (bNameComp < 0) : (dNameComp < 0));
// Sort built-in effects first before external plugins
int backendNameComparision = static_cast<int>(pManifest1->backendType()) - static_cast<int>(pManifest2->backendType());
int displayNameComparision = QString::localeAwareCompare(pManifest1->displayName(), pManifest2->displayName());
return (backendNameComparision ? (backendNameComparision < 0) : (displayNameComparision < 0));
}

void EffectsManager::addEffectsBackend(EffectsBackend* pBackend) {
Expand Down
2 changes: 0 additions & 2 deletions src/effects/effectsmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include <QScopedPointer>
#include <QPair>

#include <algorithm>

#include "preferences/usersettings.h"
#include "control/controlpotmeter.h"
#include "control/controlpushbutton.h"
Expand Down
4 changes: 4 additions & 0 deletions src/preferences/dialog/dlgprefeffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/baseeffecttest.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class TestEffectBackend : public EffectsBackend {
public:
TestEffectBackend() : EffectsBackend(NULL, "TestBackend") {
TestEffectBackend() : EffectsBackend(NULL, EffectBackendType::Unknown) {
}

// Expose as public
Expand Down

0 comments on commit 99bb100

Please sign in to comment.