| 315 | |
| 316 | |
| 317 | void CDownloadQueue::StartNextFile(CPartFile* oldfile) |
| 318 | { |
| 319 | if ( thePrefs::StartNextFile() ) { |
| 320 | SFindBestPF visitor = { -1, NULL, thePrefs::StartNextFileAlpha() }; |
| 321 | |
| 322 | { |
| 323 | wxMutexLocker lock(m_mutex); |
| 324 | |
| 325 | if (thePrefs::StartNextFileSame()) { |
| 326 | // Get a download in the same category |
| 327 | visitor.m_category = oldfile->GetCategory(); |
| 328 | |
| 329 | visitor = std::for_each(m_filelist.begin(), m_filelist.end(), visitor); |
| 330 | } |
| 331 | |
| 332 | if (visitor.m_result == NULL) { |
| 333 | // Get a download, regardless of category |
| 334 | visitor.m_category = -1; |
| 335 | |
| 336 | visitor = std::for_each(m_filelist.begin(), m_filelist.end(), visitor); |
| 337 | } |
| 338 | |
| 339 | // Alpha doesn't need special cases |
| 340 | } |
| 341 | |
| 342 | if (visitor.m_result) { |
| 343 | visitor.m_result->ResumeFile(); |
| 344 | } |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | |
| 349 | void CDownloadQueue::AddDownload(CPartFile* file, bool paused, uint8 category) |
no test coverage detected