From 8881035b7a4299af0bc12cfdcb4f7a850fafd722 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Thu, 1 Apr 2021 12:49:34 +0800 Subject: [PATCH 01/25] Enable Github Actions CI for other branches Since we need to backport some changes. --- .github/workflows/ci.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e4eb4a5e235..79df9e67116 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,11 +4,7 @@ name: GitHub Actions CI # Cache is not used for Ubuntu builds, because it already has all dependencies except # the appropriate libtorrent version, which only takes 3-5 minutes to build from source anyway -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [pull_request, push] env: VCPKG_COMMIT: e4ce66eecfd3e5cca5eac06c971921bf8e37cf88 From 9cb3a6d29e43dbaac4cff4a1685d31640917d081 Mon Sep 17 00:00:00 2001 From: Christoph Rackwitz Date: Fri, 26 Mar 2021 00:07:09 +0100 Subject: [PATCH 02/25] Fix tabChangesFocus attribute in "Edit trackers" dialog --- src/gui/trackerentriesdialog.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/trackerentriesdialog.ui b/src/gui/trackerentriesdialog.ui index 823c4d33360..adee9c8ff26 100644 --- a/src/gui/trackerentriesdialog.ui +++ b/src/gui/trackerentriesdialog.ui @@ -28,9 +28,9 @@ - + true - + From 7006afc6113635d7f77efba1a58a9f8aa76d5698 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 28 Mar 2021 13:15:47 +0800 Subject: [PATCH 03/25] Remove unnecessary URL encoding Fix #14635. --- src/webui/www/private/views/search.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webui/www/private/views/search.html b/src/webui/www/private/views/search.html index e28e83264bd..0d19032b635 100644 --- a/src/webui/www/private/views/search.html +++ b/src/webui/www/private/views/search.html @@ -386,7 +386,7 @@ const downloadSearchTorrent = function() { const urls = []; searchResultsTable.selectedRowsIds().each(function(rowId) { - urls.push(encodeURIComponent(searchResultsTable.rows.get(rowId).full_data.fileUrl)); + urls.push(searchResultsTable.rows.get(rowId).full_data.fileUrl); }); // only proceed if at least 1 row was selected From 5c05bdaa27f7279e9e4328c7a329596fc5af2844 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 31 Mar 2021 00:10:52 +0800 Subject: [PATCH 04/25] Clean up code --- src/base/filesystemwatcher.cpp | 6 +++- src/base/filesystemwatcher.h | 6 ++-- src/webui/api/appcontroller.cpp | 33 +++++++------------- src/webui/www/private/views/preferences.html | 16 +++++----- 4 files changed, 28 insertions(+), 33 deletions(-) diff --git a/src/base/filesystemwatcher.cpp b/src/base/filesystemwatcher.cpp index fd1b19fff05..ccc6bd1d97c 100644 --- a/src/base/filesystemwatcher.cpp +++ b/src/base/filesystemwatcher.cpp @@ -30,6 +30,8 @@ #include +#include + #if defined(Q_OS_MACOS) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) #include #include @@ -42,9 +44,11 @@ #include "base/logger.h" #include "base/utils/fs.h" +using namespace std::chrono_literals; + namespace { - const int WATCH_INTERVAL = 10000; // 10 sec + const std::chrono::duration WATCH_INTERVAL = 10s; const int MAX_PARTIAL_RETRIES = 5; } diff --git a/src/base/filesystemwatcher.h b/src/base/filesystemwatcher.h index 56d5f6dd64c..2f946e0a837 100644 --- a/src/base/filesystemwatcher.h +++ b/src/base/filesystemwatcher.h @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -39,9 +38,10 @@ * Subclassing QFileSystemWatcher in order to support Network File * System watching (NFS, CIFS) on Linux and Mac OS. */ -class FileSystemWatcher : public QFileSystemWatcher +class FileSystemWatcher final : public QFileSystemWatcher { Q_OBJECT + Q_DISABLE_COPY(FileSystemWatcher) public: explicit FileSystemWatcher(QObject *parent = nullptr); @@ -53,7 +53,7 @@ class FileSystemWatcher : public QFileSystemWatcher signals: void torrentsAdded(const QStringList &pathList); -protected slots: +private slots: void scanLocalFolder(const QString &path); void processPartialTorrents(); void scanNetworkFolders(); diff --git a/src/webui/api/appcontroller.cpp b/src/webui/api/appcontroller.cpp index 0f82313c97a..3a3c01b0473 100644 --- a/src/webui/api/appcontroller.cpp +++ b/src/webui/api/appcontroller.cpp @@ -394,15 +394,14 @@ void AppController::setPreferencesAction() if (hasKey("scan_dirs")) { const QVariantHash nativeDirs = it.value().toHash(); - QVariantHash oldScanDirs = pref->getScanDirs(); + const QVariantHash oldScanDirs = pref->getScanDirs(); QVariantHash scanDirs; ScanFoldersModel *model = ScanFoldersModel::instance(); + for (auto i = nativeDirs.cbegin(); i != nativeDirs.cend(); ++i) { - QString folder = Utils::Fs::toUniformPath(i.key()); - int downloadType; + int downloadType = 0; QString downloadPath; - ScanFoldersModel::PathStatus ec; if (i.value().type() == QVariant::String) { downloadType = ScanFoldersModel::CUSTOM_LOCATION; @@ -411,23 +410,17 @@ void AppController::setPreferencesAction() else { downloadType = i.value().toInt(); - downloadPath = (downloadType == ScanFoldersModel::DEFAULT_LOCATION) ? "Default folder" : "Watch folder"; + downloadPath = (downloadType == ScanFoldersModel::DEFAULT_LOCATION) + ? QLatin1String("Default folder") + : QLatin1String("Watch folder"); } - if (!oldScanDirs.contains(folder)) - ec = model->addPath(folder, static_cast(downloadType), downloadPath); - else - ec = model->updatePath(folder, static_cast(downloadType), downloadPath); - + const QString folder = Utils::Fs::toUniformPath(i.key()); + const ScanFoldersModel::PathStatus ec = !oldScanDirs.contains(folder) + ? model->addPath(folder, static_cast(downloadType), downloadPath) + : model->updatePath(folder, static_cast(downloadType), downloadPath); if (ec == ScanFoldersModel::Ok) - { - scanDirs.insert(folder, (downloadType == ScanFoldersModel::CUSTOM_LOCATION) ? QVariant(downloadPath) : QVariant(downloadType)); - qDebug("New watched folder: %s to %s", qUtf8Printable(folder), qUtf8Printable(downloadPath)); - } - else - { - qDebug("Watched folder %s failed with error %d", qUtf8Printable(folder), ec); - } + scanDirs.insert(folder, ((downloadType == ScanFoldersModel::CUSTOM_LOCATION) ? QVariant(downloadPath) : QVariant(downloadType))); } // Update deleted folders @@ -435,11 +428,9 @@ void AppController::setPreferencesAction() { const QString &folder = i.key(); if (!scanDirs.contains(folder)) - { model->removePath(folder); - qDebug("Removed watched folder %s", qUtf8Printable(folder)); - } } + pref->setScanDirs(scanDirs); } // Email notification upon download completion diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index 8d690dd1daa..d2b28f90f1b 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -1283,7 +1283,7 @@ }; // Downloads tab - const WatchedFoldersTable = new HtmlTable($("watched_folders_tab")); + const watchedFoldersTable = new HtmlTable($("watched_folders_tab")); const updateTempDirEnabled = function() { const isTempDirEnabled = $('temppath_checkbox').getProperty('checked'); @@ -1334,7 +1334,7 @@ + "" + ""; - WatchedFoldersTable.push([myinput, mycb]); + watchedFoldersTable.push([myinput, mycb]); $('cb_watch_' + pos).setProperty('value', sel); if (disableInput) { const elt = $('cb_watch_' + pos); @@ -1349,14 +1349,14 @@ for (let i = 0; i < nb_folders; ++i) { const fpath = $('text_watch_' + i).getProperty('value').trim(); if (fpath.length > 0) { - let other; const sel = $('cb_watch_' + i).getProperty('value').trim(); - if (sel == "other") { + + let other; + if (sel == "other") other = $('cb_watch_txt_' + i).getProperty('value').trim(); - } - else { - other = (sel == "watch_folder") ? 0 : 1; - } + else + other = (sel === "watch_folder") ? 0 : 1; + folders.set(fpath, other); } } From 89a8e07217d24d1c51f674c8e68c052560c8d896 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 31 Mar 2021 01:23:05 +0800 Subject: [PATCH 05/25] Revise folder monitoring functions in WebUI Closes #14241. --- src/webui/www/private/views/preferences.html | 77 ++++++-------------- 1 file changed, 24 insertions(+), 53 deletions(-) diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index d2b28f90f1b..77e9f6b1b09 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -127,22 +127,6 @@ - - - - -
- - - Add -
- - - @@ -1290,30 +1274,10 @@ $('temppath_text').setProperty('disabled', !isTempDirEnabled); }; - const addWatchFolder = function() { - const new_folder = $('new_watch_folder_txt').getProperty('value').trim(); - if (new_folder.length <= 0) return; - - const new_other = $('new_watch_folder_other_txt').getProperty('value').trim(); - if (new_other.length <= 0) return; - - const new_select = $('new_watch_folder_select').getProperty('value').trim(); - - const i = $('watched_folders_tab').getChildren('tbody')[0].getChildren('tr').length; - pushWatchFolder(i, new_folder, new_select, new_other); - - // Clear fields - $('new_watch_folder_txt').setProperty('value', ''); - const elt = $('new_watch_folder_select'); - elt.setProperty('value', 'watch_folder'); - const text = elt.options[elt.selectedIndex].innerHTML; - $('new_watch_folder_other_txt').setProperty('value', text); - }; - - const changeWatchFolderSelect = function(item) { - if (item.value == "other") { + const changeWatchFolderSelect = (item) => { + if (item.value === "other") { item.nextElementSibling.hidden = false; - item.nextElementSibling.value = 'QBT_TR(Type folder here)QBT_TR[CONTEXT=HttpServer]'; + item.nextElementSibling.value = 'QBT_TR(Type folder here)QBT_TR[CONTEXT=ScanFoldersModel]'; item.nextElementSibling.select(); } else { @@ -1323,16 +1287,19 @@ } }; - const pushWatchFolder = function(pos, folder, sel, other) { + const addWatchFolder = (folder = "", sel = "default_folder", other = "") => { + const pos = $('watched_folders_tab').getChildren('tbody')[0].getChildren('tr').length; const myinput = ""; - const disableInput = (sel != "other"); + const disableInput = (sel !== "other"); const mycb = "
" + "" - + "
"; + + "" + + "Add" + + ""; watchedFoldersTable.push([myinput, mycb]); $('cb_watch_' + pos).setProperty('value', sel); @@ -1341,9 +1308,13 @@ other = elt.options[elt.selectedIndex].innerHTML; } $('cb_watch_txt_' + pos).setProperty('value', other); + + // hide previous img + if (pos > 0) + $('addFolderImg_' + (pos - 1)).style.display = "none"; }; - const getWatchedFolders = function() { + const getWatchedFolders = () => { const nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length; const folders = new Hash(); for (let i = 0; i < nb_folders; ++i) { @@ -1352,7 +1323,7 @@ const sel = $('cb_watch_' + i).getProperty('value').trim(); let other; - if (sel == "other") + if (sel === "other") other = $('cb_watch_txt_' + i).getProperty('value').trim(); else other = (sel === "watch_folder") ? 0 : 1; @@ -1663,19 +1634,19 @@ updateExportDirFinEnabled(); // Automatically add torrents from - let i = 0; - for (const folder in pref.scan_dirs) { - let sel; + for (const [folder, folderType] of Object.entries(pref.scan_dirs)) { + let sel = ""; let other = ""; - if (typeof pref.scan_dirs[folder] == "string") { - other = pref.scan_dirs[folder]; - sel = "other"; + if (typeof folderType === "number") { + sel = (folderType === 0) ? "watch_folder" : "default_folder"; } else { - sel = (pref.scan_dirs[folder] == 0) ? "watch_folder" : "default_folder"; + sel = "other"; + other = folderType; } - pushWatchFolder(i++, folder, sel, other); + addWatchFolder(folder, sel, other); } + addWatchFolder(); // Email notification upon download completion $('mail_notification_checkbox').setProperty('checked', pref.mail_notification_enabled); From a590e7139bbf168292581ceaafa43760861489da Mon Sep 17 00:00:00 2001 From: brvphoenix Date: Sat, 3 Apr 2021 19:23:27 +0800 Subject: [PATCH 06/25] WebUI: Fix magnet url from the browser --- src/webui/www/private/scripts/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index 5ee928af45a..4a58f0021fa 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -1177,7 +1177,7 @@ function handleDownloadParam() { if (location.hash.indexOf(downloadHash) !== 0) return; - const url = location.hash.substring(downloadHash.length); + const url = decodeURIComponent(location.hash.substring(downloadHash.length)); // Remove the processed hash from the URL history.replaceState('', document.title, (location.pathname + location.search)); showDownloadPage([url]); From 5c819ee384e39d6d4b42d3e2323755047ccca4dd Mon Sep 17 00:00:00 2001 From: skvenders <79187944+skvenders@users.noreply.github.com> Date: Wed, 31 Mar 2021 03:07:01 +0000 Subject: [PATCH 07/25] Remove contributor Remove contributor as requested: https://github.com/qbittorrent/qBittorrent/pull/14637#issuecomment-808894421 --- src/gui/translators.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/translators.html b/src/gui/translators.html index a7b688832a9..88693e285d9 100644 --- a/src/gui/translators.html +++ b/src/gui/translators.html @@ -44,7 +44,7 @@
  • Serbian: Anaximandar Milet (anaximandar@operamail.com)
  • Slovak: helix84
  • Spanish: Alfredo Monclús (alfrix), Francisco Luque Contreras (frannoe@ya.com), José Antonio Moray moray33(Transifex) and Diego de las Heras(Transifex)
  • -
  • Swedish: Daniel Nylander (po@danielnylander.se), Emil Hammarberg Ooglogput(Transifex) and Jonatan Nyberg jony08(Transifex)
  • +
  • Swedish: Daniel Nylander (po@danielnylander.se) and Emil Hammarberg Ooglogput(Transifex)
  • Turkish: Hasan YILMAZ (iletisim@hedefturkce.com), Erdem Bingöl (erdem84@gmail.com) and Burak Yavuz (BouRock)
  • Ukrainian: Oleh Prypin (blaxpirit@gmail.com)
  • Vietnamese: Anh Phan ppanhh(Transifex)
  • From 482dad00fd22186c338d380b95cb1e1f31f36d1a Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 10 Apr 2021 15:47:03 +0800 Subject: [PATCH 08/25] Fix D-Bus Notification `desktop-entry` field --- src/gui/mainwindow.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index b663dd34b71..2d7c83b1e67 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -1663,8 +1663,7 @@ void MainWindow::showNotificationBaloon(const QString &title, const QString &msg // some inactivity shuts it down. Other DEs, like GNOME, choose // to start their daemons at the session startup and have it sit // idling for the whole session. - QVariantMap hints; - hints["desktop-entry"] = "qBittorrent"; + const QVariantMap hints {{QLatin1String("desktop-entry"), QLatin1String("org.qbittorrent.qBittorrent")}}; QDBusPendingReply reply = notifications.Notify("qBittorrent", 0, "qbittorrent", title, msg, QStringList(), hints, -1); reply.waitForFinished(); From 014df529c5e752653ba947ce7342a442747fa285 Mon Sep 17 00:00:00 2001 From: zhuangzi926 Date: Thu, 15 Apr 2021 21:41:42 +0800 Subject: [PATCH 09/25] Update dyndns register url --- src/base/net/dnsupdater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/net/dnsupdater.cpp b/src/base/net/dnsupdater.cpp index 00737c8bcc4..e7dfb44958b 100644 --- a/src/base/net/dnsupdater.cpp +++ b/src/base/net/dnsupdater.cpp @@ -300,7 +300,7 @@ QUrl DNSUpdater::getRegistrationUrl(const int service) switch (service) { case DNS::DYNDNS: - return {"https://www.dyndns.com/account/services/hosts/add.html"}; + return {"https://account.dyn.com/entrance/"}; case DNS::NOIP: return {"https://www.noip.com/remote-access"}; default: From 6f31ebd8999ab8ff6ce8a5012b72f8bdf0d5f3e9 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Thu, 15 Apr 2021 16:43:18 +0300 Subject: [PATCH 10/25] Allow to specify file indexes in torrents/files API --- src/webui/api/torrentscontroller.cpp | 45 +++++++++++++++++++++++----- src/webui/webapplication.h | 2 +- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index 45edc13e194..98f65895c03 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -106,6 +106,7 @@ const char KEY_PROP_SAVE_PATH[] = "save_path"; const char KEY_PROP_COMMENT[] = "comment"; // File keys +const char KEY_FILE_INDEX[] = "index"; const char KEY_FILE_NAME[] = "name"; const char KEY_FILE_SIZE[] = "size"; const char KEY_FILE_PROGRESS[] = "progress"; @@ -501,6 +502,7 @@ void TorrentsController::webseedsAction() // Returns the files in a torrent in JSON format. // The return value is a JSON-formatted list of dictionaries. // The dictionary keys are: +// - "index": File index // - "name": File name // - "size": File size // - "progress": File progress @@ -517,6 +519,32 @@ void TorrentsController::filesAction() if (!torrent) throw APIError(APIErrorType::NotFound); + const int filesCount = torrent->filesCount(); + QVector fileIndexes; + const auto idxIt = params().constFind(QLatin1String("indexes")); + if (idxIt != params().cend()) + { + const QStringList indexStrings = idxIt.value().split('|'); + fileIndexes.reserve(indexStrings.size()); + std::transform(indexStrings.cbegin(), indexStrings.cend(), std::back_inserter(fileIndexes) + , [&filesCount](const QString &indexString) -> int + { + bool ok = false; + const int index = indexString.toInt(&ok); + if (!ok || (index < 0)) + throw APIError(APIErrorType::Conflict, tr("\"%1\" is not a valid file index.").arg(indexString)); + if (index >= filesCount) + throw APIError(APIErrorType::Conflict, tr("Index %1 is out of bounds.").arg(indexString)); + return index; + }); + } + else + { + fileIndexes.reserve(filesCount); + for (int i = 0; i < filesCount; ++i) + fileIndexes.append(i); + } + QJsonArray fileList; if (torrent->hasMetadata()) { @@ -524,25 +552,26 @@ void TorrentsController::filesAction() const QVector fp = torrent->filesProgress(); const QVector fileAvailability = torrent->availableFileFractions(); const BitTorrent::TorrentInfo info = torrent->info(); - for (int i = 0; i < torrent->filesCount(); ++i) + for (const int index : asConst(fileIndexes)) { QJsonObject fileDict = { - {KEY_FILE_PROGRESS, fp[i]}, - {KEY_FILE_PRIORITY, static_cast(priorities[i])}, - {KEY_FILE_SIZE, torrent->fileSize(i)}, - {KEY_FILE_AVAILABILITY, fileAvailability[i]} + {KEY_FILE_INDEX, index}, + {KEY_FILE_PROGRESS, fp[index]}, + {KEY_FILE_PRIORITY, static_cast(priorities[index])}, + {KEY_FILE_SIZE, torrent->fileSize(index)}, + {KEY_FILE_AVAILABILITY, fileAvailability[index]} }; - QString fileName = torrent->filePath(i); + QString fileName = torrent->filePath(index); if (fileName.endsWith(QB_EXT, Qt::CaseInsensitive)) fileName.chop(QB_EXT.size()); fileDict[KEY_FILE_NAME] = Utils::Fs::toUniformPath(fileName); - const BitTorrent::TorrentInfo::PieceRange idx = info.filePieces(i); + const BitTorrent::TorrentInfo::PieceRange idx = info.filePieces(index); fileDict[KEY_FILE_PIECE_RANGE] = QJsonArray {idx.first(), idx.last()}; - if (i == 0) + if (index == 0) fileDict[KEY_FILE_IS_SEED] = torrent->isSeed(); fileList.append(fileDict); diff --git a/src/webui/webapplication.h b/src/webui/webapplication.h index 9db7a639c3d..44f8e159e3c 100644 --- a/src/webui/webapplication.h +++ b/src/webui/webapplication.h @@ -43,7 +43,7 @@ #include "base/utils/net.h" #include "base/utils/version.h" -constexpr Utils::Version API_VERSION {2, 8, 1}; +constexpr Utils::Version API_VERSION {2, 8, 2}; class APIController; class WebApplication; From 0140ed356ffda09bbee89241697503293c22eb2f Mon Sep 17 00:00:00 2001 From: Nick Korotysh Date: Sun, 18 Apr 2021 12:06:12 +0300 Subject: [PATCH 11/25] Don't use executable name as CFBundleName value --- dist/mac/Info.plist | 2 +- src/app/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/mac/Info.plist b/dist/mac/Info.plist index 630d5e56821..b1ec9e0c05c 100644 --- a/dist/mac/Info.plist +++ b/dist/mac/Info.plist @@ -47,7 +47,7 @@ CFBundleName - @EXECUTABLE@ + qBittorrent CFBundleIconFile qbittorrent_mac.icns CFBundleInfoDictionaryVersion diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index bb1dc4df6c0..cbef37fa783 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -93,7 +93,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") ) set_target_properties(qbt_app PROPERTIES MACOSX_BUNDLE ON - MACOSX_BUNDLE_BUNDLE_NAME "${EXECUTABLE}" + MACOSX_BUNDLE_BUNDLE_NAME "qBittorrent" MACOSX_BUNDLE_INFO_PLIST ${qBittorrent_BINARY_DIR}/dist/mac/Info.plist ) target_sources(qbt_app PRIVATE From 1f634907552a55962e30b813eed31f6abff611ff Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Tue, 20 Apr 2021 17:41:55 +0300 Subject: [PATCH 12/25] Correctly handle "no enough disk space" error If torrent failed to write, it stops downloading and goes to "upload mode" instead of errored state so it just keeps seeding. Now qBittorrent indicates this state as "errored" and allows the user to manually bring the torrent out of this state. --- src/base/bittorrent/torrentimpl.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index bbc1bde316f..ea3eec4cd16 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -947,7 +947,7 @@ bool TorrentImpl::hasMissingFiles() const bool TorrentImpl::hasError() const { - return static_cast(m_nativeStatus.errc); + return (m_nativeStatus.errc || (m_nativeStatus.flags & lt::torrent_flags::upload_mode)); } bool TorrentImpl::hasFilteredPieces() const @@ -966,7 +966,13 @@ int TorrentImpl::queuePosition() const QString TorrentImpl::error() const { - return QString::fromStdString(m_nativeStatus.errc.message()); + if (m_nativeStatus.errc) + return QString::fromStdString(m_nativeStatus.errc.message()); + + if (m_nativeStatus.flags & lt::torrent_flags::upload_mode) + return tr("There's not enough space on disk. Torrent is currently in \"upload only\" mode."); + + return {}; } qlonglong TorrentImpl::totalDownload() const @@ -1525,7 +1531,10 @@ void TorrentImpl::pause() void TorrentImpl::resume(const TorrentOperatingMode mode) { if (hasError()) + { m_nativeHandle.clear_error(); + m_nativeHandle.unset_flags(lt::torrent_flags::upload_mode); + } m_operatingMode = mode; @@ -1748,6 +1757,9 @@ void TorrentImpl::handleSaveResumeDataAlert(const lt::save_resume_data_alert *p) m_ltAddTorrentParams.added_time = addedTime().toSecsSinceEpoch(); + // We shouldn't save upload_mode flag to allow torrent operate normally on next run + m_ltAddTorrentParams.flags &= ~lt::torrent_flags::upload_mode; + if (m_maintenanceJob == MaintenanceJob::HandleMetadata) { m_ltAddTorrentParams.have_pieces.clear(); From ea82962c5d4506362daf7b001aacec2bdc1bc005 Mon Sep 17 00:00:00 2001 From: Nick Korotysh Date: Fri, 23 Apr 2021 02:24:00 +0300 Subject: [PATCH 13/25] Improve Info.plist generation with CMake - drop configure_file() and file(GENERATE) calls - fill missed MACOSX_DEPLOYMENT_TARGET variable --- dist/mac/Info.plist | 2 +- src/app/CMakeLists.txt | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/dist/mac/Info.plist b/dist/mac/Info.plist index b1ec9e0c05c..6465acb0fd8 100644 --- a/dist/mac/Info.plist +++ b/dist/mac/Info.plist @@ -57,7 +57,7 @@ CFBundleShortVersionString 4.3.4.1 CFBundleExecutable - @EXECUTABLE@ + ${EXECUTABLE_NAME} CFBundleIdentifier org.qbittorrent.qBittorrent LSMinimumSystemVersion diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index cbef37fa783..69e65208e4e 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -83,18 +83,14 @@ set_source_files_properties( ) if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") - # substitute @EXECUTABLE@ in dist/mac/Info.plist - get_target_property(EXECUTABLE qbt_app OUTPUT_NAME) - configure_file(${qBittorrent_SOURCE_DIR}/dist/mac/Info.plist - ${qBittorrent_BINARY_DIR}/dist/mac/pregen.plist @ONLY) - file(GENERATE - OUTPUT ${qBittorrent_BINARY_DIR}/dist/mac/Info.plist - INPUT ${qBittorrent_BINARY_DIR}/dist/mac/pregen.plist - ) + # provide variables for substitution in dist/mac/Info.plist + get_target_property(EXECUTABLE_NAME qbt_app OUTPUT_NAME) + # This variable name should be changed once qmake is no longer used. Refer to the discussion in PR #14813 + set(MACOSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET}) set_target_properties(qbt_app PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_BUNDLE_NAME "qBittorrent" - MACOSX_BUNDLE_INFO_PLIST ${qBittorrent_BINARY_DIR}/dist/mac/Info.plist + MACOSX_BUNDLE_INFO_PLIST ${qBittorrent_SOURCE_DIR}/dist/mac/Info.plist ) target_sources(qbt_app PRIVATE ${QT_TRANSLATIONS} From e6447c8f28d2ace44335c0efc92a3ac17d2ac234 Mon Sep 17 00:00:00 2001 From: jagannatharjun Date: Sat, 24 Apr 2021 18:04:23 +0530 Subject: [PATCH 14/25] Correctly draw progress background with stylesheet fixes #14731 --- src/gui/progressbarpainter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/progressbarpainter.cpp b/src/gui/progressbarpainter.cpp index 1a85b8a8e4f..7b0f5623e46 100644 --- a/src/gui/progressbarpainter.cpp +++ b/src/gui/progressbarpainter.cpp @@ -66,7 +66,7 @@ void ProgressBarPainter::paint(QPainter *painter, const QStyleOptionViewItem &op painter->save(); const QStyle *style = m_dummyProgressBar.style(); - style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter); + style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, option.widget); style->drawControl(QStyle::CE_ProgressBar, &styleOption, painter, &m_dummyProgressBar); painter->restore(); } From 132be7ee9d5395324991abb4ca36e767bb234ba1 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 28 Mar 2021 15:38:30 +0800 Subject: [PATCH 15/25] Move cursor to the next line of end of text Closes #13908. --- src/gui/downloadfromurldialog.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/downloadfromurldialog.cpp b/src/gui/downloadfromurldialog.cpp index fdfad868ca5..1d85a385d8b 100644 --- a/src/gui/downloadfromurldialog.cpp +++ b/src/gui/downloadfromurldialog.cpp @@ -83,7 +83,12 @@ DownloadFromURLDialog::DownloadFromURLDialog(QWidget *parent) if (isDownloadable(str)) uniqueURLs << str; } - m_ui->textUrls->setText(uniqueURLs.values().join('\n')); + + const QString text = uniqueURLs.values().join(QLatin1Char('\n')) + + (!uniqueURLs.isEmpty() ? QLatin1String("\n") : QLatin1String("")); + + m_ui->textUrls->setText(text); + m_ui->textUrls->moveCursor(QTextCursor::End); Utils::Gui::resize(this, m_storeDialogSize); show(); From 86e96b819e901d317032de93bd577608e014409d Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sat, 20 Mar 2021 00:01:29 +0200 Subject: [PATCH 16/25] Clarify that the license is GPLv2+ Regarding this license clarification there are 3 commits of interest (commits A, B, C). Before commit A the COPYING file contained only the text of the GPLv2 license, while all source files had a license block at the top saying that they are under the terms of "GPLv2 or later". With commit A there was a temporary change to GPLv3. The COPYING file contained only the text of the GPLv3 license, while all source files had a license block at the top saying that they are under the terms of "GPLv3 or later". Then with commit B the COPYING file and the license block of the source files was reverted to their state before commit A. Afterwards, with commit C a license summary(or clarification) block was put at the top of the COPYING file. This block indicated that the license was GPLv2 without having the "or later" clause and it also included the OpenSSL exception. However, the license block of each source file continued to contain the "or later" clause which was not removed. The same license block continues to exist in all current source files. Thus it is concluded that the ommision of the "or later" clause with commit C in the COPYING file was accidental. OR ALTERNATIVELY (OR IN ADDITION) At the time commit C was made Christophe Dumez was not the sole contributor. There is no record that the other contributors agreed with the supposed GPLv2 only change or that there was a Contributor License Agreement, transfering their rights to him. Thus making his license change decision invalid/void/illegal. Commit A: 54f9375b325cc03f8d5da9abbf6c4e25e8ee698f Commit B: 8df61db644a7fcb19170d60da3b7b5297215439c Commit C: 9835af49627e65d314668387b6ec9d029707c186 --- AUTHORS | 16 ++++++++++------ COPYING | 7 +++++-- src/gui/gpl.html | 4 ++-- src/webui/www/private/views/about.html | 4 ++-- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/AUTHORS b/AUTHORS index 21107440ee3..cd070cabadc 100644 --- a/AUTHORS +++ b/AUTHORS @@ -17,19 +17,23 @@ Contributors: * Nick Tiskov Code from other projects: -* files src/qtsingleapplication/* src/lineedit/* +* files src/app/qtlocalpeer/* copyright: Nokia Corporation - license: LGPL + license: mixed -* files src/ico.cpp src/ico.h - copyright: Malte Starostik - license: LGPL +* files src/gui/lineedit.* + copyright: Trolltech ASA + license: custom * files src/search_engine/socks.py copyright: Dan Haim license: BSD -* file src/stacktrace_win.h +* file src/app/stacktrace.h + copyright: Timo Bingmann from http://idlebox.net/ + license: WTFPL v2.0 + +* file src/app/stacktrace_win.h copyright: Quassel Project license: GPLv2/3 diff --git a/COPYING b/COPYING index 3a486c265e7..0afd58567c4 100644 --- a/COPYING +++ b/COPYING @@ -1,5 +1,6 @@ -qBittorrent is licensed under the GNU General Public License version 2 with the -addition of the following special exception: +qBittorrent is licensed under the GNU General Public License either version 2, +or (at your option) any later version with the addition of the following +special exception: In addition, as a special exception, the copyright holders give permission to link this program with the OpenSSL project's "OpenSSL" library (or with @@ -10,6 +11,8 @@ modify file(s), you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. +See also the AUTHORS file + ---------- GNU GENERAL PUBLIC LICENSE diff --git a/src/gui/gpl.html b/src/gui/gpl.html index 4c9c80da2ca..6ad30e85262 100644 --- a/src/gui/gpl.html +++ b/src/gui/gpl.html @@ -5,8 +5,8 @@ License -

    qBittorrent is licensed under the GNU General Public License version 2 with the -addition of the following special exception:

    +

    qBittorrent is licensed under the GNU General Public License either version 2, +or (at your option) any later version with the addition of the following special exception:

    In addition, as a special exception, the copyright holders give permission to link this program with the OpenSSL project's "OpenSSL" library (or with diff --git a/src/webui/www/private/views/about.html b/src/webui/www/private/views/about.html index fa9cea9a0f1..92042cb229f 100644 --- a/src/webui/www/private/views/about.html +++ b/src/webui/www/private/views/about.html @@ -130,8 +130,8 @@

    QBT_TR(Original authors)QBT_TR[CONTEXT=HttpServer]