File indexing completed on 2024-12-08 12:55:18
0001 // SPDX-FileCopyrightText: 2022 Jeremy Winter <jeremy.winter@tutanota.com> 0002 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0003 0004 #pragma once 0005 0006 #include <QJsonObject> 0007 #include <QObject> 0008 #include <QString> 0009 0010 class Identity; 0011 0012 class Relationship : public QObject 0013 { 0014 Q_OBJECT 0015 0016 Q_PROPERTY(bool following READ following WRITE setFollowing NOTIFY followingChanged) 0017 Q_PROPERTY(bool requested READ requested WRITE setRequested NOTIFY requestedChanged) 0018 Q_PROPERTY(bool endorsed READ endorsed WRITE setEndorsed NOTIFY endorsedChanged) 0019 Q_PROPERTY(bool followedBy READ followedBy WRITE setFollowedBy NOTIFY followedByChanged) 0020 Q_PROPERTY(bool muting READ muting WRITE setMuting NOTIFY mutingChanged) 0021 Q_PROPERTY(bool mutingNotifications READ mutingNotifications WRITE setMutingNotifications NOTIFY mutingNotificationsChanged) 0022 Q_PROPERTY(bool showingReblogs READ showingReblogs WRITE setShowingReblogs NOTIFY showingReblogsChanged) 0023 Q_PROPERTY(bool notifying READ notifying WRITE setNotifying NOTIFY notifyingChanged) 0024 Q_PROPERTY(bool blocking READ blocking WRITE setBlocking NOTIFY blockingChanged) 0025 Q_PROPERTY(bool domainBlocking READ domainBlocking WRITE setDomainBlocking NOTIFY domainBlockingChanged) 0026 Q_PROPERTY(bool blockedBy READ blockedBy WRITE setBlockedBy NOTIFY blockedByChanged) 0027 Q_PROPERTY(QString note READ note WRITE setNote NOTIFY noteChanged) 0028 0029 public: 0030 explicit Relationship(Identity *parent, const QJsonObject &jsonObj); 0031 0032 void updateFromJson(const QJsonObject &jsonObj); 0033 0034 Identity *m_parent; 0035 0036 bool following() const; 0037 void setFollowing(bool following); 0038 bool requested() const; 0039 void setRequested(bool requested); 0040 bool endorsed() const; 0041 void setEndorsed(bool endorsed); 0042 bool followedBy() const; 0043 void setFollowedBy(bool followedBy); 0044 bool muting() const; 0045 void setMuting(bool muting); 0046 bool mutingNotifications() const; 0047 void setMutingNotifications(bool mutingNotifications); 0048 bool showingReblogs() const; 0049 void setShowingReblogs(bool showingReblogs); 0050 bool notifying() const; 0051 void setNotifying(bool notifying); 0052 bool blocking() const; 0053 void setBlocking(bool blocking); 0054 bool domainBlocking() const; 0055 void setDomainBlocking(bool domainBlocking); 0056 bool blockedBy() const; 0057 void setBlockedBy(bool blockedBy); 0058 QString note() const; 0059 void setNote(const QString ¬e); 0060 0061 Q_SIGNALS: 0062 void followingChanged(); 0063 void requestedChanged(); 0064 void endorsedChanged(); 0065 void followedByChanged(); 0066 void mutingChanged(); 0067 void mutingNotificationsChanged(); 0068 void showingReblogsChanged(); 0069 void notifyingChanged(); 0070 void blockingChanged(); 0071 void domainBlockingChanged(); 0072 void blockedByChanged(); 0073 void noteChanged(); 0074 0075 private: 0076 bool m_following = false; 0077 bool m_requested = false; 0078 bool m_endorsed = false; 0079 bool m_followedBy = false; 0080 bool m_muting = false; 0081 bool m_mutingNotifications = false; 0082 bool m_showingReblogs = false; 0083 bool m_notifying = false; 0084 bool m_blocking = false; 0085 bool m_domainBlocking = false; 0086 bool m_blockedBy = false; 0087 QString m_note; 0088 };