forked from qt-creator/qt-creator
QbsProjectManager: Simplify profile creation code a bit
Change-Id: I253671358955a970def0eb1343558135a38acaa2 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -154,11 +154,6 @@ QString QbsProfileManager::ensureProfileForKit(const ProjectExplorer::Kit *k)
|
||||
return profileNameForKit(k);
|
||||
}
|
||||
|
||||
void QbsProfileManager::setProfileForKit(const QString &name, const ProjectExplorer::Kit *k)
|
||||
{
|
||||
runQbsConfig(QbsConfigOp::Set, kitNameKeyInQbsSettings(k), name);
|
||||
}
|
||||
|
||||
void QbsProfileManager::updateProfileIfNecessary(const ProjectExplorer::Kit *kit)
|
||||
{
|
||||
// kit in list <=> profile update is necessary
|
||||
@@ -173,29 +168,11 @@ void QbsProfileManager::updateAllProfiles()
|
||||
addProfileFromKit(kit);
|
||||
}
|
||||
|
||||
void QbsProfileManager::addProfile(const QString &name, const QVariantMap &data)
|
||||
{
|
||||
const QString keyPrefix = "profiles." + name + ".";
|
||||
for (auto it = data.begin(); it != data.end(); ++it)
|
||||
runQbsConfig(QbsConfigOp::Set, keyPrefix + it.key(), it.value());
|
||||
emit qbsProfilesUpdated();
|
||||
}
|
||||
|
||||
void QbsProfileManager::addQtProfileFromKit(const QString &profileName, const ProjectExplorer::Kit *k)
|
||||
{
|
||||
if (const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(k)) {
|
||||
runQbsConfig(QbsConfigOp::Set,
|
||||
"profiles." + profileName + ".moduleProviders.Qt.qmakeFilePaths",
|
||||
qt->qmakeCommand().toString());
|
||||
}
|
||||
}
|
||||
|
||||
void QbsProfileManager::addProfileFromKit(const ProjectExplorer::Kit *k)
|
||||
{
|
||||
const QString name = profileNameForKit(k);
|
||||
runQbsConfig(QbsConfigOp::Unset, "profiles." + name);
|
||||
setProfileForKit(name, k);
|
||||
addQtProfileFromKit(name, k);
|
||||
runQbsConfig(QbsConfigOp::Set, kitNameKeyInQbsSettings(k), name);
|
||||
|
||||
// set up properties:
|
||||
QVariantMap data = m_defaultPropertyProvider->properties(k, QVariantMap());
|
||||
@@ -203,8 +180,13 @@ void QbsProfileManager::addProfileFromKit(const ProjectExplorer::Kit *k)
|
||||
if (provider->canHandle(k))
|
||||
data = provider->properties(k, data);
|
||||
}
|
||||
if (const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(k))
|
||||
data.insert("moduleProviders.Qt.qmakeFilePaths", qt->qmakeCommand().toString());
|
||||
|
||||
addProfile(name, data);
|
||||
const QString keyPrefix = "profiles." + name + ".";
|
||||
for (auto it = data.begin(); it != data.end(); ++it)
|
||||
runQbsConfig(QbsConfigOp::Set, keyPrefix + it.key(), it.value());
|
||||
emit qbsProfilesUpdated();
|
||||
}
|
||||
|
||||
void QbsProfileManager::handleKitUpdate(ProjectExplorer::Kit *kit)
|
||||
|
||||
@@ -58,9 +58,6 @@ signals:
|
||||
void qbsProfilesUpdated();
|
||||
|
||||
private:
|
||||
void setProfileForKit(const QString &name, const ProjectExplorer::Kit *k);
|
||||
void addProfile(const QString &name, const QVariantMap &data);
|
||||
void addQtProfileFromKit(const QString &profileName, const ProjectExplorer::Kit *k);
|
||||
void addProfileFromKit(const ProjectExplorer::Kit *k);
|
||||
void updateAllProfiles();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user