- fix: compiler set index not correctly saved, when remove compiler sets in options dialog

This commit is contained in:
Roy Qu 2022-02-15 22:45:14 +08:00
parent c58b76d7cd
commit a2289463f9
2 changed files with 3 additions and 5 deletions

View File

@ -12,6 +12,7 @@ Red Panda C++ Version 0.14.3
- enhancement: git - add files - enhancement: git - add files
- enhancement: git - commit - enhancement: git - commit
- enhancement: git - restore - enhancement: git - restore
- fix: compiler set index not correctly saved, when remove compiler sets in options dialog
Red Panda C++ Version 0.14.2 Red Panda C++ Version 0.14.2
- enhancement: file system view mode for project - enhancement: file system view mode for project

View File

@ -2643,7 +2643,6 @@ void Settings::CompilerSets::loadSets()
return; return;
} }
findSets(); findSets();
saveSets();
if ( mList.size() <= mDefaultIndex) if ( mList.size() <= mDefaultIndex)
mDefaultIndex = mList.size()-1; mDefaultIndex = mList.size()-1;
pCurrentSet = defaultSet(); pCurrentSet = defaultSet();
@ -2653,7 +2652,7 @@ void Settings::CompilerSets::loadSets()
saveSets(); saveSets();
return; return;
} }
saveSet(mDefaultIndex); saveSets();
if (pCurrentSet->binDirs().count()>0) { if (pCurrentSet->binDirs().count()>0) {
pCurrentSet->setProperties(pCurrentSet->binDirs()[0]); pCurrentSet->setProperties(pCurrentSet->binDirs()[0]);
} }
@ -2707,12 +2706,10 @@ void Settings::CompilerSets::deleteSet(int index)
mSettings->mSettings.endGroup(); mSettings->mSettings.endGroup();
} }
mList.erase(std::begin(mList)+index); mList.erase(std::begin(mList)+index);
for (size_t i=index;i<mList.size();i++) {
saveSet(i);
}
if (mDefaultIndex>=mList.size()) { if (mDefaultIndex>=mList.size()) {
mDefaultIndex = mList.size()-1; mDefaultIndex = mList.size()-1;
} }
saveSets();
} }
Settings::CompilerSetList &Settings::CompilerSets::list() Settings::CompilerSetList &Settings::CompilerSets::list()