File indexing completed on 2024-06-23 04:26:33
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Saurabh Kumar <saurabhk660@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #ifndef COMMENT_MODEL 0007 #define COMMENT_MODEL 0008 0009 #include "StoryboardItem.h" 0010 0011 #include <QAbstractListModel> 0012 #include <QAbstractButton> 0013 0014 #include <kritastoryboarddocker_export.h> 0015 0016 class StoryboardModel; 0017 0018 /** 0019 * @class CommentBox 0020 * @brief This model manages the comment data of StoryboardModel. 0021 * It enables addition, deletion and modification of comments in 0022 * the @a Comments menu of the storyboard docker. 0023 */ 0024 class KRITASTORYBOARDDOCKER_EXPORT StoryboardCommentModel : public QAbstractListModel 0025 { 0026 0027 Q_OBJECT 0028 0029 public: 0030 StoryboardCommentModel(QObject *parent = 0); 0031 0032 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0033 0034 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0035 0036 Qt::ItemFlags flags(const QModelIndex &index) const override; 0037 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; 0038 0039 bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) override; 0040 bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) override; 0041 bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, 0042 const QModelIndex &destinationParent, int destinationChild) override; 0043 0044 QStringList mimeTypes() const override; 0045 QMimeData *mimeData(const QModelIndexList &indexes) const override; 0046 bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override; 0047 0048 Qt::DropActions supportedDropActions() const override; 0049 Qt::DropActions supportedDragActions() const override; 0050 0051 /** 0052 * @brief resets m_commentList to @c list. 0053 * @param list The new list. 0054 */ 0055 void resetData(QVector<StoryboardComment> list); 0056 /** 0057 * @brief returns a list of comments 0058 * @return m_commentList 0059 */ 0060 QVector<StoryboardComment> getData(); 0061 0062 Q_SIGNALS: 0063 /** 0064 * @brief Emitted whenever m_items is changed. 0065 * it is used to keep the StoryboardItemList in KisDocument 0066 * in sync with m_items 0067 */ 0068 void sigCommentListChanged(); 0069 //TODO: Use a signal compressor to reduce frequency 0070 private: 0071 QVector<StoryboardComment> m_commentList; 0072 friend class StoryboardModel; 0073 }; 0074 0075 #endif