Olive
effectfield.h
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef EFFECTFIELD_H
22 #define EFFECTFIELD_H
23 
24 enum EffectFieldType {
25  EFFECT_FIELD_DOUBLE,
26  EFFECT_FIELD_COLOR,
27  EFFECT_FIELD_STRING,
28  EFFECT_FIELD_BOOL,
29  EFFECT_FIELD_COMBO,
30  EFFECT_FIELD_FONT,
31  EFFECT_FIELD_FILE
32 };
33 
34 #include <QObject>
35 #include <QVariant>
36 #include <QVector>
37 
38 #include "keyframe.h"
39 
40 class EffectRow;
41 class ComboAction;
42 
43 class EffectField : public QObject {
44  Q_OBJECT
45 public:
46  EffectField(EffectRow* parent, int t, const QString& i);
47  ~EffectField();
48 
49  EffectRow* parent_row;
50  int type;
51  QString id;
52 
53  double get_validated_keyframe_handle(int key, bool post);
54 
55  QVariant get_previous_data();
56  QVariant get_current_data();
57  double frameToTimecode(long frame);
58  long timecodeToFrame(double timecode);
59  void set_current_data(const QVariant&);
60  void get_keyframe_data(double timecode, int& before, int& after, double& d);
61  QVariant validate_keyframe_data(double timecode, bool async = false);
62 
63  double get_double_value(double timecode, bool async = false);
64  void set_double_value(double v);
65  void set_double_default_value(double v);
66  void set_double_minimum_value(double v);
67  void set_double_maximum_value(double v);
68 
69  QString get_string_value(double timecode, bool async = false);
70  void set_string_value(const QString &s);
71 
72  void add_combo_item(const QString& name, const QVariant &data);
73  int get_combo_index(double timecode, bool async = false);
74  QVariant get_combo_data(double timecode);
75  QString get_combo_string(double timecode);
76  void set_combo_index(int index);
77  void set_combo_string(const QString& s);
78 
79  bool get_bool_value(double timecode, bool async = false);
80  void set_bool_value(bool b);
81 
82  QString get_font_name(double timecode, bool async = false);
83  void set_font_name(const QString& s);
84 
85  QColor get_color_value(double timecode, bool async = false);
86  void set_color_value(QColor color);
87 
88  QString get_filename(double timecode, bool async = false);
89  void set_filename(const QString& s);
90 
91  QWidget* get_ui_element();
92  bool is_enabled();
93  void set_enabled(bool e);
94  QVector<EffectKeyframe> keyframes;
95  QWidget* ui_element;
96 
97  void make_key_from_change(ComboAction* ca);
98 public slots:
99  void ui_element_change();
100 private:
101  bool hasKeyframes();
102 signals:
103  void changed();
104  void toggled(bool);
105  void clicked();
106 };
107 
108 #endif // EFFECTFIELD_H
Definition: undo.h:52
Definition: effectrow.h:37
Definition: effectfield.h:43