forked from qt-creator/qt-creator
QtSupport: Introduce a type alias for QList<BaseQtVersion *>
Change-Id: I96b0eccc04da2f4a1a4e5ea9bdceb91b3fa3d724 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -1003,7 +1003,7 @@ QVersionNumber AndroidConfig::ndkVersion(const FilePath &ndkPath) const
|
||||
|
||||
QStringList AndroidConfig::allEssentials() const
|
||||
{
|
||||
QList<QtVersion *> installedVersions = QtVersionManager::versions(
|
||||
QtVersions installedVersions = QtVersionManager::versions(
|
||||
[](const QtVersion *v) {
|
||||
return v->targetDeviceTypes().contains(Android::Constants::ANDROID_DEVICE_TYPE);
|
||||
});
|
||||
|
||||
@@ -267,7 +267,7 @@ public:
|
||||
void setSearchPaths(const FilePaths &searchPaths) { m_searchPaths = searchPaths; }
|
||||
|
||||
private:
|
||||
QList<QtVersion *> autoDetectQtVersions() const;
|
||||
QtVersions autoDetectQtVersions() const;
|
||||
QList<ToolChain *> autoDetectToolChains();
|
||||
void autoDetectCMake();
|
||||
void autoDetectDebugger();
|
||||
@@ -704,9 +704,9 @@ void KitDetectorPrivate::listAutoDetected() const
|
||||
emit q->logOutput('\n' + tr("Listing of previously auto-detected kit items finished.") + "\n\n");
|
||||
}
|
||||
|
||||
QList<QtVersion *> KitDetectorPrivate::autoDetectQtVersions() const
|
||||
QtVersions KitDetectorPrivate::autoDetectQtVersions() const
|
||||
{
|
||||
QList<QtVersion *> qtVersions;
|
||||
QtVersions qtVersions;
|
||||
|
||||
QString error;
|
||||
const QStringList candidates = {"qmake-qt6", "qmake-qt5", "qmake"};
|
||||
@@ -794,7 +794,7 @@ void KitDetectorPrivate::autoDetect()
|
||||
emit q->logOutput(tr("Starting auto-detection. This will take a while..."));
|
||||
|
||||
QList<ToolChain *> toolChains = autoDetectToolChains();
|
||||
QList<QtVersion *> qtVersions = autoDetectQtVersions();
|
||||
QtVersions qtVersions = autoDetectQtVersions();
|
||||
|
||||
autoDetectCMake();
|
||||
autoDetectDebugger();
|
||||
|
||||
@@ -750,7 +750,7 @@ Tasks QmakeProject::projectIssues(const Kit *k) const
|
||||
// example shipped via the installer.
|
||||
// Report a problem if and only if the project is considered to be part of *only* a Qt
|
||||
// that is not the one from the current kit.
|
||||
const QList<QtVersion *> qtsContainingThisProject
|
||||
const QtVersions qtsContainingThisProject
|
||||
= QtVersionManager::versions([filePath = projectFilePath()](const QtVersion *qt) {
|
||||
return qt->isValid() && qt->isQtSubProject(filePath);
|
||||
});
|
||||
|
||||
@@ -270,6 +270,8 @@ private:
|
||||
Internal::QtVersionPrivate *d = nullptr;
|
||||
};
|
||||
|
||||
using QtVersions = QList<QtVersion *>;
|
||||
|
||||
} // QtSupport
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QtSupport::QtVersion::QmakeBuildConfigs)
|
||||
|
||||
@@ -119,7 +119,7 @@ ExampleSetModel::ExampleSetModel()
|
||||
&ExampleSetModel::helpManagerInitialized);
|
||||
}
|
||||
|
||||
void ExampleSetModel::recreateModel(const QList<QtVersion *> &qtVersions)
|
||||
void ExampleSetModel::recreateModel(const QtVersions &qtVersions)
|
||||
{
|
||||
beginResetModel();
|
||||
clear();
|
||||
@@ -525,7 +525,7 @@ QPixmap ExamplesListModel::fetchPixmapAndUpdatePixmapCache(const QString &url) c
|
||||
|
||||
void ExampleSetModel::updateQtVersionList()
|
||||
{
|
||||
QList<QtVersion *> versions = QtVersionManager::sortVersions(QtVersionManager::versions(
|
||||
QtVersions versions = QtVersionManager::sortVersions(QtVersionManager::versions(
|
||||
[](const QtVersion *v) { return v->hasExamples() || v->hasDemos(); }));
|
||||
|
||||
// prioritize default qt version
|
||||
@@ -559,7 +559,7 @@ void ExampleSetModel::updateQtVersionList()
|
||||
emit selectedExampleSetChanged(currentIndex);
|
||||
}
|
||||
|
||||
QtVersion *ExampleSetModel::findHighestQtVersion(const QList<QtVersion *> &versions) const
|
||||
QtVersion *ExampleSetModel::findHighestQtVersion(const QtVersions &versions) const
|
||||
{
|
||||
QtVersion *newVersion = nullptr;
|
||||
for (QtVersion *version : versions) {
|
||||
|
||||
@@ -80,10 +80,10 @@ private:
|
||||
int getQtId(int index) const;
|
||||
int getExtraExampleSetIndex(int index) const;
|
||||
|
||||
QtVersion *findHighestQtVersion(const QList<QtVersion *> &versions) const;
|
||||
QtVersion *findHighestQtVersion(const QtVersions &versions) const;
|
||||
|
||||
int indexForQtVersion(QtVersion *qtVersion) const;
|
||||
void recreateModel(const QList<QtVersion *> &qtVersions);
|
||||
void recreateModel(const QtVersions &qtVersions);
|
||||
void updateQtVersionList();
|
||||
|
||||
void qtVersionManagerLoaded();
|
||||
|
||||
@@ -166,7 +166,7 @@ void QtKitAspect::setup(Kit *k)
|
||||
const Abi tcAbi = ToolChainKitAspect::targetAbi(k);
|
||||
const Id deviceType = DeviceTypeKitAspect::deviceTypeId(k);
|
||||
|
||||
const QList<QtVersion *> matches
|
||||
const QtVersions matches
|
||||
= QtVersionManager::versions([&tcAbi, &deviceType](const QtVersion *qt) {
|
||||
return qt->targetDeviceTypes().contains(deviceType)
|
||||
&& Utils::contains(qt->qtAbis(), [&tcAbi](const Abi &qtAbi) {
|
||||
@@ -177,14 +177,13 @@ void QtKitAspect::setup(Kit *k)
|
||||
|
||||
// An MSVC 2015 toolchain is compatible with an MSVC 2017 Qt, but we prefer an
|
||||
// MSVC 2015 Qt if we find one.
|
||||
const QList<QtVersion *> exactMatches = Utils::filtered(matches,
|
||||
[&tcAbi](const QtVersion *qt) {
|
||||
const QtVersions exactMatches = Utils::filtered(matches, [&tcAbi](const QtVersion *qt) {
|
||||
return qt->qtAbis().contains(tcAbi);
|
||||
});
|
||||
const QList<QtVersion *> &candidates = !exactMatches.empty() ? exactMatches : matches;
|
||||
const QtVersions &candidates = !exactMatches.empty() ? exactMatches : matches;
|
||||
|
||||
QtVersion * const qtFromPath = QtVersionManager::version(
|
||||
equal(&QtVersion::detectionSource, QString::fromLatin1("PATH")));
|
||||
equal(&QtVersion::detectionSource, QString("PATH")));
|
||||
if (qtFromPath && candidates.contains(qtFromPath))
|
||||
k->setValue(id(), qtFromPath->uniqueId());
|
||||
else
|
||||
@@ -193,10 +192,10 @@ void QtKitAspect::setup(Kit *k)
|
||||
|
||||
Tasks QtKitAspect::validate(const Kit *k) const
|
||||
{
|
||||
QTC_ASSERT(QtVersionManager::isLoaded(), return { });
|
||||
QTC_ASSERT(QtVersionManager::isLoaded(), return {});
|
||||
QtVersion *version = qtVersion(k);
|
||||
if (!version)
|
||||
return { };
|
||||
return {};
|
||||
|
||||
return version->validateKit(k);
|
||||
}
|
||||
|
||||
@@ -883,7 +883,7 @@ void QtOptionsPageWidget::apply()
|
||||
QtVersionManager::setDocumentationSetting(
|
||||
QtVersionManager::DocumentationSetting(m_ui.documentationSetting->currentData().toInt()));
|
||||
|
||||
QList<QtVersion *> versions;
|
||||
QtVersions versions;
|
||||
m_model->forItemsAtLevel<2>([&versions](QtVersionItem *item) {
|
||||
item->setChanged(false);
|
||||
versions.append(item->version()->clone());
|
||||
|
||||
@@ -153,7 +153,7 @@ void QtVersionManager::triggerQtVersionRestore()
|
||||
FileSystemWatcher::WatchModifiedDate);
|
||||
} // exists
|
||||
|
||||
const QList<QtVersion *> vs = versions();
|
||||
const QtVersions vs = versions();
|
||||
updateDocumentation(vs, {}, vs);
|
||||
}
|
||||
|
||||
@@ -501,13 +501,13 @@ static QList<std::pair<Path, FileName>> documentationFiles(QtVersion *v)
|
||||
return files;
|
||||
}
|
||||
|
||||
static QStringList documentationFiles(const QList<QtVersion *> &vs, bool highestOnly = false)
|
||||
static QStringList documentationFiles(const QtVersions &vs, bool highestOnly = false)
|
||||
{
|
||||
// if highestOnly is true, register each file only once per major Qt version, even if
|
||||
// multiple minor or patch releases of that major version are installed
|
||||
QHash<int, QSet<QString>> includedFileNames; // major Qt version -> names
|
||||
QSet<QString> filePaths;
|
||||
const QList<QtVersion *> versions = highestOnly ? QtVersionManager::sortVersions(vs) : vs;
|
||||
const QtVersions versions = highestOnly ? QtVersionManager::sortVersions(vs) : vs;
|
||||
for (QtVersion *v : versions) {
|
||||
const int majorVersion = v->qtVersion().majorVersion;
|
||||
QSet<QString> &majorVersionFileNames = includedFileNames[majorVersion];
|
||||
@@ -521,9 +521,9 @@ static QStringList documentationFiles(const QList<QtVersion *> &vs, bool highest
|
||||
return filePaths.values();
|
||||
}
|
||||
|
||||
void QtVersionManager::updateDocumentation(const QList<QtVersion *> &added,
|
||||
const QList<QtVersion *> &removed,
|
||||
const QList<QtVersion *> &allNew)
|
||||
void QtVersionManager::updateDocumentation(const QtVersions &added,
|
||||
const QtVersions &removed,
|
||||
const QtVersions &allNew)
|
||||
{
|
||||
const DocumentationSetting setting = documentationSetting();
|
||||
const QStringList docsOfAll = setting == DocumentationSetting::None
|
||||
@@ -548,18 +548,18 @@ int QtVersionManager::getUniqueId()
|
||||
return m_idcount++;
|
||||
}
|
||||
|
||||
QList<QtVersion *> QtVersionManager::versions(const QtVersion::Predicate &predicate)
|
||||
QtVersions QtVersionManager::versions(const QtVersion::Predicate &predicate)
|
||||
{
|
||||
QList<QtVersion *> versions;
|
||||
QtVersions versions;
|
||||
QTC_ASSERT(isLoaded(), return versions);
|
||||
if (predicate)
|
||||
return Utils::filtered(m_versions.values(), predicate);
|
||||
return m_versions.values();
|
||||
}
|
||||
|
||||
QList<QtVersion *> QtVersionManager::sortVersions(const QList<QtVersion *> &input)
|
||||
QtVersions QtVersionManager::sortVersions(const QtVersions &input)
|
||||
{
|
||||
QList<QtVersion *> result = input;
|
||||
QtVersions result = input;
|
||||
Utils::sort(result, qtVersionNumberCompare);
|
||||
return result;
|
||||
}
|
||||
@@ -584,21 +584,21 @@ static bool equals(QtVersion *a, QtVersion *b)
|
||||
return a->equals(b);
|
||||
}
|
||||
|
||||
void QtVersionManager::setNewQtVersions(const QList<QtVersion *> &newVersions)
|
||||
void QtVersionManager::setNewQtVersions(const QtVersions &newVersions)
|
||||
{
|
||||
// We want to preserve the same order as in the settings dialog
|
||||
// so we sort a copy
|
||||
QList<QtVersion *> sortedNewVersions = newVersions;
|
||||
QtVersions sortedNewVersions = newVersions;
|
||||
Utils::sort(sortedNewVersions, &QtVersion::uniqueId);
|
||||
|
||||
QList<QtVersion *> addedVersions;
|
||||
QList<QtVersion *> removedVersions;
|
||||
QtVersions addedVersions;
|
||||
QtVersions removedVersions;
|
||||
QList<std::pair<QtVersion *, QtVersion *>> changedVersions;
|
||||
// So we trying to find the minimal set of changed versions,
|
||||
// iterate over both sorted list
|
||||
|
||||
// newVersions and oldVersions iterator
|
||||
QList<QtVersion *>::const_iterator nit, nend;
|
||||
QtVersions::const_iterator nit, nend;
|
||||
VersionMap::const_iterator oit, oend;
|
||||
nit = sortedNewVersions.constBegin();
|
||||
nend = sortedNewVersions.constEnd();
|
||||
@@ -633,9 +633,9 @@ void QtVersionManager::setNewQtVersions(const QList<QtVersion *> &newVersions)
|
||||
}
|
||||
|
||||
if (!changedVersions.isEmpty() || !addedVersions.isEmpty() || !removedVersions.isEmpty()) {
|
||||
const QList<QtVersion *> changedOldVersions
|
||||
const QtVersions changedOldVersions
|
||||
= Utils::transform(changedVersions, &std::pair<QtVersion *, QtVersion *>::first);
|
||||
const QList<QtVersion *> changedNewVersions
|
||||
const QtVersions changedNewVersions
|
||||
= Utils::transform(changedVersions,
|
||||
&std::pair<QtVersion *, QtVersion *>::second);
|
||||
updateDocumentation(addedVersions + changedNewVersions,
|
||||
@@ -666,7 +666,7 @@ void QtVersionManager::setDocumentationSetting(const QtVersionManager::Documenta
|
||||
Core::ICore::settings()->setValueWithDefault(DOCUMENTATION_SETTING_KEY, int(setting), 0);
|
||||
// force re-evaluating which documentation should be registered
|
||||
// by claiming that all are removed and re-added
|
||||
const QList<QtVersion *> vs = versions();
|
||||
const QtVersions vs = versions();
|
||||
updateDocumentation(vs, vs, vs);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,12 +53,12 @@ public:
|
||||
// Note: DO NOT STORE THESE POINTERS!
|
||||
// The QtVersionManager may delete them at random times and you will
|
||||
// need to get a new pointer by calling this function again!
|
||||
static QList<QtVersion *> versions(const QtVersion::Predicate &predicate = QtVersion::Predicate());
|
||||
static QtVersions versions(const QtVersion::Predicate &predicate = {});
|
||||
static QtVersion *version(int id);
|
||||
static QtVersion *version(const QtVersion::Predicate &predicate);
|
||||
|
||||
// Sorting is potentially expensive since it might require qmake --query to run for each version!
|
||||
static QList<QtVersion *> sortVersions(const QList<QtVersion *> &input);
|
||||
static QtVersions sortVersions(const QtVersions &input);
|
||||
|
||||
static void addVersion(QtVersion *version);
|
||||
static void removeVersion(QtVersion *version);
|
||||
@@ -76,14 +76,14 @@ signals:
|
||||
private:
|
||||
enum class DocumentationSetting { HighestOnly, All, None };
|
||||
|
||||
static void updateDocumentation(const QList<QtVersion *> &added,
|
||||
const QList<QtVersion *> &removed,
|
||||
const QList<QtVersion *> &allNew);
|
||||
static void updateDocumentation(const QtVersions &added,
|
||||
const QtVersions &removed,
|
||||
const QtVersions &allNew);
|
||||
void updateFromInstaller(bool emitSignal = true);
|
||||
void triggerQtVersionRestore();
|
||||
|
||||
// Used by QtOptionsPage
|
||||
static void setNewQtVersions(const QList<QtVersion *> &newVersions);
|
||||
static void setNewQtVersions(const QtVersions &newVersions);
|
||||
static void setDocumentationSetting(const DocumentationSetting &setting);
|
||||
static DocumentationSetting documentationSetting();
|
||||
// Used by QtVersion
|
||||
|
||||
Reference in New Issue
Block a user