mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
Fix compilation error on Windows
Fix possible encoding problem on Windows (torrent creation tool) Fix compilation with boost >= v1.46
This commit is contained in:
parent
2da5e03741
commit
c05e6ba580
5 changed files with 12 additions and 20 deletions
|
@ -80,6 +80,7 @@
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
QBtSession* QBtSession::m_instance = 0;
|
QBtSession* QBtSession::m_instance = 0;
|
||||||
|
const qreal QBtSession::MAX_RATIO = 9999.;
|
||||||
|
|
||||||
const int MAX_TRACKER_ERRORS = 2;
|
const int MAX_TRACKER_ERRORS = 2;
|
||||||
enum VersionType { NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL };
|
enum VersionType { NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL };
|
||||||
|
|
|
@ -66,7 +66,7 @@ class QBtSession : public QObject {
|
||||||
Q_DISABLE_COPY(QBtSession)
|
Q_DISABLE_COPY(QBtSession)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const qreal MAX_RATIO = 9999.;
|
static const qreal MAX_RATIO;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit QBtSession();
|
explicit QBtSession();
|
||||||
|
|
|
@ -52,6 +52,10 @@ DEFINES += QT_NO_CAST_TO_ASCII
|
||||||
# Fast concatenation (Qt >= 4.6)
|
# Fast concatenation (Qt >= 4.6)
|
||||||
DEFINES += QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS
|
DEFINES += QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS
|
||||||
|
|
||||||
|
# Fixes compilation with Boost >= v1.46 where boost
|
||||||
|
# filesystem v3 is the default.
|
||||||
|
DEFINES += BOOST_FILESYSTEM_VERSION=2
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -85,16 +85,11 @@ void TorrentCreatorThread::sendProgressSignal(int progress) {
|
||||||
|
|
||||||
void TorrentCreatorThread::run() {
|
void TorrentCreatorThread::run() {
|
||||||
emit updateProgress(0);
|
emit updateProgress(0);
|
||||||
char const* creator_str = "qBittorrent "VERSION;
|
QString creator_str("qBittorrent "VERSION);
|
||||||
try {
|
try {
|
||||||
file_storage fs;
|
file_storage fs;
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
|
||||||
add_files(fs, input_path.toUtf8().constData(), file_filter);
|
|
||||||
#else
|
|
||||||
// Adding files to the torrent
|
// Adding files to the torrent
|
||||||
path full_path = path(input_path.toUtf8().constData());
|
add_files(fs, input_path.toUtf8().constData(), file_filter);
|
||||||
add_files(fs, full_path, file_filter);
|
|
||||||
#endif
|
|
||||||
if(abort) return;
|
if(abort) return;
|
||||||
create_torrent t(fs, piece_size);
|
create_torrent t(fs, piece_size);
|
||||||
|
|
||||||
|
@ -107,20 +102,12 @@ void TorrentCreatorThread::run() {
|
||||||
}
|
}
|
||||||
if(abort) return;
|
if(abort) return;
|
||||||
// calculate the hash for all pieces
|
// calculate the hash for all pieces
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
const QString parent_path = misc::branchPath(input_path);
|
||||||
QString parent_path = input_path.replace("\\", "/");
|
|
||||||
QStringList parts = parent_path.split("/"/*, QString::SkipEmptyParts*/);
|
|
||||||
parts.removeLast();
|
|
||||||
parent_path = parts.join("/");
|
|
||||||
set_piece_hashes(t, parent_path.toUtf8().constData(), boost::bind<void>(&sendProgressUpdateSignal, _1, t.num_pieces(), this));
|
set_piece_hashes(t, parent_path.toUtf8().constData(), boost::bind<void>(&sendProgressUpdateSignal, _1, t.num_pieces(), this));
|
||||||
#else
|
|
||||||
QString parent_path = misc::toQStringU(full_path.branch_path().string());
|
|
||||||
set_piece_hashes(t, full_path.branch_path(), boost::bind<void>(&sendProgressUpdateSignal, _1, t.num_pieces(), this));
|
|
||||||
#endif
|
|
||||||
// Set qBittorrent as creator and add user comment to
|
// Set qBittorrent as creator and add user comment to
|
||||||
// torrent_info structure
|
// torrent_info structure
|
||||||
t.set_creator(creator_str);
|
t.set_creator(creator_str.toUtf8().constData());
|
||||||
t.set_comment((const char*)comment.toUtf8());
|
t.set_comment(comment.toUtf8().constData());
|
||||||
// Is private ?
|
// Is private ?
|
||||||
t.set_priv(is_private);
|
t.set_priv(is_private);
|
||||||
if(abort) return;
|
if(abort) return;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Adapt these paths on Windows
|
# Adapt these paths on Windows
|
||||||
INCLUDEPATH += $$quote(C:/qBittorrent/boost_1_44_0)
|
INCLUDEPATH += $$quote(C:/qBittorrent/boost_1_46_0)
|
||||||
INCLUDEPATH += $$quote(C:/qBittorrent/RC_0_15/include)
|
INCLUDEPATH += $$quote(C:/qBittorrent/RC_0_15/include)
|
||||||
INCLUDEPATH += $$quote(C:/qBittorrent/RC_0_15/zlib)
|
INCLUDEPATH += $$quote(C:/qBittorrent/RC_0_15/zlib)
|
||||||
INCLUDEPATH += $$quote(C:/OpenSSL/include)
|
INCLUDEPATH += $$quote(C:/OpenSSL/include)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue