File indexing completed on 2024-06-16 04:27:57

0001 /*
0002     This file is part of KDE.
0003 
0004     SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 #include <QApplication>
0009 #include <QVBoxLayout>
0010 #include <QWidget>
0011 
0012 #include <TextEmoticonsCore/EmojiModel>
0013 #include <TextEmoticonsCore/EmojiModelManager>
0014 
0015 #include "customemojiiconmanagerguitest.h"
0016 #include "emoticontexteditselector.h"
0017 
0018 class Window : public QWidget
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit Window(QWidget *parent = nullptr)
0023         : QWidget(parent)
0024     {
0025         auto mainLayout = new QVBoxLayout(this);
0026         auto w = new TextEmoticonsWidgets::EmoticonTextEditSelector(this);
0027         auto customEmojiIconManager = new CustomEmojiIconManagerGuiTest(this);
0028         w->setCustomEmojiSupport(true);
0029         TextEmoticonsCore::EmojiModelManager::self()->emojiModel()->setCustomEmojiIconManager(customEmojiIconManager);
0030 
0031         QList<TextEmoticonsCore::CustomEmoji> customEmoji;
0032         {
0033             TextEmoticonsCore::CustomEmoji custom;
0034             custom.setIdentifier(QStringLiteral(":custom1:"));
0035             customEmoji.append(custom);
0036         }
0037         {
0038             TextEmoticonsCore::CustomEmoji custom;
0039             custom.setIdentifier(QStringLiteral(":custom2:"));
0040             customEmoji.append(custom);
0041         }
0042         {
0043             TextEmoticonsCore::CustomEmoji custom;
0044             custom.setIdentifier(QStringLiteral(":gif1:"));
0045             custom.setIsAnimatedEmoji(true);
0046             customEmoji.append(custom);
0047         }
0048         TextEmoticonsCore::EmojiModelManager::self()->emojiModel()->setCustomEmojiList(customEmoji);
0049         w->loadEmoticons();
0050 
0051         mainLayout->addWidget(w);
0052     }
0053 };
0054 
0055 int main(int argc, char *argv[])
0056 {
0057     QApplication app(argc, argv);
0058     Window window;
0059 
0060     window.show();
0061     return app.exec();
0062 }
0063 
0064 #include "emoticontexteditselector_customemoji_gui.moc"