CuteLogger
Fast and simple logging solution for Qt based applications
keyframesdock.h
1/*
2 * Copyright (c) 2016-2026 Meltytech, LLC
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef KEYFRAMESDOCK_H
19#define KEYFRAMESDOCK_H
20
21#include "models/keyframesmodel.h"
22#include "qmltypes/qmlfilter.h"
23
24#include <QDockWidget>
25#include <QQuickWidget>
26#include <QScopedPointer>
27
28class QmlFilter;
29class QmlMetadata;
30class AttachedFiltersModel;
31class QmlProducer;
32class QMenu;
33
34class KeyframesDock : public QDockWidget
35{
36 Q_OBJECT
37 Q_PROPERTY(double timeScale READ timeScale WRITE setTimeScale NOTIFY timeScaleChanged)
38
39public:
40 explicit KeyframesDock(QmlProducer *qmlProducer, QWidget *parent = 0);
41
42 KeyframesModel &model() { return m_model; }
43 Q_INVOKABLE int seekPrevious();
44 Q_INVOKABLE int seekNext();
45 int currentParameter() const;
46 double timeScale() const { return m_timeScale; }
47 void setTimeScale(double value);
48 void setZoomScale(double scale);
49
50signals:
51 void changed();
52 void setZoom(double value);
53 void zoomIn();
54 void zoomOut();
55 void zoomToFit();
56 void resetZoom();
57 void seekPreviousSimple();
58 void seekNextSimple();
59 void newFilter(); // Notifies when the filter itself has been changed
60 void timeScaleChanged();
61 void dockClicked();
62
63public slots:
64 void setCurrentFilter(QmlFilter *filter, QmlMetadata *meta);
65 void load(bool force = false);
66 void reload();
67 void onProducerModified();
68
69protected:
70 bool event(QEvent *event);
71 void keyPressEvent(QKeyEvent *event);
72 void keyReleaseEvent(QKeyEvent *event);
73
74private slots:
75 void onDockRightClicked();
76 void onKeyframeRightClicked();
77 void onClipRightClicked();
78
79private:
80 void setupActions();
81 QQuickWidget m_qview;
82 KeyframesModel m_model;
83 QmlMetadata *m_metadata;
84 QmlFilter *m_filter;
85 QmlProducer *m_qmlProducer;
86 QMenu *m_mainMenu;
87 QMenu *m_keyMenu;
88 QMenu *m_keyTypePrevMenu;
89 QMenu *m_keyTypeNextMenu;
90 QMenu *m_clipMenu;
91 double m_timeScale{1.0};
92};
93
94#endif // KEYFRAMESDOCK_H