- Added label "loading" to GxsGroupFrameDialog

- Fixed display of loading status in channel tab

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7348 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-05-07 21:04:54 +00:00
parent a5d88d967e
commit 1fd00c1c51
4 changed files with 33 additions and 23 deletions

View File

@ -32,7 +32,7 @@
#include "gui/channels/ShareKey.h" #include "gui/channels/ShareKey.h"
#include "gui/common/RSTreeWidget.h" #include "gui/common/RSTreeWidget.h"
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
//#include "gui/common/UIStateHelper.h" #include "gui/common/UIStateHelper.h"
//#define DEBUG_GROUPFRAMEDIALOG //#define DEBUG_GROUPFRAMEDIALOG
@ -46,7 +46,7 @@
#define IMAGE_SHARE ":/images/share-icon-16.png" #define IMAGE_SHARE ":/images/share-icon-16.png"
#define IMAGE_TABNEW ":/images/tab-new.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_SUBSCRIBE_CHANGE 2
//#define TOKEN_TYPE_CURRENTGROUP 3 //#define TOKEN_TYPE_CURRENTGROUP 3
@ -80,8 +80,9 @@ GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *p
mTokenQueue = new TokenQueue(mInterface->getTokenService(), this); mTokenQueue = new TokenQueue(mInterface->getTokenService(), this);
/* Setup UI helper */ /* Setup UI helper */
// mStateHelper = new UIStateHelper(this); mStateHelper = new UIStateHelper(this);
// no widget to add yet
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(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupTreeCustomPopupMenu(QPoint)));
connect(ui->groupTreeWidget, SIGNAL(treeItemActivated(QString)), this, SLOT(changedGroup(QString))); connect(ui->groupTreeWidget, SIGNAL(treeItemActivated(QString)), this, SLOT(changedGroup(QString)));
@ -686,20 +687,20 @@ void GxsGroupFrameDialog::updateMessageSummaryList(RsGxsGroupId groupId)
void GxsGroupFrameDialog::requestGroupSummary() void GxsGroupFrameDialog::requestGroupSummary()
{ {
// mStateHelper->setLoading(TOKEN_TYPE_LISTING, true); mStateHelper->setLoading(TOKEN_TYPE_GROUP_SUMMARY, true);
#ifdef DEBUG_GROUPFRAMEDIALOG #ifdef DEBUG_GROUPFRAMEDIALOG
std::cerr << "GxsGroupFrameDialog::requestGroupSummary()"; std::cerr << "GxsGroupFrameDialog::requestGroupSummary()";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
mTokenQueue->cancelActiveRequestTokens(TOKEN_TYPE_LISTING); mTokenQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUP_SUMMARY);
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
uint32_t token; 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) void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token)
@ -714,7 +715,7 @@ void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token)
if (groupInfo.size() > 0) if (groupInfo.size() > 0)
{ {
// mStateHelper->setActive(TOKEN_TYPE_LISTING, true); mStateHelper->setActive(TOKEN_TYPE_GROUP_SUMMARY, true);
insertGroupsData(groupInfo); insertGroupsData(groupInfo);
} }
@ -723,10 +724,10 @@ void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token)
std::cerr << "GxsGroupFrameDialog::loadGroupSummary() ERROR No Groups..."; std::cerr << "GxsGroupFrameDialog::loadGroupSummary() ERROR No Groups...";
std::cerr << std::endl; 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 */ /* now switch on req */
switch(req.mUserType) switch(req.mUserType)
{ {
case TOKEN_TYPE_LISTING: case TOKEN_TYPE_GROUP_SUMMARY:
loadGroupSummary(req.mToken); loadGroupSummary(req.mToken);
break; break;

View File

@ -38,7 +38,7 @@ class GxsGroupFrameDialog;
class GroupTreeWidget; class GroupTreeWidget;
class GroupItemInfo; class GroupItemInfo;
class GxsMessageFrameWidget; class GxsMessageFrameWidget;
//class UIStateHelper; class UIStateHelper;
class GxsGroupFrameDialog : public RsGxsUpdateBroadcastPage, public TokenResponse class GxsGroupFrameDialog : public RsGxsUpdateBroadcastPage, public TokenResponse
{ {
@ -159,7 +159,7 @@ private:
QTreeWidgetItem *mPopularGroups; QTreeWidgetItem *mPopularGroups;
QTreeWidgetItem *mOtherGroups; QTreeWidgetItem *mOtherGroups;
// UIStateHelper *mStateHelper; UIStateHelper *mStateHelper;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::GxsGroupFrameDialog *ui; Ui::GxsGroupFrameDialog *ui;

View File

@ -115,6 +115,13 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QLabel" name="loadingLabel">
<property name="text">
<string>Loading</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="todoPushButton"> <widget class="QPushButton" name="todoPushButton">
<property name="text"> <property name="text">

View File

@ -29,13 +29,11 @@
#define CHAN_DEFAULT_IMAGE ":/images/channels.png" #define CHAN_DEFAULT_IMAGE ":/images/channels.png"
#define WARNING_LIMIT 3600*24*2
/**** /****
* #define DEBUG_CHANNEL * #define DEBUG_CHANNEL
***/ ***/
#define USE_THREAD //#define USE_THREAD
#define TOKEN_TYPE_MESSAGE_CHANGE 4 #define TOKEN_TYPE_MESSAGE_CHANGE 4
#define TOKEN_TYPE_GROUP_DATA 6 #define TOKEN_TYPE_GROUP_DATA 6
@ -163,7 +161,7 @@ QString GxsChannelPostsWidget::groupName(bool withUnreadCount)
QIcon GxsChannelPostsWidget::groupIcon() 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"); return QIcon(":/images/kalarm.png");
} }
@ -240,8 +238,6 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group)
} }
setAutoDownloadButton(group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED); setAutoDownloadButton(group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED);
emit groupChanged(this);
} }
static bool sortChannelMsgSummaryAsc(const RsGxsChannelPost &msg1, const RsGxsChannelPost &msg2) static bool sortChannelMsgSummaryAsc(const RsGxsChannelPost &msg1, const RsGxsChannelPost &msg2)
@ -560,10 +556,10 @@ void GxsChannelPostsWidget::loadGroupData(const uint32_t &token)
mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, false); mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, false);
mStateHelper->clear(TOKEN_TYPE_GROUP_DATA); mStateHelper->clear(TOKEN_TYPE_GROUP_DATA);
}
emit groupChanged(this); emit groupChanged(this);
} }
}
void GxsChannelPostsWidget::requestPosts(const RsGxsGroupId &grpId) void GxsChannelPostsWidget::requestPosts(const RsGxsGroupId &grpId)
{ {
@ -581,10 +577,12 @@ void GxsChannelPostsWidget::requestPosts(const RsGxsGroupId &grpId)
mStateHelper->setActive(TOKEN_TYPE_POSTS, false); mStateHelper->setActive(TOKEN_TYPE_POSTS, false);
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false); mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
mStateHelper->clear(TOKEN_TYPE_POSTS); mStateHelper->clear(TOKEN_TYPE_POSTS);
emit groupChanged(this);
return; return;
} }
mStateHelper->setLoading(TOKEN_TYPE_POSTS, true); mStateHelper->setLoading(TOKEN_TYPE_POSTS, true);
emit groupChanged(this);
std::list<RsGxsGroupId> groupIds; std::list<RsGxsGroupId> groupIds;
groupIds.push_back(grpId); groupIds.push_back(grpId);
@ -611,6 +609,7 @@ void GxsChannelPostsWidget::loadPosts(const uint32_t &token)
insertChannelPosts(posts, false); insertChannelPosts(posts, false);
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false); mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
emit groupChanged(this);
} }
void GxsChannelPostsWidget::requestRelatedPosts(const RsGxsGroupId &grpId, const std::vector<RsGxsMessageId> &msgIds) void GxsChannelPostsWidget::requestRelatedPosts(const RsGxsGroupId &grpId, const std::vector<RsGxsMessageId> &msgIds)
@ -626,6 +625,7 @@ void GxsChannelPostsWidget::requestRelatedPosts(const RsGxsGroupId &grpId, const
mStateHelper->setActive(TOKEN_TYPE_POSTS, false); mStateHelper->setActive(TOKEN_TYPE_POSTS, false);
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false); mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
mStateHelper->clear(TOKEN_TYPE_POSTS); mStateHelper->clear(TOKEN_TYPE_POSTS);
emit groupChanged(this);
return; return;
} }
@ -634,6 +634,7 @@ void GxsChannelPostsWidget::requestRelatedPosts(const RsGxsGroupId &grpId, const
} }
mStateHelper->setLoading(TOKEN_TYPE_POSTS, true); mStateHelper->setLoading(TOKEN_TYPE_POSTS, true);
emit groupChanged(this);
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA; opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
@ -662,6 +663,7 @@ void GxsChannelPostsWidget::loadRelatedPosts(const uint32_t &token)
insertChannelPosts(posts, true); insertChannelPosts(posts, true);
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false); mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
emit groupChanged(this);
} }
void GxsChannelPostsWidget::acknowledgeMessageUpdate(const uint32_t &token) void GxsChannelPostsWidget::acknowledgeMessageUpdate(const uint32_t &token)