File indexing completed on 2024-12-22 04:28:16

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "textemoticonscore_export.h"
0010 #include <QAbstractListModel>
0011 #include <TextEmoticonsCore/CustomEmoji>
0012 #include <TextEmoticonsCore/UnicodeEmoticon>
0013 namespace TextEmoticonsCore
0014 {
0015 class CustomEmojiIconManager;
0016 /**
0017  * @brief The EmojiModel class
0018  * @author Laurent Montel <montel@kde.org>
0019  */
0020 class TEXTEMOTICONSCORE_EXPORT EmojiModel : public QAbstractListModel
0021 {
0022     Q_OBJECT
0023 public:
0024     enum EmoticonsRoles {
0025         UnicodeEmoji = Qt::UserRole + 1,
0026         Identifier,
0027         Category,
0028         Order,
0029         Animated,
0030         AnimatedFileName,
0031     };
0032     Q_ENUM(EmoticonsRoles)
0033 
0034     explicit EmojiModel(QObject *parent = nullptr);
0035     ~EmojiModel() override;
0036 
0037     [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
0038     [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
0039 
0040     [[nodiscard]] const QList<TextEmoticonsCore::UnicodeEmoticon> &emoticonList() const;
0041     void setUnicodeEmoticonList(const QList<TextEmoticonsCore::UnicodeEmoticon> &newEmoticonList);
0042 
0043     [[nodiscard]] QList<TextEmoticonsCore::CustomEmoji> customEmojiList() const;
0044     void setCustomEmojiList(const QList<TextEmoticonsCore::CustomEmoji> &newCustomEmojiList);
0045 
0046     [[nodiscard]] TextEmoticonsCore::CustomEmojiIconManager *customEmojiIconManager() const;
0047     void setCustomEmojiIconManager(TextEmoticonsCore::CustomEmojiIconManager *newCustomEmojiIconManager);
0048 
0049     void setExcludeEmoticons(const QStringList &emoticons);
0050 
0051 private:
0052     Q_DISABLE_COPY(EmojiModel)
0053     QList<TextEmoticonsCore::UnicodeEmoticon> mEmoticonList;
0054     QList<TextEmoticonsCore::CustomEmoji> mCustomEmojiList;
0055     TextEmoticonsCore::CustomEmojiIconManager *mCustomEmojiIconManager = nullptr;
0056 };
0057 }