diff --git a/TODO b/TODO index c615b851a..86eaba160 100644 --- a/TODO +++ b/TODO @@ -47,11 +47,9 @@ - Windows port (Chris - Peerkoel) - write a patch for file_priority(int index); - strace -p `pidof yourbtclient` -- valgrind --tool=memcheck --leak-check=full src/qbittorrent (parameter socket?) +- valgrind --tool=memcheck --leak-check=full src/qbittorrent * beta 6 - Translations update (IN PROGRESS) - - dllist and seeding lists context menus should be more similar - - dllist and seeding list shouldn't need a pointer to GUI (use signals/slots) - Wait for some bug fixes in libtorrent : - Mutex invalid argument on exit (Ticket #126) - FIXED? - Number of seeds non null for finished torrent (Ticket #122) @@ -81,3 +79,5 @@ beta5->beta6 changelog: - BUGFIX: Showing checking progress for paused torrents too - BUGFIX: Fixed progress column sorting on startup - BUGFIX: Prevent downloadFromUrl flooding +- BUGFIX: Made finished list context menu more similar to the download list one +- BUGFIX: Fixed Pause/Start action in lists context menus diff --git a/src/FinishedTorrents.cpp b/src/FinishedTorrents.cpp index c105dd873..3c5acdafe 100644 --- a/src/FinishedTorrents.cpp +++ b/src/FinishedTorrents.cpp @@ -34,6 +34,8 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession){ setupUi(this); + actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png"))); + actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png"))); nbFinished = 0; this->BTSession = BTSession; this->parent = parent; @@ -65,6 +67,8 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession){ actionDelete_Permanently->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete_perm.png"))); actionTorrent_Properties->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/properties.png"))); actionSet_upload_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/seeding.png"))); + connect(actionPause, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionPause_triggered())); + connect(actionStart, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionStart_triggered())); connect(actionDelete, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_triggered())); connect(actionPreview_file, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionPreview_file_triggered())); connect(actionDelete_Permanently, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_Permanently_triggered())); @@ -301,21 +305,39 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){ QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes(); QSettings settings("qBittorrent", "qBittorrent"); QString previewProgram = settings.value("Options/Misc/PreviewProgram", QString()).toString(); - foreach(index, selectedIndexes){ - if(index.column() == F_NAME){ + bool has_pause = false, has_start = false, has_preview = false; + foreach(index, selectedIndexes) { + if(index.column() == F_NAME) { // Get the file name QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString(); + // Get handle and pause the torrent QTorrentHandle h = BTSession->getTorrentHandle(hash); - myFinishedListMenu.addAction(actionDelete); - myFinishedListMenu.addAction(actionDelete_Permanently); - myFinishedListMenu.addAction(actionSet_upload_limit); - myFinishedListMenu.addAction(actionTorrent_Properties); - if(!previewProgram.isEmpty() && BTSession->isFilePreviewPossible(hash) && selectedIndexes.size()<=finishedListModel->columnCount()){ + if(!h.is_valid()) continue; + if(h.is_paused()) { + if(!has_start) { + myFinishedListMenu.addAction(actionStart); + has_start = true; + } + }else{ + if(!has_pause) { + myFinishedListMenu.addAction(actionPause); + has_pause = true; + } + } + if(!previewProgram.isEmpty() && BTSession->isFilePreviewPossible(hash) && !has_preview) { myFinishedListMenu.addAction(actionPreview_file); + has_preview = true; } - break; + if(has_pause && has_start && has_preview) break; } } + myFinishedListMenu.addSeparator(); + myFinishedListMenu.addAction(actionDelete); + myFinishedListMenu.addAction(actionDelete_Permanently); + myFinishedListMenu.addSeparator(); + myFinishedListMenu.addAction(actionSet_upload_limit); + myFinishedListMenu.addSeparator(); + myFinishedListMenu.addAction(actionTorrent_Properties); // Call menu // XXX: why mapToGlobal() is not enough? myFinishedListMenu.exec(mapToGlobal(pos)+QPoint(10,55)); diff --git a/src/downloadingTorrents.cpp b/src/downloadingTorrents.cpp index 2e2804ef0..007442eab 100644 --- a/src/downloadingTorrents.cpp +++ b/src/downloadingTorrents.cpp @@ -92,6 +92,8 @@ DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession) connect(downloadList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayDLListMenu(const QPoint&))); connect(infoBar, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayInfoBarMenu(const QPoint&))); // Actions + connect(actionPause, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionPause_triggered())); + connect(actionStart, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionStart_triggered())); connect(actionDelete, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_triggered())); connect(actionPreview_file, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionPreview_file_triggered())); connect(actionDelete_Permanently, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_Permanently_triggered())); @@ -286,7 +288,7 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) { myDLLlistMenu.addAction(actionTorrent_Properties); // Call menu // XXX: why mapToGlobal() is not enough? - myDLLlistMenu.exec(mapToGlobal(pos)+QPoint(10,55)); + myDLLlistMenu.exec(mapToGlobal(pos)+QPoint(10,60)); } void DownloadingTorrents::on_actionClearLog_triggered() {