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 to v4.6.x branch #20498

Merged
merged 9 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode/
src/gui/geoip/GeoIP.dat
src/gui/geoip/GeoIP.dat.gz
src/qbittorrent
Expand Down
8 changes: 4 additions & 4 deletions dist/windows/installer-translations/french.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
;LangString inst_qbt_req ${LANG_ENGLISH} "qBittorrent (required)"
LangString inst_qbt_req ${LANG_FRENCH} "qBittorrent (requis)"
;LangString inst_desktop ${LANG_ENGLISH} "Create Desktop Shortcut"
LangString inst_desktop ${LANG_FRENCH} "Créer un Raccourci sur le Bureau"
LangString inst_desktop ${LANG_FRENCH} "Créer un raccourci sur le Bureau"
;LangString inst_startmenu ${LANG_ENGLISH} "Create Start Menu Shortcut"
LangString inst_startmenu ${LANG_FRENCH} "Créer un Raccourci dans le Menu Démarrer"
LangString inst_startmenu ${LANG_FRENCH} "Créer un raccourci dans le Menu Démarrer"
;LangString inst_startup ${LANG_ENGLISH} "Start qBittorrent on Windows start up"
LangString inst_startup ${LANG_FRENCH} "Démarrer qBittorrent au démarrage de Windows"
;LangString inst_torrent ${LANG_ENGLISH} "Open .torrent files with qBittorrent"
Expand Down Expand Up @@ -57,6 +57,6 @@ LangString remove_cache ${LANG_FRENCH} "Supprimer les torrents et données en ca
;LangString uninst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before uninstalling."
LangString uninst_warning ${LANG_FRENCH} "qBittorrent est en cours d'exécution. Fermez l'application avant de la désinstaller."
;LangString uninst_tor_warn ${LANG_ENGLISH} "Not removing .torrent association. It is associated with:"
LangString uninst_tor_warn ${LANG_FRENCH} "Ne peut pas supprimer l'association du .torrent. Elle est associée avec :"
LangString uninst_tor_warn ${LANG_FRENCH} "Impossible de supprimer l'association .torrent. Elle est associée avec :"
;LangString uninst_mag_warn ${LANG_ENGLISH} "Not removing magnet association. It is associated with:"
LangString uninst_mag_warn ${LANG_FRENCH} "Ne peut pas supprimer l'association du magnet. Elle est associée avec :"
LangString uninst_mag_warn ${LANG_FRENCH} "Impossible de supprimer l'association magnet. Elle est associée avec :"
2 changes: 1 addition & 1 deletion dist/windows/installer-translations/hungarian.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ LangString inst_requires_64bit ${LANG_HUNGARIAN} "A telepítő csak 64-bites Win
;LangString inst_requires_win7 ${LANG_ENGLISH} "This qBittorrent version requires at least Windows 7."
LangString inst_requires_win7 ${LANG_HUNGARIAN} "A qBittorrent ezen verziójához minimum Windows 7 szükséges."
;LangString inst_requires_win10 ${LANG_ENGLISH} "This installer requires at least Windows 10 (1809) / Windows Server 2019."
LangString inst_requires_win10 ${LANG_HUNGARIAN} "This installer requires at least Windows 10 (1809) / Windows Server 2019."
LangString inst_requires_win10 ${LANG_HUNGARIAN} "A telepítéshez minimum Windows 10 (1809) / Windows Server 2019 szükséges."
;LangString inst_uninstall_link_description ${LANG_ENGLISH} "Uninstall qBittorrent"
LangString inst_uninstall_link_description ${LANG_HUNGARIAN} "qBittorrent eltávolítása"

Expand Down
7 changes: 2 additions & 5 deletions src/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,8 @@ Application::Application(int &argc, char **argv)
Logger::initInstance();

const auto portableProfilePath = Path(QCoreApplication::applicationDirPath()) / DEFAULT_PORTABLE_MODE_PROFILE_DIR;
const bool portableModeEnabled = m_commandLineArgs.profileDir.isEmpty() && portableProfilePath.exists();

