diff --git a/Changelog b/Changelog
index 6b0b53a48..4822a960d 100644
--- a/Changelog
+++ b/Changelog
@@ -23,6 +23,7 @@
- FEATURE: IPv6 is now fully supported
- FEATURE: Real torrent share ratio is now displayed in transfer list
- FEATURE: Added keyboard shortcuts for main actions (see wiki)
+ - FEATURE: Added a popup menu to set priority for multiple fies at once
- I18N: Added Hungarian translation
- BUGFIX: Progress of paused torrents is now correct on restart
- BUGFIX: Progress column gets sorted on restart it is was during last execution
diff --git a/TODO b/TODO
index d85771fa0..273dad433 100644
--- a/TODO
+++ b/TODO
@@ -36,13 +36,11 @@
- Display Url seeds in torrent properties and allow to edit them
- Sorting in Download Status column should be smarter than just an alphabetical sort
- Windows port : http://www.peerweb.nl/qbittorrent/experimentalbuild/testing.zip
-- Write documentation
-- Allow to scan multiple directories
+- Allow to scan multiple directories?
- Fix all (or almost all) opened bugs in bug tracker
-- Fix sorting with Qt 4.3 - Reported to Trolltech, waiting for fix
+- Fix column sorting with Qt 4.3 - Reported to Trolltech, waiting for their fix
- update sorting when a new torrent is added?
-- Allow to hide columns
-- Allow to set priorities for multiple files at once
+- Allow to hide columns (gtsoul)
- Complete documentation and english translation
* beta2
- Wait for some bug fixes in libtorrent :
diff --git a/src/addTorrentDialog.ui b/src/addTorrentDialog.ui
index 00d88e846..d4c0a77c5 100644
--- a/src/addTorrentDialog.ui
+++ b/src/addTorrentDialog.ui
@@ -105,6 +105,9 @@
QAbstractItemView::AllEditTriggers
+
+ QAbstractItemView::ExtendedSelection
+
-
diff --git a/src/torrentAddition.h b/src/torrentAddition.h
index 570b52e8e..de4c5b4ef 100644
--- a/src/torrentAddition.h
+++ b/src/torrentAddition.h
@@ -71,6 +71,11 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
PropDelegate = new PropListDelegate();
torrentContentList->setItemDelegate(PropDelegate);
connect(torrentContentList, SIGNAL(clicked(const QModelIndex&)), torrentContentList, SLOT(edit(const QModelIndex&)));
+ connect(torrentContentList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFilesListMenu(const QPoint&)));
+ connect(actionIgnored, SIGNAL(triggered()), this, SLOT(ignoreSelection()));
+ connect(actionNormal, SIGNAL(triggered()), this, SLOT(normalSelection()));
+ connect(actionHigh, SIGNAL(triggered()), this, SLOT(highSelection()));
+ connect(actionMaximum, SIGNAL(triggered()), this, SLOT(maximumSelection()));
torrentContentList->header()->resizeSection(0, 200);
QString home = QDir::homePath();
if(home[home.length()-1] != QDir::separator()){
@@ -173,6 +178,61 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
}
}
+ void displayFilesListMenu(const QPoint& pos){
+ QMenu myFilesLlistMenu(this);
+ QModelIndex index;
+ // Enable/disable pause/start action given the DL state
+ QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes();
+ myFilesLlistMenu.setTitle(tr("Priority"));
+ myFilesLlistMenu.addAction(actionIgnored);
+ myFilesLlistMenu.addAction(actionNormal);
+ myFilesLlistMenu.addAction(actionHigh);
+ myFilesLlistMenu.addAction(actionMaximum);
+ // Call menu
+ // XXX: why mapToGlobal() is not enough?
+ myFilesLlistMenu.exec(mapToGlobal(pos)+QPoint(22,95));
+ }
+
+ void ignoreSelection(){
+ QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes();
+ QModelIndex index;
+ foreach(index, selectedIndexes){
+ if(index.column() == PRIORITY){
+ PropListModel->setData(index, QVariant(IGNORED));
+ }
+ }
+ }
+
+ void normalSelection(){
+ QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes();
+ QModelIndex index;
+ foreach(index, selectedIndexes){
+ if(index.column() == PRIORITY){
+ PropListModel->setData(index, QVariant(NORMAL));
+ }
+ }
+ }
+
+ void highSelection(){
+ QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes();
+ QModelIndex index;
+ foreach(index, selectedIndexes){
+ if(index.column() == PRIORITY){
+ PropListModel->setData(index, QVariant(HIGH));
+ }
+ }
+ }
+
+ void maximumSelection(){
+ QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes();
+ QModelIndex index;
+ foreach(index, selectedIndexes){
+ if(index.column() == PRIORITY){
+ PropListModel->setData(index, QVariant(MAXIMUM));
+ }
+ }
+ }
+
void savePiecesPriorities(){
qDebug("Saving pieces priorities");
QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".priorities");