From e1660e592bbd8a6122cb83b5c88da29e3478c0ce Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 10 Apr 2007 10:11:36 +0000 Subject: [PATCH] - Added Upload limit per torrent in finished list --- src/FinishedTorrents.cpp | 15 +++++++++++++++ src/FinishedTorrents.h | 3 +++ src/seeding.ui | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/src/FinishedTorrents.cpp b/src/FinishedTorrents.cpp index ab7e0d650..66dc24b64 100644 --- a/src/FinishedTorrents.cpp +++ b/src/FinishedTorrents.cpp @@ -49,6 +49,7 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession){ actionPreview_file->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/preview.png"))); actionDelete_Permanently->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete_perm.png"))); actionTorrent_Properties->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/properties.png"))); + // TODO: Set icons for upload limit connect(actionDelete, SIGNAL(triggered()), (GUI*)parent, SLOT(deleteSelection())); connect(actionPreview_file, SIGNAL(triggered()), (GUI*)parent, SLOT(previewFileSelection())); connect(actionDelete_Permanently, SIGNAL(triggered()), (GUI*)parent, SLOT(deletePermanently())); @@ -104,6 +105,19 @@ void FinishedTorrents::setRowColor(int row, const QString& color){ } } +void FinishedTorrents::on_actionSet_upload_limit_triggered(){ + QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes(); + QModelIndex index; + QStringList hashes; + foreach(index, selectedIndexes){ + if(index.column() == NAME){ + // Get the file hash + hashes << DLListModel->data(DLListModel->index(index.row(), HASH)).toString(); + } + } + new BandwidthAllocationDialog(this, true, &BTSession, hashes); +} + void FinishedTorrents::updateFinishedList(){ // qDebug("Updating finished list"); QString hash; @@ -195,6 +209,7 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){ torrent_handle h = BTSession->getTorrentHandle(fileHash); myFinishedListMenu.addAction(actionDelete); myFinishedListMenu.addAction(actionDelete_Permanently); + myFinishedListMenu.addAction(actionSet_upload_limit); myFinishedListMenu.addAction(actionTorrent_Properties); if(!previewProgram.isEmpty() && BTSession->isFilePreviewPossible(fileHash) && selectedIndexes.size()<=finishedListModel->columnCount()){ myFinishedListMenu.addAction(actionPreview_file); diff --git a/src/FinishedTorrents.h b/src/FinishedTorrents.h index 92481a6c4..1e015dc38 100644 --- a/src/FinishedTorrents.h +++ b/src/FinishedTorrents.h @@ -54,6 +54,9 @@ class FinishedTorrents : public QWidget, public Ui::seeding{ void displayFinishedListMenu(const QPoint&); void setRowColor(int row, const QString& color); + protected slots: + void on_actionSet_upload_limit_triggered(); + }; #endif diff --git a/src/seeding.ui b/src/seeding.ui index ac15f41ae..8a82c5402 100644 --- a/src/seeding.ui +++ b/src/seeding.ui @@ -76,6 +76,11 @@ Preview file + + + Set upload limit + +