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 WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 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/>.
23 #include "qactivitystreams.h"
24 #include "objectwidgetwithsignals.h"
27 #include <QScrollArea>
28 #include <QVBoxLayout>
30 //------------------------------------------------------------------------------
32 class ASWidget
: public QScrollArea
{
36 ASWidget(QWidget
* parent
, int widgetLimit
=-1, int purgeWait
=10);
37 virtual void refreshTimeLabels();
38 virtual void fetchNewer();
39 virtual void fetchOlder(int count
=-1);
41 void setEndpoint(QString endpoint
, QObject
* parent
, int asMode
=-1);
42 QString
url() const { return m_list
->url(); }
44 int count() const { return m_object_set
.size(); }
45 const QList
<QASAbstractObject
*>& newObjects() { return m_newObjects
; }
46 virtual bool hasObject(QASAbstractObject
* obj
) {
47 return m_object_set
.contains(obj
);
50 bool linksInitialised() const { return !m_list
->firstTime(); }
55 void request(QString
, int);
56 void newReply(QASObject
*, QASObjectList
*, QASObjectList
*);
57 void linkHovered(const QString
&);
58 void like(QASObject
*);
59 void share(QASObject
*);
60 void showContext(QASObject
*);
61 void follow(QString
, bool);
62 void deleteObject(QASObject
*);
63 void editObject(QASObject
*);
66 virtual void update();
69 virtual QASAbstractObjectList
* initList(QString endpoint
, QObject
* parent
);
71 QASAbstractObject
* objectAt(int idx
);
72 ObjectWidgetWithSignals
* widgetAt(int idx
);
73 virtual ObjectWidgetWithSignals
* createWidget(QASAbstractObject
*);
74 virtual void changeWidgetObject(ObjectWidgetWithSignals
*, QASAbstractObject
*);
75 virtual bool countAsNew(QASAbstractObject
*) { return true; }
77 void keyPressEvent(QKeyEvent
* event
);
80 void refreshObject(QASAbstractObject
* obj
);
82 QVBoxLayout
* m_itemLayout
;
83 QWidget
* m_listContainer
;
86 QSet
<QASAbstractObject
*> m_object_set
;
87 QASAbstractObjectList
* m_list
;
96 QList
<QASAbstractObject
*> m_newObjects
;
99 #endif /* _ASWIDGET_H_ */