mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-31 03:45:10 -04:00
added code to notify GxsBroadcast system with new distant search results
This commit is contained in:
parent
5b9666855d
commit
6ccc7654d6
15 changed files with 63 additions and 6 deletions
|
@ -245,6 +245,16 @@ void GxsGroupFrameDialog::updateDisplay(bool complete)
|
|||
updateMessageSummaryList(msgIt->first);
|
||||
}
|
||||
}
|
||||
|
||||
updateSearchResults() ;
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::updateSearchResults()
|
||||
{
|
||||
const std::set<TurtleRequestId>& reqs = getSearchResults();
|
||||
|
||||
for(auto it(reqs.begin());it!=reqs.end();++it)
|
||||
std::cerr << "updating search ID " << std::hex << *it << std::dec << std::endl;
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::todo()
|
||||
|
|
|
@ -152,6 +152,7 @@ private:
|
|||
void initUi();
|
||||
|
||||
void updateMessageSummaryList(RsGxsGroupId groupId);
|
||||
void updateSearchResults();
|
||||
|
||||
void openGroupInNewTab(const RsGxsGroupId &groupId);
|
||||
void groupSubscribe(bool subscribe);
|
||||
|
|
|
@ -16,12 +16,19 @@ RsGxsUpdateBroadcastBase::RsGxsUpdateBroadcastBase(RsGxsIfaceHelper *ifaceImpl,
|
|||
connect(mUpdateBroadcast, SIGNAL(changed()), this, SLOT(updateBroadcastChanged()));
|
||||
connect(mUpdateBroadcast, SIGNAL(grpsChanged(std::list<RsGxsGroupId>, std::list<RsGxsGroupId>)), this, SLOT(updateBroadcastGrpsChanged(std::list<RsGxsGroupId>,std::list<RsGxsGroupId>)));
|
||||
connect(mUpdateBroadcast, SIGNAL(msgsChanged(std::map<RsGxsGroupId,std::set<RsGxsMessageId> >, std::map<RsGxsGroupId,std::set<RsGxsMessageId> >)), this, SLOT(updateBroadcastMsgsChanged(std::map<RsGxsGroupId,std::set<RsGxsMessageId> >,std::map<RsGxsGroupId,std::set<RsGxsMessageId> >)));
|
||||
connect(mUpdateBroadcast, SIGNAL(distantSearchResultsChanged(const std::list<TurtleRequestId>&)), this, SLOT(updateBroadcastDistantSearchResultsChanged(const std::list<TurtleRequestId>&)));
|
||||
}
|
||||
|
||||
RsGxsUpdateBroadcastBase::~RsGxsUpdateBroadcastBase()
|
||||
{
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastBase::updateBroadcastDistantSearchResultsChanged(const std::list<TurtleRequestId>& ids)
|
||||
{
|
||||
for(auto it(ids.begin());it!=ids.end();++it)
|
||||
mTurtleResults.insert(*it);
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastBase::fillComplete()
|
||||
{
|
||||
mFillComplete = true;
|
||||
|
@ -37,6 +44,9 @@ void RsGxsUpdateBroadcastBase::securedUpdateDisplay()
|
|||
return;
|
||||
}
|
||||
|
||||
// This is *bad* because if the connection is done asynchronously the client will call mGrpIds, mGrpIdsMeta, etc without the guarranty that the
|
||||
// the structed havnt' been cleared in the mean time.
|
||||
|
||||
emit fillDisplay(mFillComplete);
|
||||
mFillComplete = false;
|
||||
|
||||
|
@ -75,7 +85,7 @@ void RsGxsUpdateBroadcastBase::updateBroadcastChanged()
|
|||
// The question to whether we should re=load when mGrpIds is not empty is still open. It's not harmful anyway.
|
||||
// This should probably be decided by the service itself.
|
||||
|
||||
if (!mGrpIds.empty() || !mGrpIdsMeta.empty() /*|| !mMsgIds.empty()*/ || !mMsgIdsMeta.empty())
|
||||
if (!mGrpIds.empty() || !mGrpIdsMeta.empty() /*|| !mMsgIds.empty()*/ || !mMsgIdsMeta.empty() || !mTurtleResults.empty())
|
||||
mFillComplete = true ;
|
||||
|
||||
securedUpdateDisplay();
|
||||
|
|
|
@ -7,6 +7,8 @@ class QShowEvent;
|
|||
class RsGxsIfaceHelper;
|
||||
class RsGxsUpdateBroadcast;
|
||||
|
||||
typedef uint32_t TurtleRequestId ;
|
||||
|
||||
class RsGxsUpdateBroadcastBase : public QObject
|
||||
{
|
||||
friend class RsGxsUpdateBroadcastPage;
|
||||
|
@ -25,6 +27,7 @@ public:
|
|||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds() { return mMsgIds; }
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta() { return mMsgIdsMeta; }
|
||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||
const std::set<TurtleRequestId>& getSearchResults() { return mTurtleResults ; }
|
||||
|
||||
protected:
|
||||
void fillComplete();
|
||||
|
@ -39,6 +42,7 @@ private slots:
|
|||
void updateBroadcastChanged();
|
||||
void updateBroadcastGrpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId> &grpIdsMeta);
|
||||
void updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
||||
void updateBroadcastDistantSearchResultsChanged(const std::list<TurtleRequestId>& ids);
|
||||
void securedUpdateDisplay();
|
||||
|
||||
private:
|
||||
|
@ -49,4 +53,5 @@ private:
|
|||
std::set<RsGxsGroupId> mGrpIdsMeta;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgIds;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgIdsMeta;
|
||||
std::set<TurtleRequestId> mTurtleResults;
|
||||
};
|
||||
|
|
|
@ -22,6 +22,11 @@ void RsGxsUpdateBroadcastPage::setUpdateWhenInvisible(bool update)
|
|||
mBase->setUpdateWhenInvisible(update);
|
||||
}
|
||||
|
||||
const std::set<TurtleRequestId>& RsGxsUpdateBroadcastPage::getSearchResults()
|
||||
{
|
||||
return mBase->getSearchResults();
|
||||
}
|
||||
|
||||
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIdsMeta()
|
||||
{
|
||||
return mBase->getGrpIdsMeta();
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
class RsGxsIfaceHelper;
|
||||
class RsGxsUpdateBroadcastBase;
|
||||
typedef uint32_t TurtleRequestId ;
|
||||
|
||||
class RsGxsUpdateBroadcastPage : public MainPage
|
||||
{
|
||||
|
@ -30,6 +31,7 @@ public:
|
|||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||
const std::set<TurtleRequestId>& getSearchResults();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
|
|
|
@ -29,6 +29,10 @@ const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIds()
|
|||
return mBase->getGrpIds();
|
||||
}
|
||||
|
||||
const std::set<TurtleRequestId>& RsGxsUpdateBroadcastWidget::getSearchResults()
|
||||
{
|
||||
return mBase->getSearchResults();
|
||||
}
|
||||
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIdsMeta()
|
||||
{
|
||||
return mBase->getGrpIdsMeta();
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
class RsGxsIfaceHelper;
|
||||
class RsGxsUpdateBroadcastBase;
|
||||
typedef uint32_t TurtleRequestId;
|
||||
|
||||
class RsGxsUpdateBroadcastWidget : public QWidget
|
||||
{
|
||||
|
@ -30,6 +31,7 @@ public:
|
|||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||
const std::set<TurtleRequestId>& getSearchResults() ;
|
||||
|
||||
RsGxsIfaceHelper *interfaceHelper() { return mInterfaceHelper; }
|
||||
|
||||
|
|
|
@ -79,5 +79,8 @@ void RsGxsUpdateBroadcast::onChangesReceived(const RsGxsChanges& changes)
|
|||
emit grpsChanged(changes.mGrps, changes.mGrpsMeta);
|
||||
}
|
||||
|
||||
if(!changes.mDistantSearchReqs.empty())
|
||||
emit distantSearchResultsChanged(changes.mDistantSearchReqs) ;
|
||||
|
||||
emit changed();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
class RsGxsIfaceHelper;
|
||||
class RsGxsChanges;
|
||||
|
||||
typedef uint32_t TurtleRequestId ;
|
||||
|
||||
class RsGxsUpdateBroadcast : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -21,6 +23,7 @@ signals:
|
|||
void changed();
|
||||
void msgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
||||
void grpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId>& grpIdsMeta);
|
||||
void distantSearchResultsChanged(const std::list<TurtleRequestId>& reqs);
|
||||
|
||||
private slots:
|
||||
void onChangesReceived(const RsGxsChanges& changes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue