All Classes Namespaces Functions Variables Enumerations Properties Pages
layeropacitydialog.h
1 #ifndef LAYEROPACITYDIALOG_H
2 #define LAYEROPACITYDIALOG_H
3 
4 #include <QDialog>
5 #include "editor.h"
6 
7 class QTimer;
8 class LayerManager;
9 class PlaybackManager;
10 class Layer;
11 
12 namespace Ui {
13 class LayerOpacityDialog;
14 }
15 
16 enum class OpacityFadeType {
17  IN,
18  OUT
19 };
20 
22 {
23  Q_OBJECT
24 
25 public:
26  explicit LayerOpacityDialog(QWidget *parent = nullptr);
28 
29  void setCore(Editor* editor);
30  void initUI();
31  void updateUI();
32 
33 private slots:
34  void opacitySliderChanged(int value);
35  void opacitySpinboxChanged(double value);
36  void fadeInPressed();
37  void fadeOutPressed();
38 
39  void onObjectLoaded();
40  void onCurrentLayerChanged(int index);
41  void onCurrentFrameChanged(int frame);
42  void onSelectedFramesChanged();
43  void onPlayStateChanged(bool isPlaying);
44  void opacityValueChanged();
45 
46 private:
47 
48  void setCanAdjust(bool opacity, bool fade);
49  void fade(OpacityFadeType fadeType);
50  qreal getOpacityForKeyFrame(Layer* layer, const KeyFrame* keyframe) const;
51  void setOpacityForKeyFrame(Layer* layer, KeyFrame* keyframe, qreal opacity);
52 
53  void updateValues(qreal opacity);
54  void setOpacityForCurrentKeyframe();
55  void setOpacityForSelectedKeyframes();
56  void setOpacityForLayer();
57 
58  Ui::LayerOpacityDialog *ui;
59 
60  Editor* mEditor = nullptr;
61  LayerManager* mLayerManager = nullptr;
62  PlaybackManager* mPlayBack = nullptr;
63 
64  bool mPlayerIsPlaying = false;
65 
66  qreal mMultiplier = 500.0;
67  qreal mSpinBoxMultiplier = 0.2;
68  int mMinSelectedFrames = 3;
69 };
70 
71 #endif // LAYEROPACITYDIALOG_H
Q_OBJECTQ_OBJECT
Definition: layer.h:38
Definition: editor.h:55
QObject * parent() const const