forked from qt-creator/qt-creator
profiles: some variable renaming (st->profile)
Change-Id: I06da18c8db724e9dbb27878e9280b78b6df299cb Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -147,45 +147,45 @@ ProfileManager::ProfileManager(QObject *parent) :
|
|||||||
|
|
||||||
void ProfileManager::restoreProfiles()
|
void ProfileManager::restoreProfiles()
|
||||||
{
|
{
|
||||||
QList<Profile *> stsToRegister;
|
QList<Profile *> profilesToRegister;
|
||||||
QList<Profile *> stsToCheck;
|
QList<Profile *> profilesToCheck;
|
||||||
|
|
||||||
// read all profiles from SDK
|
// read all profiles from SDK
|
||||||
QFileInfo systemSettingsFile(Core::ICore::settings(QSettings::SystemScope)->fileName());
|
QFileInfo systemSettingsFile(Core::ICore::settings(QSettings::SystemScope)->fileName());
|
||||||
ProfileList system = restoreProfiles(systemSettingsFile.absolutePath() + QLatin1String(PROFILE_FILENAME));
|
ProfileList system = restoreProfiles(systemSettingsFile.absolutePath() + QLatin1String(PROFILE_FILENAME));
|
||||||
QList<Profile *> readSts = system.profiles;
|
QList<Profile *> readProfiles = system.profiles;
|
||||||
// make sure we mark these as autodetected!
|
// make sure we mark these as autodetected!
|
||||||
foreach (Profile *p, readSts)
|
foreach (Profile *p, readProfiles)
|
||||||
p->setAutoDetected(true);
|
p->setAutoDetected(true);
|
||||||
|
|
||||||
stsToRegister = readSts; // SDK profiles are always considered to be up-to-date, so no need to
|
profilesToRegister = readProfiles; // SDK profiles are always considered to be up-to-date, so no need to
|
||||||
// recheck them.
|
// recheck them.
|
||||||
|
|
||||||
// read all profile chains from user file
|
// read all profile chains from user file
|
||||||
ProfileList userProfiles = restoreProfiles(settingsFileName());
|
ProfileList userProfiles = restoreProfiles(settingsFileName());
|
||||||
readSts = userProfiles.profiles;
|
readProfiles = userProfiles.profiles;
|
||||||
|
|
||||||
foreach (Profile *p, readSts) {
|
foreach (Profile *p, readProfiles) {
|
||||||
if (p->isAutoDetected())
|
if (p->isAutoDetected())
|
||||||
stsToCheck.append(p);
|
profilesToCheck.append(p);
|
||||||
else
|
else
|
||||||
stsToRegister.append(p);
|
profilesToRegister.append(p);
|
||||||
}
|
}
|
||||||
readSts.clear();
|
readProfiles.clear();
|
||||||
|
|
||||||
// Then auto create profiles:
|
// Then auto create profiles:
|
||||||
QList<Profile *> detectedSts;
|
QList<Profile *> detectedProfiles;
|
||||||
|
|
||||||
// Find/update autodetected profiles:
|
// Find/update autodetected profiles:
|
||||||
Profile *toStore = 0;
|
Profile *toStore = 0;
|
||||||
foreach (Profile *currentDetected, detectedSts) {
|
foreach (Profile *currentDetected, detectedProfiles) {
|
||||||
toStore = currentDetected;
|
toStore = currentDetected;
|
||||||
|
|
||||||
// Check whether we had this profile stored and prefer the old one with the old id:
|
// Check whether we had this profile stored and prefer the old one with the old id:
|
||||||
for (int i = 0; i < stsToCheck.count(); ++i) {
|
for (int i = 0; i < profilesToCheck.count(); ++i) {
|
||||||
if (*(stsToCheck.at(i)) == *currentDetected) {
|
if (*(profilesToCheck.at(i)) == *currentDetected) {
|
||||||
toStore = stsToCheck.at(i);
|
toStore = profilesToCheck.at(i);
|
||||||
stsToCheck.removeAt(i);
|
profilesToCheck.removeAt(i);
|
||||||
delete currentDetected;
|
delete currentDetected;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -194,10 +194,10 @@ void ProfileManager::restoreProfiles()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete all loaded autodetected profiles that were not rediscovered:
|
// Delete all loaded autodetected profiles that were not rediscovered:
|
||||||
qDeleteAll(stsToCheck);
|
qDeleteAll(profilesToCheck);
|
||||||
|
|
||||||
// Store manual profiles
|
// Store manual profiles
|
||||||
foreach (Profile *p, stsToRegister)
|
foreach (Profile *p, profilesToRegister)
|
||||||
addProfile(p);
|
addProfile(p);
|
||||||
|
|
||||||
if (profiles().isEmpty()) {
|
if (profiles().isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user