Browse Source

BUGFIX: Fix issue when altering files priorities of a seeding torrent (closes #665799)

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
b98d0282ce
  1. 33
      src/qtlibtorrent/qtorrenthandle.cpp

33
src/qtlibtorrent/qtorrenthandle.cpp

@ -481,6 +481,32 @@ void QTorrentHandle::prioritize_files(const std::vector<int> &v) {
if(was_seed && !is_seed()) { if(was_seed && !is_seed()) {
// Reset seed status // Reset seed status
TorrentPersistentData::saveSeedStatus(*this); TorrentPersistentData::saveSeedStatus(*this);
// Move to temp folder if necessary
if(Preferences::isTempPathEnabled()) {
QString tmp_path = Preferences::getTempPath();
QString root_folder = TorrentPersistentData::getRootFolder(hash());
if(!root_folder.isEmpty())
tmp_path = QDir(tmp_path).absoluteFilePath(root_folder);
move_storage(tmp_path);
}
}
}
void QTorrentHandle::file_priority(int index, int priority) const {
Q_ASSERT(torrent_handle::is_valid());
bool was_seed = is_seed();
torrent_handle::file_priority(index, priority);
if(was_seed && !is_seed()) {
// Save seed status
TorrentPersistentData::saveSeedStatus(*this);
// Move to temp folder if necessary
if(Preferences::isTempPathEnabled()) {
QString tmp_path = Preferences::getTempPath();
QString root_folder = TorrentPersistentData::getRootFolder(hash());
if(!root_folder.isEmpty())
tmp_path = QDir(tmp_path).absoluteFilePath(root_folder);
move_storage(tmp_path);
}
} }
} }
@ -500,13 +526,6 @@ void QTorrentHandle::move_storage(QString new_path) const {
torrent_handle::move_storage(new_path.toLocal8Bit().constData()); torrent_handle::move_storage(new_path.toLocal8Bit().constData());
} }
void QTorrentHandle::file_priority(int index, int priority) const {
Q_ASSERT(torrent_handle::is_valid());
torrent_handle::file_priority(index, priority);
// Save seed status
TorrentPersistentData::saveSeedStatus(*this);
}
bool QTorrentHandle::save_torrent_file(QString path) { bool QTorrentHandle::save_torrent_file(QString path) {
if(!torrent_handle::has_metadata()) return false; if(!torrent_handle::has_metadata()) return false;
QFile met_file(path); QFile met_file(path);

Loading…
Cancel
Save