mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
commit
7a6da3d3ce
18 changed files with 79 additions and 148 deletions
|
@ -375,7 +375,7 @@ Session::Session(QObject *parent)
|
|||
m_nativeSession->add_extension(&libt::create_ut_pex_plugin);
|
||||
m_nativeSession->add_extension(&libt::create_smart_ban_plugin);
|
||||
|
||||
logger->addMessage(tr("Peer ID: ") + Utils::String::fromStdString(peerId));
|
||||
logger->addMessage(tr("Peer ID: ") + QString::fromStdString(peerId));
|
||||
logger->addMessage(tr("HTTP User-Agent is '%1'").arg(USER_AGENT));
|
||||
logger->addMessage(tr("DHT support [%1]").arg(isDHTEnabled() ? tr("ON") : tr("OFF")), Log::INFO);
|
||||
logger->addMessage(tr("Local Peer Discovery support [%1]").arg(isLSDEnabled() ? tr("ON") : tr("OFF")), Log::INFO);
|
||||
|
@ -987,11 +987,11 @@ void Session::configure(libtorrent::settings_pack &settingsPack)
|
|||
Net::ProxyConfiguration proxyConfig = proxyManager->proxyConfiguration();
|
||||
if (m_useProxy || (proxyConfig.type != Net::ProxyType::None)) {
|
||||
if (proxyConfig.type != Net::ProxyType::None) {
|
||||
settingsPack.set_str(libt::settings_pack::proxy_hostname, Utils::String::toStdString(proxyConfig.ip));
|
||||
settingsPack.set_str(libt::settings_pack::proxy_hostname, proxyConfig.ip.toStdString());
|
||||
settingsPack.set_int(libt::settings_pack::proxy_port, proxyConfig.port);
|
||||
if (proxyManager->isAuthenticationRequired()) {
|
||||
settingsPack.set_str(libt::settings_pack::proxy_username, Utils::String::toStdString(proxyConfig.username));
|
||||
settingsPack.set_str(libt::settings_pack::proxy_password, Utils::String::toStdString(proxyConfig.password));
|
||||
settingsPack.set_str(libt::settings_pack::proxy_username, proxyConfig.username.toStdString());
|
||||
settingsPack.set_str(libt::settings_pack::proxy_password, proxyConfig.password.toStdString());
|
||||
}
|
||||
settingsPack.set_bool(libt::settings_pack::proxy_peer_connections, isProxyPeerConnectionsEnabled());
|
||||
}
|
||||
|
@ -1066,7 +1066,7 @@ void Session::configure(libtorrent::settings_pack &settingsPack)
|
|||
// Include overhead in transfer limits
|
||||
settingsPack.set_bool(libt::settings_pack::rate_limit_ip_overhead, includeOverheadInLimits());
|
||||
// IP address to announce to trackers
|
||||
settingsPack.set_str(libt::settings_pack::announce_ip, Utils::String::toStdString(announceIP()));
|
||||
settingsPack.set_str(libt::settings_pack::announce_ip, announceIP().toStdString());
|
||||
// Super seeding
|
||||
settingsPack.set_bool(libt::settings_pack::strict_super_seeding, isSuperSeedingEnabled());
|
||||
// * Max Half-open connections
|
||||
|
@ -1134,11 +1134,11 @@ void Session::configure(libtorrent::session_settings &sessionSettings)
|
|||
if (m_useProxy || (proxyConfig.type != Net::ProxyType::None)) {
|
||||
libt::proxy_settings proxySettings;
|
||||
if (proxyConfig.type != Net::ProxyType::None) {
|
||||
proxySettings.hostname = Utils::String::toStdString(proxyConfig.ip);
|
||||
proxySettings.hostname = proxyConfig.ip.toStdString();
|
||||
proxySettings.port = proxyConfig.port;
|
||||
if (proxyManager->isAuthenticationRequired()) {
|
||||
proxySettings.username = Utils::String::toStdString(proxyConfig.username);
|
||||
proxySettings.password = Utils::String::toStdString(proxyConfig.password);
|
||||
proxySettings.username = proxyConfig.username.toStdString();
|
||||
proxySettings.password = proxyConfig.password.toStdString();
|
||||
}
|
||||
proxySettings.proxy_peer_connections = isProxyPeerConnectionsEnabled();
|
||||
}
|
||||
|
@ -1211,7 +1211,7 @@ void Session::configure(libtorrent::session_settings &sessionSettings)
|
|||
// Include overhead in transfer limits
|
||||
sessionSettings.rate_limit_ip_overhead = includeOverheadInLimits();
|
||||
// IP address to announce to trackers
|
||||
sessionSettings.announce_ip = Utils::String::toStdString(announceIP());
|
||||
sessionSettings.announce_ip = announceIP().toStdString();
|
||||
// Super seeding
|
||||
sessionSettings.strict_super_seeding = isSuperSeedingEnabled();
|
||||
// * Max Half-open connections
|
||||
|
@ -1711,7 +1711,7 @@ bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri
|
|||
// Limits
|
||||
p.max_connections = maxConnectionsPerTorrent();
|
||||
p.max_uploads = maxUploadsPerTorrent();
|
||||
p.save_path = Utils::String::toStdString(Utils::Fs::toNativePath(savePath));
|
||||
p.save_path = Utils::Fs::toNativePath(savePath).toStdString();
|
||||
|
||||
m_addingTorrents.insert(hash, addData);
|
||||
// Adding torrent to BitTorrent session
|
||||
|
@ -1799,7 +1799,7 @@ bool Session::loadMetadata(const MagnetUri &magnetUri)
|
|||
p.max_uploads = maxUploadsPerTorrent();
|
||||
|
||||
QString savePath = QString("%1/%2").arg(QDir::tempPath()).arg(hash);
|
||||
p.save_path = Utils::String::toStdString(Utils::Fs::toNativePath(savePath));
|
||||
p.save_path = Utils::Fs::toNativePath(savePath).toStdString();
|
||||
|
||||
// Forced start
|
||||
p.flags &= ~libt::add_torrent_params::flag_paused;
|
||||
|
@ -3330,7 +3330,7 @@ void Session::handleAlert(libt::alert *a)
|
|||
}
|
||||
}
|
||||
catch (std::exception &exc) {
|
||||
qWarning() << "Caught exception in " << Q_FUNC_INFO << ": " << Utils::String::fromStdString(exc.what());
|
||||
qWarning() << "Caught exception in " << Q_FUNC_INFO << ": " << QString::fromStdString(exc.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3412,7 +3412,7 @@ void Session::handleAddTorrentAlert(libt::add_torrent_alert *p)
|
|||
{
|
||||
if (p->error) {
|
||||
qDebug("/!\\ Error: Failed to add torrent!");
|
||||
QString msg = Utils::String::fromStdString(p->message());
|
||||
QString msg = QString::fromStdString(p->message());
|
||||
Logger::instance()->addMessage(tr("Couldn't add torrent. Reason: %1").arg(msg), Log::WARNING);
|
||||
emit addTorrentFailed(msg);
|
||||
}
|
||||
|
@ -3460,7 +3460,7 @@ void Session::handleFileErrorAlert(libt::file_error_alert *p)
|
|||
// NOTE: Check this function!
|
||||
TorrentHandle *const torrent = m_torrents.value(p->handle.info_hash());
|
||||
if (torrent) {
|
||||
QString msg = Utils::String::fromStdString(p->message());
|
||||
QString msg = QString::fromStdString(p->message());
|
||||
Logger::instance()->addMessage(tr("An I/O error occurred, '%1' paused. %2")
|
||||
.arg(torrent->name()).arg(msg));
|
||||
emit fullDiskError(torrent, msg);
|
||||
|
@ -3469,13 +3469,13 @@ void Session::handleFileErrorAlert(libt::file_error_alert *p)
|
|||
|
||||
void Session::handlePortmapWarningAlert(libt::portmap_error_alert *p)
|
||||
{
|
||||
Logger::instance()->addMessage(tr("UPnP/NAT-PMP: Port mapping failure, message: %1").arg(Utils::String::fromStdString(p->message())), Log::CRITICAL);
|
||||
Logger::instance()->addMessage(tr("UPnP/NAT-PMP: Port mapping failure, message: %1").arg(QString::fromStdString(p->message())), Log::CRITICAL);
|
||||
}
|
||||
|
||||
void Session::handlePortmapAlert(libt::portmap_alert *p)
|
||||
{
|
||||
qDebug("UPnP Success, msg: %s", p->message().c_str());
|
||||
Logger::instance()->addMessage(tr("UPnP/NAT-PMP: Port mapping successful, message: %1").arg(Utils::String::fromStdString(p->message())), Log::INFO);
|
||||
Logger::instance()->addMessage(tr("UPnP/NAT-PMP: Port mapping successful, message: %1").arg(QString::fromStdString(p->message())), Log::INFO);
|
||||
}
|
||||
|
||||
void Session::handlePeerBlockedAlert(libt::peer_blocked_alert *p)
|
||||
|
@ -3518,7 +3518,7 @@ void Session::handlePeerBanAlert(libt::peer_ban_alert *p)
|
|||
|
||||
void Session::handleUrlSeedAlert(libt::url_seed_alert *p)
|
||||
{
|
||||
Logger::instance()->addMessage(tr("URL seed lookup failed for URL: '%1', message: %2").arg(Utils::String::fromStdString(p->url)).arg(Utils::String::fromStdString(p->message())), Log::CRITICAL);
|
||||
Logger::instance()->addMessage(tr("URL seed lookup failed for URL: '%1', message: %2").arg(QString::fromStdString(p->url)).arg(QString::fromStdString(p->message())), Log::CRITICAL);
|
||||
}
|
||||
|
||||
void Session::handleListenSucceededAlert(libt::listen_succeeded_alert *p)
|
||||
|
@ -3632,20 +3632,20 @@ namespace
|
|||
if (ec || (fast.type() != libt::bdecode_node::dict_t)) return false;
|
||||
#endif
|
||||
|
||||
torrentData.savePath = Utils::Fs::fromNativePath(Utils::String::fromStdString(fast.dict_find_string_value("qBt-savePath")));
|
||||
torrentData.ratioLimit = Utils::String::fromStdString(fast.dict_find_string_value("qBt-ratioLimit")).toDouble();
|
||||
torrentData.savePath = Utils::Fs::fromNativePath(QString::fromStdString(fast.dict_find_string_value("qBt-savePath")));
|
||||
torrentData.ratioLimit = QString::fromStdString(fast.dict_find_string_value("qBt-ratioLimit")).toDouble();
|
||||
// **************************************************************************************
|
||||
// Workaround to convert legacy label to category
|
||||
// TODO: Should be removed in future
|
||||
torrentData.category = Utils::String::fromStdString(fast.dict_find_string_value("qBt-label"));
|
||||
torrentData.category = QString::fromStdString(fast.dict_find_string_value("qBt-label"));
|
||||
if (torrentData.category.isEmpty())
|
||||
// **************************************************************************************
|
||||
torrentData.category = Utils::String::fromStdString(fast.dict_find_string_value("qBt-category"));
|
||||
torrentData.name = Utils::String::fromStdString(fast.dict_find_string_value("qBt-name"));
|
||||
torrentData.category = QString::fromStdString(fast.dict_find_string_value("qBt-category"));
|
||||
torrentData.name = QString::fromStdString(fast.dict_find_string_value("qBt-name"));
|
||||
torrentData.hasSeedStatus = fast.dict_find_int_value("qBt-seedStatus");
|
||||
torrentData.disableTempPath = fast.dict_find_int_value("qBt-tempPathDisabled");
|
||||
|
||||
magnetUri = MagnetUri(Utils::String::fromStdString(fast.dict_find_string_value("qBt-magnetUri")));
|
||||
magnetUri = MagnetUri(QString::fromStdString(fast.dict_find_string_value("qBt-magnetUri")));
|
||||
torrentData.addPaused = fast.dict_find_int_value("qBt-paused");
|
||||
torrentData.addForced = fast.dict_find_int_value("qBt-forced");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue