LCOV - code coverage report
Current view: top level - src/utilities - ImageGrabber.h (source / functions) Coverage Total Hit
Test: coverage.info.cleaned Lines: 100.0 % 2 2
Test Date: 2026-04-19 00:35:54 Functions: 100.0 % 1 1

            Line data    Source code
       1              : #ifndef IMAGEGRABBER_H
       2              : #define IMAGEGRABBER_H
       3              : 
       4              : #include <QObject>
       5              : #include <QFutureWatcher>
       6              : #include <QList>
       7              : #include <QUrl>
       8              : #include <QMap>
       9              : 
      10              : #include "ImageData.h"
      11              : #include <QObject>
      12              : 
      13              : class QBatchWebDownload;
      14              : class QNetworkAccessManager;
      15              : 
      16              : /*!
      17              :     \brief The ImageGrabber attempts to download all images from a list of URLs.
      18              : 
      19              :     Uses QBatchWebDownload internally to handle parallel downloads with
      20              :     redirect and timeout handling.
      21              :  */
      22              : class ImageGrabber : public QObject
      23              : {
      24              :     Q_OBJECT
      25              : public:
      26              :     explicit ImageGrabber(QObject *parent = nullptr, QNetworkAccessManager* networkManager = nullptr);
      27              : 
      28              : signals:
      29              :     /*!
      30              :         \brief Called when all images are found.
      31              :      */
      32              :     void finished();
      33              : 
      34              : public slots:
      35              : 
      36              :     /*!
      37              :         \brief Fetch a group of remote images.
      38              :         \param urls
      39              :      */
      40              :     void fetchUrls(const QList<QUrl> &urls);
      41              : 
      42              :     /*!
      43              :         \brief Fetch a remote image.
      44              :         \param url
      45              :      */
      46              :     void fetchUrl(const QUrl &url);
      47           32 : 
      48           28 :     inline QMap<QUrl, ImageData>* getResults() { return &results; }
      49              : 
      50              : private slots:
      51              :     void onBatchFinished();
      52              : 
      53              : private:
      54              :     QBatchWebDownload* batchDownloader;
      55              :     QMap<QUrl, ImageData> results;
      56              :     QFutureWatcher<void> processWatcher;
      57              : };
      58              : 
      59              : #endif // IMAGEGRABBER_H
        

Generated by: LCOV version 2.0-1