File indexing completed on 2024-03-24 04:54:35
0001 /* 0002 SPDX-FileCopyrightText: 2015 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 "definitions.h" 0011 0012 #include <KMessageWidget> 0013 0014 #include <QString> 0015 #include <QTreeWidget> 0016 #include <QLabel> 0017 0018 #include <mlt++/Mlt.h> 0019 0020 class ClipController; 0021 class QMimeData; 0022 class QTextEdit; 0023 class QComboBox; 0024 class QListWidget; 0025 class QGroupBox; 0026 class QCheckBox; 0027 class QButtonGroup; 0028 class QSpinBox; 0029 class QSortFilterProxyModel; 0030 0031 class ElidedLinkLabel : public QLabel 0032 { 0033 Q_OBJECT 0034 0035 public: 0036 explicit ElidedLinkLabel(QWidget *parent = nullptr); 0037 void setLabelText(const QString &text, const QString &link); 0038 void updateText(int width); 0039 int currentWidth() const; 0040 0041 private: 0042 QString m_text; 0043 QString m_link; 0044 0045 protected: 0046 void resizeEvent(QResizeEvent *event) override; 0047 }; 0048 0049 class AnalysisTree : public QTreeWidget 0050 { 0051 public: 0052 explicit AnalysisTree(QWidget *parent = nullptr); 0053 0054 protected: 0055 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) 0056 QMimeData *mimeData(const QList<QTreeWidgetItem *> &list) const override; 0057 #else 0058 QMimeData *mimeData(const QList<QTreeWidgetItem *> list) const override; 0059 #endif 0060 }; 0061 0062 /** @class ClipPropertiesController 0063 @brief This class creates the widgets allowing to edit clip properties 0064 */ 0065 class ClipPropertiesController : public QWidget 0066 { 0067 Q_OBJECT 0068 public: 0069 /** 0070 * @brief Constructor. 0071 * @param clipName The clip's name 0072 * @param controller The clip's controller 0073 * @param parent The widget where our infos will be displayed 0074 */ 0075 explicit ClipPropertiesController(const QString &clipName, ClipController *controller, QWidget *parent); 0076 ~ClipPropertiesController() override; 0077 void activatePage(int ix); 0078 0079 public Q_SLOTS: 0080 void slotReloadProperties(); 0081 void slotFillMeta(QTreeWidget *tree); 0082 void slotFillAnalysisData(); 0083 void updateStreamInfo(int streamIndex); 0084 0085 private Q_SLOTS: 0086 void slotColorModified(const QColor &newcolor); 0087 void slotDurationChanged(int duration); 0088 void slotEnableForce(int state); 0089 void slotValueChanged(double); 0090 void slotDeleteAnalysis(); 0091 void slotSaveAnalysis(); 0092 void slotLoadAnalysis(); 0093 void slotAspectValueChanged(int); 0094 void slotComboValueChanged(); 0095 void slotValueChanged(int value); 0096 void slotTextChanged(); 0097 void updateTab(int ix); 0098 0099 private: 0100 ClipController *m_controller; 0101 QTabWidget *m_tabWidget; 0102 ElidedLinkLabel *m_clipLabel; 0103 QString m_id; 0104 ClipType::ProducerType m_type; 0105 /** @brief: the properties of the active producer (can be a proxy) */ 0106 std::shared_ptr<Mlt::Properties> m_properties; 0107 /** @brief: the properties of the original source producer (cannot be a proxy) */ 0108 std::shared_ptr<Mlt::Properties> m_sourceProperties; 0109 QMap<QString, QString> m_originalProperties; 0110 QMap<QString, QString> m_clipProperties; 0111 QList<int> m_videoStreams; 0112 QTreeWidget *m_propertiesTree; 0113 QWidget *m_propertiesPage; 0114 QWidget *m_metaPage; 0115 QWidget *m_analysisPage; 0116 QComboBox *m_audioStream; 0117 AnalysisTree *m_analysisTree; 0118 QTextEdit *m_textEdit; 0119 QListWidget *m_audioStreamsView; 0120 QGroupBox *m_audioEffectGroup; 0121 QCheckBox *m_swapChannels; 0122 QCheckBox *m_normalize; 0123 QButtonGroup *m_copyChannelGroup; 0124 QCheckBox *m_copyChannel1; 0125 QCheckBox *m_copyChannel2; 0126 QSpinBox *m_gain; 0127 KMessageWidget m_warningMessage; 0128 /** @brief The selected audio stream. */ 0129 int m_activeAudioStreams; 0130 void fillProperties(); 0131 /** @brief Add/remove icon beside audio stream to indicate effects. */ 0132 void updateStreamIcon(int row, int streamIndex); 0133 0134 Q_SIGNALS: 0135 void updateClipProperties(const QString &, const QMap<QString, QString> &, const QMap<QString, QString> &); 0136 void modified(const QColor &); 0137 void modified(int); 0138 void updateTimeCodeFormat(); 0139 /** @brief Seek clip monitor to a frame. */ 0140 void seekToFrame(int); 0141 void editAnalysis(const QString &id, const QString &name, const QString &value); 0142 void editClip(); 0143 void requestProxy(bool doProxy); 0144 void proxyModified(const QString &); 0145 void deleteProxy(); 0146 void enableProxy(bool); 0147 };