diff --git a/TODO b/TODO index f271a5b22..c399c589f 100644 --- a/TODO +++ b/TODO @@ -109,6 +109,7 @@ beta6->beta7 changelog: - FEATURE: Allow to drag'n drop plugin to list for install/update - FEATURE: Added some search plugins to http://plugins.qbittorrent.org - FEATURE: Added zip support in search plugins manager (can put .py & .png inside) +- BUGFIX: In torrent content, it is now easier to filter all torrents using right click menu - BUGFIX: Updated man page / README / INSTALL - BUGFIX: Paused torrents could be displayed as connected for a sec after checking - BUGFIX: 'Unknown' is now displayed in search results columns where value is -1 diff --git a/src/properties_imp.cpp b/src/properties_imp.cpp index 49cef70ae..27f38258c 100644 --- a/src/properties_imp.cpp +++ b/src/properties_imp.cpp @@ -187,27 +187,13 @@ void properties::loadPiecesPriorities(){ } } -bool properties::onlyOneItem() const { +bool properties::allFiltered() const { unsigned int nbRows = PropListModel->rowCount(); - if(nbRows == 1) return true; - unsigned int nb_unfiltered = 0; - QModelIndexList selectedIndexes = filesList->selectionModel()->selectedIndexes(); - QModelIndex index; - unsigned int to_be_filtered = 0; - foreach(index, selectedIndexes){ - if(index.column() == PRIORITY){ - if(index.data().toInt() != IGNORED) - ++to_be_filtered; - } - } for(unsigned int i=0; idata(PropListModel->index(i, PRIORITY)).toInt() != IGNORED){ - ++nb_unfiltered; - } + if(PropListModel->data(PropListModel->index(i, PRIORITY)).toInt() != IGNORED) + return false; } - if(nb_unfiltered-to_be_filtered == 0) - return true; - return false; + return true; } void properties::displayFilesListMenu(const QPoint& pos){ @@ -218,8 +204,7 @@ void properties::displayFilesListMenu(const QPoint& pos){ // Enable/disable pause/start action given the DL state QModelIndexList selectedIndexes = filesList->selectionModel()->selectedIndexes(); myFilesLlistMenu.setTitle(tr("Priority")); - if(!onlyOneItem()) - myFilesLlistMenu.addAction(actionIgnored); + myFilesLlistMenu.addAction(actionIgnored); myFilesLlistMenu.addAction(actionNormal); myFilesLlistMenu.addAction(actionHigh); myFilesLlistMenu.addAction(actionMaximum); @@ -525,8 +510,8 @@ void properties::on_incrementalDownload_stateChanged(int){ } void properties::on_okButton_clicked(){ - savePiecesPriorities(); - close(); + if(savePiecesPriorities()) + close(); } void properties::loadWebSeedsFromFile(){ @@ -566,8 +551,12 @@ void properties::saveWebSeeds(){ qDebug("url seeds were saved"); } -void properties::savePiecesPriorities(){ - if(!changedFilteredfiles) return; +bool properties::savePiecesPriorities() { + if(!changedFilteredfiles) return true; + if(allFiltered()) { + QMessageBox::warning(0, tr("Priorities error"), tr("Error, you can't filter all the files in a torrent.")); + return false; + } qDebug("Saving pieces priorities"); bool hasFilteredFiles = false; QString fileName = h.name(); @@ -577,7 +566,7 @@ void properties::savePiecesPriorities(){ // Write new files if(!pieces_file.open(QIODevice::WriteOnly | QIODevice::Text)){ std::cerr << "Error: Could not save pieces priorities\n"; - return; + return true; } unsigned int nbRows = PropListModel->rowCount(); for(unsigned int i=0; irowCount(); if(nbRows == 1) return true; - unsigned int nb_unfiltered = 0; - QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes(); - QModelIndex index; - unsigned int to_be_filtered = 0; - foreach(index, selectedIndexes){ - if(index.column() == PRIORITY){ - if(index.data().toInt() != IGNORED) - ++to_be_filtered; - } - } for(unsigned int i=0; idata(PropListModel->index(i, PRIORITY)).toInt() != IGNORED){ - ++nb_unfiltered; - } + if(PropListModel->data(PropListModel->index(i, PRIORITY)).toInt() != IGNORED) + return false; } - if(nb_unfiltered-to_be_filtered == 0) - return true; - return false; + return true; } void displayFilesListMenu(const QPoint& pos){ @@ -209,8 +196,7 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{ // Enable/disable pause/start action given the DL state QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes(); myFilesLlistMenu.setTitle(tr("Priority")); - if(!onlyOneItem()) - myFilesLlistMenu.addAction(actionIgnored); + myFilesLlistMenu.addAction(actionIgnored); myFilesLlistMenu.addAction(actionNormal); myFilesLlistMenu.addAction(actionHigh); myFilesLlistMenu.addAction(actionMaximum); @@ -328,8 +314,8 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{ QFile::remove(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".paused")); } // Check if there is at least one selected file - if(!hasSelectedFiles()){ - QMessageBox::critical(0, tr("Invalid file selection"), tr("You must select at least one file in the torrent")); + if(allFiltered()){ + QMessageBox::warning(0, tr("Invalid file selection"), tr("You must select at least one file in the torrent")); return; } // save filtered files @@ -338,18 +324,6 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{ emit torrentAddition(filePath, fromScanDir, from_url); close(); } - - bool hasSelectedFiles(){ - unsigned int nbRows = PropListModel->rowCount(); - for(unsigned int i=0; iitem(i, PRIORITY); - unsigned short priority = item->text().toInt(); - if(priority) { - return true; - } - } - return false; - } }; #endif