mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
Replace less-efficient QProcess::setEnvironment
Also small refactor
This commit is contained in:
parent
ad5c88be3d
commit
361afb401b
@ -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()
|
||||
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…
x
Reference in New Issue
Block a user