CuteLogger
Fast and simple logging solution for Qt based applications
filtercontroller.h
1/*
2 * Copyright (c) 2014-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 FILTERCONTROLLER_H
19#define FILTERCONTROLLER_H
20
21#include <QObject>
22#include <QScopedPointer>
23#include <QFuture>
24#include "models/metadatamodel.h"
25#include "models/motiontrackermodel.h"
26#include "models/attachedfiltersmodel.h"
27#include "qmltypes/qmlmetadata.h"
28#include "qmltypes/qmlfilter.h"
29
30class QTimerEvent;
31
32
33class FilterController : public QObject
34{
35 Q_OBJECT
36
37public:
38 explicit FilterController(QObject *parent = 0);
39 MetadataModel *metadataModel();
40 MotionTrackerModel *motionTrackerModel()
41 {
42 return &m_motionTrackerModel;
43 }
44 AttachedFiltersModel *attachedModel();
45
46 QmlMetadata *metadataForService(Mlt::Service *service);
47 QmlFilter *currentFilter() const
48 {
49 return m_currentFilter.data();
50 }
51 bool isOutputTrackSelected() const;
52
53protected:
54 void timerEvent(QTimerEvent *);
55
56signals:
57 void currentFilterChanged(QmlFilter *filter, QmlMetadata *meta, int index);
58 void statusChanged(QString);
59 void filterChanged(Mlt::Service *);
60
61public slots:
62 void setProducer(Mlt::Producer *producer = 0);
63 void setCurrentFilter(int attachedIndex, bool isNew = false);
64 void onFadeInChanged();
65 void onFadeOutChanged();
66 void onServiceInChanged(int delta, Mlt::Service *service = 0);
67 void onServiceOutChanged(int delta, Mlt::Service *service = 0);
68 void removeCurrent();
69 void onProducerChanged();
70
71private slots:
72 void handleAttachedModelChange();
73 void handleAttachedModelAboutToReset();
74 void addMetadata(QmlMetadata *);
75 void handleAttachedRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
76 void handleAttachedRowsRemoved(const QModelIndex &parent, int first, int last);
77 void handleAttachedRowsInserted(const QModelIndex &parent, int first, int last);
78 void handleAttachDuplicateFailed(int index);
79 void onQmlFilterChanged(const QString &name);
80
81private:
82 void loadFilterSets();
83 void loadFilterMetadata();
84
85 QFuture<void> m_future;
86 QScopedPointer<QmlFilter> m_currentFilter;
87 Mlt::Service *m_mltService;
88 MetadataModel m_metadataModel;
89 MotionTrackerModel m_motionTrackerModel;
90 AttachedFiltersModel m_attachedModel;
91 int m_currentFilterIndex;
92};
93
94#endif // FILTERCONTROLLER_H