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 #include <QFuture>
23 #include <QMutex>
24 #include <QWidget>
25 
26 class QComboBox;
27 class QDoubleSpinBox;
28 class QSlider;
29 class QSpinBox;
30 namespace Mlt {
31 class Filter;
32 class Playlist;
33 class Transition;
34 } // namespace Mlt
35 class ProducerPreviewWidget;
36 
37 class SlideshowGeneratorWidget : public QWidget
38 {
39  Q_OBJECT
40 
41 public:
42  SlideshowGeneratorWidget(Mlt::Playlist *clips, QWidget *parent = 0);
43  virtual ~SlideshowGeneratorWidget();
44 
45  Mlt::Playlist *getSlideshow();
46 
47 private slots:
48  void on_parameterChanged();
49 
50 private:
51  struct SlideshowConfig
52  {
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