|
|
|
@ -178,18 +178,44 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
@@ -178,18 +178,44 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool onlyOneItem() const { |
|
|
|
|
unsigned int nbRows = PropListModel->rowCount(); |
|
|
|
|
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; i<nbRows; ++i){ |
|
|
|
|
if(PropListModel->data(PropListModel->index(i, PRIORITY)).toInt() != IGNORED){ |
|
|
|
|
++nb_unfiltered; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(nb_unfiltered-to_be_filtered == 0) |
|
|
|
|
return true; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void displayFilesListMenu(const QPoint& pos){ |
|
|
|
|
unsigned int nbRows = PropListModel->rowCount(); |
|
|
|
|
if(nbRows == 1) return; |
|
|
|
|
QMenu myFilesLlistMenu(this); |
|
|
|
|
QModelIndex index; |
|
|
|
|
// Enable/disable pause/start action given the DL state
|
|
|
|
|
// Enable/disable pause/start action given the DL state
|
|
|
|
|
QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes(); |
|
|
|
|
myFilesLlistMenu.setTitle(tr("Priority")); |
|
|
|
|
myFilesLlistMenu.addAction(actionIgnored); |
|
|
|
|
if(!onlyOneItem()) |
|
|
|
|
myFilesLlistMenu.addAction(actionIgnored); |
|
|
|
|
myFilesLlistMenu.addAction(actionNormal); |
|
|
|
|
myFilesLlistMenu.addAction(actionHigh); |
|
|
|
|
myFilesLlistMenu.addAction(actionMaximum); |
|
|
|
|
// Call menu
|
|
|
|
|
// XXX: why mapToGlobal() is not enough?
|
|
|
|
|
// Call menu
|
|
|
|
|
// XXX: why mapToGlobal() is not enough?
|
|
|
|
|
myFilesLlistMenu.exec(mapToGlobal(pos)+QPoint(10,145)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|