Aggregation/Utils/ExtensionSystem: Make member functions const/static

readability-make-member-function-const finds lots of member functions
that could be made const. This change just picks getter functions that
really should be const.

readability-convert-member-functions-to-static finds non-static member
functions which do not access this. This change turns most of them
into static ones, but leaves some non static to keep the class API
consistent.

readability-static-accessed-through-instance fixes the places where
the originally non-static, now static functions were called through
instance.

Change-Id: I8cf16c01f7988a7c9d073b5f8ede6a9706b94fb0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2020-11-21 01:04:56 +01:00
parent 5951b26f1a
commit 81f3452e1c
21 changed files with 83 additions and 86 deletions

View File

@@ -413,7 +413,7 @@ static QString filled(const QString &s, int min)
return s + QString(qMax(0, min - s.size()), ' '); return s + QString(qMax(0, min - s.size()), ' ');
} }
QString PluginManager::systemInformation() const QString PluginManager::systemInformation()
{ {
QString result; QString result;
CommandLine qtDiag(HostOsInfo::withExecutableSuffix( CommandLine qtDiag(HostOsInfo::withExecutableSuffix(
@@ -864,7 +864,7 @@ void PluginManagerPrivate::nextDelayedInitialize()
profilingSummary(); profilingSummary();
emit q->initializationDone(); emit q->initializationDone();
#ifdef WITH_TESTS #ifdef WITH_TESTS
if (q->testRunRequested()) if (PluginManager::testRunRequested())
startTests(); startTests();
#endif #endif
} else { } else {

View File

@@ -126,10 +126,10 @@ public:
static bool isInitializationDone(); static bool isInitializationDone();
void remoteArguments(const QString &serializedArguments, QObject *socket); static void remoteArguments(const QString &serializedArguments, QObject *socket);
void shutdown(); static void shutdown();
QString systemInformation() const; static QString systemInformation();
signals: signals:
void objectAdded(QObject *obj); void objectAdded(QObject *obj);

View File

@@ -115,8 +115,6 @@ public:
: m_spec(spec), m_view(view) : m_spec(spec), m_view(view)
{} {}
int columnCount() const { return 4; }
QVariant data(int column, int role) const override QVariant data(int column, int role) const override
{ {
switch (column) { switch (column) {
@@ -226,8 +224,6 @@ public:
appendChild(new PluginItem(spec, view)); appendChild(new PluginItem(spec, view));
} }
int columnCount() const { return 4; }
QVariant data(int column, int role) const override QVariant data(int column, int role) const override
{ {
if (column == NameColumn) { if (column == NameColumn) {

View File

@@ -321,7 +321,7 @@ void ChangeSet::convertToReplace(const EditOp &op, QList<EditOp> *replaceList)
} }
} }
bool ChangeSet::hadErrors() bool ChangeSet::hadErrors() const
{ {
return m_error; return m_error;
} }

View File

@@ -92,7 +92,7 @@ public:
bool copy(int start, int end, int to); bool copy(int start, int end, int to);
bool insert(int pos, const QString &text); bool insert(int pos, const QString &text);
bool hadErrors(); bool hadErrors() const;
void apply(QString *s); void apply(QString *s);
void apply(QTextCursor *textCursor); void apply(QTextCursor *textCursor);

View File

@@ -92,12 +92,12 @@ QStringList DropSupport::mimeTypesForFilePaths()
return QStringList("text/uri-list"); return QStringList("text/uri-list");
} }
bool DropSupport::isFileDrop(QDropEvent *event) const bool DropSupport::isFileDrop(QDropEvent *event)
{ {
return Utils::isFileDrop(event->mimeData()); return Utils::isFileDrop(event->mimeData());
} }
bool DropSupport::isValueDrop(QDropEvent *event) const bool DropSupport::isValueDrop(QDropEvent *event)
{ {
if (const auto internalData = qobject_cast<const DropMimeData *>(event->mimeData())) { if (const auto internalData = qobject_cast<const DropMimeData *>(event->mimeData())) {
return !internalData->values().isEmpty(); return !internalData->values().isEmpty();

View File

@@ -62,8 +62,8 @@ signals:
void valuesDropped(const QList<QVariant> &values, const QPoint &dropPos); void valuesDropped(const QList<QVariant> &values, const QPoint &dropPos);
public: public:
bool isFileDrop(QDropEvent *event) const; static bool isFileDrop(QDropEvent *event);
bool isValueDrop(QDropEvent *event) const; static bool isValueDrop(QDropEvent *event);
protected: protected:
bool eventFilter(QObject *obj, QEvent *event) override; bool eventFilter(QObject *obj, QEvent *event) override;

View File

@@ -158,7 +158,7 @@ void Environment::setupEnglishOutput(QStringList *environment)
} }
FilePath Environment::searchInDirectory(const QStringList &execs, const FilePath &directory, FilePath Environment::searchInDirectory(const QStringList &execs, const FilePath &directory,
QSet<FilePath> &alreadyChecked) const QSet<FilePath> &alreadyChecked)
{ {
const int checkedCount = alreadyChecked.count(); const int checkedCount = alreadyChecked.count();
alreadyChecked.insert(directory); alreadyChecked.insert(directory);

View File

@@ -85,8 +85,8 @@ public:
static void setSystemEnvironment(const Environment &environment); // don't use at all!!! static void setSystemEnvironment(const Environment &environment); // don't use at all!!!
private: private:
FilePath searchInDirectory(const QStringList &execs, const FilePath &directory, static FilePath searchInDirectory(const QStringList &execs, const FilePath &directory,
QSet<FilePath> &alreadyChecked) const; QSet<FilePath> &alreadyChecked);
}; };
class QTCREATOR_UTILS_EXPORT EnvironmentProvider class QTCREATOR_UTILS_EXPORT EnvironmentProvider

View File

@@ -82,7 +82,7 @@ public:
return this == globalMacroExpander()->d ? false : globalMacroExpander()->d->resolveMacro(name, ret, seen); return this == globalMacroExpander()->d ? false : globalMacroExpander()->d->resolveMacro(name, ret, seen);
} }
QString value(const QByteArray &variable, bool *found) QString value(const QByteArray &variable, bool *found) const
{ {
MacroExpander::StringFunction sf = m_map.value(variable); MacroExpander::StringFunction sf = m_map.value(variable);
if (sf) { if (sf) {

View File

@@ -104,14 +104,14 @@ protected:
static QString rightTrimmed(const QString &in); static QString rightTrimmed(const QString &in);
Utils::FilePath absoluteFilePath(const Utils::FilePath &filePath); Utils::FilePath absoluteFilePath(const Utils::FilePath &filePath);
static QString createLinkTarget(const FilePath &filePath, int line, int column); static QString createLinkTarget(const FilePath &filePath, int line, int column);
void addLinkSpecForAbsoluteFilePath(LinkSpecs &linkSpecs, const FilePath &filePath, static void addLinkSpecForAbsoluteFilePath(LinkSpecs &linkSpecs, const FilePath &filePath,
int lineNo, int pos, int len); int lineNo, int pos, int len);
void addLinkSpecForAbsoluteFilePath(LinkSpecs &linkSpecs, const FilePath &filePath, static void addLinkSpecForAbsoluteFilePath(LinkSpecs &linkSpecs, const FilePath &filePath,
int lineNo, const QRegularExpressionMatch &match, int lineNo, const QRegularExpressionMatch &match,
int capIndex); int capIndex);
void addLinkSpecForAbsoluteFilePath(LinkSpecs &linkSpecs, const FilePath &filePath, static void addLinkSpecForAbsoluteFilePath(LinkSpecs &linkSpecs, const FilePath &filePath,
int lineNo, const QRegularExpressionMatch &match, int lineNo, const QRegularExpressionMatch &match,
const QString &capName); const QString &capName);
signals: signals:
void newSearchDir(const Utils::FilePath &dir); void newSearchDir(const Utils::FilePath &dir);

View File

@@ -176,7 +176,7 @@ SettingsAccessor::writeFile(const FilePath &path, const QVariantMap &data) const
SettingsAccessor::ProceedInfo SettingsAccessor::ProceedInfo
SettingsAccessor::reportIssues(const SettingsAccessor::Issue &issue, const FilePath &path, SettingsAccessor::reportIssues(const SettingsAccessor::Issue &issue, const FilePath &path,
QWidget *parent) const QWidget *parent)
{ {
if (!path.exists()) if (!path.exists())
return Continue; return Continue;
@@ -697,7 +697,7 @@ MergingSettingsAccessor::mergeSettings(const SettingsAccessor::RestoreData &main
/*! /*!
* Returns true for housekeeping related keys. * Returns true for housekeeping related keys.
*/ */
bool MergingSettingsAccessor::isHouseKeepingKey(const QString &key) const bool MergingSettingsAccessor::isHouseKeepingKey(const QString &key)
{ {
return key == VERSION_KEY || key == ORIGINAL_VERSION_KEY || key == SETTINGS_ID_KEY; return key == VERSION_KEY || key == ORIGINAL_VERSION_KEY || key == SETTINGS_ID_KEY;
} }

View File

@@ -131,7 +131,7 @@ public:
protected: protected:
// Report errors: // Report errors:
QVariantMap restoreSettings(const FilePath &settingsPath, QWidget *parent) const; QVariantMap restoreSettings(const FilePath &settingsPath, QWidget *parent) const;
ProceedInfo reportIssues(const Issue &issue, const FilePath &path, QWidget *parent) const; static ProceedInfo reportIssues(const Issue &issue, const FilePath &path, QWidget *parent);
virtual QVariantMap preprocessReadSettings(const QVariantMap &data) const; virtual QVariantMap preprocessReadSettings(const QVariantMap &data) const;
virtual QVariantMap prepareToWriteSettings(const QVariantMap &data) const; virtual QVariantMap prepareToWriteSettings(const QVariantMap &data) const;
@@ -294,7 +294,7 @@ protected:
virtual SettingsMergeResult merge(const SettingsMergeData &global, virtual SettingsMergeResult merge(const SettingsMergeData &global,
const SettingsMergeData &local) const = 0; const SettingsMergeData &local) const = 0;
bool isHouseKeepingKey(const QString &key) const; static bool isHouseKeepingKey(const QString &key);
virtual QVariantMap postprocessMerge(const QVariantMap &main, const QVariantMap &secondary, virtual QVariantMap postprocessMerge(const QVariantMap &main, const QVariantMap &secondary,
const QVariantMap &result) const; const QVariantMap &result) const;

View File

@@ -119,7 +119,7 @@ public:
void updatePositionAndShow(bool); void updatePositionAndShow(bool);
void updateFilter(const QString &filterText); void updateFilter(const QString &filterText);
QWidget *currentWidget(); QWidget *currentWidget() const;
int buttonMargin() const; int buttonMargin() const;
void updateButtonGeometry(); void updateButtonGeometry();
@@ -563,7 +563,7 @@ void VariableChooserPrivate::updateFilter(const QString &filterText)
/*! /*!
* \internal * \internal
*/ */
QWidget *VariableChooserPrivate::currentWidget() QWidget *VariableChooserPrivate::currentWidget() const
{ {
if (m_lineEdit) if (m_lineEdit)
return m_lineEdit; return m_lineEdit;

View File

@@ -566,7 +566,7 @@ class WizardProgressPrivate
public: public:
WizardProgressPrivate() = default; WizardProgressPrivate() = default;
bool isNextItem(WizardProgressItem *item, WizardProgressItem *nextItem) const; static bool isNextItem(WizardProgressItem *item, WizardProgressItem *nextItem);
// if multiple paths are possible the empty list is returned // if multiple paths are possible the empty list is returned
QList<WizardProgressItem *> singlePathBetween(WizardProgressItem *fromItem, WizardProgressItem *toItem) const; QList<WizardProgressItem *> singlePathBetween(WizardProgressItem *fromItem, WizardProgressItem *toItem) const;
void updateReachableItems(); void updateReachableItems();
@@ -597,7 +597,7 @@ public:
WizardProgressItem *m_nextShownItem; WizardProgressItem *m_nextShownItem;
}; };
bool WizardProgressPrivate::isNextItem(WizardProgressItem *item, WizardProgressItem *nextItem) const bool WizardProgressPrivate::isNextItem(WizardProgressItem *item, WizardProgressItem *nextItem)
{ {
QHash<WizardProgressItem *, bool> visitedItems; QHash<WizardProgressItem *, bool> visitedItems;
QList<WizardProgressItem *> workingItems = item->nextItems(); QList<WizardProgressItem *> workingItems = item->nextItems();
@@ -767,7 +767,7 @@ void WizardProgress::removePage(int pageId)
item->d_ptr->m_pages.removeOne(pageId); item->d_ptr->m_pages.removeOne(pageId);
} }
QList<int> WizardProgress::pages(WizardProgressItem *item) const QList<int> WizardProgress::pages(WizardProgressItem *item)
{ {
return item->pages(); return item->pages();
} }
@@ -931,7 +931,7 @@ void WizardProgressItem::setNextItems(const QList<WizardProgressItem *> &items)
// check if we create cycle // check if we create cycle
for (int i = 0; i < items.count(); i++) { for (int i = 0; i < items.count(); i++) {
WizardProgressItem *nextItem = items.at(i); WizardProgressItem *nextItem = items.at(i);
if (nextItem == this || d->m_wizardProgress->d_ptr->isNextItem(nextItem, this)) { if (nextItem == this || WizardProgressPrivate::isNextItem(nextItem, this)) {
qWarning("WizardProgress::setNextItems: Setting one of the next items would create a cycle"); qWarning("WizardProgress::setNextItems: Setting one of the next items would create a cycle");
return; return;
} }

View File

@@ -102,7 +102,7 @@ public:
void removePage(int pageId); void removePage(int pageId);
QList<int> pages(WizardProgressItem *item) const; static QList<int> pages(WizardProgressItem *item);
WizardProgressItem *item(int pageId) const; WizardProgressItem *item(int pageId) const;
WizardProgressItem *currentItem() const; WizardProgressItem *currentItem() const;

View File

@@ -142,7 +142,7 @@ EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) :
// item view // item view
if (!qobject_cast<EditorToolBar*>(event->source())) if (!qobject_cast<EditorToolBar*>(event->source()))
event->setDropAction(Qt::CopyAction); event->setDropAction(Qt::CopyAction);
if (event->type() == QDropEvent::DragEnter && !dropSupport->isFileDrop(event)) if (event->type() == QDropEvent::DragEnter && !DropSupport::isFileDrop(event))
return false; // do not accept drops without files return false; // do not accept drops without files
return event->source() != m_toolBar; // do not accept drops on ourselves return event->source() != m_toolBar; // do not accept drops on ourselves
}); });

View File

@@ -790,7 +790,7 @@ void ICore::addPreCloseListener(const std::function<bool ()> &listener)
*/ */
QString ICore::systemInformation() QString ICore::systemInformation()
{ {
QString result = PluginManager::instance()->systemInformation() + '\n'; QString result = PluginManager::systemInformation() + '\n';
result += versionString() + '\n'; result += versionString() + '\n';
result += buildCompatibilityString() + '\n'; result += buildCompatibilityString() + '\n';
#ifdef IDE_REVISION #ifdef IDE_REVISION

View File

@@ -49,8 +49,9 @@ EditorDiagramView::EditorDiagramView(QWidget *parent)
{ {
auto droputils = new Utils::DropSupport( auto droputils = new Utils::DropSupport(
this, this,
[](QDropEvent *event, Utils::DropSupport *dropSupport) [](QDropEvent *event, Utils::DropSupport *)
-> bool { return dropSupport->isFileDrop(event) || dropSupport->isValueDrop(event); }); -> bool { return Utils::DropSupport::isFileDrop(event)
|| Utils::DropSupport::isValueDrop(event); });
connect(droputils, &Utils::DropSupport::filesDropped, connect(droputils, &Utils::DropSupport::filesDropped,
this, &EditorDiagramView::dropFiles); this, &EditorDiagramView::dropFiles);
connect(droputils, &Utils::DropSupport::valuesDropped, connect(droputils, &Utils::DropSupport::valuesDropped,

View File

@@ -77,8 +77,8 @@ static QString pluginFolder(const QLatin1String &folder)
void tst_PluginManager::init() void tst_PluginManager::init()
{ {
m_pm = new PluginManager; m_pm = new PluginManager;
m_pm->setSettings(new QSettings); PluginManager::setSettings(new QSettings);
m_pm->setPluginIID(QLatin1String("plugin")); PluginManager::setPluginIID(QLatin1String("plugin"));
m_objectAdded = new QSignalSpy(m_pm, SIGNAL(objectAdded(QObject*))); m_objectAdded = new QSignalSpy(m_pm, SIGNAL(objectAdded(QObject*)));
m_aboutToRemoveObject = new QSignalSpy(m_pm, SIGNAL(aboutToRemoveObject(QObject*))); m_aboutToRemoveObject = new QSignalSpy(m_pm, SIGNAL(aboutToRemoveObject(QObject*)));
m_pluginsChanged = new QSignalSpy(m_pm, SIGNAL(pluginsChanged())); m_pluginsChanged = new QSignalSpy(m_pm, SIGNAL(pluginsChanged()));
@@ -86,7 +86,7 @@ void tst_PluginManager::init()
void tst_PluginManager::cleanup() void tst_PluginManager::cleanup()
{ {
m_pm->shutdown(); PluginManager::shutdown();
delete m_pm; delete m_pm;
delete m_objectAdded; delete m_objectAdded;
delete m_aboutToRemoveObject; delete m_aboutToRemoveObject;
@@ -97,35 +97,35 @@ void tst_PluginManager::addRemoveObjects()
{ {
QObject *object1 = new QObject; QObject *object1 = new QObject;
QObject *object2 = new QObject; QObject *object2 = new QObject;
QCOMPARE(m_pm->allObjects().size(), 0); QCOMPARE(PluginManager::allObjects().size(), 0);
m_pm->addObject(object1); PluginManager::addObject(object1);
QCOMPARE(m_objectAdded->count(), 1); QCOMPARE(m_objectAdded->count(), 1);
QCOMPARE(m_objectAdded->at(0).first().value<QObject *>(), object1); QCOMPARE(m_objectAdded->at(0).first().value<QObject *>(), object1);
QCOMPARE(m_aboutToRemoveObject->count(), 0); QCOMPARE(m_aboutToRemoveObject->count(), 0);
QVERIFY(m_pm->allObjects().contains(object1)); QVERIFY(PluginManager::allObjects().contains(object1));
QVERIFY(!m_pm->allObjects().contains(object2)); QVERIFY(!PluginManager::allObjects().contains(object2));
QCOMPARE(m_pm->allObjects().size(), 1); QCOMPARE(PluginManager::allObjects().size(), 1);
m_pm->addObject(object2); PluginManager::addObject(object2);
QCOMPARE(m_objectAdded->count(), 2); QCOMPARE(m_objectAdded->count(), 2);
QCOMPARE(m_objectAdded->at(1).first().value<QObject *>(), object2); QCOMPARE(m_objectAdded->at(1).first().value<QObject *>(), object2);
QCOMPARE(m_aboutToRemoveObject->count(), 0); QCOMPARE(m_aboutToRemoveObject->count(), 0);
QVERIFY(m_pm->allObjects().contains(object1)); QVERIFY(PluginManager::allObjects().contains(object1));
QVERIFY(m_pm->allObjects().contains(object2)); QVERIFY(PluginManager::allObjects().contains(object2));
QCOMPARE(m_pm->allObjects().size(), 2); QCOMPARE(PluginManager::allObjects().size(), 2);
m_pm->removeObject(object1); PluginManager::removeObject(object1);
QCOMPARE(m_objectAdded->count(), 2); QCOMPARE(m_objectAdded->count(), 2);
QCOMPARE(m_aboutToRemoveObject->count(), 1); QCOMPARE(m_aboutToRemoveObject->count(), 1);
QCOMPARE(m_aboutToRemoveObject->at(0).first().value<QObject *>(), object1); QCOMPARE(m_aboutToRemoveObject->at(0).first().value<QObject *>(), object1);
QVERIFY(!m_pm->allObjects().contains(object1)); QVERIFY(!PluginManager::allObjects().contains(object1));
QVERIFY(m_pm->allObjects().contains(object2)); QVERIFY(PluginManager::allObjects().contains(object2));
QCOMPARE(m_pm->allObjects().size(), 1); QCOMPARE(PluginManager::allObjects().size(), 1);
m_pm->removeObject(object2); PluginManager::removeObject(object2);
QCOMPARE(m_objectAdded->count(), 2); QCOMPARE(m_objectAdded->count(), 2);
QCOMPARE(m_aboutToRemoveObject->count(), 2); QCOMPARE(m_aboutToRemoveObject->count(), 2);
QCOMPARE(m_aboutToRemoveObject->at(1).first().value<QObject *>(), object2); QCOMPARE(m_aboutToRemoveObject->at(1).first().value<QObject *>(), object2);
QVERIFY(!m_pm->allObjects().contains(object1)); QVERIFY(!PluginManager::allObjects().contains(object1));
QVERIFY(!m_pm->allObjects().contains(object2)); QVERIFY(!PluginManager::allObjects().contains(object2));
QCOMPARE(m_pm->allObjects().size(), 0); QCOMPARE(PluginManager::allObjects().size(), 0);
delete object1; delete object1;
delete object2; delete object2;
} }
@@ -137,22 +137,22 @@ void tst_PluginManager::getObject()
MyClass2 *object2b = new MyClass2; MyClass2 *object2b = new MyClass2;
const QString objectName = QLatin1String("OBJECTNAME"); const QString objectName = QLatin1String("OBJECTNAME");
object2b->setObjectName(objectName); object2b->setObjectName(objectName);
m_pm->addObject(object2); PluginManager::addObject(object2);
QCOMPARE(m_pm->getObject<MyClass11>(), static_cast<MyClass11 *>(0)); QCOMPARE(PluginManager::getObject<MyClass11>(), static_cast<MyClass11 *>(0));
QCOMPARE(m_pm->getObject<MyClass1>(), static_cast<MyClass1 *>(0)); QCOMPARE(PluginManager::getObject<MyClass1>(), static_cast<MyClass1 *>(0));
QCOMPARE(m_pm->getObject<MyClass2>(), object2); QCOMPARE(PluginManager::getObject<MyClass2>(), object2);
m_pm->addObject(object11); PluginManager::addObject(object11);
QCOMPARE(m_pm->getObject<MyClass11>(), object11); QCOMPARE(PluginManager::getObject<MyClass11>(), object11);
QCOMPARE(m_pm->getObject<MyClass1>(), qobject_cast<MyClass1 *>(object11)); QCOMPARE(PluginManager::getObject<MyClass1>(), qobject_cast<MyClass1 *>(object11));
QCOMPARE(m_pm->getObject<MyClass2>(), object2); QCOMPARE(PluginManager::getObject<MyClass2>(), object2);
QCOMPARE(m_pm->getObjectByName(objectName), static_cast<QObject *>(0)); QCOMPARE(PluginManager::getObjectByName(objectName), static_cast<QObject *>(0));
m_pm->addObject(object2b); PluginManager::addObject(object2b);
QCOMPARE(m_pm->getObjectByName(objectName), object2b); QCOMPARE(PluginManager::getObjectByName(objectName), object2b);
QCOMPARE(m_pm->getObject<MyClass2>( QCOMPARE(PluginManager::getObject<MyClass2>(
[&objectName](MyClass2 *obj) { return obj->objectName() == objectName;}), object2b); [&objectName](MyClass2 *obj) { return obj->objectName() == objectName;}), object2b);
m_pm->removeObject(object2); PluginManager::removeObject(object2);
m_pm->removeObject(object11); PluginManager::removeObject(object11);
m_pm->removeObject(object2b); PluginManager::removeObject(object2b);
delete object2; delete object2;
delete object11; delete object11;
delete object2b; delete object2b;
@@ -160,9 +160,9 @@ void tst_PluginManager::getObject()
void tst_PluginManager::circularPlugins() void tst_PluginManager::circularPlugins()
{ {
m_pm->setPluginPaths(QStringList() << pluginFolder(QLatin1String("circularplugins"))); PluginManager::setPluginPaths(QStringList() << pluginFolder(QLatin1String("circularplugins")));
m_pm->loadPlugins(); PluginManager::loadPlugins();
QVector<PluginSpec *> plugins = m_pm->plugins(); QVector<PluginSpec *> plugins = PluginManager::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") {
@@ -182,11 +182,11 @@ void tst_PluginManager::circularPlugins()
void tst_PluginManager::correctPlugins1() void tst_PluginManager::correctPlugins1()
{ {
m_pm->setPluginPaths(QStringList() << pluginFolder(QLatin1String("correctplugins1"))); PluginManager::setPluginPaths(QStringList() << pluginFolder(QLatin1String("correctplugins1")));
m_pm->loadPlugins(); PluginManager::loadPlugins();
bool specError = false; bool specError = false;
bool runError = false; bool runError = false;
foreach (PluginSpec *spec, m_pm->plugins()) { foreach (PluginSpec *spec, PluginManager::plugins()) {
if (spec->hasError()) { if (spec->hasError()) {
qDebug() << spec->filePath(); qDebug() << spec->filePath();
qDebug() << spec->errorString(); qDebug() << spec->errorString();
@@ -199,7 +199,7 @@ void tst_PluginManager::correctPlugins1()
bool plugin1running = false; bool plugin1running = false;
bool plugin2running = false; bool plugin2running = false;
bool plugin3running = false; bool plugin3running = false;
foreach (QObject *obj, m_pm->allObjects()) { foreach (QObject *obj, PluginManager::allObjects()) {
if (obj->objectName() == "MyPlugin1_running") if (obj->objectName() == "MyPlugin1_running")
plugin1running = true; plugin1running = true;
else if (obj->objectName() == "MyPlugin2_running") else if (obj->objectName() == "MyPlugin2_running")

View File

@@ -96,7 +96,7 @@ void tst_PluginSpec::init()
void tst_PluginSpec::initTestCase() void tst_PluginSpec::initTestCase()
{ {
pm = new PluginManager; pm = new PluginManager;
pm->setPluginIID(QLatin1String("plugin")); PluginManager::setPluginIID(QLatin1String("plugin"));
} }
void tst_PluginSpec::cleanupTestCase() void tst_PluginSpec::cleanupTestCase()