From b5fddd54080396e7da61c812dbca386b062ce45b Mon Sep 17 00:00:00 2001 From: thalieht Date: Tue, 20 Jun 2023 07:45:17 +0300 Subject: [PATCH 1/6] Fix transfer list tab hotkey PR #19200. --- src/gui/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 5fd86649cb9..46597fba753 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -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() From 72028be563fb5dc01940d521976a733d16991df0 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Sun, 25 Jun 2023 12:44:33 +0300 Subject: [PATCH 2/6] Don't miss to enable Apply button PR #19221. Closes #19082. --- src/gui/optionsdialog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/optionsdialog.cpp b/src/gui/optionsdialog.cpp index 328815a38fc..5f4774095d4 100644 --- a/src/gui/optionsdialog.cpp +++ b/src/gui/optionsdialog.cpp @@ -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); } From 4497ca4a0e6d04058b66e111d529f1c08c99b4a0 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Sun, 25 Jun 2023 12:45:58 +0300 Subject: [PATCH 3/6] Immediately update torrent status on moving files PR #19220. --- src/base/bittorrent/sessionimpl.cpp | 5 +++++ src/base/bittorrent/sessionimpl.h | 1 + src/base/bittorrent/torrentimpl.cpp | 11 +++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/base/bittorrent/sessionimpl.cpp b/src/base/bittorrent/sessionimpl.cpp index 944322d9063..6680ff95ada 100644 --- a/src/base/bittorrent/sessionimpl.cpp +++ b/src/base/bittorrent/sessionimpl.cpp @@ -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); diff --git a/src/base/bittorrent/sessionimpl.h b/src/base/bittorrent/sessionimpl.h index 45b4bf2d877..9dfb6ff0255 100644 --- a/src/base/bittorrent/sessionimpl.h +++ b/src/base/bittorrent/sessionimpl.h @@ -422,6 +422,7 @@ namespace BitTorrent void handleTorrentUrlSeedsRemoved(TorrentImpl *const torrent, const QVector &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); diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index 01e7f528dc7..423aa26e57f 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -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); + } } } @@ -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 From 6ee6815d240328bc8167bd9bc4ff5288427194e8 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Sun, 2 Jul 2023 11:37:37 +0300 Subject: [PATCH 4/6] Always use the same limits when parse bencoded data PR #19263. --- src/base/bittorrent/bencoderesumedatastorage.cpp | 7 +++++-- src/base/bittorrent/common.h | 6 +++++- src/base/bittorrent/dbresumedatastorage.cpp | 9 ++++++--- src/base/bittorrent/torrentinfo.cpp | 8 +++----- src/base/global.h | 2 -- src/gui/addnewtorrentdialog.cpp | 1 + 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/base/bittorrent/bencoderesumedatastorage.cpp b/src/base/bittorrent/bencoderesumedatastorage.cpp index b6f02ce2223..764f24719e5 100644 --- a/src/base/bittorrent/bencoderesumedatastorage.cpp +++ b/src/base/bittorrent/bencoderesumedatastorage.cpp @@ -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" @@ -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()))); @@ -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()))); diff --git a/src/base/bittorrent/common.h b/src/base/bittorrent/common.h index b9dd6647455..a7526ab9f76 100644 --- a/src/base/bittorrent/common.h +++ b/src/base/bittorrent/common.h @@ -1,6 +1,6 @@ /* * Bittorrent Client using Qt and libtorrent. - * Copyright (C) 2020 Vladimir Golovnev + * Copyright (C) 2020-2023 Vladimir Golovnev * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -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; diff --git a/src/base/bittorrent/dbresumedatastorage.cpp b/src/base/bittorrent/dbresumedatastorage.cpp index 5dec4d7a6e9..c75d192180b 100644 --- a/src/base/bittorrent/dbresumedatastorage.cpp +++ b/src/base/bittorrent/dbresumedatastorage.cpp @@ -1,6 +1,6 @@ /* * Bittorrent Client using Qt and libtorrent. - * Copyright (C) 2021-2022 Vladimir Golovnev + * Copyright (C) 2021-2023 Vladimir Golovnev * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -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" @@ -228,7 +229,8 @@ 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; @@ -236,7 +238,8 @@ namespace BitTorrent 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(torentInfoRoot, ec); } diff --git a/src/base/bittorrent/torrentinfo.cpp b/src/base/bittorrent/torrentinfo.cpp index e2b7533df29..8490bb7af98 100644 --- a/src/base/bittorrent/torrentinfo.cpp +++ b/src/base/bittorrent/torrentinfo.cpp @@ -1,6 +1,6 @@ /* * Bittorrent Client using Qt and libtorrent. - * Copyright (C) 2015 Vladimir Golovnev + * Copyright (C) 2015-2023 Vladimir Golovnev * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -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" @@ -91,12 +92,9 @@ nonstd::expected 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())); diff --git a/src/base/global.h b/src/base/global.h index fdb251b9448..ee6828f63be 100644 --- a/src/base/global.h +++ b/src/base/global.h @@ -35,8 +35,6 @@ #define QBT_APP_64BIT #endif -inline const int MAX_TORRENT_SIZE = 100 * 1024 * 1024; // 100 MiB - template constexpr typename std::add_const_t &asConst(T &t) noexcept { return t; } diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index c6049fded6f..ed492790b1f 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -41,6 +41,7 @@ #include #include +#include "base/bittorrent/common.h" #include "base/bittorrent/downloadpriority.h" #include "base/bittorrent/infohash.h" #include "base/bittorrent/magneturi.h" From 62d87f384b3db02993accda34130427486fb05e6 Mon Sep 17 00:00:00 2001 From: Burak Yavuz Date: Wed, 5 Jul 2023 09:49:00 +0300 Subject: [PATCH 5/6] NSIS: Update Turkish translation Corrected and updated some strings PR #19242. --- dist/windows/installer-translations/turkish.nsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/windows/installer-translations/turkish.nsi b/dist/windows/installer-translations/turkish.nsi index efe92115a22..1c300753578 100644 --- a/dist/windows/installer-translations/turkish.nsi +++ b/dist/windows/installer-translations/turkish.nsi @@ -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." @@ -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:" From 7774020ba8c90cfb605c33effaccf0b3e2b89990 Mon Sep 17 00:00:00 2001 From: gdim47 <114874261+gdim47@users.noreply.github.com> Date: Sun, 2 Jul 2023 11:36:42 +0300 Subject: [PATCH 6/6] Improve performance when scrolling large torrents PR #19255. --- src/gui/torrentcontenttreeview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/torrentcontenttreeview.cpp b/src/gui/torrentcontenttreeview.cpp index 81a90e2eef2..b2288f66ca4 100644 --- a/src/gui/torrentcontenttreeview.cpp +++ b/src/gui/torrentcontenttreeview.cpp @@ -66,6 +66,7 @@ TorrentContentTreeView::TorrentContentTreeView(QWidget *parent) : QTreeView(parent) { setExpandsOnDoubleClick(false); + setUniformRowHeights(true); header()->setFirstSectionMovable(true); }