Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport changes in v4.5.x branch #19205

Merged
merged 6 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions dist/windows/installer-translations/turkish.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ LangString inst_magnet ${LANG_TURKISH} "Magnet bağlantılarını qBittorrent il
;LangString inst_firewall ${LANG_ENGLISH} "Add Windows Firewall rule"
LangString inst_firewall ${LANG_TURKISH} "Windows Güvenlik Duvarı kuralı ekle"
;LangString inst_pathlimit ${LANG_ENGLISH} "Disable Windows path length limit (260 character MAX_PATH limitation, requires Windows 10 1607 or later)"
LangString inst_pathlimit ${LANG_TURKISH} "Windows yol uzunluğu sınırını etkisizleştir (260 karakter MAX_PATH sınırlaması, Windows 10 1607 veya sonrasını gerektirir)"
LangString inst_pathlimit ${LANG_TURKISH} "Windows yol uzunluğu sınırını etkisizleştir (260 karakterlik MAX_PATH sınırlaması, Windows 10 1607 veya sonrasını gerektirir)"
;LangString inst_firewallinfo ${LANG_ENGLISH} "Adding Windows Firewall rule"
LangString inst_firewallinfo ${LANG_TURKISH} "Windows Güvenlik Duvarı kuralı ekleniyor"
;LangString inst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before installing."
LangString inst_warning ${LANG_TURKISH} "qBittorrent çalışıyor. Lütfen yüklemeden önce uygulamayı kapatın."
;LangString inst_uninstall_question ${LANG_ENGLISH} "Current version will be uninstalled. User settings and torrents will remain intact."
LangString inst_uninstall_question ${LANG_TURKISH} "Önceki bir kurulum algılandı. Kullanıcı ayarları silinmeden kaldırılacaktır."
LangString inst_uninstall_question ${LANG_TURKISH} "Şu anki sürüm kaldırılacaktır. Kullanıcı ayarları ve torrent'ler bozulmadan kalacaktır."
;LangString inst_unist ${LANG_ENGLISH} "Uninstalling previous version."
LangString inst_unist ${LANG_TURKISH} "Önceki sürüm kaldırılıyor."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_TURKISH} "qBittorrent'i başlat"
LangString launch_qbt ${LANG_TURKISH} "qBittorrent'i başlat."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_TURKISH} "Bu yükleyici sadece 64-bit Windows sürümlerinde çalışır."
;LangString inst_requires_win7 ${LANG_ENGLISH} "This qBittorrent version requires at least Windows 7."
Expand Down Expand Up @@ -53,10 +53,10 @@ LangString remove_firewall ${LANG_TURKISH} "Windows Güvenlik Duvarı kuralını
;LangString remove_firewallinfo ${LANG_ENGLISH} "Removing Windows Firewall rule"
LangString remove_firewallinfo ${LANG_TURKISH} "Windows Güvenlik Duvarı kuralı kaldırılıyor"
;LangString remove_cache ${LANG_ENGLISH} "Remove torrents and cached data"
LangString remove_cache ${LANG_TURKISH} "Torrentleri ve önbelleklenen verileri kaldır"
LangString remove_cache ${LANG_TURKISH} "Torrent'leri ve önbelleklenen verileri kaldır"
;LangString uninst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before uninstalling."
LangString uninst_warning ${LANG_TURKISH} "qBittorrent çalışıyor. Lütfen kaldırmadan önce uygulamayı kapatın."
;LangString uninst_tor_warn ${LANG_ENGLISH} "Not removing .torrent association. It is associated with:"
LangString uninst_tor_warn ${LANG_TURKISH} ".torrent ilişkilendirmesi kaldırılmıyor. Şununla ilişkilendirildi:"
LangString uninst_tor_warn ${LANG_TURKISH} ".torrent ilişkilendirmesi kaldırılamıyor. Şununla ilişkilendirildi:"
;LangString uninst_mag_warn ${LANG_ENGLISH} "Not removing magnet association. It is associated with:"
LangString uninst_mag_warn ${LANG_TURKISH} "Magnet ilişkilendirmesi kaldırılmıyor. Şununla ilişkilendirildi:"
LangString uninst_mag_warn ${LANG_TURKISH} "Magnet ilişkilendirmesi kaldırılamıyor. Şununla ilişkilendirildi:"
7 changes: 5 additions & 2 deletions src/base/bittorrent/bencoderesumedatastorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "base/utils/fs.h"
#include "base/utils/io.h"
#include "base/utils/string.h"
#include "common.h"
#include "infohash.h"
#include "loadtorrentparams.h"

