diff --git a/src/addnewtorrentdialog.cpp b/src/addnewtorrentdialog.cpp index aceca8fdc..7f4383ac5 100644 --- a/src/addnewtorrentdialog.cpp +++ b/src/addnewtorrentdialog.cpp @@ -193,7 +193,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString m_torrentInfo = new torrent_info(fsutils::toNativePath(m_filePath).toUtf8().data()); m_hash = misc::toQString(m_torrentInfo->info_hash()); } 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; } diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index 62486ac1f..8ce9a7a8c 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -395,7 +395,7 @@ void PropertiesWidget::loadDynamicData() { } } } catch(const invalid_handle& e) { - qWarning() << "Caught exception in PropertiesWidget::loadDynamicData(): " << e.what(); + qWarning() << "Caught exception in PropertiesWidget::loadDynamicData(): " << misc::toQStringU(e.what()); } } diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 3795c67d4..571c9d92f 100755 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -1074,7 +1074,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr } catch(std::exception& e) { 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(misc::toQString(e.what()), "red"); + addConsoleMessage(misc::toQStringU(e.what()), "red"); //emit invalidTorrent(from_url); fsutils::forceRemove(path); }else{ @@ -1565,7 +1565,7 @@ void QBtSession::enableDHT(bool b) { } catch(std::exception &e) { qDebug("Could not enable DHT, reason: %s", e.what()); - addConsoleMessage(tr("DHT support [OFF]. Reason: %1").arg(misc::toQString(e.what())), QString::fromUtf8("red")); + addConsoleMessage(tr("DHT support [OFF]. Reason: %1").arg(misc::toQStringU(e.what())), QString::fromUtf8("red")); } } } @@ -2201,7 +2201,7 @@ void QBtSession::handleAlert(libtorrent::alert* a) { break; } } catch (const std::exception& e) { - qWarning() << "Caught exception in readAlerts(): " << e.what(); + qWarning() << "Caught exception in readAlerts(): " << misc::toQStringU(e.what()); } } diff --git a/src/torrentcreator/torrentcreatorthread.cpp b/src/torrentcreator/torrentcreatorthread.cpp index b99feede3..eb11a3cc8 100644 --- a/src/torrentcreator/torrentcreatorthread.cpp +++ b/src/torrentcreator/torrentcreatorthread.cpp @@ -42,6 +42,7 @@ #include "torrentcreatorthread.h" #include "fs_utils.h" +#include "misc.h" #include #include @@ -136,6 +137,6 @@ void TorrentCreatorThread::run() { emit updateProgress(100); emit creationSuccess(save_path, parent_path); } catch (std::exception& e) { - emit creationFailure(QString::fromLocal8Bit(e.what())); + emit creationFailure(misc::toQStringU(e.what())); } } diff --git a/src/webui/btjson.cpp b/src/webui/btjson.cpp index b276c1de3..735e68893 100644 --- a/src/webui/btjson.cpp +++ b/src/webui/btjson.cpp @@ -256,7 +256,7 @@ QByteArray btjson::getTrackersForTorrent(const QString& hash) tracker_list.append(tracker_dict); } } 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(); } @@ -312,7 +312,7 @@ QByteArray btjson::getPropertiesForTorrent(const QString& hash) const qreal ratio = QBtSession::instance()->getRealRatio(status); data[KEY_PROP_RATIO] = ratio > 100. ? QString::fromUtf8("∞") : misc::accurateDoubleToString(ratio, 1, false); } 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(); } @@ -357,7 +357,7 @@ QByteArray btjson::getFilesForTorrent(const QString& hash) file_list.append(file_dict); } } 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(); }