1 /* SPDX-FileCopyrightText: 2012-2020 The KPhotoAlbum Development Team
2 
3    SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
4 */
5 
6 #ifndef BACKGROUNDJOBS_HANDLEVIDEOTHUMBNAILREQUESTJOB_H
7 #define BACKGROUNDJOBS_HANDLEVIDEOTHUMBNAILREQUESTJOB_H
8 
9 #include <BackgroundTaskManager/JobInterface.h>
10 
11 #include <QImage>
12 
13 namespace ImageManager
14 {
15 class ImageRequest;
16 class ThumbnailCache;
17 }
18 namespace DB
19 {
20 class FileName;
21 }
22 class QImage;
23 
24 namespace BackgroundJobs
25 {
26 
27 class HandleVideoThumbnailRequestJob : public BackgroundTaskManager::JobInterface
28 {
29     Q_OBJECT
30 public:
31     explicit HandleVideoThumbnailRequestJob(ImageManager::ImageRequest *request, BackgroundTaskManager::Priority priority, ImageManager::ThumbnailCache *thumbnailCache);
32     QString title() const override;
33     QString details() const override;
34     static void saveFullScaleFrame(const DB::FileName &fileName, const QImage &image);
35     static DB::FileName pathForRequest(const DB::FileName &fileName);
36     static DB::FileName frameName(const DB::FileName &videoName, int frameNumber);
37     static void removeFullScaleFrame(const DB::FileName &fileName);
38 
39 protected:
40     void execute() override;
41 
42 private slots:
43     void frameLoaded(QImage);
44 
45 private:
46     void sendResult(QImage image);
47     QImage brokenImage() const;
48 
49     ImageManager::ImageRequest *m_request;
50     ImageManager::ThumbnailCache *m_thumbnailCache;
51 };
52 
53 } // namespace BackgroundJobs
54 
55 #endif // BACKGROUNDJOBS_HANDLEVIDEOTHUMBNAILREQUESTJOB_H
56 // vi:expandtab:tabstop=4 shiftwidth=4:
57