本文整理汇总了C++中extensionsystem::PluginManager::setGlobalSettings方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginManager::setGlobalSettings方法的具体用法?C++ PluginManager::setGlobalSettings怎么用?C++ PluginManager::setGlobalSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类extensionsystem::PluginManager
的用法示例。
在下文中一共展示了PluginManager::setGlobalSettings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadPluginThread
/*!
* \brief 该函数最初是在子线程中完成的,但是由于在子线程中完成创建对象的任务后,还需要将该对象moveToThread到
* 主线,给很多操作带来不小的麻烦,所以这里还是在主线程中完成的。
* \param[] receiver 用来传输数据
* \return 返回0表示成功
*/
int loadPluginThread(MainApp *receiver)
{
QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope,
QCoreApplication::applicationDirPath() + QLatin1String(SHARE_PATH));
QSettings::setDefaultFormat(QSettings::IniFormat);
QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
QLatin1String(Core::Constants::TOTEM_SETTINGSVARIANT_STR),
QLatin1String("Totem"));
QSettings *globalSettings = new QSettings(QSettings::IniFormat, QSettings::SystemScope,
QLatin1String(Core::Constants::TOTEM_SETTINGSVARIANT_STR),
QLatin1String("Totem"));
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
pm->setFileExtension(QLatin1String(PLUGINSPEC_FILE_EXTENTION));
pm->setGlobalSettings(globalSettings);
pm->setSettings(settings);
QTranslator translator;
QTranslator qtTranslator;
QStringList uiLanguages;
#if (QT_VERSION >= 0x040801) || (QT_VERSION >= 0x040800 && !defined(Q_OS_WIN))
uiLanguages = QLocale::system().uiLanguages();
#else
uiLanguages << QLocale::system().name();
#endif
// QString overrideLanguage = settings->value("General/OverrideLanguage").toString();
// if (!overrideLanguage.isEmpty())
// uiLanguages.prepend(overrideLanguage);
const QString &totemTrPath = QCoreApplication::applicationDirPath()
+ QLatin1String(SHARE_PATH "/translations");
foreach (const QString &locale, uiLanguages)
{
if (translator.load(QLatin1String("totem_") + locale, totemTrPath))
{
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &qtTrFile = QLatin1String("qt_") + locale;
if (qtTranslator.load(qtTrFile, qtTrPath) || qtTranslator.load(qtTrFile, totemTrPath))
{
receiver->app.installTranslator(&translator);
receiver->app.installTranslator(&qtTranslator);
receiver->app.setProperty("qtc_locale", locale);
break;
}
translator.load(QString()); // unload()
}
else if (locale == QLatin1String("C") /* overrideLanguage == "English" */)
{
break;
}
else if (locale.startsWith(QLatin1String("en")) /* "English" is built-in */)
{
break;
}
}
//这里没有考虑MacOS,Unix
QNetworkProxyFactory::setUseSystemConfiguration(true);
//设置插件搜索路径
const QStringList pluginPaths = getPluginPaths();
pm->setPluginPaths(pluginPaths);
//检查核心插件
const PluginSpecSet plugins = pm->plugins();
ExtensionSystem::PluginSpec *coreplugin = 0;
foreach(ExtensionSystem::PluginSpec *spec, plugins)
{
if(spec->name() == QLatin1String(corePluginNameC))
{
coreplugin = spec;
break;
}
}
int status;
if( status = checkPlugin(coreplugin, QLatin1String(corePluginNameC)))//如果核心插件检查有问题
{
return status;
}
//载入皮肤
receiver->loadSkin(defaultQssFileC);
QList<ExtensionSystem::PluginSpec *> queue = pm->loadQueue();
receiver->m_futureInterface->setProgressRange(0, queue.size());
QMetaObject::invokeMethod(receiver, "onStart", Qt::QueuedConnection);
receiver->m_futureInterface->reportStarted();
foreach(ExtensionSystem::PluginSpec *spec, queue)
{
pm->loadPlugin(spec,ExtensionSystem::PluginSpec::Loaded);
receiver->m_futureInterface->setProgressValue(
receiver->m_futureInterface->progressValue() + 1);
}