Browse Source

Some fixes for commit 6dabf50781.

adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
9a18b50751
  1. 13
      src/qtlibtorrent/qbtsession.cpp
  2. 28
      src/torrentpersistentdata.h

13
src/qtlibtorrent/qbtsession.cpp

@ -80,7 +80,7 @@ @@ -80,7 +80,7 @@
//initialize static member variables
QHash<QString, TorrentTempData::TorrentData> TorrentTempData::data = QHash<QString, TorrentTempData::TorrentData>();
QHash<QString, TorrentMoveState> TorrentTempData::torrentMoveStates = QHash<QString, TorrentMoveState>();
QHash<QString, TorrentTempData::TorrentMoveState> TorrentTempData::torrentMoveStates = QHash<QString, TorrentTempData::TorrentMoveState>();
QHash<QString, bool> HiddenData::data = QHash<QString, bool>();
unsigned int HiddenData::metadata_counter = 0;
@ -2418,12 +2418,12 @@ void QBtSession::handleStorageMovedAlert(libtorrent::storage_moved_alert* p) { @@ -2418,12 +2418,12 @@ void QBtSession::handleStorageMovedAlert(libtorrent::storage_moved_alert* p) {
}
QString new_save_path = fsutils::fromNativePath(misc::toQStringU(p->path.c_str()));
if (new_save_path != TorrentTempData::getNewPath(hash)) {
if (new_save_path != fsutils::fromNativePath(TorrentTempData::getNewPath(hash))) {
qWarning("new path received in handleStorageMovedAlert() doesn't match a path in a queue");
return;
}
QString oldPath = TorrentTempData::getOldPath(hash);
QString oldPath = fsutils::fromNativePath(TorrentTempData::getOldPath(hash));
qDebug("Torrent is successfully moved from %s to %s", qPrintable(oldPath), qPrintable(new_save_path));
@ -2441,7 +2441,7 @@ void QBtSession::handleStorageMovedAlert(libtorrent::storage_moved_alert* p) { @@ -2441,7 +2441,7 @@ void QBtSession::handleStorageMovedAlert(libtorrent::storage_moved_alert* p) {
//h.force_recheck();
QString queued = TorrentTempData::getQueuedPath(hash);
if (queued != QString()) {
if (!queued.isEmpty()) {
TorrentTempData::finishMove(hash);
h.move_storage(queued);
}
@ -2465,9 +2465,12 @@ void QBtSession::handleStorageMovedFailedAlert(libtorrent::storage_moved_failed_ @@ -2465,9 +2465,12 @@ void QBtSession::handleStorageMovedFailedAlert(libtorrent::storage_moved_failed_
return;
}
addConsoleMessage(tr("Could not move torrent: '%1'. Reason: %2").arg(h.name()).arg(misc::toQStringU(p->message())), "red");
QString queued = TorrentTempData::getQueuedPath(hash);
if (queued != QString()) {
if (!queued.isEmpty()) {
TorrentTempData::finishMove(hash);
addConsoleMessage(tr("Attempting to move torrent: '%1' to path: '%2'.").arg(h.name()).arg(fsutils::toNativePath(queued)));
h.move_storage(queued);
}
else {

28
src/torrentpersistentdata.h

@ -42,20 +42,6 @@ @@ -42,20 +42,6 @@
#include "qinisettings.h"
#include <QHash>
struct TorrentMoveState
{
TorrentMoveState(QString oldPath, QString newPath)
: oldPath(oldPath)
, newPath(newPath)
{}
// the moving occurs from oldPath to newPath
// queuedPath is where files should be moved to, when current moving is completed
QString oldPath;
QString newPath;
QString queuedPath;
};
class TorrentTempData {
// This class stores strings w/o modifying separators
public:
@ -185,6 +171,20 @@ private: @@ -185,6 +171,20 @@ private:
bool seed;
};
struct TorrentMoveState
{
TorrentMoveState(QString oldPath, QString newPath)
: oldPath(oldPath)
, newPath(newPath)
{}
// the moving occurs from oldPath to newPath
// queuedPath is where files should be moved to, when current moving is completed
QString oldPath;
QString newPath;
QString queuedPath;
};
static QHash<QString, TorrentData> data;
static QHash<QString, TorrentMoveState> torrentMoveStates;
};

Loading…
Cancel
Save