const Path profileDir = portableModeEnabled
? portableProfilePath
: m_commandLineArgs.profileDir;
const bool portableModeEnabled = m_commandLineArgs.profileDir.isEmpty() && Utils::Fs::isDir(portableProfilePath);
const Path profileDir = portableModeEnabled ? portableProfilePath : m_commandLineArgs.profileDir;
Profile::initInstance(profileDir, m_commandLineArgs.configurationName,
(m_commandLineArgs.relativeFastresumePaths || portableModeEnabled));

Expand Down
2 changes: 2 additions & 0 deletions src/gui/addnewtorrentdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <functional>

#include <QAction>
#include <QByteArray>
#include <QDateTime>
#include <QDebug>
#include <QDir>
Expand All @@ -41,6 +42,7 @@
#include <QPushButton>
#include <QScreen>
#include <QShortcut>
#include <QSize>
#include <QString>
#include <QUrl>
#include <QVector>
Expand Down
6 changes: 3 additions & 3 deletions src/gui/addnewtorrentdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
#include "base/path.h"
#include "base/settingvalue.h"

class LineEdit;
class TorrentFileGuard;

namespace BitTorrent
{
class InfoHash;
Expand All @@ -54,9 +57,6 @@ namespace Ui
class AddNewTorrentDialog;
}

class LineEdit;
class TorrentFileGuard;

class AddNewTorrentDialog final : public QDialog
{
Q_OBJECT
Expand Down
9 changes: 5 additions & 4 deletions src/gui/desktopintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <chrono>

#include <QtGlobal>
#include <QMenu>
#include <QTimer>

Expand Down Expand Up @@ -300,11 +301,11 @@ QIcon DesktopIntegration::getSystrayIcon() const
icon = UIThemeManager::instance()->getIcon(u"qbittorrent-tray-light"_s);
break;
}
#if ((QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
#ifdef Q_OS_UNIX
// Workaround for invisible tray icon in KDE, https://bugreports.qt.io/browse/QTBUG-53550
return {icon.pixmap(32)};
#else
return icon;
if (qEnvironmentVariable("XDG_CURRENT_DESKTOP").compare(u"KDE", Qt::CaseInsensitive) == 0)
return icon.pixmap(32);
#endif
return icon;
}
#endif // Q_OS_MACOS
21 changes: 21 additions & 0 deletions src/gui/lineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,41 @@

#include "lineedit.h"

#include <chrono>

#include <QAction>
#include <QKeyEvent>
#include <QTimer>

#include "base/global.h"
#include "uithememanager.h"

using namespace std::chrono_literals;

namespace
{
const std::chrono::milliseconds FILTER_INPUT_DELAY {400};
}

LineEdit::LineEdit(QWidget *parent)
: QLineEdit(parent)
, m_delayedTextChangedTimer {new QTimer(this)}
{
auto *action = new QAction(UIThemeManager::instance()->getIcon(u"edit-find"_s), QString(), this);
addAction(action, QLineEdit::LeadingPosition);

setClearButtonEnabled(true);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);

m_delayedTextChangedTimer->setSingleShot(true);
connect(m_delayedTextChangedTimer, &QTimer::timeout, this, [this]
{
emit textChanged(text());
});
connect(this, &QLineEdit::textChanged, this, [this]
{
m_delayedTextChangedTimer->start(FILTER_INPUT_DELAY);
});
}

void LineEdit::keyPressEvent(QKeyEvent *event)
Expand Down
8 changes: 8 additions & 0 deletions src/gui/lineedit.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

#include <QLineEdit>

class QKeyEvent;
class QTimer;

