mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 08:48:07 -06:00
Compare commits
122 Commits
release-3.
...
release-3.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bd5ea2c68 | ||
|
|
1479a74198 | ||
|
|
9a0d25284c | ||
|
|
284e836992 | ||
|
|
43f5b31843 | ||
|
|
cada6cfc88 | ||
|
|
99f157927f | ||
|
|
664664394c | ||
|
|
a790901691 | ||
|
|
fdc70eaa62 | ||
|
|
b05a23e1ab | ||
|
|
9f6a0882e2 | ||
|
|
b351b21e55 | ||
|
|
ef22f06e92 | ||
|
|
8ea7426bc1 | ||
|
|
79e7e1727f | ||
|
|
98c33dd77c | ||
|
|
9c6504f6dd | ||
|
|
76c350bdcb | ||
|
|
106dcfd00e | ||
|
|
668c8cb0e2 | ||
|
|
3159bdf4dd | ||
|
|
97d2c0d187 | ||
|
|
0041ee3636 | ||
|
|
1ed523bec3 | ||
|
|
b131a6e9df | ||
|
|
56d9d370e9 | ||
|
|
a6efc4d92d | ||
|
|
a77db6e822 | ||
|
|
95a558941e | ||
|
|
867d69d0f2 | ||
|
|
a6d381da38 | ||
|
|
f0eb708b07 | ||
|
|
1d70698bd0 | ||
|
|
79871c8e21 | ||
|
|
25d5524213 | ||
|
|
8d21b73434 | ||
|
|
2ef01a314c | ||
|
|
a8b4aca5e6 | ||
|
|
67e7315eae | ||
|
|
a25a15d1c6 | ||
|
|
086588eeed | ||
|
|
44fa308681 | ||
|
|
6188287094 | ||
|
|
17d10afd65 | ||
|
|
89bd0e4397 | ||
|
|
1c1917f885 | ||
|
|
642377bd65 | ||
|
|
bb4668c071 | ||
|
|
689316db09 | ||
|
|
ad0c008a3e | ||
|
|
09e3698b37 | ||
|
|
6450ebfc6c | ||
|
|
e9f38ebcfd | ||
|
|
4dba31f534 | ||
|
|
04c1aad0dd | ||
|
|
6763f3ac33 | ||
|
|
afca704db0 | ||
|
|
eaec8fcddd | ||
|
|
f86fd52d6f | ||
|
|
f3f175570c | ||
|
|
729c80f910 | ||
|
|
fcaca558a0 | ||
|
|
983df9113e | ||
|
|
acf9874252 | ||
|
|
d7cf6bb11b | ||
|
|
558ea53cc2 | ||
|
|
87a6478430 | ||
|
|
cea673b267 | ||
|
|
4a5ab93c62 | ||
|
|
4c86fc8973 | ||
|
|
1c485ffb07 | ||
|
|
f283734f13 | ||
|
|
dca4ff0649 | ||
|
|
1975f2269e | ||
|
|
6fac9b42da | ||
|
|
dabae4c914 | ||
|
|
b1e9b4493d | ||
|
|
2fa207e728 | ||
|
|
7adcd909e7 | ||
|
|
50805fc2b5 | ||
|
|
3a1b7b6159 | ||
|
|
498b7c2436 | ||
|
|
4f17364305 | ||
|
|
9ebc115719 | ||
|
|
a6fa8c3a8e | ||
|
|
8187366c89 | ||
|
|
366ad01120 | ||
|
|
4da05e5914 | ||
|
|
3fb19b6a28 | ||
|
|
88f59070a4 | ||
|
|
476ffbe68a | ||
|
|
8a1846cb26 | ||
|
|
1cafde2afe | ||
|
|
bdf7312f5d | ||
|
|
a848d3d2d8 | ||
|
|
4a328843e4 | ||
|
|
edeb2342be | ||
|
|
0639a06809 | ||
|
|
7590d0fdad | ||
|
|
fe54da80cd | ||
|
|
e4ac654795 | ||
|
|
1848180faa | ||
|
|
4e9b71078f | ||
|
|
fe1b388347 | ||
|
|
23b4e62834 | ||
|
|
7fb96431b9 | ||
|
|
5213f35ec0 | ||
|
|
8e2297510d | ||
|
|
18505e2517 | ||
|
|
10908a6ece | ||
|
|
c1ee91cd2a | ||
|
|
036b4e1a85 | ||
|
|
3a4dc08304 | ||
|
|
e805e6806a | ||
|
|
f2163f6c3d | ||
|
|
6288cb4fd3 | ||
|
|
409e877f8a | ||
|
|
f2d5ba2907 | ||
|
|
b33d0f0a59 | ||
|
|
63245de69b | ||
|
|
b9fd9f1d8d |
@@ -9,8 +9,8 @@ environment:
|
||||
REPO_DIR: &REPO_DIR c:\qbittorrent
|
||||
CACHE_DIR: &CACHE_DIR c:\qbt_cache
|
||||
|
||||
QBT_VER_URL: http://builds.shiki.hu/appveyor/version
|
||||
QBT_LIB_URL: http://builds.shiki.hu/appveyor/qbt_libraries.7z
|
||||
QBT_VER_URL: https://builds.shiki.hu/appveyor/version
|
||||
QBT_LIB_URL: https://builds.shiki.hu/appveyor/qbt_libraries.7z
|
||||
|
||||
# project directory
|
||||
clone_folder: *REPO_DIR
|
||||
28
.travis.yml
28
.travis.yml
@@ -3,7 +3,7 @@ language: cpp
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
osx_image: xcode7
|
||||
osx_image: xcode7.3
|
||||
|
||||
env:
|
||||
matrix:
|
||||
@@ -30,7 +30,10 @@ notifications:
|
||||
|
||||
# container-based builds
|
||||
#sudo: false
|
||||
cache: ccache
|
||||
cache:
|
||||
ccache: true
|
||||
directories:
|
||||
- $HOME/hombebrew_cache
|
||||
|
||||
# opt-in Ubuntu Trusty
|
||||
sudo: required
|
||||
@@ -117,12 +120,29 @@ install:
|
||||
fi
|
||||
- |
|
||||
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
mkdir -p "$HOME/hombebrew_cache" ;
|
||||
wget https://builds.shiki.hu/homebrew/version ;
|
||||
if ! cmp --quiet "version" "$HOME/hombebrew_cache/version" ; then
|
||||
echo "Cached files are different from server. Downloading new ones." ;
|
||||
cp "version" $HOME/hombebrew_cache ;
|
||||
cd "$HOME/hombebrew_cache" ;
|
||||
wget https://builds.shiki.hu/homebrew/libtorrent-rasterbar.rb ;
|
||||
wget https://builds.shiki.hu/homebrew/libtorrent-rasterbar-1.0.10.el_capitan.bottle.tar.gz ;
|
||||
fi
|
||||
|
||||
# dependencies
|
||||
brew update > /dev/null && brew install colormake ccache libtorrent-rasterbar ;
|
||||
brew update > /dev/null ;
|
||||
brew install colormake ccache ;
|
||||
brew outdated "pkg-config" || brew upgrade "pkg-config" ;
|
||||
# Copy custom libtorrent bottle to homebrew's cache so it can find and install it
|
||||
# Also install our custom libtorrent formula by passing the local path to it
|
||||
# These 2 files are restored from Travis' cache.
|
||||
cp "$HOME/hombebrew_cache/libtorrent-rasterbar-1.0.10.el_capitan.bottle.tar.gz" "$(brew --cache)" ;
|
||||
brew install "$HOME/hombebrew_cache/libtorrent-rasterbar.rb" ;
|
||||
|
||||
# Qt
|
||||
if [ "$qt" = 4 ]; then brew install qt && ln -s /usr/local/Cellar/qt/4.8.7_2/plugins /usr/local ; fi ;
|
||||
if [ "$qt" = 5 ]; then brew install qt5 && brew link --force qt5 && ln -s /usr/local/Cellar/qt5/5.6.0/plugins /usr/local ; fi ;
|
||||
if [ "$qt" = 5 ]; then brew install qt5 && brew link --force qt5 && ln -s /usr/local/Cellar/qt5/5.7.0/plugins /usr/local ; fi ;
|
||||
|
||||
# ccache
|
||||
if [ "$TRAVIS_BRANCH" != "$coverity_branch" ]; then
|
||||
|
||||
55
Changelog
55
Changelog
@@ -1,3 +1,58 @@
|
||||
* Wed Dec 14 2016 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.3.8
|
||||
- FEATURE: Start using new libtorrent 1.1.x APIs (needs at least 1.1.2). Still unofficial support. (glassez, sledgehammer999)
|
||||
- FEATURE: Add a new DHT bootstrap node run by libtorrent author arvidn. (sledgehammer999)
|
||||
- FEATURE: Option to disable tracker's favicon download. (sledgehammer999)
|
||||
- FEATURE: Shift + scroll = horizontal scroll. Closes #5980. Only for TransferListWidget, PeerListWidget. (Chocobo1)
|
||||
- BUGFIX: Actually set new path as default when checkBox is enabled in Add New Torrent dialog. (erikssm)
|
||||
- BUGFIX: Properly fix the handling of default save path store/load. (sledgehammer999)
|
||||
- BUGFIX: Fix crash when restoring from tray. Closes #5854. (Chocobo1)
|
||||
- BUGFIX: Export torrents added only after the setting was enabled. (sledgehammer999)
|
||||
- BUGFIX: Delete old rss favicon before assigning new one. (sledgehammer999)
|
||||
- BUGFIX: Don't revert save path value in the Dialog when metadata are received. Closes #5482. (sledgehammer999)
|
||||
- BUGFIX: Don't ever stop seeding forced torrents. Closes #5784. (sledgehammer999)
|
||||
- BUGFIX: Fix potential crash in TransferList widget. Closes #5873. (Chocobo1)
|
||||
- BUGFIX: Sort torrent names case insensitively. (Yez Ezey)
|
||||
- BUGFIX: Fix mistake in getting values for sorting in TransferList widget. (Anton Lashkov)
|
||||
- BUGFIX: Fix memory leaks. (dzmat, Chocobo1)
|
||||
- WEBUI: Fix webui port overflow. (thalieht)
|
||||
- WEBUI: Changed meaning of the value of the 'dl_limit', 'up_limit', 'alt_dl_limit' and 'alt_up_limit' tokens. The value is expressed in bytes and not in KiB. (sledgehammer999)
|
||||
- WEBUI: Don't request client SSL certificate. Closes #3883. (borouhin)
|
||||
- WEBUI: Bump API_VERSION and API_VERSION_MIN to 11.
|
||||
- SEARCH: Fixed extratorrent search not working Closes #5736 #5753. (Yez Ezey)
|
||||
- SEARCH: Update Demonoid plugin. (ngosang)
|
||||
- SEARCH: Remove TorrentReactor plugin. (ngosang)
|
||||
- SEARCH: Fix python auto install, deletion of installer and use 3.5.x series for Vista+. Closes #5871. (sledgehammer999)
|
||||
- SEARCH: Set /usr/local/bin before default PATH on macOS. closes #5639 #5571. This enables finding newer python installs. (Yez Ezey)
|
||||
- COSMETIC: Log: set embedded Tracker [OFF] msg type as info. (thalieht)
|
||||
- COSMETIC: Remove (mostly) useless log warnings about tracker's favicon. (sledgehammer999)
|
||||
- COSMETIC: Change RSS view layout to horizontal. Closes #5920. (Chocobo1)
|
||||
- OSX: Fix crash on exit using Qt4. (Yez Ezey)
|
||||
- OSX: Change QSettings to IniFormat on macOS. Closes #5770 #5808. (Yez Ezey)
|
||||
- LINUX: Workaround a Qt5 bug which results in a flood of network interface change singals. (Eugene Shalygin)
|
||||
- OTHER: Turkish translation for installer. (Burak Yavuz)
|
||||
- OTHER: Update portugueseBR for installer. (DaRKSoM)
|
||||
- OTHER: Update portuguese for installer. (EdwardLinux)
|
||||
- OTHER: Add --disable-qt-dbus to configure if $host_os is macOS. (Yez Ezey)
|
||||
- OTHER: New translations: Icelandic, Latvian, Malay, Occitan, Uzbek.
|
||||
- OTHER: A whole lot of code refactoring by various people.
|
||||
|
||||
* Sun Sep 11 2016 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.3.7
|
||||
- FEATURE: Delete torrent+files with Shift+Delete (pieniacy)
|
||||
- BUGFIX: Fix 6-hour speedplot point push rate. Close #5545 (Daniel Segesdi)
|
||||
- BUGFIX: Avoid spawning a new explorer.exe process when selecting "Open containing folder". Closes #5564. (Chocobo1)
|
||||
- BUGFIX: Fix loading of new geoip db due to an artificial size limit. (SagePtr)
|
||||
- BUGFIX: Better error handling and logging with smtp communication. (Brian Kendall)
|
||||
- SEARCH: Remove KickassTorrents search engine (ngosang)
|
||||
- SEARCH: Remove BTDigg search engine (ngosang)
|
||||
- SEARCH: Update Torrentz search engine (ngosang)
|
||||
|
||||
* Wed Jul 20 2016 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.3.6
|
||||
- BUGFIX: Do not create save folder in advance (glassez)
|
||||
- BUGFIX: Fix upper-bound limit of command line for "Run External Program" in Windows. Closes #5399. (Chocobo1)
|
||||
- BUGFIX: Invoke system's cmd.exe directly. (Chocobo1)
|
||||
- BUGFIX: Workaround space issues in file path for running external program on Windows. (Chocobo1)
|
||||
- BUGFIX: Fix icons are missing when using RTL languages in Options dialog. Closes #5398. (Chocobo1)
|
||||
|
||||
* Mon Jun 20 2016 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.3.5
|
||||
- FEATURE: Implement Torrent Management Mode(TMM) (glassez)
|
||||
- FEATURE: New cookies management dialog and various related fixes (glassez)
|
||||
|
||||
@@ -9,6 +9,8 @@ QMAKE_CXXFLAGS += @QBT_CONF_EXTRA_CFLAGS@
|
||||
|
||||
EXTERNAL_INCLUDES = @QBT_CONF_INCLUDES@
|
||||
EXTERNAL_INCLUDES -= $$QMAKE_DEFAULT_INCDIRS
|
||||
# added /usr/local/include due to Qt 5.7.0 bug on macOS
|
||||
macx: EXTERNAL_INCLUDES += "/usr/local/include"
|
||||
INCLUDEPATH += $$EXTERNAL_INCLUDES
|
||||
|
||||
EXTERNAL_LIBS = @LDFLAGS@ @LIBS@
|
||||
|
||||
13
configure
vendored
13
configure
vendored
@@ -4257,6 +4257,17 @@ else
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OS is macOS" >&5
|
||||
$as_echo_n "checking whether OS is macOS... " >&6; }
|
||||
if expr "$host_os" : ".*darwin.*" > /dev/null; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
enable_qt_dbus=no
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
# Require 0.23 pkg-config
|
||||
|
||||
|
||||
@@ -5090,7 +5101,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
int
|
||||
main ()
|
||||
{
|
||||
boost::system::system_category
|
||||
boost::system::error_category *a = 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,12 @@ AS_IF([expr "$host_os" : ".*freebsd.*" > /dev/null],
|
||||
LIBS="-lexecinfo $LIBS"],
|
||||
[AC_MSG_RESULT([no])])
|
||||
|
||||
AC_MSG_CHECKING([whether OS is macOS])
|
||||
AS_IF([expr "$host_os" : ".*darwin.*" > /dev/null],
|
||||
[AC_MSG_RESULT([yes])
|
||||
enable_qt_dbus=no],
|
||||
[AC_MSG_RESULT([no])])
|
||||
|
||||
# Require 0.23 pkg-config
|
||||
PKG_PROG_PKG_CONFIG([0.23])
|
||||
AS_IF([test "x$PKG_CONFIG" = "x"],
|
||||
|
||||
2
dist/mac/Info.plist
vendored
2
dist/mac/Info.plist
vendored
@@ -45,7 +45,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.3.5</string>
|
||||
<string>3.3.8</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>qBit</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
|
||||
BIN
dist/qt-translations/qt_ar.qm
vendored
BIN
dist/qt-translations/qt_ar.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_ca.qm
vendored
BIN
dist/qt-translations/qt_ca.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_cs.qm
vendored
BIN
dist/qt-translations/qt_cs.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_da.qm
vendored
BIN
dist/qt-translations/qt_da.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_de.qm
vendored
BIN
dist/qt-translations/qt_de.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_es.qm
vendored
BIN
dist/qt-translations/qt_es.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_fa.qm
vendored
Normal file
BIN
dist/qt-translations/qt_fa.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qt_fi.qm
vendored
BIN
dist/qt-translations/qt_fi.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_fr.qm
vendored
BIN
dist/qt-translations/qt_fr.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_gl.qm
vendored
BIN
dist/qt-translations/qt_gl.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_he.qm
vendored
BIN
dist/qt-translations/qt_he.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_hu.qm
vendored
BIN
dist/qt-translations/qt_hu.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_it.qm
vendored
BIN
dist/qt-translations/qt_it.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_ja.qm
vendored
BIN
dist/qt-translations/qt_ja.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_ko.qm
vendored
BIN
dist/qt-translations/qt_ko.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_lt.qm
vendored
BIN
dist/qt-translations/qt_lt.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_pl.qm
vendored
BIN
dist/qt-translations/qt_pl.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_pt.qm
vendored
BIN
dist/qt-translations/qt_pt.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_ru.qm
vendored
BIN
dist/qt-translations/qt_ru.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_sk.qm
vendored
BIN
dist/qt-translations/qt_sk.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_sl.qm
vendored
Normal file
BIN
dist/qt-translations/qt_sl.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qt_sv.qm
vendored
BIN
dist/qt-translations/qt_sv.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_uk.qm
vendored
BIN
dist/qt-translations/qt_uk.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_zh_CN.qm
vendored
BIN
dist/qt-translations/qt_zh_CN.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qt_zh_TW.qm
vendored
BIN
dist/qt-translations/qt_zh_TW.qm
vendored
Binary file not shown.
BIN
dist/qt-translations/qtbase_ca.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_ca.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_cs.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_cs.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_de.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_de.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_fi.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_fi.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_fr.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_fr.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_he.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_he.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_hu.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_hu.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_it.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_it.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_ja.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_ja.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_ko.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_ko.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_lv.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_lv.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_pl.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_pl.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_ru.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_ru.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_sk.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_sk.qm
vendored
Normal file
Binary file not shown.
BIN
dist/qt-translations/qtbase_uk.qm
vendored
Normal file
BIN
dist/qt-translations/qtbase_uk.qm
vendored
Normal file
Binary file not shown.
29
dist/windows/README.txt
vendored
29
dist/windows/README.txt
vendored
@@ -1,12 +1,12 @@
|
||||
TRANSLATORS:
|
||||
|
||||
1. Use an editor that has NSIS syntax highlighting(eg Notepad++/Geany). This will
|
||||
1. Use an editor that has NSIS syntax highlighting(eg Notepad++/Geany). This will
|
||||
make your life easier.
|
||||
2. Open the relevant .nsi file that exists in the folder named
|
||||
2. Open the relevant .nsi file that exists in the folder named
|
||||
"installer-translations"
|
||||
3. Lines starting with ";" are considered comments. These include the
|
||||
3. Lines starting with ";" are considered comments. These include the
|
||||
english message to help you with the translation.
|
||||
4. Edit only the part inside the quotation marks(""). Unless you know
|
||||
4. Edit only the part inside the quotation marks(""). Unless you know
|
||||
what you are doing.
|
||||
5. Save the files with utf8 encoding and BOM.
|
||||
6. Submit your changes: 1) as a pull request to the official git repo or
|
||||
@@ -16,17 +16,13 @@ TRANSLATORS:
|
||||
PACKAGERS:
|
||||
|
||||
You will need NSIS and upx to make the installer. You need a unicode version of NSIS.
|
||||
I tested with NSIS 3.0a0.
|
||||
I tested with NSIS 3.0 (final).
|
||||
|
||||
1. Open the options.nsi file in an editor and change line that contains
|
||||
"!define PROG_VERSION "3.0.3"" to the version of qbittorrent you just built.
|
||||
2. Extract the plugins found in the folder "nsis plugins" into your
|
||||
"!define PROG_VERSION "3.0.3"" to the version of qbittorrent you just built.
|
||||
2. Extract the plugins found in the folder "nsis plugins" into your
|
||||
NSIS's unicode Plugin directory(usually C:\Program Files\NSIS\Plugins\x86-unicode).
|
||||
Only the *.dll files are needed. Don't use the .dll from UAC.zip, use the one from "UAC Unicode.zip".
|
||||
NOTE: To build the unicode version of UAC with MSVC2008 you need:
|
||||
a) the sources from UAC.zip
|
||||
b) apply the util.cpp.diff from "UAC Unicode.zip" to util.cpp
|
||||
c) in a msvc command prompt issue: cl.exe /O1s /GS- /GR- /EHs-c- /Zl /LD /DUNICODE RunAs.cpp uac.cpp util.cpp /link kernel32.lib user32.lib shell32.lib advapi32.lib ole32.lib /DLL /MANIFEST:NO /OUT:uac.dll
|
||||
Only the *.dll files are needed. Use the unicode version of the dlls.
|
||||
3. The script you need to compile is "qbittorrent.nsi". It includes all other necessary scripts.
|
||||
4. The script expects the following file tree:
|
||||
|
||||
@@ -53,10 +49,11 @@ qbittorrent.exe
|
||||
qbittorrent.nsi
|
||||
qt.conf
|
||||
translations.nsi
|
||||
UAC.nsh
|
||||
uninstaller.nsi
|
||||
|
||||
|
||||
5. "license.txt" is a text file that contains the text rendered
|
||||
5. "license.txt" is a text file that contains the text rendered
|
||||
from src\gui\gpl.html or the text contained in COPYING
|
||||
6. "qbittorrent.exe" is the compiled binary file.
|
||||
|
||||
@@ -64,7 +61,7 @@ SCRIPT HACKERS:
|
||||
|
||||
If you add any new LangString variable to the scripts you NEED to provide
|
||||
"translations" of it to all the .nsi files inside "installer-translations.
|
||||
You can always leave the english string but you have to use all the LANG_<lang name>
|
||||
for the given variable. Otherwise, if the user chooses a language that you
|
||||
haven't provided a LANG_<lang name> for your variable then your string will be empty.
|
||||
You can always leave the english string but you have to use all the LANG_<lang name>
|
||||
for the given variable. Otherwise, if the user chooses a language that you
|
||||
haven't provided a LANG_<lang name> for your variable then your string will be empty.
|
||||
Don't worry though, NSIS throws warnings for this when compiling the scripts.
|
||||
|
||||
2
dist/windows/UAC.nsh
vendored
2
dist/windows/UAC.nsh
vendored
@@ -228,6 +228,8 @@ pop $_LOGICLIB_TEMP
|
||||
!undef _UAC_ParseDefineFlags_orin_this
|
||||
!ifdef _UAC_ParseDefineFlags_orin_f1
|
||||
!undef _UAC_ParseDefineFlags_orin_f1
|
||||
!endif
|
||||
!ifdef _UAC_ParseDefineFlags_orin_f2
|
||||
!undef _UAC_ParseDefineFlags_orin_f2
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
@@ -17,7 +17,7 @@ LangString inst_firewallinfo ${LANG_PORTUGUESE} "Adicionando regra à firewall d
|
||||
;LangString inst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before installing."
|
||||
LangString inst_warning ${LANG_PORTUGUESE} "O qBittorrent está a ser executado. Feche a aplicação antes de instalar esta versão."
|
||||
;LangString inst_uninstall_question ${LANG_ENGLISH} "A previous installation was detected. It will be uninstalled without deleting user settings."
|
||||
LangString inst_uninstall_question ${LANG_PORTUGUESE} "A previous installation was detected. It will be uninstalled without deleting user settings."
|
||||
LangString inst_uninstall_question ${LANG_PORTUGUESE} "Uma antiga instalação foi encontrada.Essa mesma será desinstalada sem apagar as definições do usuário."
|
||||
;LangString inst_unist ${LANG_ENGLISH} "Uninstalling previous version."
|
||||
LangString inst_unist ${LANG_PORTUGUESE} "A desinstalar versão anterior."
|
||||
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
|
||||
|
||||
@@ -17,7 +17,7 @@ LangString inst_firewallinfo ${LANG_PORTUGUESEBR} "Adicionando regra no firewall
|
||||
;LangString inst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before installing."
|
||||
LangString inst_warning ${LANG_PORTUGUESEBR} "qBittorrent está rodando. Por favor feche a aplicação antes de instalar."
|
||||
;LangString inst_uninstall_question ${LANG_ENGLISH} "A previous installation was detected. It will be uninstalled without deleting user settings."
|
||||
LangString inst_uninstall_question ${LANG_PORTUGUESEBR} "A previous installation was detected. It will be uninstalled without deleting user settings."
|
||||
LangString inst_uninstall_question ${LANG_PORTUGUESEBR} "Uma instalação anterior foi detectada. Ela será desistalada sem deletar as configurações de usuário."
|
||||
;LangString inst_unist ${LANG_ENGLISH} "Uninstalling previous version."
|
||||
LangString inst_unist ${LANG_PORTUGUESEBR} "Desinstalando versão anterior."
|
||||
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
|
||||
|
||||
44
dist/windows/installer-translations/turkish.nsi
vendored
44
dist/windows/installer-translations/turkish.nsi
vendored
@@ -1,51 +1,51 @@
|
||||
;Installer strings
|
||||
|
||||
;LangString inst_qbt_req ${LANG_ENGLISH} "qBittorrent (required)"
|
||||
LangString inst_qbt_req ${LANG_TURKISH} "qBittorrent (required)"
|
||||
LangString inst_qbt_req ${LANG_TURKISH} "qBittorrent (zorunlu)"
|
||||
;LangString inst_dekstop ${LANG_ENGLISH} "Create Desktop Shortcut"
|
||||
LangString inst_dekstop ${LANG_TURKISH} "Create Desktop Shortcut"
|
||||
LangString inst_dekstop ${LANG_TURKISH} "Masaüstü Kısayolu oluştur"
|
||||
;LangString inst_startmenu ${LANG_ENGLISH} "Create Start Menu Shortcut"
|
||||
LangString inst_startmenu ${LANG_TURKISH} "Create Start Menu Shortcut"
|
||||
LangString inst_startmenu ${LANG_TURKISH} "Başlangıç Menüsü Kısayolu oluştur"
|
||||
;LangString inst_torrent ${LANG_ENGLISH} "Open .torrent files with qBittorrent"
|
||||
LangString inst_torrent ${LANG_TURKISH} "Open .torrent files with qBittorrent"
|
||||
LangString inst_torrent ${LANG_TURKISH} ".torrent dosyalarını qBittorrent ile aç"
|
||||
;LangString inst_magnet ${LANG_ENGLISH} "Open magnet links with qBittorrent"
|
||||
LangString inst_magnet ${LANG_TURKISH} "Open magnet links with qBittorrent"
|
||||
LangString inst_magnet ${LANG_TURKISH} "Magnet bağlantılarını qBittorrent ile aç"
|
||||
;LangString inst_firewall ${LANG_ENGLISH} "Add Windows Firewall rule"
|
||||
LangString inst_firewall ${LANG_TURKISH} "Add Windows Firewall rule"
|
||||
LangString inst_firewall ${LANG_TURKISH} "Windows Güvenlik Duvarı kuralı ekle"
|
||||
;LangString inst_firewallinfo ${LANG_ENGLISH} "Adding Windows Firewall rule"
|
||||
LangString inst_firewallinfo ${LANG_TURKISH} "Adding Windows Firewall rule"
|
||||
LangString inst_firewallinfo ${LANG_TURKISH} "Windows Güvenlik Duvarı kuralı ekleniyor"
|
||||
;LangString inst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before installing."
|
||||
LangString inst_warning ${LANG_TURKISH} "qBittorrent is running. Please close the application before installing."
|
||||
LangString inst_warning ${LANG_TURKISH} "qBittorrent çalışıyor. Lütfen yüklemeden önce uygulamayı kapatın."
|
||||
;LangString inst_uninstall_question ${LANG_ENGLISH} "A previous installation was detected. It will be uninstalled without deleting user settings."
|
||||
LangString inst_uninstall_question ${LANG_TURKISH} "A previous installation was detected. It will be uninstalled without deleting user settings."
|
||||
LangString inst_uninstall_question ${LANG_TURKISH} "Önceki bir kurulum algılandı. Kullanıcı ayarları silinmeden kaldırılacaktır."
|
||||
;LangString inst_unist ${LANG_ENGLISH} "Uninstalling previous version."
|
||||
LangString inst_unist ${LANG_TURKISH} "Uninstalling previous version."
|
||||
LangString inst_unist ${LANG_TURKISH} "Önceki sürüm kaldırılıyor."
|
||||
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
|
||||
LangString launch_qbt ${LANG_TURKISH} "Launch qBittorrent."
|
||||
LangString launch_qbt ${LANG_TURKISH} "qBittorrent'i çalıştır."
|
||||
|
||||
|
||||
;------------------------------------
|
||||
;Uninstaller strings
|
||||
|
||||
;LangString remove_files ${LANG_ENGLISH} "Remove files"
|
||||
LangString remove_files ${LANG_TURKISH} "Remove files"
|
||||
LangString remove_files ${LANG_TURKISH} "Dosyaları kaldır"
|
||||
;LangString remove_shortcuts ${LANG_ENGLISH} "Remove shortcuts"
|
||||
LangString remove_shortcuts ${LANG_TURKISH} "Remove shortcuts"
|
||||
LangString remove_shortcuts ${LANG_TURKISH} "Kısayolları kaldır"
|
||||
;LangString remove_associations ${LANG_ENGLISH} "Remove file associations"
|
||||
LangString remove_associations ${LANG_TURKISH} "Remove file associations"
|
||||
LangString remove_associations ${LANG_TURKISH} "Dosya ilişkilendirmelerini kaldır"
|
||||
;LangString remove_registry ${LANG_ENGLISH} "Remove registry keys"
|
||||
LangString remove_registry ${LANG_TURKISH} "Remove registry keys"
|
||||
LangString remove_registry ${LANG_TURKISH} "Kayıt defteri anahtarlarını kaldır"
|
||||
;LangString remove_conf ${LANG_ENGLISH} "Remove configuration files"
|
||||
LangString remove_conf ${LANG_TURKISH} "Remove configuration files"
|
||||
LangString remove_conf ${LANG_TURKISH} "Yapılandırma dosyalarını kaldır"
|
||||
;LangString remove_firewall ${LANG_ENGLISH} "Remove Windows Firewall rule"
|
||||
LangString remove_firewall ${LANG_TURKISH} "Remove Windows Firewall rule"
|
||||
LangString remove_firewall ${LANG_TURKISH} "Windows Güvenlik Duvarı kuralını kaldır"
|
||||
;LangString remove_firewallinfo ${LANG_ENGLISH} "Removing Windows Firewall rule"
|
||||
LangString remove_firewallinfo ${LANG_TURKISH} "Removing Windows Firewall rule"
|
||||
LangString remove_firewallinfo ${LANG_TURKISH} "Windows Güvenlik Duvarı kuralı kaldırılıyor"
|
||||
;LangString remove_cache ${LANG_ENGLISH} "Remove torrents and cached data"
|
||||
LangString remove_cache ${LANG_TURKISH} "Remove torrents and cached data"
|
||||
LangString remove_cache ${LANG_TURKISH} "Torrentleri ve önbelleklenen verileri kaldır"
|
||||
;LangString uninst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before uninstalling."
|
||||
LangString uninst_warning ${LANG_TURKISH} "qBittorrent is running. Please close the application before uninstalling."
|
||||
LangString uninst_warning ${LANG_TURKISH} "qBittorrent çalışıyor. Lütfen kaldırmadan önce uygulamayı kapatın."
|
||||
;LangString uninst_tor_warn ${LANG_ENGLISH} "Not removing .torrent association. It is associated with:"
|
||||
LangString uninst_tor_warn ${LANG_TURKISH} "Not removing .torrent association. It is associated with:"
|
||||
LangString uninst_tor_warn ${LANG_TURKISH} ".torrent ilişkilendirmesi kaldırılmıyor. Şununla ilişkilendirildi:"
|
||||
;LangString uninst_mag_warn ${LANG_ENGLISH} "Not removing magnet association. It is associated with:"
|
||||
LangString uninst_mag_warn ${LANG_TURKISH} "Not removing magnet association. It is associated with:"
|
||||
LangString uninst_mag_warn ${LANG_TURKISH} "Magnet ilişkilendirmesi kaldırılmıyor. Şununla ilişkilendirildi:"
|
||||
|
||||
21
dist/windows/installer.nsi
vendored
21
dist/windows/installer.nsi
vendored
@@ -30,12 +30,13 @@ Section $(inst_qbt_req) ;"qBittorrent (required)"
|
||||
File "qbittorrent.pdb"
|
||||
File "qt.conf"
|
||||
File /oname=translations\qt_ar.qm "translations\qt_ar.qm"
|
||||
File /oname=translations\qt_bg.qm "translations\qt_bg.qm"
|
||||
File /oname=translations\qt_ca.qm "translations\qt_ca.qm"
|
||||
File /oname=translations\qt_cs.qm "translations\qt_cs.qm"
|
||||
File /oname=translations\qt_da.qm "translations\qt_da.qm"
|
||||
File /oname=translations\qt_de.qm "translations\qt_de.qm"
|
||||
File /oname=translations\qt_en.qm "translations\qt_en.qm"
|
||||
File /oname=translations\qt_es.qm "translations\qt_es.qm"
|
||||
File /oname=translations\qt_eu.qm "translations\qt_eu.qm"
|
||||
File /oname=translations\qt_fa.qm "translations\qt_fa.qm"
|
||||
File /oname=translations\qt_fi.qm "translations\qt_fi.qm"
|
||||
File /oname=translations\qt_fr.qm "translations\qt_fr.qm"
|
||||
@@ -46,15 +47,33 @@ Section $(inst_qbt_req) ;"qBittorrent (required)"
|
||||
File /oname=translations\qt_ja.qm "translations\qt_ja.qm"
|
||||
File /oname=translations\qt_ko.qm "translations\qt_ko.qm"
|
||||
File /oname=translations\qt_lt.qm "translations\qt_lt.qm"
|
||||
File /oname=translations\qt_nl.qm "translations\qt_nl.qm"
|
||||
File /oname=translations\qt_pl.qm "translations\qt_pl.qm"
|
||||
File /oname=translations\qt_pt.qm "translations\qt_pt.qm"
|
||||
File /oname=translations\qt_pt_BR.qm "translations\qt_pt_BR.qm"
|
||||
File /oname=translations\qt_ru.qm "translations\qt_ru.qm"
|
||||
File /oname=translations\qt_sk.qm "translations\qt_sk.qm"
|
||||
File /oname=translations\qt_sl.qm "translations\qt_sl.qm"
|
||||
File /oname=translations\qt_sv.qm "translations\qt_sv.qm"
|
||||
File /oname=translations\qt_tr.qm "translations\qt_tr.qm"
|
||||
File /oname=translations\qt_uk.qm "translations\qt_uk.qm"
|
||||
File /oname=translations\qt_zh_CN.qm "translations\qt_zh_CN.qm"
|
||||
File /oname=translations\qt_zh_TW.qm "translations\qt_zh_TW.qm"
|
||||
File /oname=translations\qtbase_ca.qm "translations\qtbase_ca.qm"
|
||||
File /oname=translations\qtbase_cs.qm "translations\qtbase_cs.qm"
|
||||
File /oname=translations\qtbase_de.qm "translations\qtbase_de.qm"
|
||||
File /oname=translations\qtbase_fi.qm "translations\qtbase_fi.qm"
|
||||
File /oname=translations\qtbase_fr.qm "translations\qtbase_fr.qm"
|
||||
File /oname=translations\qtbase_he.qm "translations\qtbase_he.qm"
|
||||
File /oname=translations\qtbase_hu.qm "translations\qtbase_hu.qm"
|
||||
File /oname=translations\qtbase_it.qm "translations\qtbase_it.qm"
|
||||
File /oname=translations\qtbase_ja.qm "translations\qtbase_ja.qm"
|
||||
File /oname=translations\qtbase_ko.qm "translations\qtbase_ko.qm"
|
||||
File /oname=translations\qtbase_lv.qm "translations\qtbase_lv.qm"
|
||||
File /oname=translations\qtbase_pl.qm "translations\qtbase_pl.qm"
|
||||
File /oname=translations\qtbase_ru.qm "translations\qtbase_ru.qm"
|
||||
File /oname=translations\qtbase_sk.qm "translations\qtbase_sk.qm"
|
||||
File /oname=translations\qtbase_uk.qm "translations\qtbase_uk.qm"
|
||||
|
||||
; Write the installation path into the registry
|
||||
WriteRegStr HKLM "Software\qBittorrent" "InstallLocation" "$INSTDIR"
|
||||
|
||||
BIN
dist/windows/nsis plugins/UAC Unicode.zip
vendored
BIN
dist/windows/nsis plugins/UAC Unicode.zip
vendored
Binary file not shown.
BIN
dist/windows/nsis plugins/UAC.zip
vendored
BIN
dist/windows/nsis plugins/UAC.zip
vendored
Binary file not shown.
2
dist/windows/options.nsi
vendored
2
dist/windows/options.nsi
vendored
@@ -19,7 +19,7 @@ XPStyle on
|
||||
!define CSIDL_APPDATA '0x1A' ;Application Data path
|
||||
!define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
|
||||
|
||||
!define PROG_VERSION "3.3.5"
|
||||
!define PROG_VERSION "3.3.8"
|
||||
!define MUI_FINISHPAGE_RUN
|
||||
!define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
|
||||
!define MUI_FINISHPAGE_RUN_TEXT $(launch_qbt)
|
||||
|
||||
21
dist/windows/uninstaller.nsi
vendored
21
dist/windows/uninstaller.nsi
vendored
@@ -6,12 +6,13 @@
|
||||
Delete "$INSTDIR\qbittorrent.pdb"
|
||||
Delete "$INSTDIR\qt.conf"
|
||||
Delete "$INSTDIR\translations\qt_ar.qm"
|
||||
Delete "$INSTDIR\translations\qt_bg.qm"
|
||||
Delete "$INSTDIR\translations\qt_ca.qm"
|
||||
Delete "$INSTDIR\translations\qt_cs.qm"
|
||||
Delete "$INSTDIR\translations\qt_da.qm"
|
||||
Delete "$INSTDIR\translations\qt_de.qm"
|
||||
Delete "$INSTDIR\translations\qt_en.qm"
|
||||
Delete "$INSTDIR\translations\qt_es.qm"
|
||||
Delete "$INSTDIR\translations\qt_eu.qm"
|
||||
Delete "$INSTDIR\translations\qt_fa.qm"
|
||||
Delete "$INSTDIR\translations\qt_fi.qm"
|
||||
Delete "$INSTDIR\translations\qt_fr.qm"
|
||||
@@ -22,15 +23,33 @@
|
||||
Delete "$INSTDIR\translations\qt_ja.qm"
|
||||
Delete "$INSTDIR\translations\qt_ko.qm"
|
||||
Delete "$INSTDIR\translations\qt_lt.qm"
|
||||
Delete "$INSTDIR\translations\qt_nl.qm"
|
||||
Delete "$INSTDIR\translations\qt_pl.qm"
|
||||
Delete "$INSTDIR\translations\qt_pt_BR.qm"
|
||||
Delete "$INSTDIR\translations\qt_pt.qm"
|
||||
Delete "$INSTDIR\translations\qt_ru.qm"
|
||||
Delete "$INSTDIR\translations\qt_sk.qm"
|
||||
Delete "$INSTDIR\translations\qt_sl.qm"
|
||||
Delete "$INSTDIR\translations\qt_sv.qm"
|
||||
Delete "$INSTDIR\translations\qt_tr.qm"
|
||||
Delete "$INSTDIR\translations\qt_uk.qm"
|
||||
Delete "$INSTDIR\translations\qt_zh_CN.qm"
|
||||
Delete "$INSTDIR\translations\qt_zh_TW.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_ca.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_cs.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_de.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_fi.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_fr.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_he.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_hu.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_it.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_ja.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_ko.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_lv.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_pl.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_ru.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_sk.qm"
|
||||
Delete "$INSTDIR\translations\qtbase_uk.qm"
|
||||
Delete "$INSTDIR\uninst.exe"
|
||||
|
||||
; Remove directories used
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 17
|
||||
#serial 18
|
||||
|
||||
AC_DEFUN([AX_BOOST_SYSTEM],
|
||||
[
|
||||
@@ -68,9 +68,10 @@ AC_DEFUN([AX_BOOST_SYSTEM],
|
||||
ax_cv_boost_system,
|
||||
[AC_LANG_PUSH([C++])
|
||||
CXXFLAGS_SAVE=$CXXFLAGS
|
||||
CXXFLAGS=
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/system/error_code.hpp>]],
|
||||
[[boost::system::system_category]])],
|
||||
[[boost::system::error_category *a = 0;]])],
|
||||
ax_cv_boost_system=yes, ax_cv_boost_system=no)
|
||||
CXXFLAGS=$CXXFLAGS_SAVE
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
20
macxconf.pri
20
macxconf.pri
@@ -34,6 +34,8 @@ qt_translations.files = \
|
||||
$$QT_LANG_PATH/qt_da.qm \
|
||||
$$QT_LANG_PATH/qt_de.qm \
|
||||
$$QT_LANG_PATH/qt_es.qm \
|
||||
$$QT_LANG_PATH/qt_eu.qm \
|
||||
$$QT_LANG_PATH/qt_fa.qm \
|
||||
$$QT_LANG_PATH/qt_fi.qm \
|
||||
$$QT_LANG_PATH/qt_fr.qm \
|
||||
$$QT_LANG_PATH/qt_gl.qm \
|
||||
@@ -49,11 +51,27 @@ qt_translations.files = \
|
||||
$$QT_LANG_PATH/qt_pt_BR.qm \
|
||||
$$QT_LANG_PATH/qt_ru.qm \
|
||||
$$QT_LANG_PATH/qt_sk.qm \
|
||||
$$QT_LANG_PATH/qt_sl.qm \
|
||||
$$QT_LANG_PATH/qt_sv.qm \
|
||||
$$QT_LANG_PATH/qt_tr.qm \
|
||||
$$QT_LANG_PATH/qt_uk.qm \
|
||||
$$QT_LANG_PATH/qt_zh_CN.qm \
|
||||
$$QT_LANG_PATH/qt_zh_TW.qm
|
||||
$$QT_LANG_PATH/qt_zh_TW.qm \
|
||||
$$QT_LANG_PATH/qtbase_ca.qm \
|
||||
$$QT_LANG_PATH/qtbase_cs.qm \
|
||||
$$QT_LANG_PATH/qtbase_de.qm \
|
||||
$$QT_LANG_PATH/qtbase_fi.qm \
|
||||
$$QT_LANG_PATH/qtbase_fr.qm \
|
||||
$$QT_LANG_PATH/qtbase_he.qm \
|
||||
$$QT_LANG_PATH/qtbase_hu.qm \
|
||||
$$QT_LANG_PATH/qtbase_it.qm \
|
||||
$$QT_LANG_PATH/qtbase_ja.qm \
|
||||
$$QT_LANG_PATH/qtbase_ko.qm \
|
||||
$$QT_LANG_PATH/qtbase_lv.qm \
|
||||
$$QT_LANG_PATH/qtbase_pl.qm \
|
||||
$$QT_LANG_PATH/qtbase_ru.qm \
|
||||
$$QT_LANG_PATH/qtbase_sk.qm \
|
||||
$$QT_LANG_PATH/qtbase_uk.qm
|
||||
QMAKE_BUNDLE_DATA += qt_translations
|
||||
|
||||
ICON = $$DIST_PATH/qbittorrent_mac.icns
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
#include "base/net/smtp.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/net/geoipmanager.h"
|
||||
#include "base/net/proxyconfigurationmanager.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
|
||||
@@ -261,9 +262,11 @@ void Application::runExternalProgram(BitTorrent::TorrentHandle *const torrent) c
|
||||
#if defined(Q_OS_UNIX)
|
||||
QProcess::startDetached(QLatin1String("/bin/sh"), {QLatin1String("-c"), program});
|
||||
#elif defined(Q_OS_WIN) // test cmd: `echo "%F" > "c:\ab ba.txt"`
|
||||
program.prepend(QLatin1String("cmd.exe /C "));
|
||||
if (program.size() >= MAX_PATH) {
|
||||
logger->addMessage(tr("Torrent: %1, run external program command too long (length > %2), execution failed.").arg(torrent->name()).arg(MAX_PATH), Log::CRITICAL);
|
||||
program.prepend(QLatin1String("\"")).append(QLatin1String("\""));
|
||||
program.prepend(Utils::Misc::windowsSystemPath() + QLatin1String("\\cmd.exe /C "));
|
||||
const int cmdMaxLength = 32768; // max length (incl. terminate char) for `lpCommandLine` in `CreateProcessW()`
|
||||
if ((program.size() + 1) > cmdMaxLength) {
|
||||
logger->addMessage(tr("Torrent: %1, run external program command too long (length > %2), execution failed.").arg(torrent->name()).arg(cmdMaxLength), Log::CRITICAL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -393,6 +396,7 @@ void Application::processParams(const QStringList ¶ms)
|
||||
|
||||
int Application::exec(const QStringList ¶ms)
|
||||
{
|
||||
Net::ProxyConfigurationManager::initInstance();
|
||||
Net::DownloadManager::initInstance();
|
||||
#ifdef DISABLE_GUI
|
||||
IconProvider::initInstance();
|
||||
@@ -619,6 +623,7 @@ void Application::cleanup()
|
||||
Net::GeoIPManager::freeInstance();
|
||||
#endif
|
||||
Net::DownloadManager::freeInstance();
|
||||
Net::ProxyConfigurationManager::freeInstance();
|
||||
Preferences::freeInstance();
|
||||
SettingsStorage::freeInstance();
|
||||
delete m_fileLogger;
|
||||
|
||||
@@ -135,6 +135,12 @@ int main(int argc, char *argv[])
|
||||
// We must save it here because QApplication constructor may change it
|
||||
bool isOneArg = (argc == 2);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
// On macOS 10.12 Sierra, Apple changed the behaviour of CFPreferencesSetValue() https://bugreports.qt.io/browse/QTBUG-56344
|
||||
// Due to this, we have to move from native plist to IniFormat
|
||||
macMigratePlists();
|
||||
#endif
|
||||
|
||||
// Create Application
|
||||
QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString();
|
||||
QScopedPointer<Application> app(new Application(appId, argc, argv));
|
||||
@@ -230,6 +236,17 @@ int main(int argc, char *argv[])
|
||||
qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1));
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
{
|
||||
// Since Apple made difficult for users to set PATH, we set here for convenience.
|
||||
// Users are supposed to install Homebrew Python for search function.
|
||||
// For more info see issue #5571.
|
||||
QByteArray path = "/usr/local/bin:";
|
||||
path += qgetenv("PATH");
|
||||
qputenv("PATH", path.constData());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
if (!upgrade()) return EXIT_FAILURE;
|
||||
#else
|
||||
|
||||
@@ -29,24 +29,31 @@
|
||||
#ifndef UPGRADE_H
|
||||
#define UPGRADE_H
|
||||
|
||||
#include <libtorrent/lazy_entry.hpp>
|
||||
#include <libtorrent/entry.hpp>
|
||||
#include <libtorrent/version.hpp>
|
||||
#if LIBTORRENT_VERSION_NUM >= 10100
|
||||
#include <libtorrent/bdecode.hpp>
|
||||
#endif
|
||||
#include <libtorrent/bencode.hpp>
|
||||
#include <libtorrent/entry.hpp>
|
||||
#if LIBTORRENT_VERSION_NUM < 10100
|
||||
#include <libtorrent/lazy_entry.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QRegExp>
|
||||
#ifndef DISABLE_GUI
|
||||
#include <QMessageBox>
|
||||
#endif
|
||||
#include <QRegExp>
|
||||
#include <QString>
|
||||
|
||||
#include "base/logger.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "base/qinisettings.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/qinisettings.h"
|
||||
|
||||
bool userAcceptsUpgrade()
|
||||
{
|
||||
@@ -86,10 +93,16 @@ bool upgradeResumeFile(const QString &filepath, const QVariantHash &oldTorrent =
|
||||
QByteArray data = file1.readAll();
|
||||
file1.close();
|
||||
|
||||
libtorrent::lazy_entry fastOld;
|
||||
libtorrent::error_code ec;
|
||||
libtorrent::lazy_bdecode(data.constData(), data.constData() + data.size(), fastOld, ec);
|
||||
if (ec || (fastOld.type() != libtorrent::lazy_entry::dict_t)) return false;
|
||||
#if LIBTORRENT_VERSION_NUM < 10100
|
||||
libtorrent::lazy_entry fastOld;
|
||||
libtorrent::lazy_bdecode(data.constData(), data.constData() + data.size(), fastOld, ec);
|
||||
if (ec || (fastOld.type() != libtorrent::lazy_entry::dict_t)) return false;
|
||||
#else
|
||||
libtorrent::bdecode_node fastOld;
|
||||
libtorrent::bdecode(data.constData(), data.constData() + data.size(), fastOld, ec);
|
||||
if (ec || (fastOld.type() != libtorrent::bdecode_node::dict_t)) return false;
|
||||
#endif
|
||||
|
||||
libtorrent::entry fastNew;
|
||||
fastNew = fastOld;
|
||||
@@ -143,7 +156,12 @@ bool upgrade(bool ask = true)
|
||||
upgradeResumeFile(backupFolderDir.absoluteFilePath(backupFile));
|
||||
// ****************************************************************************************
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
// native .plist
|
||||
QSettings *oldResumeSettings = new QSettings("qBittorrent", "qBittorrent-resume");
|
||||
#else
|
||||
QIniSettings *oldResumeSettings = new QIniSettings("qBittorrent", "qBittorrent-resume");
|
||||
#endif
|
||||
QString oldResumeFilename = oldResumeSettings->fileName();
|
||||
QVariantHash oldResumeData = oldResumeSettings->value("torrents").toHash();
|
||||
delete oldResumeSettings;
|
||||
@@ -210,4 +228,34 @@ bool upgrade(bool ask = true)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
void migratePlistToIni(const QString &application)
|
||||
{
|
||||
QIniSettings iniFile("qBittorrent", application);
|
||||
if (iniFile.allKeys().isEmpty()) return; // We copy the contents of plist, only if inifile does not exist(is empty).
|
||||
|
||||
QSettings *plistFile = new QSettings("qBittorrent", application);
|
||||
plistFile->setFallbacksEnabled(false);
|
||||
const QStringList plist = plistFile->allKeys();
|
||||
if (!plist.isEmpty()) {
|
||||
foreach (const QString &key, plist)
|
||||
iniFile.setValue(key, plistFile->value(key));
|
||||
plistFile->clear();
|
||||
}
|
||||
|
||||
QString plistPath = plistFile->fileName();
|
||||
delete plistFile;
|
||||
Utils::Fs::forceRemove(plistPath);
|
||||
}
|
||||
|
||||
void macMigratePlists()
|
||||
{
|
||||
migratePlistToIni("qBittorrent-data");
|
||||
migratePlistToIni("qBittorrent-rss");
|
||||
migratePlistToIni("qBittorrent");
|
||||
}
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
|
||||
#endif // UPGRADE_H
|
||||
|
||||
@@ -30,6 +30,7 @@ net/downloadmanager.h
|
||||
net/geoipmanager.h
|
||||
net/portforwarder.h
|
||||
net/private/geoipdatabase.h
|
||||
net/proxyconfigurationmanager.h
|
||||
net/reverseresolution.h
|
||||
net/smtp.h
|
||||
rss/private/rssparser.h
|
||||
@@ -88,6 +89,7 @@ net/downloadmanager.cpp
|
||||
net/geoipmanager.cpp
|
||||
net/portforwarder.cpp
|
||||
net/private/geoipdatabase.cpp
|
||||
net/proxyconfigurationmanager.cpp
|
||||
net/reverseresolution.cpp
|
||||
net/smtp.cpp
|
||||
rss/private/rssparser.cpp
|
||||
|
||||
@@ -5,6 +5,7 @@ HEADERS += \
|
||||
$$PWD/qinisettings.h \
|
||||
$$PWD/logger.h \
|
||||
$$PWD/settingsstorage.h \
|
||||
$$PWD/settingvalue.h \
|
||||
$$PWD/preferences.h \
|
||||
$$PWD/indexrange.h \
|
||||
$$PWD/iconprovider.h \
|
||||
@@ -20,6 +21,7 @@ HEADERS += \
|
||||
$$PWD/net/downloadhandler.h \
|
||||
$$PWD/net/geoipmanager.h \
|
||||
$$PWD/net/portforwarder.h \
|
||||
$$PWD/net/proxyconfigurationmanager.h \
|
||||
$$PWD/net/reverseresolution.h \
|
||||
$$PWD/net/smtp.h \
|
||||
$$PWD/net/private/geoipdatabase.h \
|
||||
@@ -74,6 +76,7 @@ SOURCES += \
|
||||
$$PWD/net/downloadhandler.cpp \
|
||||
$$PWD/net/geoipmanager.cpp \
|
||||
$$PWD/net/portforwarder.cpp \
|
||||
$$PWD/net/proxyconfigurationmanager.cpp \
|
||||
$$PWD/net/reverseresolution.cpp \
|
||||
$$PWD/net/smtp.cpp \
|
||||
$$PWD/net/private/geoipdatabase.cpp \
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
#include <QTime>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/preferences.h"
|
||||
#include "bandwidthscheduler.h"
|
||||
|
||||
BandwidthScheduler::BandwidthScheduler(QObject *parent)
|
||||
: QTimer(parent)
|
||||
{
|
||||
Q_ASSERT(Preferences::instance()->isSchedulerEnabled());
|
||||
// Single shot, we call start() again manually
|
||||
setSingleShot(true);
|
||||
// Connect Signals/Slots
|
||||
@@ -47,8 +47,7 @@ BandwidthScheduler::BandwidthScheduler(QObject *parent)
|
||||
void BandwidthScheduler::start()
|
||||
{
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
Q_ASSERT(pref->isSchedulerEnabled());
|
||||
bool alt_bw_enabled = pref->isAltBandwidthEnabled();
|
||||
bool alt_bw_enabled = BitTorrent::Session::instance()->isAltGlobalSpeedLimitEnabled();
|
||||
|
||||
QTime start = pref->getSchedulerStartTime();
|
||||
QTime end = pref->getSchedulerEndTime();
|
||||
|
||||
@@ -55,10 +55,10 @@ FilterParserThread::~FilterParserThread()
|
||||
}
|
||||
|
||||
// Parser for eMule ip filter in DAT format
|
||||
int FilterParserThread::parseDATFilterFile(QString m_filePath, libt::ip_filter &filter)
|
||||
int FilterParserThread::parseDATFilterFile(QString filePath, libt::ip_filter &filter)
|
||||
{
|
||||
int ruleCount = 0;
|
||||
QFile file(m_filePath);
|
||||
QFile file(filePath);
|
||||
if (!file.exists()) return ruleCount;
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
@@ -149,10 +149,10 @@ int FilterParserThread::parseDATFilterFile(QString m_filePath, libt::ip_filter &
|
||||
}
|
||||
|
||||
// Parser for PeerGuardian ip filter in p2p format
|
||||
int FilterParserThread::parseP2PFilterFile(QString m_filePath, libt::ip_filter &filter)
|
||||
int FilterParserThread::parseP2PFilterFile(QString filePath, libt::ip_filter &filter)
|
||||
{
|
||||
int ruleCount = 0;
|
||||
QFile file(m_filePath);
|
||||
QFile file(filePath);
|
||||
if (!file.exists()) return ruleCount;
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
@@ -257,10 +257,10 @@ int FilterParserThread::getlineInStream(QDataStream &stream, std::string &name,
|
||||
}
|
||||
|
||||
// Parser for PeerGuardian ip filter in p2p format
|
||||
int FilterParserThread::parseP2BFilterFile(QString m_filePath, libt::ip_filter &filter)
|
||||
int FilterParserThread::parseP2BFilterFile(QString filePath, libt::ip_filter &filter)
|
||||
{
|
||||
int ruleCount = 0;
|
||||
QFile file(m_filePath);
|
||||
QFile file(filePath);
|
||||
if (!file.exists()) return ruleCount;
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
@@ -369,7 +369,7 @@ int FilterParserThread::parseP2BFilterFile(QString m_filePath, libt::ip_filter &
|
||||
// * eMule IP list (DAT): http://wiki.phoenixlabs.org/wiki/DAT_Format
|
||||
// * PeerGuardian Text (P2P): http://wiki.phoenixlabs.org/wiki/P2P_Format
|
||||
// * PeerGuardian Binary (P2B): http://wiki.phoenixlabs.org/wiki/P2B_Format
|
||||
void FilterParserThread::processFilterFile(QString _filePath)
|
||||
void FilterParserThread::processFilterFile(QString filePath)
|
||||
{
|
||||
if (isRunning()) {
|
||||
// Already parsing a filter, m_abort first
|
||||
@@ -378,27 +378,11 @@ void FilterParserThread::processFilterFile(QString _filePath)
|
||||
}
|
||||
|
||||
m_abort = false;
|
||||
m_filePath = _filePath;
|
||||
m_filePath = filePath;
|
||||
// Run it
|
||||
start();
|
||||
}
|
||||
|
||||
void FilterParserThread::processFilterList(libt::session *s, const QStringList &IPs)
|
||||
{
|
||||
// First, import current filter
|
||||
libt::ip_filter filter = s->get_ip_filter();
|
||||
foreach (const QString &ip, IPs) {
|
||||
qDebug("Manual ban of peer %s", ip.toLocal8Bit().constData());
|
||||
boost::system::error_code ec;
|
||||
libt::address addr = libt::address::from_string(ip.toLocal8Bit().constData(), ec);
|
||||
Q_ASSERT(!ec);
|
||||
if (!ec)
|
||||
filter.add_rule(addr, addr, libt::ip_filter::blocked);
|
||||
}
|
||||
|
||||
s->set_ip_filter(filter);
|
||||
}
|
||||
|
||||
QString FilterParserThread::cleanupIPAddress(QString _ip)
|
||||
{
|
||||
_ip = _ip.trimmed();
|
||||
|
||||
@@ -54,8 +54,7 @@ public:
|
||||
int parseP2PFilterFile(QString filePath, libtorrent::ip_filter &filter);
|
||||
int getlineInStream(QDataStream &stream, std::string &name, char delim);
|
||||
int parseP2BFilterFile(QString filePath, libtorrent::ip_filter &filter);
|
||||
void processFilterFile(QString _filePath);
|
||||
static void processFilterList(libtorrent::session *s, const QStringList &IPs);
|
||||
void processFilterFile(QString filePath);
|
||||
|
||||
signals:
|
||||
void IPFilterParsed(int ruleCount);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,17 +30,23 @@
|
||||
#ifndef BITTORRENT_SESSION_H
|
||||
#define BITTORRENT_SESSION_H
|
||||
|
||||
#include <vector>
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
#include <QFile>
|
||||
#include <QHash>
|
||||
#include <QMap>
|
||||
#include <QPointer>
|
||||
#include <QVector>
|
||||
#if LIBTORRENT_VERSION_NUM < 10100
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
#endif
|
||||
#include <QNetworkConfigurationManager>
|
||||
#include <QPointer>
|
||||
#include <QReadWriteLock>
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
#include <QWaitCondition>
|
||||
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
#include "base/settingvalue.h"
|
||||
#include "base/tristatebool.h"
|
||||
#include "base/types.h"
|
||||
#include "torrentinfo.h"
|
||||
@@ -52,19 +58,12 @@ namespace libtorrent
|
||||
class entry;
|
||||
struct add_torrent_params;
|
||||
struct pe_settings;
|
||||
struct session_settings;
|
||||
struct session_status;
|
||||
|
||||
#if LIBTORRENT_VERSION_NUM < 10100
|
||||
struct proxy_settings;
|
||||
struct session_settings;
|
||||
#else
|
||||
namespace aux
|
||||
{
|
||||
struct proxy_settings;
|
||||
}
|
||||
|
||||
typedef aux::proxy_settings proxy_settings;
|
||||
struct settings_pack;
|
||||
#endif
|
||||
struct session_status;
|
||||
|
||||
class alert;
|
||||
struct torrent_alert;
|
||||
@@ -111,7 +110,6 @@ class FilterParserThread;
|
||||
class BandwidthScheduler;
|
||||
class Statistics;
|
||||
class ResumeDataSavingManager;
|
||||
class SettingsStorage;
|
||||
|
||||
enum MaxRatioAction
|
||||
{
|
||||
@@ -172,13 +170,6 @@ namespace BitTorrent
|
||||
static void freeInstance();
|
||||
static Session *instance();
|
||||
|
||||
bool isDHTEnabled() const;
|
||||
bool isLSDEnabled() const;
|
||||
bool isPexEnabled() const;
|
||||
bool isQueueingEnabled() const;
|
||||
qreal globalMaxRatio() const;
|
||||
bool isAppendExtensionEnabled() const;
|
||||
|
||||
QString defaultSavePath() const;
|
||||
void setDefaultSavePath(QString path);
|
||||
QString tempPath() const;
|
||||
@@ -219,8 +210,124 @@ namespace BitTorrent
|
||||
bool isDisableAutoTMMWhenCategorySavePathChanged() const;
|
||||
void setDisableAutoTMMWhenCategorySavePathChanged(bool value);
|
||||
|
||||
qreal globalMaxRatio() const;
|
||||
void setGlobalMaxRatio(qreal ratio);
|
||||
bool isDHTEnabled() const;
|
||||
void setDHTEnabled(bool enabled);
|
||||
bool isLSDEnabled() const;
|
||||
void setLSDEnabled(bool enabled);
|
||||
bool isPeXEnabled() const;
|
||||
void setPeXEnabled(bool enabled);
|
||||
bool isTrackerExchangeEnabled() const;
|
||||
void setTrackerExchangeEnabled(bool enabled);
|
||||
bool isAddTorrentPaused() const;
|
||||
void setAddTorrentPaused(bool value);
|
||||
bool isTrackerEnabled() const;
|
||||
void setTrackerEnabled(bool enabled);
|
||||
bool isAppendExtensionEnabled() const;
|
||||
void setAppendExtensionEnabled(bool enabled);
|
||||
uint refreshInterval() const;
|
||||
void setRefreshInterval(uint value);
|
||||
bool isPreallocationEnabled() const;
|
||||
void setPreallocationEnabled(bool enabled);
|
||||
QString torrentExportDirectory() const;
|
||||
void setTorrentExportDirectory(QString path);
|
||||
QString finishedTorrentExportDirectory() const;
|
||||
void setFinishedTorrentExportDirectory(QString path);
|
||||
|
||||
int globalDownloadSpeedLimit() const;
|
||||
void setGlobalDownloadSpeedLimit(int limit);
|
||||
int globalUploadSpeedLimit() const;
|
||||
void setGlobalUploadSpeedLimit(int limit);
|
||||
int altGlobalDownloadSpeedLimit() const;
|
||||
void setAltGlobalDownloadSpeedLimit(int limit);
|
||||
int altGlobalUploadSpeedLimit() const;
|
||||
void setAltGlobalUploadSpeedLimit(int limit);
|
||||
int downloadSpeedLimit() const;
|
||||
void setDownloadSpeedLimit(int limit);
|
||||
int uploadSpeedLimit() const;
|
||||
void setUploadSpeedLimit(int limit);
|
||||
bool isAltGlobalSpeedLimitEnabled() const;
|
||||
void setAltGlobalSpeedLimitEnabled(bool enabled);
|
||||
bool isBandwidthSchedulerEnabled() const;
|
||||
void setBandwidthSchedulerEnabled(bool enabled);
|
||||
|
||||
uint saveResumeDataInterval() const;
|
||||
void setSaveResumeDataInterval(uint value);
|
||||
int port() const;
|
||||
void setPort(int port);
|
||||
bool useRandomPort() const;
|
||||
void setUseRandomPort(bool value);
|
||||
QString networkInterface() const;
|
||||
void setNetworkInterface(const QString &interface);
|
||||
QString networkInterfaceName() const;
|
||||
void setNetworkInterfaceName(const QString &name);
|
||||
QString networkInterfaceAddress() const;
|
||||
void setNetworkInterfaceAddress(const QString &address);
|
||||
bool isIPv6Enabled() const;
|
||||
void setIPv6Enabled(bool enabled);
|
||||
int encryption() const;
|
||||
void setEncryption(int state);
|
||||
bool isForceProxyEnabled() const;
|
||||
void setForceProxyEnabled(bool enabled);
|
||||
bool isProxyPeerConnectionsEnabled() const;
|
||||
void setProxyPeerConnectionsEnabled(bool enabled);
|
||||
bool isAddTrackersEnabled() const;
|
||||
void setAddTrackersEnabled(bool enabled);
|
||||
QString additionalTrackers() const;
|
||||
void setAdditionalTrackers(const QString &trackers);
|
||||
bool isIPFilteringEnabled() const;
|
||||
void setIPFilteringEnabled(bool enabled);
|
||||
QString IPFilterFile() const;
|
||||
void setIPFilterFile(QString path);
|
||||
bool announceToAllTrackers() const;
|
||||
void setAnnounceToAllTrackers(bool val);
|
||||
uint diskCacheSize() const;
|
||||
void setDiskCacheSize(uint size);
|
||||
uint diskCacheTTL() const;
|
||||
void setDiskCacheTTL(uint ttl);
|
||||
bool useOSCache() const;
|
||||
void setUseOSCache(bool use);
|
||||
bool isAnonymousModeEnabled() const;
|
||||
void setAnonymousModeEnabled(bool enabled);
|
||||
bool isQueueingSystemEnabled() const;
|
||||
void setQueueingSystemEnabled(bool enabled);
|
||||
bool ignoreSlowTorrentsForQueueing() const;
|
||||
void setIgnoreSlowTorrentsForQueueing(bool ignore);
|
||||
uint outgoingPortsMin() const;
|
||||
void setOutgoingPortsMin(uint min);
|
||||
uint outgoingPortsMax() const;
|
||||
void setOutgoingPortsMax(uint max);
|
||||
bool ignoreLimitsOnLAN() const;
|
||||
void setIgnoreLimitsOnLAN(bool ignore);
|
||||
bool includeOverheadInLimits() const;
|
||||
void setIncludeOverheadInLimits(bool include);
|
||||
QString announceIP() const;
|
||||
void setAnnounceIP(const QString &ip);
|
||||
bool isSuperSeedingEnabled() const;
|
||||
void setSuperSeedingEnabled(bool enabled);
|
||||
int maxConnections() const;
|
||||
void setMaxConnections(int max);
|
||||
int maxHalfOpenConnections() const;
|
||||
void setMaxHalfOpenConnections(int max);
|
||||
int maxConnectionsPerTorrent() const;
|
||||
void setMaxConnectionsPerTorrent(int max);
|
||||
int maxUploads() const;
|
||||
void setMaxUploads(int max);
|
||||
int maxUploadsPerTorrent() const;
|
||||
void setMaxUploadsPerTorrent(int max);
|
||||
int maxActiveDownloads() const;
|
||||
void setMaxActiveDownloads(int max);
|
||||
int maxActiveUploads() const;
|
||||
void setMaxActiveUploads(int max);
|
||||
int maxActiveTorrents() const;
|
||||
void setMaxActiveTorrents(int max);
|
||||
bool isUTPEnabled() const;
|
||||
void setUTPEnabled(bool enabled);
|
||||
bool isUTPRateLimited() const;
|
||||
void setUTPRateLimited(bool limited);
|
||||
bool isTrackerFilteringEnabled() const;
|
||||
void setTrackerFilteringEnabled(bool enabled);
|
||||
|
||||
TorrentHandle *findTorrent(const InfoHash &hash) const;
|
||||
QHash<InfoHash, TorrentHandle *> torrents() const;
|
||||
@@ -231,19 +338,11 @@ namespace BitTorrent
|
||||
CacheStatus cacheStatus() const;
|
||||
quint64 getAlltimeDL() const;
|
||||
quint64 getAlltimeUL() const;
|
||||
int downloadRateLimit() const;
|
||||
int uploadRateLimit() const;
|
||||
bool isListening() const;
|
||||
|
||||
MaxRatioAction maxRatioAction() const;
|
||||
void setMaxRatioAction(MaxRatioAction act);
|
||||
|
||||
void changeSpeedLimitMode(bool alternative);
|
||||
void setDownloadRateLimit(int rate);
|
||||
void setUploadRateLimit(int rate);
|
||||
void setGlobalMaxRatio(qreal ratio);
|
||||
void enableIPFilter(const QString &filterPath, bool force = false);
|
||||
void disableIPFilter();
|
||||
void banIP(const QString &ip);
|
||||
|
||||
bool isKnownTorrent(const InfoHash &hash) const;
|
||||
@@ -304,7 +403,7 @@ namespace BitTorrent
|
||||
void trackerAuthenticationRequired(BitTorrent::TorrentHandle *const torrent);
|
||||
void recursiveTorrentDownloadPossible(BitTorrent::TorrentHandle *const torrent);
|
||||
void speedLimitModeChanged(bool alternative);
|
||||
void ipFilterParsed(bool error, int ruleCount);
|
||||
void IPFilterParsed(bool error, int ruleCount);
|
||||
void trackersAdded(BitTorrent::TorrentHandle *const torrent, const QList<BitTorrent::TrackerEntry> &trackers);
|
||||
void trackersRemoved(BitTorrent::TorrentHandle *const torrent, const QList<BitTorrent::TrackerEntry> &trackers);
|
||||
void trackersChanged(BitTorrent::TorrentHandle *const torrent);
|
||||
@@ -316,7 +415,7 @@ namespace BitTorrent
|
||||
void subcategoriesSupportChanged();
|
||||
|
||||
private slots:
|
||||
void configure();
|
||||
void configureDeferred();
|
||||
void readAlerts();
|
||||
void refresh();
|
||||
void processBigRatios();
|
||||
@@ -341,20 +440,24 @@ namespace BitTorrent
|
||||
void initResumeFolder();
|
||||
|
||||
// Session configuration
|
||||
void setSessionSettings();
|
||||
void setProxySettings(libtorrent::proxy_settings proxySettings);
|
||||
void adjustLimits();
|
||||
Q_INVOKABLE void configure();
|
||||
#if LIBTORRENT_VERSION_NUM < 10100
|
||||
void configure(libtorrent::session_settings &sessionSettings);
|
||||
void adjustLimits(libtorrent::session_settings &sessionSettings);
|
||||
#else
|
||||
void configure(libtorrent::settings_pack &settingsPack);
|
||||
void adjustLimits(libtorrent::settings_pack &settingsPack);
|
||||
#endif
|
||||
void adjustLimits();
|
||||
void processBannedIPs();
|
||||
const QStringList getListeningIPs();
|
||||
void setListeningPort();
|
||||
void preAllocateAllFiles(bool b);
|
||||
void setMaxConnectionsPerTorrent(int max);
|
||||
void setMaxUploadsPerTorrent(int max);
|
||||
void enableLSD(bool enable);
|
||||
void enableDHT(bool enable);
|
||||
void configureListeningInterface();
|
||||
void changeSpeedLimitMode_impl(bool alternative);
|
||||
|
||||
void setAppendExtension(bool append);
|
||||
void enableTracker(bool enable);
|
||||
void enableBandwidthScheduler();
|
||||
void populateAdditionalTrackers();
|
||||
void enableIPFilter();
|
||||
void disableIPFilter();
|
||||
|
||||
void startUpTorrents();
|
||||
bool addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri,
|
||||
@@ -389,35 +492,99 @@ namespace BitTorrent
|
||||
void saveResumeData();
|
||||
|
||||
#if LIBTORRENT_VERSION_NUM < 10100
|
||||
void dispatchAlerts(std::auto_ptr<libtorrent::alert> alertPtr);
|
||||
void dispatchAlerts(libtorrent::alert *alertPtr);
|
||||
#endif
|
||||
void getPendingAlerts(std::vector<libtorrent::alert *> &out, ulong time = 0);
|
||||
|
||||
SettingsStorage *m_settings;
|
||||
|
||||
// BitTorrent
|
||||
libtorrent::session *m_nativeSession;
|
||||
|
||||
bool m_LSDEnabled;
|
||||
bool m_DHTEnabled;
|
||||
bool m_PeXEnabled;
|
||||
bool m_queueingEnabled;
|
||||
bool m_torrentExportEnabled;
|
||||
bool m_finishedTorrentExportEnabled;
|
||||
bool m_preAllocateAll;
|
||||
qreal m_globalMaxRatio;
|
||||
bool m_deferredConfigureScheduled;
|
||||
bool m_IPFilteringChanged;
|
||||
#if LIBTORRENT_VERSION_NUM >= 10100
|
||||
bool m_listenInterfaceChanged; // optimization
|
||||
#endif
|
||||
CachedSettingValue<bool> m_isDHTEnabled;
|
||||
CachedSettingValue<bool> m_isLSDEnabled;
|
||||
CachedSettingValue<bool> m_isPeXEnabled;
|
||||
CachedSettingValue<bool> m_isTrackerExchangeEnabled;
|
||||
CachedSettingValue<bool> m_isIPFilteringEnabled;
|
||||
CachedSettingValue<bool> m_isTrackerFilteringEnabled;
|
||||
CachedSettingValue<QString> m_IPFilterFile;
|
||||
CachedSettingValue<bool> m_announceToAllTrackers;
|
||||
CachedSettingValue<uint> m_diskCacheSize;
|
||||
CachedSettingValue<uint> m_diskCacheTTL;
|
||||
CachedSettingValue<bool> m_useOSCache;
|
||||
CachedSettingValue<bool> m_isAnonymousModeEnabled;
|
||||
CachedSettingValue<bool> m_isQueueingEnabled;
|
||||
CachedSettingValue<int> m_maxActiveDownloads;
|
||||
CachedSettingValue<int> m_maxActiveUploads;
|
||||
CachedSettingValue<int> m_maxActiveTorrents;
|
||||
CachedSettingValue<bool> m_ignoreSlowTorrentsForQueueing;
|
||||
CachedSettingValue<uint> m_outgoingPortsMin;
|
||||
CachedSettingValue<uint> m_outgoingPortsMax;
|
||||
CachedSettingValue<bool> m_ignoreLimitsOnLAN;
|
||||
CachedSettingValue<bool> m_includeOverheadInLimits;
|
||||
CachedSettingValue<QString> m_announceIP;
|
||||
CachedSettingValue<bool> m_isSuperSeedingEnabled;
|
||||
CachedSettingValue<int> m_maxConnections;
|
||||
CachedSettingValue<int> m_maxHalfOpenConnections;
|
||||
CachedSettingValue<int> m_maxUploads;
|
||||
CachedSettingValue<int> m_maxConnectionsPerTorrent;
|
||||
CachedSettingValue<int> m_maxUploadsPerTorrent;
|
||||
CachedSettingValue<bool> m_isUTPEnabled;
|
||||
CachedSettingValue<bool> m_isUTPRateLimited;
|
||||
CachedSettingValue<bool> m_isAddTrackersEnabled;
|
||||
CachedSettingValue<QString> m_additionalTrackers;
|
||||
CachedSettingValue<qreal> m_globalMaxRatio;
|
||||
CachedSettingValue<bool> m_isAddTorrentPaused;
|
||||
CachedSettingValue<bool> m_isAppendExtensionEnabled;
|
||||
CachedSettingValue<uint> m_refreshInterval;
|
||||
CachedSettingValue<bool> m_isPreallocationEnabled;
|
||||
CachedSettingValue<QString> m_torrentExportDirectory;
|
||||
CachedSettingValue<QString> m_finishedTorrentExportDirectory;
|
||||
CachedSettingValue<int> m_globalDownloadSpeedLimit;
|
||||
CachedSettingValue<int> m_globalUploadSpeedLimit;
|
||||
CachedSettingValue<int> m_altGlobalDownloadSpeedLimit;
|
||||
CachedSettingValue<int> m_altGlobalUploadSpeedLimit;
|
||||
CachedSettingValue<bool> m_isAltGlobalSpeedLimitEnabled;
|
||||
CachedSettingValue<bool> m_isBandwidthSchedulerEnabled;
|
||||
CachedSettingValue<uint> m_saveResumeDataInterval;
|
||||
CachedSettingValue<int> m_port;
|
||||
CachedSettingValue<bool> m_useRandomPort;
|
||||
CachedSettingValue<QString> m_networkInterface;
|
||||
CachedSettingValue<QString> m_networkInterfaceName;
|
||||
CachedSettingValue<QString> m_networkInterfaceAddress;
|
||||
CachedSettingValue<bool> m_isIPv6Enabled;
|
||||
CachedSettingValue<int> m_encryption;
|
||||
CachedSettingValue<bool> m_isForceProxyEnabled;
|
||||
CachedSettingValue<bool> m_isProxyPeerConnectionsEnabled;
|
||||
CachedSettingValue<QVariantMap> m_storedCategories;
|
||||
CachedSettingValue<int> m_maxRatioAction;
|
||||
CachedSettingValue<QString> m_defaultSavePath;
|
||||
CachedSettingValue<QString> m_tempPath;
|
||||
CachedSettingValue<bool> m_isSubcategoriesEnabled;
|
||||
CachedSettingValue<bool> m_isTempPathEnabled;
|
||||
CachedSettingValue<bool> m_isAutoTMMDisabledByDefault;
|
||||
CachedSettingValue<bool> m_isDisableAutoTMMWhenCategoryChanged;
|
||||
CachedSettingValue<bool> m_isDisableAutoTMMWhenDefaultSavePathChanged;
|
||||
CachedSettingValue<bool> m_isDisableAutoTMMWhenCategorySavePathChanged;
|
||||
CachedSettingValue<bool> m_isTrackerEnabled;
|
||||
CachedSettingValue<QStringList> m_bannedIPs;
|
||||
|
||||
// Order is important. These need to be declared after their CachedSettingsValue
|
||||
// counterparts, because they use them for initialization in the constructor
|
||||
// initialization list.
|
||||
const bool m_wasPexEnabled;
|
||||
const bool m_wasTrackerExchangeEnabled;
|
||||
|
||||
int m_numResumeData;
|
||||
int m_extraLimit;
|
||||
bool m_appendExtension;
|
||||
uint m_refreshInterval;
|
||||
MaxRatioAction m_maxRatioAction;
|
||||
QList<BitTorrent::TrackerEntry> m_additionalTrackers;
|
||||
QString m_defaultSavePath;
|
||||
QString m_tempPath;
|
||||
QString m_filterPath;
|
||||
QList<BitTorrent::TrackerEntry> m_additionalTrackerList;
|
||||
QString m_resumeFolderPath;
|
||||
QFile m_resumeFolderLock;
|
||||
QHash<InfoHash, QString> m_savePathsToRemove;
|
||||
bool m_useProxy;
|
||||
|
||||
QTimer *m_refreshTimer;
|
||||
QTimer *m_bigRatioTimer;
|
||||
@@ -447,6 +614,8 @@ namespace BitTorrent
|
||||
|
||||
QNetworkConfigurationManager m_networkManager;
|
||||
|
||||
mutable QReadWriteLock m_lock;
|
||||
|
||||
static Session *m_instance;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -752,7 +752,7 @@ void TorrentHandle::updateState()
|
||||
m_state = isSeed() ? TorrentState::PausedUploading : TorrentState::PausedDownloading;
|
||||
}
|
||||
else {
|
||||
if (m_session->isQueueingEnabled() && isQueued() && !isChecking()) {
|
||||
if (m_session->isQueueingSystemEnabled() && isQueued() && !isChecking()) {
|
||||
m_state = isSeed() ? TorrentState::QueuedUploading : TorrentState::QueuedDownloading;
|
||||
}
|
||||
else {
|
||||
@@ -1284,10 +1284,6 @@ void TorrentHandle::moveStorage(const QString &newPath)
|
||||
if (QDir(oldPath) == QDir(newPath)) return;
|
||||
|
||||
qDebug("move storage: %s to %s", qPrintable(oldPath), qPrintable(newPath));
|
||||
// Create destination directory if necessary
|
||||
// or move_storage() will fail...
|
||||
QDir().mkpath(newPath);
|
||||
|
||||
try {
|
||||
// Actually move the storage
|
||||
m_nativeHandle.move_storage(newPath.toUtf8().constData());
|
||||
|
||||
@@ -239,7 +239,7 @@ QVector<int> TorrentInfo::fileIndicesForPiece(int pieceIndex) const
|
||||
std::vector<libt::file_slice> files(
|
||||
nativeInfo()->map_block(pieceIndex, 0, nativeInfo()->piece_size(pieceIndex)));
|
||||
QVector<int> res;
|
||||
res.reserve(files.size());
|
||||
res.reserve(int(files.size()));
|
||||
std::transform(files.begin(), files.end(), std::back_inserter(res),
|
||||
[](const libt::file_slice &s) { return s.file_index; });
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ void Server::incomingConnection(int socketDescriptor)
|
||||
#else
|
||||
static_cast<QSslSocket*>(serverSocket)->setLocalCertificate(m_certificates.first());
|
||||
#endif
|
||||
static_cast<QSslSocket*>(serverSocket)->setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||
static_cast<QSslSocket*>(serverSocket)->startServerEncryption();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -27,20 +27,21 @@
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#include "downloadmanager.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkProxy>
|
||||
#include <QNetworkCookieJar>
|
||||
#include <QNetworkReply>
|
||||
#include <QDebug>
|
||||
#include <QNetworkCookie>
|
||||
#include <QNetworkCookieJar>
|
||||
#include <QNetworkProxy>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSslError>
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
|
||||
#include "base/preferences.h"
|
||||
#include "downloadhandler.h"
|
||||
#include "downloadmanager.h"
|
||||
#include "proxyconfigurationmanager.h"
|
||||
|
||||
// Spoof Firefox 38 user agent to avoid web server banning
|
||||
const char DEFAULT_USER_AGENT[] = "Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Firefox/38.0";
|
||||
@@ -208,16 +209,16 @@ bool DownloadManager::deleteCookie(const QNetworkCookie &cookie)
|
||||
|
||||
void DownloadManager::applyProxySettings()
|
||||
{
|
||||
auto proxyManager = ProxyConfigurationManager::instance();
|
||||
ProxyConfiguration proxyConfig = proxyManager->proxyConfiguration();
|
||||
QNetworkProxy proxy;
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
|
||||
if (pref->isProxyEnabled() && !pref->isProxyOnlyForTorrents()) {
|
||||
if (!proxyManager->isProxyOnlyForTorrents() && (proxyConfig.type != ProxyType::None)) {
|
||||
// Proxy enabled
|
||||
proxy.setHostName(pref->getProxyIp());
|
||||
proxy.setPort(pref->getProxyPort());
|
||||
proxy.setHostName(proxyConfig.ip);
|
||||
proxy.setPort(proxyConfig.port);
|
||||
// Default proxy type is HTTP, we must change if it is SOCKS5
|
||||
const int proxyType = pref->getProxyType();
|
||||
if ((proxyType == Proxy::SOCKS5) || (proxyType == Proxy::SOCKS5_PW)) {
|
||||
if ((proxyConfig.type == ProxyType::SOCKS5) || (proxyConfig.type == ProxyType::SOCKS5_PW)) {
|
||||
qDebug() << Q_FUNC_INFO << "using SOCKS proxy";
|
||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||
}
|
||||
@@ -226,10 +227,10 @@ void DownloadManager::applyProxySettings()
|
||||
proxy.setType(QNetworkProxy::HttpProxy);
|
||||
}
|
||||
// Authentication?
|
||||
if (pref->isProxyAuthEnabled()) {
|
||||
if (proxyManager->isAuthenticationRequired()) {
|
||||
qDebug("Proxy requires authentication, authenticating");
|
||||
proxy.setUser(pref->getProxyUsername());
|
||||
proxy.setPassword(pref->getProxyPassword());
|
||||
proxy.setUser(proxyConfig.username);
|
||||
proxy.setPassword(proxyConfig.password);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
static const char DATABASE_URL[] = "https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz";
|
||||
static const char GEOIP_FOLDER[] = "GeoIP";
|
||||
static const char GEOIP_FILENAME[] = "GeoLite2-Country.mmdb";
|
||||
static const int CACHE_SIZE = 1000;
|
||||
static const int UPDATE_INTERVAL = 30; // Days between database updates
|
||||
|
||||
using namespace Net;
|
||||
|
||||
@@ -26,13 +26,17 @@
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#include "portforwarder.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <libtorrent/session.hpp>
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "portforwarder.h"
|
||||
#include "base/settingsstorage.h"
|
||||
|
||||
static const QString KEY_ENABLED = QLatin1String("Network/PortForwardingEnabled");
|
||||
|
||||
namespace libt = libtorrent;
|
||||
using namespace Net;
|
||||
@@ -42,8 +46,8 @@ PortForwarder::PortForwarder(libtorrent::session *provider, QObject *parent)
|
||||
, m_active(false)
|
||||
, m_provider(provider)
|
||||
{
|
||||
configure();
|
||||
connect(Preferences::instance(), SIGNAL(changed()), SLOT(configure()));
|
||||
if (SettingsStorage::instance()->loadValue(KEY_ENABLED, true).toBool())
|
||||
start();
|
||||
}
|
||||
|
||||
PortForwarder::~PortForwarder()
|
||||
@@ -70,7 +74,24 @@ PortForwarder *PortForwarder::instance()
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
void PortForwarder::addPort(qint16 port)
|
||||
bool PortForwarder::isEnabled() const
|
||||
{
|
||||
return m_active;
|
||||
}
|
||||
|
||||
void PortForwarder::setEnabled(bool enabled)
|
||||
{
|
||||
if (m_active != enabled) {
|
||||
if (enabled)
|
||||
start();
|
||||
else
|
||||
stop();
|
||||
|
||||
SettingsStorage::instance()->storeValue(KEY_ENABLED, enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void PortForwarder::addPort(quint16 port)
|
||||
{
|
||||
if (!m_mappedPorts.contains(port)) {
|
||||
m_mappedPorts.insert(port, 0);
|
||||
@@ -79,7 +100,7 @@ void PortForwarder::addPort(qint16 port)
|
||||
}
|
||||
}
|
||||
|
||||
void PortForwarder::deletePort(qint16 port)
|
||||
void PortForwarder::deletePort(quint16 port)
|
||||
{
|
||||
if (m_mappedPorts.contains(port)) {
|
||||
if (m_active)
|
||||
@@ -88,23 +109,19 @@ void PortForwarder::deletePort(qint16 port)
|
||||
}
|
||||
}
|
||||
|
||||
void PortForwarder::configure()
|
||||
{
|
||||
bool enable = Preferences::instance()->isUPnPEnabled();
|
||||
if (m_active != enable) {
|
||||
if (enable)
|
||||
start();
|
||||
else
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
void PortForwarder::start()
|
||||
{
|
||||
qDebug("Enabling UPnP / NAT-PMP");
|
||||
#if LIBTORRENT_VERSION_NUM < 10100
|
||||
m_provider->start_upnp();
|
||||
m_provider->start_natpmp();
|
||||
foreach (qint16 port, m_mappedPorts.keys())
|
||||
#else
|
||||
libt::settings_pack settingsPack = m_provider->get_settings();
|
||||
settingsPack.set_bool(libt::settings_pack::enable_upnp, true);
|
||||
settingsPack.set_bool(libt::settings_pack::enable_natpmp, true);
|
||||
m_provider->apply_settings(settingsPack);
|
||||
#endif
|
||||
foreach (quint16 port, m_mappedPorts.keys())
|
||||
m_mappedPorts[port] = m_provider->add_port_mapping(libt::session::tcp, port, port);
|
||||
m_active = true;
|
||||
Logger::instance()->addMessage(tr("UPnP / NAT-PMP support [ON]"), Log::INFO);
|
||||
@@ -113,8 +130,15 @@ void PortForwarder::start()
|
||||
void PortForwarder::stop()
|
||||
{
|
||||
qDebug("Disabling UPnP / NAT-PMP");
|
||||
#if LIBTORRENT_VERSION_NUM < 10100
|
||||
m_provider->stop_upnp();
|
||||
m_provider->stop_natpmp();
|
||||
#else
|
||||
libt::settings_pack settingsPack = m_provider->get_settings();
|
||||
settingsPack.set_bool(libt::settings_pack::enable_upnp, false);
|
||||
settingsPack.set_bool(libt::settings_pack::enable_natpmp, false);
|
||||
m_provider->apply_settings(settingsPack);
|
||||
#endif
|
||||
m_active = false;
|
||||
Logger::instance()->addMessage(tr("UPnP / NAT-PMP support [OFF]"), Log::INFO);
|
||||
}
|
||||
|
||||
@@ -49,11 +49,11 @@ namespace Net
|
||||
static void freeInstance();
|
||||
static PortForwarder *instance();
|
||||
|
||||
void addPort(qint16 port);
|
||||
void deletePort(qint16 port);
|
||||
bool isEnabled() const;
|
||||
void setEnabled(bool enabled);
|
||||
|
||||
private slots:
|
||||
void configure();
|
||||
void addPort(quint16 port);
|
||||
void deletePort(quint16 port);
|
||||
|
||||
private:
|
||||
explicit PortForwarder(libtorrent::session *const provider, QObject *parent = 0);
|
||||
@@ -64,7 +64,7 @@ namespace Net
|
||||
|
||||
bool m_active;
|
||||
libtorrent::session *m_provider;
|
||||
QHash<qint16, int> m_mappedPorts;
|
||||
QHash<quint16, int> m_mappedPorts;
|
||||
|
||||
static PortForwarder *m_instance;
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace
|
||||
{
|
||||
const quint32 __ENDIAN_TEST__ = 0x00000001;
|
||||
const bool __IS_LITTLE_ENDIAN__ = (reinterpret_cast<const uchar *>(&__ENDIAN_TEST__)[0] == 0x01);
|
||||
const int MAX_FILE_SIZE = 10485760; // 10MB
|
||||
const qint32 MAX_FILE_SIZE = 67108864; // 64MB
|
||||
const char DB_TYPE[] = "GeoLite2-Country";
|
||||
const quint32 MAX_METADATA_SIZE = 131072; // 128KB
|
||||
const char METADATA_BEGIN_MARK[] = "\xab\xcd\xefMaxMind.com";
|
||||
|
||||
163
src/base/net/proxyconfigurationmanager.cpp
Normal file
163
src/base/net/proxyconfigurationmanager.cpp
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2016 Vladimir Golovnev <glassez@yandex.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give permission to
|
||||
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||
* and distribute the linked executables. You must obey the GNU General Public
|
||||
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#include "proxyconfigurationmanager.h"
|
||||
#include "base/settingsstorage.h"
|
||||
|
||||
#define SETTINGS_KEY(name) "Network/Proxy/" name
|
||||
const QString KEY_ONLY_FOR_TORRENTS = SETTINGS_KEY("OnlyForTorrents");
|
||||
const QString KEY_TYPE = SETTINGS_KEY("Type");
|
||||
const QString KEY_IP = SETTINGS_KEY("IP");
|
||||
const QString KEY_PORT = SETTINGS_KEY("Port");
|
||||
const QString KEY_USERNAME = SETTINGS_KEY("Username");
|
||||
const QString KEY_PASSWORD = SETTINGS_KEY("Password");
|
||||
|
||||
namespace
|
||||
{
|
||||
inline SettingsStorage *settings() { return SettingsStorage::instance(); }
|
||||
|
||||
inline bool isSameConfig(const Net::ProxyConfiguration &conf1, const Net::ProxyConfiguration &conf2)
|
||||
{
|
||||
return conf1.type == conf2.type
|
||||
&& conf1.ip == conf2.ip
|
||||
&& conf1.port == conf2.port
|
||||
&& conf1.username == conf2.username
|
||||
&& conf1.password == conf2.password;
|
||||
}
|
||||
}
|
||||
|
||||
using namespace Net;
|
||||
|
||||
ProxyConfigurationManager *ProxyConfigurationManager::m_instance = nullptr;
|
||||
|
||||
ProxyConfigurationManager::ProxyConfigurationManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_isProxyOnlyForTorrents = settings()->loadValue(KEY_ONLY_FOR_TORRENTS, false).toBool();
|
||||
m_config.type = static_cast<ProxyType>(
|
||||
settings()->loadValue(KEY_TYPE, static_cast<int>(ProxyType::None)).toInt());
|
||||
if ((m_config.type < ProxyType::None) || (m_config.type > ProxyType::SOCKS4))
|
||||
m_config.type = ProxyType::None;
|
||||
m_config.ip = settings()->loadValue(KEY_IP, "0.0.0.0").toString();
|
||||
m_config.port = static_cast<ushort>(settings()->loadValue(KEY_PORT, 8080).toUInt());
|
||||
m_config.username = settings()->loadValue(KEY_USERNAME).toString();
|
||||
m_config.password = settings()->loadValue(KEY_PASSWORD).toString();
|
||||
configureProxy();
|
||||
}
|
||||
|
||||
void ProxyConfigurationManager::initInstance()
|
||||
{
|
||||
if (!m_instance)
|
||||
m_instance = new ProxyConfigurationManager;
|
||||
}
|
||||
|
||||
void ProxyConfigurationManager::freeInstance()
|
||||
{
|
||||
if (m_instance) {
|
||||
delete m_instance;
|
||||
m_instance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ProxyConfigurationManager *ProxyConfigurationManager::instance()
|
||||
{
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
ProxyConfiguration ProxyConfigurationManager::proxyConfiguration() const
|
||||
{
|
||||
return m_config;
|
||||
}
|
||||
|
||||
void ProxyConfigurationManager::setProxyConfiguration(const ProxyConfiguration &config)
|
||||
{
|
||||
if (!isSameConfig(config, m_config)) {
|
||||
m_config = config;
|
||||
settings()->storeValue(KEY_TYPE, static_cast<int>(config.type));
|
||||
settings()->storeValue(KEY_IP, config.ip);
|
||||
settings()->storeValue(KEY_PORT, config.port);
|
||||
settings()->storeValue(KEY_USERNAME, config.username);
|
||||
settings()->storeValue(KEY_PASSWORD, config.password);
|
||||
configureProxy();
|
||||
|
||||
emit proxyConfigurationChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool ProxyConfigurationManager::isProxyOnlyForTorrents() const
|
||||
{
|
||||
return m_isProxyOnlyForTorrents || (m_config.type == ProxyType::SOCKS4);
|
||||
}
|
||||
|
||||
void ProxyConfigurationManager::setProxyOnlyForTorrents(bool onlyForTorrents)
|
||||
{
|
||||
if (m_isProxyOnlyForTorrents != onlyForTorrents) {
|
||||
settings()->storeValue(KEY_ONLY_FOR_TORRENTS, onlyForTorrents);
|
||||
m_isProxyOnlyForTorrents = onlyForTorrents;
|
||||
}
|
||||
}
|
||||
|
||||
bool ProxyConfigurationManager::isAuthenticationRequired() const
|
||||
{
|
||||
return m_config.type == ProxyType::SOCKS5_PW
|
||||
|| m_config.type == ProxyType::HTTP_PW;
|
||||
}
|
||||
|
||||
void ProxyConfigurationManager::configureProxy()
|
||||
{
|
||||
// Define environment variables for urllib in search engine plugins
|
||||
QString proxyStrHTTP, proxyStrSOCK;
|
||||
if (!m_isProxyOnlyForTorrents) {
|
||||
switch (m_config.type) {
|
||||
case ProxyType::HTTP_PW:
|
||||
proxyStrHTTP = QString("http://%1:%2@%3:%4").arg(m_config.username)
|
||||
.arg(m_config.password).arg(m_config.ip).arg(m_config.port);
|
||||
break;
|
||||
case ProxyType::HTTP:
|
||||
proxyStrHTTP = QString("http://%1:%2").arg(m_config.ip).arg(m_config.port);
|
||||
break;
|
||||
case ProxyType::SOCKS5:
|
||||
proxyStrSOCK = QString("%1:%2").arg(m_config.ip).arg(m_config.port);
|
||||
break;
|
||||
case ProxyType::SOCKS5_PW:
|
||||
proxyStrSOCK = QString("%1:%2@%3:%4").arg(m_config.username)
|
||||
.arg(m_config.password).arg(m_config.ip).arg(m_config.port);
|
||||
break;
|
||||
default:
|
||||
qDebug("Disabling HTTP communications proxy");
|
||||
}
|
||||
|
||||
qDebug("HTTP communications proxy string: %s"
|
||||
, qPrintable((m_config.type == ProxyType::SOCKS5) || (m_config.type == ProxyType::SOCKS5_PW)
|
||||
? proxyStrSOCK : proxyStrHTTP));
|
||||
}
|
||||
|
||||
qputenv("http_proxy", proxyStrHTTP.toLocal8Bit());
|
||||
qputenv("https_proxy", proxyStrHTTP.toLocal8Bit());
|
||||
qputenv("sock_proxy", proxyStrSOCK.toLocal8Bit());
|
||||
}
|
||||
87
src/base/net/proxyconfigurationmanager.h
Normal file
87
src/base/net/proxyconfigurationmanager.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2016 Vladimir Golovnev <glassez@yandex.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give permission to
|
||||
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||
* and distribute the linked executables. You must obey the GNU General Public
|
||||
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#ifndef NET_PROXYCONFIGURATIONMANAGER_H
|
||||
#define NET_PROXYCONFIGURATIONMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace Net
|
||||
{
|
||||
enum class ProxyType
|
||||
{
|
||||
None = 0,
|
||||
HTTP = 1,
|
||||
SOCKS5 = 2,
|
||||
HTTP_PW = 3,
|
||||
SOCKS5_PW = 4,
|
||||
SOCKS4 = 5
|
||||
};
|
||||
|
||||
struct ProxyConfiguration
|
||||
{
|
||||
ProxyType type = ProxyType::None;
|
||||
QString ip = "0.0.0.0";
|
||||
ushort port = 8080;
|
||||
QString username;
|
||||
QString password;
|
||||
};
|
||||
|
||||
class ProxyConfigurationManager: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(ProxyConfigurationManager)
|
||||
|
||||
explicit ProxyConfigurationManager(QObject *parent = nullptr);
|
||||
~ProxyConfigurationManager() = default;
|
||||
|
||||
public:
|
||||
static void initInstance();
|
||||
static void freeInstance();
|
||||
static ProxyConfigurationManager *instance();
|
||||
|
||||
ProxyConfiguration proxyConfiguration() const;
|
||||
void setProxyConfiguration(const ProxyConfiguration &config);
|
||||
bool isProxyOnlyForTorrents() const;
|
||||
void setProxyOnlyForTorrents(bool onlyForTorrents);
|
||||
|
||||
bool isAuthenticationRequired() const;
|
||||
|
||||
signals:
|
||||
void proxyConfigurationChanged();
|
||||
|
||||
private:
|
||||
void configureProxy();
|
||||
|
||||
static ProxyConfigurationManager *m_instance;
|
||||
ProxyConfiguration m_config;
|
||||
bool m_isProxyOnlyForTorrents;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NET_PROXYCONFIGURATIONMANAGER_H
|
||||
@@ -53,7 +53,9 @@
|
||||
namespace
|
||||
{
|
||||
const short DEFAULT_PORT = 25;
|
||||
#ifndef QT_NO_OPENSSL
|
||||
const short DEFAULT_PORT_SSL = 465;
|
||||
#endif
|
||||
|
||||
QByteArray hmacMD5(QByteArray key, const QByteArray &msg)
|
||||
{
|
||||
@@ -97,6 +99,13 @@ Smtp::Smtp(QObject *parent)
|
||||
, m_useSsl(false)
|
||||
, m_authType(AuthPlain)
|
||||
{
|
||||
static bool needToRegisterMetaType = true;
|
||||
|
||||
if (needToRegisterMetaType) {
|
||||
qRegisterMetaType<QAbstractSocket::SocketError>();
|
||||
needToRegisterMetaType = false;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENSSL
|
||||
m_socket = new QSslSocket(this);
|
||||
#else
|
||||
@@ -105,6 +114,7 @@ Smtp::Smtp(QObject *parent)
|
||||
|
||||
connect(m_socket, SIGNAL(readyRead()), SLOT(readyRead()));
|
||||
connect(m_socket, SIGNAL(disconnected()), SLOT(deleteLater()));
|
||||
connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(error(QAbstractSocket::SocketError)));
|
||||
|
||||
// Test hmacMD5 function (http://www.faqs.org/rfcs/rfc2202.html)
|
||||
Q_ASSERT(hmacMD5("Jefe", "what do ya want for nothing?").toHex()
|
||||
@@ -525,3 +535,11 @@ QString Smtp::getCurrentDateTime() const
|
||||
QString ret = weekDayStr + ", " + dayStr + " " + monthStr + " " + yearStr + " " + timeStr + " " + timeOffsetStr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Smtp::error(QAbstractSocket::SocketError socketError)
|
||||
{
|
||||
// Getting a remote host closed error is apparently normal, even when successfully sending
|
||||
// an email
|
||||
if (socketError != QAbstractSocket::RemoteHostClosedError)
|
||||
logError(m_socket->errorString());
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#include <QObject>
|
||||
#include <QByteArray>
|
||||
#include <QHash>
|
||||
#include <QAbstractSocket>
|
||||
#include <QMetaType>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QTextStream;
|
||||
@@ -64,6 +66,7 @@ namespace Net
|
||||
|
||||
private slots:
|
||||
void readyRead();
|
||||
void error(QAbstractSocket::SocketError socketError);
|
||||
|
||||
private:
|
||||
enum States
|
||||
@@ -123,4 +126,8 @@ namespace Net
|
||||
};
|
||||
}
|
||||
|
||||
#ifndef QBT_USES_QT5
|
||||
Q_DECLARE_METATYPE(QAbstractSocket::SocketError)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -50,8 +50,6 @@
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include "utils/fs.h"
|
||||
#include "utils/misc.h"
|
||||
#include "settingsstorage.h"
|
||||
@@ -60,10 +58,7 @@
|
||||
|
||||
Preferences* Preferences::m_instance = 0;
|
||||
|
||||
Preferences::Preferences()
|
||||
: m_randomPort(rand() % 64512 + 1024)
|
||||
{
|
||||
}
|
||||
Preferences::Preferences() {}
|
||||
|
||||
Preferences *Preferences::instance()
|
||||
{
|
||||
@@ -165,16 +160,6 @@ void Preferences::setHideZeroComboValues(int n)
|
||||
setValue("Preferences/General/HideZeroComboValues", n);
|
||||
}
|
||||
|
||||
bool Preferences::useRandomPort() const
|
||||
{
|
||||
return value("Preferences/General/UseRandomPort", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setRandomPort(bool b)
|
||||
{
|
||||
setValue("Preferences/General/UseRandomPort", b);
|
||||
}
|
||||
|
||||
bool Preferences::systrayIntegration() const
|
||||
{
|
||||
return value("Preferences/General/SystrayEnabled", true).toBool();
|
||||
@@ -267,16 +252,6 @@ void Preferences::setWinStartup(bool b)
|
||||
#endif
|
||||
|
||||
// Downloads
|
||||
bool Preferences::useIncompleteFilesExtension() const
|
||||
{
|
||||
return value("Preferences/Downloads/UseIncompleteExtension", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::useIncompleteFilesExtension(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Downloads/UseIncompleteExtension", enabled);
|
||||
}
|
||||
|
||||
QString Preferences::lastLocationPath() const
|
||||
{
|
||||
return Utils::Fs::fromNativePath(value("Preferences/Downloads/LastLocationPath").toString());
|
||||
@@ -287,16 +262,6 @@ void Preferences::setLastLocationPath(const QString &path)
|
||||
setValue("Preferences/Downloads/LastLocationPath", Utils::Fs::fromNativePath(path));
|
||||
}
|
||||
|
||||
bool Preferences::preAllocateAllFiles() const
|
||||
{
|
||||
return value("Preferences/Downloads/PreAllocation", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::preAllocateAllFiles(bool enabled)
|
||||
{
|
||||
return setValue("Preferences/Downloads/PreAllocation", enabled);
|
||||
}
|
||||
|
||||
QVariantHash Preferences::getScanDirs() const
|
||||
{
|
||||
return value("Preferences/Downloads/ScanDirsV2").toHash();
|
||||
@@ -318,36 +283,6 @@ void Preferences::setScanDirsLastPath(const QString &path)
|
||||
setValue("Preferences/Downloads/ScanDirsLastPath", Utils::Fs::fromNativePath(path));
|
||||
}
|
||||
|
||||
bool Preferences::isTorrentExportEnabled() const
|
||||
{
|
||||
return !value("Preferences/Downloads/TorrentExportDir").toString().isEmpty();
|
||||
}
|
||||
|
||||
QString Preferences::getTorrentExportDir() const
|
||||
{
|
||||
return Utils::Fs::fromNativePath(value("Preferences/Downloads/TorrentExportDir").toString());
|
||||
}
|
||||
|
||||
void Preferences::setTorrentExportDir(QString path)
|
||||
{
|
||||
setValue("Preferences/Downloads/TorrentExportDir", Utils::Fs::fromNativePath(path.trimmed()));
|
||||
}
|
||||
|
||||
bool Preferences::isFinishedTorrentExportEnabled() const
|
||||
{
|
||||
return !value("Preferences/Downloads/FinishedTorrentExportDir").toString().isEmpty();
|
||||
}
|
||||
|
||||
QString Preferences::getFinishedTorrentExportDir() const
|
||||
{
|
||||
return Utils::Fs::fromNativePath(value("Preferences/Downloads/FinishedTorrentExportDir").toString());
|
||||
}
|
||||
|
||||
void Preferences::setFinishedTorrentExportDir(QString path)
|
||||
{
|
||||
setValue("Preferences/Downloads/FinishedTorrentExportDir", Utils::Fs::fromNativePath(path.trimmed()));
|
||||
}
|
||||
|
||||
bool Preferences::isMailNotificationEnabled() const
|
||||
{
|
||||
return value("Preferences/MailNotification/enabled", false).toBool();
|
||||
@@ -438,97 +373,6 @@ void Preferences::setActionOnDblClOnTorrentFn(int act)
|
||||
setValue("Preferences/Downloads/DblClOnTorFn", act);
|
||||
}
|
||||
|
||||
// Connection options
|
||||
int Preferences::getSessionPort() const
|
||||
{
|
||||
if (useRandomPort())
|
||||
return m_randomPort;
|
||||
return value("Preferences/Connection/PortRangeMin", 8999).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setSessionPort(int port)
|
||||
{
|
||||
setValue("Preferences/Connection/PortRangeMin", port);
|
||||
}
|
||||
|
||||
bool Preferences::isUPnPEnabled() const
|
||||
{
|
||||
return value("Preferences/Connection/UPnP", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setUPnPEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Connection/UPnP", enabled);
|
||||
}
|
||||
|
||||
int Preferences::getGlobalDownloadLimit() const
|
||||
{
|
||||
return value("Preferences/Connection/GlobalDLLimit", -1).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setGlobalDownloadLimit(int limit)
|
||||
{
|
||||
if (limit <= 0)
|
||||
limit = -1;
|
||||
setValue("Preferences/Connection/GlobalDLLimit", limit);
|
||||
}
|
||||
|
||||
int Preferences::getGlobalUploadLimit() const
|
||||
{
|
||||
return value("Preferences/Connection/GlobalUPLimit", -1).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setGlobalUploadLimit(int limit)
|
||||
{
|
||||
if (limit <= 0)
|
||||
limit = -1;
|
||||
setValue("Preferences/Connection/GlobalUPLimit", limit);
|
||||
}
|
||||
|
||||
int Preferences::getAltGlobalDownloadLimit() const
|
||||
{
|
||||
return value("Preferences/Connection/GlobalDLLimitAlt", 10).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setAltGlobalDownloadLimit(int limit)
|
||||
{
|
||||
if (limit <= 0)
|
||||
limit = -1;
|
||||
setValue("Preferences/Connection/GlobalDLLimitAlt", limit);
|
||||
}
|
||||
|
||||
int Preferences::getAltGlobalUploadLimit() const
|
||||
{
|
||||
return value("Preferences/Connection/GlobalUPLimitAlt", 10).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setAltGlobalUploadLimit(int limit)
|
||||
{
|
||||
if (limit <= 0)
|
||||
limit = -1;
|
||||
setValue("Preferences/Connection/GlobalUPLimitAlt", limit);
|
||||
}
|
||||
|
||||
bool Preferences::isAltBandwidthEnabled() const
|
||||
{
|
||||
return value("Preferences/Connection/alt_speeds_on", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setAltBandwidthEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Connection/alt_speeds_on", enabled);
|
||||
}
|
||||
|
||||
bool Preferences::isSchedulerEnabled() const
|
||||
{
|
||||
return value("Preferences/Scheduler/Enabled", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setSchedulerEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Scheduler/Enabled", enabled);
|
||||
}
|
||||
|
||||
QTime Preferences::getSchedulerStartTime() const
|
||||
{
|
||||
return value("Preferences/Scheduler/start_time", QTime(8,0)).toTime();
|
||||
@@ -559,286 +403,6 @@ void Preferences::setSchedulerDays(scheduler_days days)
|
||||
setValue("Preferences/Scheduler/days", (int)days);
|
||||
}
|
||||
|
||||
// Proxy options
|
||||
bool Preferences::isProxyEnabled() const
|
||||
{
|
||||
return getProxyType() > 0;
|
||||
}
|
||||
|
||||
bool Preferences::isProxyAuthEnabled() const
|
||||
{
|
||||
return value("Preferences/Connection/Proxy/Authentication", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setProxyAuthEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Connection/Proxy/Authentication", enabled);
|
||||
}
|
||||
|
||||
QString Preferences::getProxyIp() const
|
||||
{
|
||||
return value("Preferences/Connection/Proxy/IP", "0.0.0.0").toString();
|
||||
}
|
||||
|
||||
void Preferences::setProxyIp(const QString &ip)
|
||||
{
|
||||
setValue("Preferences/Connection/Proxy/IP", ip);
|
||||
}
|
||||
|
||||
unsigned short Preferences::getProxyPort() const
|
||||
{
|
||||
return value("Preferences/Connection/Proxy/Port", 8080).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setProxyPort(unsigned short port)
|
||||
{
|
||||
setValue("Preferences/Connection/Proxy/Port", port);
|
||||
}
|
||||
|
||||
QString Preferences::getProxyUsername() const
|
||||
{
|
||||
return value("Preferences/Connection/Proxy/Username").toString();
|
||||
}
|
||||
|
||||
void Preferences::setProxyUsername(const QString &username)
|
||||
{
|
||||
setValue("Preferences/Connection/Proxy/Username", username);
|
||||
}
|
||||
|
||||
QString Preferences::getProxyPassword() const
|
||||
{
|
||||
return value("Preferences/Connection/Proxy/Password").toString();
|
||||
}
|
||||
|
||||
void Preferences::setProxyPassword(const QString &password)
|
||||
{
|
||||
setValue("Preferences/Connection/Proxy/Password", password);
|
||||
}
|
||||
|
||||
int Preferences::getProxyType() const
|
||||
{
|
||||
return value("Preferences/Connection/ProxyType", 0).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setProxyType(int type)
|
||||
{
|
||||
setValue("Preferences/Connection/ProxyType", type);
|
||||
}
|
||||
|
||||
bool Preferences::proxyPeerConnections() const
|
||||
{
|
||||
return value("Preferences/Connection/ProxyPeerConnections", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setProxyPeerConnections(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Connection/ProxyPeerConnections", enabled);
|
||||
}
|
||||
|
||||
bool Preferences::getForceProxy() const
|
||||
{
|
||||
return value("Preferences/Connection/ProxyForce", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setForceProxy(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Connection/ProxyForce", enabled);
|
||||
}
|
||||
|
||||
void Preferences::setProxyOnlyForTorrents(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Connection/ProxyOnlyForTorrents", enabled);
|
||||
}
|
||||
|
||||
bool Preferences::isProxyOnlyForTorrents() const
|
||||
{
|
||||
return value("Preferences/Connection/ProxyOnlyForTorrents", false).toBool();
|
||||
}
|
||||
|
||||
// Bittorrent options
|
||||
int Preferences::getMaxConnecs() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/MaxConnecs", 500).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setMaxConnecs(int val)
|
||||
{
|
||||
if (val <= 0)
|
||||
val = -1;
|
||||
setValue("Preferences/Bittorrent/MaxConnecs", val);
|
||||
}
|
||||
|
||||
int Preferences::getMaxConnecsPerTorrent() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/MaxConnecsPerTorrent", 100).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setMaxConnecsPerTorrent(int val)
|
||||
{
|
||||
if (val <= 0)
|
||||
val = -1;
|
||||
setValue("Preferences/Bittorrent/MaxConnecsPerTorrent", val);
|
||||
}
|
||||
|
||||
int Preferences::getMaxUploads() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/MaxUploads", -1).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setMaxUploads(int val)
|
||||
{
|
||||
if (val <= 0)
|
||||
val = -1;
|
||||
setValue("Preferences/Bittorrent/MaxUploads", val);
|
||||
}
|
||||
|
||||
int Preferences::getMaxUploadsPerTorrent() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/MaxUploadsPerTorrent", -1).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setMaxUploadsPerTorrent(int val)
|
||||
{
|
||||
if (val <= 0)
|
||||
val = -1;
|
||||
setValue("Preferences/Bittorrent/MaxUploadsPerTorrent", val);
|
||||
}
|
||||
|
||||
bool Preferences::isuTPEnabled() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/uTP", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setuTPEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Bittorrent/uTP", enabled);
|
||||
}
|
||||
|
||||
bool Preferences::isuTPRateLimited() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/uTP_rate_limited", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setuTPRateLimited(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Bittorrent/uTP_rate_limited", enabled);
|
||||
}
|
||||
|
||||
bool Preferences::isDHTEnabled() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/DHT", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setDHTEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Bittorrent/DHT", enabled);
|
||||
}
|
||||
|
||||
bool Preferences::isPeXEnabled() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/PeX", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setPeXEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Bittorrent/PeX", enabled);
|
||||
}
|
||||
|
||||
bool Preferences::isLSDEnabled() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/LSD", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setLSDEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Bittorrent/LSD", enabled);
|
||||
}
|
||||
|
||||
int Preferences::getEncryptionSetting() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/Encryption", 0).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setEncryptionSetting(int val)
|
||||
{
|
||||
setValue("Preferences/Bittorrent/Encryption", val);
|
||||
}
|
||||
|
||||
bool Preferences::isAddTrackersEnabled() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/AddTrackers", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setAddTrackersEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Bittorrent/AddTrackers", enabled);
|
||||
}
|
||||
|
||||
QString Preferences::getTrackersList() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/TrackersList").toString();
|
||||
}
|
||||
|
||||
void Preferences::setTrackersList(const QString &val)
|
||||
{
|
||||
setValue("Preferences/Bittorrent/TrackersList", val);
|
||||
}
|
||||
|
||||
qreal Preferences::getGlobalMaxRatio() const
|
||||
{
|
||||
return value("Preferences/Bittorrent/MaxRatio", -1).toReal();
|
||||
}
|
||||
|
||||
void Preferences::setGlobalMaxRatio(qreal ratio)
|
||||
{
|
||||
setValue("Preferences/Bittorrent/MaxRatio", ratio);
|
||||
}
|
||||
|
||||
// IP Filter
|
||||
bool Preferences::isFilteringEnabled() const
|
||||
{
|
||||
return value("Preferences/IPFilter/Enabled", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setFilteringEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/IPFilter/Enabled", enabled);
|
||||
}
|
||||
|
||||
bool Preferences::isFilteringTrackerEnabled() const
|
||||
{
|
||||
return value("Preferences/IPFilter/FilterTracker", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setFilteringTrackerEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/IPFilter/FilterTracker", enabled);
|
||||
}
|
||||
|
||||
QString Preferences::getFilter() const
|
||||
{
|
||||
return Utils::Fs::fromNativePath(value("Preferences/IPFilter/File").toString());
|
||||
}
|
||||
|
||||
void Preferences::setFilter(const QString &path)
|
||||
{
|
||||
setValue("Preferences/IPFilter/File", Utils::Fs::fromNativePath(path));
|
||||
}
|
||||
|
||||
QStringList Preferences::bannedIPs() const
|
||||
{
|
||||
return value("Preferences/IPFilter/BannedIPs").toStringList();
|
||||
}
|
||||
|
||||
void Preferences::banIP(const QString &ip)
|
||||
{
|
||||
QStringList banned_ips = value("Preferences/IPFilter/BannedIPs").toStringList();
|
||||
if (!banned_ips.contains(ip)) {
|
||||
banned_ips << ip;
|
||||
setValue("Preferences/IPFilter/BannedIPs", banned_ips);
|
||||
}
|
||||
}
|
||||
|
||||
// Search
|
||||
bool Preferences::isSearchEnabled() const
|
||||
{
|
||||
@@ -850,63 +414,6 @@ void Preferences::setSearchEnabled(bool enabled)
|
||||
setValue("Preferences/Search/SearchEnabled", enabled);
|
||||
}
|
||||
|
||||
// Queueing system
|
||||
bool Preferences::isQueueingSystemEnabled() const
|
||||
{
|
||||
return value("Preferences/Queueing/QueueingEnabled", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setQueueingSystemEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Queueing/QueueingEnabled", enabled);
|
||||
}
|
||||
|
||||
int Preferences::getMaxActiveDownloads() const
|
||||
{
|
||||
return value("Preferences/Queueing/MaxActiveDownloads", 3).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setMaxActiveDownloads(int val)
|
||||
{
|
||||
if (val < 0)
|
||||
val = -1;
|
||||
setValue("Preferences/Queueing/MaxActiveDownloads", val);
|
||||
}
|
||||
|
||||
int Preferences::getMaxActiveUploads() const
|
||||
{
|
||||
return value("Preferences/Queueing/MaxActiveUploads", 3).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setMaxActiveUploads(int val)
|
||||
{
|
||||
if (val < 0)
|
||||
val = -1;
|
||||
setValue("Preferences/Queueing/MaxActiveUploads", val);
|
||||
}
|
||||
|
||||
int Preferences::getMaxActiveTorrents() const
|
||||
{
|
||||
return value("Preferences/Queueing/MaxActiveTorrents", 5).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setMaxActiveTorrents(int val)
|
||||
{
|
||||
if (val < 0)
|
||||
val = -1;
|
||||
setValue("Preferences/Queueing/MaxActiveTorrents", val);
|
||||
}
|
||||
|
||||
bool Preferences::ignoreSlowTorrentsForQueueing() const
|
||||
{
|
||||
return value("Preferences/Queueing/IgnoreSlowTorrents", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setIgnoreSlowTorrentsForQueueing(bool ignore)
|
||||
{
|
||||
setValue("Preferences/Queueing/IgnoreSlowTorrents", ignore);
|
||||
}
|
||||
|
||||
bool Preferences::isWebUiEnabled() const
|
||||
{
|
||||
#ifdef DISABLE_GUI
|
||||
@@ -1164,111 +671,6 @@ void Preferences::setDontConfirmAutoExit(bool dontConfirmAutoExit)
|
||||
setValue("ShutdownConfirmDlg/DontConfirmAutoExit", dontConfirmAutoExit);
|
||||
}
|
||||
|
||||
uint Preferences::diskCacheSize() const
|
||||
{
|
||||
uint size = value("Preferences/Downloads/DiskWriteCacheSize", 0).toUInt();
|
||||
// These macros may not be available on compilers other than MSVC and GCC
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
size = qMin(size, (uint) 4096); // 4GiB
|
||||
#else
|
||||
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes
|
||||
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM
|
||||
size = qMin(size, (uint) 1536);
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
|
||||
void Preferences::setDiskCacheSize(uint size)
|
||||
{
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
size = qMin(size, (uint) 4096); // 4GiB
|
||||
#else
|
||||
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM
|
||||
size = qMin(size, (uint) 1536);
|
||||
#endif
|
||||
setValue("Preferences/Downloads/DiskWriteCacheSize", size);
|
||||
}
|
||||
|
||||
uint Preferences::diskCacheTTL() const
|
||||
{
|
||||
return value("Preferences/Downloads/DiskWriteCacheTTL", 60).toUInt();
|
||||
}
|
||||
|
||||
void Preferences::setDiskCacheTTL(uint ttl)
|
||||
{
|
||||
setValue("Preferences/Downloads/DiskWriteCacheTTL", ttl);
|
||||
}
|
||||
|
||||
bool Preferences::osCache() const
|
||||
{
|
||||
return value("Preferences/Advanced/osCache", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setOsCache(bool enable)
|
||||
{
|
||||
setValue("Preferences/Advanced/osCache", enable);
|
||||
}
|
||||
|
||||
uint Preferences::saveResumeDataInterval() const
|
||||
{
|
||||
return value("Preferences/Downloads/SaveResumeDataInterval", 3).toUInt();
|
||||
}
|
||||
|
||||
void Preferences::setSaveResumeDataInterval(uint m)
|
||||
{
|
||||
setValue("Preferences/Downloads/SaveResumeDataInterval", m);
|
||||
}
|
||||
|
||||
uint Preferences::outgoingPortsMin() const
|
||||
{
|
||||
return value("Preferences/Advanced/OutgoingPortsMin", 0).toUInt();
|
||||
}
|
||||
|
||||
void Preferences::setOutgoingPortsMin(uint val)
|
||||
{
|
||||
setValue("Preferences/Advanced/OutgoingPortsMin", val);
|
||||
}
|
||||
|
||||
uint Preferences::outgoingPortsMax() const
|
||||
{
|
||||
return value("Preferences/Advanced/OutgoingPortsMax", 0).toUInt();
|
||||
}
|
||||
|
||||
void Preferences::setOutgoingPortsMax(uint val)
|
||||
{
|
||||
setValue("Preferences/Advanced/OutgoingPortsMax", val);
|
||||
}
|
||||
|
||||
bool Preferences::getIgnoreLimitsOnLAN() const
|
||||
{
|
||||
return value("Preferences/Advanced/IgnoreLimitsLAN", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setIgnoreLimitsOnLAN(bool ignore)
|
||||
{
|
||||
setValue("Preferences/Advanced/IgnoreLimitsLAN", ignore);
|
||||
}
|
||||
|
||||
bool Preferences::includeOverheadInLimits() const
|
||||
{
|
||||
return value("Preferences/Advanced/IncludeOverhead", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::includeOverheadInLimits(bool include)
|
||||
{
|
||||
setValue("Preferences/Advanced/IncludeOverhead", include);
|
||||
}
|
||||
|
||||
bool Preferences::trackerExchangeEnabled() const
|
||||
{
|
||||
return value("Preferences/Advanced/LtTrackerExchange", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setTrackerExchangeEnabled(bool enable)
|
||||
{
|
||||
setValue("Preferences/Advanced/LtTrackerExchange", enable);
|
||||
}
|
||||
|
||||
bool Preferences::recheckTorrentsOnCompletion() const
|
||||
{
|
||||
return value("Preferences/Advanced/RecheckOnCompletion", false).toBool();
|
||||
@@ -1279,16 +681,6 @@ void Preferences::recheckTorrentsOnCompletion(bool recheck)
|
||||
setValue("Preferences/Advanced/RecheckOnCompletion", recheck);
|
||||
}
|
||||
|
||||
unsigned int Preferences::getRefreshInterval() const
|
||||
{
|
||||
return value("Preferences/General/RefreshInterval", 1500).toUInt();
|
||||
}
|
||||
|
||||
void Preferences::setRefreshInterval(uint interval)
|
||||
{
|
||||
setValue("Preferences/General/RefreshInterval", interval);
|
||||
}
|
||||
|
||||
bool Preferences::resolvePeerCountries() const
|
||||
{
|
||||
return value("Preferences/Connection/ResolvePeerCountries", true).toBool();
|
||||
@@ -1309,101 +701,6 @@ void Preferences::resolvePeerHostNames(bool resolve)
|
||||
setValue("Preferences/Connection/ResolvePeerHostNames", resolve);
|
||||
}
|
||||
|
||||
int Preferences::getMaxHalfOpenConnections() const
|
||||
{
|
||||
const int val = value("Preferences/Connection/MaxHalfOpenConnec", 20).toInt();
|
||||
if (val <= 0)
|
||||
return -1;
|
||||
return val;
|
||||
}
|
||||
|
||||
void Preferences::setMaxHalfOpenConnections(int value)
|
||||
{
|
||||
if (value <= 0)
|
||||
value = -1;
|
||||
setValue("Preferences/Connection/MaxHalfOpenConnec", value);
|
||||
}
|
||||
|
||||
QString Preferences::getNetworkInterface() const
|
||||
{
|
||||
return value("Preferences/Connection/Interface").toString();
|
||||
}
|
||||
|
||||
void Preferences::setNetworkInterface(const QString& iface)
|
||||
{
|
||||
setValue("Preferences/Connection/Interface", iface);
|
||||
}
|
||||
|
||||
QString Preferences::getNetworkInterfaceName() const
|
||||
{
|
||||
return value("Preferences/Connection/InterfaceName").toString();
|
||||
}
|
||||
|
||||
void Preferences::setNetworkInterfaceName(const QString& iface)
|
||||
{
|
||||
setValue("Preferences/Connection/InterfaceName", iface);
|
||||
}
|
||||
|
||||
void Preferences::setNetworkInterfaceAddress(const QString& addr)
|
||||
{
|
||||
setValue("Preferences/Connection/InterfaceAddress", addr);
|
||||
}
|
||||
|
||||
QString Preferences::getNetworkInterfaceAddress() const
|
||||
{
|
||||
return value("Preferences/Connection/InterfaceAddress").toString();
|
||||
}
|
||||
|
||||
bool Preferences::getListenIPv6() const
|
||||
{
|
||||
return value("Preferences/Connection/InterfaceListenIPv6", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setListenIPv6(bool enable)
|
||||
{
|
||||
setValue("Preferences/Connection/InterfaceListenIPv6", enable);
|
||||
}
|
||||
|
||||
QString Preferences::getNetworkAddress() const
|
||||
{
|
||||
return value("Preferences/Connection/InetAddress").toString();
|
||||
}
|
||||
|
||||
void Preferences::setNetworkAddress(const QString& addr)
|
||||
{
|
||||
setValue("Preferences/Connection/InetAddress", addr);
|
||||
}
|
||||
|
||||
bool Preferences::isAnonymousModeEnabled() const
|
||||
{
|
||||
return value("Preferences/Advanced/AnonymousMode", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::enableAnonymousMode(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Advanced/AnonymousMode", enabled);
|
||||
}
|
||||
|
||||
bool Preferences::isSuperSeedingEnabled() const
|
||||
{
|
||||
return value("Preferences/Advanced/SuperSeeding", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::enableSuperSeeding(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Advanced/SuperSeeding", enabled);
|
||||
}
|
||||
|
||||
bool Preferences::announceToAllTrackers() const
|
||||
{
|
||||
return value("Preferences/Advanced/AnnounceToAllTrackers", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setAnnounceToAllTrackers(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Advanced/AnnounceToAllTrackers", enabled);
|
||||
}
|
||||
|
||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
||||
bool Preferences::useSystemIconTheme() const
|
||||
{
|
||||
@@ -1710,16 +1007,6 @@ void Preferences::setMagnetLinkAssoc()
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Preferences::isTrackerEnabled() const
|
||||
{
|
||||
return value("Preferences/Advanced/trackerEnabled", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setTrackerEnabled(bool enabled)
|
||||
{
|
||||
setValue("Preferences/Advanced/trackerEnabled", enabled);
|
||||
}
|
||||
|
||||
int Preferences::getTrackerPort() const
|
||||
{
|
||||
return value("Preferences/Advanced/trackerPort", 9000).toInt();
|
||||
@@ -1997,7 +1284,7 @@ void Preferences::setRssOpenFolders(const QStringList &folders)
|
||||
setValue("Rss/open_folders", folders);
|
||||
}
|
||||
|
||||
QByteArray Preferences::getRssHSplitterState() const
|
||||
QByteArray Preferences::getRssSideSplitterState() const
|
||||
{
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("Rss/qt5/splitter_h").toByteArray();
|
||||
@@ -2006,7 +1293,7 @@ QByteArray Preferences::getRssHSplitterState() const
|
||||
#endif
|
||||
}
|
||||
|
||||
void Preferences::setRssHSplitterState(const QByteArray &state)
|
||||
void Preferences::setRssSideSplitterState(const QByteArray &state)
|
||||
{
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("Rss/qt5/splitter_h", state);
|
||||
@@ -2015,21 +1302,21 @@ void Preferences::setRssHSplitterState(const QByteArray &state)
|
||||
#endif
|
||||
}
|
||||
|
||||
QByteArray Preferences::getRssVSplitterState() const
|
||||
QByteArray Preferences::getRssMainSplitterState() const
|
||||
{
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("Rss/qt5/splitter_v").toByteArray();
|
||||
return value("Rss/qt5/splitterMain").toByteArray();
|
||||
#else
|
||||
return value("Rss/splitter_v").toByteArray();
|
||||
return value("Rss/splitterMain").toByteArray();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Preferences::setRssVSplitterState(const QByteArray &state)
|
||||
void Preferences::setRssMainSplitterState(const QByteArray &state)
|
||||
{
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("Rss/qt5/splitter_v", state);
|
||||
setValue("Rss/qt5/splitterMain", state);
|
||||
#else
|
||||
setValue("Rss/splitter_v", state);
|
||||
setValue("Rss/splitterMain", state);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -57,18 +57,6 @@ enum scheduler_days
|
||||
SUN
|
||||
};
|
||||
|
||||
namespace Proxy
|
||||
{
|
||||
enum ProxyType
|
||||
{
|
||||
HTTP = 1,
|
||||
SOCKS5 = 2,
|
||||
HTTP_PW = 3,
|
||||
SOCKS5_PW = 4,
|
||||
SOCKS4 = 5
|
||||
};
|
||||
}
|
||||
|
||||
namespace TrayIcon
|
||||
{
|
||||
enum Style
|
||||
@@ -102,7 +90,6 @@ class Preferences: public QObject
|
||||
void setValue(const QString &key, const QVariant &value);
|
||||
|
||||
static Preferences* m_instance;
|
||||
int m_randomPort;
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
@@ -127,8 +114,6 @@ public:
|
||||
void setHideZeroValues(bool b);
|
||||
int getHideZeroComboValues() const;
|
||||
void setHideZeroComboValues(int n);
|
||||
bool useRandomPort() const;
|
||||
void setRandomPort(bool b);
|
||||
bool systrayIntegration() const;
|
||||
void setSystrayIntegration(bool enabled);
|
||||
bool isToolbarDisplayed() const;
|
||||
@@ -149,22 +134,12 @@ public:
|
||||
#endif
|
||||
|
||||
// Downloads
|
||||
bool useIncompleteFilesExtension() const;
|
||||
void useIncompleteFilesExtension(bool enabled);
|
||||
QString lastLocationPath() const;
|
||||
void setLastLocationPath(const QString &path);
|
||||
bool preAllocateAllFiles() const;
|
||||
void preAllocateAllFiles(bool enabled);
|
||||
QVariantHash getScanDirs() const;
|
||||
void setScanDirs(const QVariantHash &dirs);
|
||||
QString getScanDirsLastPath() const;
|
||||
void setScanDirsLastPath(const QString &path);
|
||||
bool isTorrentExportEnabled() const;
|
||||
QString getTorrentExportDir() const;
|
||||
void setTorrentExportDir(QString path);
|
||||
bool isFinishedTorrentExportEnabled() const;
|
||||
QString getFinishedTorrentExportDir() const;
|
||||
void setFinishedTorrentExportDir(QString path);
|
||||
bool isMailNotificationEnabled() const;
|
||||
void setMailNotificationEnabled(bool enabled);
|
||||
QString getMailNotificationEmail() const;
|
||||
@@ -185,22 +160,6 @@ public:
|
||||
void setActionOnDblClOnTorrentFn(int act);
|
||||
|
||||
// Connection options
|
||||
int getSessionPort() const;
|
||||
void setSessionPort(int port);
|
||||
bool isUPnPEnabled() const;
|
||||
void setUPnPEnabled(bool enabled);
|
||||
int getGlobalDownloadLimit() const;
|
||||
void setGlobalDownloadLimit(int limit);
|
||||
int getGlobalUploadLimit() const;
|
||||
void setGlobalUploadLimit(int limit);
|
||||
int getAltGlobalDownloadLimit() const;
|
||||
void setAltGlobalDownloadLimit(int limit);
|
||||
int getAltGlobalUploadLimit() const;
|
||||
void setAltGlobalUploadLimit(int limit);
|
||||
bool isAltBandwidthEnabled() const;
|
||||
void setAltBandwidthEnabled(bool enabled);
|
||||
bool isSchedulerEnabled() const;
|
||||
void setSchedulerEnabled(bool enabled);
|
||||
QTime getSchedulerStartTime() const;
|
||||
void setSchedulerStartTime(const QTime &time);
|
||||
QTime getSchedulerEndTime() const;
|
||||
@@ -208,80 +167,10 @@ public:
|
||||
scheduler_days getSchedulerDays() const;
|
||||
void setSchedulerDays(scheduler_days days);
|
||||
|
||||
// Proxy options
|
||||
bool isProxyEnabled() const;
|
||||
bool isProxyAuthEnabled() const;
|
||||
void setProxyAuthEnabled(bool enabled);
|
||||
QString getProxyIp() const;
|
||||
void setProxyIp(const QString &ip);
|
||||
unsigned short getProxyPort() const;
|
||||
void setProxyPort(unsigned short port);
|
||||
QString getProxyUsername() const;
|
||||
void setProxyUsername(const QString &username);
|
||||
QString getProxyPassword() const;
|
||||
void setProxyPassword(const QString &password);
|
||||
int getProxyType() const;
|
||||
void setProxyType(int type);
|
||||
bool proxyPeerConnections() const;
|
||||
void setProxyPeerConnections(bool enabled);
|
||||
bool getForceProxy() const;
|
||||
void setForceProxy(bool enabled);
|
||||
void setProxyOnlyForTorrents(bool enabled);
|
||||
bool isProxyOnlyForTorrents() const;
|
||||
|
||||
// Bittorrent options
|
||||
int getMaxConnecs() const;
|
||||
void setMaxConnecs(int val);
|
||||
int getMaxConnecsPerTorrent() const;
|
||||
void setMaxConnecsPerTorrent(int val);
|
||||
int getMaxUploads() const;
|
||||
void setMaxUploads(int val);
|
||||
int getMaxUploadsPerTorrent() const;
|
||||
void setMaxUploadsPerTorrent(int val);
|
||||
bool isuTPEnabled() const;
|
||||
void setuTPEnabled(bool enabled);
|
||||
bool isuTPRateLimited() const;
|
||||
void setuTPRateLimited(bool enabled);
|
||||
bool isDHTEnabled() const;
|
||||
void setDHTEnabled(bool enabled);
|
||||
bool isPeXEnabled() const;
|
||||
void setPeXEnabled(bool enabled);
|
||||
bool isLSDEnabled() const;
|
||||
void setLSDEnabled(bool enabled);
|
||||
int getEncryptionSetting() const;
|
||||
void setEncryptionSetting(int val);
|
||||
bool isAddTrackersEnabled() const;
|
||||
void setAddTrackersEnabled(bool enabled);
|
||||
QString getTrackersList() const;
|
||||
void setTrackersList(const QString &val);
|
||||
qreal getGlobalMaxRatio() const;
|
||||
void setGlobalMaxRatio(qreal ratio);
|
||||
|
||||
// IP Filter
|
||||
bool isFilteringEnabled() const;
|
||||
void setFilteringEnabled(bool enabled);
|
||||
bool isFilteringTrackerEnabled() const;
|
||||
void setFilteringTrackerEnabled(bool enabled);
|
||||
QString getFilter() const;
|
||||
void setFilter(const QString &path);
|
||||
QStringList bannedIPs() const;
|
||||
void banIP(const QString &ip);
|
||||
|
||||
// Search
|
||||
bool isSearchEnabled() const;
|
||||
void setSearchEnabled(bool enabled);
|
||||
|
||||
// Queueing system
|
||||
bool isQueueingSystemEnabled() const;
|
||||
void setQueueingSystemEnabled(bool enabled);
|
||||
int getMaxActiveDownloads() const;
|
||||
void setMaxActiveDownloads(int val);
|
||||
int getMaxActiveUploads() const;
|
||||
void setMaxActiveUploads(int val);
|
||||
int getMaxActiveTorrents() const;
|
||||
void setMaxActiveTorrents(int val);
|
||||
bool ignoreSlowTorrentsForQueueing() const;
|
||||
void setIgnoreSlowTorrentsForQueueing(bool ignore);
|
||||
bool isWebUiEnabled() const;
|
||||
void setWebUiEnabled(bool enabled);
|
||||
bool isWebUiLocalAuthEnabled() const;
|
||||
@@ -331,50 +220,12 @@ public:
|
||||
void setShutdownqBTWhenDownloadsComplete(bool shutdown);
|
||||
bool dontConfirmAutoExit() const;
|
||||
void setDontConfirmAutoExit(bool dontConfirmAutoExit);
|
||||
uint diskCacheSize() const;
|
||||
void setDiskCacheSize(uint size);
|
||||
uint diskCacheTTL() const;
|
||||
void setDiskCacheTTL(uint ttl);
|
||||
bool osCache() const;
|
||||
void setOsCache(bool enable);
|
||||
uint saveResumeDataInterval() const;
|
||||
void setSaveResumeDataInterval(uint m);
|
||||
uint outgoingPortsMin() const;
|
||||
void setOutgoingPortsMin(uint val);
|
||||
uint outgoingPortsMax() const;
|
||||
void setOutgoingPortsMax(uint val);
|
||||
bool getIgnoreLimitsOnLAN() const;
|
||||
void setIgnoreLimitsOnLAN(bool ignore);
|
||||
bool includeOverheadInLimits() const;
|
||||
void includeOverheadInLimits(bool include);
|
||||
bool trackerExchangeEnabled() const;
|
||||
void setTrackerExchangeEnabled(bool enable);
|
||||
bool recheckTorrentsOnCompletion() const;
|
||||
void recheckTorrentsOnCompletion(bool recheck);
|
||||
unsigned int getRefreshInterval() const;
|
||||
void setRefreshInterval(uint interval);
|
||||
bool resolvePeerCountries() const;
|
||||
void resolvePeerCountries(bool resolve);
|
||||
bool resolvePeerHostNames() const;
|
||||
void resolvePeerHostNames(bool resolve);
|
||||
int getMaxHalfOpenConnections() const;
|
||||
void setMaxHalfOpenConnections(int value);
|
||||
QString getNetworkInterface() const;
|
||||
void setNetworkInterface(const QString& iface);
|
||||
QString getNetworkInterfaceName() const;
|
||||
void setNetworkInterfaceName(const QString& iface);
|
||||
QString getNetworkInterfaceAddress() const;
|
||||
void setNetworkInterfaceAddress(const QString& addr);
|
||||
bool getListenIPv6() const;
|
||||
void setListenIPv6(bool enable);
|
||||
QString getNetworkAddress() const;
|
||||
void setNetworkAddress(const QString& addr);
|
||||
bool isAnonymousModeEnabled() const;
|
||||
void enableAnonymousMode(bool enabled);
|
||||
bool isSuperSeedingEnabled() const;
|
||||
void enableSuperSeeding(bool enabled);
|
||||
bool announceToAllTrackers() const;
|
||||
void setAnnounceToAllTrackers(bool enabled);
|
||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
||||
bool useSystemIconTheme() const;
|
||||
void useSystemIconTheme(bool enabled);
|
||||
@@ -396,8 +247,6 @@ public:
|
||||
static void setTorrentFileAssoc();
|
||||
static void setMagnetLinkAssoc();
|
||||
#endif
|
||||
bool isTrackerEnabled() const;
|
||||
void setTrackerEnabled(bool enabled);
|
||||
int getTrackerPort() const;
|
||||
void setTrackerPort(int port);
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
@@ -451,10 +300,10 @@ public:
|
||||
void setRssHSplitterSizes(const QByteArray &sizes);
|
||||
QStringList getRssOpenFolders() const;
|
||||
void setRssOpenFolders(const QStringList &folders);
|
||||
QByteArray getRssHSplitterState() const;
|
||||
void setRssHSplitterState(const QByteArray &state);
|
||||
QByteArray getRssVSplitterState() const;
|
||||
void setRssVSplitterState(const QByteArray &state);
|
||||
QByteArray getRssSideSplitterState() const;
|
||||
void setRssSideSplitterState(const QByteArray &state);
|
||||
QByteArray getRssMainSplitterState() const;
|
||||
void setRssMainSplitterState(const QByteArray &state);
|
||||
QString getSearchColsWidth() const;
|
||||
void setSearchColsWidth(const QString &width);
|
||||
QStringList getSearchEngDisabled() const;
|
||||
|
||||
@@ -39,7 +39,7 @@ class QIniSettings : public QSettings {
|
||||
|
||||
public:
|
||||
QIniSettings(const QString &organization = "qBittorrent", const QString &application = "qBittorrent", QObject *parent = 0 ):
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
QSettings(QSettings::IniFormat, QSettings::UserScope, organization, application, parent)
|
||||
#else
|
||||
QSettings(organization, application, parent)
|
||||
|
||||
@@ -259,8 +259,13 @@ bool Feed::hasCustomIcon() const
|
||||
|
||||
void Feed::setIconPath(const QString &path)
|
||||
{
|
||||
if (!path.isEmpty() && QFile::exists(path))
|
||||
m_icon = path;
|
||||
QString nativePath = Utils::Fs::fromNativePath(path);
|
||||
if (nativePath == m_icon || nativePath.isEmpty() || !QFile::exists(nativePath)) return;
|
||||
|
||||
if (!m_icon.startsWith(":/") && QFile::exists(m_icon))
|
||||
Utils::Fs::forceRemove(m_icon);
|
||||
|
||||
m_icon = nativePath;
|
||||
}
|
||||
|
||||
ArticlePtr Feed::getItem(const QString &guid) const
|
||||
@@ -322,7 +327,7 @@ QString Feed::iconUrl() const
|
||||
void Feed::handleIconDownloadFinished(const QString &url, const QString &filePath)
|
||||
{
|
||||
Q_UNUSED(url);
|
||||
m_icon = filePath;
|
||||
setIconPath(filePath);
|
||||
qDebug() << Q_FUNC_INFO << "icon path:" << m_icon;
|
||||
m_manager->forwardFeedIconChanged(m_url, m_icon);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ static inline void removePythonScriptIfExists(const QString &scriptPath)
|
||||
const QHash<QString, QString> SearchEngine::m_categoryNames = SearchEngine::initializeCategoryNames();
|
||||
|
||||
SearchEngine::SearchEngine()
|
||||
: m_updateUrl(QString("https://raw.github.com/qbittorrent/qBittorrent/master/src/searchengine/%1/engines/").arg(Utils::Misc::pythonVersion() >= 3 ? "nova3" : "nova"))
|
||||
: m_updateUrl(QString("http://searchplugins.qbittorrent.org/%1/engines/").arg(Utils::Misc::pythonVersion() >= 3 ? "nova3" : "nova"))
|
||||
, m_searchStopped(false)
|
||||
{
|
||||
updateNova();
|
||||
|
||||
@@ -38,10 +38,6 @@
|
||||
#include "logger.h"
|
||||
#include "utils/fs.h"
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#define QSETTINGS_SYNC_IS_SAVE // whether QSettings::sync() is "atomic"
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
// Encapsulates serialization of settings in "atomic" way.
|
||||
@@ -69,7 +65,7 @@ namespace
|
||||
using SettingsPtr = std::unique_ptr<QSettings>;
|
||||
SettingsPtr createSettings(const QString &name)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
return SettingsPtr(new QSettings(QSettings::IniFormat, QSettings::UserScope, "qBittorrent", name));
|
||||
#else
|
||||
return SettingsPtr(new QSettings("qBittorrent", name));
|
||||
@@ -98,22 +94,87 @@ namespace
|
||||
{
|
||||
static const MappingTable keyMapping = {
|
||||
|
||||
{ "BitTorrent/Session/MaxRatioAction", "Preferences/Bittorrent/MaxRatioAction" },
|
||||
{ "BitTorrent/Session/DefaultSavePath", "Preferences/Downloads/SavePath" },
|
||||
{ "BitTorrent/Session/TempPath", "Preferences/Downloads/TempPath" },
|
||||
{ "BitTorrent/Session/TempPathEnabled", "Preferences/Downloads/TempPathEnabled" },
|
||||
{ "BitTorrent/Session/AddTorrentPaused", "Preferences/Downloads/StartInPause" },
|
||||
{"BitTorrent/Session/MaxRatioAction", "Preferences/Bittorrent/MaxRatioAction"},
|
||||
{"BitTorrent/Session/DefaultSavePath", "Preferences/Downloads/SavePath"},
|
||||
{"BitTorrent/Session/TempPath", "Preferences/Downloads/TempPath"},
|
||||
{"BitTorrent/Session/TempPathEnabled", "Preferences/Downloads/TempPathEnabled"},
|
||||
{"BitTorrent/Session/AddTorrentPaused", "Preferences/Downloads/StartInPause"},
|
||||
{"BitTorrent/Session/RefreshInterval", "Preferences/General/RefreshInterval"},
|
||||
{"BitTorrent/Session/Preallocation", "Preferences/Downloads/PreAllocation"},
|
||||
{"BitTorrent/Session/AddExtensionToIncompleteFiles", "Preferences/Downloads/UseIncompleteExtension"},
|
||||
{"BitTorrent/Session/TorrentExportDirectory", "Preferences/Downloads/TorrentExportDir"},
|
||||
{"BitTorrent/Session/FinishedTorrentExportDirectory", "Preferences/Downloads/FinishedTorrentExportDir"},
|
||||
{"BitTorrent/Session/GlobalUPSpeedLimit", "Preferences/Connection/GlobalUPLimit"},
|
||||
{"BitTorrent/Session/GlobalDLSpeedLimit", "Preferences/Connection/GlobalDLLimit"},
|
||||
{"BitTorrent/Session/AlternativeGlobalUPSpeedLimit", "Preferences/Connection/GlobalUPLimitAlt"},
|
||||
{"BitTorrent/Session/AlternativeGlobalDLSpeedLimit", "Preferences/Connection/GlobalDLLimitAlt"},
|
||||
{"BitTorrent/Session/UseAlternativeGlobalSpeedLimit", "Preferences/Connection/alt_speeds_on"},
|
||||
{"BitTorrent/Session/BandwidthSchedulerEnabled", "Preferences/Scheduler/Enabled"},
|
||||
{"BitTorrent/Session/Port", "Preferences/Connection/PortRangeMin"},
|
||||
{"BitTorrent/Session/UseRandomPort", "Preferences/General/UseRandomPort"},
|
||||
{"BitTorrent/Session/IPv6Enabled", "Preferences/Connection/InterfaceListenIPv6"},
|
||||
{"BitTorrent/Session/Interface", "Preferences/Connection/Interface"},
|
||||
{"BitTorrent/Session/InterfaceName", "Preferences/Connection/InterfaceName"},
|
||||
{"BitTorrent/Session/InterfaceAddress", "Preferences/Connection/InterfaceAddress"},
|
||||
{"BitTorrent/Session/SaveResumeDataInterval", "Preferences/Downloads/SaveResumeDataInterval"},
|
||||
{"BitTorrent/Session/Encryption", "Preferences/Bittorrent/Encryption"},
|
||||
{"BitTorrent/Session/ForceProxy", "Preferences/Connection/ProxyForce"},
|
||||
{"BitTorrent/Session/ProxyPeerConnections", "Preferences/Connection/ProxyPeerConnections"},
|
||||
{"BitTorrent/Session/MaxConnections", "Preferences/Bittorrent/MaxConnecs"},
|
||||
{"BitTorrent/Session/MaxUploads", "Preferences/Bittorrent/MaxUploads"},
|
||||
{"BitTorrent/Session/MaxConnectionsPerTorrent", "Preferences/Bittorrent/MaxConnecsPerTorrent"},
|
||||
{"BitTorrent/Session/MaxUploadsPerTorrent", "Preferences/Bittorrent/MaxUploadsPerTorrent"},
|
||||
{"BitTorrent/Session/DHTEnabled", "Preferences/Bittorrent/DHT"},
|
||||
{"BitTorrent/Session/LSDEnabled", "Preferences/Bittorrent/LSD"},
|
||||
{"BitTorrent/Session/PeXEnabled", "Preferences/Bittorrent/PeX"},
|
||||
{"BitTorrent/Session/TrackerExchangeEnabled", "Preferences/Advanced/LtTrackerExchange"},
|
||||
{"BitTorrent/Session/AddTrackersEnabled", "Preferences/Bittorrent/AddTrackers"},
|
||||
{"BitTorrent/Session/AdditionalTrackers", "Preferences/Bittorrent/TrackersList"},
|
||||
{"BitTorrent/Session/IPFilteringEnabled", "Preferences/IPFilter/Enabled"},
|
||||
{"BitTorrent/Session/TrackerFilteringEnabled", "Preferences/IPFilter/FilterTracker"},
|
||||
{"BitTorrent/Session/IPFilter", "Preferences/IPFilter/File"},
|
||||
{"BitTorrent/Session/GlobalMaxRatio", "Preferences/Bittorrent/MaxRatio"},
|
||||
{"BitTorrent/Session/AnnounceToAllTrackers", "Preferences/Advanced/AnnounceToAllTrackers"},
|
||||
{"BitTorrent/Session/DiskCacheSize", "Preferences/Downloads/DiskWriteCacheSize"},
|
||||
{"BitTorrent/Session/DiskCacheTTL", "Preferences/Downloads/DiskWriteCacheTTL"},
|
||||
{"BitTorrent/Session/UseOSCache", "Preferences/Advanced/osCache"},
|
||||
{"BitTorrent/Session/AnonymousModeEnabled", "Preferences/Advanced/AnonymousMode"},
|
||||
{"BitTorrent/Session/QueueingSystemEnabled", "Preferences/Queueing/QueueingEnabled"},
|
||||
{"BitTorrent/Session/MaxActiveDownloads", "Preferences/Queueing/MaxActiveDownloads"},
|
||||
{"BitTorrent/Session/MaxActiveUploads", "Preferences/Queueing/MaxActiveUploads"},
|
||||
{"BitTorrent/Session/MaxActiveTorrents", "Preferences/Queueing/MaxActiveTorrents"},
|
||||
{"BitTorrent/Session/IgnoreSlowTorrentsForQueueing", "Preferences/Queueing/IgnoreSlowTorrents"},
|
||||
{"BitTorrent/Session/OutgoingPortsMin", "Preferences/Advanced/OutgoingPortsMin"},
|
||||
{"BitTorrent/Session/OutgoingPortsMax", "Preferences/Advanced/OutgoingPortsMax"},
|
||||
{"BitTorrent/Session/IgnoreLimitsOnLAN", "Preferences/Advanced/IgnoreLimitsLAN"},
|
||||
{"BitTorrent/Session/IncludeOverheadInLimits", "Preferences/Advanced/IncludeOverhead"},
|
||||
{"BitTorrent/Session/AnnounceIP", "Preferences/Connection/InetAddress"},
|
||||
{"BitTorrent/Session/SuperSeedingEnabled", "Preferences/Advanced/SuperSeeding"},
|
||||
{"BitTorrent/Session/MaxHalfOpenConnections", "Preferences/Connection/MaxHalfOpenConnec"},
|
||||
{"BitTorrent/Session/uTPEnabled", "Preferences/Bittorrent/uTP"},
|
||||
{"BitTorrent/Session/uTPRateLimited", "Preferences/Bittorrent/uTP_rate_limited"},
|
||||
{"BitTorrent/TrackerEnabled", "Preferences/Advanced/trackerEnabled"},
|
||||
{"Network/Proxy/OnlyForTorrents", "Preferences/Connection/ProxyOnlyForTorrents"},
|
||||
{"Network/Proxy/Type", "Preferences/Connection/ProxyType"},
|
||||
{"Network/Proxy/Authentication", "Preferences/Connection/Proxy/Authentication"},
|
||||
{"Network/Proxy/Username", "Preferences/Connection/Proxy/Username"},
|
||||
{"Network/Proxy/Password", "Preferences/Connection/Proxy/Password"},
|
||||
{"Network/Proxy/IP", "Preferences/Connection/Proxy/IP"},
|
||||
{"Network/Proxy/Port", "Preferences/Connection/Proxy/Port"},
|
||||
{"Network/PortForwardingEnabled", "Preferences/Connection/UPnP"},
|
||||
#ifdef QBT_USES_QT5
|
||||
{ "AddNewTorrentDialog/TreeHeaderState", "AddNewTorrentDialog/qt5/treeHeaderState" },
|
||||
{"AddNewTorrentDialog/TreeHeaderState", "AddNewTorrentDialog/qt5/treeHeaderState"},
|
||||
#else
|
||||
{ "AddNewTorrentDialog/TreeHeaderState", "AddNewTorrentDialog/treeHeaderState" },
|
||||
{"AddNewTorrentDialog/TreeHeaderState", "AddNewTorrentDialog/treeHeaderState"},
|
||||
#endif
|
||||
{ "AddNewTorrentDialog/Width", "AddNewTorrentDialog/width" },
|
||||
{ "AddNewTorrentDialog/Position", "AddNewTorrentDialog/y" },
|
||||
{ "AddNewTorrentDialog/Expanded", "AddNewTorrentDialog/expanded" },
|
||||
{ "AddNewTorrentDialog/SavePathHistory", "TorrentAdditionDlg/save_path_history" },
|
||||
{ "AddNewTorrentDialog/Enabled", "Preferences/Downloads/NewAdditionDialog" },
|
||||
{ "AddNewTorrentDialog/TopLevel", "Preferences/Downloads/NewAdditionDialogFront" }
|
||||
{"AddNewTorrentDialog/Width", "AddNewTorrentDialog/width"},
|
||||
{"AddNewTorrentDialog/Position", "AddNewTorrentDialog/y"},
|
||||
{"AddNewTorrentDialog/Expanded", "AddNewTorrentDialog/expanded"},
|
||||
{"AddNewTorrentDialog/SavePathHistory", "TorrentAdditionDlg/save_path_history"},
|
||||
{"AddNewTorrentDialog/Enabled", "Preferences/Downloads/NewAdditionDialog"},
|
||||
{"AddNewTorrentDialog/TopLevel", "Preferences/Downloads/NewAdditionDialogFront"},
|
||||
|
||||
{"State/BannedIPs", "Preferences/IPFilter/BannedIPs"}
|
||||
|
||||
};
|
||||
|
||||
@@ -201,9 +262,6 @@ void SettingsStorage::removeValue(const QString &key)
|
||||
QVariantHash TransactionalSettings::read()
|
||||
{
|
||||
QVariantHash res;
|
||||
#ifdef QSETTINGS_SYNC_IS_SAVE
|
||||
deserialize(m_name, res);
|
||||
#else
|
||||
bool writeBackNeeded = false;
|
||||
QString newPath = deserialize(m_name + QLatin1String("_new"), res);
|
||||
if (!newPath.isEmpty()) { // "_new" file is NOT empty
|
||||
@@ -222,15 +280,12 @@ QVariantHash TransactionalSettings::read()
|
||||
|
||||
if (writeBackNeeded)
|
||||
write(res);
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool TransactionalSettings::write(const QVariantHash &data)
|
||||
{
|
||||
#ifdef QSETTINGS_SYNC_IS_SAVE
|
||||
serialize(m_name, data);
|
||||
#else
|
||||
// QSettings delete the file before writing it out. This can result in problems
|
||||
// if the disk is full or a power outage occurs. Those events might occur
|
||||
// between deleting the file and recreating it. This is a safety measure.
|
||||
@@ -247,7 +302,7 @@ bool TransactionalSettings::write(const QVariantHash &data)
|
||||
finalPath.remove(index, 4);
|
||||
Utils::Fs::forceRemove(finalPath);
|
||||
QFile::rename(newPath, finalPath);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
73
src/base/settingvalue.h
Normal file
73
src/base/settingvalue.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2016 Vladimir Golovnev <glassez@yandex.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give permission to
|
||||
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||
* and distribute the linked executables. You must obey the GNU General Public
|
||||
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#ifndef SETTINGVALUE_H
|
||||
#define SETTINGVALUE_H
|
||||
|
||||
#include <functional>
|
||||
#include <QString>
|
||||
|
||||
#include "settingsstorage.h"
|
||||
|
||||
template <typename T>
|
||||
class CachedSettingValue
|
||||
{
|
||||
using ProxyFunc = std::function<T (const T&)>;
|
||||
|
||||
public:
|
||||
explicit CachedSettingValue(const char *keyName, const T &defaultValue = T()
|
||||
, ProxyFunc proxyFunc = [](const T &value) { return value; })
|
||||
: m_keyName(QLatin1String(keyName))
|
||||
, m_value(proxyFunc(SettingsStorage::instance()->loadValue(
|
||||
m_keyName, defaultValue).template value<T>()))
|
||||
{
|
||||
}
|
||||
|
||||
T value() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
CachedSettingValue<T> &operator=(const T &newValue)
|
||||
{
|
||||
m_value = newValue;
|
||||
SettingsStorage::instance()->storeValue(m_keyName, m_value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator T() const
|
||||
{
|
||||
return value();
|
||||
}
|
||||
|
||||
private:
|
||||
const QString m_keyName;
|
||||
T m_value;
|
||||
};
|
||||
|
||||
#endif // SETTINGVALUE_H
|
||||
@@ -46,16 +46,20 @@ const char C_LOCALE_ESPERANTO[] = "Esperanto";
|
||||
const char C_LOCALE_FRENCH[] = "Français";
|
||||
const char C_LOCALE_GERMAN[] = "Deutsch";
|
||||
const char C_LOCALE_HUNGARIAN[] = "Magyar";
|
||||
const char C_LOCALE_ICELANDIC[] = "Íslenska";
|
||||
const char C_LOCALE_INDONESIAN[] = "Bahasa Indonesia";
|
||||
const char C_LOCALE_ITALIAN[] = "Italiano";
|
||||
const char C_LOCALE_DUTCH[] = "Nederlands";
|
||||
const char C_LOCALE_SPANISH[] = "Español";
|
||||
const char C_LOCALE_CATALAN[] = "Català";
|
||||
const char C_LOCALE_GALICIAN[] = "Galego";
|
||||
const char C_LOCALE_OCCITAN[] = "lenga d'òc";
|
||||
const char C_LOCALE_PORTUGUESE[] = "Português";
|
||||
const char C_LOCALE_PORTUGUESE_BRAZIL[] = "Português brasileiro";
|
||||
const char C_LOCALE_POLISH[] = "Polski";
|
||||
const char C_LOCALE_LATVIAN[] = "latviešu valoda";
|
||||
const char C_LOCALE_LITHUANIAN[] = "Lietuvių";
|
||||
const char C_LOCALE_MALAY[] = "بهاس ملايو";
|
||||
const char C_LOCALE_CZECH[] = "Čeština";
|
||||
const char C_LOCALE_SLOVAK[] = "Slovenčina";
|
||||
const char C_LOCALE_SLOVENIAN[] = "Slovenščina";
|
||||
@@ -71,6 +75,7 @@ const char C_LOCALE_NORWEGIAN[] = "Norsk";
|
||||
const char C_LOCALE_DANISH[] = "Dansk";
|
||||
const char C_LOCALE_BULGARIAN[] = "Български";
|
||||
const char C_LOCALE_UKRAINIAN[] = "Українська";
|
||||
const char C_LOCALE_UZBEK[] = "أۇزبېك";
|
||||
const char C_LOCALE_RUSSIAN[] = "Русский";
|
||||
const char C_LOCALE_JAPANESE[] = "日本語";
|
||||
const char C_LOCALE_HEBREW[] = "עברית";
|
||||
|
||||
@@ -269,67 +269,43 @@ bool Utils::Fs::isValidFileSystemName(const QString &name, bool allowSeparators)
|
||||
return !name.contains(regex);
|
||||
}
|
||||
|
||||
qlonglong Utils::Fs::freeDiskSpaceOnPath(QString path)
|
||||
qulonglong Utils::Fs::freeDiskSpaceOnPath(const QString &path)
|
||||
{
|
||||
if (path.isEmpty()) return -1;
|
||||
QDir dir_path(path);
|
||||
if (!dir_path.exists()) {
|
||||
QStringList parts = path.split("/");
|
||||
while (parts.size() > 1 && !QDir(parts.join("/")).exists()) {
|
||||
parts.removeLast();
|
||||
}
|
||||
dir_path = QDir(parts.join("/"));
|
||||
if (!dir_path.exists()) return -1;
|
||||
}
|
||||
Q_ASSERT(dir_path.exists());
|
||||
if (path.isEmpty()) return 0;
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
unsigned long long available;
|
||||
#ifdef Q_OS_HAIKU
|
||||
const QString statfs_path = dir_path.path() + "/.";
|
||||
dev_t device = dev_for_path (qPrintable(statfs_path));
|
||||
if (device >= 0) {
|
||||
fs_info info;
|
||||
if (fs_stat_dev(device, &info) == B_OK) {
|
||||
available = ((unsigned long long)(info.free_blocks * info.block_size));
|
||||
return available;
|
||||
}
|
||||
QDir dirPath(path);
|
||||
if (!dirPath.exists()) {
|
||||
QStringList parts = path.split("/");
|
||||
while (parts.size() > 1 && !QDir(parts.join("/")).exists())
|
||||
parts.removeLast();
|
||||
|
||||
dirPath = QDir(parts.join("/"));
|
||||
if (!dirPath.exists()) return 0;
|
||||
}
|
||||
return -1;
|
||||
Q_ASSERT(dirPath.exists());
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
ULARGE_INTEGER bytesFree;
|
||||
LPCWSTR nativePath = reinterpret_cast<LPCWSTR>((toNativePath(dirPath.path())).utf16());
|
||||
if (GetDiskFreeSpaceExW(nativePath, &bytesFree, NULL, NULL) == 0)
|
||||
return 0;
|
||||
return bytesFree.QuadPart;
|
||||
#elif defined(Q_OS_HAIKU)
|
||||
const QString statfsPath = dirPath.path() + "/.";
|
||||
dev_t device = dev_for_path(qPrintable(statfsPath));
|
||||
if (device < 0)
|
||||
return 0;
|
||||
fs_info info;
|
||||
if (fs_stat_dev(device, &info) != B_OK)
|
||||
return 0;
|
||||
return ((qulonglong) info.free_blocks * (qulonglong) info.block_size);
|
||||
#else
|
||||
struct statfs stats;
|
||||
const QString statfs_path = dir_path.path() + "/.";
|
||||
const int ret = statfs(qPrintable(statfs_path), &stats);
|
||||
if (ret == 0) {
|
||||
available = ((unsigned long long)stats.f_bavail)
|
||||
* ((unsigned long long)stats.f_bsize);
|
||||
return available;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
typedef BOOL (WINAPI *GetDiskFreeSpaceEx_t)(LPCTSTR,
|
||||
PULARGE_INTEGER,
|
||||
PULARGE_INTEGER,
|
||||
PULARGE_INTEGER);
|
||||
GetDiskFreeSpaceEx_t pGetDiskFreeSpaceEx =
|
||||
(GetDiskFreeSpaceEx_t)::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"), "GetDiskFreeSpaceExW");
|
||||
if (pGetDiskFreeSpaceEx) {
|
||||
ULARGE_INTEGER bytesFree, bytesTotal;
|
||||
unsigned long long *ret;
|
||||
if (pGetDiskFreeSpaceEx((LPCTSTR)(toNativePath(dir_path.path())).utf16(), &bytesFree, &bytesTotal, NULL)) {
|
||||
ret = (unsigned long long*)&bytesFree;
|
||||
return *ret;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
const QString statfsPath = dirPath.path() + "/.";
|
||||
const int ret = statfs(qPrintable(statfsPath), &stats);
|
||||
if (ret != 0)
|
||||
return 0;
|
||||
return ((qulonglong) stats.f_bavail * (qulonglong) stats.f_bsize);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -378,19 +354,17 @@ QString Utils::Fs::expandPathAbs(const QString& path)
|
||||
QString Utils::Fs::QDesktopServicesDataLocation()
|
||||
{
|
||||
QString result;
|
||||
#ifdef Q_OS_WIN
|
||||
LPWSTR path=new WCHAR[256];
|
||||
if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE))
|
||||
#if defined(Q_OS_WIN)
|
||||
wchar_t path[MAX_PATH + 1] = {L'\0'};
|
||||
if (SHGetSpecialFolderPathW(0, path, CSIDL_LOCAL_APPDATA, FALSE))
|
||||
result = fromNativePath(QString::fromWCharArray(path));
|
||||
if (!QCoreApplication::applicationName().isEmpty())
|
||||
result += QLatin1String("/") + qApp->applicationName();
|
||||
#else
|
||||
#ifdef Q_OS_MAC
|
||||
#elif defined(Q_OS_MAC)
|
||||
FSRef ref;
|
||||
OSErr err = FSFindFolder(kUserDomain, kApplicationSupportFolderType, false, &ref);
|
||||
if (err)
|
||||
return QString();
|
||||
QString path;
|
||||
QByteArray ba(2048, 0);
|
||||
if (FSRefMakePath(&ref, reinterpret_cast<UInt8 *>(ba.data()), ba.size()) == noErr)
|
||||
result = QString::fromUtf8(ba).normalized(QString::NormalizationForm_C);
|
||||
@@ -402,7 +376,6 @@ QString Utils::Fs::QDesktopServicesDataLocation()
|
||||
xdgDataHome += QLatin1String("/data/")
|
||||
+ qApp->applicationName();
|
||||
result = xdgDataHome;
|
||||
#endif
|
||||
#endif
|
||||
if (!result.endsWith("/"))
|
||||
result += "/";
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Utils
|
||||
bool sameFiles(const QString& path1, const QString& path2);
|
||||
QString toValidFileSystemName(const QString &name, bool allowSeparators = false);
|
||||
bool isValidFileSystemName(const QString& name, bool allowSeparators = false);
|
||||
qlonglong freeDiskSpaceOnPath(QString path);
|
||||
qulonglong freeDiskSpaceOnPath(const QString &path);
|
||||
QString branchPath(const QString& file_path, QString* removed = 0);
|
||||
bool sameFileNames(const QString& first, const QString& second);
|
||||
QString expandPath(const QString& path);
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windows.h>
|
||||
#include <powrprof.h>
|
||||
#include <Shlobj.h>
|
||||
const int UNLEN = 256;
|
||||
#else
|
||||
#include <unistd.h>
|
||||
@@ -159,7 +160,7 @@ void Utils::Misc::shutdownComputer(const ShutdownDialogAction &action)
|
||||
AppleEvent appleEventToSend = {typeNull, NULL};
|
||||
|
||||
OSStatus error = AECreateDesc(typeProcessSerialNumber, &kPSNOfSystemProcess,
|
||||
sizeof(kPSNOfSystemProcess), &targetDesc);
|
||||
sizeof(kPSNOfSystemProcess), &targetDesc);
|
||||
|
||||
if (error != noErr)
|
||||
return;
|
||||
@@ -233,6 +234,7 @@ QPoint Utils::Misc::screenCenter(QWidget *win)
|
||||
QRect desk(QApplication::desktop()->availableGeometry(scrn));
|
||||
return QPoint((desk.width() - win->frameGeometry().width()) / 2, (desk.height() - win->frameGeometry().height()) / 2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -267,12 +269,12 @@ QString Utils::Misc::pythonExecutable()
|
||||
* http://legacy.python.org/dev/peps/pep-0394/
|
||||
*/
|
||||
pythonProc.start("python3", QStringList() << "--version", QIODevice::ReadOnly);
|
||||
if (pythonProc.waitForFinished() && pythonProc.exitCode() == 0) {
|
||||
if (pythonProc.waitForFinished() && (pythonProc.exitCode() == 0)) {
|
||||
executable = "python3";
|
||||
return executable;
|
||||
}
|
||||
pythonProc.start("python2", QStringList() << "--version", QIODevice::ReadOnly);
|
||||
if (pythonProc.waitForFinished() && pythonProc.exitCode() == 0) {
|
||||
if (pythonProc.waitForFinished() && (pythonProc.exitCode() == 0)) {
|
||||
executable = "python2";
|
||||
return executable;
|
||||
}
|
||||
@@ -280,7 +282,7 @@ QString Utils::Misc::pythonExecutable()
|
||||
// Look for "python" in Windows and in UNIX if "python2" and "python3" are
|
||||
// not detected.
|
||||
pythonProc.start("python", QStringList() << "--version", QIODevice::ReadOnly);
|
||||
if (pythonProc.waitForFinished() && pythonProc.exitCode() == 0)
|
||||
if (pythonProc.waitForFinished() && (pythonProc.exitCode() == 0))
|
||||
executable = "python";
|
||||
else
|
||||
Logger::instance()->addMessage(QCoreApplication::translate("misc", "Python not detected"), Log::INFO);
|
||||
@@ -293,14 +295,15 @@ QString Utils::Misc::pythonExecutable()
|
||||
* eg 2.7.9
|
||||
* Make sure to have setup python first
|
||||
*/
|
||||
QString Utils::Misc::pythonVersionComplete() {
|
||||
QString Utils::Misc::pythonVersionComplete()
|
||||
{
|
||||
static QString version;
|
||||
if (version.isEmpty()) {
|
||||
if (pythonExecutable().isEmpty())
|
||||
return version;
|
||||
QProcess pythonProc;
|
||||
pythonProc.start(pythonExecutable(), QStringList() << "--version", QIODevice::ReadOnly);
|
||||
if (pythonProc.waitForFinished() && pythonProc.exitCode() == 0) {
|
||||
if (pythonProc.waitForFinished() && (pythonProc.exitCode() == 0)) {
|
||||
QByteArray output = pythonProc.readAllStandardOutput();
|
||||
if (output.isEmpty())
|
||||
output = pythonProc.readAllStandardError();
|
||||
@@ -321,7 +324,7 @@ QString Utils::Misc::pythonVersionComplete() {
|
||||
QString Utils::Misc::unitString(Utils::Misc::SizeUnit unit)
|
||||
{
|
||||
return QCoreApplication::translate("misc",
|
||||
units[static_cast<int>(unit)].source, units[static_cast<int>(unit)].comment);
|
||||
units[static_cast<int>(unit)].source, units[static_cast<int>(unit)].comment);
|
||||
}
|
||||
|
||||
// return best userfriendly storage unit (B, KiB, MiB, GiB, TiB, ...)
|
||||
@@ -349,9 +352,8 @@ QString Utils::Misc::friendlyUnit(qint64 bytesValue, bool isSpeed)
|
||||
{
|
||||
SizeUnit unit;
|
||||
qreal friendlyVal;
|
||||
if (!friendlyUnit(bytesValue, friendlyVal, unit)) {
|
||||
if (!friendlyUnit(bytesValue, friendlyVal, unit))
|
||||
return QCoreApplication::translate("misc", "Unknown", "Unknown (size)");
|
||||
}
|
||||
QString ret;
|
||||
if (unit == SizeUnit::Byte)
|
||||
ret = QString::number(bytesValue) + " " + unitString(unit);
|
||||
@@ -364,13 +366,12 @@ QString Utils::Misc::friendlyUnit(qint64 bytesValue, bool isSpeed)
|
||||
|
||||
qlonglong Utils::Misc::sizeInBytes(qreal size, Utils::Misc::SizeUnit unit)
|
||||
{
|
||||
for (int i = 0; i < static_cast<int>(unit); ++i) {
|
||||
for (int i = 0; i < static_cast<int>(unit); ++i)
|
||||
size *= 1024;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
bool Utils::Misc::isPreviewable(const QString& extension)
|
||||
bool Utils::Misc::isPreviewable(const QString &extension)
|
||||
{
|
||||
static QSet<QString> multimedia_extensions;
|
||||
if (multimedia_extensions.empty()) {
|
||||
@@ -427,7 +428,7 @@ bool Utils::Misc::isPreviewable(const QString& extension)
|
||||
// time duration like "1d 2h 10m".
|
||||
QString Utils::Misc::userFriendlyDuration(qlonglong seconds)
|
||||
{
|
||||
if (seconds < 0 || seconds >= MAX_ETA)
|
||||
if ((seconds < 0) || (seconds >= MAX_ETA))
|
||||
return QString::fromUtf8(C_INFINITY);
|
||||
if (seconds == 0)
|
||||
return "0";
|
||||
@@ -435,7 +436,7 @@ QString Utils::Misc::userFriendlyDuration(qlonglong seconds)
|
||||
return QCoreApplication::translate("misc", "< 1m", "< 1 minute");
|
||||
int minutes = seconds / 60;
|
||||
if (minutes < 60)
|
||||
return QCoreApplication::translate("misc", "%1m","e.g: 10minutes").arg(QString::number(minutes));
|
||||
return QCoreApplication::translate("misc", "%1m", "e.g: 10minutes").arg(QString::number(minutes));
|
||||
int hours = minutes / 60;
|
||||
minutes = minutes - hours * 60;
|
||||
if (hours < 24)
|
||||
@@ -452,7 +453,7 @@ QString Utils::Misc::getUserIDString()
|
||||
QString uid = "0";
|
||||
#ifdef Q_OS_WIN
|
||||
WCHAR buffer[UNLEN + 1] = {0};
|
||||
DWORD buffer_len = sizeof(buffer)/sizeof(*buffer);
|
||||
DWORD buffer_len = sizeof(buffer) / sizeof(*buffer);
|
||||
if (GetUserNameW(buffer, &buffer_len))
|
||||
uid = QString::fromWCharArray(buffer);
|
||||
#else
|
||||
@@ -496,18 +497,18 @@ QString Utils::Misc::parseHtmlLinks(const QString &raw_text)
|
||||
{
|
||||
QString result = raw_text;
|
||||
static QRegExp reURL(
|
||||
"(\\s|^)" //start with whitespace or beginning of line
|
||||
"(\\s|^)" // start with whitespace or beginning of line
|
||||
"("
|
||||
"(" //case 1 -- URL with scheme
|
||||
"(http(s?))\\://" //start with scheme
|
||||
"(" // case 1 -- URL with scheme
|
||||
"(http(s?))\\://" // start with scheme
|
||||
"([a-zA-Z0-9_-]+\\.)+" // domainpart. at least one of these must exist
|
||||
"([a-zA-Z0-9\\?%=&/_\\.:#;-]+)" // everything to 1st non-URI char, must be at least one char after the previous dot (cannot use ".*" because it can be too greedy)
|
||||
")"
|
||||
"|"
|
||||
"(" //case 2a -- no scheme, contains common TLD example.com
|
||||
"(" // case 2a -- no scheme, contains common TLD example.com
|
||||
"([a-zA-Z0-9_-]+\\.)+" // domainpart. at least one of these must exist
|
||||
"(?=" // must be followed by TLD
|
||||
"AERO|aero|" //N.B. assertions are non-capturing
|
||||
"AERO|aero|" // N.B. assertions are non-capturing
|
||||
"ARPA|arpa|"
|
||||
"ASIA|asia|"
|
||||
"BIZ|biz|"
|
||||
@@ -535,8 +536,8 @@ QString Utils::Misc::parseHtmlLinks(const QString &raw_text)
|
||||
")"
|
||||
"|"
|
||||
"(" // case 2b no scheme, no TLD, must have at least 2 alphanum strings plus uncommon TLD string --> del.icio.us
|
||||
"([a-zA-Z0-9_-]+\\.) {2,}" //2 or more domainpart. --> del.icio.
|
||||
"[a-zA-Z]{2,}" //one ab (2 char or longer) --> us
|
||||
"([a-zA-Z0-9_-]+\\.) {2,}" // 2 or more domainpart. --> del.icio.
|
||||
"[a-zA-Z]{2,}" // one ab (2 char or longer) --> us
|
||||
"([a-zA-Z0-9\\?%=&/_\\.:#;-]*)" // everything to 1st non-URI char, maybe nothing in case of del.icio.us/path
|
||||
")"
|
||||
")"
|
||||
@@ -557,7 +558,7 @@ QString Utils::Misc::parseHtmlLinks(const QString &raw_text)
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
// Open the given path with an appropriate application
|
||||
void Utils::Misc::openPath(const QString& absolutePath)
|
||||
void Utils::Misc::openPath(const QString &absolutePath)
|
||||
{
|
||||
const QString path = Utils::Fs::fromNativePath(absolutePath);
|
||||
// Hack to access samba shares with QDesktopServices::openUrl
|
||||
@@ -569,79 +570,51 @@ void Utils::Misc::openPath(const QString& absolutePath)
|
||||
|
||||
// Open the parent directory of the given path with a file manager and select
|
||||
// (if possible) the item at the given path
|
||||
void Utils::Misc::openFolderSelect(const QString& absolutePath)
|
||||
void Utils::Misc::openFolderSelect(const QString &absolutePath)
|
||||
{
|
||||
const QString path = Utils::Fs::fromNativePath(absolutePath);
|
||||
// If the item to select doesn't exist, try to open its parent
|
||||
if (!QFileInfo(path).exists()) {
|
||||
openPath(path.left(path.lastIndexOf("/")));
|
||||
return;
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
if (QFileInfo(path).exists()) {
|
||||
// Syntax is: explorer /select, "C:\Folder1\Folder2\file_to_select"
|
||||
// Dir separators MUST be win-style slashes
|
||||
|
||||
// QProcess::startDetached() has an obscure bug. If the path has
|
||||
// no spaces and a comma(and maybe other special characters) it doesn't
|
||||
// get wrapped in quotes. So explorer.exe can't find the correct path and
|
||||
// displays the default one. If we wrap the path in quotes and pass it to
|
||||
// QProcess::startDetached() explorer.exe still shows the default path. In
|
||||
// this case QProcess::startDetached() probably puts its own quotes around ours.
|
||||
|
||||
STARTUPINFO startupInfo;
|
||||
::ZeroMemory(&startupInfo, sizeof(startupInfo));
|
||||
startupInfo.cb = sizeof(startupInfo);
|
||||
|
||||
PROCESS_INFORMATION processInfo;
|
||||
::ZeroMemory(&processInfo, sizeof(processInfo));
|
||||
|
||||
QString cmd = QString("explorer.exe /select,\"%1\"").arg(Utils::Fs::toNativePath(absolutePath));
|
||||
LPWSTR lpCmd = new WCHAR[cmd.size() + 1];
|
||||
cmd.toWCharArray(lpCmd);
|
||||
lpCmd[cmd.size()] = 0;
|
||||
|
||||
bool ret = ::CreateProcessW(NULL, lpCmd, NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInfo);
|
||||
delete [] lpCmd;
|
||||
|
||||
if (ret) {
|
||||
::CloseHandle(processInfo.hProcess);
|
||||
::CloseHandle(processInfo.hThread);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If the item to select doesn't exist, try to open its parent
|
||||
openPath(path.left(path.lastIndexOf("/")));
|
||||
HRESULT hresult = ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||
PIDLIST_ABSOLUTE pidl = ::ILCreateFromPathW(reinterpret_cast<PCTSTR>(Utils::Fs::toNativePath(path).utf16()));
|
||||
if (pidl) {
|
||||
::SHOpenFolderAndSelectItems(pidl, 0, nullptr, 0);
|
||||
::ILFree(pidl);
|
||||
}
|
||||
if ((hresult == S_OK) || (hresult == S_FALSE))
|
||||
::CoUninitialize();
|
||||
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
||||
if (QFileInfo(path).exists()) {
|
||||
QProcess proc;
|
||||
proc.start("xdg-mime", QStringList() << "query" << "default" << "inode/directory");
|
||||
proc.waitForFinished();
|
||||
QString output = proc.readLine().simplified();
|
||||
if (output == "dolphin.desktop" || output == "org.kde.dolphin.desktop")
|
||||
proc.startDetached("dolphin", QStringList() << "--select" << Utils::Fs::toNativePath(path));
|
||||
else if (output == "nautilus.desktop" || output == "org.gnome.Nautilus.desktop"
|
||||
|| output == "nautilus-folder-handler.desktop")
|
||||
proc.startDetached("nautilus", QStringList() << "--no-desktop" << Utils::Fs::toNativePath(path));
|
||||
else if (output == "nemo.desktop")
|
||||
proc.startDetached("nemo", QStringList() << "--no-desktop" << Utils::Fs::toNativePath(path));
|
||||
else if (output == "konqueror.desktop" || output == "kfmclient_dir.desktop")
|
||||
proc.startDetached("konqueror", QStringList() << "--select" << Utils::Fs::toNativePath(path));
|
||||
else {
|
||||
// "caja" manager can't pinpoint the file, see: https://github.com/qbittorrent/qBittorrent/issues/5003
|
||||
openPath(path.left(path.lastIndexOf("/")));
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If the item to select doesn't exist, try to open its parent
|
||||
QProcess proc;
|
||||
proc.start("xdg-mime", QStringList() << "query" << "default" << "inode/directory");
|
||||
proc.waitForFinished();
|
||||
QString output = proc.readLine().simplified();
|
||||
if ((output == "dolphin.desktop") || (output == "org.kde.dolphin.desktop"))
|
||||
proc.startDetached("dolphin", QStringList() << "--select" << Utils::Fs::toNativePath(path));
|
||||
else if ((output == "nautilus.desktop") || (output == "org.gnome.Nautilus.desktop")
|
||||
|| (output == "nautilus-folder-handler.desktop"))
|
||||
proc.startDetached("nautilus", QStringList() << "--no-desktop" << Utils::Fs::toNativePath(path));
|
||||
else if (output == "nemo.desktop")
|
||||
proc.startDetached("nemo", QStringList() << "--no-desktop" << Utils::Fs::toNativePath(path));
|
||||
else if ((output == "konqueror.desktop") || (output == "kfmclient_dir.desktop"))
|
||||
proc.startDetached("konqueror", QStringList() << "--select" << Utils::Fs::toNativePath(path));
|
||||
else
|
||||
// "caja" manager can't pinpoint the file, see: https://github.com/qbittorrent/qBittorrent/issues/5003
|
||||
openPath(path.left(path.lastIndexOf("/")));
|
||||
}
|
||||
#else
|
||||
openPath(path.left(path.lastIndexOf("/")));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
namespace
|
||||
{
|
||||
// Trick to get a portable sleep() function
|
||||
class SleeperThread : public QThread
|
||||
class SleeperThread: public QThread
|
||||
{
|
||||
public:
|
||||
static void msleep(unsigned long msecs)
|
||||
@@ -663,6 +636,7 @@ QSize Utils::Misc::smallIconSize()
|
||||
int s = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||
return QSize(s, s);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
QString Utils::Misc::osName()
|
||||
@@ -670,12 +644,12 @@ QString Utils::Misc::osName()
|
||||
// static initialization for usage in signal handler
|
||||
static const QString name =
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
|
||||
QString("%1 %2 %3")
|
||||
.arg(QSysInfo::prettyProductName())
|
||||
.arg(QSysInfo::kernelVersion())
|
||||
.arg(QSysInfo::currentCpuArchitecture());
|
||||
QString("%1 %2 %3")
|
||||
.arg(QSysInfo::prettyProductName())
|
||||
.arg(QSysInfo::kernelVersion())
|
||||
.arg(QSysInfo::currentCpuArchitecture());
|
||||
#else
|
||||
"<Input OS name here>";
|
||||
"<Input OS name here>";
|
||||
#endif
|
||||
return name;
|
||||
}
|
||||
@@ -684,9 +658,9 @@ QString Utils::Misc::boostVersionString()
|
||||
{
|
||||
// static initialization for usage in signal handler
|
||||
static const QString ver = QString("%1.%2.%3")
|
||||
.arg(BOOST_VERSION / 100000)
|
||||
.arg((BOOST_VERSION / 100) % 1000)
|
||||
.arg(BOOST_VERSION % 100);
|
||||
.arg(BOOST_VERSION / 100000)
|
||||
.arg((BOOST_VERSION / 100) % 1000)
|
||||
.arg(BOOST_VERSION % 100);
|
||||
return ver;
|
||||
}
|
||||
|
||||
@@ -696,3 +670,15 @@ QString Utils::Misc::libtorrentVersionString()
|
||||
static const QString ver = LIBTORRENT_VERSION;
|
||||
return ver;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
QString Utils::Misc::windowsSystemPath()
|
||||
{
|
||||
static const QString path = []() -> QString {
|
||||
WCHAR systemPath[64] = {0};
|
||||
GetSystemDirectoryW(systemPath, sizeof(systemPath) / sizeof(WCHAR));
|
||||
return QString::fromWCharArray(systemPath);
|
||||
}();
|
||||
return path;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -102,12 +102,16 @@ namespace Utils
|
||||
QList<int> intListfromStringList(const QStringList &l);
|
||||
QList<bool> boolListfromStringList(const QStringList &l);
|
||||
|
||||
void msleep(unsigned long msecs);
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
void openPath(const QString& absolutePath);
|
||||
void openFolderSelect(const QString& absolutePath);
|
||||
#endif
|
||||
|
||||
void msleep(unsigned long msecs);
|
||||
#ifdef Q_OS_WIN
|
||||
QString windowsSystemPath();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
|
||||
#define SETTINGS_KEY(name) "AddNewTorrentDialog/" name
|
||||
const QString KEY_ENABLED = SETTINGS_KEY("Enabled");
|
||||
const QString KEY_DEFAULTSAVEPATH = SETTINGS_KEY("DefaultSavePath");
|
||||
const QString KEY_DEFAULTCATEGORY = SETTINGS_KEY("DefaultCategory");
|
||||
const QString KEY_TREEHEADERSTATE = SETTINGS_KEY("TreeHeaderState");
|
||||
const QString KEY_WIDTH = SETTINGS_KEY("Width");
|
||||
@@ -394,7 +393,7 @@ void AddNewTorrentDialog::onSavePathChanged(int index)
|
||||
ui->defaultSavePathCheckBox->setChecked(false);
|
||||
ui->defaultSavePathCheckBox->setVisible(
|
||||
QDir(ui->savePathComboBox->itemData(ui->savePathComboBox->currentIndex()).toString())
|
||||
!= QDir(defaultSavePath()));
|
||||
!= QDir(BitTorrent::Session::instance()->defaultSavePath()));
|
||||
|
||||
// Remember index
|
||||
m_oldIndex = index;
|
||||
@@ -567,7 +566,7 @@ void AddNewTorrentDialog::setdialogPosition()
|
||||
|
||||
void AddNewTorrentDialog::populateSavePathComboBox()
|
||||
{
|
||||
QString defSavePath = defaultSavePath();
|
||||
QString defSavePath = BitTorrent::Session::instance()->defaultSavePath();
|
||||
|
||||
ui->savePathComboBox->clear();
|
||||
ui->savePathComboBox->addItem(Utils::Fs::toNativePath(defSavePath), defSavePath);
|
||||
@@ -646,7 +645,7 @@ void AddNewTorrentDialog::accept()
|
||||
params.savePath = savePath;
|
||||
saveSavePathHistory();
|
||||
if (ui->defaultSavePathCheckBox->isChecked())
|
||||
settings()->storeValue(KEY_DEFAULTSAVEPATH, savePath);
|
||||
BitTorrent::Session::instance()->setDefaultSavePath(savePath);
|
||||
}
|
||||
|
||||
setEnabled(!ui->never_show_cb->isChecked());
|
||||
@@ -690,7 +689,6 @@ void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &info)
|
||||
|
||||
// Update UI
|
||||
setupTreeview();
|
||||
TMMChanged(ui->comboTTM->currentIndex());
|
||||
setMetadataProgressIndicator(false, tr("Metadata retrieval complete"));
|
||||
}
|
||||
|
||||
@@ -744,13 +742,6 @@ void AddNewTorrentDialog::setupTreeview()
|
||||
setdialogPosition();
|
||||
}
|
||||
|
||||
QString AddNewTorrentDialog::defaultSavePath() const
|
||||
{
|
||||
return Utils::Fs::fromNativePath(
|
||||
settings()->loadValue(KEY_DEFAULTSAVEPATH,
|
||||
BitTorrent::Session::instance()->defaultSavePath()).toString());
|
||||
}
|
||||
|
||||
void AddNewTorrentDialog::handleDownloadFailed(const QString &url, const QString &reason)
|
||||
{
|
||||
MessageBoxRaised::critical(0, tr("Download Error"), QString("Cannot download '%1': %2").arg(url).arg(reason));
|
||||
|
||||
@@ -97,7 +97,6 @@ private:
|
||||
void saveState();
|
||||
void setMetadataProgressIndicator(bool visibleIndicator, const QString &labelText = QString());
|
||||
void setupTreeview();
|
||||
QString defaultSavePath() const;
|
||||
void setCommentText(const QString &str) const;
|
||||
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
||||
@@ -27,11 +27,14 @@
|
||||
*/
|
||||
|
||||
#include "advancedsettings.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <QHeaderView>
|
||||
#include <QHostAddress>
|
||||
#include <QNetworkInterface>
|
||||
|
||||
#include "app/application.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/preferences.h"
|
||||
#include "gui/mainwindow.h"
|
||||
|
||||
@@ -63,6 +66,7 @@ enum AdvSettingsRows
|
||||
RESOLVE_COUNTRIES,
|
||||
PROGRAM_NOTIFICATIONS,
|
||||
TORRENT_ADDED_NOTIFICATIONS,
|
||||
DOWNLOAD_TRACKER_FAVICON,
|
||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
||||
USE_ICON_THEME,
|
||||
#endif
|
||||
@@ -85,7 +89,7 @@ enum AdvSettingsRows
|
||||
// tracker
|
||||
TRACKER_EXCHANGE,
|
||||
ANNOUNCE_ALL_TRACKERS,
|
||||
NETWORK_ADDRESS,
|
||||
ANNOUNCE_IP,
|
||||
|
||||
ROW_COUNT
|
||||
};
|
||||
@@ -116,61 +120,63 @@ AdvancedSettings::AdvancedSettings(QWidget *parent)
|
||||
void AdvancedSettings::saveAdvancedSettings()
|
||||
{
|
||||
Preferences* const pref = Preferences::instance();
|
||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||
|
||||
// Disk write cache
|
||||
pref->setDiskCacheSize(spin_cache.value());
|
||||
pref->setDiskCacheTTL(spin_cache_ttl.value());
|
||||
session->setDiskCacheSize(spin_cache.value());
|
||||
session->setDiskCacheTTL(spin_cache_ttl.value());
|
||||
// Enable OS cache
|
||||
pref->setOsCache(cb_os_cache.isChecked());
|
||||
session->setUseOSCache(cb_os_cache.isChecked());
|
||||
// Save resume data interval
|
||||
pref->setSaveResumeDataInterval(spin_save_resume_data_interval.value());
|
||||
session->setSaveResumeDataInterval(spin_save_resume_data_interval.value());
|
||||
// Outgoing ports
|
||||
pref->setOutgoingPortsMin(outgoing_ports_min.value());
|
||||
pref->setOutgoingPortsMax(outgoing_ports_max.value());
|
||||
session->setOutgoingPortsMin(outgoing_ports_min.value());
|
||||
session->setOutgoingPortsMax(outgoing_ports_max.value());
|
||||
// Recheck torrents on completion
|
||||
pref->recheckTorrentsOnCompletion(cb_recheck_completed.isChecked());
|
||||
// Transfer list refresh interval
|
||||
pref->setRefreshInterval(spin_list_refresh.value());
|
||||
session->setRefreshInterval(spin_list_refresh.value());
|
||||
// Peer resolution
|
||||
pref->resolvePeerCountries(cb_resolve_countries.isChecked());
|
||||
pref->resolvePeerHostNames(cb_resolve_hosts.isChecked());
|
||||
// Max Half-Open connections
|
||||
pref->setMaxHalfOpenConnections(spin_maxhalfopen.value());
|
||||
session->setMaxHalfOpenConnections(spin_maxhalfopen.value());
|
||||
// Super seeding
|
||||
pref->enableSuperSeeding(cb_super_seeding.isChecked());
|
||||
session->setSuperSeedingEnabled(cb_super_seeding.isChecked());
|
||||
// Network interface
|
||||
if (combo_iface.currentIndex() == 0) {
|
||||
// All interfaces (default)
|
||||
pref->setNetworkInterface(QString::null);
|
||||
pref->setNetworkInterfaceName(QString::null);
|
||||
session->setNetworkInterface(QString());
|
||||
session->setNetworkInterfaceName(QString());
|
||||
}
|
||||
else {
|
||||
pref->setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString());
|
||||
pref->setNetworkInterfaceName(combo_iface.currentText());
|
||||
session->setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString());
|
||||
session->setNetworkInterfaceName(combo_iface.currentText());
|
||||
}
|
||||
// Listen on IPv6 address
|
||||
pref->setListenIPv6(cb_listen_ipv6.isChecked());
|
||||
|
||||
// Interface address
|
||||
if (combo_iface_address.currentIndex() == 0) {
|
||||
// All addresses (default)
|
||||
pref->setNetworkInterfaceAddress(QString::null);
|
||||
session->setNetworkInterfaceAddress(QString::null);
|
||||
}
|
||||
else {
|
||||
QHostAddress ifaceAddr(combo_iface_address.currentText().trimmed());
|
||||
ifaceAddr.isNull() ? pref->setNetworkInterfaceAddress(QString::null) : pref->setNetworkInterfaceAddress(ifaceAddr.toString());
|
||||
ifaceAddr.isNull() ? session->setNetworkInterfaceAddress(QString::null) : session->setNetworkInterfaceAddress(ifaceAddr.toString());
|
||||
}
|
||||
// Network Announce address
|
||||
QHostAddress networkAddr(txt_network_address.text().trimmed());
|
||||
if (networkAddr.isNull())
|
||||
pref->setNetworkAddress("");
|
||||
else
|
||||
pref->setNetworkAddress(networkAddr.toString());
|
||||
session->setIPv6Enabled(cb_listen_ipv6.isChecked());
|
||||
// Announce IP
|
||||
QHostAddress addr(txtAnnounceIP.text().trimmed());
|
||||
session->setAnnounceIP(addr.isNull() ? "" : addr.toString());
|
||||
|
||||
// Program notification
|
||||
MainWindow * const mainWindow = static_cast<Application*>(QCoreApplication::instance())->mainWindow();
|
||||
mainWindow->setNotificationsEnabled(cb_program_notifications.isChecked());
|
||||
mainWindow->setTorrentAddedNotificationsEnabled(cb_torrent_added_notifications.isChecked());
|
||||
// Misc GUI properties
|
||||
mainWindow->setDownloadTrackerFavicon(cb_tracker_favicon.isChecked());
|
||||
|
||||
// Tracker
|
||||
pref->setTrackerEnabled(cb_tracker_status.isChecked());
|
||||
session->setTrackerEnabled(cb_tracker_status.isChecked());
|
||||
pref->setTrackerPort(spin_tracker_port.value());
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
pref->setUpdateCheckEnabled(cb_update_check.isChecked());
|
||||
@@ -181,8 +187,8 @@ void AdvancedSettings::saveAdvancedSettings()
|
||||
#endif
|
||||
pref->setConfirmTorrentRecheck(cb_confirm_torrent_recheck.isChecked());
|
||||
// Tracker exchange
|
||||
pref->setTrackerExchangeEnabled(cb_enable_tracker_ext.isChecked());
|
||||
pref->setAnnounceToAllTrackers(cb_announce_all_trackers.isChecked());
|
||||
session->setTrackerExchangeEnabled(cb_enable_tracker_ext.isChecked());
|
||||
session->setAnnounceToAllTrackers(cb_announce_all_trackers.isChecked());
|
||||
}
|
||||
|
||||
void AdvancedSettings::updateCacheSpinSuffix(int value)
|
||||
@@ -197,7 +203,7 @@ void AdvancedSettings::updateInterfaceAddressCombo()
|
||||
{
|
||||
// Try to get the currently selected interface name
|
||||
const QString ifaceName = combo_iface.itemData(combo_iface.currentIndex()).toString(); // Empty string for the first element
|
||||
const QString currentAddress = Preferences::instance()->getNetworkInterfaceAddress();
|
||||
const QString currentAddress = BitTorrent::Session::instance()->networkInterfaceAddress();
|
||||
|
||||
//Clear all items and reinsert them, default to all
|
||||
combo_iface_address.clear();
|
||||
@@ -233,6 +239,8 @@ void AdvancedSettings::updateInterfaceAddressCombo()
|
||||
void AdvancedSettings::loadAdvancedSettings()
|
||||
{
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
const BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||
|
||||
// add section headers
|
||||
QFont boldFont;
|
||||
boldFont.setBold(true);
|
||||
@@ -255,33 +263,33 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM
|
||||
spin_cache.setMaximum(1536);
|
||||
#endif
|
||||
spin_cache.setValue(pref->diskCacheSize());
|
||||
spin_cache.setValue(session->diskCacheSize());
|
||||
updateCacheSpinSuffix(spin_cache.value());
|
||||
addRow(DISK_CACHE, tr("Disk write cache size"), &spin_cache);
|
||||
// Disk cache expiry
|
||||
spin_cache_ttl.setMinimum(15);
|
||||
spin_cache_ttl.setMaximum(600);
|
||||
spin_cache_ttl.setValue(pref->diskCacheTTL());
|
||||
spin_cache_ttl.setValue(session->diskCacheTTL());
|
||||
spin_cache_ttl.setSuffix(tr(" s", " seconds"));
|
||||
addRow(DISK_CACHE_TTL, tr("Disk cache expiry interval"), &spin_cache_ttl);
|
||||
// Enable OS cache
|
||||
cb_os_cache.setChecked(pref->osCache());
|
||||
cb_os_cache.setChecked(session->useOSCache());
|
||||
addRow(OS_CACHE, tr("Enable OS cache"), &cb_os_cache);
|
||||
// Save resume data interval
|
||||
spin_save_resume_data_interval.setMinimum(1);
|
||||
spin_save_resume_data_interval.setMaximum(1440);
|
||||
spin_save_resume_data_interval.setValue(pref->saveResumeDataInterval());
|
||||
spin_save_resume_data_interval.setValue(session->saveResumeDataInterval());
|
||||
spin_save_resume_data_interval.setSuffix(tr(" m", " minutes"));
|
||||
addRow(SAVE_RESUME_DATA_INTERVAL, tr("Save resume data interval", "How often the fastresume file is saved."), &spin_save_resume_data_interval);
|
||||
// Outgoing port Min
|
||||
outgoing_ports_min.setMinimum(0);
|
||||
outgoing_ports_min.setMaximum(65535);
|
||||
outgoing_ports_min.setValue(pref->outgoingPortsMin());
|
||||
outgoing_ports_min.setValue(session->outgoingPortsMin());
|
||||
addRow(OUTGOING_PORT_MIN, tr("Outgoing ports (Min) [0: Disabled]"), &outgoing_ports_min);
|
||||
// Outgoing port Min
|
||||
outgoing_ports_max.setMinimum(0);
|
||||
outgoing_ports_max.setMaximum(65535);
|
||||
outgoing_ports_max.setValue(pref->outgoingPortsMax());
|
||||
outgoing_ports_max.setValue(session->outgoingPortsMax());
|
||||
addRow(OUTGOING_PORT_MAX, tr("Outgoing ports (Max) [0: Disabled]"), &outgoing_ports_max);
|
||||
// Recheck completed torrents
|
||||
cb_recheck_completed.setChecked(pref->recheckTorrentsOnCompletion());
|
||||
@@ -289,7 +297,7 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||
// Transfer list refresh interval
|
||||
spin_list_refresh.setMinimum(30);
|
||||
spin_list_refresh.setMaximum(99999);
|
||||
spin_list_refresh.setValue(pref->getRefreshInterval());
|
||||
spin_list_refresh.setValue(session->refreshInterval());
|
||||
spin_list_refresh.setSuffix(tr(" ms", " milliseconds"));
|
||||
addRow(LIST_REFRESH, tr("Transfer list refresh interval"), &spin_list_refresh);
|
||||
// Resolve Peer countries
|
||||
@@ -301,14 +309,14 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||
// Max Half Open connections
|
||||
spin_maxhalfopen.setMinimum(0);
|
||||
spin_maxhalfopen.setMaximum(99999);
|
||||
spin_maxhalfopen.setValue(pref->getMaxHalfOpenConnections());
|
||||
spin_maxhalfopen.setValue(session->maxHalfOpenConnections());
|
||||
addRow(MAX_HALF_OPEN, tr("Maximum number of half-open connections [0: Unlimited]"), &spin_maxhalfopen);
|
||||
// Super seeding
|
||||
cb_super_seeding.setChecked(pref->isSuperSeedingEnabled());
|
||||
cb_super_seeding.setChecked(session->isSuperSeedingEnabled());
|
||||
addRow(SUPER_SEEDING, tr("Strict super seeding"), &cb_super_seeding);
|
||||
// Network interface
|
||||
combo_iface.addItem(tr("Any interface", "i.e. Any network interface"));
|
||||
const QString current_iface = pref->getNetworkInterface();
|
||||
const QString current_iface = session->networkInterface();
|
||||
bool interface_exists = current_iface.isEmpty();
|
||||
int i = 1;
|
||||
foreach (const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) {
|
||||
@@ -328,7 +336,7 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||
}
|
||||
// Saved interface does not exist, show it anyway
|
||||
if (!interface_exists) {
|
||||
combo_iface.addItem(pref->getNetworkInterfaceName(), current_iface);
|
||||
combo_iface.addItem(session->networkInterfaceName(), current_iface);
|
||||
combo_iface.setCurrentIndex(i);
|
||||
}
|
||||
addRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &combo_iface);
|
||||
@@ -336,11 +344,11 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||
updateInterfaceAddressCombo();
|
||||
addRow(NETWORK_IFACE_ADDRESS, tr("Optional IP Address to bind to (requires restart)"), &combo_iface_address);
|
||||
// Listen on IPv6 address
|
||||
cb_listen_ipv6.setChecked(pref->getListenIPv6());
|
||||
cb_listen_ipv6.setChecked(session->isIPv6Enabled());
|
||||
addRow(NETWORK_LISTEN_IPV6, tr("Listen on IPv6 address (requires restart)"), &cb_listen_ipv6);
|
||||
// Announce address
|
||||
txt_network_address.setText(pref->getNetworkAddress());
|
||||
addRow(NETWORK_ADDRESS, tr("IP Address to report to trackers (requires restart)"), &txt_network_address);
|
||||
// Announce IP
|
||||
txtAnnounceIP.setText(session->announceIP());
|
||||
addRow(ANNOUNCE_IP, tr("IP Address to report to trackers (requires restart)"), &txtAnnounceIP);
|
||||
|
||||
// Program notifications
|
||||
const MainWindow * const mainWindow = static_cast<Application*>(QCoreApplication::instance())->mainWindow();
|
||||
@@ -349,8 +357,12 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||
// Torrent added notifications
|
||||
cb_torrent_added_notifications.setChecked(mainWindow->isTorrentAddedNotificationsEnabled());
|
||||
addRow(TORRENT_ADDED_NOTIFICATIONS, tr("Display notifications for added torrents"), &cb_torrent_added_notifications);
|
||||
// Download tracker's favicon
|
||||
cb_tracker_favicon.setChecked(mainWindow->isDownloadTrackerFavicon());
|
||||
addRow(DOWNLOAD_TRACKER_FAVICON, tr("Download tracker's favicon"), &cb_tracker_favicon);
|
||||
|
||||
// Tracker State
|
||||
cb_tracker_status.setChecked(pref->isTrackerEnabled());
|
||||
cb_tracker_status.setChecked(session->isTrackerEnabled());
|
||||
addRow(TRACKER_STATUS, tr("Enable embedded tracker"), &cb_tracker_status);
|
||||
// Tracker port
|
||||
spin_tracker_port.setMinimum(1);
|
||||
@@ -369,10 +381,10 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||
cb_confirm_torrent_recheck.setChecked(pref->confirmTorrentRecheck());
|
||||
addRow(CONFIRM_RECHECK_TORRENT, tr("Confirm torrent recheck"), &cb_confirm_torrent_recheck);
|
||||
// Tracker exchange
|
||||
cb_enable_tracker_ext.setChecked(pref->trackerExchangeEnabled());
|
||||
cb_enable_tracker_ext.setChecked(session->isTrackerExchangeEnabled());
|
||||
addRow(TRACKER_EXCHANGE, tr("Exchange trackers with other peers"), &cb_enable_tracker_ext);
|
||||
// Announce to all trackers
|
||||
cb_announce_all_trackers.setChecked(pref->announceToAllTrackers());
|
||||
cb_announce_all_trackers.setChecked(session->announceToAllTrackers());
|
||||
addRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers"), &cb_announce_all_trackers);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,11 +60,11 @@ private:
|
||||
|
||||
QLabel labelQbtLink, labelLibtorrentLink;
|
||||
QSpinBox spin_cache, spin_save_resume_data_interval, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port, spin_cache_ttl;
|
||||
QCheckBox cb_os_cache, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts,
|
||||
cb_super_seeding, cb_program_notifications, cb_torrent_added_notifications, cb_tracker_status,
|
||||
QCheckBox cb_os_cache, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts, cb_super_seeding,
|
||||
cb_program_notifications, cb_torrent_added_notifications, cb_tracker_favicon, cb_tracker_status,
|
||||
cb_confirm_torrent_recheck, cb_enable_tracker_ext, cb_listen_ipv6, cb_announce_all_trackers;
|
||||
QComboBox combo_iface, combo_iface_address;
|
||||
QLineEdit txt_network_address;
|
||||
QLineEdit txtAnnounceIP;
|
||||
|
||||
// OS dependent settings
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
|
||||
@@ -42,7 +42,7 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name): QDialog(parent) {
|
||||
DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles): QDialog(parent) {
|
||||
setupUi(this);
|
||||
if (size == 1)
|
||||
label->setText(tr("Are you sure you want to delete '%1' from the transfer list?", "Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?").arg(name));
|
||||
@@ -54,7 +54,7 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
|
||||
rememberBtn->setIcon(GuiIconProvider::instance()->getIcon("object-locked"));
|
||||
|
||||
move(Utils::Misc::screenCenter(this));
|
||||
checkPermDelete->setChecked(Preferences::instance()->deleteTorrentFilesAsDefault());
|
||||
checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());
|
||||
connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));
|
||||
buttonBox->button(QDialogButtonBox::Cancel)->setFocus();
|
||||
}
|
||||
@@ -63,10 +63,10 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
|
||||
return checkPermDelete->isChecked();
|
||||
}
|
||||
|
||||
static bool askForDeletionConfirmation(bool& delete_local_files, const int& size, const QString& name) {
|
||||
DeletionConfirmationDlg dlg(NULL, size, name);
|
||||
static bool askForDeletionConfirmation(bool& deleteLocalFiles, const int& size, const QString& name) {
|
||||
DeletionConfirmationDlg dlg(NULL, size, name, deleteLocalFiles);
|
||||
if (dlg.exec() == QDialog::Accepted) {
|
||||
delete_local_files = dlg.shouldDeleteLocalFiles();
|
||||
deleteLocalFiles = dlg.shouldDeleteLocalFiles();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -96,9 +96,9 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{
|
||||
QMessageBox::warning(0, tr("No URL entered"), tr("Please type at least one URL."));
|
||||
return;
|
||||
}
|
||||
close();
|
||||
emit urlsReadyToBeDownloaded(url_list_cleaned);
|
||||
qDebug("Emitted urlsReadytobedownloaded signal");
|
||||
close();
|
||||
}
|
||||
|
||||
void on_cancelButton_clicked() {
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <QCloseEvent>
|
||||
#include <QShortcut>
|
||||
#include <QScrollBar>
|
||||
#include <QSysInfo>
|
||||
#include <QMimeData>
|
||||
#include <QCryptographicHash>
|
||||
#include <QProcess>
|
||||
@@ -113,6 +114,9 @@ namespace
|
||||
const QString KEY_NOTIFICATIONS_ENABLED = NOTIFICATIONS_SETTINGS_KEY("Enabled");
|
||||
const QString KEY_NOTIFICATIONS_TORRENTADDED = NOTIFICATIONS_SETTINGS_KEY("TorrentAdded");
|
||||
|
||||
// Misc
|
||||
const QString KEY_DOWNLOAD_TRACKER_FAVICON = NOTIFICATIONS_SETTINGS_KEY("DownloadTrackerFavicon");
|
||||
|
||||
//just a shortcut
|
||||
inline SettingsStorage *settings() { return SettingsStorage::instance(); }
|
||||
}
|
||||
@@ -219,6 +223,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
//transferList->setStyleSheet("QTreeView {border: none;}"); // borderless
|
||||
m_propertiesWidget = new PropertiesWidget(hSplitter, this, m_transferListWidget);
|
||||
m_transferListFiltersWidget = new TransferListFiltersWidget(m_splitter, m_transferListWidget);
|
||||
m_transferListFiltersWidget->setDownloadTrackerFavicon(isDownloadTrackerFavicon());
|
||||
hSplitter->addWidget(m_transferListWidget);
|
||||
hSplitter->addWidget(m_propertiesWidget);
|
||||
m_splitter->addWidget(m_transferListFiltersWidget);
|
||||
@@ -248,7 +253,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(m_ui->actionStartAll, SIGNAL(triggered()), m_transferListWidget, SLOT(resumeAllTorrents()));
|
||||
connect(m_ui->actionPause, SIGNAL(triggered()), m_transferListWidget, SLOT(pauseSelectedTorrents()));
|
||||
connect(m_ui->actionPauseAll, SIGNAL(triggered()), m_transferListWidget, SLOT(pauseAllTorrents()));
|
||||
connect(m_ui->actionDelete, SIGNAL(triggered()), m_transferListWidget, SLOT(deleteSelectedTorrents()));
|
||||
connect(m_ui->actionDelete, SIGNAL(triggered()), m_transferListWidget, SLOT(softDeleteSelectedTorrents()));
|
||||
connect(m_ui->actionTopPriority, SIGNAL(triggered()), m_transferListWidget, SLOT(topPrioSelectedTorrents()));
|
||||
connect(m_ui->actionIncreasePriority, SIGNAL(triggered()), m_transferListWidget, SLOT(increasePrioSelectedTorrents()));
|
||||
connect(m_ui->actionDecreasePriority, SIGNAL(triggered()), m_transferListWidget, SLOT(decreasePrioSelectedTorrents()));
|
||||
@@ -397,10 +402,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
// Workaround to avoid bug http://bugreports.qt.nokia.com/browse/QTBUG-7305
|
||||
setUnifiedTitleAndToolBarOnMac(false);
|
||||
#endif
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
@@ -447,6 +448,17 @@ void MainWindow::setTorrentAddedNotificationsEnabled(bool value)
|
||||
settings()->storeValue(KEY_NOTIFICATIONS_TORRENTADDED, value);
|
||||
}
|
||||
|
||||
bool MainWindow::isDownloadTrackerFavicon() const
|
||||
{
|
||||
return settings()->loadValue(KEY_DOWNLOAD_TRACKER_FAVICON, true).toBool();
|
||||
}
|
||||
|
||||
void MainWindow::setDownloadTrackerFavicon(bool value)
|
||||
{
|
||||
m_transferListFiltersWidget->setDownloadTrackerFavicon(value);
|
||||
settings()->storeValue(KEY_DOWNLOAD_TRACKER_FAVICON, value);
|
||||
}
|
||||
|
||||
void MainWindow::addToolbarContextMenu()
|
||||
{
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
@@ -743,8 +755,8 @@ void MainWindow::fullDiskError(BitTorrent::TorrentHandle *const torrent, QString
|
||||
|
||||
void MainWindow::createKeyboardShortcuts()
|
||||
{
|
||||
m_ui->actionCreateTorrent->setShortcut(QKeySequence("Ctrl+N"));
|
||||
m_ui->actionOpen->setShortcut(QKeySequence("Ctrl+O"));
|
||||
m_ui->actionCreateTorrent->setShortcut(QKeySequence::New);
|
||||
m_ui->actionOpen->setShortcut(QKeySequence::Open);
|
||||
m_ui->actionDownloadFromURL->setShortcut(QKeySequence("Ctrl+Shift+O"));
|
||||
m_ui->actionExit->setShortcut(QKeySequence("Ctrl+Q"));
|
||||
|
||||
@@ -752,12 +764,12 @@ void MainWindow::createKeyboardShortcuts()
|
||||
connect(switchTransferShortcut, SIGNAL(activated()), this, SLOT(displayTransferTab()));
|
||||
QShortcut *switchSearchShortcut = new QShortcut(QKeySequence("Alt+2"), this);
|
||||
connect(switchSearchShortcut, SIGNAL(activated()), this, SLOT(displaySearchTab()));
|
||||
QShortcut *switchSearchShortcut2 = new QShortcut(QKeySequence("Ctrl+F"), this);
|
||||
QShortcut *switchSearchShortcut2 = new QShortcut(QKeySequence::Find, this);
|
||||
connect(switchSearchShortcut2, SIGNAL(activated()), this, SLOT(displaySearchTab()));
|
||||
QShortcut *switchRSSShortcut = new QShortcut(QKeySequence("Alt+3"), this);
|
||||
connect(switchRSSShortcut, SIGNAL(activated()), this, SLOT(displayRSSTab()));
|
||||
|
||||
m_ui->actionDocumentation->setShortcut(QKeySequence("F1"));
|
||||
m_ui->actionDocumentation->setShortcut(QKeySequence::HelpContents);
|
||||
m_ui->actionOptions->setShortcut(QKeySequence("Alt+O"));
|
||||
m_ui->actionStart->setShortcut(QKeySequence("Ctrl+S"));
|
||||
m_ui->actionStartAll->setShortcut(QKeySequence("Ctrl+Shift+S"));
|
||||
@@ -820,32 +832,26 @@ void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const
|
||||
void MainWindow::on_actionSetGlobalUploadLimit_triggered()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
bool ok;
|
||||
int curLimit = BitTorrent::Session::instance()->uploadRateLimit();
|
||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Upload Speed Limit"), curLimit);
|
||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||
bool ok = false;
|
||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
||||
&ok, tr("Global Upload Speed Limit"), session->uploadSpeedLimit());
|
||||
if (ok) {
|
||||
qDebug("Setting global upload rate limit to %.1fKb/s", newLimit / 1024.);
|
||||
BitTorrent::Session::instance()->setUploadRateLimit(newLimit);
|
||||
if (newLimit <= 0)
|
||||
Preferences::instance()->setGlobalUploadLimit(-1);
|
||||
else
|
||||
Preferences::instance()->setGlobalUploadLimit(newLimit / 1024.);
|
||||
session->setUploadSpeedLimit(newLimit);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSetGlobalDownloadLimit_triggered()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
bool ok;
|
||||
int curLimit = BitTorrent::Session::instance()->downloadRateLimit();
|
||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Download Speed Limit"), curLimit);
|
||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||
bool ok = false;
|
||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
||||
&ok, tr("Global Download Speed Limit"), session->downloadSpeedLimit());
|
||||
if (ok) {
|
||||
qDebug("Setting global download rate limit to %.1fKb/s", newLimit / 1024.);
|
||||
BitTorrent::Session::instance()->setDownloadRateLimit(newLimit);
|
||||
if (newLimit <= 0)
|
||||
Preferences::instance()->setGlobalDownloadLimit(-1);
|
||||
else
|
||||
Preferences::instance()->setGlobalDownloadLimit(newLimit / 1024.);
|
||||
session->setDownloadSpeedLimit(newLimit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -924,7 +930,7 @@ void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e)
|
||||
return;
|
||||
}
|
||||
// Make sure the window is not minimized
|
||||
setWindowState(windowState() & (~Qt::WindowMinimized | Qt::WindowActive));
|
||||
setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
||||
// Then show it
|
||||
show();
|
||||
raise();
|
||||
@@ -1221,7 +1227,7 @@ void MainWindow::loadPreferences(bool configureSession)
|
||||
m_propertiesWidget->getPeerList()->setAlternatingRowColors(pref->useAlternatingRowColors());
|
||||
|
||||
// Queueing System
|
||||
if (pref->isQueueingSystemEnabled()) {
|
||||
if (BitTorrent::Session::instance()->isQueueingSystemEnabled()) {
|
||||
if (!m_ui->actionDecreasePriority->isVisible()) {
|
||||
m_transferListWidget->hidePriorityColumn(false);
|
||||
m_ui->actionDecreasePriority->setVisible(true);
|
||||
@@ -1412,7 +1418,7 @@ QMenu* MainWindow::trayIconMenu()
|
||||
m_trayIconMenu->addAction(m_ui->actionOpen);
|
||||
m_trayIconMenu->addAction(m_ui->actionDownloadFromURL);
|
||||
m_trayIconMenu->addSeparator();
|
||||
const bool isAltBWEnabled = Preferences::instance()->isAltBandwidthEnabled();
|
||||
const bool isAltBWEnabled = BitTorrent::Session::instance()->isAltGlobalSpeedLimitEnabled();
|
||||
updateAltSpeedsBtn(isAltBWEnabled);
|
||||
m_ui->actionUseAlternativeSpeedLimits->setChecked(isAltBWEnabled);
|
||||
m_trayIconMenu->addAction(m_ui->actionUseAlternativeSpeedLimits);
|
||||
@@ -1485,7 +1491,8 @@ void MainWindow::on_actionSearchWidget_triggered()
|
||||
|
||||
// Check if python is already in PATH
|
||||
if (pythonVersion > 0)
|
||||
Logger::instance()->addMessage(tr("Python found in %1").arg("PATH"), Log::INFO); // Prevent translators from messing with PATH
|
||||
// Prevent translators from messing with PATH
|
||||
Logger::instance()->addMessage(tr("Python found in %1: %2", "Python found in PATH: /usr/local/bin:/usr/bin:/etc/bin").arg("PATH").arg(qgetenv("PATH").constData()), Log::INFO);
|
||||
#ifdef Q_OS_WIN
|
||||
else if (addPythonPathToEnv())
|
||||
pythonVersion = Utils::Misc::pythonVersion();
|
||||
@@ -1604,7 +1611,7 @@ void MainWindow::showConnectionSettings()
|
||||
|
||||
void MainWindow::minimizeWindow()
|
||||
{
|
||||
setWindowState(windowState() ^ Qt::WindowMinimized);
|
||||
setWindowState(windowState() | Qt::WindowMinimized);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionExecutionLogs_triggered(bool checked)
|
||||
@@ -1759,7 +1766,11 @@ void MainWindow::installPython()
|
||||
{
|
||||
setCursor(QCursor(Qt::WaitCursor));
|
||||
// Download python
|
||||
Net::DownloadHandler *handler = Net::DownloadManager::instance()->downloadUrl("https://www.python.org/ftp/python/3.4.3/python-3.4.3.msi", true);
|
||||
Net::DownloadHandler *handler = nullptr;
|
||||
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
|
||||
handler = Net::DownloadManager::instance()->downloadUrl("https://www.python.org/ftp/python/3.5.2/python-3.5.2.exe", true);
|
||||
else
|
||||
handler = Net::DownloadManager::instance()->downloadUrl("https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi", true);
|
||||
connect(handler, SIGNAL(downloadFinished(QString, QString)), this, SLOT(pythonDownloadSuccess(QString, QString)));
|
||||
connect(handler, SIGNAL(downloadFailed(QString, QString)), this, SLOT(pythonDownloadFailure(QString, QString)));
|
||||
}
|
||||
@@ -1768,19 +1779,29 @@ void MainWindow::pythonDownloadSuccess(const QString &url, const QString &filePa
|
||||
{
|
||||
Q_UNUSED(url)
|
||||
setCursor(QCursor(Qt::ArrowCursor));
|
||||
QFile::rename(filePath, filePath + ".msi");
|
||||
QProcess installer;
|
||||
qDebug("Launching Python installer in passive mode...");
|
||||
|
||||
installer.start("msiexec.exe /passive /i " + Utils::Fs::toNativePath(filePath) + ".msi");
|
||||
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) {
|
||||
QFile::rename(filePath, filePath + ".exe");
|
||||
installer.start("\"" + Utils::Fs::toNativePath(filePath) + ".exe\" /passive");
|
||||
}
|
||||
else {
|
||||
QFile::rename(filePath, filePath + ".msi");
|
||||
installer.start(Utils::Misc::windowsSystemPath() + "\\msiexec.exe /passive /i \"" + Utils::Fs::toNativePath(filePath) + ".msi\"");
|
||||
}
|
||||
|
||||
// Wait for setup to complete
|
||||
installer.waitForFinished();
|
||||
installer.waitForFinished(10 * 60 * 1000);
|
||||
|
||||
qDebug("Installer stdout: %s", installer.readAllStandardOutput().data());
|
||||
qDebug("Installer stderr: %s", installer.readAllStandardError().data());
|
||||
qDebug("Setup should be complete!");
|
||||
// Delete temp file
|
||||
Utils::Fs::forceRemove(filePath);
|
||||
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
|
||||
Utils::Fs::forceRemove(filePath + ".exe");
|
||||
else
|
||||
Utils::Fs::forceRemove(filePath + ".msi");
|
||||
// Reload search engine
|
||||
m_hasPython = addPythonPathToEnv();
|
||||
if (m_hasPython) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user