diff --git a/retroshare-gui/src/gui/Posted/PostedListWidget.cpp b/retroshare-gui/src/gui/Posted/PostedListWidget.cpp index d5b191392..586b673ed 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidget.cpp +++ b/retroshare-gui/src/gui/Posted/PostedListWidget.cpp @@ -44,14 +44,14 @@ PostedListWidget::PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent ui->setupUi(this); /* Setup UI helper */ + mStateHelper->addWidget(mTokenTypeAllPosts, ui->hotSortButton); + mStateHelper->addWidget(mTokenTypeAllPosts, ui->newSortButton); + mStateHelper->addWidget(mTokenTypeAllPosts, ui->topSortButton); + mStateHelper->addWidget(mTokenTypePosts, ui->hotSortButton); mStateHelper->addWidget(mTokenTypePosts, ui->newSortButton); mStateHelper->addWidget(mTokenTypePosts, ui->topSortButton); - mStateHelper->addWidget(mTokenTypeRelatedPosts, ui->hotSortButton); - mStateHelper->addWidget(mTokenTypeRelatedPosts, ui->newSortButton); - mStateHelper->addWidget(mTokenTypeRelatedPosts, ui->topSortButton); - mStateHelper->addWidget(mTokenTypeGroupData, ui->submitPostButton); mStateHelper->addWidget(mTokenTypeGroupData, ui->subscribeToolButton); @@ -107,7 +107,7 @@ void PostedListWidget::processSettings(bool /*load*/) QIcon PostedListWidget::groupIcon() { - if (mStateHelper->isLoading(mTokenTypeGroupData) || mStateHelper->isLoading(mTokenTypePosts)) { + if (mStateHelper->isLoading(mTokenTypeGroupData) || mStateHelper->isLoading(mTokenTypeAllPosts)) { // return QIcon(":/images/kalarm.png"); } @@ -526,7 +526,7 @@ bool PostedListWidget::insertGroupData(const uint32_t &token, RsGroupMetaData &m return false; } -void PostedListWidget::insertPosts(const uint32_t &token, GxsMessageFramePostThread */*thread*/) +void PostedListWidget::insertAllPosts(const uint32_t &token, GxsMessageFramePostThread */*thread*/) { std::vector posts; rsPosted->getPostData(token, posts); @@ -541,10 +541,10 @@ void PostedListWidget::insertPosts(const uint32_t &token, GxsMessageFramePostThr applyRanking(); } -void PostedListWidget::insertRelatedPosts(const uint32_t &token) +void PostedListWidget::insertPosts(const uint32_t &token) { std::vector posts; - rsPosted->getRelatedPosts(token, posts); + rsPosted->getPostData(token, posts); std::vector::iterator vit; for(vit = posts.begin(); vit != posts.end(); ++vit) diff --git a/retroshare-gui/src/gui/Posted/PostedListWidget.h b/retroshare-gui/src/gui/Posted/PostedListWidget.h index 7a9348d64..be6c5411f 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidget.h +++ b/retroshare-gui/src/gui/Posted/PostedListWidget.h @@ -60,8 +60,8 @@ public: protected: /* GxsMessageFramePostWidget */ virtual bool insertGroupData(const uint32_t &token, RsGroupMetaData &metaData); - virtual void insertPosts(const uint32_t &token, GxsMessageFramePostThread *thread); - virtual void insertRelatedPosts(const uint32_t &token); + virtual void insertAllPosts(const uint32_t &token, GxsMessageFramePostThread *thread); + virtual void insertPosts(const uint32_t &token); virtual void clearPosts(); virtual bool navigatePostItem(const RsGxsMessageId& msgId); diff --git a/retroshare-gui/src/gui/gxs/GxsMessageFramePostWidget.cpp b/retroshare-gui/src/gui/gxs/GxsMessageFramePostWidget.cpp index 361910614..f9808a4d9 100644 --- a/retroshare-gui/src/gui/gxs/GxsMessageFramePostWidget.cpp +++ b/retroshare-gui/src/gui/gxs/GxsMessageFramePostWidget.cpp @@ -36,8 +36,8 @@ GxsMessageFramePostWidget::GxsMessageFramePostWidget(RsGxsIfaceHelper *ifaceImpl mFillThread = NULL; mTokenTypeGroupData = nextTokenType(); + mTokenTypeAllPosts = nextTokenType(); mTokenTypePosts = nextTokenType(); - mTokenTypeRelatedPosts = nextTokenType(); } GxsMessageFramePostWidget::~GxsMessageFramePostWidget() @@ -76,7 +76,7 @@ bool GxsMessageFramePostWidget::navigate(const RsGxsMessageId &msgId) return false; } - if (mStateHelper->isLoading(mTokenTypePosts) || mStateHelper->isLoading(mTokenTypeRelatedPosts)) { + if (mStateHelper->isLoading(mTokenTypeAllPosts) || mStateHelper->isLoading(mTokenTypePosts)) { mNavigatePendingMsgId = msgId; /* No information if group is available */ @@ -88,7 +88,7 @@ bool GxsMessageFramePostWidget::navigate(const RsGxsMessageId &msgId) bool GxsMessageFramePostWidget::isLoading() { - if (mStateHelper->isLoading(mTokenTypePosts) || mStateHelper->isLoading(mTokenTypeRelatedPosts)) { + if (mStateHelper->isLoading(mTokenTypeAllPosts) || mStateHelper->isLoading(mTokenTypePosts)) { return true; } @@ -100,7 +100,7 @@ void GxsMessageFramePostWidget::updateDisplay(bool complete) if (complete) { /* Fill complete */ requestGroupData(); - requestPosts(); + requestAllPosts(); return; } @@ -118,14 +118,14 @@ void GxsMessageFramePostWidget::updateDisplay(bool complete) if (!groupId().isNull() && std::find(grpIds.begin(), grpIds.end(), groupId()) != grpIds.end()) { updateGroup = true; /* Do we need to fill all posts? */ - requestPosts(); + requestAllPosts(); } else { std::map > msgs; getAllMsgIds(msgs); if (!msgs.empty()) { std::map >::const_iterator mit = msgs.find(groupId()); if (mit != msgs.end()) { - requestRelatedPosts(mit->second); + requestPosts(mit->second); } } } @@ -155,7 +155,7 @@ void GxsMessageFramePostWidget::fillThreadFinished() /* Current thread has finished */ mFillThread = NULL; - mStateHelper->setLoading(mTokenTypePosts, false); + mStateHelper->setLoading(mTokenTypeAllPosts, false); emit groupChanged(this); if (!mNavigatePendingMsgId.isNull()) { @@ -258,10 +258,10 @@ void GxsMessageFramePostWidget::loadGroupData(const uint32_t &token) emit groupChanged(this); } -void GxsMessageFramePostWidget::requestPosts() +void GxsMessageFramePostWidget::requestAllPosts() { #ifdef ENABLE_DEBUG - std::cerr << "GxsMessageFramePostWidget::requestPosts()"; + std::cerr << "GxsMessageFramePostWidget::requestAllPosts()"; std::cerr << std::endl; #endif @@ -269,7 +269,7 @@ void GxsMessageFramePostWidget::requestPosts() /* Request all posts */ - mTokenQueue->cancelActiveRequestTokens(mTokenTypePosts); + mTokenQueue->cancelActiveRequestTokens(mTokenTypeAllPosts); if (mFillThread) { /* Stop current fill thread */ @@ -277,20 +277,20 @@ void GxsMessageFramePostWidget::requestPosts() mFillThread = NULL; thread->stop(false); - mStateHelper->setLoading(mTokenTypePosts, false); + mStateHelper->setLoading(mTokenTypeAllPosts, false); } clearPosts(); if (groupId().isNull()) { - mStateHelper->setActive(mTokenTypePosts, false); - mStateHelper->setLoading(mTokenTypePosts, false); - mStateHelper->clear(mTokenTypePosts); + mStateHelper->setActive(mTokenTypeAllPosts, false); + mStateHelper->setLoading(mTokenTypeAllPosts, false); + mStateHelper->clear(mTokenTypeAllPosts); emit groupChanged(this); return; } - mStateHelper->setLoading(mTokenTypePosts, true); + mStateHelper->setLoading(mTokenTypeAllPosts, true); emit groupChanged(this); std::list groupIds; @@ -300,17 +300,17 @@ void GxsMessageFramePostWidget::requestPosts() opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; uint32_t token; - mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, mTokenTypePosts); + mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, mTokenTypeAllPosts); } -void GxsMessageFramePostWidget::loadPosts(const uint32_t &token) +void GxsMessageFramePostWidget::loadAllPosts(const uint32_t &token) { #ifdef ENABLE_DEBUG - std::cerr << "GxsMessageFramePostWidget::loadPosts()"; + std::cerr << "GxsMessageFramePostWidget::loadAllPosts()"; std::cerr << std::endl; #endif - mStateHelper->setActive(mTokenTypePosts, true); + mStateHelper->setActive(mTokenTypeAllPosts, true); if (useThread()) { /* Create fill thread */ @@ -321,15 +321,15 @@ void GxsMessageFramePostWidget::loadPosts(const uint32_t &token) connect(mFillThread, SIGNAL(addPost(QVariant,bool,int,int)), this, SLOT(fillThreadAddPost(QVariant,bool,int,int)), Qt::BlockingQueuedConnection); #ifdef ENABLE_DEBUG - std::cerr << "GxsMessageFramePostWidget::loadPosts() Start fill thread" << std::endl; + std::cerr << "GxsMessageFramePostWidget::loadAllPosts() Start fill thread" << std::endl; #endif /* Start thread */ mFillThread->start(); } else { - insertPosts(token, NULL); + insertAllPosts(token, NULL); - mStateHelper->setLoading(mTokenTypePosts, false); + mStateHelper->setLoading(mTokenTypeAllPosts, false); if (!mNavigatePendingMsgId.isNull()) { navigate(mNavigatePendingMsgId); @@ -341,21 +341,21 @@ void GxsMessageFramePostWidget::loadPosts(const uint32_t &token) emit groupChanged(this); } -void GxsMessageFramePostWidget::requestRelatedPosts(const std::vector &msgIds) +void GxsMessageFramePostWidget::requestPosts(const std::vector &msgIds) { #ifdef ENABLE_DEBUG - std::cerr << "GxsMessageFramePostWidget::requestRelatedPosts()"; + std::cerr << "GxsMessageFramePostWidget::requestPosts()"; std::cerr << std::endl; #endif mNavigatePendingMsgId.clear(); - mTokenQueue->cancelActiveRequestTokens(mTokenTypeRelatedPosts); + mTokenQueue->cancelActiveRequestTokens(mTokenTypePosts); if (groupId().isNull()) { - mStateHelper->setActive(mTokenTypeRelatedPosts, false); - mStateHelper->setLoading(mTokenTypeRelatedPosts, false); - mStateHelper->clear(mTokenTypeRelatedPosts); + mStateHelper->setActive(mTokenTypePosts, false); + mStateHelper->setLoading(mTokenTypePosts, false); + mStateHelper->clear(mTokenTypePosts); emit groupChanged(this); return; } @@ -364,33 +364,30 @@ void GxsMessageFramePostWidget::requestRelatedPosts(const std::vectorsetLoading(mTokenTypeRelatedPosts, true); + mStateHelper->setLoading(mTokenTypePosts, true); emit groupChanged(this); RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA; - opts.mOptions = RS_TOKREQOPT_MSG_VERSIONS; + opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; uint32_t token; - std::vector relatedMsgIds; - for (std::vector::const_iterator msgIt = msgIds.begin(); msgIt != msgIds.end(); ++msgIt) { - relatedMsgIds.push_back(RsGxsGrpMsgIdPair(groupId(), *msgIt)); - } - mTokenQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, relatedMsgIds, mTokenTypeRelatedPosts); + GxsMsgReq requestMsgIds; + requestMsgIds[groupId()] = msgIds; + mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, requestMsgIds, mTokenTypePosts); } -void GxsMessageFramePostWidget::loadRelatedPosts(const uint32_t &token) +void GxsMessageFramePostWidget::loadPosts(const uint32_t &token) { #ifdef ENABLE_DEBUG - std::cerr << "GxsMessageFramePostWidget::loadRelatedPosts()"; + std::cerr << "GxsMessageFramePostWidget::loadPosts()"; std::cerr << std::endl; #endif - mStateHelper->setActive(mTokenTypeRelatedPosts, true); + mStateHelper->setActive(mTokenTypePosts, true); - insertRelatedPosts(token); + insertPosts(token); - mStateHelper->setLoading(mTokenTypeRelatedPosts, false); + mStateHelper->setLoading(mTokenTypePosts, false); emit groupChanged(this); if (!mNavigatePendingMsgId.isNull()) { @@ -414,13 +411,13 @@ void GxsMessageFramePostWidget::loadRequest(const TokenQueue *queue, const Token return; } - if (req.mUserType == mTokenTypePosts) { - loadPosts(req.mToken); + if (req.mUserType == mTokenTypeAllPosts) { + loadAllPosts(req.mToken); return; } - if (req.mUserType == mTokenTypeRelatedPosts) { - loadRelatedPosts(req.mToken); + if (req.mUserType == mTokenTypePosts) { + loadPosts(req.mToken); return; } } @@ -465,7 +462,7 @@ void GxsMessageFramePostThread::run() std::cerr << "GxsMessageFramePostThread::run()" << std::endl; #endif - mParent->insertPosts(mToken, this); + mParent->insertAllPosts(mToken, this); #ifdef ENABLE_DEBUG std::cerr << "GxsMessageFramePostThread::run() stopped: " << (stopped() ? "yes" : "no") << std::endl; diff --git a/retroshare-gui/src/gui/gxs/GxsMessageFramePostWidget.h b/retroshare-gui/src/gui/gxs/GxsMessageFramePostWidget.h index 2b9e54fa1..d01a0ca42 100644 --- a/retroshare-gui/src/gui/gxs/GxsMessageFramePostWidget.h +++ b/retroshare-gui/src/gui/gxs/GxsMessageFramePostWidget.h @@ -68,13 +68,13 @@ protected: void loadGroupData(const uint32_t &token); virtual bool insertGroupData(const uint32_t &token, RsGroupMetaData &metaData) = 0; - void requestPosts(); - void loadPosts(const uint32_t &token); - virtual void insertPosts(const uint32_t &token, GxsMessageFramePostThread *thread) = 0; + void requestAllPosts(); + void loadAllPosts(const uint32_t &token); + virtual void insertAllPosts(const uint32_t &token, GxsMessageFramePostThread *thread) = 0; - void requestRelatedPosts(const std::vector &msgIds); - void loadRelatedPosts(const uint32_t &token); - virtual void insertRelatedPosts(const uint32_t &token) = 0; + void requestPosts(const std::vector &msgIds); + void loadPosts(const uint32_t &token); + virtual void insertPosts(const uint32_t &token) = 0; private slots: void fillThreadFinished(); @@ -82,8 +82,8 @@ private slots: protected: uint32_t mTokenTypeGroupData; + uint32_t mTokenTypeAllPosts; uint32_t mTokenTypePosts; - uint32_t mTokenTypeRelatedPosts; RsGxsMessageId mNavigatePendingMsgId; private: diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index bf9ef2fdd..e6ddc8b8a 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -55,11 +55,11 @@ GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWid /* Setup UI helper */ - mStateHelper->addWidget(mTokenTypePosts, ui->progressBar, UISTATE_LOADING_VISIBLE); - mStateHelper->addWidget(mTokenTypePosts, ui->loadingLabel, UISTATE_LOADING_VISIBLE); - mStateHelper->addWidget(mTokenTypePosts, ui->filterLineEdit); + mStateHelper->addWidget(mTokenTypeAllPosts, ui->progressBar, UISTATE_LOADING_VISIBLE); + mStateHelper->addWidget(mTokenTypeAllPosts, ui->loadingLabel, UISTATE_LOADING_VISIBLE); + mStateHelper->addWidget(mTokenTypeAllPosts, ui->filterLineEdit); - mStateHelper->addWidget(mTokenTypeRelatedPosts, ui->loadingLabel, UISTATE_LOADING_VISIBLE); + mStateHelper->addWidget(mTokenTypePosts, ui->loadingLabel, UISTATE_LOADING_VISIBLE); mStateHelper->addLoadPlaceholder(mTokenTypeGroupData, ui->nameLabel); @@ -175,7 +175,7 @@ void GxsChannelPostsWidget::groupNameChanged(const QString &name) QIcon GxsChannelPostsWidget::groupIcon() { - if (mStateHelper->isLoading(mTokenTypeGroupData) || mStateHelper->isLoading(mTokenTypePosts)) { + if (mStateHelper->isLoading(mTokenTypeGroupData) || mStateHelper->isLoading(mTokenTypeAllPosts)) { return QIcon(":/images/kalarm.png"); } @@ -488,7 +488,7 @@ bool GxsChannelPostsWidget::insertGroupData(const uint32_t &token, RsGroupMetaDa return false; } -void GxsChannelPostsWidget::insertPosts(const uint32_t &token, GxsMessageFramePostThread *thread) +void GxsChannelPostsWidget::insertAllPosts(const uint32_t &token, GxsMessageFramePostThread *thread) { std::vector posts; rsGxsChannels->getPostData(token, posts); @@ -496,10 +496,10 @@ void GxsChannelPostsWidget::insertPosts(const uint32_t &token, GxsMessageFramePo insertChannelPosts(posts, thread, false); } -void GxsChannelPostsWidget::insertRelatedPosts(const uint32_t &token) +void GxsChannelPostsWidget::insertPosts(const uint32_t &token) { std::vector posts; - rsGxsChannels->getRelatedPosts(token, posts); + rsGxsChannels->getPostData(token, posts); insertChannelPosts(posts, NULL, true); } diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.h b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.h index eb537f3f0..541fcc506 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.h @@ -67,8 +67,8 @@ protected: /* GxsMessageFramePostWidget */ virtual void groupNameChanged(const QString &name); virtual bool insertGroupData(const uint32_t &token, RsGroupMetaData &metaData); - virtual void insertPosts(const uint32_t &token, GxsMessageFramePostThread *thread); - virtual void insertRelatedPosts(const uint32_t &token); + virtual void insertAllPosts(const uint32_t &token, GxsMessageFramePostThread *thread); + virtual void insertPosts(const uint32_t &token); virtual void clearPosts(); virtual bool useThread() { return mUseThread; } virtual void fillThreadCreatePost(const QVariant &post, bool related, int current, int count);