Olive
effectfield.h
Go to the documentation of this file.
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 
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 
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 
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
QString get_filename(double timecode, bool async=false)
Definition: effectfield.cpp:479
QString get_combo_string(double timecode)
Definition: effectfield.cpp:418
void set_bool_value(bool b)
Definition: effectfield.cpp:439
Definition: effectfield.h:29
EffectField(EffectRow *parent, int t, const QString &i)
Definition: effectfield.cpp:47
int get_combo_index(double timecode, bool async=false)
Definition: effectfield.cpp:405
QVariant validate_keyframe_data(double timecode, bool async=false)
Definition: effectfield.cpp:246
void set_double_default_value(double v)
Definition: effectfield.cpp:389
void set_font_name(const QString &s)
Definition: effectfield.cpp:463
void clicked()
long timecodeToFrame(double timecode)
Definition: effectfield.cpp:190
Definition: effectfield.h:27
Definition: effectfield.h:30
double frameToTimecode(long frame)
Definition: effectfield.cpp:186
The ComboAction class.
Definition: comboaction.h:19
void set_current_data(const QVariant &)
Definition: effectfield.cpp:194
void ui_element_change()
Definition: effectfield.cpp:347
void set_combo_string(const QString &s)
Definition: effectfield.cpp:427
double get_double_value(double timecode, bool async=false)
Definition: effectfield.cpp:377
void set_string_value(const QString &s)
Definition: effectfield.cpp:451
QWidget * get_ui_element()
Definition: effectfield.cpp:365
QVector< EffectKeyframe > keyframes
Definition: effectfield.h:94
Definition: effectrow.h:37
void toggled(bool)
void get_keyframe_data(double timecode, int &before, int &after, double &d)
Definition: effectfield.cpp:206
bool is_enabled()
Definition: effectfield.cpp:369
Definition: effectfield.h:25
void set_double_value(double v)
Definition: effectfield.cpp:385
void make_key_from_change(ComboAction *ca)
Definition: effectfield.cpp:356
QString id
Definition: effectfield.h:51
void set_enabled(bool e)
Definition: effectfield.cpp:373
QVariant get_combo_data(double timecode)
Definition: effectfield.cpp:413
bool hasKeyframes()
Definition: effectfield.cpp:242
Definition: effectfield.h:26
void set_double_maximum_value(double v)
Definition: effectfield.cpp:397
double get_validated_keyframe_handle(int key, bool post)
Definition: effectfield.cpp:114
QString get_font_name(double timecode, bool async=false)
Definition: effectfield.cpp:455
void changed()
Definition: effectfield.h:28
void set_color_value(QColor color)
Definition: effectfield.cpp:475
QColor get_color_value(double timecode, bool async=false)
Definition: effectfield.cpp:467
void set_filename(const QString &s)
Definition: effectfield.cpp:487
bool get_bool_value(double timecode, bool async=false)
Definition: effectfield.cpp:431
EffectFieldType
Definition: effectfield.h:24
void add_combo_item(const QString &name, const QVariant &data)
Definition: effectfield.cpp:401
QVariant get_previous_data()
Definition: effectfield.cpp:160
Definition: effectfield.h:43
~EffectField()
Definition: effectfield.cpp:112
void set_double_minimum_value(double v)
Definition: effectfield.cpp:393
int type
Definition: effectfield.h:50
void set_combo_index(int index)
Definition: effectfield.cpp:423
QString get_string_value(double timecode, bool async=false)
Definition: effectfield.cpp:443
QVariant get_current_data()
Definition: effectfield.cpp:173
QWidget * ui_element
Definition: effectfield.h:95
EffectRow * parent_row
Definition: effectfield.h:49
Definition: effectfield.h:31