File indexing completed on 2024-05-12 16:27:34

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include "libruqolawidgets_private_export.h"
0009 #include <QLabel>
0010 class LIBRUQOLAWIDGETS_TESTS_EXPORT RoomHeaderLabel : public QLabel
0011 {
0012     Q_OBJECT
0013 public:
0014     explicit RoomHeaderLabel(QWidget *parent = nullptr);
0015     ~RoomHeaderLabel() override;
0016 
0017     void setRoomAnnouncement(const QString &announcement);
0018     void setRoomTopic(const QString &name);
0019 
0020     [[nodiscard]] const QString &fullText() const;
0021 
0022 protected:
0023     void resizeEvent(QResizeEvent *ev) override;
0024 
0025 private:
0026     LIBRUQOLAWIDGETS_NO_EXPORT void slotMoreInfo(const QString &content);
0027     LIBRUQOLAWIDGETS_NO_EXPORT void updateSqueezedText();
0028     LIBRUQOLAWIDGETS_NO_EXPORT void updateHeaderText();
0029     [[nodiscard]] LIBRUQOLAWIDGETS_NO_EXPORT QString rPixelSqueeze(const QString &text, int maxPixels) const;
0030     [[nodiscard]] LIBRUQOLAWIDGETS_NO_EXPORT QSize textSize(const QString &text) const;
0031     QString mFullText;
0032     QString mTopic;
0033     QString mAnnouncement;
0034     bool mExpandTopic = false;
0035 };