Exemplo n.º 1
0
QList<QSharedPointer<IChunkDownloader>> DownloadManager::getTheFirstUnfinishedChunks(int n)
{
   QList<QSharedPointer<IChunkDownloader>> unfinishedChunks;

   DownloadQueue::ScanningIterator<IsDownloable> i(this->downloadQueue);
   FileDownload* fileDownload;
   while (unfinishedChunks.size() < n && (fileDownload = static_cast<FileDownload*>(i.next())))
   {
      fileDownload->getUnfinishedChunks(unfinishedChunks, n - unfinishedChunks.size(), false); // 'false' because we always want the first (unfinished) chunks.
   }

   return unfinishedChunks;
}
Exemplo n.º 2
0
QList< QSharedPointer<IChunkDownload> > DownloadManager::getTheFirstUnfinishedChunks(int n)
{
   QList< QSharedPointer<IChunkDownload> > unfinishedChunks;

   FileDownload* fileDownload = 0;
   DownloadQueue::ScanningIterator<IsDownloable> i(this->downloadQueue);
   while (unfinishedChunks.size() < n)
   {
      if (!(fileDownload = static_cast<FileDownload*>(i.next())))
          break;
      fileDownload->getUnfinishedChunks(unfinishedChunks, n - unfinishedChunks.size());
   }

   return unfinishedChunks;
}