mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 01:44:26 +00:00
Drop support for libtorrent v0.14.x
This commit is contained in:
parent
0c9dbc15f9
commit
a53a70742d
4
INSTALL
4
INSTALL
@ -14,7 +14,7 @@ qBittorrent - A BitTorrent client in C++ / Qt4
|
|||||||
|
|
||||||
- pkg-config executable
|
- pkg-config executable
|
||||||
|
|
||||||
- libtorrent-rasterbar by Arvid Norberg (>= 0.14.4 REQUIRED, compatible with v0.15.x/v0.16.x)
|
- libtorrent-rasterbar by Arvid Norberg (>= 0.15.0)
|
||||||
-> http://www.libtorrent.net
|
-> http://www.libtorrent.net
|
||||||
Be careful: another library (the one used by rTorrent) uses a similar name.
|
Be careful: another library (the one used by rTorrent) uses a similar name.
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ qBittorrent - A BitTorrent client in C++ / Qt4
|
|||||||
|
|
||||||
- pkg-config executable
|
- pkg-config executable
|
||||||
|
|
||||||
- libtorrent-rasterbar by Arvid Norberg (>= 0.14.4 REQUIRED, >= v0.15.0 ADVISED)
|
- libtorrent-rasterbar by Arvid Norberg (>= v0.15.0)
|
||||||
-> http://www.libtorrent.net
|
-> http://www.libtorrent.net
|
||||||
Be careful: another library (the one used by rTorrent) uses a similar name.
|
Be careful: another library (the one used by rTorrent) uses a similar name.
|
||||||
|
|
||||||
|
4
configure
vendored
4
configure
vendored
@ -419,11 +419,11 @@ class qc_libtorrent_rasterbar : public ConfObj
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
qc_libtorrent_rasterbar(Conf *c) : ConfObj(c) {}
|
qc_libtorrent_rasterbar(Conf *c) : ConfObj(c) {}
|
||||||
QString name() const { return "libtorrent-rasterbar >= 0.14.4"; }
|
QString name() const { return "libtorrent-rasterbar >= 0.15.0"; }
|
||||||
QString shortname() const { return "libtorrent-rasterbar"; }
|
QString shortname() const { return "libtorrent-rasterbar"; }
|
||||||
bool exec(){
|
bool exec(){
|
||||||
QStringList incs;
|
QStringList incs;
|
||||||
QString req_ver = "0.14.4";
|
QString req_ver = "0.15.0";
|
||||||
QString version, libs, other;
|
QString version, libs, other;
|
||||||
VersionMode mode = VersionMin;
|
VersionMode mode = VersionMin;
|
||||||
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, req_ver, &version, &incs, &libs, &other))
|
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, req_ver, &version, &incs, &libs, &other))
|
||||||
|
@ -8,11 +8,11 @@ class qc_libtorrent_rasterbar : public ConfObj
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
qc_libtorrent_rasterbar(Conf *c) : ConfObj(c) {}
|
qc_libtorrent_rasterbar(Conf *c) : ConfObj(c) {}
|
||||||
QString name() const { return "libtorrent-rasterbar >= 0.14.4"; }
|
QString name() const { return "libtorrent-rasterbar >= 0.15.0"; }
|
||||||
QString shortname() const { return "libtorrent-rasterbar"; }
|
QString shortname() const { return "libtorrent-rasterbar"; }
|
||||||
bool exec(){
|
bool exec(){
|
||||||
QStringList incs;
|
QStringList incs;
|
||||||
QString req_ver = "0.14.4";
|
QString req_ver = "0.15.0";
|
||||||
QString version, libs, other;
|
QString version, libs, other;
|
||||||
VersionMode mode = VersionMin;
|
VersionMode mode = VersionMin;
|
||||||
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, req_ver, &version, &incs, &libs, &other))
|
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, req_ver, &version, &incs, &libs, &other))
|
||||||
|
@ -21,9 +21,7 @@ enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_L
|
|||||||
USE_ICON_THEME,
|
USE_ICON_THEME,
|
||||||
#endif
|
#endif
|
||||||
CONFIRM_DELETE_TORRENT, TRACKER_EXCHANGE,
|
CONFIRM_DELETE_TORRENT, TRACKER_EXCHANGE,
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
ANNOUNCE_ALL_TRACKERS,
|
ANNOUNCE_ALL_TRACKERS,
|
||||||
#endif
|
|
||||||
ROW_COUNT};
|
ROW_COUNT};
|
||||||
|
|
||||||
class AdvancedSettings: public QTableWidget {
|
class AdvancedSettings: public QTableWidget {
|
||||||
@ -41,9 +39,7 @@ private:
|
|||||||
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
||||||
QCheckBox cb_use_icon_theme;
|
QCheckBox cb_use_icon_theme;
|
||||||
#endif
|
#endif
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
QCheckBox cb_announce_all_trackers;
|
||||||
QCheckBox cb_announce_all_trackers;
|
|
||||||
#endif
|
|
||||||
QLineEdit txt_network_address;
|
QLineEdit txt_network_address;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -85,10 +81,8 @@ public slots:
|
|||||||
pref.resolvePeerHostNames(cb_resolve_hosts.isChecked());
|
pref.resolvePeerHostNames(cb_resolve_hosts.isChecked());
|
||||||
// Max Half-Open connections
|
// Max Half-Open connections
|
||||||
pref.setMaxHalfOpenConnections(spin_maxhalfopen.value());
|
pref.setMaxHalfOpenConnections(spin_maxhalfopen.value());
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
// Super seeding
|
// Super seeding
|
||||||
pref.enableSuperSeeding(cb_super_seeding.isChecked());
|
pref.enableSuperSeeding(cb_super_seeding.isChecked());
|
||||||
#endif
|
|
||||||
// Network interface
|
// Network interface
|
||||||
if(combo_iface.currentIndex() == 0) {
|
if(combo_iface.currentIndex() == 0) {
|
||||||
// All interfaces (default)
|
// All interfaces (default)
|
||||||
@ -117,9 +111,7 @@ public slots:
|
|||||||
pref.setConfirmTorrentDeletion(cb_confirm_torrent_deletion.isChecked());
|
pref.setConfirmTorrentDeletion(cb_confirm_torrent_deletion.isChecked());
|
||||||
// Tracker exchange
|
// Tracker exchange
|
||||||
pref.setTrackerExchangeEnabled(cb_enable_tracker_ext.isChecked());
|
pref.setTrackerExchangeEnabled(cb_enable_tracker_ext.isChecked());
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
pref.setAnnounceToAllTrackers(cb_announce_all_trackers.isChecked());
|
pref.setAnnounceToAllTrackers(cb_announce_all_trackers.isChecked());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -201,11 +193,7 @@ private slots:
|
|||||||
spin_maxhalfopen.setValue(pref.getMaxHalfOpenConnections());
|
spin_maxhalfopen.setValue(pref.getMaxHalfOpenConnections());
|
||||||
setRow(MAX_HALF_OPEN, tr("Maximum number of half-open connections [0: Disabled]"), &spin_maxhalfopen);
|
setRow(MAX_HALF_OPEN, tr("Maximum number of half-open connections [0: Disabled]"), &spin_maxhalfopen);
|
||||||
// Super seeding
|
// Super seeding
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
cb_super_seeding.setChecked(pref.isSuperSeedingEnabled());
|
cb_super_seeding.setChecked(pref.isSuperSeedingEnabled());
|
||||||
#else
|
|
||||||
cb_super_seeding.setEnabled(false);
|
|
||||||
#endif
|
|
||||||
setRow(SUPER_SEEDING, tr("Strict super seeding"), &cb_super_seeding);
|
setRow(SUPER_SEEDING, tr("Strict super seeding"), &cb_super_seeding);
|
||||||
// Network interface
|
// Network interface
|
||||||
combo_iface.addItem(tr("Any interface", "i.e. Any network interface"));
|
combo_iface.addItem(tr("Any interface", "i.e. Any network interface"));
|
||||||
@ -247,11 +235,9 @@ private slots:
|
|||||||
// Tracker exchange
|
// Tracker exchange
|
||||||
cb_enable_tracker_ext.setChecked(pref.trackerExchangeEnabled());
|
cb_enable_tracker_ext.setChecked(pref.trackerExchangeEnabled());
|
||||||
setRow(TRACKER_EXCHANGE, tr("Exchange trackers with other peers"), &cb_enable_tracker_ext);
|
setRow(TRACKER_EXCHANGE, tr("Exchange trackers with other peers"), &cb_enable_tracker_ext);
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
// Announce to all trackers
|
// Announce to all trackers
|
||||||
cb_announce_all_trackers.setChecked(pref.announceToAllTrackers());
|
cb_announce_all_trackers.setChecked(pref.announceToAllTrackers());
|
||||||
setRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers"), &cb_announce_all_trackers);
|
setRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers"), &cb_announce_all_trackers);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -246,9 +246,6 @@ options_imp::options_imp(QWidget *parent):
|
|||||||
applyButton->setEnabled(false);
|
applyButton->setEnabled(false);
|
||||||
// Tab selection mecanism
|
// Tab selection mecanism
|
||||||
connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
|
connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
checkAppendqB->setVisible(false);
|
|
||||||
#endif
|
|
||||||
#if LIBTORRENT_VERSION_MINOR < 16
|
#if LIBTORRENT_VERSION_MINOR < 16
|
||||||
checkuTP->setVisible(false);
|
checkuTP->setVisible(false);
|
||||||
checkLimituTPConnections->setVisible(false);
|
checkLimituTPConnections->setVisible(false);
|
||||||
@ -392,9 +389,7 @@ void options_imp::saveOptions(){
|
|||||||
#endif
|
#endif
|
||||||
pref.setTempPath(temp_path);
|
pref.setTempPath(temp_path);
|
||||||
pref.setAppendTorrentLabel(checkAppendLabel->isChecked());
|
pref.setAppendTorrentLabel(checkAppendLabel->isChecked());
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
pref.useIncompleteFilesExtension(checkAppendqB->isChecked());
|
pref.useIncompleteFilesExtension(checkAppendqB->isChecked());
|
||||||
#endif
|
|
||||||
pref.preAllocateAllFiles(preAllocateAllFiles());
|
pref.preAllocateAllFiles(preAllocateAllFiles());
|
||||||
pref.useAdditionDialog(useAdditionDialog());
|
pref.useAdditionDialog(useAdditionDialog());
|
||||||
pref.addTorrentsInPause(addTorrentsInPause());
|
pref.addTorrentsInPause(addTorrentsInPause());
|
||||||
@ -569,9 +564,7 @@ void options_imp::loadOptions(){
|
|||||||
#endif
|
#endif
|
||||||
textTempPath->setText(temp_path);
|
textTempPath->setText(temp_path);
|
||||||
checkAppendLabel->setChecked(pref.appendTorrentLabel());
|
checkAppendLabel->setChecked(pref.appendTorrentLabel());
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
checkAppendqB->setChecked(pref.useIncompleteFilesExtension());
|
checkAppendqB->setChecked(pref.useIncompleteFilesExtension());
|
||||||
#endif
|
|
||||||
checkPreallocateAll->setChecked(pref.preAllocateAllFiles());
|
checkPreallocateAll->setChecked(pref.preAllocateAllFiles());
|
||||||
checkAdditionDialog->setChecked(pref.useAdditionDialog());
|
checkAdditionDialog->setChecked(pref.useAdditionDialog());
|
||||||
checkStartPaused->setChecked(pref.addTorrentsInPause());
|
checkStartPaused->setChecked(pref.addTorrentsInPause());
|
||||||
|
@ -205,7 +205,6 @@ public:
|
|||||||
setValue(QString::fromUtf8("Preferences/Downloads/TempPath"), path);
|
setValue(QString::fromUtf8("Preferences/Downloads/TempPath"), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
bool useIncompleteFilesExtension() const {
|
bool useIncompleteFilesExtension() const {
|
||||||
return value(QString::fromUtf8("Preferences/Downloads/UseIncompleteExtension"), false).toBool();
|
return value(QString::fromUtf8("Preferences/Downloads/UseIncompleteExtension"), false).toBool();
|
||||||
}
|
}
|
||||||
@ -213,7 +212,6 @@ public:
|
|||||||
void useIncompleteFilesExtension(bool enabled) {
|
void useIncompleteFilesExtension(bool enabled) {
|
||||||
setValue(QString::fromUtf8("Preferences/Downloads/UseIncompleteExtension"), enabled);
|
setValue(QString::fromUtf8("Preferences/Downloads/UseIncompleteExtension"), enabled);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool appendTorrentLabel() const {
|
bool appendTorrentLabel() const {
|
||||||
return value(QString::fromUtf8("Preferences/Downloads/AppendLabel"), false).toBool();
|
return value(QString::fromUtf8("Preferences/Downloads/AppendLabel"), false).toBool();
|
||||||
@ -1025,7 +1023,6 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
bool isSuperSeedingEnabled() const {
|
bool isSuperSeedingEnabled() const {
|
||||||
return value(QString::fromUtf8("Preferences/Advanced/SuperSeeding"), false).toBool();
|
return value(QString::fromUtf8("Preferences/Advanced/SuperSeeding"), false).toBool();
|
||||||
}
|
}
|
||||||
@ -1041,7 +1038,6 @@ public:
|
|||||||
void setAnnounceToAllTrackers(bool enabled) {
|
void setAnnounceToAllTrackers(bool enabled) {
|
||||||
setValue(QString::fromUtf8("Preferences/Advanced/AnnounceToAllTrackers"), enabled);
|
setValue(QString::fromUtf8("Preferences/Advanced/AnnounceToAllTrackers"), enabled);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
||||||
bool useSystemIconTheme() const {
|
bool useSystemIconTheme() const {
|
||||||
|
@ -96,10 +96,9 @@ void PreviewSelect::on_previewButton_clicked(){
|
|||||||
QModelIndex index;
|
QModelIndex index;
|
||||||
QModelIndexList selectedIndexes = previewList->selectionModel()->selectedRows(NAME);
|
QModelIndexList selectedIndexes = previewList->selectionModel()->selectedRows(NAME);
|
||||||
if(selectedIndexes.size() == 0) return;
|
if(selectedIndexes.size() == 0) return;
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
// Flush data
|
// Flush data
|
||||||
h.flush_cache();
|
h.flush_cache();
|
||||||
#endif
|
|
||||||
QString path;
|
QString path;
|
||||||
foreach(index, selectedIndexes){
|
foreach(index, selectedIndexes){
|
||||||
path = h.absolute_files_path().at(indexes.at(index.row()));
|
path = h.absolute_files_path().at(indexes.at(index.row()));
|
||||||
|
@ -420,10 +420,8 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
|
|||||||
const QString filename = h.filepath_at(i);
|
const QString filename = h.filepath_at(i);
|
||||||
const QString file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename));
|
const QString file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename));
|
||||||
qDebug("Trying to open file at %s", qPrintable(file_path));
|
qDebug("Trying to open file at %s", qPrintable(file_path));
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
// Flush data
|
// Flush data
|
||||||
h.flush_cache();
|
h.flush_cache();
|
||||||
#endif
|
|
||||||
if(QFile::exists(file_path)) {
|
if(QFile::exists(file_path)) {
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(file_path));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(file_path));
|
||||||
} else {
|
} else {
|
||||||
@ -442,10 +440,8 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
|
|||||||
const QString filename = path_items.join(QDir::separator());
|
const QString filename = path_items.join(QDir::separator());
|
||||||
const QString file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename));
|
const QString file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename));
|
||||||
qDebug("Trying to open folder at %s", qPrintable(file_path));
|
qDebug("Trying to open folder at %s", qPrintable(file_path));
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
// Flush data
|
// Flush data
|
||||||
h.flush_cache();
|
h.flush_cache();
|
||||||
#endif
|
|
||||||
if(QFile::exists(file_path)) {
|
if(QFile::exists(file_path)) {
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(file_path));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(file_path));
|
||||||
} else {
|
} else {
|
||||||
|
@ -247,7 +247,6 @@ void TrackerList::loadTrackers() {
|
|||||||
}
|
}
|
||||||
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
||||||
QString error_message = data.last_message.trimmed();
|
QString error_message = data.last_message.trimmed();
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
if(it->verified) {
|
if(it->verified) {
|
||||||
item->setText(COL_STATUS, tr("Working"));
|
item->setText(COL_STATUS, tr("Working"));
|
||||||
item->setText(COL_MSG, "");
|
item->setText(COL_MSG, "");
|
||||||
@ -265,20 +264,6 @@ void TrackerList::loadTrackers() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if(data.verified) {
|
|
||||||
item->setText(COL_STATUS, tr("Working"));
|
|
||||||
item->setText(COL_MSG, "");
|
|
||||||
} else {
|
|
||||||
if(data.fail_count > 0) {
|
|
||||||
item->setText(COL_STATUS, tr("Not working"));
|
|
||||||
item->setText(COL_MSG, error_message);
|
|
||||||
} else {
|
|
||||||
item->setText(COL_STATUS, tr("Not contacted yet"));
|
|
||||||
item->setText(COL_MSG, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
item->setText(COL_PEERS, QString::number(trackers_data.value(tracker_url, TrackerInfos(tracker_url)).num_peers));
|
item->setText(COL_PEERS, QString::number(trackers_data.value(tracker_url, TrackerInfos(tracker_url)).num_peers));
|
||||||
}
|
}
|
||||||
// Remove old trackers
|
// Remove old trackers
|
||||||
|
@ -57,9 +57,7 @@
|
|||||||
#include <libtorrent/version.hpp>
|
#include <libtorrent/version.hpp>
|
||||||
#include <libtorrent/extensions/ut_metadata.hpp>
|
#include <libtorrent/extensions/ut_metadata.hpp>
|
||||||
#include <libtorrent/version.hpp>
|
#include <libtorrent/version.hpp>
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
#include <libtorrent/extensions/lt_trackers.hpp>
|
#include <libtorrent/extensions/lt_trackers.hpp>
|
||||||
#endif
|
|
||||||
#include <libtorrent/extensions/ut_pex.hpp>
|
#include <libtorrent/extensions/ut_pex.hpp>
|
||||||
#include <libtorrent/extensions/smart_ban.hpp>
|
#include <libtorrent/extensions/smart_ban.hpp>
|
||||||
//#include <libtorrent/extensions/metadata_transfer.hpp>
|
//#include <libtorrent/extensions/metadata_transfer.hpp>
|
||||||
@ -139,10 +137,8 @@ QBtSession::QBtSession()
|
|||||||
// Enabling plugins
|
// Enabling plugins
|
||||||
//s->add_extension(&create_metadata_plugin);
|
//s->add_extension(&create_metadata_plugin);
|
||||||
s->add_extension(&create_ut_metadata_plugin);
|
s->add_extension(&create_ut_metadata_plugin);
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
if(pref.trackerExchangeEnabled())
|
if(pref.trackerExchangeEnabled())
|
||||||
s->add_extension(&create_lt_trackers_plugin);
|
s->add_extension(&create_lt_trackers_plugin);
|
||||||
#endif
|
|
||||||
if(pref.isPeXEnabled()) {
|
if(pref.isPeXEnabled()) {
|
||||||
PeXEnabled = true;
|
PeXEnabled = true;
|
||||||
s->add_extension(&create_ut_pex_plugin);
|
s->add_extension(&create_ut_pex_plugin);
|
||||||
@ -154,9 +150,7 @@ QBtSession::QBtSession()
|
|||||||
connect(timerAlerts, SIGNAL(timeout()), SLOT(readAlerts()));
|
connect(timerAlerts, SIGNAL(timeout()), SLOT(readAlerts()));
|
||||||
timerAlerts->start(1000);
|
timerAlerts->start(1000);
|
||||||
appendLabelToSavePath = pref.appendTorrentLabel();
|
appendLabelToSavePath = pref.appendTorrentLabel();
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
appendqBExtension = pref.useIncompleteFilesExtension();
|
appendqBExtension = pref.useIncompleteFilesExtension();
|
||||||
#endif
|
|
||||||
connect(m_scanFolders, SIGNAL(torrentsAdded(QStringList&)), SLOT(addTorrentsFromScanFolder(QStringList&)));
|
connect(m_scanFolders, SIGNAL(torrentsAdded(QStringList&)), SLOT(addTorrentsFromScanFolder(QStringList&)));
|
||||||
// Apply user settings to Bittorrent session
|
// Apply user settings to Bittorrent session
|
||||||
configureSession();
|
configureSession();
|
||||||
@ -179,9 +173,6 @@ QBtSession::~QBtSession() {
|
|||||||
delete m_speedMonitor;
|
delete m_speedMonitor;
|
||||||
qDebug("Deleted the torrent speed monitor");
|
qDebug("Deleted the torrent speed monitor");
|
||||||
// Do some BT related saving
|
// Do some BT related saving
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
saveDHTEntry();
|
|
||||||
#endif
|
|
||||||
saveSessionState();
|
saveSessionState();
|
||||||
saveFastResumeData();
|
saveFastResumeData();
|
||||||
// Delete our objects
|
// Delete our objects
|
||||||
@ -309,9 +300,7 @@ void QBtSession::configureSession() {
|
|||||||
setDefaultTempPath(QString::null);
|
setDefaultTempPath(QString::null);
|
||||||
}
|
}
|
||||||
setAppendLabelToSavePath(pref.appendTorrentLabel());
|
setAppendLabelToSavePath(pref.appendTorrentLabel());
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
setAppendqBExtension(pref.useIncompleteFilesExtension());
|
setAppendqBExtension(pref.useIncompleteFilesExtension());
|
||||||
#endif
|
|
||||||
preAllocateAllFiles(pref.preAllocateAllFiles());
|
preAllocateAllFiles(pref.preAllocateAllFiles());
|
||||||
startTorrentsInPause(pref.addTorrentsInPause());
|
startTorrentsInPause(pref.addTorrentsInPause());
|
||||||
// * Export Dir
|
// * Export Dir
|
||||||
@ -404,22 +393,18 @@ void QBtSession::configureSession() {
|
|||||||
sessionSettings.stop_tracker_timeout = 1;
|
sessionSettings.stop_tracker_timeout = 1;
|
||||||
//sessionSettings.announce_to_all_trackers = true;
|
//sessionSettings.announce_to_all_trackers = true;
|
||||||
sessionSettings.auto_scrape_interval = 1200; // 20 minutes
|
sessionSettings.auto_scrape_interval = 1200; // 20 minutes
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
bool announce_to_all = pref.announceToAllTrackers();
|
bool announce_to_all = pref.announceToAllTrackers();
|
||||||
sessionSettings.announce_to_all_trackers = announce_to_all;
|
sessionSettings.announce_to_all_trackers = announce_to_all;
|
||||||
sessionSettings.announce_to_all_tiers = announce_to_all;
|
sessionSettings.announce_to_all_tiers = announce_to_all;
|
||||||
sessionSettings.auto_scrape_min_interval = 900; // 15 minutes
|
sessionSettings.auto_scrape_min_interval = 900; // 15 minutes
|
||||||
#endif
|
|
||||||
sessionSettings.cache_size = pref.diskCacheSize()*64;
|
sessionSettings.cache_size = pref.diskCacheSize()*64;
|
||||||
qDebug() << "Using a disk cache size of" << pref.diskCacheSize() << "MiB";
|
qDebug() << "Using a disk cache size of" << pref.diskCacheSize() << "MiB";
|
||||||
// Disable OS cache to avoid memory problems (uTorrent behavior)
|
// Disable OS cache to avoid memory problems (uTorrent behavior)
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
// Fixes huge memory usage on Windows 7 (especially when checking files)
|
// Fixes huge memory usage on Windows 7 (especially when checking files)
|
||||||
sessionSettings.disk_io_write_mode = session_settings::disable_os_cache;
|
sessionSettings.disk_io_write_mode = session_settings::disable_os_cache;
|
||||||
sessionSettings.disk_io_read_mode = session_settings::disable_os_cache;
|
sessionSettings.disk_io_read_mode = session_settings::disable_os_cache;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#if LIBTORRENT_VERSION_MINOR > 15
|
#if LIBTORRENT_VERSION_MINOR > 15
|
||||||
sessionSettings.anonymous_mode = pref.isAnonymousModeEnabled();
|
sessionSettings.anonymous_mode = pref.isAnonymousModeEnabled();
|
||||||
if (sessionSettings.anonymous_mode) {
|
if (sessionSettings.anonymous_mode) {
|
||||||
@ -461,9 +446,7 @@ void QBtSession::configureSession() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// Super seeding
|
// Super seeding
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
sessionSettings.strict_super_seeding = pref.isSuperSeedingEnabled();
|
sessionSettings.strict_super_seeding = pref.isSuperSeedingEnabled();
|
||||||
#endif
|
|
||||||
#if LIBTORRENT_VERSION_MINOR > 15
|
#if LIBTORRENT_VERSION_MINOR > 15
|
||||||
// * Max Half-open connections
|
// * Max Half-open connections
|
||||||
sessionSettings.half_open_limit = pref.getMaxHalfOpenConnections();
|
sessionSettings.half_open_limit = pref.getMaxHalfOpenConnections();
|
||||||
@ -1163,11 +1146,10 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
|
|||||||
qDebug("This is a NEW torrent (first time)...");
|
qDebug("This is a NEW torrent (first time)...");
|
||||||
loadTorrentTempData(h, savePath, false);
|
loadTorrentTempData(h, savePath, false);
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
// Append .!qB to incomplete files
|
// Append .!qB to incomplete files
|
||||||
if(appendqBExtension)
|
if(appendqBExtension)
|
||||||
appendqBextensionToTorrent(h, true);
|
appendqBextensionToTorrent(h, true);
|
||||||
#endif
|
|
||||||
// Backup torrent file
|
// Backup torrent file
|
||||||
const QString newFile = torrentBackup.absoluteFilePath(hash + ".torrent");
|
const QString newFile = torrentBackup.absoluteFilePath(hash + ".torrent");
|
||||||
if(path != newFile)
|
if(path != newFile)
|
||||||
@ -1232,15 +1214,11 @@ add_torrent_params QBtSession::initializeAddTorrentParams(const QString &hash) {
|
|||||||
add_torrent_params p;
|
add_torrent_params p;
|
||||||
|
|
||||||
// Seeding mode
|
// Seeding mode
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
// Skip checking and directly start seeding (new in libtorrent v0.15)
|
// Skip checking and directly start seeding (new in libtorrent v0.15)
|
||||||
if(TorrentTempData::isSeedingMode(hash))
|
if(TorrentTempData::isSeedingMode(hash))
|
||||||
p.seed_mode=true;
|
p.seed_mode=true;
|
||||||
else
|
else
|
||||||
p.seed_mode=false;
|
p.seed_mode=false;
|
||||||
#else
|
|
||||||
Q_UNUSED(hash);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Preallocation mode
|
// Preallocation mode
|
||||||
if(preAllocateAll)
|
if(preAllocateAll)
|
||||||
@ -1503,7 +1481,6 @@ void QBtSession::loadSessionState() {
|
|||||||
QFile::remove(state_path);
|
QFile::remove(state_path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
QFile state_file(state_path);
|
QFile state_file(state_path);
|
||||||
if(!state_file.open(QIODevice::ReadOnly)) return;
|
if(!state_file.open(QIODevice::ReadOnly)) return;
|
||||||
std::vector<char> in;
|
std::vector<char> in;
|
||||||
@ -1522,20 +1499,11 @@ void QBtSession::loadSessionState() {
|
|||||||
#endif
|
#endif
|
||||||
s->load_state(e);
|
s->load_state(e);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
boost::filesystem::ifstream ses_state_file(state_path.toLocal8Bit().constData()
|
|
||||||
, std::ios_base::binary);
|
|
||||||
ses_state_file.unsetf(std::ios_base::skipws);
|
|
||||||
s->load_state(bdecode(
|
|
||||||
std::istream_iterator<char>(ses_state_file)
|
|
||||||
, std::istream_iterator<char>()));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QBtSession::saveSessionState() {
|
void QBtSession::saveSessionState() {
|
||||||
qDebug("Saving session state to disk...");
|
qDebug("Saving session state to disk...");
|
||||||
const QString state_path = misc::cacheLocation()+QDir::separator()+QString::fromUtf8("ses_state");
|
const QString state_path = misc::cacheLocation()+QDir::separator()+QString::fromUtf8("ses_state");
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
entry session_state;
|
entry session_state;
|
||||||
s->save_state(session_state);
|
s->save_state(session_state);
|
||||||
vector<char> out;
|
vector<char> out;
|
||||||
@ -1545,38 +1513,16 @@ void QBtSession::saveSessionState() {
|
|||||||
session_file.write(&out[0], out.size());
|
session_file.write(&out[0], out.size());
|
||||||
session_file.close();
|
session_file.close();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
entry session_state = s->state();
|
|
||||||
boost::filesystem::ofstream out(state_path.toLocal8Bit().constData()
|
|
||||||
, std::ios_base::binary);
|
|
||||||
out.unsetf(std::ios_base::skipws);
|
|
||||||
bencode(std::ostream_iterator<char>(out), session_state);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable DHT
|
// Enable DHT
|
||||||
bool QBtSession::enableDHT(bool b) {
|
bool QBtSession::enableDHT(bool b) {
|
||||||
if(b) {
|
if(b) {
|
||||||
if(!DHTEnabled) {
|
if(!DHTEnabled) {
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
entry dht_state;
|
|
||||||
const QString dht_state_path = misc::cacheLocation()+QDir::separator()+QString::fromUtf8("dht_state");
|
|
||||||
if(QFile::exists(dht_state_path)) {
|
|
||||||
boost::filesystem::ifstream dht_state_file(dht_state_path.toLocal8Bit().constData(), std::ios_base::binary);
|
|
||||||
dht_state_file.unsetf(std::ios_base::skipws);
|
|
||||||
try{
|
|
||||||
dht_state = bdecode(std::istream_iterator<char>(dht_state_file), std::istream_iterator<char>());
|
|
||||||
}catch (std::exception&) {}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
try {
|
try {
|
||||||
qDebug() << "Starting DHT...";
|
qDebug() << "Starting DHT...";
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
Q_ASSERT(!s->is_dht_running());
|
Q_ASSERT(!s->is_dht_running());
|
||||||
s->start_dht();
|
s->start_dht();
|
||||||
#else
|
|
||||||
s->start_dht(dht_state);
|
|
||||||
#endif
|
|
||||||
s->add_dht_router(std::make_pair(std::string("router.bittorrent.com"), 6881));
|
s->add_dht_router(std::make_pair(std::string("router.bittorrent.com"), 6881));
|
||||||
s->add_dht_router(std::make_pair(std::string("router.utorrent.com"), 6881));
|
s->add_dht_router(std::make_pair(std::string("router.utorrent.com"), 6881));
|
||||||
s->add_dht_router(std::make_pair(std::string("dht.transmissionbt.com"), 6881));
|
s->add_dht_router(std::make_pair(std::string("dht.transmissionbt.com"), 6881));
|
||||||
@ -1807,7 +1753,6 @@ void QBtSession::setDefaultTempPath(QString temppath) {
|
|||||||
defaultTempPath = temppath;
|
defaultTempPath = temppath;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
void QBtSession::appendqBextensionToTorrent(const QTorrentHandle &h, bool append) {
|
void QBtSession::appendqBextensionToTorrent(const QTorrentHandle &h, bool append) {
|
||||||
if(!h.is_valid() || !h.has_metadata()) return;
|
if(!h.is_valid() || !h.has_metadata()) return;
|
||||||
std::vector<size_type> fp;
|
std::vector<size_type> fp;
|
||||||
@ -1834,7 +1779,6 @@ void QBtSession::appendqBextensionToTorrent(const QTorrentHandle &h, bool append
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void QBtSession::changeLabelInTorrentSavePath(const QTorrentHandle &h, QString old_label, QString new_label) {
|
void QBtSession::changeLabelInTorrentSavePath(const QTorrentHandle &h, QString old_label, QString new_label) {
|
||||||
if(!h.is_valid()) return;
|
if(!h.is_valid()) return;
|
||||||
@ -1879,7 +1823,6 @@ void QBtSession::setAppendLabelToSavePath(bool append) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
void QBtSession::setAppendqBExtension(bool append) {
|
void QBtSession::setAppendqBExtension(bool append) {
|
||||||
if(appendqBExtension != append) {
|
if(appendqBExtension != append) {
|
||||||
appendqBExtension = !appendqBExtension;
|
appendqBExtension = !appendqBExtension;
|
||||||
@ -1892,7 +1835,6 @@ void QBtSession::setAppendqBExtension(bool append) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Set the ports range in which is chosen the port the Bittorrent
|
// Set the ports range in which is chosen the port the Bittorrent
|
||||||
// session will listen to
|
// session will listen to
|
||||||
@ -2191,11 +2133,10 @@ void QBtSession::readAlerts() {
|
|||||||
if(h.is_valid()) {
|
if(h.is_valid()) {
|
||||||
const QString hash = h.hash();
|
const QString hash = h.hash();
|
||||||
qDebug("Got a torrent finished alert for %s", qPrintable(h.name()));
|
qDebug("Got a torrent finished alert for %s", qPrintable(h.name()));
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
// Remove .!qB extension if necessary
|
// Remove .!qB extension if necessary
|
||||||
if(appendqBExtension)
|
if(appendqBExtension)
|
||||||
appendqBextensionToTorrent(h, false);
|
appendqBextensionToTorrent(h, false);
|
||||||
#endif
|
|
||||||
const bool was_already_seeded = TorrentPersistentData::isSeed(hash);
|
const bool was_already_seeded = TorrentPersistentData::isSeed(hash);
|
||||||
qDebug("Was already seeded: %d", was_already_seeded);
|
qDebug("Was already seeded: %d", was_already_seeded);
|
||||||
if(!was_already_seeded) {
|
if(!was_already_seeded) {
|
||||||
@ -2341,18 +2282,7 @@ void QBtSession::readAlerts() {
|
|||||||
}
|
}
|
||||||
else if (torrent_deleted_alert* p = dynamic_cast<torrent_deleted_alert*>(a.get())) {
|
else if (torrent_deleted_alert* p = dynamic_cast<torrent_deleted_alert*>(a.get())) {
|
||||||
qDebug("A torrent was deleted from the hard disk, attempting to remove the root folder too...");
|
qDebug("A torrent was deleted from the hard disk, attempting to remove the root folder too...");
|
||||||
QString hash;
|
QString hash = misc::toQString(p->info_hash);
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
hash = misc::toQString(p->info_hash);
|
|
||||||
#else
|
|
||||||
// Unfortunately libtorrent v0.14 does not provide the hash,
|
|
||||||
// only the torrent handle that is often invalid when it arrives
|
|
||||||
try {
|
|
||||||
if(p->handle.is_valid()) {
|
|
||||||
hash = misc::toQString(p->handle.info_hash());
|
|
||||||
}
|
|
||||||
}catch(std::exception){}
|
|
||||||
#endif
|
|
||||||
if(!hash.isEmpty()) {
|
if(!hash.isEmpty()) {
|
||||||
if(savePathsToRemove.contains(hash)) {
|
if(savePathsToRemove.contains(hash)) {
|
||||||
const QString dirpath = savePathsToRemove.take(hash);
|
const QString dirpath = savePathsToRemove.take(hash);
|
||||||
@ -2403,11 +2333,9 @@ void QBtSession::readAlerts() {
|
|||||||
// Copy the torrent file to the export folder
|
// Copy the torrent file to the export folder
|
||||||
if(torrentExport)
|
if(torrentExport)
|
||||||
exportTorrentFile(h);
|
exportTorrentFile(h);
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
// Append .!qB to incomplete files
|
// Append .!qB to incomplete files
|
||||||
if(appendqBExtension)
|
if(appendqBExtension)
|
||||||
appendqBextensionToTorrent(h, true);
|
appendqBextensionToTorrent(h, true);
|
||||||
#endif
|
|
||||||
// Truncate root folder
|
// Truncate root folder
|
||||||
const QString root_folder = misc::truncateRootFolder(p->handle);
|
const QString root_folder = misc::truncateRootFolder(p->handle);
|
||||||
TorrentPersistentData::setRootFolder(h.hash(), root_folder);
|
TorrentPersistentData::setRootFolder(h.hash(), root_folder);
|
||||||
@ -2451,7 +2379,6 @@ void QBtSession::readAlerts() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
else if (file_completed_alert* p = dynamic_cast<file_completed_alert*>(a.get())) {
|
else if (file_completed_alert* p = dynamic_cast<file_completed_alert*>(a.get())) {
|
||||||
QTorrentHandle h(p->handle);
|
QTorrentHandle h(p->handle);
|
||||||
qDebug("A file completed download in torrent %s", qPrintable(h.name()));
|
qDebug("A file completed download in torrent %s", qPrintable(h.name()));
|
||||||
@ -2466,7 +2393,6 @@ void QBtSession::readAlerts() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else if (torrent_paused_alert* p = dynamic_cast<torrent_paused_alert*>(a.get())) {
|
else if (torrent_paused_alert* p = dynamic_cast<torrent_paused_alert*>(a.get())) {
|
||||||
if(p->handle.is_valid()) {
|
if(p->handle.is_valid()) {
|
||||||
QTorrentHandle h(p->handle);
|
QTorrentHandle h(p->handle);
|
||||||
@ -2486,10 +2412,6 @@ void QBtSession::readAlerts() {
|
|||||||
QHash<QString, TrackerInfos> trackers_data = trackersInfos.value(h.hash(), QHash<QString, TrackerInfos>());
|
QHash<QString, TrackerInfos> trackers_data = trackersInfos.value(h.hash(), QHash<QString, TrackerInfos>());
|
||||||
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
||||||
data.last_message = misc::toQString(p->msg);
|
data.last_message = misc::toQString(p->msg);
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
data.verified = false;
|
|
||||||
++data.fail_count;
|
|
||||||
#endif
|
|
||||||
trackers_data.insert(tracker_url, data);
|
trackers_data.insert(tracker_url, data);
|
||||||
trackersInfos[h.hash()] = trackers_data;
|
trackersInfos[h.hash()] = trackers_data;
|
||||||
} else {
|
} else {
|
||||||
@ -2507,10 +2429,6 @@ void QBtSession::readAlerts() {
|
|||||||
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
||||||
data.last_message = ""; // Reset error/warning message
|
data.last_message = ""; // Reset error/warning message
|
||||||
data.num_peers = p->num_peers;
|
data.num_peers = p->num_peers;
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
data.fail_count = 0;
|
|
||||||
data.verified = true;
|
|
||||||
#endif
|
|
||||||
trackers_data.insert(tracker_url, data);
|
trackers_data.insert(tracker_url, data);
|
||||||
trackersInfos[h.hash()] = trackers_data;
|
trackersInfos[h.hash()] = trackers_data;
|
||||||
}
|
}
|
||||||
@ -2522,10 +2440,6 @@ void QBtSession::readAlerts() {
|
|||||||
const QString tracker_url = misc::toQString(p->url);
|
const QString tracker_url = misc::toQString(p->url);
|
||||||
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
||||||
data.last_message = misc::toQString(p->msg); // Store warning message
|
data.last_message = misc::toQString(p->msg); // Store warning message
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
data.verified = true;
|
|
||||||
data.fail_count = 0;
|
|
||||||
#endif
|
|
||||||
trackers_data.insert(tracker_url, data);
|
trackers_data.insert(tracker_url, data);
|
||||||
trackersInfos[h.hash()] = trackers_data;
|
trackersInfos[h.hash()] = trackers_data;
|
||||||
qDebug("Received a tracker warning from %s: %s", p->url.c_str(), p->msg.c_str());
|
qDebug("Received a tracker warning from %s: %s", p->url.c_str(), p->msg.c_str());
|
||||||
@ -2560,12 +2474,7 @@ void QBtSession::readAlerts() {
|
|||||||
QTorrentHandle h(p->handle);
|
QTorrentHandle h(p->handle);
|
||||||
if(h.is_valid()) {
|
if(h.is_valid()) {
|
||||||
qDebug("/!\\ Fast resume failed for %s, reason: %s", qPrintable(h.name()), p->message().c_str());
|
qDebug("/!\\ Fast resume failed for %s, reason: %s", qPrintable(h.name()), p->message().c_str());
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
QString msg = QString::fromLocal8Bit(p->message().c_str());
|
|
||||||
if(msg.contains("filesize", Qt::CaseInsensitive) && msg.contains("mismatch", Qt::CaseInsensitive) && TorrentPersistentData::isSeed(h.hash()) && h.has_missing_files()) {
|
|
||||||
#else
|
|
||||||
if(p->error.value() == 134 && TorrentPersistentData::isSeed(h.hash()) && h.has_missing_files()) {
|
if(p->error.value() == 134 && TorrentPersistentData::isSeed(h.hash()) && h.has_missing_files()) {
|
||||||
#endif
|
|
||||||
const QString hash = h.hash();
|
const QString hash = h.hash();
|
||||||
// Mismatching file size (files were probably moved
|
// Mismatching file size (files were probably moved
|
||||||
addConsoleMessage(tr("File sizes mismatch for torrent %1, pausing it.").arg(h.name()));
|
addConsoleMessage(tr("File sizes mismatch for torrent %1, pausing it.").arg(h.name()));
|
||||||
@ -2775,27 +2684,6 @@ qreal QBtSession::getPayloadUploadRate() const{
|
|||||||
return s->status().payload_upload_rate;
|
return s->status().payload_upload_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
// Save DHT entry to hard drive
|
|
||||||
void QBtSession::saveDHTEntry() {
|
|
||||||
// Save DHT entry
|
|
||||||
if(DHTEnabled) {
|
|
||||||
try{
|
|
||||||
entry dht_state = s->dht_state();
|
|
||||||
const QString dht_path = misc::cacheLocation()+QDir::separator()+QString::fromUtf8("dht_state");
|
|
||||||
if(QFile::exists(dht_path))
|
|
||||||
misc::safeRemove(dht_path);
|
|
||||||
boost::filesystem::ofstream out(dht_path.toLocal8Bit().constData(), std::ios_base::binary);
|
|
||||||
out.unsetf(std::ios_base::skipws);
|
|
||||||
bencode(std::ostream_iterator<char>(out), dht_state);
|
|
||||||
qDebug("DHT entry saved");
|
|
||||||
}catch (std::exception& e) {
|
|
||||||
std::cerr << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void QBtSession::applyEncryptionSettings(pe_settings se) {
|
void QBtSession::applyEncryptionSettings(pe_settings se) {
|
||||||
qDebug("Applying encryption settings");
|
qDebug("Applying encryption settings");
|
||||||
s->set_pe_settings(se);
|
s->set_pe_settings(se);
|
||||||
|
@ -146,10 +146,8 @@ public slots:
|
|||||||
void setAppendLabelToSavePath(bool append);
|
void setAppendLabelToSavePath(bool append);
|
||||||
void appendLabelToTorrentSavePath(const QTorrentHandle &h);
|
void appendLabelToTorrentSavePath(const QTorrentHandle &h);
|
||||||
void changeLabelInTorrentSavePath(const QTorrentHandle &h, QString old_label, QString new_label);
|
void changeLabelInTorrentSavePath(const QTorrentHandle &h, QString old_label, QString new_label);
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
void appendqBextensionToTorrent(const QTorrentHandle &h, bool append);
|
void appendqBextensionToTorrent(const QTorrentHandle &h, bool append);
|
||||||
void setAppendqBExtension(bool append);
|
void setAppendqBExtension(bool append);
|
||||||
#endif
|
|
||||||
void applyEncryptionSettings(libtorrent::pe_settings se);
|
void applyEncryptionSettings(libtorrent::pe_settings se);
|
||||||
void setDownloadLimit(QString hash, long val);
|
void setDownloadLimit(QString hash, long val);
|
||||||
void setUploadLimit(QString hash, long val);
|
void setUploadLimit(QString hash, long val);
|
||||||
@ -216,11 +214,6 @@ signals:
|
|||||||
void ipFilterParsed(bool error, int ruleCount);
|
void ipFilterParsed(bool error, int ruleCount);
|
||||||
void listenSucceeded();
|
void listenSucceeded();
|
||||||
|
|
||||||
private:
|
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
void saveDHTEntry();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Bittorrent
|
// Bittorrent
|
||||||
libtorrent::session *s;
|
libtorrent::session *s;
|
||||||
@ -252,9 +245,7 @@ private:
|
|||||||
bool queueingEnabled;
|
bool queueingEnabled;
|
||||||
bool appendLabelToSavePath;
|
bool appendLabelToSavePath;
|
||||||
bool torrentExport;
|
bool torrentExport;
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
bool appendqBExtension;
|
bool appendqBExtension;
|
||||||
#endif
|
|
||||||
QString defaultSavePath;
|
QString defaultSavePath;
|
||||||
QString defaultTempPath;
|
QString defaultTempPath;
|
||||||
// IP filtering
|
// IP filtering
|
||||||
|
@ -43,6 +43,9 @@
|
|||||||
#include <libtorrent/torrent_info.hpp>
|
#include <libtorrent/torrent_info.hpp>
|
||||||
#include <libtorrent/bencode.hpp>
|
#include <libtorrent/bencode.hpp>
|
||||||
#include <libtorrent/entry.hpp>
|
#include <libtorrent/entry.hpp>
|
||||||
|
#if LIBTORRENT_VERSION_MINOR < 15
|
||||||
|
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
@ -51,6 +54,21 @@
|
|||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#if LIBTORRENT_VERSION_MINOR < 16
|
||||||
|
static QString boostTimeToQString(const boost::posix_time::ptime &boostDate) {
|
||||||
|
if(boostDate.is_not_a_date_time()) return "";
|
||||||
|
struct std::tm tm;
|
||||||
|
try {
|
||||||
|
tm = boost::posix_time::to_tm(boostDate);
|
||||||
|
} catch(std::exception e) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
const time_t t = mktime(&tm);
|
||||||
|
const QDateTime dt = QDateTime::fromTime_t(t);
|
||||||
|
return dt.toString(Qt::DefaultLocaleLongDate);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QTorrentHandle::QTorrentHandle(torrent_handle h): torrent_handle(h) {}
|
QTorrentHandle::QTorrentHandle(torrent_handle h): torrent_handle(h) {}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -74,10 +92,13 @@ QString QTorrentHandle::creation_date() const {
|
|||||||
boost::optional<time_t> t = torrent_handle::get_torrent_info().creation_date();
|
boost::optional<time_t> t = torrent_handle::get_torrent_info().creation_date();
|
||||||
if (t)
|
if (t)
|
||||||
return QDateTime::fromTime_t(*t).toString(Qt::DefaultLocaleLongDate);
|
return QDateTime::fromTime_t(*t).toString(Qt::DefaultLocaleLongDate);
|
||||||
return tr("Unknown");
|
return "";
|
||||||
#else
|
#else
|
||||||
boost::optional<boost::posix_time::ptime> boostDate = torrent_handle::get_torrent_info().creation_date();
|
boost::optional<boost::posix_time::ptime> boostDate = torrent_handle::get_torrent_info().creation_date();
|
||||||
return misc::boostTimeToQString(boostDate);
|
if (boostDate) {
|
||||||
|
return boostTimeToQString(*boostDate);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,11 +595,7 @@ return torrent_handle::status(0x0).distributed_copies;
|
|||||||
}
|
}
|
||||||
|
|
||||||
void QTorrentHandle::file_progress(std::vector<size_type>& fp) const {
|
void QTorrentHandle::file_progress(std::vector<size_type>& fp) const {
|
||||||
torrent_handle::file_progress(fp
|
torrent_handle::file_progress(fp, torrent_handle::piece_granularity);
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
, torrent_handle::piece_granularity
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -745,24 +762,7 @@ void QTorrentHandle::prioritize_files(const vector<int> &files) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void QTorrentHandle::add_tracker(const announce_entry& url) const {
|
void QTorrentHandle::add_tracker(const announce_entry& url) const {
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
torrent_handle::add_tracker(url);
|
torrent_handle::add_tracker(url);
|
||||||
#else
|
|
||||||
std::vector<announce_entry> trackers = torrent_handle::trackers();
|
|
||||||
bool exists = false;
|
|
||||||
std::vector<announce_entry>::iterator it = trackers.begin();
|
|
||||||
while(it != trackers.end()) {
|
|
||||||
if(it->url == url.url) {
|
|
||||||
exists = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
it++;
|
|
||||||
}
|
|
||||||
if(!exists) {
|
|
||||||
trackers.push_back(url);
|
|
||||||
torrent_handle::replace_trackers(trackers);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTorrentHandle::prioritize_first_last_piece(int file_index, bool b) const {
|
void QTorrentHandle::prioritize_first_last_piece(int file_index, bool b) const {
|
||||||
|
@ -38,10 +38,6 @@ public:
|
|||||||
QString name_or_url;
|
QString name_or_url;
|
||||||
QString last_message;
|
QString last_message;
|
||||||
unsigned long num_peers;
|
unsigned long num_peers;
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
bool verified;
|
|
||||||
uint fail_count;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//TrackerInfos() {}
|
//TrackerInfos() {}
|
||||||
TrackerInfos(const TrackerInfos &b) {
|
TrackerInfos(const TrackerInfos &b) {
|
||||||
@ -49,16 +45,8 @@ public:
|
|||||||
Q_ASSERT(!name_or_url.isEmpty());
|
Q_ASSERT(!name_or_url.isEmpty());
|
||||||
last_message = b.last_message;
|
last_message = b.last_message;
|
||||||
num_peers = b.num_peers;
|
num_peers = b.num_peers;
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
verified = b.verified;
|
|
||||||
fail_count = b.fail_count;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
TrackerInfos(QString name_or_url): name_or_url(name_or_url), last_message(""), num_peers(0) {
|
TrackerInfos(QString name_or_url): name_or_url(name_or_url), last_message(""), num_peers(0) {
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
fail_count = 0;
|
|
||||||
verified = false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -112,9 +112,6 @@ torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) :
|
|||||||
comboLabel->addItem(label);
|
comboLabel->addItem(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
addInSeed->setVisible(false);
|
|
||||||
#endif
|
|
||||||
// Set Add button as default
|
// Set Add button as default
|
||||||
OkButton->setDefault(true);
|
OkButton->setDefault(true);
|
||||||
}
|
}
|
||||||
@ -663,7 +660,6 @@ void torrentAdditionDialog::on_OkButton_clicked(){
|
|||||||
TorrentTempData::setFilesPath(hash, files_path);
|
TorrentTempData::setFilesPath(hash, files_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
// Skip file checking and directly start seeding
|
// Skip file checking and directly start seeding
|
||||||
if(addInSeed->isChecked()) {
|
if(addInSeed->isChecked()) {
|
||||||
// Check if local file(s) actually exist
|
// Check if local file(s) actually exist
|
||||||
@ -674,7 +670,6 @@ void torrentAdditionDialog::on_OkButton_clicked(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
// Check if there is at least one selected file
|
// Check if there is at least one selected file
|
||||||
if(!is_magnet && t->num_files() > 1 && allFiltered()){
|
if(!is_magnet && t->num_files() > 1 && allFiltered()){
|
||||||
QMessageBox::warning(0, tr("Invalid file selection"), tr("You must select at least one file in the torrent"));
|
QMessageBox::warning(0, tr("Invalid file selection"), tr("You must select at least one file in the torrent"));
|
||||||
|
@ -171,10 +171,8 @@ void TorrentCreatorDlg::handleCreationSuccess(QString path, QString branch_path)
|
|||||||
save_path = QDir(save_path).absoluteFilePath(root_folder);
|
save_path = QDir(save_path).absoluteFilePath(root_folder);
|
||||||
}
|
}
|
||||||
TorrentTempData::setSavePath(hash, save_path);
|
TorrentTempData::setSavePath(hash, save_path);
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
// Enable seeding mode (do not recheck the files)
|
// Enable seeding mode (do not recheck the files)
|
||||||
TorrentTempData::setSeedingMode(hash, true);
|
TorrentTempData::setSeedingMode(hash, true);
|
||||||
#endif
|
|
||||||
emit torrent_to_seed(path);
|
emit torrent_to_seed(path);
|
||||||
}
|
}
|
||||||
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path);
|
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path);
|
||||||
|
@ -51,9 +51,6 @@ TorrentImportDlg::TorrentImportDlg(QWidget *parent) :
|
|||||||
ui->lbl_info->setFixedWidth(ui->lbl_info->height());
|
ui->lbl_info->setFixedWidth(ui->lbl_info->height());
|
||||||
ui->importBtn->setIcon(IconProvider::instance()->getIcon("document-import"));
|
ui->importBtn->setIcon(IconProvider::instance()->getIcon("document-import"));
|
||||||
// Libtorrent < 0.15 does not support skipping file checking
|
// Libtorrent < 0.15 does not support skipping file checking
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
|
||||||
ui->checkSkipCheck->setVisible(false);
|
|
||||||
#endif
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +104,6 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
|
|||||||
#else
|
#else
|
||||||
ui->lineContent->setText(m_contentPath);
|
ui->lineContent->setText(m_contentPath);
|
||||||
#endif
|
#endif
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 15
|
|
||||||
// Check file size
|
// Check file size
|
||||||
const qint64 file_size = QFile(m_contentPath).size();
|
const qint64 file_size = QFile(m_contentPath).size();
|
||||||
if(t->file_at(0).size == file_size) {
|
if(t->file_at(0).size == file_size) {
|
||||||
@ -118,7 +114,6 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
|
|||||||
ui->checkSkipCheck->setChecked(false);
|
ui->checkSkipCheck->setChecked(false);
|
||||||
ui->checkSkipCheck->setEnabled(false);
|
ui->checkSkipCheck->setEnabled(false);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
// Handle file renaming
|
// Handle file renaming
|
||||||
QStringList parts = m_contentPath.replace("\\", "/").split("/");
|
QStringList parts = m_contentPath.replace("\\", "/").split("/");
|
||||||
QString new_file_name = parts.takeLast();
|
QString new_file_name = parts.takeLast();
|
||||||
@ -145,7 +140,6 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
|
|||||||
#else
|
#else
|
||||||
ui->lineContent->setText(m_contentPath);
|
ui->lineContent->setText(m_contentPath);
|
||||||
#endif
|
#endif
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 15
|
|
||||||
bool size_mismatch = false;
|
bool size_mismatch = false;
|
||||||
QDir content_dir(m_contentPath);
|
QDir content_dir(m_contentPath);
|
||||||
// Check file sizes
|
// Check file sizes
|
||||||
@ -172,7 +166,6 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
|
|||||||
qDebug("The file size matches, allowing fast seeding...");
|
qDebug("The file size matches, allowing fast seeding...");
|
||||||
ui->checkSkipCheck->setEnabled(true);
|
ui->checkSkipCheck->setEnabled(true);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
// Enable the import button
|
// Enable the import button
|
||||||
ui->importBtn->setEnabled(true);
|
ui->importBtn->setEnabled(true);
|
||||||
@ -214,9 +207,7 @@ void TorrentImportDlg::importTorrent()
|
|||||||
const QString hash = misc::toQString(t->info_hash());
|
const QString hash = misc::toQString(t->info_hash());
|
||||||
qDebug() << "Torrent hash is" << hash;
|
qDebug() << "Torrent hash is" << hash;
|
||||||
TorrentTempData::setSavePath(hash, content_path);
|
TorrentTempData::setSavePath(hash, content_path);
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 15
|
|
||||||
TorrentTempData::setSeedingMode(hash, dlg.skipFileChecking());
|
TorrentTempData::setSeedingMode(hash, dlg.skipFileChecking());
|
||||||
#endif
|
|
||||||
qDebug("Adding the torrent to the session...");
|
qDebug("Adding the torrent to the session...");
|
||||||
QBtSession::instance()->addTorrent(torrent_path);
|
QBtSession::instance()->addTorrent(torrent_path);
|
||||||
// Remember the last opened folder
|
// Remember the last opened folder
|
||||||
@ -280,12 +271,10 @@ boost::intrusive_ptr<libtorrent::torrent_info> TorrentImportDlg::torrent() const
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 15
|
|
||||||
bool TorrentImportDlg::skipFileChecking() const
|
bool TorrentImportDlg::skipFileChecking() const
|
||||||
{
|
{
|
||||||
return ui->checkSkipCheck->isChecked();
|
return ui->checkSkipCheck->isChecked();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void TorrentImportDlg::loadSettings()
|
void TorrentImportDlg::loadSettings()
|
||||||
{
|
{
|
||||||
|
@ -56,9 +56,7 @@ public:
|
|||||||
QString getContentPath() const;
|
QString getContentPath() const;
|
||||||
bool fileRenamed() const;
|
bool fileRenamed() const;
|
||||||
boost::intrusive_ptr<libtorrent::torrent_info> torrent() const;
|
boost::intrusive_ptr<libtorrent::torrent_info> torrent() const;
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 15
|
|
||||||
bool skipFileChecking() const;
|
bool skipFileChecking() const;
|
||||||
#endif
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void loadTorrent(const QString &torrent_path);
|
void loadTorrent(const QString &torrent_path);
|
||||||
|
@ -118,7 +118,6 @@ public:
|
|||||||
return data.value("sequential", false).toBool();
|
return data.value("sequential", false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
static void setSeedingMode(QString hash,bool seed){
|
static void setSeedingMode(QString hash,bool seed){
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
|
||||||
QHash<QString, QVariant> all_data = settings.value("torrents-tmp").toHash();
|
QHash<QString, QVariant> all_data = settings.value("torrents-tmp").toHash();
|
||||||
@ -134,7 +133,6 @@ public:
|
|||||||
const QHash<QString, QVariant> data = all_data.value(hash).toHash();
|
const QHash<QString, QVariant> data = all_data.value(hash).toHash();
|
||||||
return data.value("seeding", false).toBool();
|
return data.value("seeding", false).toBool();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static QString getSavePath(QString hash) {
|
static QString getSavePath(QString hash) {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
|
||||||
|
@ -547,7 +547,6 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TransferListWidget::toggleSelectedTorrentsSuperSeeding() const {
|
void TransferListWidget::toggleSelectedTorrentsSuperSeeding() const {
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
const QStringList hashes = getSelectedTorrentsHashes();
|
const QStringList hashes = getSelectedTorrentsHashes();
|
||||||
foreach(const QString &hash, hashes) {
|
foreach(const QString &hash, hashes) {
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||||
@ -555,7 +554,6 @@ void TransferListWidget::toggleSelectedTorrentsSuperSeeding() const {
|
|||||||
h.super_seeding(!h.super_seeding());
|
h.super_seeding(!h.super_seeding());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListWidget::toggleSelectedTorrentsSequentialDownload() const {
|
void TransferListWidget::toggleSelectedTorrentsSequentialDownload() const {
|
||||||
@ -672,11 +670,9 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
connect(&actionForce_recheck, SIGNAL(triggered()), this, SLOT(recheckSelectedTorrents()));
|
connect(&actionForce_recheck, SIGNAL(triggered()), this, SLOT(recheckSelectedTorrents()));
|
||||||
QAction actionCopy_magnet_link(QIcon(":/Icons/magnet.png"), tr("Copy magnet link"), 0);
|
QAction actionCopy_magnet_link(QIcon(":/Icons/magnet.png"), tr("Copy magnet link"), 0);
|
||||||
connect(&actionCopy_magnet_link, SIGNAL(triggered()), this, SLOT(copySelectedMagnetURIs()));
|
connect(&actionCopy_magnet_link, SIGNAL(triggered()), this, SLOT(copySelectedMagnetURIs()));
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
QAction actionSuper_seeding_mode(tr("Super seeding mode"), 0);
|
QAction actionSuper_seeding_mode(tr("Super seeding mode"), 0);
|
||||||
actionSuper_seeding_mode.setCheckable(true);
|
actionSuper_seeding_mode.setCheckable(true);
|
||||||
connect(&actionSuper_seeding_mode, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSuperSeeding()));
|
connect(&actionSuper_seeding_mode, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSuperSeeding()));
|
||||||
#endif
|
|
||||||
QAction actionRename(IconProvider::instance()->getIcon("edit-rename"), tr("Rename..."), 0);
|
QAction actionRename(IconProvider::instance()->getIcon("edit-rename"), tr("Rename..."), 0);
|
||||||
connect(&actionRename, SIGNAL(triggered()), this, SLOT(renameSelectedTorrent()));
|
connect(&actionRename, SIGNAL(triggered()), this, SLOT(renameSelectedTorrent()));
|
||||||
QAction actionSequential_download(tr("Download in sequential order"), 0);
|
QAction actionSequential_download(tr("Download in sequential order"), 0);
|
||||||
@ -690,10 +686,8 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
// Enable/disable pause/start action given the DL state
|
// Enable/disable pause/start action given the DL state
|
||||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||||
bool has_pause = false, has_start = false, has_preview = false;
|
bool has_pause = false, has_start = false, has_preview = false;
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
bool all_same_super_seeding = true;
|
bool all_same_super_seeding = true;
|
||||||
bool super_seeding_mode = false;
|
bool super_seeding_mode = false;
|
||||||
#endif
|
|
||||||
bool all_same_sequential_download_mode = true, all_same_prio_firstlast = true;
|
bool all_same_sequential_download_mode = true, all_same_prio_firstlast = true;
|
||||||
bool sequential_download_mode = false, prioritize_first_last = false;
|
bool sequential_download_mode = false, prioritize_first_last = false;
|
||||||
bool one_has_metadata = false, one_not_seed = false;
|
bool one_has_metadata = false, one_not_seed = false;
|
||||||
@ -724,7 +718,6 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
else {
|
else {
|
||||||
if(!one_not_seed && all_same_super_seeding && h.has_metadata()) {
|
if(!one_not_seed && all_same_super_seeding && h.has_metadata()) {
|
||||||
if(first) {
|
if(first) {
|
||||||
@ -736,7 +729,6 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if(h.is_paused()) {
|
if(h.is_paused()) {
|
||||||
if(!has_start) {
|
if(!has_start) {
|
||||||
listMenu.addAction(&actionStart);
|
listMenu.addAction(&actionStart);
|
||||||
@ -776,12 +768,10 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
listMenu.addAction(&actionSet_download_limit);
|
listMenu.addAction(&actionSet_download_limit);
|
||||||
listMenu.addAction(&actionSet_max_ratio);
|
listMenu.addAction(&actionSet_max_ratio);
|
||||||
listMenu.addAction(&actionSet_upload_limit);
|
listMenu.addAction(&actionSet_upload_limit);
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
if(!one_not_seed && all_same_super_seeding && one_has_metadata) {
|
if(!one_not_seed && all_same_super_seeding && one_has_metadata) {
|
||||||
actionSuper_seeding_mode.setChecked(super_seeding_mode);
|
actionSuper_seeding_mode.setChecked(super_seeding_mode);
|
||||||
listMenu.addAction(&actionSuper_seeding_mode);
|
listMenu.addAction(&actionSuper_seeding_mode);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
listMenu.addSeparator();
|
listMenu.addSeparator();
|
||||||
bool added_preview_action = false;
|
bool added_preview_action = false;
|
||||||
if(has_preview) {
|
if(has_preview) {
|
||||||
|
@ -68,7 +68,6 @@ QList<QVariantMap> EventManager::getPropTrackersInfo(QString hash) const {
|
|||||||
tracker["url"] = tracker_url;
|
tracker["url"] = tracker_url;
|
||||||
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
||||||
QString error_message = data.last_message.trimmed();
|
QString error_message = data.last_message.trimmed();
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
if(it->verified) {
|
if(it->verified) {
|
||||||
tracker["status"] = tr("Working");
|
tracker["status"] = tr("Working");
|
||||||
} else {
|
} else {
|
||||||
@ -82,16 +81,6 @@ QList<QVariantMap> EventManager::getPropTrackersInfo(QString hash) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if(data.verified) {
|
|
||||||
tracker["status"] = tr("Working");
|
|
||||||
} else {
|
|
||||||
if(data.fail_count > 0)
|
|
||||||
tracker["status"] = tr("Not working");
|
|
||||||
else
|
|
||||||
tracker["status"] = tr("Not contacted yet");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
tracker["num_peers"] = QString::number(trackers_data.value(tracker_url, TrackerInfos(tracker_url)).num_peers);
|
tracker["num_peers"] = QString::number(trackers_data.value(tracker_url, TrackerInfos(tracker_url)).num_peers);
|
||||||
tracker["msg"] = error_message;
|
tracker["msg"] = error_message;
|
||||||
trackersInfo << tracker;
|
trackersInfo << tracker;
|
||||||
@ -209,10 +198,8 @@ void EventManager::setGlobalPreferences(QVariantMap m) {
|
|||||||
pref.setMaxActiveUploads(m["max_active_uploads"].toInt());
|
pref.setMaxActiveUploads(m["max_active_uploads"].toInt());
|
||||||
if(m.contains("dont_count_slow_torrents"))
|
if(m.contains("dont_count_slow_torrents"))
|
||||||
pref.setIgnoreSlowTorrentsForQueueing(m["dont_count_slow_torrents"].toBool());
|
pref.setIgnoreSlowTorrentsForQueueing(m["dont_count_slow_torrents"].toBool());
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
if(m.contains("incomplete_files_ext"))
|
if(m.contains("incomplete_files_ext"))
|
||||||
pref.useIncompleteFilesExtension(m["incomplete_files_ext"].toBool());
|
pref.useIncompleteFilesExtension(m["incomplete_files_ext"].toBool());
|
||||||
#endif
|
|
||||||
// Connection
|
// Connection
|
||||||
if(m.contains("listen_port"))
|
if(m.contains("listen_port"))
|
||||||
pref.setSessionPort(m["listen_port"].toInt());
|
pref.setSessionPort(m["listen_port"].toInt());
|
||||||
@ -360,9 +347,7 @@ QVariantMap EventManager::getGlobalPreferences() const {
|
|||||||
data["max_active_torrents"] = pref.getMaxActiveTorrents();
|
data["max_active_torrents"] = pref.getMaxActiveTorrents();
|
||||||
data["max_active_uploads"] = pref.getMaxActiveUploads();
|
data["max_active_uploads"] = pref.getMaxActiveUploads();
|
||||||
data["dont_count_slow_torrents"] = pref.ignoreSlowTorrentsForQueueing();
|
data["dont_count_slow_torrents"] = pref.ignoreSlowTorrentsForQueueing();
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
|
||||||
data["incomplete_files_ext"] = pref.useIncompleteFilesExtension();
|
data["incomplete_files_ext"] = pref.useIncompleteFilesExtension();
|
||||||
#endif
|
|
||||||
// Connection
|
// Connection
|
||||||
data["listen_port"] = pref.getSessionPort();
|
data["listen_port"] = pref.getSessionPort();
|
||||||
data["upnp"] = pref.isUPnPEnabled();
|
data["upnp"] = pref.isUPnPEnabled();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user