forked from qt-creator/qt-creator
QbsProjectManager: Make QbsManager instance available as a Singleton.
We now use it in contexts that do not have access to a Project. Change-Id: I96ebad60f5fc354b004092748033d83c766a305d Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -178,7 +178,7 @@ void QbsProfilesSettingsWidget::displayCurrentProfile()
|
|||||||
const Core::Id kitId = Core::Id::fromSetting(m_ui.kitsComboBox->currentData());
|
const Core::Id kitId = Core::Id::fromSetting(m_ui.kitsComboBox->currentData());
|
||||||
const ProjectExplorer::Kit * const kit = ProjectExplorer::KitManager::find(kitId);
|
const ProjectExplorer::Kit * const kit = ProjectExplorer::KitManager::find(kitId);
|
||||||
QTC_ASSERT(kit, return);
|
QTC_ASSERT(kit, return);
|
||||||
const QString profileName = QString::fromLatin1("qtc_") + kit->fileSystemFriendlyName();
|
const QString profileName = QbsManager::instance()->profileForKit(kit);
|
||||||
m_ui.profileValueLabel->setText(profileName);
|
m_ui.profileValueLabel->setText(profileName);
|
||||||
for (int i = 0; i < m_model.rowCount(); ++i) {
|
for (int i = 0; i < m_model.rowCount(); ++i) {
|
||||||
const QModelIndex profilesIndex = m_model.index(i, 0);
|
const QModelIndex profilesIndex = m_model.index(i, 0);
|
||||||
@@ -227,7 +227,7 @@ void QbsProfilesSettingsWidget::mergeCustomPropertiesIntoModel()
|
|||||||
const ProjectExplorer::Kit * const kit = ProjectExplorer::KitManager::find(kitId);
|
const ProjectExplorer::Kit * const kit = ProjectExplorer::KitManager::find(kitId);
|
||||||
QTC_ASSERT(kit, continue);
|
QTC_ASSERT(kit, continue);
|
||||||
const QString keyPrefix = QLatin1String("profiles.")
|
const QString keyPrefix = QLatin1String("profiles.")
|
||||||
+ QString::fromLatin1("qtc_") + kit->fileSystemFriendlyName() + QLatin1Char('.');
|
+ QbsManager::instance()->profileForKit(kit) + QLatin1Char('.');
|
||||||
for (QVariantMap::ConstIterator it2 = it.value().constBegin(); it2 != it.value().constEnd();
|
for (QVariantMap::ConstIterator it2 = it.value().constBegin(); it2 != it.value().constEnd();
|
||||||
++it2) {
|
++it2) {
|
||||||
customProperties.insert(keyPrefix + it2.key(), it2.value());
|
customProperties.insert(keyPrefix + it2.key(), it2.value());
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
#include <coreplugin/mimedatabase.h>
|
||||||
#include <cpptools/cppmodelmanager.h>
|
#include <cpptools/cppmodelmanager.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <projectexplorer/buildenvironmentwidget.h>
|
#include <projectexplorer/buildenvironmentwidget.h>
|
||||||
#include <projectexplorer/buildmanager.h>
|
#include <projectexplorer/buildmanager.h>
|
||||||
#include <projectexplorer/buildtargetinfo.h>
|
#include <projectexplorer/buildtargetinfo.h>
|
||||||
@@ -631,9 +630,7 @@ void QbsProject::parse(const QVariantMap &config, const Environment &env, const
|
|||||||
|
|
||||||
registerQbsProjectParser(new QbsProjectParser(this, m_qbsUpdateFutureInterface));
|
registerQbsProjectParser(new QbsProjectParser(this, m_qbsUpdateFutureInterface));
|
||||||
|
|
||||||
QbsManager * const qbsManager = ExtensionSystem::PluginManager::getObject<QbsManager>();
|
QbsManager::instance()->updateProfileIfNecessary(activeTarget()->kit());
|
||||||
QTC_ASSERT(qbsManager, return);
|
|
||||||
qbsManager->updateProfileIfNecessary(activeTarget()->kit());
|
|
||||||
m_qbsProjectParser->parse(config, env, dir);
|
m_qbsProjectParser->parse(config, env, dir);
|
||||||
emit projectParsingStarted();
|
emit projectParsingStarted();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,11 +60,13 @@ namespace QbsProjectManager {
|
|||||||
|
|
||||||
qbs::Settings *QbsManager::m_settings = 0;
|
qbs::Settings *QbsManager::m_settings = 0;
|
||||||
Internal::QbsLogSink *QbsManager::m_logSink = 0;
|
Internal::QbsLogSink *QbsManager::m_logSink = 0;
|
||||||
|
QbsManager *QbsManager::m_instance = 0;
|
||||||
|
|
||||||
QbsManager::QbsManager() :
|
QbsManager::QbsManager() :
|
||||||
m_defaultPropertyProvider(new DefaultPropertyProvider)
|
m_defaultPropertyProvider(new DefaultPropertyProvider)
|
||||||
{
|
{
|
||||||
m_settings = new qbs::Settings(Core::ICore::userResourcePath());
|
m_settings = new qbs::Settings(Core::ICore::userResourcePath());
|
||||||
|
m_instance = this;
|
||||||
|
|
||||||
setObjectName(QLatin1String("QbsProjectManager"));
|
setObjectName(QLatin1String("QbsProjectManager"));
|
||||||
connect(ProjectExplorer::KitManager::instance(), &ProjectExplorer::KitManager::kitsLoaded, this,
|
connect(ProjectExplorer::KitManager::instance(), &ProjectExplorer::KitManager::kitsLoaded, this,
|
||||||
@@ -97,6 +99,7 @@ QbsManager::~QbsManager()
|
|||||||
{
|
{
|
||||||
delete m_defaultPropertyProvider;
|
delete m_defaultPropertyProvider;
|
||||||
delete m_settings;
|
delete m_settings;
|
||||||
|
m_instance = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QbsManager::mimeType() const
|
QString QbsManager::mimeType() const
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public:
|
|||||||
|
|
||||||
static qbs::Settings *settings() { return m_settings; }
|
static qbs::Settings *settings() { return m_settings; }
|
||||||
static Internal::QbsLogSink *logSink() { return m_logSink; }
|
static Internal::QbsLogSink *logSink() { return m_logSink; }
|
||||||
|
static QbsManager *instance() { return m_instance; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addProfile(const QString &name, const QVariantMap &data);
|
void addProfile(const QString &name, const QVariantMap &data);
|
||||||
@@ -93,6 +94,7 @@ private:
|
|||||||
|
|
||||||
DefaultPropertyProvider *m_defaultPropertyProvider;
|
DefaultPropertyProvider *m_defaultPropertyProvider;
|
||||||
QList<ProjectExplorer::Kit *> m_kitsToBeSetupForQbs;
|
QList<ProjectExplorer::Kit *> m_kitsToBeSetupForQbs;
|
||||||
|
static QbsManager *m_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QbsProjectManager
|
} // namespace QbsProjectManager
|
||||||
|
|||||||
Reference in New Issue
Block a user