CuteLogger
Fast and simple logging solution for Qt based applications
slideshowgeneratorwidget.h
1/*
2 * Copyright (c) 2020-2022 Meltytech, LLC
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef SLIDESHOWGENERATORWIDGET_H
19#define SLIDESHOWGENERATORWIDGET_H
20
21#include <MltProducer.h>
22
23#include <QFuture>
24#include <QMutex>
25#include <QWidget>
26
27class QComboBox;
28class QDoubleSpinBox;
29class QSlider;
30class QSpinBox;
31namespace Mlt {
32class Filter;
33class Playlist;
34class Transition;
35}
36class ProducerPreviewWidget;
37
38class SlideshowGeneratorWidget : public QWidget
39{
40 Q_OBJECT
41
42public:
43 SlideshowGeneratorWidget(Mlt::Playlist *clips, QWidget *parent = 0);
44 virtual ~SlideshowGeneratorWidget();
45
46 Mlt::Playlist *getSlideshow();
47
48private slots:
49 void on_parameterChanged();
50
51private:
52 struct SlideshowConfig {
53 double clipDuration;
54 int aspectConversion;
55 int zoomPercent;
56 double transitionDuration;
57 int transitionStyle;
58 int transitionSoftness;
59 };
60
61 void attachAffineFilter(SlideshowConfig &config, Mlt::Producer *producer, int endPosition);
62 void attachBlurFilter(SlideshowConfig &config, Mlt::Producer *producer);
63 void applyLumaTransitionProperties(Mlt::Transition *luma, SlideshowConfig &config);
64 void generatePreviewSlideshow();
65 Q_INVOKABLE void startPreview();
66
67 QDoubleSpinBox *m_clipDurationSpinner;
68 QComboBox *m_aspectConversionCombo;
69 QSpinBox *m_zoomPercentSpinner;
70 QDoubleSpinBox *m_transitionDurationSpinner;
71 QComboBox *m_transitionStyleCombo;
72 QSpinBox *m_softnessSpinner;
73 ProducerPreviewWidget *m_preview;
74 Mlt::Playlist *m_clips;
75
76 // Mutext Protected Members
77 QFuture<void> m_future;
78 QMutex m_mutex;
79 bool m_refreshPreview;
80 SlideshowConfig m_config;
81 Mlt::Producer m_previewProducer;
82};
83
84#endif // SLIDESHOWGENERATORWIDGET_H