From 7757b833632871911a6882fb44ddae481c02f673 Mon Sep 17 00:00:00 2001 From: Dimitriy Ryazantcev Date: Thu, 18 Oct 2012 20:48:01 +0300 Subject: [PATCH 3/5] Win32: build fixes in bittorrent plugin. --- src/plugins/bittorrent/torrentfilesmodel.cpp | 16 ++++++++++++++++ src/plugins/bittorrent/torrentplugin.cpp | 8 ++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/plugins/bittorrent/torrentfilesmodel.cpp b/src/plugins/bittorrent/torrentfilesmodel.cpp index 693e190..f872dd6 100644 --- a/src/plugins/bittorrent/torrentfilesmodel.cpp +++ b/src/plugins/bittorrent/torrentfilesmodel.cpp @@ -315,7 +315,11 @@ namespace LeechCraft MkParentIfDoesntExist (path); QList displayData; +#ifdef Q_OS_WIN32 + displayData << QString::fromUtf16 (reinterpret_cast (path.leaf ().c_str ())) +#else displayData << QString::fromUtf8 (path.leaf ().c_str ()) +#endif << Util::MakePrettySize (begin->size); TreeItem *parentItem = Path2TreeItem_ [parentPath], @@ -354,7 +358,11 @@ namespace LeechCraft QString pathStr = QString::fromUtf8 (fi.Path_.string ().c_str ()); QList displayData; +#ifdef Q_OS_WIN32 + displayData << QString::fromUtf16 (reinterpret_cast (fi.Path_.leaf ().c_str ())) +#else displayData << QString::fromUtf8 (fi.Path_.leaf ().c_str ()) +#endif << QString::number (fi.Priority_) << QString::number (fi.Progress_, 'f', 3); qDebug () << Q_FUNC_INFO << fi.Priority_; @@ -485,7 +493,11 @@ namespace LeechCraft { if (item->Data (0, RoleProgress).toDouble () != 1) { +#ifdef Q_OS_WIN32 + QString filename = QString::fromUtf16 (reinterpret_cast (i->first.filename ().c_str ())); +#else QString filename = QString::fromUtf8 (i->first.filename ().c_str ()); +#endif emit gotEntity (Util::MakeNotification ("BitTorrent", tr ("The file %1 hasn't finished downloading yet.") .arg (filename), @@ -525,7 +537,11 @@ namespace LeechCraft TreeItem *parent = Path2TreeItem_ [parentPath.branch_path ()]; QList data; +#ifdef Q_OS_WIN32 + data << QString::fromUtf16 (reinterpret_cast (parentPath.leaf ().c_str ())) << QString (""); +#else data << QString::fromUtf8 (parentPath.leaf ().c_str ()) << QString (""); +#endif if (!AdditionDialog_) data << QString ("") << QString (""); TreeItem *item = new TreeItem (data, parent); diff --git a/src/plugins/bittorrent/torrentplugin.cpp b/src/plugins/bittorrent/torrentplugin.cpp index 97f074b..5184e4b 100644 --- a/src/plugins/bittorrent/torrentplugin.cpp +++ b/src/plugins/bittorrent/torrentplugin.cpp @@ -32,6 +32,9 @@ #include #include #include +#include +#include +#include #include #include #include -- 1.7.11.msysgit.1