diff --git a/src/properties_imp.cpp b/src/properties_imp.cpp index 698fb42e7..69d62a629 100644 --- a/src/properties_imp.cpp +++ b/src/properties_imp.cpp @@ -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(){ QList 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){ } } +void properties::setAllPiecesState(bool selected){ + torrent_info torrentInfo = h.get_torrent_info(); + for(int i=0; isetData(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){ diff --git a/src/properties_imp.h b/src/properties_imp.h index 08f2b22f8..67fc79371 100644 --- a/src/properties_imp.h +++ b/src/properties_imp.h @@ -51,6 +51,7 @@ class properties : public QDialog, private Ui::properties{ void saveFilteredFiles(); void updateProgress(); void loadFilteredFiles(); + void setAllPiecesState(bool selected); signals: void changedFilteredFiles(torrent_handle h, bool compact_mode);