finished converting GxsMessageFrameWidget to blocking API

This commit is contained in:
csoler 2020-03-31 20:21:16 +02:00
parent 55c810f848
commit cf7a77e512
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
13 changed files with 98 additions and 41 deletions

View file

@ -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);
}

View file

@ -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 */