mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-06 06:09:22 +00:00
Let the download list own its downloads through a shared pointer.
A multicall could then dispatch commands on an erased download.
This commit is contained in:
+5
-2
@@ -1,3 +1,4 @@
|
||||
#include <memory>
|
||||
#include "config.h"
|
||||
|
||||
#include <cassert>
|
||||
@@ -30,8 +31,10 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
Download::Download(core::Download* d)
|
||||
: m_download(d) {
|
||||
Download::Download(const std::shared_ptr<core::Download>& download)
|
||||
: m_download(download.get()) {
|
||||
|
||||
auto* d = download.get();
|
||||
|
||||
m_windowDownloadStatus = std::make_unique<WDownloadStatus>(d);
|
||||
m_windowDownloadStatus->set_bottom(true);
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
#define RTORRENT_UI_DOWNLOAD_H
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <torrent/peer/peer.h>
|
||||
|
||||
#include "display/manager.h"
|
||||
@@ -36,7 +37,7 @@ public:
|
||||
DISPLAY_MAX_SIZE
|
||||
} Display;
|
||||
|
||||
Download(core::Download* d);
|
||||
Download(const std::shared_ptr<core::Download>& d);
|
||||
~Download();
|
||||
|
||||
void activate(display::Frame* frame, bool focus = true);
|
||||
|
||||
@@ -89,7 +89,7 @@ DownloadList::unfocus_download(core::Download* d) {
|
||||
if (m_state == DISPLAY_DOWNLOAD && d == static_cast<Download*>(m_uiArray[DISPLAY_DOWNLOAD])->download())
|
||||
activate_display(DISPLAY_DOWNLOAD_LIST);
|
||||
|
||||
if (current_view()->focus() < current_view()->end_visible() && *current_view()->focus() == d)
|
||||
if (current_view()->focus() < current_view()->end_visible() && current_view()->focus()->get() == d)
|
||||
current_view()->next_focus();
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ ElementDownloadList::receive_cycle_throttle() {
|
||||
if (m_view->focus() == m_view->end_visible())
|
||||
return;
|
||||
|
||||
core::Download* download = *m_view->focus();
|
||||
core::Download* download = m_view->focus()->get();
|
||||
if (download->is_active()) {
|
||||
lt_log_print(torrent::LOG_TORRENT_WARN, "Cannot change throttle on active download.");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user