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()
|
void SearchPluginManager::update()
|
||||||
{
|
{
|
||||||
QProcess nova;
|
QProcess nova;
|
||||||
nova.setEnvironment(QProcess::systemEnvironment());
|
nova.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
|
||||||
QStringList params;
|
|
||||||
params << Utils::Fs::toNativePath(engineLocation() + "/nova2.py");
|
const QStringList params {Utils::Fs::toNativePath(engineLocation() + "/nova2.py"), "--capabilities"};
|
||||||
params << "--capabilities";
|
|
||||||
nova.start(Utils::ForeignApps::pythonInfo().executableName, params, QIODevice::ReadOnly);
|
nova.start(Utils::ForeignApps::pythonInfo().executableName, params, QIODevice::ReadOnly);
|
||||||
nova.waitForStarted();
|
|
||||||
nova.waitForFinished();
|
nova.waitForFinished();
|
||||||
|
|
||||||
QString capabilities = QString(nova.readAll());
|
QString capabilities = nova.readAll();
|
||||||
QDomDocument xmlDoc;
|
QDomDocument xmlDoc;
|
||||||
if (!xmlDoc.setContent(capabilities)) {
|
if (!xmlDoc.setContent(capabilities)) {
|
||||||
qWarning() << "Could not parse Nova search engine capabilities, msg: " << capabilities.toLocal8Bit().data();
|
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->fullName = engineElem.elementsByTagName("name").at(0).toElement().text();
|
||||||
plugin->url = engineElem.elementsByTagName("url").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();
|
cat = cat.trimmed();
|
||||||
if (!cat.isEmpty())
|
if (!cat.isEmpty())
|
||||||
plugin->supportedCategories << cat;
|
plugin->supportedCategories << cat;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user