2013-07-14 14:48:40 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <retroshare/rsgxsifacetypes.h>
|
|
|
|
|
|
|
|
// This class implement a basic RS functionality which is that widgets displaying info
|
|
|
|
// should update regularly. They also should update only when visible, to save CPU time.
|
|
|
|
//
|
|
|
|
// Using this class simply needs to derive your widget from RsGxsUpdateBroadcastWidget
|
|
|
|
// and oveload the updateDisplay() function with the actual code that updates the
|
|
|
|
// widget.
|
|
|
|
//
|
|
|
|
|
|
|
|
class RsGxsIfaceHelper;
|
|
|
|
class RsGxsUpdateBroadcastBase;
|
|
|
|
|
|
|
|
class RsGxsUpdateBroadcastWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
RsGxsUpdateBroadcastWidget(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL, Qt::WindowFlags flags = 0);
|
|
|
|
virtual ~RsGxsUpdateBroadcastWidget();
|
|
|
|
|
2014-05-05 17:53:47 -04:00
|
|
|
void fillComplete();
|
2013-07-14 14:48:40 -04:00
|
|
|
void setUpdateWhenInvisible(bool update);
|
2014-05-06 16:19:04 -04:00
|
|
|
const std::list<RsGxsGroupId> &getGrpIds();
|
2014-07-04 17:51:17 -04:00
|
|
|
const std::list<RsGxsGroupId> &getGrpIdsMeta();
|
|
|
|
void getAllGrpIds(std::list<RsGxsGroupId> &grpIds);
|
2014-05-06 16:19:04 -04:00
|
|
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();
|
2014-07-04 17:51:17 -04:00
|
|
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIdsMeta();
|
|
|
|
void getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds);
|
2013-07-14 14:48:40 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void showEvent(QShowEvent *event);
|
|
|
|
|
|
|
|
// This is overloaded in subclasses.
|
2013-07-19 05:48:51 -04:00
|
|
|
virtual void updateDisplay(bool complete) = 0;
|
2013-07-14 14:48:40 -04:00
|
|
|
|
|
|
|
private slots:
|
2013-07-19 05:48:51 -04:00
|
|
|
void fillDisplay(bool complete);
|
2013-07-14 14:48:40 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
RsGxsUpdateBroadcastBase *mBase;
|
|
|
|
};
|