File indexing completed on 2024-12-01 04:37:03

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolawidgets_private_export.h"
0010 #include <QLabel>
0011 #include <QPointer>
0012 #include <QWidget>
0013 class Room;
0014 class UsersInRoomMenu;
0015 class LIBRUQOLAWIDGETS_TESTS_EXPORT UserLabel : public QLabel
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit UserLabel(QWidget *parent = nullptr);
0020     ~UserLabel() override;
0021     void setRoom(Room *room);
0022     void setUserId(const QString &userId);
0023     void setUserName(const QString &userName);
0024 
0025 private:
0026     LIBRUQOLAWIDGETS_NO_EXPORT void slotCustomContextMenuRequested(const QPoint &pos);
0027     LIBRUQOLAWIDGETS_NO_EXPORT void slotOpenConversation();
0028     QString mUserId;
0029     QString mUserName;
0030     QPointer<Room> mRoom;
0031     UsersInRoomMenu *mMenu = nullptr;
0032 };
0033 
0034 class LIBRUQOLAWIDGETS_TESTS_EXPORT UsersInRoomLabel : public QWidget
0035 {
0036     Q_OBJECT
0037 public:
0038     struct UserInfo {
0039         QString userName;
0040         QString userId;
0041         QString iconStatus;
0042         QString userDisplayName;
0043     };
0044     explicit UsersInRoomLabel(QWidget *parent = nullptr);
0045     ~UsersInRoomLabel() override;
0046 
0047     void setUserInfo(const UsersInRoomLabel::UserInfo &info);
0048     void setRoom(Room *room);
0049 
0050 private:
0051     UsersInRoomLabel::UserInfo mInfo;
0052     QLabel *const mIconLabel;
0053     UserLabel *const mUserNameLabel;
0054 };
0055 Q_DECLARE_METATYPE(UsersInRoomLabel::UserInfo)
0056 Q_DECLARE_TYPEINFO(UsersInRoomLabel::UserInfo, Q_RELOCATABLE_TYPE);