File indexing completed on 2024-12-01 04:36:50
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "emoticonmenuwidget.h" 0008 #include "customemojiiconmanager.h" 0009 #include "rocketchataccount.h" 0010 #include "ruqola.h" 0011 #include <QVBoxLayout> 0012 #include <TextEmoticonsCore/EmojiModel> 0013 #include <TextEmoticonsCore/EmojiModelManager> 0014 EmoticonMenuWidget::EmoticonMenuWidget(QWidget *parent) 0015 : TextEmoticonsWidgets::EmoticonTextEditSelector(parent) 0016 { 0017 setCustomEmojiSupport(true); 0018 setAttribute(Qt::WA_DeleteOnClose); 0019 loadEmoticons(); 0020 const QSize popupMenuSize = QSize(400, 250); 0021 setFixedSize(popupMenuSize); 0022 TextEmoticonsCore::EmojiModelManager::self()->emojiModel()->setCustomEmojiIconManager(Ruqola::self()->customEmojiIconManager()); 0023 } 0024 0025 EmoticonMenuWidget::~EmoticonMenuWidget() = default; 0026 0027 void EmoticonMenuWidget::setCurrentRocketChatAccount(RocketChatAccount *currentRocketChatAccount) 0028 { 0029 Ruqola::self()->customEmojiIconManager()->setCurrentRocketChatAccount(currentRocketChatAccount); 0030 if (currentRocketChatAccount) { 0031 TextEmoticonsCore::EmojiModelManager::self()->emojiModel()->setCustomEmojiList(currentRocketChatAccount->customEmojies()); 0032 } 0033 } 0034 0035 QSize EmoticonMenuWidget::sizeHint() const 0036 { 0037 return minimumSize(); 0038 } 0039 0040 #include "moc_emoticonmenuwidget.cpp"