|
|
|
@ -71,6 +71,11 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
@@ -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{
@@ -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"); |
|
|
|
|