File indexing completed on 2024-05-12 04:52:51
0001 /* 0002 SPDX-FileCopyrightText: 2016 Nicolas Carion 0003 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 */ 0005 0006 #pragma once 0007 0008 #include <QDebug> 0009 #include <QPersistentModelIndex> 0010 #include <QWidget> 0011 #include <memory> 0012 0013 class AssetParameterModel; 0014 0015 /** @class AbstractParamWidget 0016 @brief Base class of all the widgets representing a parameter of an asset (effect or transition) 0017 */ 0018 class AbstractParamWidget : public QWidget 0019 { 0020 Q_OBJECT 0021 public: 0022 AbstractParamWidget() = delete; 0023 AbstractParamWidget(std::shared_ptr<AssetParameterModel> model, const QModelIndex &index, QWidget *parent); 0024 ~AbstractParamWidget() override = default; 0025 0026 /** @brief Factory method to construct a parameter widget. 0027 @param model Parameter model this parameter belongs to 0028 @param index Index of the parameter in the given model 0029 @param parent parent widget 0030 */ 0031 static AbstractParamWidget *construct(const std::shared_ptr<AssetParameterModel> &model, const QModelIndex &index, QSize frameSize, QWidget *parent); 0032 0033 Q_SIGNALS: 0034 /** @brief Signal sent when the parameters hold by the widgets are modified 0035 The index corresponds which parameter is changed 0036 The string is the new value 0037 The bool allows to decide whether an undo object should be created 0038 */ 0039 void valueChanged(QModelIndex, QString, bool); 0040 0041 /** @brief Signal sent when the filter needs to be deactivated or reactivated. 0042 This happens for example when the user has to pick a color. 0043 */ 0044 void disableCurrentFilter(bool); 0045 0046 void seekToPos(int); 0047 void updateHeight(); 0048 void activateEffect(); 0049 0050 public Q_SLOTS: 0051 /** @brief Toggle the comments on or off 0052 */ 0053 virtual void slotShowComment(bool /*show*/) { qDebug() << "DEBUG: show_comment not correctly overridden"; } 0054 0055 /** @brief refresh the properties to reflect changes in the model 0056 */ 0057 virtual void slotRefresh() = 0; 0058 0059 /** @brief initialize qml keyframe view after creating it 0060 */ 0061 virtual void slotInitMonitor(bool /*active*/) {} 0062 0063 protected: 0064 std::shared_ptr<AssetParameterModel> m_model; 0065 QPersistentModelIndex m_index; 0066 };