Changeset View
Changeset View
Standalone View
Standalone View
src/assets/view/widgets/keyframewidget.hpp
Show All 15 Lines | |||||
16 | * You should have received a copy of the GNU General Public License * | 16 | * You should have received a copy of the GNU General Public License * | ||
17 | * along with Kdenlive. If not, see <http://www.gnu.org/licenses/>. * | 17 | * along with Kdenlive. If not, see <http://www.gnu.org/licenses/>. * | ||
18 | ***************************************************************************/ | 18 | ***************************************************************************/ | ||
19 | 19 | | |||
20 | #ifndef KEYFRAMEWIDGET_H | 20 | #ifndef KEYFRAMEWIDGET_H | ||
21 | #define KEYFRAMEWIDGET_H | 21 | #define KEYFRAMEWIDGET_H | ||
22 | 22 | | |||
23 | #include "abstractparamwidget.hpp" | 23 | #include "abstractparamwidget.hpp" | ||
24 | | ||||
25 | #include "definitions.h" | 24 | #include "definitions.h" | ||
26 | #include <QPersistentModelIndex> | 25 | #include <QPersistentModelIndex> | ||
27 | #include <memory> | 26 | #include <memory> | ||
28 | #include <unordered_map> | 27 | #include <unordered_map> | ||
29 | 28 | | |||
30 | class AssetParameterModel; | 29 | class AssetParameterModel; | ||
31 | class DoubleWidget; | 30 | class DoubleWidget; | ||
32 | class KeyframeView; | 31 | class KeyframeView; | ||
33 | class KeyframeModelList; | 32 | class KeyframeModelList; | ||
34 | class QVBoxLayout; | 33 | class QVBoxLayout; | ||
35 | class QToolButton; | 34 | class QToolButton; | ||
36 | class TimecodeDisplay; | 35 | class TimecodeDisplay; | ||
37 | class KSelectAction; | 36 | class KSelectAction; | ||
37 | class Monitor; | ||||
38 | 38 | | |||
39 | class KeyframeWidget : public AbstractParamWidget | 39 | class KeyframeWidget : public AbstractParamWidget | ||
40 | { | 40 | { | ||
41 | Q_OBJECT | 41 | Q_OBJECT | ||
42 | 42 | | |||
43 | public: | 43 | public: | ||
44 | explicit KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent = nullptr); | 44 | explicit KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent = nullptr); | ||
45 | ~KeyframeWidget(); | 45 | ~KeyframeWidget(); | ||
46 | 46 | | |||
47 | /* @brief Add a new parameter to be managed using the same keyframe viewer */ | 47 | /* @brief Add a new parameter to be managed using the same keyframe viewer */ | ||
48 | void addParameter(const QPersistentModelIndex &index); | 48 | void addParameter(const QPersistentModelIndex &index); | ||
49 | int getPosition() const; | 49 | int getPosition() const; | ||
50 | void addKeyframe(int pos = -1); | 50 | void addKeyframe(int pos = -1); | ||
51 | 51 | | |||
52 | void updateTimecodeFormat(); | 52 | void updateTimecodeFormat(); | ||
53 | const QString getValue() const; | ||||
53 | 54 | | |||
54 | void slotSetRange(QPair<int, int> range) override; | 55 | void slotSetRange(QPair<int, int> range) override; | ||
55 | void slotRefresh() override; | 56 | void slotRefresh() override; | ||
56 | public slots: | 57 | public slots: | ||
57 | void slotSetPosition(int pos = -1, bool update = true); | 58 | void slotSetPosition(int pos = -1, bool update = true); | ||
58 | 59 | | |||
59 | private slots: | 60 | private slots: | ||
60 | /* brief Update the value of the widgets to reflect keyframe change */ | 61 | /* brief Update the value of the widgets to reflect keyframe change */ | ||
61 | void slotRefreshParams(); | 62 | void slotRefreshParams(); | ||
62 | void slotAtKeyframe(bool atKeyframe, bool singleKeyframe); | 63 | void slotAtKeyframe(bool atKeyframe, bool singleKeyframe); | ||
63 | void monitorSeek(int pos); | 64 | void monitorSeek(int pos); | ||
64 | void slotEditKeyframeType(QAction *action); | 65 | void slotEditKeyframeType(QAction *action); | ||
65 | 66 | | |||
67 | signals: | ||||
68 | void valueChanged(const QString val); | ||||
69 | | ||||
66 | private: | 70 | private: | ||
67 | QVBoxLayout *m_lay; | 71 | QVBoxLayout *m_lay; | ||
72 | Monitor *m_monitor; | ||||
68 | std::shared_ptr<KeyframeModelList> m_keyframes; | 73 | std::shared_ptr<KeyframeModelList> m_keyframes; | ||
74 | QSize m_defaultSize; | ||||
69 | 75 | | |||
70 | KeyframeView *m_keyframeview; | 76 | KeyframeView *m_keyframeview; | ||
71 | QToolButton *m_buttonAddDelete; | 77 | QToolButton *m_buttonAddDelete; | ||
72 | QToolButton *m_buttonPrevious; | 78 | QToolButton *m_buttonPrevious; | ||
73 | QToolButton *m_buttonNext; | 79 | QToolButton *m_buttonNext; | ||
74 | KSelectAction *m_selectType; | 80 | KSelectAction *m_selectType; | ||
75 | TimecodeDisplay *m_time; | 81 | TimecodeDisplay *m_time; | ||
76 | 82 | DoubleWidget *m_rotationWidget; | |||
83 | void connectMonitor(bool active); | ||||
77 | std::unordered_map<QPersistentModelIndex, QWidget *> m_parameters; | 84 | std::unordered_map<QPersistentModelIndex, QWidget *> m_parameters; | ||
78 | }; | 85 | }; | ||
79 | 86 | | |||
80 | #endif | 87 | #endif |