File indexing completed on 2024-12-08 04:33:08

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolacore_export.h"
0010 #include <QDebug>
0011 
0012 #include <QString>
0013 
0014 class LIBRUQOLACORE_EXPORT BannerInfo
0015 {
0016 public:
0017     BannerInfo();
0018     ~BannerInfo();
0019 
0020     [[nodiscard]] bool isValid() const;
0021 
0022     void parseBannerInfo(const QJsonObject &object);
0023 
0024     [[nodiscard]] bool operator==(const BannerInfo &other) const;
0025 
0026     [[nodiscard]] const QString &text() const;
0027     void setText(const QString &newText);
0028 
0029     [[nodiscard]] const QString &title() const;
0030     void setTitle(const QString &newTitle);
0031 
0032     [[nodiscard]] const QString &link() const;
0033     void setLink(const QString &newLink);
0034 
0035     [[nodiscard]] bool read() const;
0036     void setRead(bool newRead);
0037 
0038     [[nodiscard]] const QStringList &textArguments() const;
0039     void setTextArguments(const QStringList &newTextArguments);
0040 
0041     [[nodiscard]] const QString &identifier() const;
0042     void setIdentifier(const QString &newIdentifier);
0043 
0044     [[nodiscard]] int priority() const;
0045     void setPriority(int newPriority);
0046 
0047     [[nodiscard]] static QString defaultText(const BannerInfo &info);
0048 
0049 private:
0050     QStringList mTextArguments;
0051     QString mText;
0052     QString mTitle;
0053     QString mLink;
0054     QString mIdentifier;
0055     int mPriority = -1;
0056     bool mRead = false;
0057 };
0058 
0059 Q_DECLARE_METATYPE(BannerInfo)
0060 Q_DECLARE_TYPEINFO(BannerInfo, Q_RELOCATABLE_TYPE);
0061 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const BannerInfo &t);