diff --git a/.gitignore b/.gitignore index b1d504978..f3801267c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.vscode/ src/gui/geoip/GeoIP.dat src/gui/geoip/GeoIP.dat.gz src/qbittorrent diff --git a/dist/windows/installer-translations/french.nsi b/dist/windows/installer-translations/french.nsi index 3685f8d7a..af99865b3 100644 --- a/dist/windows/installer-translations/french.nsi +++ b/dist/windows/installer-translations/french.nsi @@ -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" @@ -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 :" diff --git a/dist/windows/installer-translations/hungarian.nsi b/dist/windows/installer-translations/hungarian.nsi index 6536c3a85..f311c8779 100644 --- a/dist/windows/installer-translations/hungarian.nsi +++ b/dist/windows/installer-translations/hungarian.nsi @@ -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" diff --git a/src/app/application.cpp b/src/app/application.cpp index e22f2f670..0244e40f1 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -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)); diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index 2fe8ecafb..89133e084 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -41,6 +42,7 @@ #include #include #include +#include #include #include #include diff --git a/src/gui/addnewtorrentdialog.h b/src/gui/addnewtorrentdialog.h index 910275344..557df9b9e 100644 --- a/src/gui/addnewtorrentdialog.h +++ b/src/gui/addnewtorrentdialog.h @@ -39,6 +39,9 @@ #include "base/path.h" #include "base/settingvalue.h" +class LineEdit; +class TorrentFileGuard; + namespace BitTorrent { class InfoHash; @@ -54,9 +57,6 @@ namespace Ui class AddNewTorrentDialog; } -class LineEdit; -class TorrentFileGuard; - class AddNewTorrentDialog final : public QDialog { Q_OBJECT diff --git a/src/gui/desktopintegration.cpp b/src/gui/desktopintegration.cpp index f8a4c85cb..466d62c8c 100644 --- a/src/gui/desktopintegration.cpp +++ b/src/gui/desktopintegration.cpp @@ -31,6 +31,7 @@ #include +#include #include #include @@ -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 diff --git a/src/gui/fspathedit_p.cpp b/src/gui/fspathedit_p.cpp index d6f4031c9..1e58002e3 100644 --- a/src/gui/fspathedit_p.cpp +++ b/src/gui/fspathedit_p.cpp @@ -1,7 +1,8 @@ /* * Bittorrent Client using Qt and libtorrent. - * Copyright (C) 2022 Mike Tzou (Chocobo1) - * Copyright (C) 2016 Eugene Shalygin + * Copyright (C) 2024 Vladimir Golovnev + * Copyright (C) 2022 Mike Tzou (Chocobo1) + * Copyright (C) 2016 Eugene Shalygin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -32,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -160,36 +162,33 @@ QValidator::State Private::FileSystemPathValidator::validate(QString &input, int } Private::FileLineEdit::FileLineEdit(QWidget *parent) - : QLineEdit {parent} - , m_completerModel {new QFileSystemModel(this)} - , m_completer {new QCompleter(this)} + : QLineEdit(parent) { - m_iconProvider.setOptions(QFileIconProvider::DontUseCustomDirectoryIcons); - - m_completerModel->setIconProvider(&m_iconProvider); - m_completerModel->setOptions(QFileSystemModel::DontWatchForChanges); - - m_completer->setModel(m_completerModel); - setCompleter(m_completer); - connect(this, &QLineEdit::textChanged, this, &FileLineEdit::validateText); } Private::FileLineEdit::~FileLineEdit() { delete m_completerModel; // has to be deleted before deleting the m_iconProvider object + delete m_iconProvider; } void Private::FileLineEdit::completeDirectoriesOnly(const bool completeDirsOnly) { - const QDir::Filters filters = QDir::NoDotAndDotDot - | (completeDirsOnly ? QDir::Dirs : QDir::AllEntries); - m_completerModel->setFilter(filters); + m_completeDirectoriesOnly = completeDirsOnly; + if (m_completerModel) + { + const QDir::Filters filters = QDir::NoDotAndDotDot + | (completeDirsOnly ? QDir::Dirs : QDir::AllEntries); + m_completerModel->setFilter(filters); + } } void Private::FileLineEdit::setFilenameFilters(const QStringList &filters) { - m_completerModel->setNameFilters(filters); + m_filenameFilters = filters; + if (m_completerModel) + m_completerModel->setNameFilters(m_filenameFilters); } void Private::FileLineEdit::setBrowseAction(QAction *action) @@ -223,6 +222,24 @@ void Private::FileLineEdit::keyPressEvent(QKeyEvent *e) if ((e->key() == Qt::Key_Space) && (e->modifiers() == Qt::CTRL)) { + if (!m_completer) + { + m_iconProvider = new QFileIconProvider; + m_iconProvider->setOptions(QFileIconProvider::DontUseCustomDirectoryIcons); + + m_completerModel = new QFileSystemModel(this); + m_completerModel->setIconProvider(m_iconProvider); + m_completerModel->setOptions(QFileSystemModel::DontWatchForChanges); + m_completerModel->setNameFilters(m_filenameFilters); + const QDir::Filters filters = QDir::NoDotAndDotDot + | (m_completeDirectoriesOnly ? QDir::Dirs : QDir::AllEntries); + m_completerModel->setFilter(filters); + + m_completer = new QCompleter(this); + m_completer->setModel(m_completerModel); + setCompleter(m_completer); + } + m_completerModel->setRootPath(Path(text()).data()); showCompletionPopup(); } diff --git a/src/gui/fspathedit_p.h b/src/gui/fspathedit_p.h index 69592281b..153cf4b08 100644 --- a/src/gui/fspathedit_p.h +++ b/src/gui/fspathedit_p.h @@ -1,6 +1,7 @@ /* * Bittorrent Client using Qt and libtorrent. - * Copyright (C) 2016 Eugene Shalygin + * Copyright (C) 2024 Vladimir Golovnev + * Copyright (C) 2016 Eugene Shalygin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -29,7 +30,6 @@ #pragma once #include -#include #include #include #include @@ -39,6 +39,7 @@ class QAction; class QCompleter; class QContextMenuEvent; +class QFileIconProvider; class QFileSystemModel; class QKeyEvent; @@ -143,7 +144,9 @@ namespace Private QCompleter *m_completer = nullptr; QAction *m_browseAction = nullptr; QAction *m_warningAction = nullptr; - QFileIconProvider m_iconProvider; + QFileIconProvider *m_iconProvider = nullptr; + bool m_completeDirectoriesOnly = false; + QStringList m_filenameFilters; }; class FileComboEdit final : public QComboBox, public IFileEditorWithCompletion diff --git a/src/gui/lineedit.cpp b/src/gui/lineedit.cpp index f388fab60..08a5aeea5 100644 --- a/src/gui/lineedit.cpp +++ b/src/gui/lineedit.cpp @@ -29,20 +29,41 @@ #include "lineedit.h" +#include + #include #include +#include #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) diff --git a/src/gui/lineedit.h b/src/gui/lineedit.h index 55ed3bd85..459740f86 100644 --- a/src/gui/lineedit.h +++ b/src/gui/lineedit.h @@ -31,6 +31,9 @@ #include +class QKeyEvent; +class QTimer; + class LineEdit final : public QLineEdit { Q_OBJECT @@ -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; }; diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 3edf3f74f..c7e15e40c 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -57,6 +57,7 @@ #include #include #include +#include #include #include diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 0566c7050..30923b166 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -42,6 +42,7 @@ class QCloseEvent; class QComboBox; class QFileSystemWatcher; class QSplitter; +class QString; class QTabWidget; class QTimer; diff --git a/src/gui/rss/articlelistwidget.cpp b/src/gui/rss/articlelistwidget.cpp index 599a4d886..e20c0b1fd 100644 --- a/src/gui/rss/articlelistwidget.cpp +++ b/src/gui/rss/articlelistwidget.cpp @@ -104,7 +104,7 @@ void ArticleListWidget::handleArticleRead(RSS::Article *rssArticle) const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_s)}; item->setData(Qt::ForegroundRole, foregroundBrush); - item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_s, u"sphere"_s)); + item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"rss_read_article"_s, u"sphere"_s)); checkInvariant(); } @@ -131,13 +131,13 @@ QListWidgetItem *ArticleListWidget::createItem(RSS::Article *article) const { const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_s)}; item->setData(Qt::ForegroundRole, foregroundBrush); - item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_s, u"sphere"_s)); + item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"rss_read_article"_s, u"sphere"_s)); } else { const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.UnreadArticle"_s)}; item->setData(Qt::ForegroundRole, foregroundBrush); - item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_s, u"sphere"_s)); + item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"rss_unread_article"_s, u"sphere"_s)); } return item; diff --git a/src/gui/search/searchjobwidget.cpp b/src/gui/search/searchjobwidget.cpp index e40863526..bddaefa21 100644 --- a/src/gui/search/searchjobwidget.cpp +++ b/src/gui/search/searchjobwidget.cpp @@ -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(&QComboBox::currentIndexChanged) , this, &SearchJobWidget::updateFilter); connect(m_ui->minSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter); diff --git a/src/gui/uithemecommon.h b/src/gui/uithemecommon.h index 087357395..64c50d659 100644 --- a/src/gui/uithemecommon.h +++ b/src/gui/uithemecommon.h @@ -149,6 +149,8 @@ inline QSet defaultUIThemeIcons() u"queued"_s, u"ratio"_s, u"reannounce"_s, + u"rss_read_article"_s, + u"rss_unread_article"_s, u"security-high"_s, u"security-low"_s, u"set-location"_s, diff --git a/src/icons/icons.qrc b/src/icons/icons.qrc index 7d23cc8ca..28ee16e1b 100644 --- a/src/icons/icons.qrc +++ b/src/icons/icons.qrc @@ -331,6 +331,8 @@ queued.svg ratio.svg reannounce.svg + rss_read_article.png + rss_unread_article.png security-high.svg security-low.svg set-location.svg diff --git a/src/icons/rss_read_article.png b/src/icons/rss_read_article.png new file mode 100644 index 000000000..ae6588c03 Binary files /dev/null and b/src/icons/rss_read_article.png differ diff --git a/src/icons/rss_unread_article.png b/src/icons/rss_unread_article.png new file mode 100644 index 000000000..a9291d2e9 Binary files /dev/null and b/src/icons/rss_unread_article.png differ diff --git a/src/src.pro b/src/src.pro index dc164a5e2..8f6173e6c 100644 --- a/src/src.pro +++ b/src/src.pro @@ -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 diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index d26cc7a9e..fdd1fa7ea 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -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; @@ -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); diff --git a/src/webui/www/private/scripts/contextmenu.js b/src/webui/www/private/scripts/contextmenu.js index b9487abb8..a24d1840b 100644 --- a/src/webui/www/private/scripts/contextmenu.js +++ b/src/webui/www/private/scripts/contextmenu.js @@ -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)); }, diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index b576d8a06..17d3e883c 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -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) diff --git a/src/webui/www/private/scripts/misc.js b/src/webui/www/private/scripts/misc.js index 23e8bb520..e2c025b7c 100644 --- a/src/webui/www/private/scripts/misc.js +++ b/src/webui/www/private/scripts/misc.js @@ -46,6 +46,8 @@ window.qBittorrent.Misc = (function() { toFixedPointString: toFixedPointString, containsAllTerms: containsAllTerms, sleep: sleep, + // variables + FILTER_INPUT_DELAY: 400, MAX_ETA: 8640000 }; }; diff --git a/src/webui/www/private/scripts/prop-files.js b/src/webui/www/private/scripts/prop-files.js index 503350f90..e21dc7e02 100644 --- a/src/webui/www/private/scripts/prop-files.js +++ b/src/webui/www/private/scripts/prop-files.js @@ -366,6 +366,7 @@ window.qBittorrent.PropFiles = (function() { }, onSuccess: function(files) { clearTimeout(torrentFilesFilterInputTimer); + torrentFilesFilterInputTimer = -1; if (files.length === 0) { torrentFilesTable.clear(); @@ -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() { - 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); + let torrentFilesFilterInputTimer = -1; + $('torrentFilesFilterInput').addEvent('input', () => { + clearTimeout(torrentFilesFilterInputTimer); - if (value.trim() === "") - collapseAllNodes(); - else - expandAllNodes(); - }, 400); - } + const value = $('torrentFilesFilterInput').get("value"); + torrentFilesTable.setFilter(value); + + torrentFilesFilterInputTimer = setTimeout(() => { + torrentFilesFilterInputTimer = -1; + + if (current_hash === "") + return; + + torrentFilesTable.updateTable(); + + if (value.trim() === "") + collapseAllNodes(); + else + expandAllNodes(); + }, window.qBittorrent.Misc.FILTER_INPUT_DELAY); }); /** diff --git a/src/webui/www/private/views/log.html b/src/webui/www/private/views/log.html index ff3a25319..3068edf69 100644 --- a/src/webui/www/private/views/log.html +++ b/src/webui/www/private/views/log.html @@ -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']; @@ -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) => { @@ -321,6 +323,7 @@ } clearTimeout(logFilterTimer); + logFilterTimer = -1; load(); if (tableInfo[currentSelectedTab].instance.filterText !== getFilterText()) { @@ -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') { diff --git a/src/webui/www/private/views/search.html b/src/webui/www/private/views/search.html index fbae44ae8..1f032db80 100644 --- a/src/webui/www/private/views/search.html +++ b/src/webui/www/private/views/search.html @@ -233,7 +233,6 @@ max: 0.00, maxUnit: 3 }; - let prevNameFilterValue; let selectedCategory = "QBT_TR(All categories)QBT_TR[CONTEXT=SearchEngineWidget]"; let selectedPlugin = "all"; let prevSelectedPlugin; @@ -258,18 +257,17 @@ searchResultsTable.setup('searchResultsTableDiv', 'searchResultsTableFixedHeaderDiv', searchResultsTableContextMenu); getPlugins(); - let searchInNameFilterTimer = null; // listen for changes to searchInNameFilter - $('searchInNameFilter').addEvent('input', function() { - const value = $('searchInNameFilter').get("value"); - if (value !== prevNameFilterValue) { - prevNameFilterValue = value; - clearTimeout(searchInNameFilterTimer); - searchInNameFilterTimer = setTimeout(function() { - searchText.filterPattern = value; - searchFilterChanged(); - }, 400); - } + let searchInNameFilterTimer = -1; + $('searchInNameFilter').addEvent('input', () => { + clearTimeout(searchInNameFilterTimer); + searchInNameFilterTimer = setTimeout(() => { + searchInNameFilterTimer = -1; + + const value = $('searchInNameFilter').get("value"); + searchText.filterPattern = value; + searchFilterChanged(); + }, window.qBittorrent.Misc.FILTER_INPUT_DELAY); }); new Keyboard({