mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 14:08:03 -06:00
Compare commits
39 Commits
release-5.
...
release-3.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d753988729 | ||
|
|
a6b948077a | ||
|
|
3276cc4987 | ||
|
|
71557fe784 | ||
|
|
29fc5bc80d | ||
|
|
db07551e4c | ||
|
|
8f6eb795e3 | ||
|
|
0a37799e6e | ||
|
|
76d6d9a4f9 | ||
|
|
0c8abd0abb | ||
|
|
ddc8420810 | ||
|
|
a4ff039abc | ||
|
|
c8be062e19 | ||
|
|
29443a2c10 | ||
|
|
e402556e91 | ||
|
|
4ed4ebcdb7 | ||
|
|
a280467270 | ||
|
|
9b1090332b | ||
|
|
18a520c9f9 | ||
|
|
af871ef8af | ||
|
|
3af7eb8e03 | ||
|
|
3439300cda | ||
|
|
a8027565c9 | ||
|
|
3d4e1a8127 | ||
|
|
7b6a1a1955 | ||
|
|
3f8dc60680 | ||
|
|
9be449dd7f | ||
|
|
c46f2ba097 | ||
|
|
c2c441ed08 | ||
|
|
c1e52fa1cd | ||
|
|
fbed5dc606 | ||
|
|
97978068c6 | ||
|
|
006e34880a | ||
|
|
1fd5c5d8b5 | ||
|
|
68ac9fda2d | ||
|
|
c5d807ef65 | ||
|
|
e17f10ae6b | ||
|
|
78c5d1c12f | ||
|
|
26fb54299b |
@@ -1,7 +1,7 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[qbittorrent.qbittorrent_master]
|
||||
[qbittorrent.qbittorrent_v3_3_x]
|
||||
file_filter = src/lang/qbittorrent_<lang>.ts
|
||||
source_file = src/lang/qbittorrent_en.ts
|
||||
source_lang = en
|
||||
|
||||
36
CONTRIBUTING.md
Normal file
36
CONTRIBUTING.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Filing an issue
|
||||
|
||||
### Must read
|
||||
* If you aren't sure, you can ask on the [**forum**](http://forum.qbittorrent.org) or read our [**wiki**](http://wiki.qbittorrent.org) first.
|
||||
* Do a quick **search**. Others might already reported the issue.
|
||||
* Write in **English**!
|
||||
* Provide **version** information: (You can find version numbers at menu `Help -> About -> Libraries`)
|
||||
```
|
||||
qBittorrent:
|
||||
Qt:
|
||||
libtorrent:
|
||||
boost:
|
||||
OS version:
|
||||
|
||||
```
|
||||
* Provide **steps** to reproduce the problem, it will be easier to pinpoint the fault.
|
||||
* **Screenshots**! A screenshot is worth a thousand words. just upload it. [(How?)](https://help.github.com/articles/file-attachments-on-issues-and-pull-requests)
|
||||
|
||||
### Good to know
|
||||
* **Patience**. The dev team is small and resource limited. Devs finding their free time, analyzing the problem and fixing the issue, it all takes time. :clock3:
|
||||
* If you can code, why not become a **contributor** by fixing the issue and open a pull request? :wink:
|
||||
* Harsh words or threats won't help your situation. What's worse, your complain will (very likely) to be **ignored**. :fearful:
|
||||
|
||||
|
||||
# Opening a pull request
|
||||
|
||||
### Must read
|
||||
* Read our [**coding guidelines**](https://github.com/qbittorrent/qBittorrent/blob/master/CODING_GUIDELINES.md). There are some scripts to help you: [uncrustify script](https://gist.github.com/sledgehammer999/1cb1d9224d7fec8fa632), [astyle script](https://gist.github.com/Chocobo1/539cee860d1eef0acfa6), [(related thread)](https://github.com/qbittorrent/qBittorrent/issues/2192).
|
||||
* Keep the title **short** and provide a **clear** description about what your pull request does.
|
||||
* Provide **screenshots** for UI related changes.
|
||||
* Keep your git commit history **clean** and **precise**. Commits like `xxx fixup` should not appear.
|
||||
* If your commit fix a reported issue (for example #4134), add the following message to the commit `Closes #4134.`. Example [here](https://github.com/qbittorrent/qBittorrent/commit/a74bac20c4e8de9776bf9bb77fdc7526135d1988).
|
||||
|
||||
### Good to know
|
||||
* **Search** pull request history! Others might already implemented your idea and is waiting to be merged (or got rejected already). Save your precious time by doing a search first.
|
||||
* When resolving merge conflicts, do `git rebase <target_branch_name>`, don't do `git pull`. Then you can start fixing the conflicts. Here is a good explanation: [link](https://www.atlassian.com/git/tutorials/merging-vs-rebasing).
|
||||
24
Changelog
24
Changelog
@@ -1,3 +1,27 @@
|
||||
* Tue Dec 08 2015 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.3.1
|
||||
- FEATURE: New "Set as default label" option in Add torrent dialog. (takiz)
|
||||
- FEATURE: Support wildcards for filtering torrent list and torrent content (vlakoff)
|
||||
- BUGFIX: Fix -1 is displayed instead of the infinity symbol (Chocobo1)
|
||||
- BUGFIX: Fix scan dirs settings saving. Closes #4254, #4239, #4187. (glassez)
|
||||
- BUGFIX: Exported torrents now use name instead of hash. Closes #4205. (glassez)
|
||||
- BUGFIX: Improve upgrade to v3.3.0. Now undownloaded magnets will be migrated too. Fixes #4195. (glassez)
|
||||
- BUGFIX: Fix wrong encoding for listen failed error message. (glassez)
|
||||
- BUGFIX: Fix RSS not automarking articles as read. (glassez)
|
||||
- BUGFIX: Fix possible deadlock during application exit. (sledgehammer999)
|
||||
- WEBUI: Cookies support on WebUI when downloading torrent from a URL. (Naikel Aparicio)
|
||||
- WEBUI: Modified download and upload windows to allow autocompletion of browsers. (Naikel Aparicio)
|
||||
- WEBUI: Fixed the spinner in the WebUI upload page. (Naikel Aparicio)
|
||||
- WEBUI: Modified height of the WebUI download page. (Naikel Aparicio)
|
||||
- WEBUI: Fixed all the JavaScript functions for download and upload pages. (Naikel Aparicio)
|
||||
- WEBUI: Add seeds tab to WebUI (buinsky)
|
||||
- WEBUI: Bump WebUI API_VERSION.
|
||||
- COSMETIC: Cleanup "Trackers", "Peers", "HTTP Sources", "Speed" and "Content" page layout (Chocobo1)
|
||||
- COSMETIC: Reduce mainwindow border width (Chocobo1)
|
||||
- COSMETIC: Use QLineEdit built-in ClearButton (Qt5 only) (Chocobo1)
|
||||
- COSMETIC: Change text description for half-open connection (Chocobo1)
|
||||
- OTHER: Change update URL to FossHub. Closes #4188. (sledgehammer999)
|
||||
|
||||
|
||||
* Sun Nov 29 2015 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.3.0
|
||||
- FEATURE: Huge core code refactoring. Problems with labels, temp folders etc should be eliminated. Smoother UI should be observed too. (glassez)
|
||||
- FEATURE: Speed graph (Anton Lashkov)
|
||||
|
||||
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.0</string>
|
||||
<string>3.3.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>qBit</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
|
||||
5
dist/windows/README.txt
vendored
5
dist/windows/README.txt
vendored
@@ -41,7 +41,10 @@ installer-translations
|
||||
translations
|
||||
qt_ar.qm
|
||||
...
|
||||
(all the .qm files found in dist/qt-translations in every source release)
|
||||
(all the .qm files found in the 'translations' folder of your Qt install. Those files differ between Qt4 and Qt5.
|
||||
If you want to distribute Qt4 translations it is better to use the ones found in this repo under the path "dist/qt-translations".
|
||||
They contain extra languages not distributed via the official qt4 sources.
|
||||
Don't forget to edit the filelist in installer.nsi + uninstaller.nsi to include all your .qm files.)
|
||||
qt_zh_TW.qm
|
||||
installer.nsi
|
||||
license.txt
|
||||
|
||||
12
dist/windows/installer.nsi
vendored
12
dist/windows/installer.nsi
vendored
@@ -31,13 +31,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"
|
||||
File /oname=translations\qt_gl.qm "translations\qt_gl.qm"
|
||||
@@ -47,17 +47,15 @@ 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_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\qt_zh_TW.qm "translations\qt_zh_TW.qm"
|
||||
|
||||
; Write the installation path into the registry
|
||||
WriteRegStr HKLM "Software\qBittorrent" "InstallLocation" "$INSTDIR"
|
||||
|
||||
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.0"
|
||||
!define PROG_VERSION "3.3.1"
|
||||
!define MUI_FINISHPAGE_RUN
|
||||
!define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
|
||||
!define MUI_FINISHPAGE_RUN_TEXT $(launch_qbt)
|
||||
|
||||
8
dist/windows/uninstaller.nsi
vendored
8
dist/windows/uninstaller.nsi
vendored
@@ -6,13 +6,12 @@
|
||||
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"
|
||||
@@ -23,18 +22,15 @@
|
||||
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.qm"
|
||||
Delete "$INSTDIR\translations\qt_pt_BR.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\qt_zh_TW.qm"
|
||||
Delete "$INSTDIR\uninst.exe"
|
||||
|
||||
; Remove directories used
|
||||
|
||||
@@ -58,17 +58,17 @@
|
||||
#endif
|
||||
|
||||
#include "application.h"
|
||||
#include "core/logger.h"
|
||||
#include "core/preferences.h"
|
||||
#include "core/utils/fs.h"
|
||||
#include "core/utils/misc.h"
|
||||
#include "core/iconprovider.h"
|
||||
#include "core/scanfoldersmodel.h"
|
||||
#include "core/net/smtp.h"
|
||||
#include "core/net/downloadmanager.h"
|
||||
#include "core/net/geoipmanager.h"
|
||||
#include "core/bittorrent/session.h"
|
||||
#include "core/bittorrent/torrenthandle.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/iconprovider.h"
|
||||
#include "base/scanfoldersmodel.h"
|
||||
#include "base/net/smtp.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/net/geoipmanager.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
|
||||
static const char PARAMS_SEPARATOR[] = "|";
|
||||
|
||||
@@ -357,7 +357,7 @@ void Application::initializeTranslation()
|
||||
}
|
||||
|
||||
if (m_qtTranslator.load(
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
QString::fromUtf8("qtbase_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) ||
|
||||
m_qtTranslator.load(
|
||||
#endif
|
||||
|
||||
@@ -50,7 +50,7 @@ QT_END_NAMESPACE
|
||||
typedef QtSingleCoreApplication BaseApplication;
|
||||
#endif
|
||||
|
||||
#include "core/utils/misc.h"
|
||||
#include "base/utils/misc.h"
|
||||
|
||||
#ifndef DISABLE_WEBUI
|
||||
class WebUI;
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#include <QSplashScreen>
|
||||
#ifdef QBT_STATIC_QT
|
||||
#include <QtPlugin>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
Q_IMPORT_PLUGIN(QICOPlugin)
|
||||
#else
|
||||
Q_IMPORT_PLUGIN(qico)
|
||||
@@ -72,8 +72,8 @@ Q_IMPORT_PLUGIN(qico)
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include "application.h"
|
||||
#include "core/utils/misc.h"
|
||||
#include "core/preferences.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/preferences.h"
|
||||
|
||||
#include "upgrade.h"
|
||||
|
||||
|
||||
@@ -40,9 +40,11 @@
|
||||
#include <QMessageBox>
|
||||
#endif
|
||||
|
||||
#include "core/logger.h"
|
||||
#include "core/utils/fs.h"
|
||||
#include "core/utils/misc.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "base/qinisettings.h"
|
||||
|
||||
bool userAcceptsUpgrade()
|
||||
{
|
||||
@@ -73,7 +75,7 @@ bool userAcceptsUpgrade()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool upgradeResumeFile(const QString &filepath)
|
||||
bool upgradeResumeFile(const QString &filepath, const QVariantHash &oldTorrent, int &maxPrio)
|
||||
{
|
||||
QFile file1(filepath);
|
||||
if (!file1.open(QIODevice::ReadOnly))
|
||||
@@ -91,6 +93,12 @@ bool upgradeResumeFile(const QString &filepath)
|
||||
fastNew = fastOld;
|
||||
|
||||
int priority = fastOld.dict_find_int_value("qBt-queuePosition");
|
||||
if (priority > maxPrio)
|
||||
maxPrio = priority;
|
||||
|
||||
fastNew["qBt-name"] = Utils::String::toStdString(oldTorrent.value("name").toString());
|
||||
fastNew["qBt-tempPathDisabled"] = false;
|
||||
|
||||
QFile file2(QString("%1.%2").arg(filepath).arg(priority > 0 ? priority : 0));
|
||||
QVector<char> out;
|
||||
libtorrent::bencode(std::back_inserter(out), fastNew);
|
||||
@@ -106,26 +114,63 @@ bool upgradeResumeFile(const QString &filepath)
|
||||
|
||||
bool upgrade(bool ask = true)
|
||||
{
|
||||
QIniSettings *oldResumeSettings = new QIniSettings("qBittorrent", "qBittorrent-resume");
|
||||
QString oldResumeFilename = oldResumeSettings->fileName();
|
||||
QVariantHash oldResumeData = oldResumeSettings->value("torrents").toHash();
|
||||
delete oldResumeSettings;
|
||||
if (oldResumeData.isEmpty())
|
||||
Utils::Fs::forceRemove(oldResumeFilename);
|
||||
|
||||
|
||||
QString backupFolderPath = Utils::Fs::expandPathAbs(Utils::Fs::QDesktopServicesDataLocation() + "BT_backup");
|
||||
QDir backupFolderDir(backupFolderPath);
|
||||
if (!backupFolderDir.exists()) return true;
|
||||
|
||||
QStringList backupFiles = backupFolderDir.entryList(QStringList() << QLatin1String("*.fastresume"), QDir::Files, QDir::Unsorted);
|
||||
if (!backupFiles.isEmpty()) {
|
||||
if (ask && !userAcceptsUpgrade()) return false;
|
||||
if (backupFiles.isEmpty() && oldResumeData.isEmpty()) return true;
|
||||
if (ask && !userAcceptsUpgrade()) return false;
|
||||
|
||||
QRegExp rx(QLatin1String("^([A-Fa-f0-9]{40})\\.fastresume$"));
|
||||
foreach (QString backupFile, backupFiles) {
|
||||
if (rx.indexIn(backupFile) != -1) {
|
||||
if (!upgradeResumeFile(backupFolderDir.absoluteFilePath(backupFile)))
|
||||
Logger::instance()->addMessage(QObject::tr("Couldn't migrate torrent with hash: %1").arg(rx.cap(1)), Log::WARNING);
|
||||
}
|
||||
else {
|
||||
Logger::instance()->addMessage(QObject::tr("Couldn't migrate torrent. Invalid fastresume file name: %1").arg(backupFile), Log::WARNING);
|
||||
}
|
||||
int maxPrio = 0;
|
||||
QRegExp rx(QLatin1String("^([A-Fa-f0-9]{40})\\.fastresume$"));
|
||||
foreach (QString backupFile, backupFiles) {
|
||||
if (rx.indexIn(backupFile) != -1) {
|
||||
if (upgradeResumeFile(backupFolderDir.absoluteFilePath(backupFile), oldResumeData[rx.cap(1)].toHash(), maxPrio))
|
||||
oldResumeData.remove(rx.cap(1));
|
||||
else
|
||||
Logger::instance()->addMessage(QObject::tr("Couldn't migrate torrent with hash: %1").arg(rx.cap(1)), Log::WARNING);
|
||||
}
|
||||
else {
|
||||
Logger::instance()->addMessage(QObject::tr("Couldn't migrate torrent. Invalid fastresume file name: %1").arg(backupFile), Log::WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (const QString &hash, oldResumeData.keys()) {
|
||||
QVariantHash oldTorrent = oldResumeData[hash].toHash();
|
||||
if (oldTorrent.value("is_magnet", false).toBool()) {
|
||||
libtorrent::entry resumeData;
|
||||
resumeData["qBt-magnetUri"] = Utils::String::toStdString(oldTorrent.value("magnet_uri").toString());
|
||||
resumeData["qBt-paused"] = false;
|
||||
resumeData["qBt-forced"] = false;
|
||||
|
||||
resumeData["qBt-savePath"] = Utils::String::toStdString(oldTorrent.value("save_path").toString());
|
||||
resumeData["qBt-ratioLimit"] = Utils::String::toStdString(QString::number(oldTorrent.value("max_ratio", -2).toReal()));
|
||||
resumeData["qBt-label"] = Utils::String::toStdString(oldTorrent.value("label").toString());
|
||||
resumeData["qBt-name"] = Utils::String::toStdString(oldTorrent.value("name").toString());
|
||||
resumeData["qBt-seedStatus"] = oldTorrent.value("seed").toBool();
|
||||
resumeData["qBt-tempPathDisabled"] = false;
|
||||
|
||||
QString filename = QString("%1.fastresume.%2").arg(hash).arg(++maxPrio);
|
||||
QString filepath = backupFolderDir.absoluteFilePath(filename);
|
||||
|
||||
QFile resumeFile(filepath);
|
||||
QVector<char> out;
|
||||
libtorrent::bencode(std::back_inserter(out), resumeData);
|
||||
if (resumeFile.open(QIODevice::WriteOnly))
|
||||
resumeFile.write(&out[0], out.size());
|
||||
}
|
||||
}
|
||||
|
||||
if (!oldResumeData.isEmpty())
|
||||
QFile(oldResumeFilename).rename(oldResumeFilename + ".bak");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <libtorrent/error_code.hpp>
|
||||
#include <libtorrent/magnet_uri.hpp>
|
||||
|
||||
#include "core/utils/string.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "magneturi.h"
|
||||
|
||||
namespace libt = libtorrent;
|
||||
@@ -26,9 +26,10 @@
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#include "core/net/geoipmanager.h"
|
||||
#include "core/utils/string.h"
|
||||
#include "core/unicodestrings.h"
|
||||
#include "base/net/geoipmanager.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "peerinfo.h"
|
||||
|
||||
namespace libt = libtorrent;
|
||||
@@ -49,9 +50,11 @@ PeerAddress::PeerAddress(QHostAddress ip, ushort port)
|
||||
|
||||
// PeerInfo
|
||||
|
||||
PeerInfo::PeerInfo(const libt::peer_info &nativeInfo)
|
||||
PeerInfo::PeerInfo(const TorrentHandle *torrent, const libt::peer_info &nativeInfo)
|
||||
: m_nativeInfo(nativeInfo)
|
||||
{
|
||||
calcRelevance(torrent);
|
||||
determineFlags();
|
||||
}
|
||||
|
||||
bool PeerInfo::fromDHT() const
|
||||
@@ -253,3 +256,155 @@ QString PeerInfo::connectionType() const
|
||||
|
||||
return connection;
|
||||
}
|
||||
|
||||
void PeerInfo::calcRelevance(const TorrentHandle *torrent)
|
||||
{
|
||||
const QBitArray &allPieces = torrent->pieces();
|
||||
const QBitArray &peerPieces = pieces();
|
||||
|
||||
int localMissing = 0;
|
||||
int remoteHaves = 0;
|
||||
|
||||
for (int i = 0; i < allPieces.size(); ++i) {
|
||||
if (!allPieces[i]) {
|
||||
++localMissing;
|
||||
if (peerPieces[i])
|
||||
++remoteHaves;
|
||||
}
|
||||
}
|
||||
|
||||
if (localMissing == 0)
|
||||
m_relevance = 0.0;
|
||||
else
|
||||
m_relevance = static_cast<qreal>(remoteHaves) / localMissing;
|
||||
}
|
||||
|
||||
qreal PeerInfo::relevance() const
|
||||
{
|
||||
return m_relevance;
|
||||
}
|
||||
|
||||
void PeerInfo::determineFlags()
|
||||
{
|
||||
if (isInteresting()) {
|
||||
//d = Your client wants to download, but peer doesn't want to send (interested and choked)
|
||||
if (isRemoteChocked()) {
|
||||
m_flags += "d ";
|
||||
m_flagsDescription += tr("interested(local) and choked(peer)");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
else {
|
||||
//D = Currently downloading (interested and not choked)
|
||||
m_flags += "D ";
|
||||
m_flagsDescription += tr("interested(local) and unchoked(peer)");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
if (isRemoteInterested()) {
|
||||
//u = Peer wants your client to upload, but your client doesn't want to (interested and choked)
|
||||
if (isChocked()) {
|
||||
m_flags += "u ";
|
||||
m_flagsDescription += tr("interested(peer) and choked(local)");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
else {
|
||||
//U = Currently uploading (interested and not choked)
|
||||
m_flags += "U ";
|
||||
m_flagsDescription += tr("interested(peer) and unchoked(local)");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
//O = Optimistic unchoke
|
||||
if (optimisticUnchoke()) {
|
||||
m_flags += "O ";
|
||||
m_flagsDescription += tr("optimistic unchoke");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
|
||||
//S = Peer is snubbed
|
||||
if (isSnubbed()) {
|
||||
m_flags += "S ";
|
||||
m_flagsDescription += tr("peer snubbed");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
|
||||
//I = Peer is an incoming connection
|
||||
if (!isLocalConnection()) {
|
||||
m_flags += "I ";
|
||||
m_flagsDescription += tr("incoming connection");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
|
||||
//K = Peer is unchoking your client, but your client is not interested
|
||||
if (!isRemoteChocked() && !isInteresting()) {
|
||||
m_flags += "K ";
|
||||
m_flagsDescription += tr("not interested(local) and unchoked(peer)");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
|
||||
//? = Your client unchoked the peer but the peer is not interested
|
||||
if (!isChocked() && !isRemoteInterested()) {
|
||||
m_flags += "? ";
|
||||
m_flagsDescription += tr("not interested(peer) and unchoked(local)");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
|
||||
//X = Peer was included in peerlists obtained through Peer Exchange (PEX)
|
||||
if (fromPeX()) {
|
||||
m_flags += "X ";
|
||||
m_flagsDescription += tr("peer from PEX");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
|
||||
//H = Peer was obtained through DHT
|
||||
if (fromDHT()) {
|
||||
m_flags += "H ";
|
||||
m_flagsDescription += tr("peer from DHT");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
|
||||
//E = Peer is using Protocol Encryption (all traffic)
|
||||
if (isRC4Encrypted()) {
|
||||
m_flags += "E ";
|
||||
m_flagsDescription += tr("encrypted traffic");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
|
||||
//e = Peer is using Protocol Encryption (handshake)
|
||||
if (isPlaintextEncrypted()) {
|
||||
m_flags += "e ";
|
||||
m_flagsDescription += tr("encrypted handshake");
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
|
||||
//P = Peer is using uTorrent uTP
|
||||
|
||||
if (useUTPSocket()) {
|
||||
m_flags += "P ";
|
||||
m_flagsDescription += QString::fromUtf8(C_UTP);
|
||||
m_flagsDescription += ", ";
|
||||
}
|
||||
|
||||
//L = Peer is local
|
||||
if (fromLSD()) {
|
||||
m_flags += "L";
|
||||
m_flagsDescription += tr("peer from LSD");
|
||||
}
|
||||
|
||||
m_flags = m_flags.trimmed();
|
||||
m_flagsDescription = m_flagsDescription.trimmed();
|
||||
if (m_flagsDescription.endsWith(',', Qt::CaseInsensitive))
|
||||
m_flagsDescription.chop(1);
|
||||
}
|
||||
|
||||
QString PeerInfo::flags() const
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
QString PeerInfo::flagsDescription() const
|
||||
{
|
||||
return m_flagsDescription;
|
||||
}
|
||||
@@ -33,9 +33,12 @@
|
||||
|
||||
#include <QHostAddress>
|
||||
#include <QBitArray>
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TorrentHandle;
|
||||
|
||||
struct PeerAddress
|
||||
{
|
||||
QHostAddress ip;
|
||||
@@ -47,8 +50,10 @@ namespace BitTorrent
|
||||
|
||||
class PeerInfo
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(PeerInfo)
|
||||
|
||||
public:
|
||||
PeerInfo(const libtorrent::peer_info &nativeInfo);
|
||||
PeerInfo(const TorrentHandle *torrent, const libtorrent::peer_info &nativeInfo);
|
||||
|
||||
bool fromDHT() const;
|
||||
bool fromPeX() const;
|
||||
@@ -89,12 +94,21 @@ namespace BitTorrent
|
||||
qlonglong totalDownload() const;
|
||||
QBitArray pieces() const;
|
||||
QString connectionType() const;
|
||||
qreal relevance() const;
|
||||
QString flags() const;
|
||||
QString flagsDescription() const;
|
||||
#ifndef DISABLE_COUNTRIES_RESOLUTION
|
||||
QString country() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
void calcRelevance(const TorrentHandle *torrent);
|
||||
void determineFlags();
|
||||
|
||||
libtorrent::peer_info m_nativeInfo;
|
||||
qreal m_relevance;
|
||||
QString m_flags;
|
||||
QString m_flagsDescription;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <QTime>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "core/preferences.h"
|
||||
#include "base/preferences.h"
|
||||
#include "bandwidthscheduler.h"
|
||||
|
||||
BandwidthScheduler::BandwidthScheduler(QObject *parent)
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <libtorrent/session.hpp>
|
||||
#include <libtorrent/ip_filter.hpp>
|
||||
|
||||
#include "core/logger.h"
|
||||
#include "base/logger.h"
|
||||
#include "filterparserthread.h"
|
||||
|
||||
namespace libt = libtorrent;
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
#include <libtorrent/session.hpp>
|
||||
|
||||
#include "core/qinisettings.h"
|
||||
#include "core/preferences.h"
|
||||
#include "core/bittorrent/sessionstatus.h"
|
||||
#include "core/bittorrent/session.h"
|
||||
#include "base/qinisettings.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/bittorrent/sessionstatus.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "statistics.h"
|
||||
|
||||
static const qint64 SAVE_INTERVAL = 15 * 60 * 1000;
|
||||
@@ -83,7 +83,7 @@ void Statistics::load()
|
||||
// Don't forget to remove:
|
||||
// 1. Preferences::getStats()
|
||||
// 2. Preferences::removeStats()
|
||||
// 3. #include "core/preferences.h"
|
||||
// 3. #include "base/preferences.h"
|
||||
Preferences* const pref = Preferences::instance();
|
||||
QIniSettings s("qBittorrent", "qBittorrent-data");
|
||||
QVariantHash v = pref->getStats();
|
||||
@@ -63,20 +63,20 @@ using namespace BitTorrent;
|
||||
//#include <libtorrent/extensions/metadata_transfer.hpp>
|
||||
|
||||
#ifndef DISABLE_COUNTRIES_RESOLUTION
|
||||
#include "core/net/geoipmanager.h"
|
||||
#include "base/net/geoipmanager.h"
|
||||
#endif
|
||||
|
||||
#include "core/utils/misc.h"
|
||||
#include "core/utils/fs.h"
|
||||
#include "core/utils/string.h"
|
||||
#include "core/unicodestrings.h"
|
||||
#include "core/logger.h"
|
||||
#include "core/preferences.h"
|
||||
#include "core/torrentfilter.h"
|
||||
#include "core/net/downloadmanager.h"
|
||||
#include "core/net/downloadhandler.h"
|
||||
#include "core/net/portforwarder.h"
|
||||
#include "core/utils/string.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/torrentfilter.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/net/downloadhandler.h"
|
||||
#include "base/net/portforwarder.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "private/filterparserthread.h"
|
||||
#include "private/statistics.h"
|
||||
#include "private/bandwidthscheduler.h"
|
||||
@@ -466,7 +466,8 @@ void Session::configure()
|
||||
m_torrentExportEnabled = torrentExportEnabled;
|
||||
if (m_torrentExportEnabled) {
|
||||
qDebug("Torrent export is enabled, exporting the current torrents");
|
||||
exportTorrentFiles(pref->getTorrentExportDir());
|
||||
for (auto torrent: m_torrents)
|
||||
exportTorrentFile(torrent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1151,57 +1152,22 @@ void Session::exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolde
|
||||
Q_ASSERT(((folder == TorrentExportFolder::Regular) && m_torrentExportEnabled) ||
|
||||
((folder == TorrentExportFolder::Finished) && m_finishedTorrentExportEnabled));
|
||||
|
||||
QString validName = Utils::Fs::toValidFileSystemName(torrent->name());
|
||||
QString torrentFilename = QString("%1.torrent").arg(torrent->hash());
|
||||
QString torrentExportFilename = QString("%1.torrent").arg(validName);
|
||||
QString torrentPath = QDir(m_resumeFolderPath).absoluteFilePath(torrentFilename);
|
||||
QDir exportPath(folder == TorrentExportFolder::Regular ? Preferences::instance()->getTorrentExportDir() : Preferences::instance()->getFinishedTorrentExportDir());
|
||||
if (exportPath.exists() || exportPath.mkpath(exportPath.absolutePath())) {
|
||||
QString newTorrentPath = exportPath.absoluteFilePath(torrentFilename);
|
||||
if (QFile::exists(newTorrentPath) && Utils::Fs::sameFiles(torrentPath, newTorrentPath)) {
|
||||
// Append hash to torrent name to make it unique
|
||||
newTorrentPath = exportPath.absoluteFilePath(torrent->name() + "-" + torrentFilename);
|
||||
}
|
||||
QFile::copy(torrentPath, newTorrentPath);
|
||||
}
|
||||
}
|
||||
|
||||
void Session::exportTorrentFiles(QString path)
|
||||
{
|
||||
// NOTE: Maybe create files from current metadata here?
|
||||
Q_ASSERT(m_torrentExportEnabled);
|
||||
|
||||
QDir exportDir(path);
|
||||
if (!exportDir.exists()) {
|
||||
if (!exportDir.mkpath(exportDir.absolutePath())) {
|
||||
Logger::instance()->addMessage(tr("Error: Could not create torrent export directory: '%1'").arg(exportDir.absolutePath()), Log::CRITICAL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QDir resumeDataDir(m_resumeFolderPath);
|
||||
foreach (TorrentHandle *const torrent, m_torrents) {
|
||||
if (!torrent->isValid()) {
|
||||
Logger::instance()->addMessage(tr("Torrent Export: torrent is invalid, skipping..."), Log::CRITICAL);
|
||||
continue;
|
||||
QString newTorrentPath = exportPath.absoluteFilePath(torrentExportFilename);
|
||||
int counter = 0;
|
||||
while (QFile::exists(newTorrentPath) && !Utils::Fs::sameFiles(torrentPath, newTorrentPath)) {
|
||||
// Append number to torrent name to make it unique
|
||||
torrentExportFilename = QString("%1 %2.torrent").arg(validName).arg(++counter);
|
||||
newTorrentPath = exportPath.absoluteFilePath(torrentExportFilename);
|
||||
}
|
||||
|
||||
const QString srcPath(resumeDataDir.absoluteFilePath(QString("%1.torrent").arg(torrent->hash())));
|
||||
if (QFile::exists(srcPath)) {
|
||||
QString dstPath = exportDir.absoluteFilePath(QString("%1.torrent").arg(torrent->name()));
|
||||
if (QFile::exists(dstPath)) {
|
||||
if (!Utils::Fs::sameFiles(srcPath, dstPath)) {
|
||||
dstPath = exportDir.absoluteFilePath(QString("%1-%2.torrent").arg(torrent->name()).arg(torrent->hash()));
|
||||
}
|
||||
else {
|
||||
qDebug("Torrent Export: Destination file exists, skipping...");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
qDebug("Export Torrent: %s -> %s", qPrintable(srcPath), qPrintable(dstPath));
|
||||
QFile::copy(srcPath, dstPath);
|
||||
}
|
||||
else {
|
||||
Logger::instance()->addMessage(tr("Error: could not export torrent '%1', maybe it has not metadata yet.").arg(torrent->hash()), Log::CRITICAL);
|
||||
}
|
||||
if (!QFile::exists(newTorrentPath))
|
||||
QFile::copy(torrentPath, newTorrentPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1433,6 +1399,8 @@ void Session::networkOnlineStateChanged(const bool online)
|
||||
void Session::networkConfigurationChange(const QNetworkConfiguration& cfg)
|
||||
{
|
||||
const QString configuredInterfaceName = Preferences::instance()->getNetworkInterface();
|
||||
// Empty means "Any Interface". In this case libtorrent has binded to 0.0.0.0 so any change to any interface will
|
||||
// be automatically picked up. Otherwise we would rebinding here to 0.0.0.0 again.
|
||||
if (configuredInterfaceName.isEmpty())
|
||||
return;
|
||||
const QString changedInterface = cfg.name();
|
||||
@@ -1511,7 +1479,7 @@ void Session::setListeningPort()
|
||||
m_nativeSession->listen_on(ports, ec, 0, libt::session::listen_no_system_port);
|
||||
|
||||
if (ec)
|
||||
logger->addMessage(tr("qBittorrent failed to listen on any interface port: %1. Reason: %2", "e.g: qBittorrent failed to listen on any interface port: TCP/6881. Reason: no such interface" ).arg(QString::number(port)).arg(Utils::String::fromStdString(ec.message())), Log::CRITICAL);
|
||||
logger->addMessage(tr("qBittorrent failed to listen on any interface port: %1. Reason: %2.", "e.g: qBittorrent failed to listen on any interface port: TCP/6881. Reason: no such interface" ).arg(QString::number(port)).arg(QString::fromLocal8Bit(ec.message().c_str())), Log::CRITICAL);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1996,7 +1964,7 @@ void Session::getPendingAlerts(QVector<libt::alert *> &out, ulong time)
|
||||
|
||||
QMutexLocker lock(&m_alertsMutex);
|
||||
|
||||
while (m_alerts.empty())
|
||||
if (m_alerts.empty())
|
||||
m_alertsWaitCondition.wait(&m_alertsMutex, time);
|
||||
|
||||
m_alerts.swap(out);
|
||||
@@ -2304,10 +2272,10 @@ void Session::handleListenFailedAlert(libt::listen_failed_alert *p)
|
||||
proto = "SOCKS5";
|
||||
qDebug() << "Failed listening on " << proto << p->endpoint.address().to_string(ec).c_str() << "/" << p->endpoint.port();
|
||||
Logger::instance()->addMessage(
|
||||
tr("qBittorrent failed listening on interface %1 port: %2/%3. Reason: %4",
|
||||
tr("qBittorrent failed listening on interface %1 port: %2/%3. Reason: %4.",
|
||||
"e.g: qBittorrent failed listening on interface 192.168.0.1 port: TCP/6881. Reason: already in use")
|
||||
.arg(p->endpoint.address().to_string(ec).c_str()).arg(proto).arg(QString::number(p->endpoint.port()))
|
||||
.arg(Utils::String::fromStdString(p->error.message())), Log::CRITICAL);
|
||||
.arg(QString::fromLocal8Bit(p->error.message().c_str())), Log::CRITICAL);
|
||||
}
|
||||
|
||||
void Session::handleExternalIPAlert(libt::external_ip_alert *p)
|
||||
@@ -38,8 +38,8 @@
|
||||
#include <QWaitCondition>
|
||||
#include <QNetworkConfigurationManager>
|
||||
|
||||
#include "core/tristatebool.h"
|
||||
#include "core/types.h"
|
||||
#include "base/tristatebool.h"
|
||||
#include "base/types.h"
|
||||
#include "torrentinfo.h"
|
||||
|
||||
namespace libtorrent
|
||||
@@ -293,7 +293,6 @@ namespace BitTorrent
|
||||
|
||||
void updateRatioTimer();
|
||||
void exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolder folder = TorrentExportFolder::Regular);
|
||||
void exportTorrentFiles(QString path);
|
||||
void saveTorrentResumeData(TorrentHandle *const torrent);
|
||||
|
||||
void handleAlert(libtorrent::alert *a);
|
||||
@@ -43,9 +43,9 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "core/utils/fs.h"
|
||||
#include "core/utils/misc.h"
|
||||
#include "core/utils/string.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "torrentcreatorthread.h"
|
||||
|
||||
namespace libt = libtorrent;
|
||||
@@ -46,11 +46,11 @@
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#include "core/logger.h"
|
||||
#include "core/preferences.h"
|
||||
#include "core/utils/string.h"
|
||||
#include "core/utils/fs.h"
|
||||
#include "core/utils/misc.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "session.h"
|
||||
#include "peerinfo.h"
|
||||
#include "trackerentry.h"
|
||||
@@ -960,7 +960,7 @@ QList<PeerInfo> TorrentHandle::peers() const
|
||||
SAFE_CALL(get_peer_info, nativePeers);
|
||||
|
||||
foreach (const libt::peer_info &peer, nativePeers)
|
||||
peers << peer;
|
||||
peers << PeerInfo(this, peer);
|
||||
|
||||
return peers;
|
||||
}
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <libtorrent/torrent_handle.hpp>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#include "core/tristatebool.h"
|
||||
#include "base/tristatebool.h"
|
||||
#include "private/speedmonitor.h"
|
||||
#include "infohash.h"
|
||||
#include "torrentinfo.h"
|
||||
@@ -33,9 +33,9 @@
|
||||
|
||||
#include <libtorrent/error_code.hpp>
|
||||
|
||||
#include "core/utils/misc.h"
|
||||
#include "core/utils/fs.h"
|
||||
#include "core/utils/string.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "infohash.h"
|
||||
#include "trackerentry.h"
|
||||
#include "torrentinfo.h"
|
||||
@@ -33,9 +33,9 @@
|
||||
#include <libtorrent/bencode.hpp>
|
||||
#include <libtorrent/entry.hpp>
|
||||
|
||||
#include "core/preferences.h"
|
||||
#include "core/http/server.h"
|
||||
#include "core/utils/string.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/http/server.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "tracker.h"
|
||||
|
||||
// static limits
|
||||
@@ -33,9 +33,9 @@
|
||||
#define BITTORRENT_TRACKER_H
|
||||
|
||||
#include <QHash>
|
||||
#include "core/http/types.h"
|
||||
#include "core/http/responsebuilder.h"
|
||||
#include "core/http/irequesthandler.h"
|
||||
#include "base/http/types.h"
|
||||
#include "base/http/responsebuilder.h"
|
||||
#include "base/http/irequesthandler.h"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "core/utils/misc.h"
|
||||
#include "core/utils/string.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "trackerentry.h"
|
||||
|
||||
using namespace BitTorrent;
|
||||
@@ -12,9 +12,9 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "core/preferences.h"
|
||||
#include "core/bittorrent/torrentinfo.h"
|
||||
#include "core/bittorrent/magneturi.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/bittorrent/torrentinfo.h"
|
||||
#include "base/bittorrent/magneturi.h"
|
||||
#include "filesystemwatcher.h"
|
||||
|
||||
#ifndef CIFS_MAGIC_NUMBER
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
#include <QDir>
|
||||
@@ -117,7 +117,7 @@ bool RequestParser::parseStartingLine(const QString &line)
|
||||
m_request.path = url.path(); // Path
|
||||
|
||||
// Parse GET parameters
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
QListIterator<QPair<QString, QString> > i(url.queryItems());
|
||||
#else
|
||||
QListIterator<QPair<QString, QString> > i(QUrlQuery(url).queryItems());
|
||||
@@ -216,7 +216,7 @@ bool RequestParser::parseContent(const QByteArray& data)
|
||||
// Parse url-encoded POST data
|
||||
if (m_request.headers["content-type"].startsWith("application/x-www-form-urlencoded")) {
|
||||
QUrl url;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
url.setEncodedQuery(data);
|
||||
QListIterator<QPair<QString, QString> > i(url.queryItems());
|
||||
#else
|
||||
@@ -29,7 +29,7 @@
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include "core/utils/gzip.h"
|
||||
#include "base/utils/gzip.h"
|
||||
#include "responsegenerator.h"
|
||||
|
||||
using namespace Http;
|
||||
@@ -67,7 +67,7 @@ void Server::disableHttps()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
void Server::incomingConnection(qintptr socketDescriptor)
|
||||
#else
|
||||
void Server::incomingConnection(int socketDescriptor)
|
||||
@@ -59,7 +59,7 @@ namespace Http
|
||||
#endif
|
||||
|
||||
private:
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
void incomingConnection(qintptr socketDescriptor);
|
||||
#else
|
||||
void incomingConnection(int socketDescriptor);
|
||||
@@ -32,11 +32,11 @@
|
||||
#include <QDebug>
|
||||
#include <QRegExp>
|
||||
#include <QStringList>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
|
||||
#include "core/logger.h"
|
||||
#include "base/logger.h"
|
||||
#include "dnsupdater.h"
|
||||
|
||||
using namespace Net;
|
||||
@@ -160,7 +160,7 @@ QUrl DNSUpdater::getUpdateUrl() const
|
||||
}
|
||||
url.setPath("/nic/update");
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
url.addQueryItem("hostname", m_domain);
|
||||
url.addQueryItem("myip", m_lastIP.toString());
|
||||
#else
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QDateTime>
|
||||
#include <QTimer>
|
||||
#include "core/preferences.h"
|
||||
#include "base/preferences.h"
|
||||
|
||||
namespace Net
|
||||
{
|
||||
@@ -36,9 +36,9 @@
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
|
||||
#include "core/utils/fs.h"
|
||||
#include "core/utils/gzip.h"
|
||||
#include "core/utils/misc.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/gzip.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "downloadmanager.h"
|
||||
#include "downloadhandler.h"
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
|
||||
#include "core/preferences.h"
|
||||
#include "base/preferences.h"
|
||||
#include "downloadhandler.h"
|
||||
#include "downloadmanager.h"
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
#include <QHostAddress>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "core/logger.h"
|
||||
#include "core/preferences.h"
|
||||
#include "core/utils/fs.h"
|
||||
#include "core/utils/gzip.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/gzip.h"
|
||||
#include "downloadmanager.h"
|
||||
#include "downloadhandler.h"
|
||||
#include "private/geoipdatabase.h"
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
#include <libtorrent/session.hpp>
|
||||
|
||||
#include "core/logger.h"
|
||||
#include "core/preferences.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "portforwarder.h"
|
||||
|
||||
namespace libt = libtorrent;
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QFile>
|
||||
|
||||
#include "core/types.h"
|
||||
#include "base/types.h"
|
||||
#include "geoipdatabase.h"
|
||||
|
||||
namespace
|
||||
@@ -66,7 +66,7 @@ namespace
|
||||
Float = 15
|
||||
};
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
Q_IPV6ADDR createMappedAddress(quint32 ip4);
|
||||
#endif
|
||||
}
|
||||
@@ -166,7 +166,7 @@ QDateTime GeoIPDatabase::buildEpoch() const
|
||||
|
||||
QString GeoIPDatabase::lookup(const QHostAddress &hostAddr) const
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
Q_IPV6ADDR addr = hostAddr.protocol() == QAbstractSocket::IPv4Protocol
|
||||
? createMappedAddress(hostAddr.toIPv4Address())
|
||||
: hostAddr.toIPv6Address();
|
||||
@@ -499,7 +499,7 @@ QVariant GeoIPDatabase::readArrayValue(quint32 &offset, quint32 count) const
|
||||
|
||||
namespace
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
Q_IPV6ADDR createMappedAddress(quint32 ip4)
|
||||
{
|
||||
Q_IPV6ADDR ip6;
|
||||
@@ -33,8 +33,8 @@
|
||||
*/
|
||||
|
||||
#include "smtp.h"
|
||||
#include "core/preferences.h"
|
||||
#include "core/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/logger.h"
|
||||
|
||||
#include <QTextStream>
|
||||
#ifndef QT_NO_OPENSSL
|
||||
@@ -52,8 +52,8 @@
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include "core/utils/fs.h"
|
||||
#include "core/utils/misc.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
|
||||
|
||||
Preferences* Preferences::m_instance = 0;
|
||||
@@ -504,7 +504,7 @@ QList<bool> Preferences::getDownloadInScanDirs() const
|
||||
|
||||
void Preferences::setDownloadInScanDirs(const QList<bool> &list)
|
||||
{
|
||||
setValue("Preferences/Downloads/ScanDirsDownloadPaths", Utils::Misc::toStringList(list));
|
||||
setValue("Preferences/Downloads/DownloadInScanDirs", Utils::Misc::toStringList(list));
|
||||
}
|
||||
|
||||
void Preferences::setScanDirsDownloadPaths(const QStringList &downloadpaths)
|
||||
@@ -514,7 +514,7 @@ void Preferences::setScanDirsDownloadPaths(const QStringList &downloadpaths)
|
||||
|
||||
QStringList Preferences::getScanDirsDownloadPaths() const
|
||||
{
|
||||
return value("Preferences/Downloads/DownloadPaths").toStringList();
|
||||
return value("Preferences/Downloads/ScanDirsDownloadPaths").toStringList();
|
||||
}
|
||||
|
||||
QString Preferences::getScanDirsLastPath() const
|
||||
@@ -1662,6 +1662,16 @@ void Preferences::removeTorrentLabel(const QString& label)
|
||||
setValue("TransferListFilters/customLabels", labels);
|
||||
}
|
||||
|
||||
QString Preferences::getDefaultLabel() const
|
||||
{
|
||||
return value("Preferences/Downloads/DefaultLabel").toString();
|
||||
}
|
||||
|
||||
void Preferences::setDefaultLabel(const QString &defaultLabel)
|
||||
{
|
||||
setValue("Preferences/Downloads/DefaultLabel", defaultLabel);
|
||||
}
|
||||
|
||||
bool Preferences::recursiveDownloadDisabled() const
|
||||
{
|
||||
return value("Preferences/Advanced/DisableRecursiveDownload", false).toBool();
|
||||
@@ -1966,7 +1976,7 @@ void Preferences::setTrayIconStyle(TrayIcon::Style style)
|
||||
// in the same file.
|
||||
QByteArray Preferences::getAddNewTorrentDialogState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("AddNewTorrentDialog/qt5/treeHeaderState").toByteArray();
|
||||
#else
|
||||
return value("AddNewTorrentDialog/treeHeaderState").toByteArray();
|
||||
@@ -1975,7 +1985,7 @@ QByteArray Preferences::getAddNewTorrentDialogState() const
|
||||
|
||||
void Preferences::setAddNewTorrentDialogState(const QByteArray &state)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("AddNewTorrentDialog/qt5/treeHeaderState", state);
|
||||
#else
|
||||
setValue("AddNewTorrentDialog/treeHeaderState", state);
|
||||
@@ -2064,7 +2074,7 @@ void Preferences::setMainGeometry(const QByteArray &geometry)
|
||||
|
||||
QByteArray Preferences::getMainVSplitterState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("MainWindow/qt5/vsplitterState").toByteArray();
|
||||
#else
|
||||
return value("MainWindow/vsplitterState").toByteArray();
|
||||
@@ -2073,7 +2083,7 @@ QByteArray Preferences::getMainVSplitterState() const
|
||||
|
||||
void Preferences::setMainVSplitterState(const QByteArray &state)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("MainWindow/qt5/vsplitterState", state);
|
||||
#else
|
||||
setValue("MainWindow/vsplitterState", state);
|
||||
@@ -2124,7 +2134,7 @@ void Preferences::setPrefHSplitterSizes(const QStringList &sizes)
|
||||
|
||||
QByteArray Preferences::getPeerListState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("TorrentProperties/Peers/qt5/PeerListState").toByteArray();
|
||||
#else
|
||||
return value("TorrentProperties/Peers/PeerListState").toByteArray();
|
||||
@@ -2133,7 +2143,7 @@ QByteArray Preferences::getPeerListState() const
|
||||
|
||||
void Preferences::setPeerListState(const QByteArray &state)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("TorrentProperties/Peers/qt5/PeerListState", state);
|
||||
#else
|
||||
setValue("TorrentProperties/Peers/PeerListState", state);
|
||||
@@ -2152,7 +2162,7 @@ void Preferences::setPropSplitterSizes(const QString &sizes)
|
||||
|
||||
QByteArray Preferences::getPropFileListState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("TorrentProperties/qt5/FilesListState").toByteArray();
|
||||
#else
|
||||
return value("TorrentProperties/FilesListState").toByteArray();
|
||||
@@ -2161,7 +2171,7 @@ QByteArray Preferences::getPropFileListState() const
|
||||
|
||||
void Preferences::setPropFileListState(const QByteArray &state)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("TorrentProperties/qt5/FilesListState", state);
|
||||
#else
|
||||
setValue("TorrentProperties/FilesListState", state);
|
||||
@@ -2190,7 +2200,7 @@ void Preferences::setPropVisible(const bool visible)
|
||||
|
||||
QByteArray Preferences::getPropTrackerListState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("TorrentProperties/Trackers/qt5/TrackerListState").toByteArray();
|
||||
#else
|
||||
return value("TorrentProperties/Trackers/TrackerListState").toByteArray();
|
||||
@@ -2199,7 +2209,7 @@ QByteArray Preferences::getPropTrackerListState() const
|
||||
|
||||
void Preferences::setPropTrackerListState(const QByteArray &state)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("TorrentProperties/Trackers/qt5/TrackerListState", state);
|
||||
#else
|
||||
setValue("TorrentProperties/Trackers/TrackerListState", state);
|
||||
@@ -2218,7 +2228,7 @@ void Preferences::setRssGeometry(const QByteArray &geometry)
|
||||
|
||||
QByteArray Preferences::getRssHSplitterSizes() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("RssFeedDownloader/qt5/hsplitterSizes").toByteArray();
|
||||
#else
|
||||
return value("RssFeedDownloader/hsplitterSizes").toByteArray();
|
||||
@@ -2227,7 +2237,7 @@ QByteArray Preferences::getRssHSplitterSizes() const
|
||||
|
||||
void Preferences::setRssHSplitterSizes(const QByteArray &sizes)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("RssFeedDownloader/qt5/hsplitterSizes", sizes);
|
||||
#else
|
||||
setValue("RssFeedDownloader/hsplitterSizes", sizes);
|
||||
@@ -2246,7 +2256,7 @@ void Preferences::setRssOpenFolders(const QStringList &folders)
|
||||
|
||||
QByteArray Preferences::getRssHSplitterState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("Rss/qt5/splitter_h").toByteArray();
|
||||
#else
|
||||
return value("Rss/splitter_h").toByteArray();
|
||||
@@ -2255,7 +2265,7 @@ QByteArray Preferences::getRssHSplitterState() const
|
||||
|
||||
void Preferences::setRssHSplitterState(const QByteArray &state)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("Rss/qt5/splitter_h", state);
|
||||
#else
|
||||
setValue("Rss/splitter_h", state);
|
||||
@@ -2264,7 +2274,7 @@ void Preferences::setRssHSplitterState(const QByteArray &state)
|
||||
|
||||
QByteArray Preferences::getRssVSplitterState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("Rss/qt5/splitter_v").toByteArray();
|
||||
#else
|
||||
return value("Rss/splitter_v").toByteArray();
|
||||
@@ -2273,7 +2283,7 @@ QByteArray Preferences::getRssVSplitterState() const
|
||||
|
||||
void Preferences::setRssVSplitterState(const QByteArray &state)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("Rss/qt5/splitter_v", state);
|
||||
#else
|
||||
setValue("Rss/splitter_v", state);
|
||||
@@ -2412,7 +2422,7 @@ void Preferences::setTransSelFilter(const int &index)
|
||||
|
||||
QByteArray Preferences::getTransHeaderState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("TransferList/qt5/HeaderState").toByteArray();
|
||||
#else
|
||||
return value("TransferList/HeaderState").toByteArray();
|
||||
@@ -2421,7 +2431,7 @@ QByteArray Preferences::getTransHeaderState() const
|
||||
|
||||
void Preferences::setTransHeaderState(const QByteArray &state)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("TransferList/qt5/HeaderState", state);
|
||||
#else
|
||||
setValue("TransferList/HeaderState", state);
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <QNetworkCookie>
|
||||
#include <QVariant>
|
||||
|
||||
#include "core/types.h"
|
||||
#include "base/types.h"
|
||||
|
||||
enum scheduler_days
|
||||
{
|
||||
@@ -160,6 +160,8 @@ public:
|
||||
void setTempPathEnabled(bool enabled);
|
||||
QString getTempPath() const;
|
||||
void setTempPath(const QString &path);
|
||||
QString getDefaultLabel() const;
|
||||
void setDefaultLabel(const QString &defaultLabel);
|
||||
bool useIncompleteFilesExtension() const;
|
||||
void useIncompleteFilesExtension(bool enabled);
|
||||
bool appendTorrentLabel() const;
|
||||
@@ -55,7 +55,7 @@
|
||||
#include <winbase.h>
|
||||
#endif
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
#include <QDesktopServices>
|
||||
@@ -182,7 +182,7 @@ bool Utils::Fs::forceRemove(const QString& file_path)
|
||||
*/
|
||||
void Utils::Fs::removeDirRecursive(const QString& dirName)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
QDir(dirName).removeRecursively();
|
||||
#else
|
||||
QDir dir(dirName);
|
||||
@@ -250,13 +250,15 @@ bool Utils::Fs::sameFiles(const QString& path1, const QString& path2)
|
||||
return same;
|
||||
}
|
||||
|
||||
QString Utils::Fs::toValidFileSystemName(QString filename)
|
||||
QString Utils::Fs::toValidFileSystemName(const QString &filename)
|
||||
{
|
||||
qDebug("toValidFSName: %s", qPrintable(filename));
|
||||
const QRegExp regex("[\\\\/:?\"*<>|]");
|
||||
filename.replace(regex, " ");
|
||||
qDebug("toValidFSName, result: %s", qPrintable(filename));
|
||||
return filename.trimmed();
|
||||
static const QRegExp regex("[\\\\/:?\"*<>|]");
|
||||
|
||||
QString validName = filename.trimmed();
|
||||
validName.replace(regex, " ");
|
||||
qDebug() << "toValidFileSystemName:" << filename << "=>" << validName;
|
||||
|
||||
return validName;
|
||||
}
|
||||
|
||||
bool Utils::Fs::isValidFileSystemName(const QString& filename)
|
||||
@@ -437,7 +439,7 @@ QString Utils::Fs::QDesktopServicesCacheLocation()
|
||||
|
||||
QString Utils::Fs::QDesktopServicesDownloadLocation()
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
#if defined(Q_OS_WIN)
|
||||
if (QSysInfo::windowsVersion() <= QSysInfo::WV_XP) // Windows XP
|
||||
return QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)).absoluteFilePath(
|
||||
@@ -48,7 +48,7 @@ namespace Utils
|
||||
QString folderName(const QString& file_path);
|
||||
qint64 computePathSize(const QString& path);
|
||||
bool sameFiles(const QString& path1, const QString& path2);
|
||||
QString toValidFileSystemName(QString filename);
|
||||
QString toValidFileSystemName(const QString &filename);
|
||||
bool isValidFileSystemName(const QString& filename);
|
||||
qlonglong freeDiskSpaceOnPath(QString path);
|
||||
QString branchPath(const QString& file_path, QString* removed = 0);
|
||||
@@ -72,9 +72,9 @@ const int UNLEN = 256;
|
||||
#include <QProcess>
|
||||
#endif
|
||||
|
||||
#include "core/utils/string.h"
|
||||
#include "core/unicodestrings.h"
|
||||
#include "core/logger.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "base/logger.h"
|
||||
#include "misc.h"
|
||||
#include "fs.h"
|
||||
|
||||
@@ -465,7 +465,7 @@ QList<bool> Utils::Misc::boolListfromStringList(const QStringList &l)
|
||||
{
|
||||
QList<bool> ret;
|
||||
foreach (const QString &s, l)
|
||||
ret << (s=="1");
|
||||
ret << (s == "1");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QUrl>
|
||||
#include "core/types.h"
|
||||
#include "base/types.h"
|
||||
|
||||
/* Miscellaneous functions that can be useful */
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <QtGlobal>
|
||||
#include <libtorrent/version.hpp>
|
||||
#include <boost/version.hpp>
|
||||
#include "core/unicodestrings.h"
|
||||
#include "base/unicodestrings.h"
|
||||
|
||||
class about : public QDialog, private Ui::AboutDlg{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -35,16 +35,16 @@
|
||||
#include <QMenu>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "core/preferences.h"
|
||||
#include "core/net/downloadmanager.h"
|
||||
#include "core/net/downloadhandler.h"
|
||||
#include "core/bittorrent/session.h"
|
||||
#include "core/bittorrent/magneturi.h"
|
||||
#include "core/bittorrent/torrentinfo.h"
|
||||
#include "core/bittorrent/torrenthandle.h"
|
||||
#include "core/utils/fs.h"
|
||||
#include "core/utils/misc.h"
|
||||
#include "core/unicodestrings.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/net/downloadhandler.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/magneturi.h"
|
||||
#include "base/bittorrent/torrentinfo.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
#include "messageboxraised.h"
|
||||
@@ -77,9 +77,16 @@ AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent)
|
||||
|
||||
// Load labels
|
||||
const QStringList customLabels = pref->getTorrentLabels();
|
||||
const QString defaultLabel = pref->getDefaultLabel();
|
||||
|
||||
if (!defaultLabel.isEmpty())
|
||||
ui->label_combo->addItem(defaultLabel);
|
||||
ui->label_combo->addItem("");
|
||||
|
||||
foreach (const QString& label, customLabels)
|
||||
ui->label_combo->addItem(label);
|
||||
if (label != defaultLabel)
|
||||
ui->label_combo->addItem(label);
|
||||
|
||||
ui->label_combo->model()->sort(0);
|
||||
ui->content_tree->header()->setSortIndicator(0, Qt::AscendingOrder);
|
||||
loadState();
|
||||
@@ -587,6 +594,9 @@ void AddNewTorrentDialog::accept()
|
||||
// Label
|
||||
params.label = ui->label_combo->currentText();
|
||||
|
||||
if (ui->defaultLabel->isChecked())
|
||||
pref->setDefaultLabel(params.label);
|
||||
|
||||
// Save file priorities
|
||||
if (m_contentModel)
|
||||
params.filePriorities = m_contentModel->model()->getFilePriorities();
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
#include <QDialog>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/bittorrent/infohash.h"
|
||||
#include "core/bittorrent/torrentinfo.h"
|
||||
#include "base/bittorrent/infohash.h"
|
||||
#include "base/bittorrent/torrentinfo.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
|
||||
@@ -127,6 +127,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="defaultLabel">
|
||||
<property name="text">
|
||||
<string>Set as default label</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user