From 020b49add13f4af04721e0b57889ace2dc5a0053 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Fri, 29 Mar 2024 09:38:54 +0300 Subject: [PATCH 01/12] Prevent app from being closed when disabling system tray icon PR #20627. Closes #20604. --- src/app/application.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/application.cpp b/src/app/application.cpp index 0244e40f1..3026b69b1 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -258,6 +258,7 @@ Application::Application(int &argc, char **argv) setAttribute(Qt::AA_UseHighDpiPixmaps, true); // opt-in to the high DPI pixmap support #endif setQuitOnLastWindowClosed(false); + setQuitLockEnabled(false); QPixmapCache::setCacheLimit(PIXMAP_CACHE_SIZE); #endif From 73cedb6ea169b8f51e3b8590b2b4e79ffe96544e Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 1 Apr 2024 19:36:45 +0800 Subject: [PATCH 02/12] GHA CI: only store cache for master branch Also set a lower cache limit for macOS to prevent cache thrashing. Previously the default was 5G. PR #20640. --- .github/workflows/ci_macos.yaml | 4 +++- .github/workflows/ci_ubuntu.yaml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_macos.yaml b/.github/workflows/ci_macos.yaml index 4b2709516..38b3abce5 100644 --- a/.github/workflows/ci_macos.yaml +++ b/.github/workflows/ci_macos.yaml @@ -49,8 +49,10 @@ jobs: - name: Setup ccache uses: Chocobo1/setup-ccache-action@v1 with: - store_cache: ${{ startsWith(github.ref, 'refs/heads/') }} + store_cache: ${{ github.ref == 'refs/heads/master' }} update_packager_index: false + ccache_options: | + max_size=2G - name: Install boost run: | diff --git a/.github/workflows/ci_ubuntu.yaml b/.github/workflows/ci_ubuntu.yaml index 313275b07..406b3917a 100644 --- a/.github/workflows/ci_ubuntu.yaml +++ b/.github/workflows/ci_ubuntu.yaml @@ -39,7 +39,7 @@ jobs: - name: Setup ccache uses: Chocobo1/setup-ccache-action@v1 with: - store_cache: ${{ startsWith(github.ref, 'refs/heads/') }} + store_cache: ${{ github.ref == 'refs/heads/master' }} update_packager_index: false ccache_options: | max_size=2G From 684a56197487378c643d18597cc79fb3acdb6d5d Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 1 Apr 2024 19:59:26 +0800 Subject: [PATCH 03/12] GHA CI: retry action on failure PR #20641. --- .github/workflows/ci_macos.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_macos.yaml b/.github/workflows/ci_macos.yaml index 38b3abce5..081016246 100644 --- a/.github/workflows/ci_macos.yaml +++ b/.github/workflows/ci_macos.yaml @@ -138,8 +138,16 @@ jobs: if [ "${{ matrix.qbt_gui }}" = "GUI=OFF" ]; then appName="qbittorrent-nox" fi + # package pushd build - macdeployqt "$appName.app" -dmg -no-strip + PACKAGE_RETRY=0 + while [ "$PACKAGE_RETRY" -lt "3" ]; do + if macdeployqt "$appName.app" -dmg -no-strip; then + break + fi + sleep 5s + PACKAGE_RETRY=$((PACKAGE_RETRY + 1)) + done popd # prepare upload folder mkdir upload From a7dfefc2a5558da1936955ea93371fbee46df8df Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Mon, 8 Apr 2024 16:02:26 +0300 Subject: [PATCH 04/12] Fix Enter key behavior in Add new torrent dialog Prevent inappropriate default completer from being used by path edit. PR #20670. Closes #20663. --- src/gui/fspathedit_p.cpp | 11 +++++------ src/gui/fspathedit_p.h | 2 -- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/gui/fspathedit_p.cpp b/src/gui/fspathedit_p.cpp index 1e58002e3..ba6efec12 100644 --- a/src/gui/fspathedit_p.cpp +++ b/src/gui/fspathedit_p.cpp @@ -164,6 +164,7 @@ QValidator::State Private::FileSystemPathValidator::validate(QString &input, int Private::FileLineEdit::FileLineEdit(QWidget *parent) : QLineEdit(parent) { + setCompleter(new QCompleter(this)); connect(this, &QLineEdit::textChanged, this, &FileLineEdit::validateText); } @@ -222,7 +223,7 @@ void Private::FileLineEdit::keyPressEvent(QKeyEvent *e) if ((e->key() == Qt::Key_Space) && (e->modifiers() == Qt::CTRL)) { - if (!m_completer) + if (!m_completerModel) { m_iconProvider = new QFileIconProvider; m_iconProvider->setOptions(QFileIconProvider::DontUseCustomDirectoryIcons); @@ -235,9 +236,7 @@ void Private::FileLineEdit::keyPressEvent(QKeyEvent *e) | (m_completeDirectoriesOnly ? QDir::Dirs : QDir::AllEntries); m_completerModel->setFilter(filters); - m_completer = new QCompleter(this); - m_completer->setModel(m_completerModel); - setCompleter(m_completer); + completer()->setModel(m_completerModel); } m_completerModel->setRootPath(Path(text()).data()); @@ -261,8 +260,8 @@ void Private::FileLineEdit::contextMenuEvent(QContextMenuEvent *event) void Private::FileLineEdit::showCompletionPopup() { - m_completer->setCompletionPrefix(text()); - m_completer->complete(); + completer()->setCompletionPrefix(text()); + completer()->complete(); } void Private::FileLineEdit::validateText() diff --git a/src/gui/fspathedit_p.h b/src/gui/fspathedit_p.h index 153cf4b08..e52face0f 100644 --- a/src/gui/fspathedit_p.h +++ b/src/gui/fspathedit_p.h @@ -37,7 +37,6 @@ #include "base/pathfwd.h" class QAction; -class QCompleter; class QContextMenuEvent; class QFileIconProvider; class QFileSystemModel; @@ -141,7 +140,6 @@ namespace Private static QString warningText(FileSystemPathValidator::TestResult result); QFileSystemModel *m_completerModel = nullptr; - QCompleter *m_completer = nullptr; QAction *m_browseAction = nullptr; QAction *m_warningAction = nullptr; QFileIconProvider *m_iconProvider = nullptr; From db384896b8d394595214ba6c27b337b4c70da623 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 9 Apr 2024 14:12:30 +0800 Subject: [PATCH 05/12] GHA CI: lock to ESLint v8 For unknown reasons, ESLint v9 doesn't work correctly. Migration to ESLint v9 will be done later when it is stable enough. PR #20665. --- src/webui/www/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webui/www/package.json b/src/webui/www/package.json index 6be44e273..e527fed26 100644 --- a/src/webui/www/package.json +++ b/src/webui/www/package.json @@ -10,8 +10,8 @@ "lint": "eslint private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js && stylelint **/*.css && html-validate private public" }, "devDependencies": { - "eslint": "*", - "eslint-plugin-html": "*", + "eslint": "^8", + "eslint-plugin-html": "^8", "html-validate": "*", "js-beautify": "*", "prettier": "*", From 749746e8121a8769d46e0224f222260d21ceff17 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 9 Apr 2024 14:22:05 +0800 Subject: [PATCH 06/12] GHA CI: revise packaging failure detection Fix up 1d221c22e4da53d3f09969ec05fe8ba1c613a07e. PR #20664. --- .github/workflows/ci_macos.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_macos.yaml b/.github/workflows/ci_macos.yaml index 081016246..0b60cf989 100644 --- a/.github/workflows/ci_macos.yaml +++ b/.github/workflows/ci_macos.yaml @@ -142,11 +142,13 @@ jobs: pushd build PACKAGE_RETRY=0 while [ "$PACKAGE_RETRY" -lt "3" ]; do - if macdeployqt "$appName.app" -dmg -no-strip; then + macdeployqt "$appName.app" -dmg -no-strip + if [ -f "$appName.dmg" ]; then break fi - sleep 5s + sleep 5 PACKAGE_RETRY=$((PACKAGE_RETRY + 1)) + echo "Retry $PACKAGE_RETRY..." done popd # prepare upload folder From 40833ca5106fe0c3b3f6411d25a5d0a336bf0c5e Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 15 Apr 2024 12:17:40 +0800 Subject: [PATCH 07/12] Update screenshot URL in appstream metadata Those URL are pointing to our git repo: https://github.com/qbittorrent/qBittorrent-website/tree/723c0df824392d888b4c2590ceca89ed347a5bd3/src/img/screenshots/linux PR #20694. --- dist/unix/org.qbittorrent.qBittorrent.metainfo.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/unix/org.qbittorrent.qBittorrent.metainfo.xml b/dist/unix/org.qbittorrent.qBittorrent.metainfo.xml index c6cfa3ba8..370ddabc0 100644 --- a/dist/unix/org.qbittorrent.qBittorrent.metainfo.xml +++ b/dist/unix/org.qbittorrent.qBittorrent.metainfo.xml @@ -33,19 +33,19 @@ Main window (General tab collapsed) - https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_01.png + https://raw.githubusercontent.com/qbittorrent/qBittorrent-website/2741f2a90854604e268c6bba9e6859aad0103583/src/img/screenshots/linux/1.webp Main window (General tab expanded) - https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_03.png + https://raw.githubusercontent.com/qbittorrent/qBittorrent-website/2741f2a90854604e268c6bba9e6859aad0103583/src/img/screenshots/linux/2.webp Options dialog - https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_04.png + https://raw.githubusercontent.com/qbittorrent/qBittorrent-website/2741f2a90854604e268c6bba9e6859aad0103583/src/img/screenshots/linux/3.webp Search engine - https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_02.png + https://raw.githubusercontent.com/qbittorrent/qBittorrent-website/2741f2a90854604e268c6bba9e6859aad0103583/src/img/screenshots/linux/4.webp sledgehammer999@qbittorrent.org From c1b62e0e61a5bdd79f1c2c4fbefd07aa3fe80501 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 15 Apr 2024 12:42:47 +0800 Subject: [PATCH 08/12] WebUI: fix wrong peer number PR #20695. --- src/webui/www/private/scripts/prop-trackers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webui/www/private/scripts/prop-trackers.js b/src/webui/www/private/scripts/prop-trackers.js index e1c4ddaa0..d808c5de9 100644 --- a/src/webui/www/private/scripts/prop-trackers.js +++ b/src/webui/www/private/scripts/prop-trackers.js @@ -100,7 +100,7 @@ window.qBittorrent.PropTrackers = (function() { tier: (tracker.tier >= 0) ? tracker.tier : "", url: tracker.url, status: status, - peers: tracker.num_peers, + peers: (tracker.num_peers >= 0) ? tracker.num_peers : "QBT_TR(N/A)QBT_TR[CONTEXT=TrackerListWidget]", seeds: (tracker.num_seeds >= 0) ? tracker.num_seeds : "QBT_TR(N/A)QBT_TR[CONTEXT=TrackerListWidget]", leeches: (tracker.num_leeches >= 0) ? tracker.num_leeches : "QBT_TR(N/A)QBT_TR[CONTEXT=TrackerListWidget]", downloaded: (tracker.num_downloaded >= 0) ? tracker.num_downloaded : "QBT_TR(N/A)QBT_TR[CONTEXT=TrackerListWidget]", From 2aa7a7f453dd4c65f1c363b6b6149daf5a55b060 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Thu, 18 Apr 2024 07:59:24 +0300 Subject: [PATCH 09/12] Prevent invalid status filter index from being used PR #20714. Closes #20701. --- src/base/torrentfilter.h | 4 +++- src/gui/transferlistfilters/statusfilterwidget.cpp | 2 +- src/gui/transferlistwidget.cpp | 5 +++-- src/gui/transferlistwidget.h | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/base/torrentfilter.h b/src/base/torrentfilter.h index 3358ef380..4c49d904b 100644 --- a/src/base/torrentfilter.h +++ b/src/base/torrentfilter.h @@ -60,7 +60,9 @@ public: StalledDownloading, Checking, Moving, - Errored + Errored, + + _Count }; // These mean any permutation, including no category / tag. diff --git a/src/gui/transferlistfilters/statusfilterwidget.cpp b/src/gui/transferlistfilters/statusfilterwidget.cpp index 99b00af76..731b4fe52 100644 --- a/src/gui/transferlistfilters/statusfilterwidget.cpp +++ b/src/gui/transferlistfilters/statusfilterwidget.cpp @@ -95,7 +95,7 @@ StatusFilterWidget::StatusFilterWidget(QWidget *parent, TransferListWidget *tran connect(pref, &Preferences::changed, this, &StatusFilterWidget::configure); const int storedRow = pref->getTransSelFilter(); - if (item((storedRow < count()) ? storedRow : 0)->isHidden()) + if (item(((storedRow >= 0) && (storedRow < count())) ? storedRow : 0)->isHidden()) setCurrentRow(TorrentFilter::All, QItemSelectionModel::SelectCurrent); else setCurrentRow(storedRow, QItemSelectionModel::SelectCurrent); diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp index 38300d05c..ff76167f8 100644 --- a/src/gui/transferlistwidget.cpp +++ b/src/gui/transferlistwidget.cpp @@ -1330,9 +1330,10 @@ void TransferListWidget::applyFilter(const QString &name, const TransferListMode m_sortFilterModel->setFilterRegularExpression(QRegularExpression(pattern, QRegularExpression::CaseInsensitiveOption)); } -void TransferListWidget::applyStatusFilter(int f) +void TransferListWidget::applyStatusFilter(const int filterIndex) { - m_sortFilterModel->setStatusFilter(static_cast(f)); + const auto filterType = static_cast(filterIndex); + m_sortFilterModel->setStatusFilter(((filterType >= TorrentFilter::All) && (filterType < TorrentFilter::_Count)) ? filterType : TorrentFilter::All); // Select first item if nothing is selected if (selectionModel()->selectedRows(0).empty() && (m_sortFilterModel->rowCount() > 0)) { diff --git a/src/gui/transferlistwidget.h b/src/gui/transferlistwidget.h index ad9b0f37b..84a965d4e 100644 --- a/src/gui/transferlistwidget.h +++ b/src/gui/transferlistwidget.h @@ -93,7 +93,7 @@ public slots: void previewSelectedTorrents(); void hideQueuePosColumn(bool hide); void applyFilter(const QString &name, const TransferListModel::Column &type); - void applyStatusFilter(int f); + void applyStatusFilter(int filterIndex); void applyCategoryFilter(const QString &category); void applyTagFilter(const QString &tag); void applyTrackerFilterAll(); From 9c3382f0d7ba89cd489bb8144441c107f4108ce5 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Thu, 18 Apr 2024 09:04:06 +0300 Subject: [PATCH 10/12] Add extra offset for dialog frame PR #20715. Closes #20609. --- src/gui/addnewtorrentdialog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index 89133e084..a2d9d49db 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -159,7 +159,8 @@ namespace delta.setY(0); dialogGeometry.translate(delta); - delta = screenGeometry.topLeft() - dialogGeometry.topLeft(); + const QPoint frameOffset {10, 40}; + delta = screenGeometry.topLeft() - dialogGeometry.topLeft() + frameOffset; if (delta.x() < 0) delta.setX(0); if (delta.y() < 0) From 0bbfeeb98761b80d09011c3cfc75785943bff081 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Sat, 20 Apr 2024 11:10:31 +0300 Subject: [PATCH 11/12] Don't overwrite stored layout of main window with incorrect one Prevents overwriting of the stored layout in case the main window was hidden at startup and has not been shown since, because incorrect dimensions can be provided by it in this case. PR #20725. Closes #20720. --- src/gui/mainwindow.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index c7e15e40c..fb01833f1 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -781,8 +781,11 @@ void MainWindow::saveSplitterSettings() const void MainWindow::cleanup() { - saveSettings(); - saveSplitterSettings(); + if (!m_neverShown) + { + saveSettings(); + saveSplitterSettings(); + } // delete RSSWidget explicitly to avoid crash in // handleRSSUnreadCountUpdated() at application shutdown From f86a574b9d7d10d5580f923c871f30f8957c2e8a Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Wed, 24 Apr 2024 09:15:19 +0300 Subject: [PATCH 12/12] Don't forget to resume "missing files" torrent when rechecking PR #20747. --- src/base/bittorrent/torrentimpl.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index 7cab602d7..fea7c3858 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -1519,7 +1519,17 @@ void TorrentImpl::forceRecheck() // an incorrect one during the interval until the cached state is updated in a regular way. m_nativeStatus.state = lt::torrent_status::checking_resume_data; - m_hasMissingFiles = false; + if (m_hasMissingFiles) + { + m_hasMissingFiles = false; + if (!isPaused()) + { + setAutoManaged(m_operatingMode == TorrentOperatingMode::AutoManaged); + if (m_operatingMode == TorrentOperatingMode::Forced) + m_nativeHandle.resume(); + } + } + m_unchecked = false; m_completedFiles.fill(false);