File indexing completed on 2024-03-24 04:54:03
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 0013 class ProjectClip; 0014 class Bin; 0015 0016 /** 0017 * @class ProjectFolder 0018 * @brief A folder in the bin. 0019 */ 0020 class ProjectFolder : public AbstractProjectItem 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 /** 0026 * @brief Creates the supplied folder and loads its children. 0027 * @param description element describing the folder and its children 0028 */ 0029 static std::shared_ptr<ProjectFolder> construct(const QString &id, const QString &name, std::shared_ptr<ProjectItemModel> model); 0030 0031 /** @brief Creates an empty root folder. */ 0032 static std::shared_ptr<ProjectFolder> construct(std::shared_ptr<ProjectItemModel> model); 0033 0034 protected: 0035 ProjectFolder(const QString &id, const QString &name, const std::shared_ptr<ProjectItemModel> &model); 0036 0037 explicit ProjectFolder(const std::shared_ptr<ProjectItemModel> &model); 0038 0039 public: 0040 ~ProjectFolder() override; 0041 0042 /** 0043 * @brief Returns the clip if it is a child (also indirect). 0044 * @param id id of the child which should be returned 0045 */ 0046 std::shared_ptr<ProjectClip> clip(const QString &id) override; 0047 0048 /** 0049 * @brief Returns itself or a child folder that matches the requested id. 0050 * @param id id of the child which should be returned 0051 */ 0052 std::shared_ptr<ProjectFolder> folder(const QString &id) override; 0053 0054 /** @brief Recursively disable/enable bin effects. */ 0055 void setBinEffectsEnabled(bool enabled) override; 0056 0057 /** 0058 * @brief Returns the clip if it is a child (also indirect). 0059 * @param index index of the child which should be returned 0060 */ 0061 std::shared_ptr<ProjectClip> clipAt(int index) override; 0062 0063 /** @brief Returns an xml description of the folder. */ 0064 QDomElement toXml(QDomDocument &document, bool includeMeta = false, bool includeProfile = true) override; 0065 QString getToolTip() const override; 0066 bool rename(const QString &name, int column) override; 0067 /** @brief Returns a list of all children and sub-children clips. */ 0068 QList<std::shared_ptr<ProjectClip>> childClips(); 0069 /** @brief Returns true if folder contains a clip. */ 0070 bool hasChildClips() const; 0071 ClipType::ProducerType clipType() const override; 0072 /** @brief Returns true if item has both audio and video enabled. */ 0073 bool hasAudioAndVideo() const override; 0074 /** @brief Returns a clip id if folder contains clip with matching at \@hash, empty if not found. */ 0075 QString childByHash(const QString &hash); 0076 };