Added CancelRequest on second request.

Added new icon for the forum thread tab for the state loading.
Started to lock the gui when data is loaded.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5940 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-12-04 16:06:21 +00:00
parent 385b37bc01
commit 694885963e
5 changed files with 187 additions and 30 deletions

View file

@ -69,6 +69,8 @@ GxsForumsDialog::GxsForumsDialog(QWidget *parent)
/* Setup Queue */
mForumQueue = new TokenQueue(rsGxsForums->getTokenService(), this);
mTokenGroupSummary = 0;
mRequestGroupSummary = false;
connect(ui.forumTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(forumListCustomPopupMenu(QPoint)));
connect(ui.newForumButton, SIGNAL(clicked()), this, SLOT(newforum()));
@ -222,8 +224,6 @@ void GxsForumsDialog::updateDisplay()
{
/* update Forums List */
insertForums();
/* update threads as well */
//#TODO insertThreads();
}
}
@ -342,7 +342,8 @@ void GxsForumsDialog::changedForum(const QString &id)
if (!threadWidget) {
/* create a thread widget */
threadWidget = new GxsForumThreadWidget(id.toStdString());
ui.threadTabWidget->addTab(threadWidget, tr("Loading"));
int index = ui.threadTabWidget->addTab(threadWidget, threadWidget->forumName());
ui.threadTabWidget->setTabIcon(index, threadWidget->forumIcon());
connect(threadWidget, SIGNAL(forumChanged(QWidget*)), this, SLOT(threadTabChanged(QWidget*)));
}
@ -370,6 +371,7 @@ void GxsForumsDialog::threadTabChanged(QWidget *widget)
}
ui.threadTabWidget->setTabText(index, threadWidget->forumName());
ui.threadTabWidget->setTabIcon(index, threadWidget->forumIcon());
}
QString GxsForumsDialog::titleFromInfo(const RsMsgMetaData &meta)
@ -608,11 +610,20 @@ void GxsForumsDialog::requestGroupSummary()
std::cerr << "GxsForumsDialog::requestGroupSummary()";
std::cerr << std::endl;
if (mRequestGroupSummary) {
std::cerr << "GxsForumsDialog::requestGroupSummary() Canceling Request: " << mTokenGroupSummary;
std::cerr << std::endl;
mForumQueue->cancelRequest(mTokenGroupSummary);
mTokenGroupSummary = 0;
mRequestGroupSummary = false;
}
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
uint32_t token;
mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, FORUMSV2DIALOG_LISTING);
mForumQueue->requestGroupInfo(mTokenGroupSummary, RS_TOKREQ_ANSTYPE_SUMMARY, opts, FORUMSV2DIALOG_LISTING);
mRequestGroupSummary = true;
}
void GxsForumsDialog::loadGroupSummary(const uint32_t &token)
@ -620,6 +631,18 @@ void GxsForumsDialog::loadGroupSummary(const uint32_t &token)
std::cerr << "GxsForumsDialog::loadGroupSummary()";
std::cerr << std::endl;
if (!mRequestGroupSummary) {
std::cerr << "GxsForumsDialog::loadGroupSummary()) No waiting request got token: " << token;
std::cerr << std::endl;
return;
}
if (token != mTokenGroupSummary) {
std::cerr << "GxsForumsDialog::loadGroupSummary()) Wrong token - want: " << mTokenGroupSummary << " got: " << token;
std::cerr << std::endl;
return;
}
std::list<RsGroupMetaData> groupInfo;
rsGxsForums->getGroupSummary(token, groupInfo);
@ -632,6 +655,8 @@ void GxsForumsDialog::loadGroupSummary(const uint32_t &token)
std::cerr << "GxsForumsDialog::loadGroupSummary() ERROR No Groups...";
std::cerr << std::endl;
}
mTokenGroupSummary = 0;
mRequestGroupSummary = false;
}
/*********************** **** **** **** ***********************/