void CFloatingInfoWnd::RebuildList() { if (IsWindow (m_wndList) == FALSE) return; bool bDownloading = false; m_mxList.Lock (); m_wndList.DeleteAllItems (); try{ DLDS_LIST vAddToList, v; _DldsMgr.LockList (true); size_t nCount = _DldsMgr.GetCount (); for (size_t i = 0; i < nCount; i++) { vmsDownloadSmartPtr dld = _DldsMgr.GetDownload (i); if (dld->pMgr->IsRunning ()) { bDownloading = true; vAddToList.push_back (dld); } if (dld->pMgr->IsBittorrent () && dld->pMgr->GetBtDownloadMgr ()->GetUploadSpeed ()) { v.push_back (dld); } } _DldsMgr.UnlockList (true); for (size_t i = 0; i < vAddToList.size (); i++) AddDownloadToList (vAddToList [i], false); for (size_t i = 0; i < v.size (); i++) AddDownloadToList (v [i], true); } catch (...) {} m_mxList.Unlock (); if (m_bNeedToShow && (m_wndList.GetItemCount () == 0 || bDownloading == false)) NeedToShow (FALSE); }
STDMETHODIMP CFDMDownloadsStat::BuildListOfDownloads(BOOL bIncludeCompleted, BOOL bIncludeRunning) { m_vDownloads.clear (); for (size_t i = 0; i < _DldsMgr.GetCount (); i++) { vmsDownloadSmartPtr dld = _DldsMgr.GetDownload (i); bool bAdd = bIncludeRunning && dld->pMgr->IsRunning (); if (bAdd == false) bAdd = bIncludeCompleted && dld->pMgr->IsDone (); if (bAdd) AddDownloadToList (dld); } return S_OK; }