Show webfinger if displayName is unknown for an author.
[larjonas-pumpa.git] / src / qasactor.h
blobd99065b86eb3aef5a8a461dc9090b19fc306a55a
1 /*
2 Copyright 2013-2015 Mats Sjöberg
4 This file is part of the Pumpa programme.
6 Pumpa is free software: you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Pumpa is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Pumpa. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _QASACTOR_H_
21 #define _QASACTOR_H_
23 #include "qasobject.h"
25 #include <QSet>
26 #include <QStringList>
28 //------------------------------------------------------------------------------
30 class QASActor : public QASObject {
31 Q_OBJECT
33 private:
34 QASActor(QString id, QObject* parent);
36 public:
37 static void clearCache();
39 static QASActor* getActor(QVariantMap json, QObject* parent);
40 virtual void update(QVariantMap json);
42 QString webFinger() const { return m_webFinger; }
43 QString displayNameOrWebFinger() const;
44 QString preferredUsername() const { return m_preferredUsername; }
46 QString displayNameOrYou() const { return isYou() ? "You" : displayName(); }
47 void setDisplayName(QString s) { m_displayName = s; }
49 bool isYou() const { return m_isYou; }
50 void setYou();
52 bool followed() const;
53 void setFollowed(bool b);
54 bool followedKnown() const { return s_followed_known || m_followed_set; }
55 static void setFollowedKnown();
56 void followedIsKnown();
58 QString summary() const { return m_summary; }
59 void setSummary(QString s) { m_summary = s; }
61 QString location() const { return m_location; }
62 void setLocation(QString l) { m_location = l; }
64 bool isHidden() const;
65 void setHidden(bool b);
67 static void setHiddenAuthors(QStringList sl);
68 static QStringList getHiddenAuthors() { return s_hiddenAuthors.toList(); }
70 private:
71 static bool s_followed_known;
73 bool m_followed;
74 bool m_followed_json;
75 bool m_followed_set;
76 bool m_isYou;
77 QString m_summary;
78 QString m_location;
80 QString m_webFinger;
81 QString m_preferredUsername;
83 static QMap<QString, QASActor*> s_actors;
84 static QSet<QString> s_hiddenAuthors;
87 #endif /* _QASACTOR_H_ */