Warning, file /network/ruqola/src/core/model/emoticonmodel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "emoticons/customemoji.h" 0010 #include "libruqolacore_export.h" 0011 #include <QAbstractListModel> 0012 #include <TextEmoticonsCore/UnicodeEmoticon> 0013 0014 class RocketChatAccount; 0015 // Model showing all emojis 0016 class LIBRUQOLACORE_EXPORT EmoticonModel : public QAbstractListModel 0017 { 0018 Q_OBJECT 0019 public: 0020 enum EmoticonsRoles { 0021 UnicodeEmojiRole = Qt::UserRole + 1, 0022 CompleterName, // keep value in sync with InputCompleterModel 0023 IdentifierRole, 0024 Category, 0025 IconRole, 0026 }; 0027 Q_ENUM(EmoticonsRoles) 0028 0029 explicit EmoticonModel(RocketChatAccount *account, QObject *parent = nullptr); 0030 ~EmoticonModel() override; 0031 0032 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0033 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override; 0034 0035 [[nodiscard]] QList<TextEmoticonsCore::UnicodeEmoticon> unicodeEmoticons() const; 0036 0037 void setUnicodeEmoticons(const QList<TextEmoticonsCore::UnicodeEmoticon> &emoticons); 0038 0039 [[nodiscard]] const QVector<CustomEmoji> &customEmojiList() const; 0040 void setCustomEmojiList(const QVector<CustomEmoji> &newCustomEmojiList); 0041 0042 private: 0043 [[nodiscard]] LIBRUQOLACORE_NO_EXPORT QIcon createCustomIcon(const QString &name) const; 0044 QList<TextEmoticonsCore::UnicodeEmoticon> mEmoticons; 0045 QVector<CustomEmoji> mCustomEmojiList; 0046 // first int is an index into mEmoticons 0047 // second is -1 for the emoticon identifier or otherwise an index into the alias list 0048 QVector<QPair<int, int>> mUnicodeRows; 0049 QVector<QPair<int, int>> mCustomRows; 0050 RocketChatAccount *const mRocketChatAccount; 0051 };