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