File indexing completed on 2024-04-21 04:52:23
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 <QMutex> 0009 #include <QTabWidget> 0010 #include <memory> 0011 0012 class TimelineWidget; 0013 class TimelineItemModel; 0014 class AssetParameterModel; 0015 class EffectStackModel; 0016 class MonitorProxy; 0017 class QMenu; 0018 0019 /** @class TimelineContainer 0020 @brief This is a class that extends QTabWidget to provide additional functionality related to timeline tabs 0021 */ 0022 class TimelineContainer : public QWidget 0023 { 0024 0025 public: 0026 TimelineContainer(QWidget *parent); 0027 0028 protected: 0029 QSize sizeHint() const override; 0030 }; 0031 0032 class TimelineTabs : public QTabWidget 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 /** @brief Construct the tabs as well as the widget for the main timeline */ 0038 TimelineTabs(QWidget *parent); 0039 ~TimelineTabs() override; 0040 0041 /** @brief Returns a pointer to the current timeline */ 0042 TimelineWidget *getCurrentTimeline() const; 0043 /** @brief Activate a timeline tab by uuid */ 0044 bool raiseTimeline(const QUuid &uuid); 0045 void disconnectTimeline(TimelineWidget *timeline); 0046 /** @brief Do some closing stuff on timelinewidgets */ 0047 void closeTimelines(); 0048 /** @brief Store timeline menus */ 0049 void setTimelineMenu(QMenu *compositionMenu, QMenu *timelineMenu, QMenu *guideMenu, QMenu *timelineRulerMenu, QAction *editGuideAction, QMenu *headerMenu, 0050 QMenu *thumbsMenu, QMenu *subtitleClipMenu); 0051 /** @brief Mark a tab as modified */ 0052 void setModified(const QUuid &uuid, bool modified); 0053 /** @brief Returns the uuid list for opened timeline tabs. */ 0054 const QStringList openedSequences(); 0055 /** @brief Get a timeline tab by uuid. */ 0056 TimelineWidget *getTimeline(const QUuid uuid) const; 0057 /** @brief We display the current tab's name in window title if the tab bar is hidden 0058 */ 0059 void updateWindowTitle(); 0060 /** @brief Build the timeline clip menu with dynamic actions. */ 0061 void buildClipMenu(); 0062 0063 protected: 0064 /** @brief Helper function to connect a timeline's signals/slots*/ 0065 void connectTimeline(TimelineWidget *timeline); 0066 0067 Q_SIGNALS: 0068 /** @brief Request repaint of audio thumbs 0069 This is an input signal, forwarded to the timelines 0070 */ 0071 void audioThumbFormatChanged(); 0072 0073 /** @brief The parameter controlling whether we show video thumbnails has changed 0074 This is an input signal, forwarded to the timelines 0075 */ 0076 void showThumbnailsChanged(); 0077 0078 /** @brief The parameter controlling whether we show audio thumbnails has changed 0079 This is an input signal, forwarded to the timelines 0080 */ 0081 void showAudioThumbnailsChanged(); 0082 0083 /** @brief Change the level of zoom 0084 This is an input signal, forwarded to the timelines 0085 */ 0086 void changeZoom(int value, bool zoomOnMouse); 0087 void fitZoom(); 0088 /** @brief Requests that a given parameter model is displayed in the asset panel */ 0089 void showTransitionModel(int tid, std::shared_ptr<AssetParameterModel>); 0090 /** @brief Requests that a given mix is displayed in the asset panel */ 0091 void showMixModel(int cid, std::shared_ptr<AssetParameterModel>, bool refreshOnly); 0092 /** @brief Requests that a given effectstack model is displayed in the asset panel */ 0093 void showItemEffectStack(const QString &clipName, std::shared_ptr<EffectStackModel>, QSize size, bool showKeyframes); 0094 void showSubtitle(int itemId); 0095 void updateAssetPosition(int itemId, const QUuid uuid); 0096 /** @brief Zoom level changed in timeline, update slider 0097 */ 0098 void updateZoom(int); 0099 0100 public Q_SLOTS: 0101 TimelineWidget *addTimeline(const QUuid uuid, const QString &tabName, std::shared_ptr<TimelineItemModel> timelineModel, MonitorProxy *proxy); 0102 void connectCurrent(int ix); 0103 void closeTimelineByIndex(int ix); 0104 void closeTimelineTab(const QUuid uuid); 0105 void renameTab(const QUuid &uuid, const QString &name); 0106 void slotNextSequence(); 0107 void slotPreviousSequence(); 0108 0109 private Q_SLOTS: 0110 void onTabBarDoubleClicked(int index); 0111 0112 private: 0113 TimelineWidget *m_activeTimeline; 0114 QMenu *m_timelineClipMenu{nullptr}; 0115 QMenu *m_timelineCompositionMenu; 0116 QMenu *m_timelineMenu; 0117 QMenu *m_timelineRulerMenu; 0118 QMenu *m_guideMenu; 0119 QMenu *m_headerMenu; 0120 QMenu *m_thumbsMenu; 0121 QAction *m_editGuideAction; 0122 QMenu *m_timelineSubtitleClipMenu; 0123 QMutex m_lock; 0124 };