Commit 915c9985 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

QtKitInformation: Make use of QtVersionManager::isLoaded()



Warn when accessing QtVersionManager before settings are restored and
make sure this is not done. Fix reseting Qt versions in kits when
they get removed.

Change-Id: Ida818a9b42884f1e447cf0ed4ac3a6741d9d824b
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 519a3659
......@@ -35,6 +35,7 @@
#include "qtparser.h"
#include <utils/environment.h>
#include <utils/qtcassert.h>
namespace QtSupport {
namespace Internal {
......@@ -44,10 +45,8 @@ const char QT_INFORMATION[] = "QtSupport.QtInformation";
QtKitInformation::QtKitInformation()
{
setObjectName(QLatin1String("QtKitInformation"));
connect(QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
this, SIGNAL(validationNeeded()));
connect(QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
this, SLOT(qtVersionsChanged(QList<int>,QList<int>,QList<int>)));
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()),
this, SLOT(kitsWereLoaded()));
}
Core::Id QtKitInformation::dataId() const
......@@ -89,14 +88,17 @@ QVariant QtKitInformation::defaultValue(ProjectExplorer::Kit *k) const
QList<ProjectExplorer::Task> QtKitInformation::validate(const ProjectExplorer::Kit *k) const
{
QList<ProjectExplorer::Task> result;
QTC_ASSERT(QtVersionManager::instance()->isLoaded(), return result);
BaseQtVersion *version = qtVersion(k);
if (!version)
return QList<ProjectExplorer::Task>();
return result;
return version->validateKit(k);
}
void QtKitInformation::fix(ProjectExplorer::Kit *k)
{
QTC_ASSERT(QtVersionManager::instance()->isLoaded(), return);
BaseQtVersion *version = qtVersion(k);
if (!version)
setQtVersionId(k, -1);
......@@ -187,6 +189,15 @@ void QtKitInformation::qtVersionsChanged(const QList<int> &addedIds,
notifyAboutUpdate(k);
}
void QtKitInformation::kitsWereLoaded()
{
foreach (ProjectExplorer::Kit *k, ProjectExplorer::KitManager::instance()->kits())
fix(k);
connect(QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
this, SLOT(qtVersionsChanged(QList<int>,QList<int>,QList<int>)));
}
QtPlatformKitMatcher::QtPlatformKitMatcher(const QString &platform) :
m_platform(platform)
{ }
......
......@@ -72,6 +72,7 @@ private slots:
void qtVersionsChanged(const QList<int> &addedIds,
const QList<int> &removedIds,
const QList<int> &changedIds);
void kitsWereLoaded();
};
class QTSUPPORT_EXPORT QtPlatformKitMatcher : public ProjectExplorer::KitMatcher
......
......@@ -83,6 +83,8 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes
addAutoReleasedObject(new CustomExecutableRunConfigurationFactory);
ProjectExplorer::KitManager::instance()->registerKitInformation(new QtKitInformation);
return true;
}
......@@ -98,7 +100,6 @@ void QtSupportPlugin::extensionsInitialized()
this, SLOT(updateVariable(QByteArray)));
QtVersionManager::instance()->extensionsInitialized();
ProjectExplorer::KitManager::instance()->registerKitInformation(new QtKitInformation);
}
bool QtSupportPlugin::delayedInitialize()
......
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