forked from qt-creator/qt-creator
ExtensionSystem: Move away from QList
Qt 6 API will move away from it. Use QVector for API and some std container for internal things. Change-Id: Iff14d48a47d5ac52ade875d9c8c84ad8a4f577d8 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -102,7 +102,7 @@ const char BLOCK_OPTION[] = "-block";
|
||||
const char PLUGINPATH_OPTION[] = "-pluginpath";
|
||||
const char USER_LIBRARY_PATH_OPTION[] = "-user-library-path"; // hidden option for qtcreator.sh
|
||||
|
||||
typedef QList<PluginSpec *> PluginSpecSet;
|
||||
using PluginSpecSet = QVector<PluginSpec *>;
|
||||
|
||||
// Helpers for displaying messages. Note that there is no console on Windows.
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ IPlugin::~IPlugin()
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QList<QObject *> IPlugin::createTestObjects() const
|
||||
\fn QVector<QObject *> IPlugin::createTestObjects() const
|
||||
|
||||
Returns objects that are meant to be passed on to QTest::qExec().
|
||||
|
||||
@@ -201,9 +201,9 @@ IPlugin::~IPlugin()
|
||||
|
||||
The ownership of returned objects is transferred to caller.
|
||||
*/
|
||||
QList<QObject *> IPlugin::createTestObjects() const
|
||||
QVector<QObject *> IPlugin::createTestObjects() const
|
||||
{
|
||||
return QList<QObject *>();
|
||||
return {};
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
virtual QObject *remoteCommand(const QStringList & /* options */,
|
||||
const QString & /* workingDirectory */,
|
||||
const QStringList & /* arguments */) { return nullptr; }
|
||||
virtual QList<QObject *> createTestObjects() const;
|
||||
virtual QVector<QObject *> createTestObjects() const;
|
||||
|
||||
PluginSpec *pluginSpec() const;
|
||||
|
||||
|
||||
@@ -115,10 +115,10 @@ bool OptionsParser::checkForTestOptions()
|
||||
if (m_currentArg == QLatin1String(TEST_OPTION)) {
|
||||
if (nextToken(RequiredToken)) {
|
||||
if (m_currentArg == QLatin1String("all")) {
|
||||
m_pmPrivate->testSpecs =
|
||||
Utils::transform(m_pmPrivate->loadQueue(), [](PluginSpec *spec) {
|
||||
return PluginManagerPrivate::TestSpec(spec);
|
||||
});
|
||||
m_pmPrivate->testSpecs
|
||||
= Utils::transform<std::vector>(m_pmPrivate->loadQueue(), [](PluginSpec *spec) {
|
||||
return PluginManagerPrivate::TestSpec(spec);
|
||||
});
|
||||
} else {
|
||||
QStringList args = m_currentArg.split(QLatin1Char(','));
|
||||
const QString pluginName = args.takeFirst();
|
||||
@@ -129,7 +129,7 @@ bool OptionsParser::checkForTestOptions()
|
||||
"The plugin \"%1\" is specified twice for testing.").arg(pluginName);
|
||||
m_hasError = true;
|
||||
} else {
|
||||
m_pmPrivate->testSpecs.append(PluginManagerPrivate::TestSpec(spec, args));
|
||||
m_pmPrivate->testSpecs.emplace_back(spec, args);
|
||||
}
|
||||
} else {
|
||||
if (m_errorString)
|
||||
@@ -265,7 +265,7 @@ bool OptionsParser::checkForUnknownOption()
|
||||
|
||||
void OptionsParser::forceDisableAllPluginsExceptTestedAndForceEnabled()
|
||||
{
|
||||
for (const PluginManagerPrivate::TestSpec &testSpec : qAsConst(m_pmPrivate->testSpecs))
|
||||
for (const PluginManagerPrivate::TestSpec &testSpec : m_pmPrivate->testSpecs)
|
||||
testSpec.pluginSpec->d->setForceEnabled(true);
|
||||
for (PluginSpec *spec : qAsConst(m_pmPrivate->pluginSpecs)) {
|
||||
if (!spec->isForceEnabled() && !spec->isRequired())
|
||||
|
||||
@@ -319,7 +319,7 @@ void PluginManager::removeObject(QObject *obj)
|
||||
|
||||
\sa PluginManager::getObject()
|
||||
*/
|
||||
QList<QObject *> PluginManager::allObjects()
|
||||
QVector<QObject *> PluginManager::allObjects()
|
||||
{
|
||||
return d->allObjects;
|
||||
}
|
||||
@@ -376,10 +376,11 @@ QSet<PluginSpec *> PluginManager::pluginsRequiredByPlugin(PluginSpec *spec)
|
||||
{
|
||||
QSet<PluginSpec *> recursiveDependencies;
|
||||
recursiveDependencies.insert(spec);
|
||||
QList<PluginSpec *> queue;
|
||||
queue.append(spec);
|
||||
while (!queue.isEmpty()) {
|
||||
PluginSpec *checkSpec = queue.takeFirst();
|
||||
std::queue<PluginSpec *> queue;
|
||||
queue.push(spec);
|
||||
while (!queue.empty()) {
|
||||
PluginSpec *checkSpec = queue.front();
|
||||
queue.pop();
|
||||
QHashIterator<PluginDependency, PluginSpec *> depIt(checkSpec->dependencySpecs());
|
||||
while (depIt.hasNext()) {
|
||||
depIt.next();
|
||||
@@ -388,7 +389,7 @@ QSet<PluginSpec *> PluginManager::pluginsRequiredByPlugin(PluginSpec *spec)
|
||||
PluginSpec *depSpec = depIt.value();
|
||||
if (!recursiveDependencies.contains(depSpec)) {
|
||||
recursiveDependencies.insert(depSpec);
|
||||
queue.append(depSpec);
|
||||
queue.push(depSpec);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -536,12 +537,12 @@ QStringList PluginManager::arguments()
|
||||
|
||||
\sa setPluginPaths()
|
||||
*/
|
||||
const QList<PluginSpec *> PluginManager::plugins()
|
||||
const QVector<PluginSpec *> PluginManager::plugins()
|
||||
{
|
||||
return d->pluginSpecs;
|
||||
}
|
||||
|
||||
QHash<QString, QList<PluginSpec *> > PluginManager::pluginCollections()
|
||||
QHash<QString, QVector<PluginSpec *>> PluginManager::pluginCollections()
|
||||
{
|
||||
return d->pluginCategories;
|
||||
}
|
||||
@@ -752,7 +753,7 @@ void PluginManager::formatPluginVersions(QTextStream &str)
|
||||
*/
|
||||
bool PluginManager::testRunRequested()
|
||||
{
|
||||
return !d->testSpecs.isEmpty();
|
||||
return !d->testSpecs.empty();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -769,7 +770,7 @@ void PluginManager::profilingReport(const char *what, const PluginSpec *spec)
|
||||
/*!
|
||||
Returns a list of plugins in load order.
|
||||
*/
|
||||
QList<PluginSpec *> PluginManager::loadQueue()
|
||||
QVector<PluginSpec *> PluginManager::loadQueue()
|
||||
{
|
||||
return d->loadQueue();
|
||||
}
|
||||
@@ -818,15 +819,16 @@ PluginSpecPrivate *PluginManagerPrivate::privateSpec(PluginSpec *spec)
|
||||
|
||||
void PluginManagerPrivate::nextDelayedInitialize()
|
||||
{
|
||||
while (!delayedInitializeQueue.isEmpty()) {
|
||||
PluginSpec *spec = delayedInitializeQueue.takeFirst();
|
||||
while (!delayedInitializeQueue.empty()) {
|
||||
PluginSpec *spec = delayedInitializeQueue.front();
|
||||
delayedInitializeQueue.pop();
|
||||
profilingReport(">delayedInitialize", spec);
|
||||
bool delay = spec->d->delayedInitialize();
|
||||
profilingReport("<delayedInitialize", spec);
|
||||
if (delay)
|
||||
break; // do next delayedInitialize after a delay
|
||||
}
|
||||
if (delayedInitializeQueue.isEmpty()) {
|
||||
if (delayedInitializeQueue.empty()) {
|
||||
m_isInitializationDone = true;
|
||||
delete delayedInitializeTimer;
|
||||
delayedInitializeTimer = nullptr;
|
||||
@@ -903,7 +905,7 @@ void PluginManagerPrivate::stopAll()
|
||||
delete delayedInitializeTimer;
|
||||
delayedInitializeTimer = nullptr;
|
||||
}
|
||||
QList<PluginSpec *> queue = loadQueue();
|
||||
QVector<PluginSpec *> queue = loadQueue();
|
||||
foreach (PluginSpec *spec, queue) {
|
||||
loadPlugin(spec, PluginSpec::Stopped);
|
||||
}
|
||||
@@ -926,8 +928,10 @@ using TestPlanIterator = QMapIterator<QObject *, QStringList>;
|
||||
|
||||
static bool isTestFunction(const QMetaMethod &metaMethod)
|
||||
{
|
||||
static const QList<QByteArray> blackList = QList<QByteArray>()
|
||||
<< "initTestCase()" << "cleanupTestCase()" << "init()" << "cleanup()";
|
||||
static const QVector<QByteArray> blackList = {"initTestCase()",
|
||||
"cleanupTestCase()",
|
||||
"init()",
|
||||
"cleanup()"};
|
||||
|
||||
if (metaMethod.methodType() != QMetaMethod::Slot)
|
||||
return false;
|
||||
@@ -991,7 +995,7 @@ static QStringList matchingTestFunctions(const QStringList &testFunctions,
|
||||
return matchingFunctions;
|
||||
}
|
||||
|
||||
static QObject *objectWithClassName(const QList<QObject *> &objects, const QString &className)
|
||||
static QObject *objectWithClassName(const QVector<QObject *> &objects, const QString &className)
|
||||
{
|
||||
return Utils::findOr(objects, nullptr, [className] (QObject *object) -> bool {
|
||||
QString candidate = QString::fromUtf8(object->metaObject()->className());
|
||||
@@ -1034,7 +1038,7 @@ static int executeTestPlan(const TestPlan &testPlan)
|
||||
|
||||
/// Resulting plan consists of all test functions of the plugin object and
|
||||
/// all test functions of all test objects of the plugin.
|
||||
static TestPlan generateCompleteTestPlan(IPlugin *plugin, const QList<QObject *> &testObjects)
|
||||
static TestPlan generateCompleteTestPlan(IPlugin *plugin, const QVector<QObject *> &testObjects)
|
||||
{
|
||||
TestPlan testPlan;
|
||||
|
||||
@@ -1054,7 +1058,8 @@ static TestPlan generateCompleteTestPlan(IPlugin *plugin, const QList<QObject *>
|
||||
///
|
||||
/// Since multiple match texts can match the same function, a test function might
|
||||
/// be included multiple times for a test object.
|
||||
static TestPlan generateCustomTestPlan(IPlugin *plugin, const QList<QObject *> &testObjects,
|
||||
static TestPlan generateCustomTestPlan(IPlugin *plugin,
|
||||
const QVector<QObject *> &testObjects,
|
||||
const QStringList &matchTexts)
|
||||
{
|
||||
TestPlan testPlan;
|
||||
@@ -1062,7 +1067,7 @@ static TestPlan generateCustomTestPlan(IPlugin *plugin, const QList<QObject *> &
|
||||
const QStringList testFunctionsOfPluginObject = testFunctions(plugin->metaObject());
|
||||
QStringList matchedTestFunctionsOfPluginObject;
|
||||
QStringList remainingMatchTexts = matchTexts;
|
||||
QList<QObject *> remainingTestObjectsOfPlugin = testObjects;
|
||||
QVector<QObject *> remainingTestObjectsOfPlugin = testObjects;
|
||||
|
||||
while (!remainingMatchTexts.isEmpty()) {
|
||||
const QString matchText = remainingMatchTexts.takeFirst();
|
||||
@@ -1127,11 +1132,12 @@ void PluginManagerPrivate::startTests()
|
||||
if (!plugin)
|
||||
continue; // plugin not loaded
|
||||
|
||||
const QList<QObject *> testObjects = plugin->createTestObjects();
|
||||
const QVector<QObject *> testObjects = plugin->createTestObjects();
|
||||
ExecuteOnDestruction deleteTestObjects([&]() { qDeleteAll(testObjects); });
|
||||
Q_UNUSED(deleteTestObjects)
|
||||
|
||||
const bool hasDuplicateTestObjects = testObjects.size() != testObjects.toSet().size();
|
||||
const bool hasDuplicateTestObjects = testObjects.size()
|
||||
!= Utils::filteredUnique(testObjects).size();
|
||||
QTC_ASSERT(!hasDuplicateTestObjects, continue);
|
||||
QTC_ASSERT(!testObjects.contains(plugin), continue);
|
||||
|
||||
@@ -1205,7 +1211,7 @@ void PluginManagerPrivate::removeObject(QObject *obj)
|
||||
*/
|
||||
void PluginManagerPrivate::loadPlugins()
|
||||
{
|
||||
QList<PluginSpec *> queue = loadQueue();
|
||||
QVector<PluginSpec *> queue = loadQueue();
|
||||
Utils::setMimeStartupPhase(MimeStartupPhase::PluginsLoading);
|
||||
foreach (PluginSpec *spec, queue) {
|
||||
loadPlugin(spec, PluginSpec::Loaded);
|
||||
@@ -1218,7 +1224,7 @@ void PluginManagerPrivate::loadPlugins()
|
||||
Utils::reverseForeach(queue, [this](PluginSpec *spec) {
|
||||
loadPlugin(spec, PluginSpec::Running);
|
||||
if (spec->state() == PluginSpec::Running) {
|
||||
delayedInitializeQueue.append(spec);
|
||||
delayedInitializeQueue.push(spec);
|
||||
} else {
|
||||
// Plugin initialization failed, so cleanup after it
|
||||
spec->d->kill();
|
||||
@@ -1261,7 +1267,7 @@ void PluginManagerPrivate::asyncShutdownFinished()
|
||||
{
|
||||
auto *plugin = qobject_cast<IPlugin *>(sender());
|
||||
Q_ASSERT(plugin);
|
||||
asynchronousPlugins.removeAll(plugin->pluginSpec());
|
||||
asynchronousPlugins.remove(plugin->pluginSpec());
|
||||
if (asynchronousPlugins.isEmpty())
|
||||
shutdownEventLoop->exit();
|
||||
}
|
||||
@@ -1269,11 +1275,11 @@ void PluginManagerPrivate::asyncShutdownFinished()
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
QList<PluginSpec *> PluginManagerPrivate::loadQueue()
|
||||
QVector<PluginSpec *> PluginManagerPrivate::loadQueue()
|
||||
{
|
||||
QList<PluginSpec *> queue;
|
||||
QVector<PluginSpec *> queue;
|
||||
foreach (PluginSpec *spec, pluginSpecs) {
|
||||
QList<PluginSpec *> circularityCheckQueue;
|
||||
QVector<PluginSpec *> circularityCheckQueue;
|
||||
loadQueue(spec, queue, circularityCheckQueue);
|
||||
}
|
||||
return queue;
|
||||
@@ -1282,8 +1288,9 @@ QList<PluginSpec *> PluginManagerPrivate::loadQueue()
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
bool PluginManagerPrivate::loadQueue(PluginSpec *spec, QList<PluginSpec *> &queue,
|
||||
QList<PluginSpec *> &circularityCheckQueue)
|
||||
bool PluginManagerPrivate::loadQueue(PluginSpec *spec,
|
||||
QVector<PluginSpec *> &queue,
|
||||
QVector<PluginSpec *> &circularityCheckQueue)
|
||||
{
|
||||
if (queue.contains(spec))
|
||||
return true;
|
||||
@@ -1433,7 +1440,7 @@ void PluginManagerPrivate::readPluginPaths()
|
||||
pluginCategories.clear();
|
||||
|
||||
// default
|
||||
pluginCategories.insert(QString(), QList<PluginSpec *>());
|
||||
pluginCategories.insert(QString(), QVector<PluginSpec *>());
|
||||
|
||||
foreach (const QString &pluginFile, pluginFiles(pluginPaths)) {
|
||||
auto *spec = new PluginSpec;
|
||||
@@ -1477,7 +1484,7 @@ void PluginManagerPrivate::enableDependenciesIndirectly()
|
||||
foreach (PluginSpec *spec, pluginSpecs)
|
||||
spec->d->enabledIndirectly = false;
|
||||
// cannot use reverse loadQueue here, because test dependencies can introduce circles
|
||||
QList<PluginSpec *> queue = Utils::filtered(pluginSpecs, &PluginSpec::isEffectivelyEnabled);
|
||||
QVector<PluginSpec *> queue = Utils::filtered(pluginSpecs, &PluginSpec::isEffectivelyEnabled);
|
||||
while (!queue.isEmpty()) {
|
||||
PluginSpec *spec = queue.takeFirst();
|
||||
queue += spec->d->enableDependenciesIndirectly(containsTestSpec(spec));
|
||||
|
||||
@@ -55,14 +55,14 @@ public:
|
||||
// Object pool operations
|
||||
static void addObject(QObject *obj);
|
||||
static void removeObject(QObject *obj);
|
||||
static QList<QObject *> allObjects();
|
||||
static QVector<QObject *> allObjects();
|
||||
static QReadWriteLock *listLock();
|
||||
|
||||
// This is useful for soft dependencies using pure interfaces.
|
||||
template <typename T> static T *getObject()
|
||||
{
|
||||
QReadLocker lock(listLock());
|
||||
QList<QObject *> all = allObjects();
|
||||
QVector<QObject *> all = allObjects();
|
||||
foreach (QObject *obj, all) {
|
||||
if (T *result = qobject_cast<T *>(obj))
|
||||
return result;
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
template <typename T, typename Predicate> static T *getObject(Predicate predicate)
|
||||
{
|
||||
QReadLocker lock(listLock());
|
||||
QList<QObject *> all = allObjects();
|
||||
QVector<QObject *> all = allObjects();
|
||||
foreach (QObject *obj, all) {
|
||||
if (T *result = qobject_cast<T *>(obj))
|
||||
if (predicate(result))
|
||||
@@ -84,14 +84,14 @@ public:
|
||||
static QObject *getObjectByName(const QString &name);
|
||||
|
||||
// Plugin operations
|
||||
static QList<PluginSpec *> loadQueue();
|
||||
static QVector<PluginSpec *> loadQueue();
|
||||
static void loadPlugins();
|
||||
static QStringList pluginPaths();
|
||||
static void setPluginPaths(const QStringList &paths);
|
||||
static QString pluginIID();
|
||||
static void setPluginIID(const QString &iid);
|
||||
static const QList<PluginSpec *> plugins();
|
||||
static QHash<QString, QList<PluginSpec *>> pluginCollections();
|
||||
static const QVector<PluginSpec *> plugins();
|
||||
static QHash<QString, QVector<PluginSpec *>> pluginCollections();
|
||||
static bool hasError();
|
||||
static QSet<PluginSpec *> pluginsRequiringPlugin(PluginSpec *spec);
|
||||
static QSet<PluginSpec *> pluginsRequiredByPlugin(PluginSpec *spec);
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <QScopedPointer>
|
||||
#include <QReadWriteLock>
|
||||
|
||||
#include <queue>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QTime;
|
||||
class QTimer;
|
||||
@@ -65,13 +67,13 @@ public:
|
||||
void loadPlugins();
|
||||
void shutdown();
|
||||
void setPluginPaths(const QStringList &paths);
|
||||
QList<PluginSpec *> loadQueue();
|
||||
QVector<ExtensionSystem::PluginSpec *> loadQueue();
|
||||
void loadPlugin(PluginSpec *spec, PluginSpec::State destState);
|
||||
void resolveDependencies();
|
||||
void enableDependenciesIndirectly();
|
||||
void initProfiling();
|
||||
void profilingSummary() const;
|
||||
void profilingReport(const char *what, const PluginSpec *spec = 0);
|
||||
void profilingReport(const char *what, const PluginSpec *spec = nullptr);
|
||||
void setSettings(QSettings *settings);
|
||||
void setGlobalSettings(QSettings *settings);
|
||||
void readSettings();
|
||||
@@ -80,8 +82,10 @@ public:
|
||||
class TestSpec {
|
||||
public:
|
||||
TestSpec(PluginSpec *pluginSpec, const QStringList &testFunctionsOrObjects = QStringList())
|
||||
: pluginSpec(pluginSpec), testFunctionsOrObjects(testFunctionsOrObjects) {}
|
||||
PluginSpec *pluginSpec;
|
||||
: pluginSpec(pluginSpec)
|
||||
, testFunctionsOrObjects(testFunctionsOrObjects)
|
||||
{}
|
||||
PluginSpec *pluginSpec = nullptr;
|
||||
QStringList testFunctionsOrObjects;
|
||||
};
|
||||
|
||||
@@ -95,21 +99,21 @@ public:
|
||||
testSpecs = Utils::filtered(testSpecs, [pluginSpec](const TestSpec &s) { return s.pluginSpec != pluginSpec; });
|
||||
}
|
||||
|
||||
QHash<QString, QList<PluginSpec *>> pluginCategories;
|
||||
QList<PluginSpec *> pluginSpecs;
|
||||
QList<TestSpec> testSpecs;
|
||||
QHash<QString, QVector<PluginSpec *>> pluginCategories;
|
||||
QVector<PluginSpec *> pluginSpecs;
|
||||
std::vector<TestSpec> testSpecs;
|
||||
QStringList pluginPaths;
|
||||
QString pluginIID;
|
||||
QList<QObject *> allObjects; // ### make this a QList<QPointer<QObject> > > ?
|
||||
QVector<QObject *> allObjects; // ### make this a QVector<QPointer<QObject> > > ?
|
||||
QStringList defaultDisabledPlugins; // Plugins/Ignored from install settings
|
||||
QStringList defaultEnabledPlugins; // Plugins/ForceEnabled from install settings
|
||||
QStringList disabledPlugins;
|
||||
QStringList forceEnabledPlugins;
|
||||
// delayed initialization
|
||||
QTimer *delayedInitializeTimer = nullptr;
|
||||
QList<PluginSpec *> delayedInitializeQueue;
|
||||
std::queue<PluginSpec *> delayedInitializeQueue;
|
||||
// ansynchronous shutdown
|
||||
QList<PluginSpec *> asynchronousPlugins; // plugins that have requested async shutdown
|
||||
QSet<PluginSpec *> asynchronousPlugins; // plugins that have requested async shutdown
|
||||
QEventLoop *shutdownEventLoop = nullptr; // used for async shutdown
|
||||
|
||||
QStringList arguments;
|
||||
@@ -140,8 +144,8 @@ private:
|
||||
|
||||
void readPluginPaths();
|
||||
bool loadQueue(PluginSpec *spec,
|
||||
QList<PluginSpec *> &queue,
|
||||
QList<PluginSpec *> &circularityCheckQueue);
|
||||
QVector<ExtensionSystem::PluginSpec *> &queue,
|
||||
QVector<ExtensionSystem::PluginSpec *> &circularityCheckQueue);
|
||||
void stopAll();
|
||||
void deleteAll();
|
||||
|
||||
|
||||
@@ -885,7 +885,7 @@ int PluginSpecPrivate::versionCompare(const QString &version1, const QString &ve
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
|
||||
bool PluginSpecPrivate::resolveDependencies(const QVector<PluginSpec *> &specs)
|
||||
{
|
||||
if (hasError)
|
||||
return false;
|
||||
@@ -924,11 +924,11 @@ bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
|
||||
}
|
||||
|
||||
// returns the plugins that it actually indirectly enabled
|
||||
QList<PluginSpec *> PluginSpecPrivate::enableDependenciesIndirectly(bool enableTestDependencies)
|
||||
QVector<PluginSpec *> PluginSpecPrivate::enableDependenciesIndirectly(bool enableTestDependencies)
|
||||
{
|
||||
if (!q->isEffectivelyEnabled()) // plugin not enabled, nothing to do
|
||||
return {};
|
||||
QList<PluginSpec *> enabled;
|
||||
QVector<PluginSpec *> enabled;
|
||||
QHashIterator<PluginDependency, PluginSpec *> it(dependencySpecs);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
bool read(const QString &fileName);
|
||||
bool provides(const QString &pluginName, const QString &version) const;
|
||||
bool resolveDependencies(const QList<PluginSpec *> &specs);
|
||||
bool resolveDependencies(const QVector<PluginSpec *> &specs);
|
||||
bool loadLibrary();
|
||||
bool initializePlugin();
|
||||
bool initializeExtensions();
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
static bool isValidVersion(const QString &version);
|
||||
static int versionCompare(const QString &version1, const QString &version2);
|
||||
|
||||
QList<PluginSpec *> enableDependenciesIndirectly(bool enableTestDependencies = false);
|
||||
QVector<PluginSpec *> enableDependenciesIndirectly(bool enableTestDependencies = false);
|
||||
|
||||
bool readMetaData(const QJsonObject &pluginMetaData);
|
||||
|
||||
|
||||
@@ -212,8 +212,10 @@ public:
|
||||
class CollectionItem : public TreeItem
|
||||
{
|
||||
public:
|
||||
CollectionItem(const QString &name, QList<PluginSpec *> plugins, PluginView *view)
|
||||
: m_name(name), m_plugins(plugins), m_view(view)
|
||||
CollectionItem(const QString &name, QVector<PluginSpec *> plugins, PluginView *view)
|
||||
: m_name(name)
|
||||
, m_plugins(plugins)
|
||||
, m_view(view)
|
||||
{
|
||||
foreach (PluginSpec *spec, plugins)
|
||||
appendChild(new PluginItem(spec, view));
|
||||
@@ -254,9 +256,11 @@ public:
|
||||
bool setData(int column, const QVariant &data, int role) override
|
||||
{
|
||||
if (column == LoadedColumn && role == Qt::CheckStateRole) {
|
||||
const QList<PluginSpec *> affectedPlugins =
|
||||
Utils::filtered(m_plugins, [](PluginSpec *spec) { return !spec->isRequired(); });
|
||||
if (m_view->setPluginsEnabled(affectedPlugins.toSet(), data.toBool())) {
|
||||
const QVector<PluginSpec *> affectedPlugins
|
||||
= Utils::filtered(m_plugins, [](PluginSpec *spec) { return !spec->isRequired(); });
|
||||
if (m_view->setPluginsEnabled(Utils::transform<QSet>(affectedPlugins,
|
||||
[](PluginSpec *s) { return s; }),
|
||||
data.toBool())) {
|
||||
update();
|
||||
return true;
|
||||
}
|
||||
@@ -274,7 +278,7 @@ public:
|
||||
|
||||
public:
|
||||
QString m_name;
|
||||
QList<PluginSpec *> m_plugins;
|
||||
QVector<PluginSpec *> m_plugins;
|
||||
PluginView *m_view; // Not owned.
|
||||
};
|
||||
|
||||
@@ -408,13 +412,13 @@ void PluginView::updatePlugins()
|
||||
// Model.
|
||||
m_model->clear();
|
||||
|
||||
|
||||
QList<CollectionItem *> collections;
|
||||
const QHash<QString, QList<PluginSpec *>> pluginCollections = PluginManager::pluginCollections();
|
||||
const QHash<QString, QVector<PluginSpec *>> pluginCollections
|
||||
= PluginManager::pluginCollections();
|
||||
std::vector<CollectionItem *> collections;
|
||||
const auto end = pluginCollections.cend();
|
||||
for (auto it = pluginCollections.cbegin(); it != end; ++it) {
|
||||
const QString name = it.key().isEmpty() ? tr("Utilities") : it.key();
|
||||
collections.append(new CollectionItem(name, it.value(), this));
|
||||
collections.push_back(new CollectionItem(name, it.value(), this));
|
||||
}
|
||||
Utils::sort(collections, &CollectionItem::m_name);
|
||||
|
||||
|
||||
@@ -357,9 +357,9 @@ void AutotestPlugin::popupResultsPane()
|
||||
s_instance->m_resultsPane->popup(Core::IOutputPane::NoModeSwitch);
|
||||
}
|
||||
|
||||
QList<QObject *> AutotestPlugin::createTestObjects() const
|
||||
QVector<QObject *> AutotestPlugin::createTestObjects() const
|
||||
{
|
||||
QList<QObject *> tests;
|
||||
QVector<QObject *> tests;
|
||||
#ifdef WITH_TESTS
|
||||
tests << new AutoTestUnitTests(TestTreeModel::instance());
|
||||
#endif
|
||||
|
||||
@@ -79,7 +79,7 @@ private:
|
||||
void onRunSelectedTriggered();
|
||||
void onRunFileTriggered();
|
||||
void onRunUnderCursorTriggered(TestRunMode mode);
|
||||
QList<QObject *> createTestObjects() const override;
|
||||
QVector<QObject *> createTestObjects() const override;
|
||||
const QSharedPointer<TestSettings> m_settings;
|
||||
TestFrameworkManager *m_frameworkManager = nullptr;
|
||||
TestSettingsPage *m_testSettingPage = nullptr;
|
||||
|
||||
@@ -201,7 +201,7 @@ void ClangCodeModelPlugin::maybeHandleBatchFileAndExit() const
|
||||
}
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
QList<QObject *> ClangCodeModelPlugin::createTestObjects() const
|
||||
QVector<QObject *> ClangCodeModelPlugin::createTestObjects() const
|
||||
{
|
||||
return {
|
||||
new Tests::ClangCodeCompletionTest,
|
||||
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
::Utils::ParameterAction *m_generateCompilationDBAction = nullptr;
|
||||
QFutureWatcher<Utils::GenerateCompilationDbResult> m_generatorWatcher;
|
||||
#ifdef WITH_TESTS
|
||||
QList<QObject *> createTestObjects() const override;
|
||||
QVector<QObject *> createTestObjects() const override;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ static const char kFileSaveWarning[]
|
||||
|
||||
static bool isBeautifierPluginActivated()
|
||||
{
|
||||
const QList<ExtensionSystem::PluginSpec *> specs = ExtensionSystem::PluginManager::plugins();
|
||||
const QVector<ExtensionSystem::PluginSpec *> specs = ExtensionSystem::PluginManager::plugins();
|
||||
return std::find_if(specs.begin(),
|
||||
specs.end(),
|
||||
[](ExtensionSystem::PluginSpec *spec) {
|
||||
|
||||
@@ -132,9 +132,9 @@ bool ClangToolsPlugin::initialize(const QStringList &arguments, QString *errorSt
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<QObject *> ClangToolsPlugin::createTestObjects() const
|
||||
QVector<QObject *> ClangToolsPlugin::createTestObjects() const
|
||||
{
|
||||
QList<QObject *> tests;
|
||||
QVector<QObject *> tests;
|
||||
#ifdef WITH_TESTS
|
||||
tests << new PreconfiguredSessionTests;
|
||||
tests << new ClangToolsUnitTests;
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
private:
|
||||
bool initialize(const QStringList &arguments, QString *errorString) final;
|
||||
void extensionsInitialized() final {}
|
||||
QList<QObject *> createTestObjects() const final;
|
||||
QVector<QObject *> createTestObjects() const final;
|
||||
|
||||
class ClangToolsPluginPrivate *d = nullptr;
|
||||
};
|
||||
|
||||
@@ -95,9 +95,9 @@ void CompilationDatabaseProjectManagerPlugin::extensionsInitialized()
|
||||
{
|
||||
}
|
||||
|
||||
QList<QObject *> CompilationDatabaseProjectManagerPlugin::createTestObjects() const
|
||||
QVector<QObject *> CompilationDatabaseProjectManagerPlugin::createTestObjects() const
|
||||
{
|
||||
QList<QObject *> tests;
|
||||
QVector<QObject *> tests;
|
||||
#ifdef WITH_TESTS
|
||||
tests << new CompilationDatabaseTests;
|
||||
#endif
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
private:
|
||||
void projectChanged();
|
||||
|
||||
QList<QObject *> createTestObjects() const final;
|
||||
QVector<QObject *> createTestObjects() const final;
|
||||
|
||||
CompilationDatabaseEditorFactory factory;
|
||||
CompilationDatabaseBuildConfigurationFactory buildConfigFactory;
|
||||
|
||||
@@ -371,11 +371,9 @@ void CppEditorPluginPrivate::inspectCppCodeModel()
|
||||
}
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
QList<QObject *> CppEditorPlugin::createTestObjects() const
|
||||
QVector<QObject *> CppEditorPlugin::createTestObjects() const
|
||||
{
|
||||
return QList<QObject *>()
|
||||
<< new Tests::DoxygenTest
|
||||
;
|
||||
return {new Tests::DoxygenTest};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private:
|
||||
QList<QObject *> createTestObjects() const override;
|
||||
QVector<QObject *> createTestObjects() const override;
|
||||
|
||||
private slots:
|
||||
// The following tests expect that no projects are loaded on start-up.
|
||||
|
||||
@@ -2634,15 +2634,14 @@ void DebuggerUnitTests::testDebuggerMatching()
|
||||
QCOMPARE(expectedLevel, level);
|
||||
}
|
||||
|
||||
|
||||
QList<QObject *> DebuggerPlugin::createTestObjects() const
|
||||
QVector<QObject *> DebuggerPlugin::createTestObjects() const
|
||||
{
|
||||
return {new DebuggerUnitTests};
|
||||
}
|
||||
|
||||
#else // ^-- if WITH_TESTS else --v
|
||||
|
||||
QList<QObject *> DebuggerPlugin::createTestObjects() const
|
||||
QVector<QObject *> DebuggerPlugin::createTestObjects() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ private:
|
||||
// Called from GammaRayIntegration
|
||||
Q_SLOT void getEnginesState(QByteArray *json) const;
|
||||
|
||||
QList<QObject *> createTestObjects() const override;
|
||||
QVector<QObject *> createTestObjects() const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -102,9 +102,9 @@ PerfSettings *PerfProfilerPlugin::globalSettings()
|
||||
return perfGlobalSettings();
|
||||
}
|
||||
|
||||
QList<QObject *> PerfProfilerPlugin::createTestObjects() const
|
||||
QVector<QObject *> PerfProfilerPlugin::createTestObjects() const
|
||||
{
|
||||
QList<QObject *> tests;
|
||||
QVector<QObject *> tests;
|
||||
#if WITH_TESTS
|
||||
tests << new PerfProfilerTraceFileTest;
|
||||
tests << new PerfResourceCounterTest;
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorString) final;
|
||||
void extensionsInitialized() final;
|
||||
QList<QObject *> createTestObjects() const final;
|
||||
QVector<QObject *> createTestObjects() const final;
|
||||
|
||||
static PerfSettings *globalSettings();
|
||||
|
||||
|
||||
@@ -196,9 +196,9 @@ ExtensionSystem::IPlugin::ShutdownFlag QmlPreviewPlugin::aboutToShutdown()
|
||||
return SynchronousShutdown;
|
||||
}
|
||||
|
||||
QList<QObject *> QmlPreviewPlugin::createTestObjects() const
|
||||
QVector<QObject *> QmlPreviewPlugin::createTestObjects() const
|
||||
{
|
||||
QList<QObject *> tests;
|
||||
QVector<QObject *> tests;
|
||||
#ifdef WITH_TESTS
|
||||
tests.append(new QmlPreviewClientTest);
|
||||
tests.append(new QmlPreviewPluginTest);
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
bool initialize(const QStringList &arguments, QString *errorString) override;
|
||||
void extensionsInitialized() override;
|
||||
ShutdownFlag aboutToShutdown() override;
|
||||
QList<QObject *> createTestObjects() const override;
|
||||
QVector<QObject *> createTestObjects() const override;
|
||||
|
||||
QString previewedFile() const;
|
||||
void setPreviewedFile(const QString &previewedFile);
|
||||
|
||||
@@ -43,7 +43,7 @@ QmlPreviewPluginTest::QmlPreviewPluginTest(QObject *parent) : QObject(parent)
|
||||
|
||||
static ExtensionSystem::IPlugin *getPlugin()
|
||||
{
|
||||
const QList<ExtensionSystem::PluginSpec *> plugins = ExtensionSystem::PluginManager::plugins();
|
||||
const QVector<ExtensionSystem::PluginSpec *> plugins = ExtensionSystem::PluginManager::plugins();
|
||||
auto it = std::find_if(plugins.begin(), plugins.end(), [](ExtensionSystem::PluginSpec *spec) {
|
||||
return spec->name() == "QmlPreview";
|
||||
});
|
||||
|
||||
@@ -149,9 +149,9 @@ QmlProfilerSettings *QmlProfilerPlugin::globalSettings()
|
||||
return qmlProfilerGlobalSettings();
|
||||
}
|
||||
|
||||
QList<QObject *> QmlProfiler::Internal::QmlProfilerPlugin::createTestObjects() const
|
||||
QVector<QObject *> QmlProfiler::Internal::QmlProfilerPlugin::createTestObjects() const
|
||||
{
|
||||
QList<QObject *> tests;
|
||||
QVector<QObject *> tests;
|
||||
#ifdef WITH_TESTS
|
||||
tests << new DebugMessagesModelTest;
|
||||
tests << new FlameGraphModelTest;
|
||||
|
||||
@@ -44,7 +44,7 @@ private:
|
||||
bool initialize(const QStringList &arguments, QString *errorString) final;
|
||||
void extensionsInitialized() final;
|
||||
ShutdownFlag aboutToShutdown() final;
|
||||
QList<QObject *> createTestObjects() const final;
|
||||
QVector<QObject *> createTestObjects() const final;
|
||||
|
||||
class QmlProfilerPluginPrivate *d = nullptr;
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ void SilverSearcherPlugin::extensionsInitialized()
|
||||
}
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
QList<QObject *> SilverSearcherPlugin::createTestObjects() const
|
||||
QVector<QObject *> SilverSearcherPlugin::createTestObjects() const
|
||||
{
|
||||
return {new OutputParserTest};
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
void extensionsInitialized() override;
|
||||
#ifdef WITH_TESTS
|
||||
private:
|
||||
QList<QObject *> createTestObjects() const override;
|
||||
QVector<QObject *> createTestObjects() const override;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -127,9 +127,9 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<QObject *> ValgrindPlugin::createTestObjects() const
|
||||
QVector<QObject *> ValgrindPlugin::createTestObjects() const
|
||||
{
|
||||
QList<QObject *> tests;
|
||||
QVector<QObject *> tests;
|
||||
#ifdef WITH_TESTS
|
||||
tests << new Test::ValgrindMemcheckParserTest << new Test::ValgrindTestRunnerTest;
|
||||
#endif
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
void extensionsInitialized() final {}
|
||||
|
||||
private:
|
||||
QList<QObject *> createTestObjects() const override;
|
||||
QVector<QObject *> createTestObjects() const override;
|
||||
|
||||
class ValgrindPluginPrivate *d = nullptr;
|
||||
};
|
||||
|
||||
@@ -161,7 +161,7 @@ void tst_PluginManager::circularPlugins()
|
||||
{
|
||||
m_pm->setPluginPaths(QStringList() << pluginFolder(QLatin1String("circularplugins")));
|
||||
m_pm->loadPlugins();
|
||||
QList<PluginSpec *> plugins = m_pm->plugins();
|
||||
QVector<PluginSpec *> plugins = m_pm->plugins();
|
||||
QCOMPARE(plugins.count(), 3);
|
||||
foreach (PluginSpec *spec, plugins) {
|
||||
if (spec->name() == "plugin1") {
|
||||
|
||||
@@ -245,7 +245,7 @@ void tst_PluginSpec::locationAndPath()
|
||||
|
||||
void tst_PluginSpec::resolveDependencies()
|
||||
{
|
||||
QList<PluginSpec *> specs;
|
||||
QVector<PluginSpec *> specs;
|
||||
PluginSpec *spec1 = Internal::PluginManagerPrivate::createSpec();
|
||||
specs.append(spec1);
|
||||
Internal::PluginSpecPrivate *spec1Priv = Internal::PluginManagerPrivate::privateSpec(spec1);
|
||||
@@ -291,7 +291,7 @@ void tst_PluginSpec::loadLibrary()
|
||||
PluginSpec *ps = Internal::PluginManagerPrivate::createSpec();
|
||||
Internal::PluginSpecPrivate *spec = Internal::PluginManagerPrivate::privateSpec(ps);
|
||||
QVERIFY(spec->read(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/") + libraryName(QLatin1String("test"))));
|
||||
QVERIFY(spec->resolveDependencies(QList<PluginSpec *>()));
|
||||
QVERIFY(spec->resolveDependencies(QVector<PluginSpec *>()));
|
||||
QVERIFY2(spec->loadLibrary(), qPrintable(spec->errorString));
|
||||
QVERIFY(spec->plugin != 0);
|
||||
QVERIFY(QLatin1String(spec->plugin->metaObject()->className()) == QLatin1String("MyPlugin::MyPluginImpl"));
|
||||
@@ -305,7 +305,7 @@ void tst_PluginSpec::initializePlugin()
|
||||
{
|
||||
Internal::PluginSpecPrivate spec(0);
|
||||
QVERIFY(spec.read(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/") + libraryName(QLatin1String("test"))));
|
||||
QVERIFY(spec.resolveDependencies(QList<PluginSpec *>()));
|
||||
QVERIFY(spec.resolveDependencies(QVector<PluginSpec *>()));
|
||||
QVERIFY2(spec.loadLibrary(), qPrintable(spec.errorString));
|
||||
bool isInitialized;
|
||||
QMetaObject::invokeMethod(spec.plugin, "isInitialized",
|
||||
@@ -323,7 +323,7 @@ void tst_PluginSpec::initializeExtensions()
|
||||
{
|
||||
Internal::PluginSpecPrivate spec(0);
|
||||
QVERIFY(spec.read(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/") + libraryName(QLatin1String("test"))));
|
||||
QVERIFY(spec.resolveDependencies(QList<PluginSpec *>()));
|
||||
QVERIFY(spec.resolveDependencies(QVector<PluginSpec *>()));
|
||||
QVERIFY2(spec.loadLibrary(), qPrintable(spec.errorString));
|
||||
bool isExtensionsInitialized;
|
||||
QVERIFY(spec.initializePlugin());
|
||||
|
||||
Reference in New Issue
Block a user