Browse Source

Replace less-efficient QProcess::setEnvironment

Also small refactor
adaptive-webui-19844
Chocobo1 6 years ago
parent
commit
361afb401b
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 13
      src/base/search/searchpluginmanager.cpp

13
src/base/search/searchpluginmanager.cpp

@ -433,15 +433,13 @@ void SearchPluginManager::updateNova() @@ -433,15 +433,13 @@ void SearchPluginManager::updateNova()
void SearchPluginManager::update()
{
QProcess nova;
nova.setEnvironment(QProcess::systemEnvironment());
QStringList params;
params << Utils::Fs::toNativePath(engineLocation() + "/nova2.py");
params << "--capabilities";
nova.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
const QStringList params {Utils::Fs::toNativePath(engineLocation() + "/nova2.py"), "--capabilities"};
nova.start(Utils::ForeignApps::pythonInfo().executableName, params, QIODevice::ReadOnly);
nova.waitForStarted();
nova.waitForFinished();
QString capabilities = QString(nova.readAll());
QString capabilities = nova.readAll();
QDomDocument xmlDoc;
if (!xmlDoc.setContent(capabilities)) {
qWarning() << "Could not parse Nova search engine capabilities, msg: " << capabilities.toLocal8Bit().data();
@ -466,7 +464,8 @@ void SearchPluginManager::update() @@ -466,7 +464,8 @@ void SearchPluginManager::update()
plugin->fullName = engineElem.elementsByTagName("name").at(0).toElement().text();
plugin->url = engineElem.elementsByTagName("url").at(0).toElement().text();
foreach (QString cat, engineElem.elementsByTagName("categories").at(0).toElement().text().split(" ")) {
const auto categories = engineElem.elementsByTagName("categories").at(0).toElement().text().split(' ');
for (QString cat : categories) {
cat = cat.trimmed();
if (!cat.isEmpty())
plugin->supportedCategories << cat;

Loading…
Cancel
Save