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  int currentParameter() const;
47 
48 signals:
49  void changed();
50  void zoomIn();
51  void zoomOut();
52  void zoomToFit();
53  void resetZoom();
54  void seekPreviousSimple();
55  void seekNextSimple();
56 
57 public slots:
58  void setCurrentFilter(QmlFilter* filter, QmlMetadata* meta);
59  void load(bool force = false);
60  void onProducerModified();
61 
62 protected:
63  bool event(QEvent *event);
64  void keyPressEvent(QKeyEvent* event);
65  void keyReleaseEvent(QKeyEvent* event);
66 
67 private slots:
68  void onVisibilityChanged(bool visible);
69 
70 private:
71  QQuickWidget m_qview;
72  QmlMetadata m_emptyQmlMetadata;
73  QmlFilter m_emptyQmlFilter;
74  KeyframesModel m_model;
75  QmlProducer* m_qmlProducer;
76 };
77 
78 #endif // KEYFRAMESDOCK_H