mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-22 14:23:35 -07:00
- Fixed compiling with libtorrent v0.12 stable
- Fixed EffectiveSize() function so that the file size really reflects only unfiltered files in the torrent
This commit is contained in:
parent
1c5262b1ed
commit
21be57d06f
1 changed files with 18 additions and 1 deletions
19
src/GUI.cpp
19
src/GUI.cpp
|
@ -1044,9 +1044,26 @@ size_type GUI::torrentEffectiveSize(QString hash) const{
|
|||
torrent_info t = h.get_torrent_info();
|
||||
unsigned short nbFiles = t.num_files();
|
||||
size_type effective_size = 0;
|
||||
#ifndef V_0_13
|
||||
QList<QByteArray> filteredFiles;
|
||||
QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".pieces");
|
||||
if(pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
QByteArray pieces_selection = pieces_file.readAll();
|
||||
pieces_file.close();
|
||||
filteredFiles = pieces_selection.split('\n');
|
||||
}
|
||||
bool corrupted_pieces_file = false;
|
||||
if(nbFiles != filteredFiles.size() - 1)
|
||||
corrupted_pieces_file = true;
|
||||
#endif
|
||||
for(unsigned int i=0; i<nbFiles; ++i){
|
||||
#ifndef V_0_13
|
||||
if(!corrupted_pieces_file && !filteredFiles.at(i).toInt())
|
||||
#endif
|
||||
#ifdef V_0_13
|
||||
if(h.piece_priority(i) != 0)
|
||||
effective_size += t.file_at(i).size;
|
||||
#endif
|
||||
effective_size += t.file_at(i).size;
|
||||
}
|
||||
return effective_size;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue