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 #include "qasactorlist.h"
26 //------------------------------------------------------------------------------
28 QMap
<QString
, QASActorList
*> QASActorList::s_actorLists
;
29 void QASActorList::clearCache() { deleteMap
<QASActorList
*>(s_actorLists
); }
31 //------------------------------------------------------------------------------
33 QASActorList::QASActorList(QString url
, QObject
* parent
) :
34 QASObjectList(url
, parent
)
36 m_asType
= QAS_OBJECTLIST
;
38 qDebug() << "new ActorList" << m_url
;
42 //------------------------------------------------------------------------------
44 QASActorList
* QASActorList::getActorList(QVariantMap json
, QObject
* parent
,
46 QString url
= json
["url"].toString();
50 QASActorList
* ol
= s_actorLists
.contains(url
) ? s_actorLists
[url
] :
51 new QASActorList(url
, parent
);
52 s_actorLists
.insert(url
, ol
);
54 ol
->update(json
, id
& QAS_OLDER
);
58 //------------------------------------------------------------------------------
60 QASActor
* QASActorList::at(size_t i
) const {
63 return QASObjectList::at(i
)->asActor();
66 //------------------------------------------------------------------------------
68 QString
QASActorList::actorNames() const {
70 for (size_t i
=0; i
<size(); i
++) {
72 text
+= QString("<a href=\"%1\">%2</a>")
74 .arg(a
->displayNameOrYou());