mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 08:48:07 -06:00
Use the correct character encoding for exceptions coming from libtorrent.
Conflicts: src/qtlibtorrent/qbtsession.cpp
This commit is contained in:
@@ -197,7 +197,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString
|
|||||||
m_torrentInfo = new torrent_info(m_filePath.toUtf8().data());
|
m_torrentInfo = new torrent_info(m_filePath.toUtf8().data());
|
||||||
m_hash = misc::toQString(m_torrentInfo->info_hash());
|
m_hash = misc::toQString(m_torrentInfo->info_hash());
|
||||||
} catch(const std::exception& e) {
|
} catch(const std::exception& e) {
|
||||||
MessageBoxRaised::critical(0, tr("Invalid torrent"), tr("Failed to load the torrent: %1").arg(e.what()));
|
MessageBoxRaised::critical(0, tr("Invalid torrent"), tr("Failed to load the torrent: %1").arg(misc::toQStringU(e.what())));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -384,7 +384,7 @@ void PropertiesWidget::loadDynamicData() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(const invalid_handle& e) {
|
} catch(const invalid_handle& e) {
|
||||||
qWarning() << "Caught exception in PropertiesWidget::loadDynamicData(): " << e.what();
|
qWarning() << "Caught exception in PropertiesWidget::loadDynamicData(): " << misc::toQStringU(e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1110,7 +1110,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
|
|||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
if (!from_url.isNull()) {
|
if (!from_url.isNull()) {
|
||||||
addConsoleMessage(tr("Unable to decode torrent file: '%1'", "e.g: Unable to decode torrent file: '/home/y/xxx.torrent'").arg(from_url), QString::fromUtf8("red"));
|
addConsoleMessage(tr("Unable to decode torrent file: '%1'", "e.g: Unable to decode torrent file: '/home/y/xxx.torrent'").arg(from_url), QString::fromUtf8("red"));
|
||||||
addConsoleMessage(misc::toQString(e.what()), "red");
|
addConsoleMessage(misc::toQStringU(e.what()), "red");
|
||||||
//emit invalidTorrent(from_url);
|
//emit invalidTorrent(from_url);
|
||||||
fsutils::forceRemove(path);
|
fsutils::forceRemove(path);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include "torrentcreatorthread.h"
|
#include "torrentcreatorthread.h"
|
||||||
#include "fs_utils.h"
|
#include "fs_utils.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_NUM < 1600
|
#if LIBTORRENT_VERSION_NUM < 1600
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
@@ -156,6 +157,6 @@ void TorrentCreatorThread::run() {
|
|||||||
emit updateProgress(100);
|
emit updateProgress(100);
|
||||||
emit creationSuccess(save_path, parent_path);
|
emit creationSuccess(save_path, parent_path);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
emit creationFailure(QString::fromLocal8Bit(e.what()));
|
emit creationFailure(misc::toQStringU(e.what()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ QByteArray btjson::getTrackersForTorrent(const QString& hash)
|
|||||||
tracker_list.append(tracker_dict);
|
tracker_list.append(tracker_dict);
|
||||||
}
|
}
|
||||||
} catch(const std::exception& e) {
|
} catch(const std::exception& e) {
|
||||||
qWarning() << Q_FUNC_INFO << "Invalid torrent: " << e.what();
|
qWarning() << Q_FUNC_INFO << "Invalid torrent: " << misc::toQStringU(e.what());
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,7 +318,7 @@ QByteArray btjson::getPropertiesForTorrent(const QString& hash)
|
|||||||
const qreal ratio = QBtSession::instance()->getRealRatio(h.hash());
|
const qreal ratio = QBtSession::instance()->getRealRatio(h.hash());
|
||||||
data[KEY_PROP_RATIO] = ratio > 100. ? QString::fromUtf8("∞") : misc::accurateDoubleToString(ratio, 1, false);
|
data[KEY_PROP_RATIO] = ratio > 100. ? QString::fromUtf8("∞") : misc::accurateDoubleToString(ratio, 1, false);
|
||||||
} catch(const std::exception& e) {
|
} catch(const std::exception& e) {
|
||||||
qWarning() << Q_FUNC_INFO << "Invalid torrent: " << e.what();
|
qWarning() << Q_FUNC_INFO << "Invalid torrent: " << misc::toQStringU(e.what());
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,7 +363,7 @@ QByteArray btjson::getFilesForTorrent(const QString& hash)
|
|||||||
file_list.append(file_dict);
|
file_list.append(file_dict);
|
||||||
}
|
}
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
qWarning() << Q_FUNC_INFO << "Invalid torrent: " << e.what();
|
qWarning() << Q_FUNC_INFO << "Invalid torrent: " << misc::toQStringU(e.what());
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user