mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-29 03:38:05 -06:00
Move related functions to Utils::Python
This commit is contained in:
committed by
sledgehammer999
parent
bfad14d552
commit
54f080b755
@@ -46,6 +46,7 @@
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/profile.h"
|
||||
#include "base/utils/foreignapps.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "searchdownloadhandler.h"
|
||||
@@ -63,7 +64,7 @@ namespace
|
||||
QPointer<SearchPluginManager> SearchPluginManager::m_instance = nullptr;
|
||||
|
||||
SearchPluginManager::SearchPluginManager()
|
||||
: m_updateUrl(QString("http://searchplugins.qbittorrent.org/%1/engines/").arg(Utils::Misc::pythonVersion() >= 3 ? "nova3" : "nova"))
|
||||
: m_updateUrl(QString("http://searchplugins.qbittorrent.org/%1/engines/").arg(Utils::ForeignApps::Python::pythonVersion() >= 3 ? "nova3" : "nova"))
|
||||
{
|
||||
Q_ASSERT(!m_instance); // only one instance is allowed
|
||||
m_instance = this;
|
||||
@@ -322,7 +323,7 @@ QString SearchPluginManager::pluginsLocation()
|
||||
QString SearchPluginManager::engineLocation()
|
||||
{
|
||||
QString folder = "nova";
|
||||
if (Utils::Misc::pythonVersion() >= 3)
|
||||
if (Utils::ForeignApps::Python::pythonVersion() >= 3)
|
||||
folder = "nova3";
|
||||
const QString location = Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Data) + folder);
|
||||
QDir locationDir(location);
|
||||
@@ -370,7 +371,7 @@ void SearchPluginManager::updateNova()
|
||||
|
||||
// create nova directory if necessary
|
||||
QDir searchDir(engineLocation());
|
||||
QString novaFolder = Utils::Misc::pythonVersion() >= 3 ? "searchengine/nova3" : "searchengine/nova";
|
||||
QString novaFolder = Utils::ForeignApps::Python::pythonVersion() >= 3 ? "searchengine/nova3" : "searchengine/nova";
|
||||
QFile packageFile(searchDir.absoluteFilePath("__init__.py"));
|
||||
packageFile.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
packageFile.close();
|
||||
@@ -436,7 +437,7 @@ void SearchPluginManager::update()
|
||||
QStringList params;
|
||||
params << Utils::Fs::toNativePath(engineLocation() + "/nova2.py");
|
||||
params << "--capabilities";
|
||||
nova.start(Utils::Misc::pythonExecutable(), params, QIODevice::ReadOnly);
|
||||
nova.start(Utils::ForeignApps::Python::pythonExecutable(), params, QIODevice::ReadOnly);
|
||||
nova.waitForStarted();
|
||||
nova.waitForFinished();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user