From 52dd1476dbe806e8ba5b7beb36b23de73aac3d61 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 7 Jan 2010 18:17:20 +0000 Subject: [PATCH] - Fix addInPause setting in torrent addition dialog --- src/GUI.h | 1 + src/torrentadditiondlg.h | 12 ++++++++++-- src/transferlistwidget.h | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/GUI.h b/src/GUI.h index e20c80ef8..2c4dfeaab 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -157,6 +157,7 @@ public: // Methods int getCurrentTabIndex() const; QPoint screenCenter() const; + TransferListWidget* getTransferList() const { return transferList; } }; #endif diff --git a/src/torrentadditiondlg.h b/src/torrentadditiondlg.h index 45e7abd8f..28fc74507 100644 --- a/src/torrentadditiondlg.h +++ b/src/torrentadditiondlg.h @@ -52,6 +52,8 @@ #include "torrentpersistentdata.h" #include "torrentfilesmodel.h" #include "preferences.h" +#include "GUI.h" +#include "transferlistwidget.h" using namespace libtorrent; @@ -72,9 +74,10 @@ private: bool is_magnet; public: - torrentAdditionDialog(QWidget *parent, Bittorrent* _BTSession) : QDialog(parent) { + torrentAdditionDialog(GUI *parent, Bittorrent* _BTSession) : QDialog((QWidget*)parent) { setupUi(this); setAttribute(Qt::WA_DeleteOnClose); + connect(this, SIGNAL(torrentPaused(QTorrentHandle&)), parent->getTransferList(), SLOT(pauseTorrent(QTorrentHandle&))); BTSession = _BTSession; // Set Properties list model PropListModel = new TorrentFilesModel(); @@ -484,10 +487,15 @@ public slots: h = BTSession->addMagnetUri(from_url, false); else h = BTSession->addTorrent(filePath, false, from_url); - if(addInPause->isChecked() && h.is_valid()) + if(addInPause->isChecked() && h.is_valid()) { h.pause(); + emit torrentPaused(h); + } close(); } + + signals: + void torrentPaused(QTorrentHandle &h); }; #endif diff --git a/src/transferlistwidget.h b/src/transferlistwidget.h index 55f0ab208..10f6206e8 100644 --- a/src/transferlistwidget.h +++ b/src/transferlistwidget.h @@ -83,7 +83,6 @@ protected slots: void displayListMenu(const QPoint&); void updateMetadata(QTorrentHandle &h); void currentChanged(const QModelIndex& current, const QModelIndex&); - void pauseTorrent(QTorrentHandle &h); void resumeTorrent(QTorrentHandle &h); #ifdef LIBTORRENT_0_15 void toggleSelectedTorrentsSuperSeeding(); @@ -96,6 +95,7 @@ protected slots: public slots: void refreshList(); void addTorrent(QTorrentHandle& h); + void pauseTorrent(QTorrentHandle &h); void setFinished(QTorrentHandle &h); void setSelectionLabel(QString label); void setRefreshInterval(int t);