Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effect chain: (re)load & select preset after saving with a new name #4899

Merged
merged 1 commit into from
Aug 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/effects/presets/effectchainpresetmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,14 @@ void EffectChainPresetManager::setQuickEffectPresetOrder(
emit quickEffectChainPresetListUpdated();
}

void EffectChainPresetManager::savePreset(EffectChainPointer pChainSlot) {
void EffectChainPresetManager::savePresetAndReload(EffectChainPointer pChainSlot) {
auto pPreset = EffectChainPresetPointer::create(pChainSlot.data());
savePreset(pPreset);
if (savePreset(pPreset)) {
pChainSlot->loadChainPreset(pPreset);
Swiftb0y marked this conversation as resolved.
Show resolved Hide resolved
}
}

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
4 changes: 2 additions & 2 deletions 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);
void savePresetAndReload(EffectChainPointer pChainSlot);
bool savePreset(EffectChainPresetPointer pPreset);
void updatePreset(EffectChainPointer pChainSlot);

EffectsXmlData readEffectsXml(const QDomDocument& doc, const QStringList& deckStrings);
Expand Down
2 changes: 1 addition & 1 deletion src/widget/weffectchainpresetbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void WEffectChainPresetButton::populateMenu() {
});
}
m_pMenu->addAction(tr("Save As New Preset..."), this, [this]() {
m_pChainPresetManager->savePreset(m_pChain);
m_pChainPresetManager->savePresetAndReload(m_pChain);
});

m_pMenu->addSeparator();
Expand Down