class LineEdit final : public QLineEdit
{
Q_OBJECT
Expand All @@ -39,6 +42,11 @@ class LineEdit final : public QLineEdit
public:
explicit LineEdit(QWidget *parent = nullptr);

signals:
void textChanged(const QString &text);

private:
void keyPressEvent(QKeyEvent *event) override;

QTimer *m_delayedTextChangedTimer = nullptr;
};
1 change: 1 addition & 0 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include <QShortcut>
#include <QSplitter>
#include <QStatusBar>
#include <QString>
#include <QtGlobal>
#include <QTimer>

Expand Down
1 change: 1 addition & 0 deletions src/gui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class QCloseEvent;
class QComboBox;
class QFileSystemWatcher;
class QSplitter;
class QString;
class QTabWidget;
class QTimer;

Expand Down
2 changes: 1 addition & 1 deletion src/gui/search/searchjobwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent)
m_lineEditSearchResultsFilter->setPlaceholderText(tr("Filter search results..."));
m_lineEditSearchResultsFilter->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_lineEditSearchResultsFilter, &QWidget::customContextMenuRequested, this, &SearchJobWidget::showFilterContextMenu);
connect(m_lineEditSearchResultsFilter, &LineEdit::textChanged, this, &SearchJobWidget::filterSearchResults);
m_ui->horizontalLayout->insertWidget(0, m_lineEditSearchResultsFilter);

connect(m_lineEditSearchResultsFilter, &LineEdit::textChanged, this, &SearchJobWidget::filterSearchResults);
connect(m_ui->filterMode, qOverload<int>(&QComboBox::currentIndexChanged)
, this, &SearchJobWidget::updateFilter);
connect(m_ui->minSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter);
Expand Down
2 changes: 1 addition & 1 deletion src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ win32: include(../winconf.pri)
macx: include(../macxconf.pri)
unix:!macx: include(../unixconf.pri)

QT += network sql xml
QT += core-private network sql xml

macx|*-clang*: QMAKE_CXXFLAGS_WARN_ON += -Wno-range-loop-analysis

