MCPcopy Create free account
hub / github.com/amule-project/amule / AddDownload

Method AddDownload

src/DownloadQueue.cpp:349–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347
348
349void CDownloadQueue::AddDownload(CPartFile* file, bool paused, uint8 category)
350{
351 wxCHECK_RET(!IsFileExisting(file->GetFileHash()), "Adding duplicate part-file");
352
353 if (file->GetStatus(true) == PS_ALLOCATING) {
354 file->PauseFile();
355 } else if (paused && GetFileCount()) {
356 file->StopFile();
357 }
358
359 {
360 wxMutexLocker lock(m_mutex);
361 m_filelist.push_back( file );
362 DoSortByPriority();
363 }
364
365 NotifyObservers( EventType( EventType::INSERTED, file ) );
366 if (category < theApp->glob_prefs->GetCatCount()) {
367 file->SetCategory(category);
368 } else {
369 AddDebugLogLineN( logDownloadQueue, "Tried to add download into invalid category." );
370 }
371 Notify_DownloadCtrlAddFile( file );
372 theApp->searchlist->UpdateSearchFileByHash(file->GetFileHash()); // Update file in the search dialog if it's still open
373 AddLogLineC(CFormat(_("Downloading %s")) % file->GetFileName() );
374}
375
376
377bool CDownloadQueue::IsFileExisting( const CMD4Hash& fileid ) const

Callers 1

performConvertToeMuleMethod · 0.80

Calls 8

CFormatClass · 0.85
PauseFileMethod · 0.80
StopFileMethod · 0.80
GetCatCountMethod · 0.80
SetCategoryMethod · 0.80
EventTypeEnum · 0.70
GetStatusMethod · 0.45

Tested by

no test coverage detected