mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-30 09:48:59 -04:00
finished converting GxsMessageFrameWidget to blocking API
This commit is contained in:
parent
55c810f848
commit
cf7a77e512
13 changed files with 98 additions and 41 deletions
|
@ -888,6 +888,7 @@ void PostedListWidget::shallowClearPosts()
|
|||
bool PostedListWidget::insertGroupData(const RsGxsGenericGroupData *data)
|
||||
{
|
||||
insertPostedDetails(*dynamic_cast<const RsPostedGroup*>(data));
|
||||
return true;
|
||||
}
|
||||
|
||||
void PostedListWidget::insertAllPostedPosts(const std::vector<RsPostedPost>& posts, GxsMessageFramePostThread */*thread*/)
|
||||
|
@ -1048,7 +1049,7 @@ void PostedListWidget::getAllMsgData(std::vector<RsGxsGenericMsgData*>& psts)
|
|||
std::vector<RsPostedPost> posts;
|
||||
std::vector<RsGxsComment> comments;
|
||||
|
||||
rsPosted->getBoardContent( groupId(),std::set<RsGxsMessageId>(),posts,comments );
|
||||
rsPosted->getBoardAllContent( groupId(),posts,comments );
|
||||
|
||||
psts.clear();
|
||||
|
||||
|
@ -1073,10 +1074,7 @@ void PostedListWidget::insertPosts(const std::vector<RsGxsGenericMsgData*>& post
|
|||
std::vector<RsPostedPost> cposts;
|
||||
|
||||
for(auto post: posts) // This is not so nice but we have somehow to convert to RsGxsChannelPost at some timer, and the cposts list is being modified in the insert method.
|
||||
{
|
||||
cposts.push_back(*dynamic_cast<RsPostedPost*>(post));
|
||||
delete post;
|
||||
}
|
||||
|
||||
insertPostedPosts(cposts);
|
||||
}
|
||||
|
@ -1086,10 +1084,7 @@ void PostedListWidget::insertAllPosts(const std::vector<RsGxsGenericMsgData*>& p
|
|||
std::vector<RsPostedPost> cposts;
|
||||
|
||||
for(auto post: posts) // This is not so nice but we have somehow to convert to RsGxsChannelPost at some timer, and the cposts list is being modified in the insert method.
|
||||
{
|
||||
cposts.push_back(*dynamic_cast<RsPostedPost*>(post));
|
||||
delete post;
|
||||
}
|
||||
|
||||
insertAllPostedPosts(cposts, NULL);
|
||||
}
|
||||
|
|
|
@ -510,6 +510,12 @@ void GxsMessageFramePostWidget::loadPosts(const std::set<RsGxsMessageId>& msgIds
|
|||
|
||||
mNavigatePendingMsgId.clear();
|
||||
}
|
||||
|
||||
// don't forget to delete posts.
|
||||
|
||||
for(auto& post:posts)
|
||||
delete post;
|
||||
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
|
|
|
@ -81,6 +81,8 @@ protected:
|
|||
//void requestPosts(const std::set<RsGxsMessageId> &msgIds);
|
||||
//void loadPosts(const uint32_t &token);
|
||||
#endif
|
||||
// In the following 3 methods, the memory ownership is kept by GxsMessageFramePostWidget
|
||||
|
||||
virtual bool insertGroupData(const RsGxsGenericGroupData *data) =0;
|
||||
virtual void insertPosts(const std::vector<RsGxsGenericMsgData*>& posts) =0;
|
||||
virtual void insertAllPosts(const std::vector<RsGxsGenericMsgData*>& posts, GxsMessageFramePostThread *thread) =0;
|
||||
|
|
|
@ -148,7 +148,7 @@ void GxsChannelPostsWidget::handleEvent_main_thread(std::shared_ptr<const RsEven
|
|||
case RsChannelEventCode::NEW_CHANNEL:
|
||||
case RsChannelEventCode::UPDATED_MESSAGE:
|
||||
case RsChannelEventCode::NEW_MESSAGE:
|
||||
if(e->mChannelGroupId == mChannelGroupId)
|
||||
if(e->mChannelGroupId == groupId())
|
||||
updateDisplay(true);
|
||||
break;
|
||||
default:
|
||||
|
@ -737,7 +737,6 @@ void GxsChannelPostsWidget::toggleAutoDownload()
|
|||
bool GxsChannelPostsWidget::insertGroupData(const RsGxsGenericGroupData *data)
|
||||
{
|
||||
insertChannelDetails(*dynamic_cast<const RsGxsChannelGroup*>(data));
|
||||
mChannelGroupId = data->mMeta.mGroupId;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -757,7 +756,7 @@ void GxsChannelPostsWidget::getMsgData(const std::set<RsGxsMessageId>& msgIds,st
|
|||
std::vector<RsGxsChannelPost> posts;
|
||||
std::vector<RsGxsComment> comments;
|
||||
|
||||
rsGxsChannels->getChannelContent( mChannelGroupId,msgIds,posts,comments );
|
||||
rsGxsChannels->getChannelContent( groupId(),msgIds,posts,comments );
|
||||
|
||||
psts.clear();
|
||||
|
||||
|
@ -770,7 +769,7 @@ void GxsChannelPostsWidget::getAllMsgData(std::vector<RsGxsGenericMsgData*>& pst
|
|||
std::vector<RsGxsChannelPost> posts;
|
||||
std::vector<RsGxsComment> comments;
|
||||
|
||||
rsGxsChannels->getChannelContent( mChannelGroupId,std::set<RsGxsMessageId>(),posts,comments );
|
||||
rsGxsChannels->getChannelAllContent( groupId(),posts,comments );
|
||||
|
||||
psts.clear();
|
||||
|
||||
|
@ -795,7 +794,6 @@ bool GxsChannelPostsWidget::getGroupData(RsGxsGenericGroupData *& data)
|
|||
{
|
||||
insertChannelDetails(distant_group);
|
||||
data = new RsGxsChannelGroup(distant_group);
|
||||
mChannelGroupId = distant_group.mMeta.mGroupId;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
@ -808,10 +806,7 @@ void GxsChannelPostsWidget::insertAllPosts(const std::vector<RsGxsGenericMsgData
|
|||
std::vector<RsGxsChannelPost> cposts;
|
||||
|
||||
for(auto post: posts) // This is not so nice but we have somehow to convert to RsGxsChannelPost at some timer, and the cposts list is being modified in the insert method.
|
||||
{
|
||||
cposts.push_back(*dynamic_cast<RsGxsChannelPost*>(post));
|
||||
delete post;
|
||||
}
|
||||
cposts.push_back(*static_cast<RsGxsChannelPost*>(post));
|
||||
|
||||
insertChannelPosts(cposts, thread, false);
|
||||
}
|
||||
|
@ -820,10 +815,7 @@ void GxsChannelPostsWidget::insertPosts(const std::vector<RsGxsGenericMsgData*>&
|
|||
std::vector<RsGxsChannelPost> cposts;
|
||||
|
||||
for(auto post: posts) // This is not so nice but we have somehow to convert to RsGxsChannelPost at some timer, and the cposts list is being modified in the insert method.
|
||||
{
|
||||
cposts.push_back(*dynamic_cast<RsGxsChannelPost*>(post));
|
||||
delete post;
|
||||
}
|
||||
cposts.push_back(*static_cast<RsGxsChannelPost*>(post));
|
||||
|
||||
insertChannelPosts(cposts, NULL, true);
|
||||
}
|
||||
|
|
|
@ -66,8 +66,10 @@ protected:
|
|||
/* GxsMessageFramePostWidget */
|
||||
virtual void groupNameChanged(const QString &name);
|
||||
virtual bool insertGroupData(const RsGxsGenericGroupData *data) override;
|
||||
#ifdef TO_REMOVE
|
||||
virtual void insertAllPosts(const uint32_t &token, GxsMessageFramePostThread *thread);
|
||||
virtual void insertPosts(const uint32_t &token);
|
||||
#endif
|
||||
virtual void clearPosts();
|
||||
virtual bool useThread() { return mUseThread; }
|
||||
virtual void fillThreadCreatePost(const QVariant &post, bool related, int current, int count);
|
||||
|
@ -109,7 +111,6 @@ private:
|
|||
QAction *mAutoDownloadAction;
|
||||
|
||||
bool mUseThread;
|
||||
RsGxsGroupId mChannelGroupId;
|
||||
RsEventsHandlerId_t mEventHandlerId ;
|
||||
|
||||
/* UI - from Designer */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue