Allow users to specify Python executable path

Closes #19195.
PR #19644.
This commit is contained in:
Chocobo1 2023-09-28 01:27:48 +08:00 committed by GitHub
parent 529e49aea7
commit b3fda76027
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 77 additions and 16 deletions

View file

@ -99,6 +99,7 @@ namespace
TRACKER_STATUS,
TRACKER_PORT,
TRACKER_PORT_FORWARDING,
PYTHON_EXECUTABLE_PATH,
// libtorrent section
LIBTORRENT_HEADER,
BDECODE_DEPTH_LIMIT,
@ -316,7 +317,8 @@ void AdvancedSettings::saveAdvancedSettings() const
pref->setTrackerPort(m_spinBoxTrackerPort.value());
pref->setTrackerPortForwardingEnabled(m_checkBoxTrackerPortForwarding.isChecked());
session->setTrackerEnabled(m_checkBoxTrackerStatus.isChecked());
// Python executable path
pref->setPythonExecutablePath(Path(m_pythonExecutablePath.text().trimmed()));
// Choking algorithm
session->setChokingAlgorithm(m_comboBoxChokingAlgorithm.currentData().value<BitTorrent::ChokingAlgorithm>());
// Seed choking algorithm
@ -810,6 +812,10 @@ void AdvancedSettings::loadAdvancedSettings()
// Tracker port forwarding
m_checkBoxTrackerPortForwarding.setChecked(pref->isTrackerPortForwardingEnabled());
addRow(TRACKER_PORT_FORWARDING, tr("Enable port forwarding for embedded tracker"), &m_checkBoxTrackerPortForwarding);
// Python executable path
m_pythonExecutablePath.setPlaceholderText(tr("(Auto detect if empty)"));
m_pythonExecutablePath.setText(pref->getPythonExecutablePath().toString());
addRow(PYTHON_EXECUTABLE_PATH, tr("Python executable path (may require restart)"), &m_pythonExecutablePath);
// Choking algorithm
m_comboBoxChokingAlgorithm.addItem(tr("Fixed slots"), QVariant::fromValue(BitTorrent::ChokingAlgorithm::FixedSlots));
m_comboBoxChokingAlgorithm.addItem(tr("Upload rate based"), QVariant::fromValue(BitTorrent::ChokingAlgorithm::RateBased));