KTextAddons

emojimodelmanager.h
1/*
2 SPDX-FileCopyrightText: 2021-2025 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6#pragma once
7
8#include "textemoticonscore_export.h"
9#include <QObject>
10#include <memory>
11namespace TextEmoticonsCore
12{
13class EmojiModel;
15/**
16 * @brief The EmojiModelManager class
17 * @author Laurent Montel <montel@kde.org>
18 */
19class TEXTEMOTICONSCORE_EXPORT EmojiModelManager : public QObject
20{
22
23 Q_PROPERTY(TextEmoticonsCore::EmojiModel *emojiModel READ emojiModel CONSTANT)
24 Q_PROPERTY(QStringList recentIdentifier READ recentIdentifier NOTIFY usedIdentifierChanged)
25 Q_PROPERTY(EmojiModelManager::EmojiTone emojiTone READ emojiTone WRITE setEmojiTone NOTIFY emojiToneChanged)
26
27public:
28 enum class EmojiTone : uint8_t {
29 All, // Show all emoji
30 Original, // Show
31 Light, // tone1
32 MediumLight, // tone2
33 Medium, // tone3
34 MediumDark, // tone4
35 Dark, // tone5
36 };
37 Q_ENUM(EmojiTone)
38
39 static EmojiModelManager *self();
40 [[nodiscard]] TextEmoticonsCore::EmojiModel *emojiModel() const;
41
42 /**
43 * @brief Set the settings group name used to store the recent identifiers.
44 * @note If not set, the group name is "EmoticonRecentUsed".
45 */
46 void setRecentSettingsGroupName(const QString &key);
47
48 [[nodiscard]] const QStringList &recentIdentifier() const;
49 void setRecentIdentifier(const QStringList &newRecentIdentifier);
50 Q_INVOKABLE void addIdentifier(const QString &identifier);
51
52 [[nodiscard]] TextEmoticonsCore::CustomEmojiIconManager *customEmojiIconManager() const;
53 void setCustomEmojiIconManager(TextEmoticonsCore::CustomEmojiIconManager *newCustomEmojiIconManager);
54
55 [[nodiscard]] QStringList excludeEmoticons() const;
56 void setExcludeEmoticons(const QStringList &emoticons);
57
58 [[nodiscard]] EmojiModelManager::EmojiTone emojiTone() const;
59 void setEmojiTone(EmojiModelManager::EmojiTone tone);
60
62 void usedIdentifierChanged(const QStringList &lst);
63 void excludeEmoticonsChanged();
64 void emojiToneChanged();
65
66protected:
67 explicit EmojiModelManager(QObject *parent = nullptr);
68 ~EmojiModelManager() override;
69
70private:
71 class EmojiModelManagerPrivate;
72 std::unique_ptr<EmojiModelManagerPrivate> const d;
73};
74}
void setRecentSettingsGroupName(const QString &key)
Set the settings group name used to store the recent identifiers.
The EmojiModel class.
Definition emojimodel.h:21
QObject(QObject *parent)
Q_ENUM(...)
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 28 2025 11:51:55 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.