diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index f4dcea920..36e274383 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -32,7 +32,7 @@ #include "gui/channels/ShareKey.h" #include "gui/common/RSTreeWidget.h" #include "gui/notifyqt.h" -//#include "gui/common/UIStateHelper.h" +#include "gui/common/UIStateHelper.h" //#define DEBUG_GROUPFRAMEDIALOG @@ -46,7 +46,7 @@ #define IMAGE_SHARE ":/images/share-icon-16.png" #define IMAGE_TABNEW ":/images/tab-new.png" -#define TOKEN_TYPE_LISTING 1 +#define TOKEN_TYPE_GROUP_SUMMARY 1 #define TOKEN_TYPE_SUBSCRIBE_CHANGE 2 //#define TOKEN_TYPE_CURRENTGROUP 3 @@ -80,8 +80,9 @@ GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *p mTokenQueue = new TokenQueue(mInterface->getTokenService(), this); /* Setup UI helper */ -// mStateHelper = new UIStateHelper(this); - // no widget to add yet + mStateHelper = new UIStateHelper(this); + + mStateHelper->addWidget(TOKEN_TYPE_GROUP_SUMMARY, ui->loadingLabel, UISTATE_LOADING_VISIBLE); connect(ui->groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupTreeCustomPopupMenu(QPoint))); connect(ui->groupTreeWidget, SIGNAL(treeItemActivated(QString)), this, SLOT(changedGroup(QString))); @@ -686,20 +687,20 @@ void GxsGroupFrameDialog::updateMessageSummaryList(RsGxsGroupId groupId) void GxsGroupFrameDialog::requestGroupSummary() { -// mStateHelper->setLoading(TOKEN_TYPE_LISTING, true); + mStateHelper->setLoading(TOKEN_TYPE_GROUP_SUMMARY, true); #ifdef DEBUG_GROUPFRAMEDIALOG std::cerr << "GxsGroupFrameDialog::requestGroupSummary()"; std::cerr << std::endl; #endif - mTokenQueue->cancelActiveRequestTokens(TOKEN_TYPE_LISTING); + mTokenQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUP_SUMMARY); RsTokReqOptions opts; opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; uint32_t token; - mTokenQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_TYPE_LISTING); + mTokenQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_TYPE_GROUP_SUMMARY); } void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token) @@ -714,7 +715,7 @@ void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token) if (groupInfo.size() > 0) { -// mStateHelper->setActive(TOKEN_TYPE_LISTING, true); + mStateHelper->setActive(TOKEN_TYPE_GROUP_SUMMARY, true); insertGroupsData(groupInfo); } @@ -723,10 +724,10 @@ void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token) std::cerr << "GxsGroupFrameDialog::loadGroupSummary() ERROR No Groups..."; std::cerr << std::endl; -// mStateHelper->setActive(TOKEN_TYPE_LISTING, false); + mStateHelper->setActive(TOKEN_TYPE_GROUP_SUMMARY, false); } -// mStateHelper->setLoading(TOKEN_TYPE_LISTING, false); + mStateHelper->setLoading(TOKEN_TYPE_GROUP_SUMMARY, false); } /*********************** **** **** **** ***********************/ @@ -801,7 +802,7 @@ void GxsGroupFrameDialog::loadRequest(const TokenQueue *queue, const TokenReques /* now switch on req */ switch(req.mUserType) { - case TOKEN_TYPE_LISTING: + case TOKEN_TYPE_GROUP_SUMMARY: loadGroupSummary(req.mToken); break; diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index 63bde5f50..e6f391856 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -38,7 +38,7 @@ class GxsGroupFrameDialog; class GroupTreeWidget; class GroupItemInfo; class GxsMessageFrameWidget; -//class UIStateHelper; +class UIStateHelper; class GxsGroupFrameDialog : public RsGxsUpdateBroadcastPage, public TokenResponse { @@ -159,7 +159,7 @@ private: QTreeWidgetItem *mPopularGroups; QTreeWidgetItem *mOtherGroups; -// UIStateHelper *mStateHelper; + UIStateHelper *mStateHelper; /** Qt Designer generated object */ Ui::GxsGroupFrameDialog *ui; diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.ui b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.ui index f6b260ed4..cf7a14272 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.ui +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.ui @@ -115,6 +115,13 @@ + + + + Loading + + + diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index 7ab7f4287..bb2d0b9ad 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -29,13 +29,11 @@ #define CHAN_DEFAULT_IMAGE ":/images/channels.png" -#define WARNING_LIMIT 3600*24*2 - /**** * #define DEBUG_CHANNEL ***/ -#define USE_THREAD +//#define USE_THREAD #define TOKEN_TYPE_MESSAGE_CHANGE 4 #define TOKEN_TYPE_GROUP_DATA 6 @@ -163,7 +161,7 @@ QString GxsChannelPostsWidget::groupName(bool withUnreadCount) QIcon GxsChannelPostsWidget::groupIcon() { - if (mStateHelper->isLoading(TOKEN_TYPE_POSTS)) { + if (mStateHelper->isLoading(TOKEN_TYPE_GROUP_DATA) || mStateHelper->isLoading(TOKEN_TYPE_POSTS)) { return QIcon(":/images/kalarm.png"); } @@ -240,8 +238,6 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group) } setAutoDownloadButton(group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED); - - emit groupChanged(this); } static bool sortChannelMsgSummaryAsc(const RsGxsChannelPost &msg1, const RsGxsChannelPost &msg2) @@ -511,7 +507,7 @@ void GxsChannelPostsWidget::requestGroupData(const RsGxsGroupId &grpId) mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUP_DATA); - if (grpId.isNull()) { + if (grpId.isNull()) { mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, false); mStateHelper->setLoading(TOKEN_TYPE_GROUP_DATA, false); mStateHelper->clear(TOKEN_TYPE_GROUP_DATA); @@ -560,9 +556,9 @@ void GxsChannelPostsWidget::loadGroupData(const uint32_t &token) mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, false); mStateHelper->clear(TOKEN_TYPE_GROUP_DATA); - - emit groupChanged(this); } + + emit groupChanged(this); } void GxsChannelPostsWidget::requestPosts(const RsGxsGroupId &grpId) @@ -577,14 +573,16 @@ void GxsChannelPostsWidget::requestPosts(const RsGxsGroupId &grpId) mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_POSTS); - if (grpId.isNull()) { + if (grpId.isNull()) { mStateHelper->setActive(TOKEN_TYPE_POSTS, false); mStateHelper->setLoading(TOKEN_TYPE_POSTS, false); mStateHelper->clear(TOKEN_TYPE_POSTS); + emit groupChanged(this); return; } mStateHelper->setLoading(TOKEN_TYPE_POSTS, true); + emit groupChanged(this); std::list groupIds; groupIds.push_back(grpId); @@ -611,6 +609,7 @@ void GxsChannelPostsWidget::loadPosts(const uint32_t &token) insertChannelPosts(posts, false); mStateHelper->setLoading(TOKEN_TYPE_POSTS, false); + emit groupChanged(this); } void GxsChannelPostsWidget::requestRelatedPosts(const RsGxsGroupId &grpId, const std::vector &msgIds) @@ -626,6 +625,7 @@ void GxsChannelPostsWidget::requestRelatedPosts(const RsGxsGroupId &grpId, const mStateHelper->setActive(TOKEN_TYPE_POSTS, false); mStateHelper->setLoading(TOKEN_TYPE_POSTS, false); mStateHelper->clear(TOKEN_TYPE_POSTS); + emit groupChanged(this); return; } @@ -634,6 +634,7 @@ void GxsChannelPostsWidget::requestRelatedPosts(const RsGxsGroupId &grpId, const } mStateHelper->setLoading(TOKEN_TYPE_POSTS, true); + emit groupChanged(this); RsTokReqOptions opts; opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA; @@ -662,6 +663,7 @@ void GxsChannelPostsWidget::loadRelatedPosts(const uint32_t &token) insertChannelPosts(posts, true); mStateHelper->setLoading(TOKEN_TYPE_POSTS, false); + emit groupChanged(this); } void GxsChannelPostsWidget::acknowledgeMessageUpdate(const uint32_t &token)