Use new libtorrent-1.1 settings API

This commit is contained in:
Vladimir Golovnev (Glassez)
2016-06-03 17:03:17 +03:00
parent b2cb473b63
commit b5fe749f0b
12 changed files with 536 additions and 286 deletions

View File

@@ -29,24 +29,31 @@
#ifndef UPGRADE_H
#define UPGRADE_H
#include <libtorrent/lazy_entry.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/version.hpp>
#if LIBTORRENT_VERSION_NUM >= 10100
#include <libtorrent/bdecode.hpp>
#endif
#include <libtorrent/bencode.hpp>
#include <libtorrent/entry.hpp>
#if LIBTORRENT_VERSION_NUM < 10100
#include <libtorrent/lazy_entry.hpp>
#endif
#include <QString>
#include <QDir>
#include <QFile>
#include <QRegExp>
#ifndef DISABLE_GUI
#include <QMessageBox>
#endif
#include <QRegExp>
#include <QString>
#include "base/logger.h"
#include "base/utils/fs.h"
#include "base/utils/misc.h"
#include "base/utils/string.h"
#include "base/qinisettings.h"
#include "base/preferences.h"
#include "base/qinisettings.h"
bool userAcceptsUpgrade()
{
@@ -86,10 +93,16 @@ bool upgradeResumeFile(const QString &filepath, const QVariantHash &oldTorrent =
QByteArray data = file1.readAll();
file1.close();
libtorrent::lazy_entry fastOld;
libtorrent::error_code ec;
libtorrent::lazy_bdecode(data.constData(), data.constData() + data.size(), fastOld, ec);
if (ec || (fastOld.type() != libtorrent::lazy_entry::dict_t)) return false;
#if LIBTORRENT_VERSION_NUM < 10100
libtorrent::lazy_entry fastOld;
libtorrent::lazy_bdecode(data.constData(), data.constData() + data.size(), fastOld, ec);
if (ec || (fastOld.type() != libtorrent::lazy_entry::dict_t)) return false;
#else
libtorrent::bdecode_node fastOld;
libtorrent::bdecode(data.constData(), data.constData() + data.size(), fastOld, ec);
if (ec || (fastOld.type() != libtorrent::bdecode_node::dict_t)) return false;
#endif
libtorrent::entry fastNew;
fastNew = fastOld;