1 /*
2     SPDX-FileCopyrightText: 2008 Jean-Baptiste Mardelle <jb@kdenlive.org>
3 
4 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5 */
6 
7 #ifndef SLIDESHOWCLIP_H
8 #define SLIDESHOWCLIP_H
9 
10 #include "definitions.h"
11 #include "timecode.h"
12 #include "ui_slideshowclip_ui.h"
13 
14 #include <KIO/PreviewJob>
15 
16 class ProjectClip;
17 
18 class SlideshowClip : public QDialog
19 {
20     Q_OBJECT
21 
22 public:
23     explicit SlideshowClip(const Timecode &tc, QString clipFolder, ProjectClip *clip = nullptr, QWidget *parent = nullptr);
24     ~SlideshowClip() override;
25     /** return selected path for slideshow in MLT format */
26     QString selectedPath();
27     QString clipName() const;
28     QString clipDuration() const;
29     QString lumaDuration() const;
30     int imageCount() const;
31     bool loop() const;
32     bool crop() const;
33     bool fade() const;
34     QString lumaFile() const;
35     int softness() const;
36     QString animation() const;
37 
38     /** @brief Get the image frame number from a file path, for example image_047.jpg will return 47. */
39     static int getFrameNumberFromPath(const QUrl &path);
40     /** @brief return the url pattern for selected slideshow. */
41     static QString selectedPath(const QUrl &url, bool isMime, QString extension, QStringList *list);
42     /** @brief Convert the selection animation style into an affine geometry string. */
43     static QString animationToGeometry(const QString &animation, int &ttl);
44 
45 private slots:
46     void parseFolder();
47     void slotEnableLuma(int state);
48     void slotEnableThumbs(int state);
49     void slotEnableLumaFile(int state);
50     void slotUpdateDurationFormat(int ix);
51     void slotGenerateThumbs();
52     void slotSetPixmap(const KFileItem &fileItem, const QPixmap &pix);
53     /** @brief Display correct widget depending on user choice (MIME type or pattern method). */
54     void slotMethodChanged(bool active);
55 
56 private:
57     Ui::SlideshowClip_UI m_view;
58     int m_count;
59     Timecode m_timecode;
60     KIO::PreviewJob *m_thumbJob;
61 };
62 
63 #endif
64