File indexing completed on 2024-03-03 05:04:11

0001 /*
0002     SPDX-FileCopyrightText: 2008 Jean-Baptiste Mardelle <jb@kdenlive.org>
0003 
0004 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include "definitions.h"
0010 #include "utils/timecode.h"
0011 #include "ui_slideshowclip_ui.h"
0012 
0013 #include <KIO/PreviewJob>
0014 
0015 class ProjectClip;
0016 
0017 class SlideshowClip : public QDialog
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     explicit SlideshowClip(const Timecode &tc, QString clipFolder, ProjectClip *clip = nullptr, QWidget *parent = nullptr);
0023     ~SlideshowClip() override;
0024     /** return selected path for slideshow in MLT format */
0025     QString selectedPath();
0026     QString clipName() const;
0027     QString clipDuration() const;
0028     QString lumaDuration() const;
0029     int imageCount() const;
0030     bool loop() const;
0031     bool crop() const;
0032     bool fade() const;
0033     QString lumaFile() const;
0034     int softness() const;
0035     QString animation() const;
0036     /** @brief Should we add a low-pass (blur) filter */
0037     int lowPass() const;
0038     /** @brief The selected image extension */
0039     const QString extension() const;
0040 
0041     /** @brief Get the image frame number from a file path, for example image_047.jpg will return 47. */
0042     static int getFrameNumberFromPath(const QUrl &path);
0043     /** @brief return the url pattern for selected slideshow. */
0044     static QString selectedPath(const QUrl &url, bool isMime, QString extension, QStringList *list);
0045     /** @brief Convert the selection animation style into an affine geometry string. */
0046     static QString animationToGeometry(const QString &animation, int &ttl);
0047 
0048 private Q_SLOTS:
0049     void parseFolder();
0050     void slotEnableLuma(int state);
0051     void slotEnableThumbs(int state);
0052     void slotEnableLumaFile(int state);
0053     void slotUpdateDurationFormat(int ix);
0054     void slotGenerateThumbs();
0055     void slotSetPixmap(const KFileItem &fileItem, const QPixmap &pix);
0056     /** @brief Display correct widget depending on user choice (MIME type or pattern method). */
0057     void slotMethodChanged(bool active);
0058 
0059 private:
0060     Ui::SlideshowClip_UI m_view;
0061     int m_count;
0062     Timecode m_timecode;
0063     KIO::PreviewJob *m_thumbJob;
0064 };