Skip to content

Commit

Permalink
Effect chain: (re)load preset after saving with a new name
Browse files Browse the repository at this point in the history
This will select the new preset in WEffectChainMenuButton and
WEffectChainPresetSelector
  • Loading branch information
ronso0 committed Aug 16, 2022
1 parent 1ed11fc commit 9615568
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/effects/presets/effectchainpresetmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,12 @@ void EffectChainPresetManager::setQuickEffectPresetOrder(

void EffectChainPresetManager::savePreset(EffectChainPointer pChainSlot) {
auto pPreset = EffectChainPresetPointer::create(pChainSlot.data());
savePreset(pPreset);
if (savePreset(pPreset)) {
pChainSlot->loadChainPreset(pPreset);
}
}

void EffectChainPresetManager::savePreset(EffectChainPresetPointer pPreset) {
bool EffectChainPresetManager::savePreset(EffectChainPresetPointer pPreset) {
QString name;
QString errorText;
while (name.isEmpty() || m_effectChainPresets.contains(name)) {
Expand All @@ -381,7 +383,7 @@ void EffectChainPresetManager::savePreset(EffectChainPresetPointer pPreset) {
&okay)
.trimmed();
if (!okay) {
return;
return false;
}

if (name.isEmpty()) {
Expand All @@ -404,6 +406,7 @@ void EffectChainPresetManager::savePreset(EffectChainPresetPointer pPreset) {
emit quickEffectChainPresetListUpdated();

savePresetXml(pPreset);
return true;
}

void EffectChainPresetManager::updatePreset(EffectChainPointer pChainSlot) {
Expand Down
2 changes: 1 addition & 1 deletion src/effects/presets/effectchainpresetmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class EffectChainPresetManager : public QObject {
return m_effectChainPresets.value(name);
}

void savePreset(EffectChainPresetPointer pPreset);
void savePreset(EffectChainPointer pChainSlot);
bool savePreset(EffectChainPresetPointer pPreset);
void updatePreset(EffectChainPointer pChainSlot);

EffectsXmlData readEffectsXml(const QDomDocument& doc, const QStringList& deckStrings);
Expand Down

0 comments on commit 9615568

Please sign in to comment.