From c42e5fb2fec9b20fe6956d8798b85874b2eff73e Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Mon, 26 Aug 2019 03:01:55 -0400 Subject: changed total speed and count to a list of the last 5 downloads existing servers now merged when retrieving the download links download manager doesn't store the servers any more, queries the settings every time --- src/downloadmanager.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/downloadmanager.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 45cfdeed..93ca1608 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -288,12 +288,6 @@ void DownloadManager::setOutputDirectory(const QString &outputDirectory) } -void DownloadManager::setServers(const ServerList& servers) -{ - m_Servers = servers; -} - - void DownloadManager::setSupportedExtensions(const QStringList &extensions) { m_SupportedExtensions = extensions; @@ -1669,7 +1663,7 @@ void DownloadManager::nxmFileInfoAvailable(QString gameName, int modID, int file static int evaluateFileInfoMap( const QVariantMap &map, - const QList& preferredServers) + const ServerList::container& preferredServers) { int preference = 0; bool found = false; @@ -1692,8 +1686,9 @@ static int evaluateFileInfoMap( } // sort function to sort by best download server -bool DownloadManager::ServerByPreference( - const QList& preferredServers, +// +bool ServerByPreference( + const ServerList::container& preferredServers, const QVariant &LHS, const QVariant &RHS) { const auto a = evaluateFileInfoMap(LHS.toMap(), preferredServers); @@ -1747,10 +1742,12 @@ void DownloadManager::nxmDownloadURLsAvailable(QString gameName, int modID, int return; } + const auto servers = m_OrganizerCore->settings().getServers(); + std::sort( resultList.begin(), resultList.end(), - boost::bind(&DownloadManager::ServerByPreference, m_Servers.getPreferred(), _1, _2)); + boost::bind(&ServerByPreference, servers.getPreferred(), _1, _2)); info->userData["downloadMap"] = resultList; -- cgit v1.3.1