CuteLogger
Fast and simple logging solution for Qt based applications
keyframesdock.h
1/*
2 * Copyright (c) 2016-2023 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
49signals:
50 void changed();
51 void setZoom(double value);
52 void zoomIn();
53 void zoomOut();
54 void zoomToFit();
55 void resetZoom();
56 void seekPreviousSimple();
57 void seekNextSimple();
58 void newFilter(); // Notifies when the filter itself has been changed
59 void timeScaleChanged();
60 void dockClicked();
61
62public slots:
63 void setCurrentFilter(QmlFilter *filter, QmlMetadata *meta);
64 void load(bool force = false);
65 void reload();
66 void onProducerModified();
67
68protected:
69 bool event(QEvent *event);
70 void keyPressEvent(QKeyEvent *event);
71 void keyReleaseEvent(QKeyEvent *event);
72
73private slots:
74 void onDockRightClicked();
75 void onKeyframeRightClicked();
76 void onClipRightClicked();
77
78private:
79 void setupActions();
80 QQuickWidget m_qview;
81 KeyframesModel m_model;
82 QmlMetadata *m_metadata;
83 QmlFilter *m_filter;
84 QmlProducer *m_qmlProducer;
85 QMenu *m_mainMenu;
86 QMenu *m_keyMenu;
87 QMenu *m_keyTypePrevMenu;
88 QMenu *m_keyTypeNextMenu;
89 QMenu *m_clipMenu;
90 double m_timeScale{1.0};
91};
92
93#endif // KEYFRAMESDOCK_H