Expand Down Expand Up @@ -196,7 +197,8 @@ void BitTorrent::BencodeResumeDataStorage::loadQueue(const Path &queueFilename)
BitTorrent::LoadResumeDataResult BitTorrent::BencodeResumeDataStorage::loadTorrentResumeData(const QByteArray &data, const QByteArray &metadata) const
{
lt::error_code ec;
const lt::bdecode_node resumeDataRoot = lt::bdecode(data, ec);
const lt::bdecode_node resumeDataRoot = lt::bdecode(data, ec
, nullptr, BENCODE_DEPTH_LIMIT, BENCODE_TOKEN_LIMIT);
if (ec)
return nonstd::make_unexpected(tr("Cannot parse resume data: %1").arg(QString::fromStdString(ec.message())));

Expand Down Expand Up @@ -263,7 +265,8 @@ BitTorrent::LoadResumeDataResult BitTorrent::BencodeResumeDataStorage::loadTorre

if (!metadata.isEmpty())
{
const lt::bdecode_node torentInfoRoot = lt::bdecode(metadata, ec);
const lt::bdecode_node torentInfoRoot = lt::bdecode(metadata, ec
, nullptr, BENCODE_DEPTH_LIMIT, BENCODE_TOKEN_LIMIT);
if (ec)
return nonstd::make_unexpected(tr("Cannot parse torrent info: %1").arg(QString::fromStdString(ec.message())));

Expand Down
6 changes: 5 additions & 1 deletion src/base/bittorrent/common.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2020 Vladimir Golovnev <[email protected]>
* Copyright (C) 2020-2023 Vladimir Golovnev <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -33,3 +33,7 @@
#include "base/global.h"

inline const QString QB_EXT = u".!qB"_qs;

inline const int MAX_TORRENT_SIZE = 100 * 1024 * 1024; // 100 MiB
inline const int BENCODE_DEPTH_LIMIT = 100;
inline const int BENCODE_TOKEN_LIMIT = 10'000'000;
9 changes: 6 additions & 3 deletions src/base/bittorrent/dbresumedatastorage.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2021-2022 Vladimir Golovnev <[email protected]>
* Copyright (C) 2021-2023 Vladimir Golovnev <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -54,6 +54,7 @@
#include "base/profile.h"
#include "base/utils/fs.h"
#include "base/utils/string.h"
#include "common.h"
#include "infohash.h"
#include "loadtorrentparams.h"

Expand Down Expand Up @@ -228,15 +229,17 @@ namespace BitTorrent
const QByteArray bencodedResumeData = query.value(DB_COLUMN_RESUMEDATA.name).toByteArray();

lt::error_code ec;
const lt::bdecode_node resumeDataRoot = lt::bdecode(bencodedResumeData, ec);
const lt::bdecode_node resumeDataRoot = lt::bdecode(bencodedResumeData, ec
, nullptr, BENCODE_DEPTH_LIMIT, BENCODE_TOKEN_LIMIT);

lt::add_torrent_params &p = resumeData.ltAddTorrentParams;

p = lt::read_resume_data(resumeDataRoot, ec);

if (const QByteArray bencodedMetadata = query.value(DB_COLUMN_METADATA.name).toByteArray(); !bencodedMetadata.isEmpty())
{
const lt::bdecode_node torentInfoRoot = lt::bdecode(bencodedMetadata, ec);
const lt::bdecode_node torentInfoRoot = lt::bdecode(bencodedMetadata, ec
, nullptr, BENCODE_DEPTH_LIMIT, BENCODE_TOKEN_LIMIT);
p.ti = std::make_shared<lt::torrent_info>(torentInfoRoot, ec);
}

Expand Down
5 changes: 5 additions & 0 deletions src/base/bittorrent/sessionimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4637,6 +4637,11 @@ void SessionImpl::handleTorrentInfoHashChanged(TorrentImpl *torrent, const InfoH
}
}

void SessionImpl::handleTorrentStorageMovingStateChanged(TorrentImpl *torrent)
{
emit torrentsUpdated({torrent});
}

bool SessionImpl::addMoveTorrentStorageJob(TorrentImpl *torrent, const Path &newPath, const MoveStorageMode mode)
{
Q_ASSERT(torrent);
Expand Down
1 change: 1 addition & 0 deletions src/base/bittorrent/sessionimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ namespace BitTorrent
void handleTorrentUrlSeedsRemoved(TorrentImpl *const torrent, const QVector<QUrl> &urlSeeds);
void handleTorrentResumeDataReady(TorrentImpl *const torrent, const LoadTorrentParams &data);
void handleTorrentInfoHashChanged(TorrentImpl *torrent, const InfoHash &prevInfoHash);
void handleTorrentStorageMovingStateChanged(TorrentImpl *torrent);

bool addMoveTorrentStorageJob(TorrentImpl *torrent, const Path &newPath, MoveStorageMode mode);

Expand Down
11 changes: 9 additions & 2 deletions src/base/bittorrent/torrentimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1745,8 +1745,12 @@ void TorrentImpl::moveStorage(const Path &newPath, const MoveStorageMode mode)

if (m_session->addMoveTorrentStorageJob(this, newPath, mode))
{
m_storageIsMoving = true;
updateState();
if (!m_storageIsMoving)
{
m_storageIsMoving = true;
updateState();
m_session->handleTorrentStorageMovingStateChanged(this);
}
}
}

Expand Down Expand Up @@ -1778,6 +1782,9 @@ void TorrentImpl::handleMoveStorageJobFinished(const Path &path, const bool hasO

if (!m_storageIsMoving)
{
updateState();
m_session->handleTorrentStorageMovingStateChanged(this);

if (m_hasMissingFiles)
{
// it can be moved to the proper location
Expand Down
8 changes: 3 additions & 5 deletions src/base/bittorrent/torrentinfo.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2015 Vladimir Golovnev <[email protected]>
* Copyright (C) 2015-2023 Vladimir Golovnev <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -45,6 +45,7 @@
#include "base/utils/fs.h"
#include "base/utils/io.h"
#include "base/utils/misc.h"
#include "common.h"
#include "infohash.h"
#include "trackerentry.h"

Expand Down Expand Up @@ -91,12 +92,9 @@ nonstd::expected<TorrentInfo, QString> TorrentInfo::load(const QByteArray &data)
{
// 2-step construction to overcome default limits of `depth_limit` & `token_limit` which are
// used in `torrent_info()` constructor
const int depthLimit = 100;
const int tokenLimit = 10000000;

lt::error_code ec;
const lt::bdecode_node node = lt::bdecode(data, ec
, nullptr, depthLimit, tokenLimit);
, nullptr, BENCODE_DEPTH_LIMIT, BENCODE_TOKEN_LIMIT);
if (ec)
return nonstd::make_unexpected(QString::fromStdString(ec.message()));

Expand Down
2 changes: 0 additions & 2 deletions src/base/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
#define QBT_APP_64BIT
#endif

inline const int MAX_TORRENT_SIZE = 100 * 1024 * 1024; // 100 MiB

template <typename T>
constexpr typename std::add_const_t<T> &asConst(T &t) noexcept { return t; }

Expand Down
1 change: 1 addition & 0 deletions src/gui/addnewtorrentdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <QUrl>
#include <QVector>

#include "base/bittorrent/common.h"
#include "base/bittorrent/downloadpriority.h"
#include "base/bittorrent/infohash.h"
#include "base/bittorrent/magneturi.h"
Expand Down
2 changes: 1 addition & 1 deletion src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ void MainWindow::createKeyboardShortcuts()
// Keyboard shortcuts slots
void MainWindow::displayTransferTab() const
{
m_tabs->setCurrentWidget(m_transferListWidget);
m_tabs->setCurrentWidget(m_splitter);
}

void MainWindow::displaySearchTab()
Expand Down
3 changes: 2 additions & 1 deletion src/gui/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,9 @@ void OptionsDialog::loadDownloadsTabOptions()
connect(m_ui->mailNotifUsername, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);
connect(m_ui->mailNotifPassword, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);

connect(m_ui->autoRunBox, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->groupBoxRunOnAdded, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->lineEditRunOnAdded, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);
connect(m_ui->groupBoxRunOnFinished, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->lineEditRunOnFinished, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);
connect(m_ui->autoRunConsole, &QCheckBox::toggled, this, &ThisType::enableApplyButton);
}
Expand Down
1 change: 1 addition & 0 deletions src/gui/torrentcontenttreeview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ TorrentContentTreeView::TorrentContentTreeView(QWidget *parent)
: QTreeView(parent)
{
setExpandsOnDoubleClick(false);
setUniformRowHeights(true);
header()->setFirstSectionMovable(true);
}

Expand Down
Loading