mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-21 16:07:23 -06:00
Use new libtorrent-1.1 settings API
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user