mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
Added update broadcast component, works, but don't use yet, will change
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6017 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e2ad5b6cb6
commit
470b3df7c2
44
retroshare-gui/src/util/RsGxsUpdateBroadcast.cpp
Normal file
44
retroshare-gui/src/util/RsGxsUpdateBroadcast.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
#include <QTimer>
|
||||
|
||||
#include "RsGxsUpdateBroadcast.h"
|
||||
|
||||
|
||||
RsGxsUpdateBroadcast::RsGxsUpdateBroadcast(RsGxsIfaceImpl *ifaceImpl, float dt, QObject *parent) :
|
||||
QObject(parent), mIfaceImpl(ifaceImpl), mDt(dt)
|
||||
{
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcast::startMonitor()
|
||||
{
|
||||
slowPoll();
|
||||
}
|
||||
|
||||
|
||||
void RsGxsUpdateBroadcast::fastPoll()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcast::slowPoll()
|
||||
{
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
|
||||
std::list<RsGxsGroupId> grps;
|
||||
|
||||
if(mIfaceImpl->updated())
|
||||
{
|
||||
mIfaceImpl->msgsChanged(msgs);
|
||||
if(!msgs.empty())
|
||||
{
|
||||
emit msgsChanged(msgs);
|
||||
}
|
||||
|
||||
mIfaceImpl->groupsChanged(grps);
|
||||
|
||||
if(!grps.empty())
|
||||
{
|
||||
emit grpsChanged(grps);
|
||||
}
|
||||
|
||||
QTimer::singleShot((int) (mDt * 1000.0), this, SLOT(slowPoll()));
|
||||
}
|
||||
}
|
33
retroshare-gui/src/util/RsGxsUpdateBroadcast.h
Normal file
33
retroshare-gui/src/util/RsGxsUpdateBroadcast.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef RSGXSUPDATEBROADCAST_H
|
||||
#define RSGXSUPDATEBROADCAST_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <gxs/rsgxsifaceimpl.h>
|
||||
|
||||
class RsGxsUpdateBroadcast : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RsGxsUpdateBroadcast(RsGxsIfaceImpl* ifaceImpl, float dt, QObject *parent = 0);
|
||||
|
||||
void startMonitor();
|
||||
void update();
|
||||
|
||||
signals:
|
||||
|
||||
void msgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > & msgIds);
|
||||
void grpsChanged(const std::list<RsGxsGroupId>& grpIds);
|
||||
|
||||
public slots:
|
||||
|
||||
void fastPoll();
|
||||
void slowPoll();
|
||||
|
||||
private:
|
||||
|
||||
RsGxsIfaceImpl* mIfaceImpl;
|
||||
float mDt;
|
||||
};
|
||||
|
||||
#endif // RSGXSUPDATEBROADCAST_H
|
Loading…
Reference in New Issue
Block a user