Browse Source

- Made finished list menu more similar to the download list one

- Fixed Start/Pause actions in lists context menus
adaptive-webui-19844
Christophe Dumez 17 years ago
parent
commit
71599c0f9f
  1. 6
      TODO
  2. 38
      src/FinishedTorrents.cpp
  3. 4
      src/downloadingTorrents.cpp

6
TODO

@ -47,11 +47,9 @@
- Windows port (Chris - Peerkoel) - Windows port (Chris - Peerkoel)
- write a patch for file_priority(int index); - write a patch for file_priority(int index);
- strace -p `pidof yourbtclient` - strace -p `pidof yourbtclient`
- valgrind --tool=memcheck --leak-check=full src/qbittorrent (parameter socket?) - valgrind --tool=memcheck --leak-check=full src/qbittorrent
* beta 6 * beta 6
- Translations update (IN PROGRESS) - 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 : - Wait for some bug fixes in libtorrent :
- Mutex invalid argument on exit (Ticket #126) - FIXED? - Mutex invalid argument on exit (Ticket #126) - FIXED?
- Number of seeds non null for finished torrent (Ticket #122) - 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: Showing checking progress for paused torrents too
- BUGFIX: Fixed progress column sorting on startup - BUGFIX: Fixed progress column sorting on startup
- BUGFIX: Prevent downloadFromUrl flooding - 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

38
src/FinishedTorrents.cpp

@ -34,6 +34,8 @@
FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession){ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession){
setupUi(this); setupUi(this);
actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png")));
actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png")));
nbFinished = 0; nbFinished = 0;
this->BTSession = BTSession; this->BTSession = BTSession;
this->parent = parent; this->parent = parent;
@ -65,6 +67,8 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession){
actionDelete_Permanently->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete_perm.png"))); actionDelete_Permanently->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete_perm.png")));
actionTorrent_Properties->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/properties.png"))); actionTorrent_Properties->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/properties.png")));
actionSet_upload_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/seeding.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(actionDelete, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_triggered()));
connect(actionPreview_file, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionPreview_file_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())); 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(); QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
QSettings settings("qBittorrent", "qBittorrent"); QSettings settings("qBittorrent", "qBittorrent");
QString previewProgram = settings.value("Options/Misc/PreviewProgram", QString()).toString(); QString previewProgram = settings.value("Options/Misc/PreviewProgram", QString()).toString();
foreach(index, selectedIndexes){ bool has_pause = false, has_start = false, has_preview = false;
if(index.column() == F_NAME){ foreach(index, selectedIndexes) {
if(index.column() == F_NAME) {
// Get the file name // Get the file name
QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString(); QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
// Get handle and pause the torrent
QTorrentHandle h = BTSession->getTorrentHandle(hash); QTorrentHandle h = BTSession->getTorrentHandle(hash);
myFinishedListMenu.addAction(actionDelete); if(!h.is_valid()) continue;
myFinishedListMenu.addAction(actionDelete_Permanently); if(h.is_paused()) {
myFinishedListMenu.addAction(actionSet_upload_limit); if(!has_start) {
myFinishedListMenu.addAction(actionTorrent_Properties); myFinishedListMenu.addAction(actionStart);
if(!previewProgram.isEmpty() && BTSession->isFilePreviewPossible(hash) && selectedIndexes.size()<=finishedListModel->columnCount()){ 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); 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 // Call menu
// XXX: why mapToGlobal() is not enough? // XXX: why mapToGlobal() is not enough?
myFinishedListMenu.exec(mapToGlobal(pos)+QPoint(10,55)); myFinishedListMenu.exec(mapToGlobal(pos)+QPoint(10,55));

4
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(downloadList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayDLListMenu(const QPoint&)));
connect(infoBar, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayInfoBarMenu(const QPoint&))); connect(infoBar, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayInfoBarMenu(const QPoint&)));
// Actions // 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(actionDelete, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_triggered()));
connect(actionPreview_file, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionPreview_file_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())); 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); myDLLlistMenu.addAction(actionTorrent_Properties);
// Call menu // Call menu
// XXX: why mapToGlobal() is not enough? // 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() { void DownloadingTorrents::on_actionClearLog_triggered() {

Loading…
Cancel
Save