1 /* 2 SPDX-FileCopyrightText: 2015 Jean-Baptiste Mardelle <jb@kdenlive.org> 3 This file is part of Kdenlive. See www.kdenlive.org. 4 5 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 6 */ 7 8 #ifndef CLIPPROPERTIESCONTROLLER_H 9 #define CLIPPROPERTIESCONTROLLER_H 10 11 #include "definitions.h" 12 #include "timecode.h" 13 14 #include <QString> 15 #include <QTreeWidget> 16 #include <QLabel> 17 18 #include <mlt++/Mlt.h> 19 20 class ClipController; 21 class QMimeData; 22 class QTextEdit; 23 class QComboBox; 24 class QListWidget; 25 class QGroupBox; 26 class QCheckBox; 27 class QButtonGroup; 28 class QSpinBox; 29 class QSortFilterProxyModel; 30 31 class ElidedLinkLabel : public QLabel 32 { 33 Q_OBJECT 34 35 public: 36 explicit ElidedLinkLabel(QWidget *parent = nullptr); 37 void setLabelText(const QString &text, const QString &link); 38 void updateText(int width); 39 int currentWidth() const; 40 41 private: 42 QString m_text; 43 QString m_link; 44 45 protected: 46 void resizeEvent(QResizeEvent *event) override; 47 }; 48 49 class AnalysisTree : public QTreeWidget 50 { 51 public: 52 explicit AnalysisTree(QWidget *parent = nullptr); 53 54 protected: 55 QMimeData *mimeData(const QList<QTreeWidgetItem *> list) const override; 56 }; 57 58 /** @class ClipPropertiesController 59 @brief This class creates the widgets allowing to edit clip properties 60 */ 61 class ClipPropertiesController : public QWidget 62 { 63 Q_OBJECT 64 public: 65 /** 66 * @brief Constructor. 67 * @param id The clip's id 68 * @param properties The clip's properties 69 * @param parent The widget where our infos will be displayed 70 */ 71 explicit ClipPropertiesController(ClipController *controller, QWidget *parent); 72 ~ClipPropertiesController() override; 73 void activatePage(int ix); 74 75 public slots: 76 void slotReloadProperties(); 77 void slotRefreshTimeCode(); 78 void slotFillMeta(QTreeWidget *tree); 79 void slotFillAnalysisData(); 80 void slotDeleteSelectedMarkers(); 81 void slotSelectAllMarkers(); 82 void updateStreamInfo(int streamIndex); 83 void slotEditMarker(); 84 85 private slots: 86 void slotColorModified(const QColor &newcolor); 87 void slotDurationChanged(int duration); 88 void slotEnableForce(int state); 89 void slotValueChanged(double); 90 void slotSeekToMarker(); 91 void slotDeleteMarker(); 92 void slotAddMarker(); 93 void slotLoadMarkers(); 94 void slotSaveMarkers(); 95 void slotDeleteAnalysis(); 96 void slotSaveAnalysis(); 97 void slotLoadAnalysis(); 98 void slotAspectValueChanged(int); 99 void slotComboValueChanged(); 100 void slotValueChanged(int value); 101 void slotTextChanged(); 102 void updateTab(int ix); 103 104 private: 105 ClipController *m_controller; 106 QTabWidget *m_tabWidget; 107 ElidedLinkLabel *m_clipLabel; 108 Timecode m_tc; 109 QString m_id; 110 ClipType::ProducerType m_type; 111 /** @brief: the properties of the active producer (can be a proxy) */ 112 std::shared_ptr<Mlt::Properties> m_properties; 113 /** @brief: the properties of the original source producer (cannot be a proxy) */ 114 Mlt::Properties m_sourceProperties; 115 QMap<QString, QString> m_originalProperties; 116 QMap<QString, QString> m_clipProperties; 117 QList<int> m_videoStreams; 118 QTreeWidget *m_propertiesTree; 119 QWidget *m_propertiesPage; 120 QWidget *m_markersPage; 121 QWidget *m_metaPage; 122 QWidget *m_analysisPage; 123 QComboBox *m_audioStream; 124 QTreeView *m_markerTree; 125 std::unique_ptr<QSortFilterProxyModel>m_sortMarkers; 126 AnalysisTree *m_analysisTree; 127 QTextEdit *m_textEdit; 128 QListWidget *m_audioStreamsView; 129 QGroupBox *m_audioEffectGroup; 130 QCheckBox *m_swapChannels; 131 QCheckBox *m_normalize; 132 QButtonGroup *m_copyChannelGroup; 133 QCheckBox *m_copyChannel1; 134 QCheckBox *m_copyChannel2; 135 QSpinBox *m_gain; 136 /** @brief The selected audio stream. */ 137 int m_activeAudioStreams; 138 void fillProperties(); 139 /** @brief Add/remove icon beside audio stream to indicate effects. */ 140 void updateStreamIcon(int row, int streamIndex); 141 142 signals: 143 void updateClipProperties(const QString &, const QMap<QString, QString> &, const QMap<QString, QString> &); 144 void modified(const QColor &); 145 void modified(int); 146 void updateTimeCodeFormat(); 147 /** @brief Seek clip monitor to a frame. */ 148 void seekToFrame(int); 149 void editAnalysis(const QString &id, const QString &name, const QString &value); 150 void editClip(); 151 void requestProxy(bool doProxy); 152 void proxyModified(const QString &); 153 void deleteProxy(); 154 void enableProxy(bool); 155 }; 156 157 #endif 158