File: effectfield.h

package info (click to toggle)
olive-editor 20181223-2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 2,844 kB
  • sloc: cpp: 20,147; xml: 315; ansic: 16; makefile: 11
file content (74 lines) | stat: -rw-r--r-- 2,240 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef EFFECTFIELD_H
#define EFFECTFIELD_H

#define EFFECT_FIELD_DOUBLE 0
#define EFFECT_FIELD_COLOR 1
#define EFFECT_FIELD_STRING 2
#define EFFECT_FIELD_BOOL 3
#define EFFECT_FIELD_COMBO 4
#define EFFECT_FIELD_FONT 5

#include <QObject>
#include <QVariant>
#include <QVector>

class EffectRow;
class ComboAction;

class EffectField : public QObject {
    Q_OBJECT
public:
    EffectField(EffectRow* parent, int t, const QString& i);
    EffectRow* parent_row;
    int type;
    QString id;

    QVariant get_previous_data();
    QVariant get_current_data();
    double frameToTimecode(long frame);
    long timecodeToFrame(double timecode);
    void set_current_data(const QVariant&);
    void get_keyframe_data(double timecode, int& before, int& after, double& d);
    QVariant validate_keyframe_data(double timecode, bool async = false);

    double get_double_value(double timecode, bool async = false);
    void set_double_value(double v);
    void set_double_default_value(double v);
    void set_double_minimum_value(double v);
    void set_double_maximum_value(double v);

    const QString get_string_value(double timecode, bool async = false);
    void set_string_value(const QString &s);

    void add_combo_item(const QString& name, const QVariant &data);
    int get_combo_index(double timecode, bool async = false);
    const QVariant get_combo_data(double timecode);
    const QString get_combo_string(double timecode);
    void set_combo_index(int index);
    void set_combo_string(const QString& s);

    bool get_bool_value(double timecode, bool async = false);
    void set_bool_value(bool b);

    const QString get_font_name(double timecode, bool async = false);
    void set_font_name(const QString& s);

    QColor get_color_value(double timecode, bool async = false);
    void set_color_value(QColor color);

    QWidget* get_ui_element();
    void set_enabled(bool e);
    QVector<QVariant> keyframe_data;
    QWidget* ui_element;

    void make_key_from_change(ComboAction* ca);
private:
    bool hasKeyframes();
private slots:
    void ui_element_change();
signals:
    void changed();
    void toggled(bool);
};

#endif // EFFECTFIELD_H