RetroShare/retroshare-gui/src/util/RsGxsUpdateBroadcast.cpp
chrisparker126 50c75de73c Refactored GXS interface to remove exposure to RS internals (i.e. only reference types, declaration in retroshare folder)
To achieve this I created second interface RsGxsIface which RsGxsGenExchange derives from, and RsGxsIfaceImpl (renamed RsGxsIfaceHelper) now takes an instance of this instead so these interfaces don't exposed the RsGenExchange and its underlying types. 

The other stuff is simply definitions and type aliases required for the front-ends to work (RsGroupMeta, RsGroupId, etc) and I've moved gxs flags also. 

This is a good idea as it seem much more clear what's available to a GXS service (apart from RsGenExchange public methods).  


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6166 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2013-02-28 21:58:38 +00:00

45 lines
868 B
C++

#include <QTimer>
#include "RsGxsUpdateBroadcast.h"
RsGxsUpdateBroadcast::RsGxsUpdateBroadcast(RsGxsIfaceHelper *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()));
}
}