|
|
|
@ -154,8 +154,11 @@ void properties::loadFilteredFiles(){
@@ -154,8 +154,11 @@ void properties::loadFilteredFiles(){
|
|
|
|
|
QString fileName = QString(torrentInfo.name().c_str()); |
|
|
|
|
QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileName+".pieces"); |
|
|
|
|
has_filtered_files = false; |
|
|
|
|
qDebug("Loading filtered state of files"); |
|
|
|
|
// Read saved file
|
|
|
|
|
if(!pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)){ |
|
|
|
|
qDebug("Could not find pieces file"); |
|
|
|
|
setAllPiecesState(true); |
|
|
|
|
selectionBitmask.assign(torrentInfo.num_files(), 0); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -164,6 +167,7 @@ void properties::loadFilteredFiles(){
@@ -164,6 +167,7 @@ void properties::loadFilteredFiles(){
|
|
|
|
|
QList<QByteArray> pieces_selection_list = pieces_selection.split('\n'); |
|
|
|
|
if(pieces_selection_list.size() != torrentInfo.num_files()+1){ |
|
|
|
|
std::cout << "Error: Corrupted pieces file\n"; |
|
|
|
|
setAllPiecesState(true); |
|
|
|
|
selectionBitmask.assign(torrentInfo.num_files(), 0); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -200,6 +204,18 @@ void properties::setRowColor(int row, QString color){
@@ -200,6 +204,18 @@ void properties::setRowColor(int row, QString color){
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void properties::setAllPiecesState(bool selected){ |
|
|
|
|
torrent_info torrentInfo = h.get_torrent_info(); |
|
|
|
|
for(int i=0; i<torrentInfo.num_files(); ++i){ |
|
|
|
|
if(selected){ |
|
|
|
|
setRowColor(i, "green"); |
|
|
|
|
}else{ |
|
|
|
|
setRowColor(i, "red"); |
|
|
|
|
} |
|
|
|
|
PropListModel->setData(PropListModel->index(i, SELECTED), QVariant(selected)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Toggle the selected state of a file within the torrent when we
|
|
|
|
|
// double click on it.
|
|
|
|
|
void properties::toggleSelectedState(const QModelIndex& index){ |
|
|
|
|