1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#include "downloadmanagerproxy.h"
#include "organizerproxy.h"
#include "proxyutils.h"
using namespace MOBase;
using namespace MOShared;
DownloadManagerProxy::DownloadManagerProxy(OrganizerProxy* oproxy,
DownloadManager* downloadManager)
: m_OrganizerProxy(oproxy), m_Proxied(downloadManager)
{}
DownloadManagerProxy::~DownloadManagerProxy()
{
disconnectSignals();
}
void DownloadManagerProxy::connectSignals()
{
m_Connections.push_back(m_Proxied->onDownloadComplete(
callSignalIfPluginActive(m_OrganizerProxy, m_DownloadComplete)));
m_Connections.push_back(m_Proxied->onDownloadFailed(
callSignalIfPluginActive(m_OrganizerProxy, m_DownloadFailed)));
m_Connections.push_back(m_Proxied->onDownloadRemoved(
callSignalIfPluginActive(m_OrganizerProxy, m_DownloadRemoved)));
m_Connections.push_back(m_Proxied->onDownloadPaused(
callSignalIfPluginActive(m_OrganizerProxy, m_DownloadPaused)));
}
void DownloadManagerProxy::disconnectSignals()
{
for (auto& conn : m_Connections) {
conn.disconnect();
}
m_Connections.clear();
}
int DownloadManagerProxy::startDownloadURLs(const QStringList& urls)
{
return m_Proxied->startDownloadURLs(urls);
}
int DownloadManagerProxy::startDownloadNexusFile(int modID, int fileID)
{
return m_Proxied->startDownloadNexusFile(
m_OrganizerProxy->managedGame()->gameNexusName(), modID, fileID);
}
int DownloadManagerProxy::startDownloadNexusFileForGame(const QString& gameName,
int modID, int fileID)
{
return m_Proxied->startDownloadNexusFile(gameName, modID, fileID);
}
QString DownloadManagerProxy::downloadPath(int id)
{
return m_Proxied->downloadPath(id);
}
bool DownloadManagerProxy::onDownloadComplete(const std::function<void(int)>& callback)
{
return m_DownloadComplete.connect(callback).connected();
}
bool DownloadManagerProxy::onDownloadPaused(const std::function<void(int)>& callback)
{
return m_DownloadPaused.connect(callback).connected();
}
bool DownloadManagerProxy::onDownloadFailed(const std::function<void(int)>& callback)
{
return m_DownloadFailed.connect(callback).connected();
}
bool DownloadManagerProxy::onDownloadRemoved(const std::function<void(int)>& callback)
{
return m_DownloadRemoved.connect(callback).connected();
}
|