本文整理汇总了C++中extensionsystem::PluginManager::runningTests方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginManager::runningTests方法的具体用法?C++ PluginManager::runningTests怎么用?C++ PluginManager::runningTests使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类extensionsystem::PluginManager
的用法示例。
在下文中一共展示了PluginManager::runningTests方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
if (spec->name() == QString(COREPLUGINSNAME)) {
coreplugin = spec;
break;
}
}
ExtensionSystem::PluginSpec *userplugin = 0;
foreach (ExtensionSystem::PluginSpec *spec, plugins) {
if (spec->name() == QString(USERPLUGINSNAME)) {
userplugin = spec;
break;
}
}
if (!coreplugin) {
const QString reason = QCoreApplication::translate("Application", "Couldn't find 'Core.pluginspec' in %1").arg(qApp->libraryPaths().join("; "));
qWarning() << reason;
// displayError(msgCoreLoadFailure(reason));
return 1;
}
if (!userplugin) {
const QString reason = QCoreApplication::translate("Application", "Couldn't find 'UserManager.pluginspec' in %1").arg(qApp->libraryPaths().join("; "));
qWarning() << reason;
// displayError(msgCoreLoadFailure(reason));
return 1;
}
if (coreplugin->hasError()) {
qWarning() << coreplugin->errorString();
// displayError(msgCoreLoadFailure(coreplugin->errorString()));
return 1;
}
if (userplugin->hasError()) {
qWarning() << userplugin->errorString();
// displayError(msgCoreLoadFailure(coreplugin->errorString()));
return 1;
}
// if (foundAppOptions.contains(QLatin1String(VERSION_OPTION))) {
// printVersion(coreplugin, pluginManager);
// return 0;
// }
// if (foundAppOptions.contains(QLatin1String(HELP_OPTION1))
// || foundAppOptions.contains(QLatin1String(HELP_OPTION2))
// || foundAppOptions.contains(QLatin1String(HELP_OPTION3))
// || foundAppOptions.contains(QLatin1String(HELP_OPTION4))) {
// printHelp(QFileInfo(app.applicationFilePath()).baseName(), pluginManager);
// return 0;
// }
// const bool isFirstInstance = !app.isRunning();
// if (!isFirstInstance && foundAppOptions.contains(QLatin1String(CLIENT_OPTION)))
// return sendArguments(app, pluginManager.arguments()) ? 0 : -1;
// foreach (ExtensionSystem::PluginSpec *spec, plugins) {
// qWarning() << "PlugInSpec" << spec->name() << spec->errorString() << spec->state();
// }
pluginManager.loadPlugins();
if (WarnAllPluginSpecs) {
foreach (ExtensionSystem::PluginSpec *spec, plugins) {
qWarning() << "PluginSpecs :::"<< spec->name() << "hasError:" << spec->hasError() << spec->errorString();
}
}
if (coreplugin->hasError()) {
qWarning() << coreplugin->errorString();
return 1;
}
if (userplugin->hasError()) {
qWarning() << userplugin->errorString();
// displayError(msgCoreLoadFailure(coreplugin->errorString()));
return 1;
}
// if (isFirstInstance) {
// // Set up lock and remote arguments for the first instance only.
// // Silently fallback to unconnected instances for any subsequent
// // instances.
// app.initialize();
// QObject::connect(&app, SIGNAL(messageReceived(QString)), coreplugin->plugin(), SLOT(remoteArgument(QString)));
// }
// QObject::connect(&app, SIGNAL(fileOpenRequest(QString)), coreplugin->plugin(), SLOT(remoteArgument(QString)));
// shutdown plugin manager on the exit
QObject::connect(&app, SIGNAL(aboutToQuit()), &pluginManager, SLOT(shutdown()));
#ifdef WITH_TESTS
// Do this after the event loop has started
if (pluginManager.runningTests())
QTimer::singleShot(100, &pluginManager, SLOT(startTests()));
#endif
int r = app.exec();
// Utils::Log::saveLog();
return r;
}
示例2: main
//.........这里部分代码省略.........
#ifdef LIBRARY_BASENAME
libpath << Utils::applicationPluginsPath(QString(BINARY_NAME), QString(LIBRARY_BASENAME));
#else
libpath << Utils::applicationPluginsPath(QString(BINARY_NAME), "");
#endif
if (libpath.isEmpty())
return 123;
pluginManager.setPluginPaths(libpath);
// Add some debugging information
Utils::Log::logCompilationConfiguration();
// Manage plugin manager options
QStringList arguments = app.arguments(); // adapted arguments list is passed to plugin manager later
QMap<QString, QString> foundAppOptions;
if (arguments.size() > 1) {
QMap<QString, bool> appOptions;
QString errorMessage;
if (!pluginManager.parseOptions(arguments, appOptions, &foundAppOptions, &errorMessage)) {
qWarning() << errorMessage;
qWarning() << HELP_MESSAGE;
return -1;
}
}
const PluginSpecSet plugins = pluginManager.plugins();
ExtensionSystem::PluginSpec *coreplugin = 0;
if (WarnAllPluginSpecs) {
foreach (ExtensionSystem::PluginSpec *spec, plugins) {
qWarning() << "PluginSpecs :::"<< spec->filePath() << spec->name() << spec->version();
}
}
foreach (ExtensionSystem::PluginSpec *spec, plugins) {
if (spec->name() == QString(COREPLUGINSNAME)) {
coreplugin = spec;
break;
}
}
// ExtensionSystem::PluginSpec *userplugin = 0;
// foreach (ExtensionSystem::PluginSpec *spec, plugins) {
// if (spec->name() == QString(USERPLUGINSNAME)) {
// userplugin = spec;
// break;
// }
// }
if (!coreplugin) {
const QString reason = QCoreApplication::translate("Application", "Couldn't find 'Core.pluginspec' in %1").arg(qApp->libraryPaths().join("; "));
qWarning() << reason;
return 1;
}
// if (!userplugin) {
// const QString reason = QCoreApplication::translate("Application", "Couldn't find 'UserManager.pluginspec' in %1").arg(qApp->libraryPaths().join("; "));
// qWarning() << reason;
// return 1;
// }
if (coreplugin->hasError()) {
qWarning() << coreplugin->errorString();
return 1;
}
// if (userplugin->hasError()) {
// qWarning() << userplugin->errorString();
// return 1;
// }
pluginManager.loadPlugins();
if (WarnAllPluginSpecs) {
foreach (ExtensionSystem::PluginSpec *spec, plugins) {
qWarning() << "PluginSpecs :::"<< spec->name() << "hasError:" << spec->hasError() << spec->errorString();
}
}
if (coreplugin->hasError()) {
qWarning() << coreplugin->errorString();
return 1;
}
// if (userplugin->hasError()) {
// qWarning() << userplugin->errorString();
// return 1;
// }
// shutdown plugin manager on the exit
QObject::connect(&app, SIGNAL(aboutToQuit()), &pluginManager, SLOT(shutdown()));
#ifdef WITH_TESTS
// Do this after the event loop has started
if (pluginManager.runningTests())
QTimer::singleShot(100, &pluginManager, SLOT(startTests()));
#endif
int r = app.exec();
// Utils::Log::saveLog();
return r;
}