CuteLogger
Fast and simple logging solution for Qt based applications
keyframesdock.h
1 /*
2  * Copyright (c) 2016-2020 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 "qmltypes/qmlfilter.h"
22 #include "models/metadatamodel.h"
23 #include "sharedframe.h"
24 #include "models/keyframesmodel.h"
25 
26 #include <QDockWidget>
27 #include <QQuickWidget>
28 #include <QScopedPointer>
29 
30 class QmlFilter;
31 class QmlMetadata;
32 class MetadataModel;
33 class AttachedFiltersModel;
34 class QmlProducer;
35 
36 class KeyframesDock : public QDockWidget
37 {
38  Q_OBJECT
39 
40 public:
41  explicit KeyframesDock(QmlProducer* qmlProducer, QWidget *parent = 0);
42 
43  KeyframesModel& model() { return m_model; }
44  Q_INVOKABLE int seekPrevious();
45  Q_INVOKABLE int seekNext();
46 
47 signals:
48  void changed();
49  void zoomIn();
50  void zoomOut();
51  void resetZoom();
52  void seekPreviousSimple();
53  void seekNextSimple();
54 
55 public slots:
56  void setCurrentFilter(QmlFilter* filter, QmlMetadata* meta);
57  void load(bool force = false);
58  void onProducerModified();
59 
60 protected:
61  bool event(QEvent *event);
62  void keyPressEvent(QKeyEvent* event);
63  void keyReleaseEvent(QKeyEvent* event);
64 
65 private slots:
66  void onVisibilityChanged(bool visible);
67 
68 private:
69  QQuickWidget m_qview;
70  QmlMetadata m_emptyQmlMetadata;
71  QmlFilter m_emptyQmlFilter;
72  KeyframesModel m_model;
73  QmlProducer* m_qmlProducer;
74 
75  int currentParameter() const;
76 };
77 
78 #endif // KEYFRAMESDOCK_H