File indexing completed on 2024-04-14 04:46:10

0001 /*
0002 SPDX-FileCopyrightText: 2012 Till Theato <root@ttill.de>
0003 SPDX-FileCopyrightText: 2014 Jean-Baptiste Mardelle <jb@kdenlive.org>
0004 This file is part of Kdenlive. See www.kdenlive.org.
0005 
0006 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0007 */
0008 
0009 #pragma once
0010 
0011 #include "abstractprojectitem.h"
0012 #include "utils/timecode.h"
0013 
0014 #include <KMessageWidget>
0015 
0016 #include <QDir>
0017 #include <QDomElement>
0018 #include <QFuture>
0019 #include <QLineEdit>
0020 #include <QListView>
0021 #include <QMutex>
0022 #include <QPushButton>
0023 #include <QTreeView>
0024 #include <QListWidget>
0025 #include <QUrl>
0026 #include <QWidget>
0027 #include <QActionGroup>
0028 
0029 #include <KRecentDirs>
0030 
0031 class AbstractProjectItem;
0032 class BinItemDelegate;
0033 class BinListItemDelegate;
0034 class ClipController;
0035 class EffectStackModel;
0036 class InvalidDialog;
0037 class TranscodeSeek;
0038 class KdenliveDoc;
0039 class TagWidget;
0040 class Monitor;
0041 class ProjectClip;
0042 class ProjectFolder;
0043 class ProjectItemModel;
0044 class ProjectSortProxyModel;
0045 class QDockWidget;
0046 class QMenu;
0047 class QScrollArea;
0048 class QTimeLine;
0049 class QToolBar;
0050 class QToolButton;
0051 class QUndoCommand;
0052 class QVBoxLayout;
0053 class SmallJobLabel;
0054 class MediaBrowser;
0055 
0056 namespace Mlt {
0057 class Producer;
0058 }
0059 
0060 /** @class MyListView
0061     @brief \@todo Describe class MyListView
0062     @todo Describe class MyListView
0063  */
0064 class MyListView : public QListView
0065 {
0066     Q_OBJECT
0067 public:
0068     explicit MyListView(QWidget *parent = nullptr);
0069 
0070 protected:
0071     void mousePressEvent(QMouseEvent *event) override;
0072     void mouseReleaseEvent(QMouseEvent *event) override;
0073     void mouseMoveEvent(QMouseEvent *event) override;
0074     void focusInEvent(QFocusEvent *event) override;
0075 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
0076     void enterEvent(QEnterEvent *event) override;
0077 #else
0078     void enterEvent(QEvent *event) override;
0079 #endif
0080     void leaveEvent(QEvent *event) override;
0081     void dropEvent(QDropEvent *event) override;
0082 
0083 Q_SIGNALS:
0084     void focusView();
0085     void updateDragMode(PlaylistState::ClipState type);
0086     void displayBinFrame(QModelIndex ix, int frame, bool storeFrame = false);
0087     void processDragEnd();
0088 private:
0089     QPoint m_startPos;
0090     PlaylistState::ClipState m_dragType;
0091     QModelIndex m_lastHoveredItem;
0092 };
0093 
0094 /** @class MyTreeView
0095     @brief \@todo Describe class MyTreeView
0096     @todo Describe class MyTreeView
0097  */
0098 class MyTreeView : public QTreeView
0099 {
0100     Q_OBJECT
0101     Q_PROPERTY(bool editing READ isEditing WRITE setEditing NOTIFY editingChanged)
0102 public:
0103     explicit MyTreeView(QWidget *parent = nullptr);
0104     void setEditing(bool edit);
0105 
0106 protected:
0107     void mousePressEvent(QMouseEvent *event) override;
0108     void mouseReleaseEvent(QMouseEvent *event) override;
0109     void mouseMoveEvent(QMouseEvent *event) override;
0110     void focusInEvent(QFocusEvent *event) override;
0111 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
0112     void enterEvent(QEnterEvent *) override;
0113 #else
0114     void enterEvent(QEvent *event) override;
0115 #endif
0116     void leaveEvent(QEvent *event) override;
0117 
0118 protected Q_SLOTS:
0119     void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint) override;
0120     void editorDestroyed(QObject *editor) override;
0121 
0122 private:
0123     QPoint m_startPos;
0124     PlaylistState::ClipState m_dragType;
0125     QModelIndex m_lastHoveredItem;
0126     bool m_editing;
0127     bool performDrag();
0128     bool isEditing() const;
0129 
0130 Q_SIGNALS:
0131     void focusView();
0132     void updateDragMode(PlaylistState::ClipState type);
0133     void displayBinFrame(QModelIndex ix, int frame, bool storeFrame = false);
0134     void processDragEnd();
0135     void selectCurrent();
0136     void editingChanged();
0137 };
0138 
0139 /** @class SmallJobLabel
0140     @brief \@todo Describe class SmallJobLabel
0141     @todo Describe class SmallJobLabel
0142  */
0143 class SmallJobLabel : public QPushButton
0144 {
0145     Q_OBJECT
0146 public:
0147     explicit SmallJobLabel(QWidget *parent = nullptr);
0148     static const QString getStyleSheet(const QPalette &p);
0149     void setAction(QAction *action);
0150 
0151 private:
0152     enum ItemRole { NameRole = Qt::UserRole, DurationRole, UsageRole };
0153 
0154     QTimeLine *m_timeLine;
0155     QAction *m_action{nullptr};
0156     QMutex m_locker;
0157 
0158 public Q_SLOTS:
0159     void slotSetJobCount(int jobCount);
0160 
0161 private Q_SLOTS:
0162     void slotTimeLineChanged(qreal value);
0163     void slotTimeLineFinished();
0164 };
0165 
0166 /** @class LineEventEater
0167     @brief \@todo Describe class LineEventEater
0168     @todo Describe class LineEventEater
0169  */
0170 class LineEventEater : public QObject
0171 {
0172     Q_OBJECT
0173 public:
0174     explicit LineEventEater(QObject *parent = nullptr);
0175 
0176 protected:
0177     bool eventFilter(QObject *obj, QEvent *event) override;
0178 
0179 Q_SIGNALS:
0180     void clearSearchLine();
0181     void showClearButton(bool);
0182 };
0183 
0184 /**
0185  * @class Bin
0186  * @brief The bin widget takes care of both item model and view upon project opening.
0187  */
0188 class Bin : public QWidget
0189 {
0190     Q_OBJECT
0191 
0192     /** @brief Defines the view types (icon view, tree view,...)  */
0193     enum BinViewType { BinTreeView, BinIconView };
0194 
0195 public:
0196     explicit Bin(std::shared_ptr<ProjectItemModel> model, QWidget *parent = nullptr, bool isMainBin = true);
0197     ~Bin() override;
0198 
0199     bool isLoading;
0200     /** @brief Sets the document for the bin and initialize some stuff  */
0201     const QString setDocument(KdenliveDoc *project, const QString &id = QString());
0202     /** @brief Delete all project related data, to be called before setDocument  */
0203     void cleanDocument();
0204 
0205     /** @brief Create a clip item from its xml description  */
0206     void createClip(const QDomElement &xml);
0207 
0208     /** @brief Used to notify the Model View that an item was updated */
0209     void emitItemUpdated(std::shared_ptr<AbstractProjectItem> item);
0210 
0211     /** @brief Set monitor associated with this bin (clipmonitor) */
0212     void setMonitor(Monitor *monitor);
0213 
0214     /** @brief Returns the clip monitor */
0215     Monitor *monitor();
0216 
0217     /** @brief Open a producer in the clip monitor */
0218     void openProducer(std::shared_ptr<ProjectClip> controller);
0219     void openProducer(std::shared_ptr<ProjectClip> controller, int in, int out);
0220 
0221     /** @brief Get a clip from it's id */
0222     std::shared_ptr<ProjectClip> getBinClip(const QString &id);
0223     /** @brief Get a clip's name from it's id */
0224     const QString getBinClipName(const QString &id) const;
0225     /** @brief Returns the duration of a given clip. */
0226     size_t getClipDuration(int itemId) const;
0227     /** @brief Returns the frame size of a given clip. */
0228     QSize getFrameSize(int itemId) const;
0229     /** @brief Returns the state of a given clip: AudioOnly, VideoOnly, Disabled (Disabled means it has audio and video capabilities */
0230     PlaylistState::ClipState getClipState(int itemId) const;
0231 
0232     /** @brief Add markers on clip \@param binId at \@param positions with @comments text if given */
0233     void addClipMarker(const QString &binId, const QList<int> &positions, const QStringList &comments = {});
0234 
0235     /** @brief Get the count of all markers in all clips using this category */
0236     int getAllClipMarkers(int category) const;
0237 
0238     /** @brief Remove all clip markers using a category */
0239     void removeMarkerCategories(QList<int> toRemove, const QMap<int, int> remapCategories);
0240 
0241     /** @brief Returns a list of selected clip ids.
0242      *  @param allowSubClips: if true, will include subclip ids in the form: "master clip id/in/out"
0243      */
0244     std::vector<QString> selectedClipsIds(bool allowSubClips = false);
0245 
0246     // Returns the selected clips
0247     QList<std::shared_ptr<ProjectClip>> selectedClips();
0248 
0249     /** @brief Current producer has changed, refresh monitor and timeline*/
0250     void refreshClip(const QString &id);
0251 
0252     void setupMenu();
0253 
0254     /** @brief The source file was modified, we will reload it soon, disable item in the meantime */
0255     void setWaitingStatus(const QString &id);
0256 
0257     const QString getDocumentProperty(const QString &key);
0258 
0259     /** @brief Ask MLT to reload this clip's producer  */
0260     void reloadClip(const QString &id);
0261 
0262     /** @brief refresh monitor (if clip changed)  */
0263     void reloadMonitorIfActive(const QString &id);
0264     /** @brief refresh monitor stream selector  */
0265     void reloadMonitorStreamIfActive(const QString &id);
0266     /** @brief Update timeline targets according to selected audio streams */
0267     void updateTargets(QString id = QStringLiteral("-1"));
0268     /** @brief Update some timeline related stuff, like used clips bound, audio targets,... */
0269     void sequenceActivated();
0270 
0271     void doMoveClip(const QString &id, const QString &newParentId);
0272     void doMoveFolder(const QString &id, const QString &newParentId);
0273     void setupGeneratorMenu();
0274 
0275     /** @brief Set focus to the Bin view. */
0276     void focusBinView() const;
0277     /** @brief Get a string list of all clip ids that are inside a folder defined by id. */
0278     QStringList getBinFolderClipIds(const QString &id) const;
0279     /** @brief Build a rename subclip command. */
0280     void renameSubClipCommand(const QString &id, const QString &newName, const QString &oldName, int in, int out);
0281     /** @brief Rename a clip zone (subclip). */
0282     void renameSubClip(const QString &id, const QString &newName, int in, int out);
0283 
0284     /** @brief Edit an effect settings to a bin clip. */
0285     void editMasterEffect(const std::shared_ptr<AbstractProjectItem> &clip);
0286     /** @brief An effect setting was changed, update stack if displayed. */
0287     void updateMasterEffect(ClipController *ctl);
0288     void rebuildMenu();
0289     void refreshIcons();
0290 
0291     /** @brief This function change the global enabled state of the bin effects
0292      */
0293     void setBinEffectsEnabled(bool enabled, bool refreshMonitor = true);
0294 
0295     void requestAudioThumbs(const QString &id, long duration);
0296     /** @brief Proxy status for the project changed, update. */
0297     void refreshProxySettings();
0298     /** @brief A clip is ready, update its info panel if displayed. */
0299     void emitRefreshPanel(const QString &id);
0300     /** @brief Returns true if there is a clip in bin. Timeline clips are ignored. */
0301     bool hasUserClip() const;
0302     /** @brief Trigger reload of all clips. */
0303     void reloadAllProducers(bool reloadThumbs = true);
0304     /** @brief Ensure all audio thumbs have been created */
0305     void checkAudioThumbs();
0306     /** @brief Get usage stats for project bin. */
0307     void getBinStats(uint *used, uint *unused, qint64 *usedSize, qint64 *unusedSize);
0308     /** @brief Returns the clip properties dockwidget. */
0309     QDockWidget *clipPropertiesDock();
0310     void rebuildProxies();
0311     /** @brief Return a list of all clips hashes used in this project */
0312     QStringList getProxyHashList();
0313     /** @brief Get binId of the current selected folder */
0314     QString getCurrentFolder();
0315     /** @brief Save a clip zone as MLT playlist */
0316     void saveZone(const QStringList &info, const QDir &dir);
0317     /** @brief A bin clip changed (its effects), invalidate preview */
0318     void invalidateClip(const QString &binId);
0319     /** @brief Recreate missing proxies on document opening */
0320     void checkMissingProxies();
0321     /** @brief Save folder state (expanded or not) */
0322     void saveFolderState();
0323     /** @brief Load folder state (expanded or not), zoom level and possible other project stored Bin settings */
0324     void loadBinProperties(const QStringList &foldersToExpand, int zoomLevel = -1);
0325     /** @brief gets a QList of all clips used in timeline */
0326     QList<int> getUsedClipIds();
0327     /** @brief Update a new timeline clip when it has been changed
0328      * @param uuid the uuid of the timeline clip that was changed
0329      * @param id the updated duration of the timeline clip
0330      * * @param current the uuid of the currently active timeline
0331      */
0332     void updateSequenceClip(const QUuid &uuid, int duration, int pos);
0333     /** @brief Update a sequence AV info (has audio/video) */
0334     void updateSequenceAVType(const QUuid &uuid, int tracksCount);
0335 
0336     // TODO refac: remove this and call directly the function in ProjectItemModel
0337     void cleanupUnused();
0338     void selectAll();
0339     /** @brief Save an mlt playlist from a bin id and a list of cuts
0340      * @param binId the id of the source clip for zones
0341      * @param savePath the path for the resulting playlist
0342      * @param zones the source cli pzones that will be put in the result playlist
0343      * @param properties some extra properties that will be set on the producer
0344      * @param createNew if true, the playlist will be added as a new clip in project binId */
0345     void savePlaylist(const QString &binId, const QString &savePath, const QVector<QPoint> &zones, const QMap<QString, QString> &properties, bool createNew);
0346     /** @brief Do some checks on the profile */
0347     static void checkProfile(const std::shared_ptr<Mlt::Producer> &producer);
0348     /** @brief Should we process a profile check for added clips */
0349     std::atomic<bool> shouldCheckProfile;
0350     /** @brief Set the message for key binding info. */
0351     void updateKeyBinding(const QString &bindingMessage = QString());
0352     /** @brief Returns true if a clip with id cid is visible in this bin. */
0353     bool containsId(const QString &cid) const;
0354     void replaceSingleClip(const QString clipId, const QString &newUrl);
0355     /** @brief List all clips referenced in a timeline sequence. */
0356     QStringList sequenceReferencedClips(const QUuid &uuid) const;
0357     /** @brief Define a thumbnail for a sequence clip. */
0358     void setSequenceThumbnail(const QUuid &uuid, int frame);
0359     /** @brief When saving or rendering, copy timewarp temporary playlists to the correct folder. */
0360     void moveTimeWarpToFolder(const QDir sequenceFolder, bool copy);
0361     /** @brief Create new sequence clip
0362      * @param aTracks the audio tracks count, use default if -1
0363      * @param vTracks the video tracks count, use default if -1 */
0364     void buildSequenceClip(int aTracks = -1, int vTracks = -1);
0365     const QString buildSequenceClipWithUndo(Fun &undo, Fun &redo, int aTracks = -1, int vTracks = -1, QString suggestedName = QString());
0366     /** @brief Returns true if the project uses a clip with variable framerate. */
0367     bool usesVariableFpsClip();
0368 
0369 private Q_SLOTS:
0370     void slotAddClip();
0371     /** @brief Reload clip from disk */
0372     void slotReloadClip();
0373     /** @brief Replace clip with another file */
0374     void slotReplaceClip();
0375     /** @brief Replace audio or video component in timeline with another file */
0376     void slotReplaceClipInTimeline();
0377     /** @brief Set sorting column */
0378     void slotSetSorting();
0379     /** @brief Show/hide date column */
0380     void slotShowColumn(bool show);
0381     /** @brief Ensure current item is selected */
0382     void ensureCurrent();
0383     /** @brief Go to parent folder */
0384     void slotBack();
0385     /** @brief Setup the bin view type (icon view, tree view, ...).
0386      * @param action The action whose data defines the view type or nullptr to keep default view */
0387     void slotInitView(QAction *action);
0388     void slotSetIconSize(int size);
0389     void selectProxyModel(const QModelIndex &id);
0390     void slotSaveHeaders();
0391 
0392     /** @brief Reset all text and log data from info message widget. */
0393     void slotResetInfoMessage();
0394     /** @brief Show dialog prompting for removal of invalid clips. */
0395     void slotQueryRemoval(const QString &id, const QString &url, const QString &errorMessage);
0396     /** @brief Request display of current clip in monitor. */
0397     void slotOpenCurrent();
0398     void slotZoomView(bool zoomIn);
0399     /** @brief Widget gained focus, make sure we display effects for master clip. */
0400     void slotGotFocus();
0401     /** @brief Rename a Bin Item. */
0402     void slotRenameItem();
0403     void doRefreshPanel(const QString &id);
0404     /** @brief Enable item view and hide message */
0405     void slotMessageActionTriggered();
0406     /** @brief Request editing of title or slideshow clip */
0407     void slotEditClip();
0408     /** @brief Enable / disable clear button on search line
0409      *  this is a workaround foq Qt bug 54676
0410      */
0411     void showClearButton(bool show);
0412     /** @brief Display a defined frame in bin clip thumbnail
0413      */
0414     void showBinFrame(const QModelIndex &ix, int frame, bool storeFrame = false);
0415     /** @brief Switch a tag on/off on current selection
0416      */
0417     void switchTag(const QString &tag, bool add);
0418     /** @brief Update project tags
0419      */
0420     void updateTags(const QMap <int, QStringList> &previousTags, const QMap <int, QStringList> &tags);
0421     void rebuildFilters(int tagsCount);
0422     /** @brief Switch a tag on  a clip list
0423      */
0424     void editTags(const QList <QString> &allClips, const QString &tag, bool add);
0425     /** @brief Update the string description of the clips count, like: 123 clips (3 selected). */
0426     void updateClipsCount();
0427     /** @brief Update the menu entry listing the occurrences of a clip in timeline. */
0428     void updateTimelineOccurrences();
0429     /** @brief Set (or unset) the default folder for newly created sequence clips. */
0430     void setDefaultSequenceFolder(bool enable);
0431     /** @brief Set (or unset) the default folder for newly created audio captures. */
0432     void setDefaultAudioCaptureFolder(bool enable);
0433     /** @brief Fetch the filters from the UI and apply them to the proxy model */
0434     void slotApplyFilters();
0435 
0436 public Q_SLOTS:
0437 
0438     void slotRemoveInvalidClip(const QString &id, bool replace, const QString &errorMessage);
0439     /** @brief Reload clip thumbnail - when frame for thumbnail changed */
0440     void slotRefreshClipThumbnail(const QString &id);
0441     void slotDeleteClip();
0442     void slotItemDoubleClicked(const QModelIndex &ix, const QPoint &pos, uint modifiers);
0443     void slotSwitchClipProperties(const std::shared_ptr<ProjectClip> &clip);
0444     void slotSwitchClipProperties();
0445     /** @brief Creates a new folder with optional name, and returns new folder's id */
0446     void slotAddFolder();
0447     void slotCreateProjectClip();
0448     void slotEditClipCommand(const QString &id, const QMap<QString, QString> &oldProps, const QMap<QString, QString> &newProps);
0449     /** @brief Start a filter job requested by a filter applied in timeline */
0450     void slotStartFilterJob(const ItemInfo &info, const QString &id, QMap<QString, QString> &filterParams, QMap<QString, QString> &consumerParams,
0451                             QMap<QString, QString> &extraParams);
0452     void slotItemDropped(const QStringList ids, const QModelIndex parent);
0453     const QString slotUrlsDropped(const QList<QUrl> urls, const QModelIndex parent);
0454     void slotEffectDropped(const QStringList &effectData, const QModelIndex &parent);
0455     void slotTagDropped(const QString &tag, const QModelIndex &parent);
0456     void slotItemEdited(const QModelIndex &, const QModelIndex &, const QVector<int> &);
0457     /** @brief Open current clip in an external editing application */
0458     void slotOpenClipExtern();
0459     void slotDuplicateClip();
0460     void slotLocateClip();
0461     void showClipProperties(const std::shared_ptr<ProjectClip> &clip, bool forceRefresh = false);
0462     /** @brief Add extra data to a clip. */
0463     void slotAddClipExtraData(const QString &id, const QString &key, const QString &data = QString());
0464     void slotUpdateClipProperties(const QString &id, const QMap<QString, QString> &properties, bool refreshPropertiesPanel);
0465     /** @brief Add effect to active Bin clip (used when double clicking an effect in list). */
0466     void slotAddEffect(std::vector<QString> ids, const QStringList &effectData);
0467     void slotExpandUrl(const ItemInfo &info, const QString &url, QUndoCommand *command);
0468     /** @brief Abort all ongoing operations to prepare close. */
0469     void abortOperations();
0470     void doDisplayMessage(const QString &text, KMessageWidget::MessageType type, const QList<QAction *> &actions = QList<QAction *>(), bool showCloseButton = false, BinMessage::BinCategory messageCategory = BinMessage::BinCategory::NoMessage);
0471     void doDisplayMessage(const QString &text, KMessageWidget::MessageType type, const QString logInfo);
0472     /** @brief Select a clip in the Bin from its id. */
0473     void selectClipById(const QString &id, int frame = -1, const QPoint &zone = QPoint(), bool activateMonitor = true);
0474     const QString slotAddClipToProject(const QUrl &url);
0475     void droppedUrls(const QList<QUrl> &urls, const QString &folderInfo = QString());
0476     /** @brief Adjust project profile to current clip. */
0477     void adjustProjectProfileToItem();
0478     /** @brief Check and propose auto adding audio tracks.
0479      * @param clipId The clip whose streams have to be checked
0480      * @param minimumTracksCount the number of active streams for this clip
0481      */
0482     void checkProjectAudioTracks(QString clipId, int minimumTracksCount);
0483     void showTitleWidget(const std::shared_ptr<ProjectClip> &clip);
0484     /** @brief Add a clip in a specially named folder */
0485     bool addProjectClipInFolder(const QString &path, const QString &sourceClipId, const QString &sourceFolder, const QString &jobId);
0486     /** @brief Add a filter with some presets to a clip */
0487     void addFilterToClip(const QString &sourceClipId, const QString &filterId, stringMap params);
0488     /** @brief Check if a clip profile matches project, propose switch otherwise */
0489     void slotCheckProfile(const QString &binId);
0490     /** @brief A non seekable clip was added to project, propose transcoding */
0491     void requestTranscoding(const QString &url, const QString &id, int type, bool checkProfile, const QString &suffix = QString(), const QString &message = QString());
0492     /** @brief Display the transcode to edit friendly format for currenly selected bin clips */
0493     void requestSelectionTranscoding(bool forceReplace = false);
0494     /** @brief Build the project bin audio/video icons according to color theme */
0495     void slotUpdatePalette();
0496     /** @brief Import multiple video streams in a clip */
0497     void processMultiStream(const QString &clipId, QList<int> videoStreams, QList<int> audioStreams);
0498     /** @brief Transcode all used clips with variable framerate to edit friendly format. */
0499     void transcodeUsedClips();
0500 
0501 protected:
0502     /* This function is called whenever an item is selected to propagate signals
0503        (for ex request to show the clip in the monitor)
0504     */
0505     void setCurrent(const std::shared_ptr<AbstractProjectItem> &item);
0506     void selectClip(const std::shared_ptr<ProjectClip> &clip);
0507     void contextMenuEvent(QContextMenuEvent *event) override;
0508     bool eventFilter(QObject *obj, QEvent *event) override;
0509     QSize sizeHint() const override;
0510 
0511 private:
0512     bool m_isMainBin;
0513     std::shared_ptr<ProjectItemModel> m_itemModel;
0514     QAbstractItemView *m_itemView;
0515     BinItemDelegate *m_binTreeViewDelegate;
0516     BinListItemDelegate *m_binListViewDelegate;
0517     std::unique_ptr<ProjectSortProxyModel> m_proxyModel;
0518     QToolBar *m_toolbar;
0519     KdenliveDoc *m_doc;
0520     QLineEdit *m_searchLine;
0521     QToolButton *m_addButton;
0522     QMenu *m_extractAudioAction;
0523     QAction *m_transcodeAction;
0524     QMenu *m_clipsActionsMenu;
0525     QAction *m_inTimelineAction;
0526     QAction *m_showDate;
0527     QAction *m_showDesc;
0528     QAction *m_showRating;
0529     QAction *m_sortDescend;
0530     /** @brief Default view type (icon, tree, ...) */
0531     BinViewType m_listType;
0532     /** @brief Default icon size for the views. */
0533     QSize m_baseIconSize;
0534     /** @brief Keeps the column width info of the tree view. */
0535     QByteArray m_headerInfo;
0536     QVBoxLayout *m_layout;
0537     QDockWidget *m_propertiesDock;
0538     QScrollArea *m_propertiesPanel;
0539     QSlider *m_slider;
0540     Monitor *m_monitor;
0541     QIcon m_blankThumb;
0542     QMenu *m_menu;
0543     QAction *m_openAction;
0544     QAction *m_editAction;
0545     QAction *m_reloadAction;
0546     QAction *m_replaceAction{nullptr};
0547     QAction *m_replaceInTimelineAction{nullptr};
0548     QAction *m_duplicateAction;
0549     QAction *m_locateAction;
0550     QAction *m_proxyAction;
0551     QAction *m_deleteAction;
0552     QAction *m_openInBin;
0553     QAction *m_sequencesFolderAction;
0554     QAction *m_audioCapturesFolderAction;
0555     QAction *m_addClip;
0556     QAction *m_createFolderAction;
0557     QAction *m_renameAction;
0558     QMenu *m_jobsMenu;
0559     QAction *m_cancelJobs;
0560     QAction *m_discardCurrentClipJobs;
0561     QAction *m_discardPendingJobs;
0562     QAction *m_upAction;
0563     QAction *m_tagAction;
0564     QActionGroup *m_sortGroup;
0565     SmallJobLabel *m_infoLabel;
0566     TagWidget *m_tagsWidget;
0567     QMenu *m_filterMenu;
0568     QActionGroup m_filterTagGroup;
0569     QActionGroup m_filterRateGroup;
0570     QActionGroup m_filterUsageGroup;
0571     QActionGroup m_filterTypeGroup;
0572     QToolButton *m_filterButton;
0573     /** @brief The info widget for failed jobs. */
0574     KMessageWidget *m_infoMessage;
0575     BinMessage::BinCategory m_currentMessage;
0576     QStringList m_errorLog;
0577     /** @brief Dialog listing invalid clips on load. */
0578     InvalidDialog *m_invalidClipDialog;
0579     /** @brief Dialog listing non seekable clips on load. */
0580     TranscodeSeek *m_transcodingDialog;
0581     /** @brief Set to true if widget just gained focus (means we have to update effect stack . */
0582     bool m_gainedFocus;
0583     /** @brief List of Clip Ids that want an audio thumb. */
0584     QStringList m_audioThumbsList;
0585     QString m_processingAudioThumb;
0586     QMutex m_audioThumbMutex;
0587     /** @brief This is a lock that ensures safety in case of concurrent access */
0588     mutable QReadWriteLock m_lock;
0589     /** @brief Total number of milliseconds to process for audio thumbnails */
0590     long m_audioDuration;
0591     /** @brief Total number of milliseconds already processed for audio thumbnails */
0592     long m_processedAudio;
0593     /** @brief Indicates whether audio thumbnail creation is running. */
0594     QFuture<void> m_audioThumbsThread;
0595     QAction *addAction(const QString &name, const QString &text, const QIcon &icon, const QString &category = {});
0596     void setupAddClipAction(QMenu *addClipMenu, ClipType::ProducerType type, const QString &name, const QString &text, const QIcon &icon);
0597     /** @brief Get the QModelIndex value for an item in the Bin. */
0598     QModelIndex getIndexForId(const QString &id, bool folderWanted) const;
0599     std::shared_ptr<ProjectClip> getFirstSelectedClip();
0600     void showSlideshowWidget(const std::shared_ptr<ProjectClip> &clip);
0601     void processAudioThumbs();
0602     void updateSortingAction(int ix);
0603     int wheelAccumulatedDelta;
0604     QString m_keyBindingMessage;
0605     QString m_clipsCountMessage;
0606     /** @brief Show the clip count and key binfing info in status bar. */
0607     void showBinInfo();
0608     /** @brief Find all clip Ids that have a specific tag. */
0609     const QList<QString> getAllClipsWithTag(const QString &tag);
0610 
0611 Q_SIGNALS:
0612     void itemUpdated(std::shared_ptr<AbstractProjectItem>);
0613     void producerReady(const QString &id);
0614     /** @brief Save folder info into MLT. */
0615     void storeFolder(const QString &folderId, const QString &parentId, const QString &oldParentId, const QString &folderName);
0616     void gotFilterJobResults(const QString &, int, int, stringMap, stringMap);
0617     /** @brief Request display of effect stack for a Bin clip. */
0618     void requestShowEffectStack(const QString &clipName, std::shared_ptr<EffectStackModel>, QSize frameSize, bool showKeyframes);
0619     void requestShowClipProperties(const std::shared_ptr<ProjectClip> &clip, bool forceRefresh = false);
0620     /** @brief Request that the given clip is displayed in the clip monitor */
0621     void requestClipShow(std::shared_ptr<ProjectClip>);
0622     void displayBinMessage(const QString &, KMessageWidget::MessageType);
0623     void requesteInvalidRemoval(const QString &, const QString &, const QString &);
0624     /** @brief Analysis data changed, refresh panel. */
0625     void updateAnalysisData(const QString &);
0626     void openClip(std::shared_ptr<ProjectClip> c, int in = -1, int out = -1);
0627     /** @brief Fill context menu with occurrences of this clip in timeline. */
0628     void findInTimeline(const QString &, QList<int> ids = QList<int>());
0629     void clipNameChanged(int, const QString);
0630     /** @brief A clip was updated, request panel update. */
0631     void refreshPanel(const QString &id);
0632     /** @brief Upon selection, activate timeline target tracks. */
0633     void setupTargets(bool hasVideo, QMap <int, QString> audioStreams);
0634     /** @brief A drag event ended, inform timeline. */
0635     void processDragEnd();
0636     void requestBinClose();
0637     /** @brief Update a timeline tab name on clip rename. */
0638     void updateTabName(const QUuid &, const QString &);
0639 };