You've already forked qBittorrent
mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-11-14 03:17:38 +01:00
Compare commits
31 Commits
release-4.
...
release-4.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
785320e7f6 | ||
|
|
954d6ff5c6 | ||
|
|
1f6a817020 | ||
|
|
4e30e6cb8e | ||
|
|
753cdfdb1a | ||
|
|
daaaa11f93 | ||
|
|
c0e0e36d10 | ||
|
|
188469a42c | ||
|
|
18296b2f75 | ||
|
|
cce1290c0c | ||
|
|
64acc64c58 | ||
|
|
d5a3f724ab | ||
|
|
7567f71c55 | ||
|
|
6805922521 | ||
|
|
a3812c0831 | ||
|
|
361741d677 | ||
|
|
acd9102dc2 | ||
|
|
e74b587420 | ||
|
|
2589363622 | ||
|
|
cfa7a6db46 | ||
|
|
5609fa49a6 | ||
|
|
d0ad08e495 | ||
|
|
33b51249dc | ||
|
|
17b6dcfbef | ||
|
|
c894d84ed3 | ||
|
|
8c52b53300 | ||
|
|
4c3af5d923 | ||
|
|
77d907c2aa | ||
|
|
a56b3edc58 | ||
|
|
a83424a7a7 | ||
|
|
cdf66e069d |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.vscode/
|
||||
src/gui/geoip/GeoIP.dat
|
||||
src/gui/geoip/GeoIP.dat.gz
|
||||
src/qbittorrent
|
||||
|
||||
21
Changelog
21
Changelog
@@ -1,3 +1,22 @@
|
||||
Sun Mar 24th 2024 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.6.4
|
||||
- BUGFIX: Correctly adjust "Add New torrent" dialog position in all the cases (glassez)
|
||||
- BUGFIX: Change "metadata received" stop condition behavior (glassez)
|
||||
- BUGFIX: Add a small delay before processing the key input of search boxes (Chocobo1)
|
||||
- BUGFIX: Ensure the profile path is pointing to a directory (Chocobo1)
|
||||
- RSS: Use better icons for RSS articles (glassez)
|
||||
- WINDOWS: NSIS: Update French, Hungarian translations (MarcDrieu, foxi69)
|
||||
- LINUX: Fix sorting when ICU isn't used (Chocobo1)
|
||||
- LINUX: Fix invisible tray icon on Plasma 6 (tehcneko)
|
||||
|
||||
Mon Jan 15th 2024 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.6.3
|
||||
- BUGFIX: Correctly update number of filtered items (glassez)
|
||||
- BUGFIX: Don't forget to store Stop condition value (glassez)
|
||||
- BUGFIX: Show correctly decoded filename in log (glassez)
|
||||
- BUGFIX: Specify a locale if none is set (Chocobo1)
|
||||
- BUGFIX: Apply inactive seeding time limit set on new torrents (glassez)
|
||||
- BUGFIX: Show URL seeds for torrents that have no metadata (glassez)
|
||||
- BUGFIX: Don't get stuck loading on mismatched info-hashes in resume data (glassez)
|
||||
|
||||
Mon Nov 27th 2023 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.6.2
|
||||
- BUGFIX: Do not apply share limit if the previous one was applied (glassez)
|
||||
- BUGFIX: Show Add new torrent dialog on main window screen (glassez)
|
||||
@@ -6,7 +25,7 @@ Mon Nov 27th 2023 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.6.2
|
||||
- WINDOWS: NSIS: Display correct Minimum Windows OS requirement (xavier2k6)
|
||||
- WINDOWS: NSIS: Add Hebrew translation (avivmu)
|
||||
- LINUX: WAYLAND: Fix parent widget of "Lock qBittorrent" submenu (Vlad Zahorodnii)
|
||||
|
||||
|
||||
Mon Nov 20th 2023 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.6.1
|
||||
- FEATURE: Add option to enable previous Add new torrent dialog behavior (glassez)
|
||||
- BUGFIX: Prevent crash due to race condition when adding magnet link (glassez)
|
||||
|
||||
20
configure
vendored
20
configure
vendored
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.71 for qbittorrent v4.6.2.
|
||||
# Generated by GNU Autoconf 2.71 for qbittorrent v4.6.4.
|
||||
#
|
||||
# Report bugs to <bugs.qbittorrent.org>.
|
||||
#
|
||||
@@ -611,8 +611,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='qbittorrent'
|
||||
PACKAGE_TARNAME='qbittorrent'
|
||||
PACKAGE_VERSION='v4.6.2'
|
||||
PACKAGE_STRING='qbittorrent v4.6.2'
|
||||
PACKAGE_VERSION='v4.6.4'
|
||||
PACKAGE_STRING='qbittorrent v4.6.4'
|
||||
PACKAGE_BUGREPORT='bugs.qbittorrent.org'
|
||||
PACKAGE_URL='https://www.qbittorrent.org/'
|
||||
|
||||
@@ -1329,7 +1329,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures qbittorrent v4.6.2 to adapt to many kinds of systems.
|
||||
\`configure' configures qbittorrent v4.6.4 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1400,7 +1400,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of qbittorrent v4.6.2:";;
|
||||
short | recursive ) echo "Configuration of qbittorrent v4.6.4:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1533,7 +1533,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
qbittorrent configure v4.6.2
|
||||
qbittorrent configure v4.6.4
|
||||
generated by GNU Autoconf 2.71
|
||||
|
||||
Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
@@ -1648,7 +1648,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by qbittorrent $as_me v4.6.2, which was
|
||||
It was created by qbittorrent $as_me v4.6.4, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
$ $0$ac_configure_args_raw
|
||||
@@ -4779,7 +4779,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='qbittorrent'
|
||||
VERSION='v4.6.2'
|
||||
VERSION='v4.6.4'
|
||||
|
||||
|
||||
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
|
||||
@@ -7237,7 +7237,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by qbittorrent $as_me v4.6.2, which was
|
||||
This file was extended by qbittorrent $as_me v4.6.4, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -7297,7 +7297,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config='$ac_cs_config_escaped'
|
||||
ac_cs_version="\\
|
||||
qbittorrent config.status v4.6.2
|
||||
qbittorrent config.status v4.6.4
|
||||
configured by $0, generated by GNU Autoconf 2.71,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AC_INIT([qbittorrent], [v4.6.2], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
|
||||
AC_INIT([qbittorrent], [v4.6.4], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
: ${CFLAGS=""}
|
||||
|
||||
4
dist/mac/Info.plist
vendored
4
dist/mac/Info.plist
vendored
@@ -55,7 +55,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.6.2</string>
|
||||
<string>4.6.4</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@@ -67,7 +67,7 @@
|
||||
<key>NSAppleScriptEnabled</key>
|
||||
<string>YES</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2006-2023 The qBittorrent project</string>
|
||||
<string>Copyright © 2006-2024 The qBittorrent project</string>
|
||||
<key>UTExportedTypeDeclarations</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
||||
@@ -74,6 +74,6 @@
|
||||
<url type="translate">https://github.com/qbittorrent/qBittorrent/wiki/How-to-translate-qBittorrent</url>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="4.6.2" date="2023-11-27"/>
|
||||
<release version="4.6.4" date="2024-03-24"/>
|
||||
</releases>
|
||||
</component>
|
||||
|
||||
@@ -21,7 +21,7 @@ GenericName[ar]=عميل بتتورنت
|
||||
Comment[ar]=نزّل وشارك الملفات عبر كيوبتتورنت
|
||||
Name[ar]=qBittorrent
|
||||
GenericName[be]=Кліент BitTorrent
|
||||
Comment[be]=Спампоўванне і раздача файлаў праз пратакол BitTorrent
|
||||
Comment[be]=Сьцягваньне й раздача файлаў праз пратакол BitTorrent
|
||||
Name[be]=qBittorrent
|
||||
GenericName[bg]=BitTorrent клиент
|
||||
Comment[bg]=Сваляне и споделяне на файлове чрез BitTorrent
|
||||
@@ -144,8 +144,8 @@ GenericName[sl]=BitTorrent odjemalec
|
||||
Comment[sl]=Prenesite in delite datoteke preko BitTorrenta
|
||||
Name[sl]=qBittorrent
|
||||
Name[sq]=qBittorrent
|
||||
GenericName[sr]=BitTorrent-клијент
|
||||
Comment[sr]=Преузимајте и делите фајлове преко BitTorrent протокола
|
||||
GenericName[sr]=BitTorrent клијент
|
||||
Comment[sr]=Преузимајте и делите фајлове преко BitTorrent-а
|
||||
Name[sr]=qBittorrent
|
||||
GenericName[sr@latin]=BitTorrent klijent
|
||||
Comment[sr@latin]=Preuzimanje i deljenje fajlova preko BitTorrent-a
|
||||
|
||||
4
dist/windows/config.nsi
vendored
4
dist/windows/config.nsi
vendored
@@ -25,7 +25,7 @@
|
||||
; 4.5.1.3 -> good
|
||||
; 4.5.1.3.2 -> bad
|
||||
; 4.5.0beta -> bad
|
||||
!define /ifndef QBT_VERSION "4.6.2"
|
||||
!define /ifndef QBT_VERSION "4.6.4"
|
||||
|
||||
; Option that controls the installer's window name
|
||||
; If set, its value will be used like this:
|
||||
@@ -112,7 +112,7 @@ OutFile "qbittorrent_${QBT_INSTALLER_FILENAME}_setup.exe"
|
||||
;Installer Version Information
|
||||
VIAddVersionKey "ProductName" "qBittorrent"
|
||||
VIAddVersionKey "CompanyName" "The qBittorrent project"
|
||||
VIAddVersionKey "LegalCopyright" "Copyright ©2006-2023 The qBittorrent project"
|
||||
VIAddVersionKey "LegalCopyright" "Copyright ©2006-2024 The qBittorrent project"
|
||||
VIAddVersionKey "FileDescription" "qBittorrent - A Bittorrent Client"
|
||||
VIAddVersionKey "FileVersion" "${QBT_VERSION}"
|
||||
|
||||
|
||||
@@ -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 :"
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ void showSplashScreen();
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
void adjustFileDescriptorLimit();
|
||||
void adjustLocale();
|
||||
#endif
|
||||
|
||||
// Main
|
||||
@@ -104,6 +105,7 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
adjustLocale();
|
||||
adjustFileDescriptorLimit();
|
||||
#endif
|
||||
|
||||
@@ -392,4 +394,12 @@ void adjustFileDescriptorLimit()
|
||||
limit.rlim_cur = limit.rlim_max;
|
||||
setrlimit(RLIMIT_NOFILE, &limit);
|
||||
}
|
||||
|
||||
void adjustLocale()
|
||||
{
|
||||
// specify the default locale just in case if user has not set any other locale
|
||||
// only `C` locale is available universally without installing locale packages
|
||||
if (qEnvironmentVariableIsEmpty("LANG"))
|
||||
qputenv("LANG", "C.UTF-8");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -194,11 +194,16 @@ add_library(qbt_base STATIC
|
||||
|
||||
target_link_libraries(qbt_base
|
||||
PRIVATE
|
||||
OpenSSL::Crypto OpenSSL::SSL
|
||||
OpenSSL::Crypto
|
||||
OpenSSL::SSL
|
||||
ZLIB::ZLIB
|
||||
PUBLIC
|
||||
LibtorrentRasterbar::torrent-rasterbar
|
||||
Qt::Core Qt::Network Qt::Sql Qt::Xml
|
||||
Qt::Core
|
||||
Qt::CorePrivate
|
||||
Qt::Network
|
||||
Qt::Sql
|
||||
Qt::Xml
|
||||
qbt_common_cfg
|
||||
)
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ const QString PARAM_DOWNLOADPATH = u"download_path"_s;
|
||||
const QString PARAM_OPERATINGMODE = u"operating_mode"_s;
|
||||
const QString PARAM_QUEUETOP = u"add_to_top_of_queue"_s;
|
||||
const QString PARAM_STOPPED = u"stopped"_s;
|
||||
const QString PARAM_STOPCONDITION = u"stop_condition"_s;
|
||||
const QString PARAM_SKIPCHECKING = u"skip_checking"_s;
|
||||
const QString PARAM_CONTENTLAYOUT = u"content_layout"_s;
|
||||
const QString PARAM_AUTOTMM = u"use_auto_tmm"_s;
|
||||
@@ -126,17 +127,18 @@ BitTorrent::AddTorrentParams BitTorrent::parseAddTorrentParams(const QJsonObject
|
||||
params.savePath = Path(jsonObj.value(PARAM_SAVEPATH).toString());
|
||||
params.useDownloadPath = getOptionalBool(jsonObj, PARAM_USEDOWNLOADPATH);
|
||||
params.downloadPath = Path(jsonObj.value(PARAM_DOWNLOADPATH).toString());
|
||||
params.addForced = (getEnum<BitTorrent::TorrentOperatingMode>(jsonObj, PARAM_OPERATINGMODE) == BitTorrent::TorrentOperatingMode::Forced);
|
||||
params.addForced = (getEnum<TorrentOperatingMode>(jsonObj, PARAM_OPERATINGMODE) == TorrentOperatingMode::Forced);
|
||||
params.addToQueueTop = getOptionalBool(jsonObj, PARAM_QUEUETOP);
|
||||
params.addPaused = getOptionalBool(jsonObj, PARAM_STOPPED);
|
||||
params.stopCondition = getOptionalEnum<Torrent::StopCondition>(jsonObj, PARAM_STOPCONDITION);
|
||||
params.skipChecking = jsonObj.value(PARAM_SKIPCHECKING).toBool();
|
||||
params.contentLayout = getOptionalEnum<BitTorrent::TorrentContentLayout>(jsonObj, PARAM_CONTENTLAYOUT);
|
||||
params.contentLayout = getOptionalEnum<TorrentContentLayout>(jsonObj, PARAM_CONTENTLAYOUT);
|
||||
params.useAutoTMM = getOptionalBool(jsonObj, PARAM_AUTOTMM);
|
||||
params.uploadLimit = jsonObj.value(PARAM_UPLOADLIMIT).toInt(-1);
|
||||
params.downloadLimit = jsonObj.value(PARAM_DOWNLOADLIMIT).toInt(-1);
|
||||
params.seedingTimeLimit = jsonObj.value(PARAM_SEEDINGTIMELIMIT).toInt(BitTorrent::Torrent::USE_GLOBAL_SEEDING_TIME);
|
||||
params.inactiveSeedingTimeLimit = jsonObj.value(PARAM_INACTIVESEEDINGTIMELIMIT).toInt(BitTorrent::Torrent::USE_GLOBAL_INACTIVE_SEEDING_TIME);
|
||||
params.ratioLimit = jsonObj.value(PARAM_RATIOLIMIT).toDouble(BitTorrent::Torrent::USE_GLOBAL_RATIO);
|
||||
params.seedingTimeLimit = jsonObj.value(PARAM_SEEDINGTIMELIMIT).toInt(Torrent::USE_GLOBAL_SEEDING_TIME);
|
||||
params.inactiveSeedingTimeLimit = jsonObj.value(PARAM_INACTIVESEEDINGTIMELIMIT).toInt(Torrent::USE_GLOBAL_INACTIVE_SEEDING_TIME);
|
||||
params.ratioLimit = jsonObj.value(PARAM_RATIOLIMIT).toDouble(Torrent::USE_GLOBAL_RATIO);
|
||||
|
||||
return params;
|
||||
}
|
||||
@@ -149,7 +151,7 @@ QJsonObject BitTorrent::serializeAddTorrentParams(const AddTorrentParams ¶ms
|
||||
{PARAM_SAVEPATH, params.savePath.data()},
|
||||
{PARAM_DOWNLOADPATH, params.downloadPath.data()},
|
||||
{PARAM_OPERATINGMODE, Utils::String::fromEnum(params.addForced
|
||||
? BitTorrent::TorrentOperatingMode::Forced : BitTorrent::TorrentOperatingMode::AutoManaged)},
|
||||
? TorrentOperatingMode::Forced : TorrentOperatingMode::AutoManaged)},
|
||||
{PARAM_SKIPCHECKING, params.skipChecking},
|
||||
{PARAM_UPLOADLIMIT, params.uploadLimit},
|
||||
{PARAM_DOWNLOADLIMIT, params.downloadLimit},
|
||||
@@ -162,6 +164,8 @@ QJsonObject BitTorrent::serializeAddTorrentParams(const AddTorrentParams ¶ms
|
||||
jsonObj[PARAM_QUEUETOP] = *params.addToQueueTop;
|
||||
if (params.addPaused)
|
||||
jsonObj[PARAM_STOPPED] = *params.addPaused;
|
||||
if (params.stopCondition)
|
||||
jsonObj[PARAM_STOPCONDITION] = Utils::String::fromEnum(*params.stopCondition);
|
||||
if (params.contentLayout)
|
||||
jsonObj[PARAM_CONTENTLAYOUT] = Utils::String::fromEnum(*params.contentLayout);
|
||||
if (params.useAutoTMM)
|
||||
|
||||
@@ -288,6 +288,16 @@ BitTorrent::LoadResumeDataResult BitTorrent::BencodeResumeDataStorage::loadTorre
|
||||
return nonstd::make_unexpected(tr("Cannot parse torrent info: %1").arg(QString::fromStdString(ec.message())));
|
||||
|
||||
p.ti = torrentInfo;
|
||||
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
if (((p.info_hashes.has_v1() && (p.info_hashes.v1 != p.ti->info_hashes().v1))
|
||||
|| (p.info_hashes.has_v2() && (p.info_hashes.v2 != p.ti->info_hashes().v2))))
|
||||
#else
|
||||
if (!p.info_hash.is_all_zeros() && (p.info_hash != p.ti->info_hash()))
|
||||
#endif
|
||||
{
|
||||
return nonstd::make_unexpected(tr("Mismatching info-hash detected in resume data"));
|
||||
}
|
||||
}
|
||||
|
||||
p.save_path = Profile::instance()->fromPortablePath(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2015-2023 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2015-2024 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -1217,13 +1217,13 @@ void SessionImpl::prepareStartup()
|
||||
context->isLoadFinished = true;
|
||||
});
|
||||
|
||||
connect(this, &SessionImpl::torrentsLoaded, context, [this, context](const QVector<Torrent *> &torrents)
|
||||
connect(this, &SessionImpl::addTorrentAlertsReceived, context, [this, context](const qsizetype alertsCount)
|
||||
{
|
||||
context->processingResumeDataCount -= torrents.count();
|
||||
context->finishedResumeDataCount += torrents.count();
|
||||
context->processingResumeDataCount -= alertsCount;
|
||||
context->finishedResumeDataCount += alertsCount;
|
||||
if (!context->isLoadedResumeDataHandlingEnqueued)
|
||||
{
|
||||
QMetaObject::invokeMethod(this, [this, context]() { handleLoadedResumeData(context); }, Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(this, [this, context] { handleLoadedResumeData(context); }, Qt::QueuedConnection);
|
||||
context->isLoadedResumeDataHandlingEnqueued = true;
|
||||
}
|
||||
|
||||
@@ -2449,7 +2449,7 @@ bool SessionImpl::cancelDownloadMetadata(const TorrentID &id)
|
||||
// if magnet link was hybrid initially then it is indexed also by v1 info hash
|
||||
// so we need to remove both entries
|
||||
const auto altID = TorrentID::fromSHA1Hash(infoHash.v1());
|
||||
m_downloadedMetadata.remove((altID == downloadedMetadataIter.key()) ? id : altID);
|
||||
m_downloadedMetadata.remove(altID);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2681,6 +2681,7 @@ LoadTorrentParams SessionImpl::initLoadTorrentParams(const AddTorrentParams &add
|
||||
loadTorrentParams.addToQueueTop = addTorrentParams.addToQueueTop.value_or(isAddTorrentToQueueTop());
|
||||
loadTorrentParams.ratioLimit = addTorrentParams.ratioLimit;
|
||||
loadTorrentParams.seedingTimeLimit = addTorrentParams.seedingTimeLimit;
|
||||
loadTorrentParams.inactiveSeedingTimeLimit = addTorrentParams.inactiveSeedingTimeLimit;
|
||||
|
||||
const QString category = addTorrentParams.category;
|
||||
if (!category.isEmpty() && !m_categories.contains(category) && !addCategory(category))
|
||||
@@ -2806,6 +2807,14 @@ bool SessionImpl::addTorrent_impl(const std::variant<MagnetUri, TorrentInfo> &so
|
||||
|
||||
if (hasMetadata)
|
||||
{
|
||||
// Torrent that is being added with metadata is considered to be added as stopped
|
||||
// if "metadata received" stop condition is set for it.
|
||||
if (loadTorrentParams.stopCondition == Torrent::StopCondition::MetadataReceived)
|
||||
{
|
||||
loadTorrentParams.stopped = true;
|
||||
loadTorrentParams.stopCondition = Torrent::StopCondition::None;
|
||||
}
|
||||
|
||||
const TorrentInfo &torrentInfo = std::get<TorrentInfo>(source);
|
||||
|
||||
Q_ASSERT(addTorrentParams.filePaths.isEmpty() || (addTorrentParams.filePaths.size() == torrentInfo.filesCount()));
|
||||
@@ -5459,11 +5468,14 @@ void SessionImpl::handleAddTorrentAlerts(const std::vector<lt::alert *> &alerts)
|
||||
if (!isRestored())
|
||||
loadedTorrents.reserve(MAX_PROCESSING_RESUMEDATA_COUNT);
|
||||
|
||||
qsizetype alertsCount = 0;
|
||||
for (const lt::alert *a : alerts)
|
||||
{
|
||||
if (a->type() != lt::add_torrent_alert::alert_type)
|
||||
continue;
|
||||
|
||||
++alertsCount;
|
||||
|
||||
const auto *alert = static_cast<const lt::add_torrent_alert *>(a);
|
||||
if (alert->error)
|
||||
{
|
||||
@@ -5473,6 +5485,7 @@ void SessionImpl::handleAddTorrentAlerts(const std::vector<lt::alert *> &alerts)
|
||||
|
||||
const lt::add_torrent_params ¶ms = alert->params;
|
||||
const bool hasMetadata = (params.ti && params.ti->is_valid());
|
||||
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
const InfoHash infoHash {(hasMetadata ? params.ti->info_hashes() : params.info_hashes)};
|
||||
if (infoHash.isHybrid())
|
||||
@@ -5497,10 +5510,9 @@ void SessionImpl::handleAddTorrentAlerts(const std::vector<lt::alert *> &alerts)
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
const InfoHash infoHash {alert->handle.info_hashes()};
|
||||
#else
|
||||
@@ -5518,7 +5530,7 @@ void SessionImpl::handleAddTorrentAlerts(const std::vector<lt::alert *> &alerts)
|
||||
loadedTorrents.append(torrent);
|
||||
}
|
||||
else if (const auto downloadedMetadataIter = m_downloadedMetadata.find(torrentID)
|
||||
; downloadedMetadataIter != m_downloadedMetadata.end())
|
||||
; downloadedMetadataIter != m_downloadedMetadata.end())
|
||||
{
|
||||
downloadedMetadataIter.value() = alert->handle;
|
||||
if (infoHash.isHybrid())
|
||||
@@ -5530,11 +5542,16 @@ void SessionImpl::handleAddTorrentAlerts(const std::vector<lt::alert *> &alerts)
|
||||
}
|
||||
}
|
||||
|
||||
if (!loadedTorrents.isEmpty())
|
||||
if (alertsCount > 0)
|
||||
{
|
||||
if (isRestored())
|
||||
m_torrentsQueueChanged = true;
|
||||
emit torrentsLoaded(loadedTorrents);
|
||||
emit addTorrentAlertsReceived(alertsCount);
|
||||
|
||||
if (!loadedTorrents.isEmpty())
|
||||
{
|
||||
if (isRestored())
|
||||
m_torrentsQueueChanged = true;
|
||||
emit torrentsLoaded(loadedTorrents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5831,7 +5848,7 @@ void SessionImpl::handleFileErrorAlert(const lt::file_error_alert *p)
|
||||
|
||||
const QString msg = QString::fromStdString(p->message());
|
||||
LogMsg(tr("File error alert. Torrent: \"%1\". File: \"%2\". Reason: \"%3\"")
|
||||
.arg(torrent->name(), QString::fromLocal8Bit(p->filename()), msg)
|
||||
.arg(torrent->name(), QString::fromUtf8(p->filename()), msg)
|
||||
, Log::WARNING);
|
||||
emit fullDiskError(torrent, msg);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2015-2023 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2015-2024 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -475,6 +475,9 @@ namespace BitTorrent
|
||||
|
||||
void invokeAsync(std::function<void ()> func);
|
||||
|
||||
signals:
|
||||
void addTorrentAlertsReceived(qsizetype count);
|
||||
|
||||
private slots:
|
||||
void configureDeferred();
|
||||
void readAlerts();
|
||||
|
||||
@@ -31,7 +31,14 @@
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
|
||||
#if !defined(Q_OS_WIN) && (!defined(Q_OS_UNIX) || defined(Q_OS_MACOS) || defined(QT_FEATURE_icu))
|
||||
// for QT_FEATURE_xxx, see: https://wiki.qt.io/Qt5_Build_System#How_to
|
||||
#include <QtCore/private/qtcore-config_p.h>
|
||||
|
||||
// macOS and Windows support 'case sensitivity' and 'numeric mode' natively
|
||||
// https://github.com/qt/qtbase/blob/6.0/src/corelib/CMakeLists.txt#L777-L793
|
||||
// https://github.com/qt/qtbase/blob/6.0/src/corelib/text/qcollator_macx.cpp#L74-L77
|
||||
// https://github.com/qt/qtbase/blob/6.0/src/corelib/text/qcollator_win.cpp#L72-L78
|
||||
#if ((QT_FEATURE_icu == 1) || defined(Q_OS_MACOS) || defined(Q_OS_WIN))
|
||||
#define QBT_USE_QCOLLATOR
|
||||
#include <QCollator>
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#define QBT_VERSION_MAJOR 4
|
||||
#define QBT_VERSION_MINOR 6
|
||||
#define QBT_VERSION_BUGFIX 2
|
||||
#define QBT_VERSION_BUGFIX 4
|
||||
#define QBT_VERSION_BUILD 0
|
||||
#define QBT_VERSION_STATUS "" // Should be empty for stable releases!
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ AboutDialog::AboutDialog(QWidget *parent)
|
||||
u"</p>"_s
|
||||
.arg(tr("An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar.")
|
||||
.replace(u"C++"_s, u"C\u2060+\u2060+"_s) // make C++ non-breaking
|
||||
, tr("Copyright %1 2006-2023 The qBittorrent project").arg(C_COPYRIGHT)
|
||||
, tr("Copyright %1 2006-2024 The qBittorrent project").arg(C_COPYRIGHT)
|
||||
, tr("Home Page:")
|
||||
, tr("Forum:")
|
||||
, tr("Bug Tracker:"));
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <functional>
|
||||
|
||||
#include <QAction>
|
||||
#include <QByteArray>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
@@ -41,6 +42,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QScreen>
|
||||
#include <QShortcut>
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QVector>
|
||||
@@ -356,18 +358,28 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
|
||||
m_ui->downloadPath->setMaxVisibleItems(20);
|
||||
|
||||
m_ui->addToQueueTopCheckBox->setChecked(m_torrentParams.addToQueueTop.value_or(session->isAddTorrentToQueueTop()));
|
||||
m_ui->startTorrentCheckBox->setChecked(!m_torrentParams.addPaused.value_or(session->isAddTorrentPaused()));
|
||||
|
||||
m_ui->stopConditionComboBox->setToolTip(
|
||||
u"<html><body><p><b>" + tr("None") + u"</b> - " + tr("No stop condition is set.") + u"</p><p><b>" +
|
||||
tr("Metadata received") + u"</b> - " + tr("Torrent will stop after metadata is received.") +
|
||||
u" <em>" + tr("Torrents that have metadata initially aren't affected.") + u"</em></p><p><b>" +
|
||||
u" <em>" + tr("Torrents that have metadata initially will be added as stopped.") + u"</em></p><p><b>" +
|
||||
tr("Files checked") + u"</b> - " + tr("Torrent will stop after files are initially checked.") +
|
||||
u" <em>" + tr("This will also download metadata if it wasn't there initially.") + u"</em></p></body></html>");
|
||||
m_ui->stopConditionComboBox->setItemData(0, QVariant::fromValue(BitTorrent::Torrent::StopCondition::None));
|
||||
m_ui->stopConditionComboBox->setItemData(1, QVariant::fromValue(BitTorrent::Torrent::StopCondition::MetadataReceived));
|
||||
m_ui->stopConditionComboBox->setItemData(2, QVariant::fromValue(BitTorrent::Torrent::StopCondition::FilesChecked));
|
||||
m_ui->stopConditionComboBox->setCurrentIndex(m_ui->stopConditionComboBox->findData(
|
||||
QVariant::fromValue(m_torrentParams.stopCondition.value_or(session->torrentStopCondition()))));
|
||||
m_ui->stopConditionComboBox->addItem(tr("None"), QVariant::fromValue(BitTorrent::Torrent::StopCondition::None));
|
||||
if (!hasMetadata())
|
||||
m_ui->stopConditionComboBox->addItem(tr("Metadata received"), QVariant::fromValue(BitTorrent::Torrent::StopCondition::MetadataReceived));
|
||||
m_ui->stopConditionComboBox->addItem(tr("Files checked"), QVariant::fromValue(BitTorrent::Torrent::StopCondition::FilesChecked));
|
||||
const auto stopCondition = m_torrentParams.stopCondition.value_or(session->torrentStopCondition());
|
||||
if (hasMetadata() && (stopCondition == BitTorrent::Torrent::StopCondition::MetadataReceived))
|
||||
{
|
||||
m_ui->startTorrentCheckBox->setChecked(false);
|
||||
m_ui->stopConditionComboBox->setCurrentIndex(m_ui->stopConditionComboBox->findData(QVariant::fromValue(BitTorrent::Torrent::StopCondition::None)));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->startTorrentCheckBox->setChecked(!m_torrentParams.addPaused.value_or(session->isAddTorrentPaused()));
|
||||
m_ui->stopConditionComboBox->setCurrentIndex(m_ui->stopConditionComboBox->findData(QVariant::fromValue(stopCondition)));
|
||||
}
|
||||
m_ui->stopConditionLabel->setEnabled(m_ui->startTorrentCheckBox->isChecked());
|
||||
m_ui->stopConditionComboBox->setEnabled(m_ui->startTorrentCheckBox->isChecked());
|
||||
connect(m_ui->startTorrentCheckBox, &QCheckBox::toggled, this, [this](const bool checked)
|
||||
@@ -551,7 +563,10 @@ void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorre
|
||||
// Qt::Window is required to avoid showing only two dialog on top (see #12852).
|
||||
// Also improves the general convenience of adding multiple torrents.
|
||||
if (!attached)
|
||||
{
|
||||
dlg->setWindowFlags(Qt::Window);
|
||||
adjustDialogGeometry(dlg, parent);
|
||||
}
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
if (Net::DownloadManager::hasSupportedScheme(source))
|
||||
@@ -570,14 +585,9 @@ void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorre
|
||||
: dlg->loadTorrentFile(source);
|
||||
|
||||
if (isLoaded)
|
||||
{
|
||||
adjustDialogGeometry(dlg, parent);
|
||||
dlg->QDialog::show();
|
||||
}
|
||||
else
|
||||
{
|
||||
delete dlg;
|
||||
}
|
||||
}
|
||||
|
||||
void AddNewTorrentDialog::show(const QString &source, QWidget *parent)
|
||||
@@ -993,14 +1003,22 @@ void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &metadata
|
||||
// Good to go
|
||||
m_torrentInfo = metadata;
|
||||
setMetadataProgressIndicator(true, tr("Parsing metadata..."));
|
||||
const auto stopCondition = m_ui->stopConditionComboBox->currentData().value<BitTorrent::Torrent::StopCondition>();
|
||||
if (stopCondition == BitTorrent::Torrent::StopCondition::MetadataReceived)
|
||||
m_ui->startTorrentCheckBox->setChecked(false);
|
||||
|
||||
// Update UI
|
||||
setupTreeview();
|
||||
setMetadataProgressIndicator(false, tr("Metadata retrieval complete"));
|
||||
|
||||
if (const auto stopCondition = m_ui->stopConditionComboBox->currentData().value<BitTorrent::Torrent::StopCondition>()
|
||||
; stopCondition == BitTorrent::Torrent::StopCondition::MetadataReceived)
|
||||
{
|
||||
m_ui->startTorrentCheckBox->setChecked(false);
|
||||
|
||||
const auto index = m_ui->stopConditionComboBox->currentIndex();
|
||||
m_ui->stopConditionComboBox->setCurrentIndex(m_ui->stopConditionComboBox->findData(
|
||||
QVariant::fromValue(BitTorrent::Torrent::StopCondition::None)));
|
||||
m_ui->stopConditionComboBox->removeItem(index);
|
||||
}
|
||||
|
||||
m_ui->buttonSave->setVisible(true);
|
||||
if (m_torrentInfo.infoHash().v2().isValid())
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -261,24 +261,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="stopConditionComboBox">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Metadata received</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Files checked</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QMenu>
|
||||
#include <QTimer>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <glassez@yandex.ru>
|
||||
* 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 <QCompleter>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QDir>
|
||||
#include <QFileIconProvider>
|
||||
#include <QFileInfo>
|
||||
#include <QFileSystemModel>
|
||||
#include <QMenu>
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2016 Eugene Shalygin
|
||||
* Copyright (C) 2024 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* 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 <QComboBox>
|
||||
#include <QFileIconProvider>
|
||||
#include <QLineEdit>
|
||||
#include <QtContainerFwd>
|
||||
#include <QValidator>
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include <QShortcut>
|
||||
#include <QSplitter>
|
||||
#include <QStatusBar>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ class QCloseEvent;
|
||||
class QComboBox;
|
||||
class QFileSystemWatcher;
|
||||
class QSplitter;
|
||||
class QString;
|
||||
class QTabWidget;
|
||||
class QTimer;
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ void OptionsDialog::loadDownloadsTabOptions()
|
||||
m_ui->stopConditionComboBox->setToolTip(
|
||||
u"<html><body><p><b>" + tr("None") + u"</b> - " + tr("No stop condition is set.") + u"</p><p><b>" +
|
||||
tr("Metadata received") + u"</b> - " + tr("Torrent will stop after metadata is received.") +
|
||||
u" <em>" + tr("Torrents that have metadata initially aren't affected.") + u"</em></p><p><b>" +
|
||||
u" <em>" + tr("Torrents that have metadata initially will be added as stopped.") + u"</em></p><p><b>" +
|
||||
tr("Files checked") + u"</b> - " + tr("Torrent will stop after files are initially checked.") +
|
||||
u" <em>" + tr("This will also download metadata if it wasn't there initially.") + u"</em></p></body></html>");
|
||||
m_ui->stopConditionComboBox->setItemData(0, QVariant::fromValue(BitTorrent::Torrent::StopCondition::None));
|
||||
|
||||
@@ -291,6 +291,8 @@ void PropertiesWidget::loadTorrentInfos(BitTorrent::Torrent *const torrent)
|
||||
// Info hashes
|
||||
m_ui->labelInfohash1Val->setText(m_torrent->infoHash().v1().isValid() ? m_torrent->infoHash().v1().toString() : tr("N/A"));
|
||||
m_ui->labelInfohash2Val->setText(m_torrent->infoHash().v2().isValid() ? m_torrent->infoHash().v2().toString() : tr("N/A"));
|
||||
// URL seeds
|
||||
loadUrlSeeds();
|
||||
if (m_torrent->hasMetadata())
|
||||
{
|
||||
// Creation date
|
||||
@@ -301,9 +303,6 @@ void PropertiesWidget::loadTorrentInfos(BitTorrent::Torrent *const torrent)
|
||||
// Comment
|
||||
m_ui->labelCommentVal->setText(Utils::Misc::parseHtmlLinks(m_torrent->comment().toHtmlEscaped()));
|
||||
|
||||
// URL seeds
|
||||
loadUrlSeeds();
|
||||
|
||||
m_ui->labelCreatedByVal->setText(m_torrent->creator());
|
||||
}
|
||||
// Load dynamic data
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user