Use libtorrent version.hpp instead of our own DEFINE

This commit is contained in:
Christophe Dumez 2010-06-07 08:32:41 +00:00
parent 2e0c8f848f
commit 5f23cbc470
17 changed files with 79 additions and 62 deletions

View file

@ -7,6 +7,7 @@
#include <QCheckBox>
#include <QComboBox>
#include <QNetworkInterface>
#include <libtorrent/version.hpp>
#include "preferences.h"
enum AdvSettingsCols {PROPERTY, VALUE};
@ -73,7 +74,7 @@ public slots:
Preferences::resolvePeerHostNames(cb_resolve_hosts->isChecked());
// Max Half-Open connections
Preferences::setMaxHalfOpenConnections(spin_maxhalfopen->value());
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
// Super seeding
Preferences::enableSuperSeeding(cb_super_seeding->isChecked());
#endif
@ -164,7 +165,7 @@ protected slots:
setItem(SUPER_SEEDING, PROPERTY, new QTableWidgetItem(tr("Strict super seeding")));
cb_super_seeding = new QCheckBox();
connect(cb_super_seeding, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged()));
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
cb_super_seeding->setChecked(Preferences::isSuperSeedingEnabled());
#else
cb_super_seeding->setEnabled(false);

View file

@ -51,7 +51,8 @@
#include "httpserver.h"
#include "bandwidthscheduler.h"
#include <libtorrent/extensions/ut_metadata.hpp>
#ifdef LIBTORRENT_0_15
#include <libtorrent/version.hpp>
#if LIBTORRENT_VERSION_MINOR > 14
#include <libtorrent/extensions/lt_trackers.hpp>
#endif
#include <libtorrent/extensions/ut_pex.hpp>
@ -121,7 +122,7 @@ Bittorrent::Bittorrent()
// Enabling plugins
//s->add_extension(&create_metadata_plugin);
s->add_extension(&create_ut_metadata_plugin);
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
s->add_extension(create_lt_trackers_plugin);
#endif
if(Preferences::isPeXEnabled()) {
@ -141,7 +142,7 @@ Bittorrent::Bittorrent()
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(processDownloadedFile(QString, QString)));
connect(downloader, SIGNAL(downloadFailure(QString, QString)), this, SLOT(handleDownloadFailure(QString, QString)));
appendLabelToSavePath = Preferences::appendTorrentLabel();
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
appendqBExtension = Preferences::useIncompleteFilesExtension();
#endif
connect(m_scanFolders, SIGNAL(torrentsAdded(QStringList&)), this, SLOT(addTorrentsFromScanFolder(QStringList&)));
@ -154,7 +155,7 @@ session_proxy Bittorrent::asyncDeletion() {
qDebug("Bittorrent session async deletion IN");
exiting = true;
// Do some BT related saving
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
saveDHTEntry();
#endif
saveSessionState();
@ -171,7 +172,7 @@ Bittorrent::~Bittorrent() {
qDebug("BTSession destructor IN");
if(!exiting) {
// Do some BT related saving
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
saveDHTEntry();
#endif
saveSessionState();
@ -281,7 +282,7 @@ void Bittorrent::configureSession() {
setDefaultTempPath(QString::null);
}
setAppendLabelToSavePath(Preferences::appendTorrentLabel());
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
setAppendqBExtension(Preferences::useIncompleteFilesExtension());
#endif
preAllocateAllFiles(Preferences::preAllocateAllFiles());
@ -423,7 +424,7 @@ void Bittorrent::configureSession() {
sessionSettings.stop_tracker_timeout = 1;
//sessionSettings.announce_to_all_trackers = true;
sessionSettings.auto_scrape_interval = 1200; // 20 minutes
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
sessionSettings.announce_to_all_trackers = true;
sessionSettings.announce_to_all_tiers = true; //uTorrent behavior
sessionSettings.auto_scrape_min_interval = 900; // 15 minutes
@ -858,7 +859,7 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
qDebug("addMagnetURI: using save_path: %s", qPrintable(savePath));
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
// Skip checking and directly start seeding (new in libtorrent v0.15)
if(TorrentTempData::isSeedingMode(hash)){
p.seed_mode=true;
@ -1082,7 +1083,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
qDebug("addTorrent: using save_path: %s", qPrintable(savePath));
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
// Skip checking and directly start seeding (new in libtorrent v0.15)
if(TorrentTempData::isSeedingMode(hash)){
p.seed_mode=true;
@ -1173,7 +1174,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
qDebug("addTorrent: Saving save_path in persistent data: %s", qPrintable(savePath));
TorrentPersistentData::saveSavePath(hash, savePath);
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
// Append .!qB to incomplete files
if(appendqBExtension)
appendqBextensionToTorrent(h, true);
@ -1357,7 +1358,7 @@ void Bittorrent::enableLSD(bool b) {
void Bittorrent::loadSessionState() {
const QString state_path = misc::cacheLocation()+QDir::separator()+QString::fromUtf8("ses_state");
if(!QFile::exists(state_path)) return;
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
std::vector<char> in;
if (load_file(state_path.toLocal8Bit().constData(), in) == 0)
{
@ -1378,7 +1379,7 @@ void Bittorrent::loadSessionState() {
void Bittorrent::saveSessionState() {
qDebug("Saving session state to disk...");
const QString state_path = misc::cacheLocation()+QDir::separator()+QString::fromUtf8("ses_state");
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
entry session_state;
s->save_state(session_state);
std::vector<char> out;
@ -1404,7 +1405,7 @@ void Bittorrent::saveSessionState() {
bool Bittorrent::enableDHT(bool b) {
if(b) {
if(!DHTEnabled) {
#ifndef LIBTORRENT_0_15
#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)) {
@ -1416,7 +1417,7 @@ bool Bittorrent::enableDHT(bool b) {
}
#endif
try {
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
s->start_dht();
#else
s->start_dht(dht_state);
@ -1632,7 +1633,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
defaultTempPath = temppath;
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
void Bittorrent::appendqBextensionToTorrent(QTorrentHandle h, bool append) {
if(!h.is_valid() || !h.has_metadata()) return;
std::vector<size_type> fp;
@ -1704,7 +1705,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
}
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
void Bittorrent::setAppendqBExtension(bool append) {
if(appendqBExtension != append) {
appendqBExtension = !appendqBExtension;
@ -1932,7 +1933,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
if(h.is_valid()) {
emit finishedTorrent(h);
const QString &hash = h.hash();
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
// Remove .!qB extension if necessary
if(appendqBExtension)
appendqBextensionToTorrent(h, false);
@ -2059,7 +2060,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
}
}
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
// Append .!qB to incomplete files
if(appendqBExtension)
appendqBextensionToTorrent(h, true);
@ -2089,7 +2090,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
}
}
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
else if (file_completed_alert* p = dynamic_cast<file_completed_alert*>(a.get())) {
QTorrentHandle h(p->handle);
if(appendqBExtension) {
@ -2119,7 +2120,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
QHash<QString, TrackerInfos> trackers_data = trackersInfos.value(h.hash(), QHash<QString, TrackerInfos>());
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
data.last_message = misc::toQString(p->msg);
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
data.verified = false;
++data.fail_count;
#endif
@ -2140,7 +2141,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
data.last_message = ""; // Reset error/warning message
data.num_peers = p->num_peers;
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
data.fail_count = 0;
data.verified = true;
#endif
@ -2155,7 +2156,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
const QString &tracker_url = misc::toQString(p->url);
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
data.last_message = misc::toQString(p->msg); // Store warning message
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
data.verified = true;
data.fail_count = 0;
#endif
@ -2388,7 +2389,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
return sessionStatus.payload_upload_rate;
}
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
// Save DHT entry to hard drive
void Bittorrent::saveDHTEntry() {
// Save DHT entry

View file

@ -43,6 +43,7 @@
#include <QPointer>
#include <QTimer>
#include <libtorrent/version.hpp>
#include <libtorrent/session.hpp>
#include <libtorrent/ip_filter.hpp>
#include "qtorrenthandle.h"
@ -63,7 +64,7 @@ public:
QString name_or_url;
QString last_message;
unsigned long num_peers;
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
bool verified;
uint fail_count;
#endif
@ -74,13 +75,13 @@ public:
Q_ASSERT(!name_or_url.isEmpty());
last_message = b.last_message;
num_peers = b.num_peers;
#ifndef LIBTORRENT_0_15
#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) {
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
fail_count = 0;
verified = false;
#endif
@ -135,7 +136,7 @@ public slots:
void resumeTorrent(QString hash);
void resumeAllTorrents();
/* End Web UI */
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
void saveDHTEntry();
#endif
void preAllocateAllFiles(bool b);
@ -163,7 +164,7 @@ public slots:
void setAppendLabelToSavePath(bool append);
void appendLabelToTorrentSavePath(QTorrentHandle h);
void changeLabelInTorrentSavePath(QTorrentHandle h, QString old_label, QString new_label);
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
void appendqBextensionToTorrent(QTorrentHandle h, bool append);
void setAppendqBExtension(bool append);
#endif
@ -249,7 +250,7 @@ private:
bool queueingEnabled;
bool appendLabelToSavePath;
bool torrentExport;
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
bool appendqBExtension;
#endif
QString defaultSavePath;

View file

@ -37,6 +37,7 @@
#include <boost/filesystem/fstream.hpp>
#include <boost/bind.hpp>
#include <libtorrent/version.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/torrent_info.hpp>
@ -208,7 +209,7 @@ void createtorrent::handleCreationSuccess(QString path, const char* branch_path)
}
QString hash = misc::toQString(t->info_hash());
TorrentTempData::setSavePath(hash, QString::fromLocal8Bit(branch_path));
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
// Enable seeding mode (do not recheck the files)
TorrentTempData::setSeedingMode(hash, true);
#endif

View file

@ -29,6 +29,7 @@
*/
#include <libtorrent/version.hpp>
#include "eventmanager.h"
#include "bittorrent.h"
#include "scannedfoldersmodel.h"
@ -60,7 +61,7 @@ QList<QVariantMap> EventManager::getPropTrackersInfo(QString hash) const {
tracker["url"] = tracker_url;
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
QString error_message = data.last_message.trimmed();
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
if(it->verified) {
tracker["status"] = tr("Working");
} else {
@ -171,7 +172,7 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
Preferences::setMaxActiveTorrents(m["max_active_torrents"].toInt());
if(m.contains("max_active_uploads"))
Preferences::setMaxActiveUploads(m["max_active_uploads"].toInt());
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
if(m.contains("incomplete_files_ext"))
Preferences::useIncompleteFilesExtension(m["incomplete_files_ext"].toBool());
#endif
@ -274,7 +275,7 @@ QVariantMap EventManager::getGlobalPreferences() const {
data["max_active_downloads"] = Preferences::getMaxActiveDownloads();
data["max_active_torrents"] = Preferences::getMaxActiveTorrents();
data["max_active_uploads"] = Preferences::getMaxActiveUploads();
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
data["incomplete_files_ext"] = Preferences::useIncompleteFilesExtension();
#endif
// Connection

View file

@ -39,6 +39,7 @@
#include <QDesktopWidget>
#include <QStyleFactory>
#include <libtorrent/version.hpp>
#include <time.h>
#include <stdlib.h>
@ -283,7 +284,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
}
// Tab selection mecanism
connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
checkAppendqB->setVisible(false);
#endif
// Load Advanced settings
@ -403,7 +404,7 @@ void options_imp::saveOptions(){
#endif
settings.setValue(QString::fromUtf8("TempPath"), temp_path);
settings.setValue(QString::fromUtf8("AppendLabel"), checkAppendLabel->isChecked());
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
settings.setValue(QString::fromUtf8("UseIncompleteExtension"), checkAppendqB->isChecked());
#endif
settings.setValue(QString::fromUtf8("PreAllocation"), preAllocateAllFiles());
@ -644,7 +645,7 @@ void options_imp::loadOptions(){
#endif
textTempPath->setText(temp_path);
checkAppendLabel->setChecked(Preferences::appendTorrentLabel());
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
checkAppendqB->setChecked(Preferences::useIncompleteFilesExtension());
#endif
checkPreallocateAll->setChecked(Preferences::preAllocateAllFiles());

View file

@ -37,6 +37,7 @@
#include <QDir>
#include <QTime>
#include <QList>
#include <libtorrent/version.hpp>
#ifndef DISABLE_GUI
#include <QApplication>
@ -178,7 +179,7 @@ public:
settings.setValue(QString::fromUtf8("Preferences/Downloads/TempPath"), path);
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
static bool useIncompleteFilesExtension() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/UseIncompleteExtension"), false).toBool();
@ -967,7 +968,7 @@ public:
return settings.value(QString::fromUtf8("Preferences/Connection/Interface"), QString()).toString();
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
static bool isSuperSeedingEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Advanced/SuperSeeding"), false).toBool();

View file

@ -36,6 +36,7 @@
#include <QHeaderView>
#include <QMessageBox>
#include <QFile>
#include <libtorrent/version.hpp>
#include <libtorrent/session.hpp>
#include "ui_preview.h"
#include "previewlistdelegate.h"
@ -65,7 +66,7 @@ protected slots:
QModelIndex index;
QModelIndexList selectedIndexes = previewList->selectionModel()->selectedRows(NAME);
if(selectedIndexes.size() == 0) return;
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
// Flush data
h.flush_cache();
#endif

View file

@ -40,6 +40,7 @@
#include <QFileDialog>
#include <QDesktopServices>
#include <QInputDialog>
#include <libtorrent/version.hpp>
#include "propertieswidget.h"
#include "transferlistwidget.h"
#include "torrentpersistentdata.h"
@ -101,7 +102,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, GUI* main_window, TransferLi
ProgressHLayout_2->insertWidget(1, pieces_availability);
// Tracker list
trackerList = new TrackerList(this);
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
trackerUpButton->setVisible(false);
trackerDownButton->setVisible(false);
#else
@ -492,7 +493,7 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
const QString &filename = misc::toQStringU(h.get_torrent_info().file_at(i).path.string());
const QString &file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename));
qDebug("Trying to open file at %s", qPrintable(file_path));
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
// Flush data
h.flush_cache();
#endif
@ -518,7 +519,7 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
const QString &filename = path_items.join(QDir::separator());
const QString &file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename));
qDebug("Trying to open folder at %s", qPrintable(file_path));
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
// Flush data
h.flush_cache();
#endif

View file

@ -37,6 +37,7 @@
#include "misc.h"
#include "qtorrenthandle.h"
#include "torrentpersistentdata.h"
#include <libtorrent/version.hpp>
#include <libtorrent/magnet_uri.hpp>
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/bencode.hpp>
@ -228,7 +229,7 @@ QString QTorrentHandle::save_path() const {
return misc::toQString(h.save_path().string());
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
bool QTorrentHandle::super_seeding() const {
Q_ASSERT(h.is_valid());
return h.super_seeding();
@ -595,7 +596,7 @@ void QTorrentHandle::file_priority(int index, int priority) const {
TorrentPersistentData::saveSeedStatus(*this);
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
void QTorrentHandle::super_seeding(bool on) const {
Q_ASSERT(h.is_valid());
h.super_seeding(on);
@ -648,7 +649,7 @@ void QTorrentHandle::set_peer_download_limit(libtorrent::asio::ip::tcp::endpoint
void QTorrentHandle::add_tracker(announce_entry const& url) {
Q_ASSERT(h.is_valid());
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
h.add_tracker(url);
#else
std::vector<announce_entry> trackers = h.trackers();

View file

@ -31,6 +31,7 @@
#ifndef QTORRENTHANDLE_H
#define QTORRENTHANDLE_H
#include <libtorrent/version.hpp>
#include <libtorrent/torrent_handle.hpp>
#include <libtorrent/torrent_info.hpp>
@ -117,7 +118,7 @@ class QTorrentHandle {
qlonglong seeding_time() const;
std::vector<int> file_priorities() const;
bool is_sequential_download() const;
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
bool super_seeding() const;
#endif
QString creation_date() const;
@ -158,7 +159,7 @@ class QTorrentHandle {
void auto_managed(bool) const;
void force_recheck() const;
void move_storage(QString path) const;
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
void super_seeding(bool on) const;
void flush_cache() const;
#endif

View file

@ -43,6 +43,7 @@
#include <QDesktopWidget>
#include <QInputDialog>
#include <libtorrent/version.hpp>
#include <libtorrent/session.hpp>
#include <libtorrent/bencode.hpp>
#include "bittorrent.h"
@ -108,7 +109,7 @@ public:
addInPause->setChecked(true);
//addInPause->setEnabled(false);
}
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
addInSeed->setVisible(false);
#endif
}
@ -512,7 +513,7 @@ public slots:
TorrentTempData::setFilesPath(hash, files_path);
}
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
// Skip file checking and directly start seeding
if(addInSeed->isChecked()) {
// Check if local file(s) actually exist

View file

@ -34,6 +34,7 @@
#include <QSettings>
#include <QVariant>
#include <QDateTime>
#include <libtorrent/version.hpp>
#include <libtorrent/magnet_uri.hpp>
#include "qtorrenthandle.h"
#include "misc.h"
@ -126,7 +127,7 @@ public:
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
static void setSeedingMode(QString hash,bool seed){
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
QHash<QString, QVariant> all_data = settings.value("torrents-tmp", QHash<QString, QVariant>()).toHash();

View file

@ -35,6 +35,7 @@
#include <QHash>
#include <QAction>
#include <QColor>
#include <libtorrent/version.hpp>
#include "trackerlist.h"
#include "propertieswidget.h"
@ -93,7 +94,7 @@ void TrackerList::setRowColor(int row, QColor color) {
}
}
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
void TrackerList::moveSelectionUp() {
QTorrentHandle h = properties->getCurrentTorrent();
if(!h.is_valid()) {
@ -241,7 +242,7 @@ void TrackerList::loadTrackers() {
}
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
QString error_message = data.last_message.trimmed();
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
if(it->verified) {
item->setText(COL_STATUS, tr("Working"));
item->setText(COL_MSG, "");

View file

@ -34,6 +34,7 @@
#include <QTreeWidget>
#include <QList>
#include <libtorrent/version.hpp>
#include "qtorrenthandle.h"
enum TrackerListColumn {COL_URL, COL_STATUS, COL_PEERS, COL_MSG};
@ -62,7 +63,7 @@ protected:
public slots:
void setRowColor(int row, QColor color);
#ifndef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR < 15
void moveSelectionUp();
void moveSelectionDown();
#endif

View file

@ -38,6 +38,7 @@
#include "GUI.h"
#include "preferences.h"
#include "deletionconfirmationdlg.h"
#include <libtorrent/version.hpp>
#include <QStandardItemModel>
#include <QSortFilterProxyModel>
#include <QDesktopServices>
@ -932,7 +933,7 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&){
}
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
void TransferListWidget::toggleSelectedTorrentsSuperSeeding() const {
const QStringList &hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
@ -1055,7 +1056,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
connect(&actionForce_recheck, SIGNAL(triggered()), this, SLOT(recheckSelectedTorrents()));
QAction actionCopy_magnet_link(QIcon(QString::fromUtf8(":/Icons/magnet.png")), tr("Copy magnet link"), 0);
connect(&actionCopy_magnet_link, SIGNAL(triggered()), this, SLOT(copySelectedMagnetURIs()));
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
QAction actionSuper_seeding_mode(tr("Super seeding mode"), 0);
connect(&actionSuper_seeding_mode, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSuperSeeding()));
#endif
@ -1070,7 +1071,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
// Enable/disable pause/start action given the DL state
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
bool has_pause = false, has_start = false, has_preview = false;
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
bool all_same_super_seeding = true;
bool super_seeding_mode = false;
#endif
@ -1104,7 +1105,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
}
}
}
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
else {
if(!one_not_seed && all_same_super_seeding && h.has_metadata()) {
if(first) {
@ -1155,7 +1156,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
if(one_not_seed)
listMenu.addAction(&actionSet_download_limit);
listMenu.addAction(&actionSet_upload_limit);
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
if(!one_not_seed && all_same_super_seeding && one_has_metadata) {
QIcon ico;
if(super_seeding_mode) {

View file

@ -31,7 +31,8 @@
#ifndef TRANSFERLISTWIDGET_H
#define TRANSFERLISTWIDGET_H
#include<QTreeView>
#include <QTreeView>
#include <libtorrent/version.hpp>
#include "qtorrenthandle.h"
class QStandardItemModel;
@ -106,7 +107,7 @@ protected slots:
void updateMetadata(QTorrentHandle &h);
void currentChanged(const QModelIndex& current, const QModelIndex&);
void resumeTorrent(QTorrentHandle &h);
#ifdef LIBTORRENT_0_15
#if LIBTORRENT_VERSION_MINOR > 14
void toggleSelectedTorrentsSuperSeeding() const;
#endif
void toggleSelectedTorrentsSequentialDownload() const;