Add code to ensure unique preference pack names.

This commit is contained in:
Chris Hennes
2021-08-19 12:29:08 -05:00
parent 8c875a0098
commit 080e2ea198
3 changed files with 30 additions and 0 deletions

View File

@@ -359,8 +359,15 @@ void DlgGeneralImp::preferencePackSelectionChanged()
void DlgGeneralImp::saveAsNewPreferencePack()
{
// Create and run a modal New PreferencePack dialog box
auto appearancePacks = Application::Instance->prefPackManager()->preferencePackNames(PreferencePack::Type::Appearance);
auto behaviorPacks = Application::Instance->prefPackManager()->preferencePackNames(PreferencePack::Type::Behavior);
auto combinationPacks = Application::Instance->prefPackManager()->preferencePackNames(PreferencePack::Type::Combination);
auto allPacks = appearancePacks;
allPacks.insert(allPacks.end(), behaviorPacks.begin(), behaviorPacks.end());
allPacks.insert(allPacks.end(), combinationPacks.begin(), combinationPacks.end());
newPreferencePackDialog = std::make_unique<DlgCreateNewPreferencePackImp>(this);
newPreferencePackDialog->setPreferencePackTemplates(Application::Instance->prefPackManager()->templateFiles());
newPreferencePackDialog->setPreferencePackNames(allPacks);
connect(newPreferencePackDialog.get(), &DlgCreateNewPreferencePackImp::accepted, this, &DlgGeneralImp::newPreferencePackDialogAccepted);
newPreferencePackDialog->open();
}