File indexing completed on 2024-05-12 04:52:48
0001 /* 0002 SPDX-FileCopyrightText: 2018 Jean-Baptiste Mardelle <jb@kdenlive.org> 0003 This file is part of Kdenlive. See www.kdenlive.org. 0004 0005 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 #pragma once 0009 0010 #include <QPersistentModelIndex> 0011 0012 #include <QObject> 0013 #include <QVariant> 0014 0015 #include <memory> 0016 0017 class Monitor; 0018 class AssetParameterModel; 0019 0020 /** @class KeyframeMonitorHelper 0021 @brief This class helps manage effects that receive data from the monitor's qml overlay to translate 0022 the data and pass it to the model 0023 */ 0024 class KeyframeMonitorHelper : public QObject 0025 { 0026 Q_OBJECT 0027 0028 public: 0029 /** @brief Construct a keyframe list bound to the given effect 0030 @param init_value is the value taken by the param at time 0. 0031 @param model is the asset this parameter belong to 0032 @param index is the index of this parameter in its model 0033 */ 0034 explicit KeyframeMonitorHelper(Monitor *monitor, std::shared_ptr<AssetParameterModel> model, const QPersistentModelIndex &index, QObject *parent = nullptr); 0035 /** @brief Send signals to the monitor to update the qml overlay. 0036 @param returns : true if the monitor's connection was changed to active. 0037 */ 0038 virtual bool connectMonitor(bool activate); 0039 /** @brief Send data update to the monitor 0040 */ 0041 virtual void refreshParams(int pos); 0042 0043 QList<QPersistentModelIndex> getIndexes(); 0044 0045 protected: 0046 Monitor *m_monitor; 0047 std::shared_ptr<AssetParameterModel> m_model; 0048 /** @brief List of indexes managed by this class 0049 */ 0050 QList<QPersistentModelIndex> m_indexes; 0051 bool m_active; 0052 0053 private Q_SLOTS: 0054 virtual void slotUpdateFromMonitorData(const QVariantList &v); 0055 0056 public Q_SLOTS: 0057 /** @brief For classes that manage several parameters, add a param index to the list 0058 */ 0059 void addIndex(const QPersistentModelIndex &index); 0060 0061 Q_SIGNALS: 0062 /** @brief Send updated keyframe data to the parameter \@index 0063 */ 0064 void updateKeyframeData(QPersistentModelIndex index, const QVariant &v); 0065 };