QbsProjectManager: Cut down visible QbsManager interface a bit

Change-Id: I2c2d50f1ec0c7fdb5e9a629728f8db90cdb43b75
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2018-02-01 17:25:14 +01:00
parent 59d2505441
commit c4b3779b42
5 changed files with 18 additions and 22 deletions

View File

@@ -126,7 +126,7 @@ bool QbsBuildConfiguration::fromMap(const QVariantMap &map)
m_configurationName = map.value(configNameKey()).toString();
if (m_configurationName.isEmpty()) { // pre-4.4 backwards compatibility
const QString profileName = QbsManager::instance()->profileForKit(target()->kit());
const QString profileName = QbsManager::profileForKit(target()->kit());
const QString buildVariant = qbsConfiguration()
.value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString();
m_configurationName = profileName + QLatin1Char('-') + buildVariant;
@@ -369,7 +369,7 @@ QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep)
Utils::QtcProcess::addArgs(&commandLine, QStringList({"--jobs",
QString::number(jobCount)}));
}
const QString profileName = QbsManager::instance()->profileForKit(buildStep->target()->kit());
const QString profileName = QbsManager::profileForKit(buildStep->target()->kit());
const QString buildVariant = qbsConfiguration()
.value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString();
Utils::QtcProcess::addArg(&commandLine, configurationName());

View File

@@ -167,7 +167,7 @@ void QbsProfilesSettingsWidget::displayCurrentProfile()
const Core::Id kitId = Core::Id::fromSetting(m_ui.kitsComboBox->currentData());
const ProjectExplorer::Kit * const kit = ProjectExplorer::KitManager::kit(kitId);
QTC_ASSERT(kit, return);
const QString profileName = QbsManager::instance()->profileForKit(kit);
const QString profileName = QbsManager::profileForKit(kit);
m_ui.profileValueLabel->setText(profileName);
for (int i = 0; i < m_model.rowCount(); ++i) {
const QModelIndex profilesIndex = m_model.index(i, 0);

View File

@@ -687,7 +687,7 @@ void QbsProject::parse(const QVariantMap &config, const Environment &env, const
registerQbsProjectParser(new QbsProjectParser(this, m_qbsUpdateFutureInterface));
QbsManager::instance()->updateProfileIfNecessary(activeTarget()->kit());
QbsManager::updateProfileIfNecessary(activeTarget()->kit());
m_qbsProjectParser->parse(config, env, dir, configName);
emitParsingStarted();
}

View File

@@ -69,9 +69,9 @@ PropertyProvider::~PropertyProvider()
namespace Internal {
qbs::Settings *QbsManager::m_settings = nullptr;
Internal::QbsLogSink *QbsManager::m_logSink = nullptr;
QbsManager *QbsManager::m_instance = nullptr;
static qbs::Settings *m_settings = nullptr;
static Internal::QbsLogSink *m_logSink = nullptr;
static QbsManager *m_instance = nullptr;
QbsManager::QbsManager() : m_defaultPropertyProvider(new DefaultPropertyProvider)
{
@@ -130,8 +130,8 @@ void QbsManager::updateProfileIfNecessary(const ProjectExplorer::Kit *kit)
{
// kit in list <=> profile update is necessary
// Note that the const_cast is safe, as we do not call any non-const methods on the object.
if (m_kitsToBeSetupForQbs.removeOne(const_cast<ProjectExplorer::Kit *>(kit)))
addProfileFromKit(kit);
if (m_instance->m_kitsToBeSetupForQbs.removeOne(const_cast<ProjectExplorer::Kit *>(kit)))
m_instance->addProfileFromKit(kit);
}
void QbsManager::updateAllProfiles()
@@ -150,6 +150,11 @@ qbs::Settings *QbsManager::settings()
return m_settings;
}
QbsLogSink *QbsManager::logSink()
{
return m_logSink;
}
void QbsManager::addProfile(const QString &name, const QVariantMap &data)
{
qbs::Profile profile(name, settings());

View File

@@ -33,10 +33,7 @@
namespace qbs { class Settings; }
namespace ProjectExplorer {
class Kit;
class Project;
} // namespace ProjectExplorer
namespace ProjectExplorer { class Kit; }
namespace QbsProjectManager {
namespace Internal {
@@ -53,15 +50,13 @@ public:
// QBS profiles management:
static QString profileForKit(const ProjectExplorer::Kit *k);
void setProfileForKit(const QString &name, const ProjectExplorer::Kit *k);
void updateProfileIfNecessary(const ProjectExplorer::Kit *kit);
static void updateProfileIfNecessary(const ProjectExplorer::Kit *kit);
static qbs::Settings *settings();
static Internal::QbsLogSink *logSink() { return m_logSink; }
static QbsManager *instance() { return m_instance; }
static Internal::QbsLogSink *logSink();
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);
@@ -70,12 +65,8 @@ private:
void handleKitUpdate(ProjectExplorer::Kit *kit);
void handleKitRemoval(ProjectExplorer::Kit *kit);
static QbsLogSink *m_logSink;
static qbs::Settings *m_settings;
DefaultPropertyProvider *m_defaultPropertyProvider;
QList<ProjectExplorer::Kit *> m_kitsToBeSetupForQbs;
static QbsManager *m_instance;
};
} // namespace Internal