forked from qt-creator/qt-creator
QtVersionManager: Introduce qtVersionNumber + various fixes
Make the internal data structure a map from id to Version, simplfing a few functions. Return sorted lists, with newer versions in front for various functions, e.g. validVersions(), versionsForTargetId.
This commit is contained in:
@@ -110,33 +110,6 @@ QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath)
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuildableHelperLibrary::checkMinimumQtVersion(const QString &qtVersionString, int majorVersion, int minorVersion, int patchVersion)
|
|
||||||
{
|
|
||||||
int major = -1;
|
|
||||||
int minor = -1;
|
|
||||||
int patch = -1;
|
|
||||||
|
|
||||||
// check format
|
|
||||||
static QRegExp qtVersionRegex(QLatin1String("^\\d+\\.\\d+\\.\\d+$"));
|
|
||||||
if (!qtVersionRegex.exactMatch(qtVersionString))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QStringList parts = qtVersionString.split(QLatin1Char('.'));
|
|
||||||
major = parts.at(0).toInt();
|
|
||||||
minor = parts.at(1).toInt();
|
|
||||||
patch = parts.at(2).toInt();
|
|
||||||
|
|
||||||
if (major == majorVersion) {
|
|
||||||
if (minor == minorVersion) {
|
|
||||||
if (patch >= patchVersion)
|
|
||||||
return true;
|
|
||||||
} else if (minor > minorVersion)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList BuildableHelperLibrary::possibleQMakeCommands()
|
QStringList BuildableHelperLibrary::possibleQMakeCommands()
|
||||||
{
|
{
|
||||||
// On windows no one has renamed qmake, right?
|
// On windows no one has renamed qmake, right?
|
||||||
|
|||||||
@@ -332,24 +332,13 @@ bool QMakeStep::isQmlDebuggingLibrarySupported(QString *reason) const
|
|||||||
if (qt4BuildConfiguration()->qtVersion()->hasQmlDebuggingLibrary())
|
if (qt4BuildConfiguration()->qtVersion()->hasQmlDebuggingLibrary())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int major, minor, patch;
|
if (!qt4BuildConfiguration()->qtVersion()->isValid()) {
|
||||||
if (!qt4BuildConfiguration()->qtVersion()->versionNumbers(&major, &minor, &patch)) {
|
|
||||||
if (reason)
|
if (reason)
|
||||||
*reason = tr("Invalid Qt version.");
|
*reason = tr("Invalid Qt version.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only support 4.7.1 onwards
|
if (qt4BuildConfiguration()->qtVersion()->qtVersion() < QtVersionNumber(4, 7 ,0)) {
|
||||||
bool compatibleQt = false;
|
|
||||||
if (major == 4) {
|
|
||||||
if (minor == 7) {
|
|
||||||
if (patch >= 1)
|
|
||||||
compatibleQt = true;
|
|
||||||
} else if (minor > 7)
|
|
||||||
compatibleQt = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!compatibleQt) {
|
|
||||||
if (reason)
|
if (reason)
|
||||||
*reason = tr("Requires Qt 4.7.1 or newer.");
|
*reason = tr("Requires Qt 4.7.1 or newer.");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ QString QmlDebuggingLibrary::libraryByInstallData(const QString &qtInstallData,
|
|||||||
|
|
||||||
bool QmlDebuggingLibrary::canBuild(const QtVersion *qtVersion)
|
bool QmlDebuggingLibrary::canBuild(const QtVersion *qtVersion)
|
||||||
{
|
{
|
||||||
return checkMinimumQtVersion(qtVersion->qtVersionString(), 4, 7, 1);
|
return qtVersion->qtVersion() >= QtVersionNumber(4, 7, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlDebuggingLibrary::build(const QString &directory, const QString &makeCommand,
|
bool QmlDebuggingLibrary::build(const QString &directory, const QString &makeCommand,
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ bool QmlDumpTool::canBuild(const QtVersion *qtVersion)
|
|||||||
const QString header = installHeaders + QLatin1String("/QtDeclarative/private/qdeclarativemetatype_p.h");
|
const QString header = installHeaders + QLatin1String("/QtDeclarative/private/qdeclarativemetatype_p.h");
|
||||||
return (qtVersion->supportsTargetId(Constants::DESKTOP_TARGET_ID)
|
return (qtVersion->supportsTargetId(Constants::DESKTOP_TARGET_ID)
|
||||||
|| (qtVersion->supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID)
|
|| (qtVersion->supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID)
|
||||||
&& checkMinimumQtVersion(qtVersion->qtVersionString(), 4, 7, 1)))
|
&& (qtVersion->qtVersion() > QtVersionNumber(4, 7, 1))))
|
||||||
&& QFile::exists(header);
|
&& QFile::exists(header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ bool QmlObserverTool::canBuild(const QtVersion *qtVersion)
|
|||||||
{
|
{
|
||||||
return (qtVersion->supportsTargetId(Constants::DESKTOP_TARGET_ID)
|
return (qtVersion->supportsTargetId(Constants::DESKTOP_TARGET_ID)
|
||||||
|| qtVersion->supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID))
|
|| qtVersion->supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID))
|
||||||
&& checkMinimumQtVersion(qtVersion->qtVersionString(), 4, 7, 1);
|
&& (qtVersion->qtVersion() > QtVersionNumber(4, 7, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlObserverTool::toolForProject(ProjectExplorer::Project *project)
|
QString QmlObserverTool::toolForProject(ProjectExplorer::Project *project)
|
||||||
|
|||||||
@@ -104,10 +104,16 @@ static T *createToolChain(const QString &id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// prefer newer qts otherwise compare on id
|
||||||
|
bool qtVersionNumberCompare(QtVersion *a, QtVersion *b)
|
||||||
|
{
|
||||||
|
return a->qtVersion() > b->qtVersion() || (a->qtVersion() == b->qtVersion() && a->uniqueId() < b->uniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// QtVersionManager
|
// QtVersionManager
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
QtVersionManager *QtVersionManager::m_self = 0;
|
QtVersionManager *QtVersionManager::m_self = 0;
|
||||||
|
|
||||||
QtVersionManager::QtVersionManager()
|
QtVersionManager::QtVersionManager()
|
||||||
@@ -193,10 +199,9 @@ QtVersionManager::QtVersionManager()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_versions.append(version);
|
m_versions.insert(version->uniqueId(), version);
|
||||||
}
|
}
|
||||||
s->endArray();
|
s->endArray();
|
||||||
updateUniqueIdToIndexMap();
|
|
||||||
|
|
||||||
++m_idcount;
|
++m_idcount;
|
||||||
addNewVersionsFromInstaller();
|
addNewVersionsFromInstaller();
|
||||||
@@ -226,12 +231,12 @@ QtVersionManager *QtVersionManager::instance()
|
|||||||
void QtVersionManager::addVersion(QtVersion *version)
|
void QtVersionManager::addVersion(QtVersion *version)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(version != 0, return);
|
QTC_ASSERT(version != 0, return);
|
||||||
if (m_versions.contains(version))
|
if (m_versions.contains(version->uniqueId()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_versions.append(version);
|
|
||||||
int uniqueId = version->uniqueId();
|
int uniqueId = version->uniqueId();
|
||||||
m_uniqueIdToIndex.insert(uniqueId, m_versions.count() - 1);
|
m_versions.insert(uniqueId, version);
|
||||||
|
|
||||||
emit qtVersionsChanged(QList<int>() << uniqueId);
|
emit qtVersionsChanged(QList<int>() << uniqueId);
|
||||||
writeVersionsIntoSettings();
|
writeVersionsIntoSettings();
|
||||||
}
|
}
|
||||||
@@ -239,10 +244,8 @@ void QtVersionManager::addVersion(QtVersion *version)
|
|||||||
void QtVersionManager::removeVersion(QtVersion *version)
|
void QtVersionManager::removeVersion(QtVersion *version)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(version != 0, return);
|
QTC_ASSERT(version != 0, return);
|
||||||
m_versions.removeAll(version);
|
m_versions.remove(version->uniqueId());
|
||||||
int uniqueId = version->uniqueId();
|
emit qtVersionsChanged(QList<int>() << version->uniqueId());
|
||||||
m_uniqueIdToIndex.remove(uniqueId);
|
|
||||||
emit qtVersionsChanged(QList<int>() << uniqueId);
|
|
||||||
writeVersionsIntoSettings();
|
writeVersionsIntoSettings();
|
||||||
delete version;
|
delete version;
|
||||||
}
|
}
|
||||||
@@ -256,13 +259,14 @@ bool QtVersionManager::supportsTargetId(const QString &id) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QtVersion *> QtVersionManager::versionsForTargetId(const QString &id) const
|
QList<QtVersion *> QtVersionManager::versionsForTargetId(const QString &id, const QtVersionNumber &minimumQtVersion) const
|
||||||
{
|
{
|
||||||
QList<QtVersion *> targetVersions;
|
QList<QtVersion *> targetVersions;
|
||||||
foreach (QtVersion *version, m_versions) {
|
foreach (QtVersion *version, m_versions) {
|
||||||
if (version->supportsTargetId(id))
|
if (version->supportsTargetId(id) && version->qtVersion() >= minimumQtVersion)
|
||||||
targetVersions.append(version);
|
targetVersions.append(version);
|
||||||
}
|
}
|
||||||
|
qSort(targetVersions.begin(), targetVersions.end(), &qtVersionNumberCompare);
|
||||||
return targetVersions;
|
return targetVersions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,19 +345,13 @@ int QtVersionManager::getUniqueId()
|
|||||||
return m_idcount++;
|
return m_idcount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtVersionManager::updateUniqueIdToIndexMap()
|
|
||||||
{
|
|
||||||
m_uniqueIdToIndex.clear();
|
|
||||||
for (int i = 0; i < m_versions.size(); ++i)
|
|
||||||
m_uniqueIdToIndex.insert(m_versions.at(i)->uniqueId(), i);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtVersionManager::writeVersionsIntoSettings()
|
void QtVersionManager::writeVersionsIntoSettings()
|
||||||
{
|
{
|
||||||
QSettings *s = Core::ICore::instance()->settings();
|
QSettings *s = Core::ICore::instance()->settings();
|
||||||
s->beginWriteArray(QtVersionsSectionName);
|
s->beginWriteArray(QtVersionsSectionName);
|
||||||
|
QMap<int, QtVersion *>::const_iterator it = m_versions.constBegin();
|
||||||
for (int i = 0; i < m_versions.size(); ++i) {
|
for (int i = 0; i < m_versions.size(); ++i) {
|
||||||
const QtVersion *version = m_versions.at(i);
|
const QtVersion *version = it.value();
|
||||||
s->setArrayIndex(i);
|
s->setArrayIndex(i);
|
||||||
s->setValue("Name", version->displayName());
|
s->setValue("Name", version->displayName());
|
||||||
// for downwards compat
|
// for downwards compat
|
||||||
@@ -365,13 +363,18 @@ void QtVersionManager::writeVersionsIntoSettings()
|
|||||||
s->setValue("autodetectionSource", version->autodetectionSource());
|
s->setValue("autodetectionSource", version->autodetectionSource());
|
||||||
s->setValue("S60SDKDirectory", version->s60SDKDirectory());
|
s->setValue("S60SDKDirectory", version->s60SDKDirectory());
|
||||||
s->setValue(QLatin1String("SBSv2Directory"), version->sbsV2Directory());
|
s->setValue(QLatin1String("SBSv2Directory"), version->sbsV2Directory());
|
||||||
|
++it;
|
||||||
}
|
}
|
||||||
s->endArray();
|
s->endArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QtVersion *> QtVersionManager::versions() const
|
QList<QtVersion *> QtVersionManager::versions() const
|
||||||
{
|
{
|
||||||
return m_versions;
|
QList<QtVersion *> versions;
|
||||||
|
foreach (QtVersion *version, m_versions)
|
||||||
|
versions << version;
|
||||||
|
qSort(versions.begin(), versions.end(), &qtVersionNumberCompare);
|
||||||
|
return versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QtVersion *> QtVersionManager::validVersions() const
|
QList<QtVersion *> QtVersionManager::validVersions() const
|
||||||
@@ -381,22 +384,21 @@ QList<QtVersion *> QtVersionManager::validVersions() const
|
|||||||
if (v->isValid())
|
if (v->isValid())
|
||||||
results.append(v);
|
results.append(v);
|
||||||
}
|
}
|
||||||
|
qSort(results.begin(), results.end(), &qtVersionNumberCompare);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QtVersionManager::isValidId(int id) const
|
bool QtVersionManager::isValidId(int id) const
|
||||||
{
|
{
|
||||||
int pos = m_uniqueIdToIndex.value(id, -1);
|
return m_versions.contains(id);
|
||||||
return (pos != -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtVersion *QtVersionManager::version(int id) const
|
QtVersion *QtVersionManager::version(int id) const
|
||||||
{
|
{
|
||||||
int pos = m_uniqueIdToIndex.value(id, -1);
|
QMap<int, QtVersion *>::const_iterator it = m_versions.find(id);
|
||||||
if (pos != -1)
|
if (it == m_versions.constEnd())
|
||||||
return m_versions.at(pos);
|
|
||||||
|
|
||||||
return m_emptyVersion;
|
return m_emptyVersion;
|
||||||
|
return it.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Rework this!
|
// FIXME: Rework this!
|
||||||
@@ -449,7 +451,7 @@ void QtVersionManager::addNewVersionsFromInstaller()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!versionWasAlreadyInList) {
|
if (!versionWasAlreadyInList) {
|
||||||
m_versions.append(version);
|
m_versions.insert(version->uniqueId(), version);
|
||||||
} else {
|
} else {
|
||||||
// clean up
|
// clean up
|
||||||
delete version;
|
delete version;
|
||||||
@@ -457,7 +459,6 @@ void QtVersionManager::addNewVersionsFromInstaller()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateUniqueIdToIndexMap();
|
|
||||||
settings->setValue(QLatin1String("General/LastQtVersionUpdate"), QDateTime::currentDateTime());
|
settings->setValue(QLatin1String("General/LastQtVersionUpdate"), QDateTime::currentDateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,8 +484,7 @@ void QtVersionManager::updateSystemVersion()
|
|||||||
getUniqueId(),
|
getUniqueId(),
|
||||||
true,
|
true,
|
||||||
PATH_AUTODETECTION_SOURCE);
|
PATH_AUTODETECTION_SOURCE);
|
||||||
m_versions.prepend(version);
|
m_versions.insert(version->uniqueId(), version);
|
||||||
updateUniqueIdToIndexMap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtVersion *QtVersionManager::emptyVersion() const
|
QtVersion *QtVersionManager::emptyVersion() const
|
||||||
@@ -519,14 +519,14 @@ void QtVersionManager::setNewQtVersions(QList<QtVersion *> newVersions)
|
|||||||
QList<QtVersion *> sortedNewVersions = newVersions;
|
QList<QtVersion *> sortedNewVersions = newVersions;
|
||||||
SortByUniqueId sortByUniqueId;
|
SortByUniqueId sortByUniqueId;
|
||||||
qSort(sortedNewVersions.begin(), sortedNewVersions.end(), sortByUniqueId);
|
qSort(sortedNewVersions.begin(), sortedNewVersions.end(), sortByUniqueId);
|
||||||
qSort(m_versions.begin(), m_versions.end(), sortByUniqueId);
|
|
||||||
|
|
||||||
QList<int> changedVersions;
|
QList<int> changedVersions;
|
||||||
// So we trying to find the minimal set of changed versions,
|
// So we trying to find the minimal set of changed versions,
|
||||||
// iterate over both sorted list
|
// iterate over both sorted list
|
||||||
|
|
||||||
// newVersions and oldVersions iterator
|
// newVersions and oldVersions iterator
|
||||||
QList<QtVersion *>::const_iterator nit, nend, oit, oend;
|
QList<QtVersion *>::const_iterator nit, nend;
|
||||||
|
QMap<int, QtVersion *>::const_iterator oit, oend;
|
||||||
nit = sortedNewVersions.constBegin();
|
nit = sortedNewVersions.constBegin();
|
||||||
nend = sortedNewVersions.constEnd();
|
nend = sortedNewVersions.constEnd();
|
||||||
oit = m_versions.constBegin();
|
oit = m_versions.constBegin();
|
||||||
@@ -561,11 +561,11 @@ void QtVersionManager::setNewQtVersions(QList<QtVersion *> newVersions)
|
|||||||
|
|
||||||
qDeleteAll(m_versions);
|
qDeleteAll(m_versions);
|
||||||
m_versions.clear();
|
m_versions.clear();
|
||||||
m_versions = newVersions;
|
foreach (QtVersion *v, sortedNewVersions)
|
||||||
|
m_versions.insert(v->uniqueId(), v);
|
||||||
|
|
||||||
if (!changedVersions.isEmpty())
|
if (!changedVersions.isEmpty())
|
||||||
updateDocumentation();
|
updateDocumentation();
|
||||||
updateUniqueIdToIndexMap();
|
|
||||||
|
|
||||||
updateExamples();
|
updateExamples();
|
||||||
writeVersionsIntoSettings();
|
writeVersionsIntoSettings();
|
||||||
@@ -837,26 +837,10 @@ QString QtVersion::qtVersionString() const
|
|||||||
return m_qtVersionString;
|
return m_qtVersionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QtVersion::versionNumbers(int *majorNumber, int *minorNumber, int *patchNumber) const
|
QtVersionNumber QtVersion::qtVersion() const
|
||||||
{
|
{
|
||||||
const QString versionString = qtVersionString();
|
//todo cache this;
|
||||||
if (versionString.isEmpty())
|
return QtVersionNumber(qtVersionString());
|
||||||
return false;
|
|
||||||
|
|
||||||
// check format
|
|
||||||
static QRegExp qtVersionRegex(QLatin1String("^\\d+\\.\\d+\\.\\d+$"));
|
|
||||||
if (!qtVersionRegex.exactMatch(versionString))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QStringList parts = versionString.split(QLatin1Char('.'));
|
|
||||||
if (majorNumber)
|
|
||||||
*majorNumber = parts.at(0).toInt();
|
|
||||||
if (minorNumber)
|
|
||||||
*minorNumber = parts.at(1).toInt();
|
|
||||||
if (patchNumber)
|
|
||||||
*patchNumber = parts.at(2).toInt();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<QString,QString> QtVersion::versionInfo() const
|
QHash<QString,QString> QtVersion::versionInfo() const
|
||||||
@@ -1951,3 +1935,87 @@ void QtVersion::invalidateCache()
|
|||||||
{
|
{
|
||||||
m_versionInfoUpToDate = false;
|
m_versionInfoUpToDate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////
|
||||||
|
// QtVersionNumber
|
||||||
|
///////////////
|
||||||
|
|
||||||
|
|
||||||
|
QtVersionNumber::QtVersionNumber(int ma, int mi, int p)
|
||||||
|
: majorVersion(ma), minorVersion(mi), patchVersion(p)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QtVersionNumber::QtVersionNumber(const QString &versionString)
|
||||||
|
{
|
||||||
|
if (!checkVersionString(versionString))
|
||||||
|
majorVersion = minorVersion = patchVersion = -1;
|
||||||
|
|
||||||
|
QStringList parts = versionString.split(QLatin1Char('.'));
|
||||||
|
majorVersion = parts.at(0).toInt();
|
||||||
|
minorVersion = parts.at(1).toInt();
|
||||||
|
patchVersion = parts.at(2).toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
QtVersionNumber::QtVersionNumber()
|
||||||
|
{
|
||||||
|
majorVersion = minorVersion = patchVersion = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool QtVersionNumber::checkVersionString(const QString &version) const
|
||||||
|
{
|
||||||
|
int dots = 0;
|
||||||
|
QString validChars = "0123456789.";
|
||||||
|
foreach (const QChar &c, version) {
|
||||||
|
if (!validChars.contains(c))
|
||||||
|
return false;
|
||||||
|
if (c == '.')
|
||||||
|
++dots;
|
||||||
|
}
|
||||||
|
if (dots != 2)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QtVersionNumber::operator <(const QtVersionNumber &b) const
|
||||||
|
{
|
||||||
|
if (majorVersion < b.majorVersion)
|
||||||
|
return true;
|
||||||
|
if (majorVersion > b.majorVersion)
|
||||||
|
return false;
|
||||||
|
if (minorVersion < b.minorVersion)
|
||||||
|
return true;
|
||||||
|
if (minorVersion > b.minorVersion)
|
||||||
|
return false;
|
||||||
|
if (patchVersion < b.patchVersion)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QtVersionNumber::operator >(const QtVersionNumber &b) const
|
||||||
|
{
|
||||||
|
return b < *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QtVersionNumber::operator ==(const QtVersionNumber &b) const
|
||||||
|
{
|
||||||
|
return majorVersion == b.majorVersion
|
||||||
|
&& minorVersion == b.minorVersion
|
||||||
|
&& patchVersion == b.patchVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QtVersionNumber::operator !=(const QtVersionNumber &b) const
|
||||||
|
{
|
||||||
|
return !(*this == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QtVersionNumber::operator <=(const QtVersionNumber &b) const
|
||||||
|
{
|
||||||
|
return !(*this > b);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QtVersionNumber::operator >=(const QtVersionNumber &b) const
|
||||||
|
{
|
||||||
|
return b <= *this;
|
||||||
|
}
|
||||||
|
|||||||
@@ -58,6 +58,27 @@ class QtOptionsPageWidget;
|
|||||||
class QtOptionsPage;
|
class QtOptionsPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class QT4PROJECTMANAGER_EXPORT QtVersionNumber
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QtVersionNumber(int ma, int mi, int p);
|
||||||
|
QtVersionNumber(const QString &versionString);
|
||||||
|
QtVersionNumber();
|
||||||
|
|
||||||
|
int majorVersion;
|
||||||
|
int minorVersion;
|
||||||
|
int patchVersion;
|
||||||
|
bool operator <(const QtVersionNumber &b) const;
|
||||||
|
bool operator <=(const QtVersionNumber &b) const;
|
||||||
|
bool operator >(const QtVersionNumber &b) const;
|
||||||
|
bool operator >=(const QtVersionNumber &b) const;
|
||||||
|
bool operator !=(const QtVersionNumber &b) const;
|
||||||
|
bool operator ==(const QtVersionNumber &b) const;
|
||||||
|
private:
|
||||||
|
bool checkVersionString(const QString &version) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class QT4PROJECTMANAGER_EXPORT QtVersion
|
class QT4PROJECTMANAGER_EXPORT QtVersion
|
||||||
{
|
{
|
||||||
friend class QtVersionManager;
|
friend class QtVersionManager;
|
||||||
@@ -106,8 +127,7 @@ public:
|
|||||||
void setQMakeCommand(const QString &path);
|
void setQMakeCommand(const QString &path);
|
||||||
|
|
||||||
QString qtVersionString() const;
|
QString qtVersionString() const;
|
||||||
bool versionNumbers(int *majorNumber, int *minorNumber, int *patchNumber) const;
|
QtVersionNumber qtVersion() const;
|
||||||
|
|
||||||
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
|
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
|
||||||
QHash<QString,QString> versionInfo() const;
|
QHash<QString,QString> versionInfo() const;
|
||||||
|
|
||||||
@@ -260,7 +280,8 @@ public:
|
|||||||
bool supportsTargetId(const QString &id) const;
|
bool supportsTargetId(const QString &id) const;
|
||||||
// This returns a list of versions that support the target with the given id.
|
// This returns a list of versions that support the target with the given id.
|
||||||
// @return A list of QtVersions that supports a target. This list may be empty!
|
// @return A list of QtVersions that supports a target. This list may be empty!
|
||||||
QList<QtVersion *> versionsForTargetId(const QString &id) const;
|
|
||||||
|
QList<QtVersion *> versionsForTargetId(const QString &id, const QtVersionNumber &minimumQtVersion = QtVersionNumber()) const;
|
||||||
QSet<QString> supportedTargetIds() const;
|
QSet<QString> supportedTargetIds() const;
|
||||||
|
|
||||||
// Static Methods
|
// Static Methods
|
||||||
@@ -299,8 +320,7 @@ private:
|
|||||||
void updateUniqueIdToIndexMap();
|
void updateUniqueIdToIndexMap();
|
||||||
|
|
||||||
QtVersion *m_emptyVersion;
|
QtVersion *m_emptyVersion;
|
||||||
QList<QtVersion *> m_versions;
|
QMap<int, QtVersion *> m_versions;
|
||||||
QMap<int, int> m_uniqueIdToIndex;
|
|
||||||
int m_idcount;
|
int m_idcount;
|
||||||
// managed by QtProjectManagerPlugin
|
// managed by QtProjectManagerPlugin
|
||||||
static QtVersionManager *m_self;
|
static QtVersionManager *m_self;
|
||||||
|
|||||||
Reference in New Issue
Block a user