Expand Down
20 changes: 9 additions & 11 deletions src/webui/www/private/scripts/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,8 @@ window.addEvent('load', function() {
$('error_div').set('html', '');
if (response) {
clearTimeout(torrentsFilterInputTimer);
torrentsFilterInputTimer = -1;

let torrentsTableSelectedRows;
let update_categories = false;
let updateTags = false;
Expand Down Expand Up @@ -1357,18 +1359,14 @@ window.addEvent('load', function() {
$('torrentFilesFilterToolbar').addClass("invisible");
};

let prevTorrentsFilterValue;
let torrentsFilterInputTimer = null;
// listen for changes to torrentsFilterInput
$('torrentsFilterInput').addEvent('input', function() {
const value = $('torrentsFilterInput').get("value");
if (value !== prevTorrentsFilterValue) {
prevTorrentsFilterValue = value;
clearTimeout(torrentsFilterInputTimer);
torrentsFilterInputTimer = setTimeout(function() {
torrentsTable.updateTable(false);
}, 400);
}
let torrentsFilterInputTimer = -1;
$('torrentsFilterInput').addEvent('input', () => {
clearTimeout(torrentsFilterInputTimer);
torrentsFilterInputTimer = setTimeout(() => {
torrentsFilterInputTimer = -1;
torrentsTable.updateTable();
}, window.qBittorrent.Misc.FILTER_INPUT_DELAY);
});

$('transfersTabLink').addEvent('click', showTransfersTab);
Expand Down
2 changes: 2 additions & 0 deletions src/webui/www/private/scripts/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,14 @@ window.qBittorrent.ContextMenu = (function() {

const touchstartEvent = e;
this.touchstartTimer = setTimeout(function() {
this.touchstartTimer = -1;
this.triggerMenu(touchstartEvent, elem);
}.bind(this), this.options.touchTimer);
}.bind(this));
elem.addEvent('touchend', function(e) {
e.preventDefault();
clearTimeout(this.touchstartTimer);
this.touchstartTimer = -1;
}.bind(this));
},

Expand Down
5 changes: 1 addition & 4 deletions src/webui/www/private/scripts/dynamicTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,10 +701,7 @@ window.qBittorrent.DynamicTable = (function() {
return null;
},

updateTable: function(fullUpdate) {
if (fullUpdate === undefined)
fullUpdate = false;

updateTable: function(fullUpdate = false) {
const rows = this.getFilteredAndSortedRows();

for (let i = 0; i < this.selectedRows.length; ++i)
Expand Down
2 changes: 2 additions & 0 deletions src/webui/www/private/scripts/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ window.qBittorrent.Misc = (function() {
toFixedPointString: toFixedPointString,
containsAllTerms: containsAllTerms,
sleep: sleep,
// variables
FILTER_INPUT_DELAY: 400,
MAX_ETA: 8640000
};
};
Expand Down
36 changes: 19 additions & 17 deletions src/webui/www/private/scripts/prop-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ window.qBittorrent.PropFiles = (function() {
},
onSuccess: function(files) {
clearTimeout(torrentFilesFilterInputTimer);
torrentFilesFilterInputTimer = -1;

if (files.length === 0) {
torrentFilesTable.clear();
Expand Down Expand Up @@ -640,26 +641,27 @@ window.qBittorrent.PropFiles = (function() {
if (torrentFilesTable.getSortedColumn() === null)
torrentFilesTable.setSortedColumn('name');

let prevTorrentFilesFilterValue;
let torrentFilesFilterInputTimer = null;
// listen for changes to torrentFilesFilterInput
$('torrentFilesFilterInput').addEvent('input', function() {
let torrentFilesFilterInputTimer = -1;
$('torrentFilesFilterInput').addEvent('input', () => {
clearTimeout(torrentFilesFilterInputTimer);

const value = $('torrentFilesFilterInput').get("value");
if (value !== prevTorrentFilesFilterValue) {
prevTorrentFilesFilterValue = value;
torrentFilesTable.setFilter(value);
clearTimeout(torrentFilesFilterInputTimer);
torrentFilesFilterInputTimer = setTimeout(function() {
if (current_hash === "")
return;
torrentFilesTable.updateTable(false);
torrentFilesTable.setFilter(value);

if (value.trim() === "")
collapseAllNodes();
else
expandAllNodes();
}, 400);
}
torrentFilesFilterInputTimer = setTimeout(() => {
torrentFilesFilterInputTimer = -1;

if (current_hash === "")
return;

torrentFilesTable.updateTable();

if (value.trim() === "")
collapseAllNodes();
else
expandAllNodes();
}, window.qBittorrent.Misc.FILTER_INPUT_DELAY);
});

/**
Expand Down
9 changes: 7 additions & 2 deletions src/webui/www/private/views/log.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
};

let customSyncLogDataInterval = null;
let logFilterTimer;
let logFilterTimer = -1;
let inputtedFilterText = "";
let selectBox;
let selectedLogLevels = JSON.parse(LocalPreferences.get('qbt_selected_log_levels')) || ['1', '2', '4', '8'];
Expand Down Expand Up @@ -297,9 +297,11 @@
const logFilterChanged = () => {
clearTimeout(logFilterTimer);
logFilterTimer = setTimeout((curTab) => {
logFilterTimer = -1;

tableInfo[curTab].instance.updateTable(false);
updateLabelCount(curTab);
}, 400, currentSelectedTab);
}, window.qBittorrent.Misc.FILTER_INPUT_DELAY, currentSelectedTab);
};

const setCurrentTab = (tab) => {
Expand All @@ -321,6 +323,7 @@
}

clearTimeout(logFilterTimer);
logFilterTimer = -1;
load();

if (tableInfo[currentSelectedTab].instance.filterText !== getFilterText()) {
Expand Down Expand Up @@ -377,6 +380,8 @@

if (response.length > 0) {
clearTimeout(logFilterTimer);
logFilterTimer = -1;

for (let i = 0; i < response.length; ++i) {
let row;
if (curTab === 'main') {
Expand Down
Loading
Loading