Commit 5063ac31 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

KitManager: Load settings in extensionsInitialized()



Add isLoaded() method to make assert that we have our data loaded.

Change-Id: I50a1847464ec3641a288226c69df93e0d789affd
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 872da99b
......@@ -39,7 +39,6 @@
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginspec.h>
#include <utils/persistentsettings.h>
#include <utils/environment.h>
......@@ -139,7 +138,6 @@ void KitManager::restoreKits()
return;
initializing = true;
QTC_CHECK(ProjectExplorerPlugin::instance()->pluginSpec()->state() == ExtensionSystem::PluginSpec::Running);
QList<Kit *> kitsToRegister;
QList<Kit *> kitsToValidate;
......@@ -221,6 +219,7 @@ void KitManager::restoreKits()
d->m_writer = new Utils::PersistentSettingsWriter(settingsFileName(), QLatin1String("QtCreatorProfiles"));
d->m_initialized = true;
emit kitsLoaded();
emit kitsChanged();
}
......@@ -264,8 +263,7 @@ bool greaterPriority(KitInformation *a, KitInformation *b)
void KitManager::registerKitInformation(KitInformation *ki)
{
QTC_CHECK(ProjectExplorerPlugin::instance()->pluginSpec()->state() <= ExtensionSystem::PluginSpec::Initialized);
QTC_CHECK(d->m_kitList.isEmpty());
QTC_CHECK(!isLoaded());
QList<KitInformation *>::iterator it
= qLowerBound(d->m_informationList.begin(), d->m_informationList.end(), ki, greaterPriority);
......@@ -344,9 +342,6 @@ KitManager::KitList KitManager::restoreKits(const Utils::FileName &fileName)
QList<Kit *> KitManager::kits(const KitMatcher *m) const
{
if (!d->m_initialized)
const_cast<KitManager *>(this)->restoreKits();
QList<Kit *> result;
foreach (Kit *k, d->m_kitList) {
if (!m || m->matches(k))
......@@ -375,8 +370,6 @@ Kit *KitManager::find(const KitMatcher *m) const
Kit *KitManager::defaultKit() const
{
if (!d->m_initialized)
const_cast<KitManager *>(this)->restoreKits();
return d->m_defaultKit;
}
......@@ -402,6 +395,11 @@ void KitManager::deleteKit(Kit *k)
delete k;
}
bool KitManager::isLoaded() const
{
return d->m_initialized;
}
void KitManager::notifyAboutUpdate(ProjectExplorer::Kit *k)
{
if (!k)
......@@ -414,6 +412,7 @@ void KitManager::notifyAboutUpdate(ProjectExplorer::Kit *k)
bool KitManager::registerKit(ProjectExplorer::Kit *k)
{
QTC_ASSERT(isLoaded(), return false);
if (!k)
return true;
foreach (Kit *current, kits()) {
......
......@@ -123,6 +123,8 @@ public:
static void deleteKit(Kit *k);
bool isLoaded() const;
public slots:
bool registerKit(ProjectExplorer::Kit *k);
void deregisterKit(ProjectExplorer::Kit *k);
......@@ -145,6 +147,8 @@ signals:
// Something changed.
void kitsChanged();
void kitsLoaded();
private slots:
void validateKits();
......
......@@ -1129,6 +1129,7 @@ void ProjectExplorerPlugin::extensionsInitialized()
DeviceManager::instance()->addDevice(IDevice::Ptr(new DesktopDevice));
dm->load();
d->m_toolChainManager->restoreToolChains();
d->m_kitManager->restoreKits();
}
void ProjectExplorerPlugin::loadCustomWizards()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment