Index: kdevplatform/project/tests/abstractfilemanagerpluginimportbenchmark.cpp =================================================================== --- kdevplatform/project/tests/abstractfilemanagerpluginimportbenchmark.cpp +++ kdevplatform/project/tests/abstractfilemanagerpluginimportbenchmark.cpp @@ -17,19 +17,26 @@ Boston, MA 02110-1301, USA. */ +#include +#include +#include + #include #include +#include + #include #include #include +#include #include #include #include -#include +#include #include #include #include @@ -46,9 +53,10 @@ Q_OBJECT public: AbstractFileManagerPluginImportBenchmark(AbstractFileManagerPlugin* manager, const QString& path, - QObject* parent) - : QObject(parent) + TestCore* core) + : QObject(core) , m_out(stdout) + , m_core(core) { m_manager = manager; m_project = new TestProject(Path(path)); @@ -58,6 +66,16 @@ { m_projectNumber = s_numBenchmarksRunning++; m_out << "Starting import of project " << m_project->path().toLocalFile() << endl; + ProjectController *projectController = qobject_cast(m_core->projectController()); + if (projectController) { + projectController->addProject(m_project); + } else { + // warn that something apparently changed and attempt to activate + // the Project Filter by sending the appropriate signal directly. + qWarning() << "not a ProjectController instance:" << m_core->projectController(); + qWarning() << "emulating the class to set up the Project Filter"; + emit m_core->projectController()->projectAboutToBeOpened(m_project); + } m_timer.start(); auto root = m_manager->import(m_project); int elapsed = m_timer.elapsed(); @@ -75,6 +93,7 @@ QElapsedTimer m_timer; int m_projectNumber; QTextStream m_out; + TestCore* m_core; static int s_numBenchmarksRunning; @@ -86,8 +105,9 @@ { Q_UNUSED(job); int elapsed = m_timer.elapsed(); - m_out << "importing project " << m_projectNumber << " took " - << elapsed / 1000.0 << " seconds" << endl; + m_out << "importing " << m_project->fileSet().size() + << " items into project #" << m_projectNumber + << " took " << elapsed / 1000.0 << " seconds" << endl; s_numBenchmarksRunning -= 1; if (s_numBenchmarksRunning <= 0) { @@ -106,7 +126,7 @@ qWarning() << "Usage:" << argv[0] << "projectDir1 [...projectDirN]"; return 1; } - QCoreApplication app(argc, argv); + QApplication app(argc, argv); QTextStream qout(stdout); // measure the total test time, this provides an indication // of overhead and how well multiple projects are imported in parallel @@ -117,7 +137,9 @@ QElapsedTimer runTimer; AutoTestShell::init({"no plugins"}); - auto core = TestCore::initialize(Core::NoUi); + auto core = TestCore::initialize(); + // attempt to load the "Project Filter" plugin; + core->pluginController()->allPluginsForExtension(QStringLiteral("org.kdevelop.IProjectFilter")); auto manager = new AbstractFileManagerPlugin({}, core); const char *kdwMethod[] = {"FAM", "Inotify", "Stat", "QFSWatch"}; Index: kdevplatform/shell/projectcontroller.h =================================================================== --- kdevplatform/shell/projectcontroller.h +++ kdevplatform/shell/projectcontroller.h @@ -46,6 +46,8 @@ class ContextMenuExtension; class IPlugin; +class AbstractFileManagerPluginImportBenchmark; + class KDEVPLATFORMSHELL_EXPORT IProjectDialogProvider : public QObject { Q_OBJECT @@ -161,6 +163,8 @@ private: const QScopedPointer d; friend class ProjectControllerPrivate; +public: + friend class AbstractFileManagerPluginImportBenchmark; }; class ProjectDialogProvider : public IProjectDialogProvider