File indexing completed on 2024-11-03 07:38:07

0001 /*
0002     SPDX-FileCopyrightText: 2017 Nicolas Carion
0003     SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #pragma once
0007 
0008 #include <QVBoxLayout>
0009 #include <QWidget>
0010 #include <memory>
0011 
0012 #include "definitions.h"
0013 
0014 class KSqueezedTextLabel;
0015 class KDualAction;
0016 class KMessageWidget;
0017 class QToolButton;
0018 class QComboBox;
0019 class QScrollArea;
0020 
0021 class AssetParameterModel;
0022 class AssetParameterView;
0023 class EffectStackModel;
0024 class EffectStackView;
0025 class TransitionStackView;
0026 class MixStackView;
0027 class QLabel;
0028 
0029 /** @class AssetPanel
0030     @brief This class is the widget that provides interaction with the asset currently selected.
0031     That is, it either displays an effectStack or the parameters of a transition
0032  */
0033 class AssetPanel : public QWidget
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038     AssetPanel(QWidget *parent);
0039 
0040     /** @brief Shows the parameters of the given transition model */
0041     void showTransition(int tid, const std::shared_ptr<AssetParameterModel> &transition_model);
0042     /** @brief Shows the parameters of the given mix model */
0043     void showMix(int cid, const std::shared_ptr<AssetParameterModel> &transitionModel, bool refreshOnly);
0044 
0045     /** @brief Shows the parameters of the given effect stack model */
0046     void showEffectStack(const QString &itemName, const std::shared_ptr<EffectStackModel> &effectsModel, QSize frameSize, bool showKeyframes);
0047 
0048     /** @brief Clear the panel so that it doesn't display anything */
0049     void clear();
0050 
0051     /** @brief This method should be called when the style changes */
0052     void updatePalette();
0053     /** @brief Returns the object type / id of effectstack owner */
0054     ObjectId effectStackOwner();
0055     /** @brief Add an effect to the current stack owner */
0056     bool addEffect(const QString &effectId);
0057     /** @brief Used to pass a standard action like copy or paste to the effect stack widget */
0058     void sendStandardCommand(int command);
0059 
0060 public Q_SLOTS:
0061     /** @brief Clear panel if displaying itemId */
0062     void clearAssetPanel(int itemId);
0063     void assetPanelWarning(const QString &service, const QString &id, const QString &message);
0064     void deleteCurrentEffect();
0065     /** @brief Collapse/expand current effect */
0066     void collapseCurrentEffect();
0067     void slotCheckWheelEventFilter();
0068     void slotAddRemoveKeyframe();
0069     void slotNextKeyframe();
0070     void slotPreviousKeyframe();
0071     /** @brief Update timelinbe position in keyframe views */
0072     void updateAssetPosition(int itemId, const QUuid uuid);
0073 
0074 protected:
0075     /** @brief Return the stylesheet used to display the panel (based on current palette). */
0076     static const QString getStyleSheet();
0077     QVBoxLayout *m_lay;
0078     KSqueezedTextLabel *m_assetTitle;
0079     QWidget *m_container;
0080     TransitionStackView *m_transitionWidget;
0081     MixStackView *m_mixWidget;
0082     EffectStackView *m_effectStackWidget;
0083 
0084 private:
0085     QToolButton *m_switchBuiltStack;
0086     QToolButton *m_saveEffectStack;
0087     QComboBox *m_switchCompoButton;
0088     QAction *m_titleAction;
0089     QAction *m_switchAction;
0090     KDualAction *m_splitButton;
0091     KDualAction *m_enableStackButton;
0092     KDualAction *m_timelineButton;
0093     QScrollArea *m_sc;
0094     KMessageWidget *m_infoMessage;
0095 
0096 private Q_SLOTS:
0097     void processSplitEffect(bool enable);
0098     /** Displays the owner clip keyframes in timeline */
0099     void showKeyframes(bool enable);
0100     /** Enable / disable effect stack */
0101     void enableStack(bool enable);
0102     /** Scroll effects view */
0103     void scrollTo(QRect rect);
0104 
0105 Q_SIGNALS:
0106     void doSplitEffect(bool);
0107     void doSplitBinEffect(bool);
0108     void seekToPos(int);
0109     void reloadEffect(const QString &path);
0110     void switchCurrentComposition(int tid, const QString &compoId);
0111     void slotSaveStack();
0112 };