File indexing completed on 2024-04-28 15:39:47

0001 // SPDX-FileCopyrightText: 2012-2022 The KPhotoAlbum Development Team
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #ifndef BACKGROUNDJOBS_HANDLEVIDEOTHUMBNAILREQUESTJOB_H
0006 #define BACKGROUNDJOBS_HANDLEVIDEOTHUMBNAILREQUESTJOB_H
0007 
0008 #include <BackgroundTaskManager/JobInterface.h>
0009 
0010 #include <QImage>
0011 
0012 namespace ImageManager
0013 {
0014 class ImageRequest;
0015 class ThumbnailCache;
0016 }
0017 namespace DB
0018 {
0019 class FileName;
0020 }
0021 class QImage;
0022 
0023 namespace BackgroundJobs
0024 {
0025 
0026 class HandleVideoThumbnailRequestJob : public BackgroundTaskManager::JobInterface
0027 {
0028     Q_OBJECT
0029 public:
0030     explicit HandleVideoThumbnailRequestJob(ImageManager::ImageRequest *request, BackgroundTaskManager::Priority priority, ImageManager::ThumbnailCache *thumbnailCache);
0031     QString title() const override;
0032     QString details() const override;
0033     static void saveFullScaleFrame(const DB::FileName &fileName, const QImage &image);
0034     static DB::FileName pathForRequest(const DB::FileName &fileName);
0035     static DB::FileName frameName(const DB::FileName &videoName, int frameNumber);
0036     static void removeFullScaleFrame(const DB::FileName &fileName);
0037 
0038 protected:
0039     void execute() override;
0040 
0041 private Q_SLOTS:
0042     void frameLoaded(QImage);
0043 
0044 private:
0045     void sendResult(QImage image);
0046     QImage brokenImage() const;
0047 
0048     ImageManager::ImageRequest *m_request;
0049     ImageManager::ThumbnailCache *m_thumbnailCache;
0050 };
0051 
0052 } // namespace BackgroundJobs
0053 
0054 #endif // BACKGROUNDJOBS_HANDLEVIDEOTHUMBNAILREQUESTJOB_H
0055 // vi:expandtab:tabstop=4 shiftwidth=4: