mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Optimized fill of forums
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7716 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
959c0ebf5b
commit
1fff74656e
@ -113,11 +113,11 @@ void GxsMessageFramePostWidget::updateDisplay(bool complete)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool updateGroup = false;
|
|
||||||
if (mGroupId.isNull()) {
|
if (mGroupId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool updateGroup = false;
|
||||||
const std::list<RsGxsGroupId> &grpIdsMeta = getGrpIdsMeta();
|
const std::list<RsGxsGroupId> &grpIdsMeta = getGrpIdsMeta();
|
||||||
if (std::find(grpIdsMeta.begin(), grpIdsMeta.end(), mGroupId) != grpIdsMeta.end()) {
|
if (std::find(grpIdsMeta.begin(), grpIdsMeta.end(), mGroupId) != grpIdsMeta.end()) {
|
||||||
updateGroup = true;
|
updateGroup = true;
|
||||||
|
@ -162,10 +162,13 @@
|
|||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||||
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>314</width>
|
<width>0</width>
|
||||||
<height>10</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@ -179,6 +182,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QProgressBar" name="progressBar">
|
<widget class="QProgressBar" name="progressBar">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
|
@ -82,9 +82,10 @@
|
|||||||
|
|
||||||
#define ROLE_THREAD_COUNT 3
|
#define ROLE_THREAD_COUNT 3
|
||||||
|
|
||||||
#define TOKEN_TYPE_CURRENTFORUM 1
|
#define TOKEN_TYPE_GROUPDATA 1
|
||||||
#define TOKEN_TYPE_INSERT_POST 2
|
#define TOKEN_TYPE_INSERT_THREADS 2
|
||||||
#define TOKEN_TYPE_REPLY_MESSAGE 3
|
#define TOKEN_TYPE_MESSAGEDATA 3
|
||||||
|
#define TOKEN_TYPE_REPLY_MESSAGE 4
|
||||||
|
|
||||||
GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget *parent) :
|
GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget *parent) :
|
||||||
GxsMessageFrameWidget(rsGxsForums, parent),
|
GxsMessageFrameWidget(rsGxsForums, parent),
|
||||||
@ -97,33 +98,34 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
|
|||||||
/* Setup UI helper */
|
/* Setup UI helper */
|
||||||
mStateHelper = new UIStateHelper(this);
|
mStateHelper = new UIStateHelper(this);
|
||||||
|
|
||||||
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->progressBar, UISTATE_LOADING_VISIBLE);
|
mStateHelper->addWidget(TOKEN_TYPE_GROUPDATA, ui->subscribeToolButton);
|
||||||
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->progressText, UISTATE_LOADING_VISIBLE);
|
mStateHelper->addWidget(TOKEN_TYPE_GROUPDATA, ui->newthreadButton);
|
||||||
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->subscribeToolButton);
|
|
||||||
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->newthreadButton);
|
|
||||||
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->threadTreeWidget, UISTATE_ACTIVE_ENABLED);
|
|
||||||
|
|
||||||
mStateHelper->addLoadPlaceholder(TOKEN_TYPE_CURRENTFORUM, ui->progressText);
|
mStateHelper->addClear(TOKEN_TYPE_GROUPDATA, ui->forumName);
|
||||||
|
|
||||||
mStateHelper->addClear(TOKEN_TYPE_CURRENTFORUM, ui->threadTreeWidget);
|
mStateHelper->addWidget(TOKEN_TYPE_INSERT_THREADS, ui->progressBar, UISTATE_LOADING_VISIBLE);
|
||||||
mStateHelper->addClear(TOKEN_TYPE_CURRENTFORUM, ui->forumName);
|
mStateHelper->addWidget(TOKEN_TYPE_INSERT_THREADS, ui->progressText, UISTATE_LOADING_VISIBLE);
|
||||||
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->nextUnreadButton);
|
mStateHelper->addWidget(TOKEN_TYPE_INSERT_THREADS, ui->threadTreeWidget, UISTATE_ACTIVE_ENABLED);
|
||||||
|
mStateHelper->addLoadPlaceholder(TOKEN_TYPE_INSERT_THREADS, ui->progressText);
|
||||||
|
mStateHelper->addWidget(TOKEN_TYPE_INSERT_THREADS, ui->nextUnreadButton);
|
||||||
|
mStateHelper->addWidget(TOKEN_TYPE_INSERT_THREADS, ui->previousButton);
|
||||||
|
mStateHelper->addWidget(TOKEN_TYPE_INSERT_THREADS, ui->nextButton);
|
||||||
|
|
||||||
mStateHelper->addWidget(TOKEN_TYPE_INSERT_POST, ui->previousButton);
|
mStateHelper->addClear(TOKEN_TYPE_INSERT_THREADS, ui->threadTreeWidget);
|
||||||
mStateHelper->addWidget(TOKEN_TYPE_INSERT_POST, ui->nextButton);
|
|
||||||
mStateHelper->addWidget(TOKEN_TYPE_INSERT_POST, ui->newmessageButton);
|
|
||||||
mStateHelper->addWidget(TOKEN_TYPE_INSERT_POST, ui->postText);
|
|
||||||
mStateHelper->addWidget(TOKEN_TYPE_INSERT_POST, ui->downloadButton);
|
|
||||||
|
|
||||||
mStateHelper->addLoadPlaceholder(TOKEN_TYPE_INSERT_POST, ui->postText);
|
mStateHelper->addWidget(TOKEN_TYPE_MESSAGEDATA, ui->newmessageButton);
|
||||||
mStateHelper->addLoadPlaceholder(TOKEN_TYPE_INSERT_POST, ui->threadTitle);
|
// mStateHelper->addWidget(TOKEN_TYPE_MESSAGEDATA, ui->postText);
|
||||||
|
mStateHelper->addWidget(TOKEN_TYPE_MESSAGEDATA, ui->downloadButton);
|
||||||
|
|
||||||
|
mStateHelper->addLoadPlaceholder(TOKEN_TYPE_MESSAGEDATA, ui->postText);
|
||||||
|
mStateHelper->addLoadPlaceholder(TOKEN_TYPE_MESSAGEDATA, ui->threadTitle);
|
||||||
|
|
||||||
mSubscribeFlags = 0;
|
mSubscribeFlags = 0;
|
||||||
mInProcessSettings = false;
|
mInProcessSettings = false;
|
||||||
mUnreadCount = 0;
|
mUnreadCount = 0;
|
||||||
mNewCount = 0;
|
mNewCount = 0;
|
||||||
|
|
||||||
mThreadQueue = new TokenQueue(rsGxsForums->getTokenService(), this);
|
mTokenQueue = new TokenQueue(rsGxsForums->getTokenService(), this);
|
||||||
|
|
||||||
mInMsgAsReadUnread = false;
|
mInMsgAsReadUnread = false;
|
||||||
|
|
||||||
@ -187,14 +189,6 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
|
|||||||
ui->progressBar->hide();
|
ui->progressBar->hide();
|
||||||
ui->progressText->hide();
|
ui->progressText->hide();
|
||||||
|
|
||||||
// mTimer = new QTimer;
|
|
||||||
// mTimer->setInterval(1000);
|
|
||||||
// mTimer->setSingleShot(true);
|
|
||||||
|
|
||||||
// QObject::connect(mTimer, SIGNAL(timeout()), this, SLOT(updateDisplay()));
|
|
||||||
|
|
||||||
// mTimer->start();
|
|
||||||
|
|
||||||
mFillThread = NULL;
|
mFillThread = NULL;
|
||||||
ui->threadTreeWidget->setGxsIdColumn(COLUMN_THREAD_AUTHOR);
|
ui->threadTreeWidget->setGxsIdColumn(COLUMN_THREAD_AUTHOR);
|
||||||
|
|
||||||
@ -216,8 +210,7 @@ GxsForumThreadWidget::~GxsForumThreadWidget()
|
|||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
|
|
||||||
// delete(mTimer);
|
delete(mTokenQueue);
|
||||||
delete(mThreadQueue);
|
|
||||||
delete(mThreadCompareRole);
|
delete(mThreadCompareRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +270,7 @@ void GxsForumThreadWidget::setGroupId(const RsGxsGroupId &forumId)
|
|||||||
|
|
||||||
emit groupChanged(this);
|
emit groupChanged(this);
|
||||||
|
|
||||||
insertThreads();
|
fillComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GxsForumThreadWidget::groupName(bool withUnreadCount)
|
QString GxsForumThreadWidget::groupName(bool withUnreadCount)
|
||||||
@ -293,7 +286,7 @@ QString GxsForumThreadWidget::groupName(bool withUnreadCount)
|
|||||||
|
|
||||||
QIcon GxsForumThreadWidget::groupIcon()
|
QIcon GxsForumThreadWidget::groupIcon()
|
||||||
{
|
{
|
||||||
if (mStateHelper->isLoading(TOKEN_TYPE_CURRENTFORUM) || mFillThread) {
|
if (mStateHelper->isLoading(TOKEN_TYPE_GROUPDATA) || mFillThread) {
|
||||||
return QIcon(":/images/kalarm.png");
|
return QIcon(":/images/kalarm.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,25 +310,72 @@ void GxsForumThreadWidget::changeEvent(QEvent *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void removeMessages(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds, const QList<RsGxsMessageId> &removeMsgId)
|
||||||
|
{
|
||||||
|
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator grpIt;
|
||||||
|
for (grpIt = msgIds.begin(); grpIt != msgIds.end(); ) {
|
||||||
|
std::vector<RsGxsMessageId> &msgs = grpIt->second;
|
||||||
|
|
||||||
|
QList<RsGxsMessageId>::const_iterator removeMsgIt;
|
||||||
|
for (removeMsgIt = removeMsgId.begin(); removeMsgIt != removeMsgId.end(); ++removeMsgIt) {
|
||||||
|
std::vector<RsGxsMessageId>::iterator msgIt = std::find(msgs.begin(), msgs.end(), *removeMsgIt);
|
||||||
|
if (msgIt != msgs.end()) {
|
||||||
|
msgs.erase(msgIt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msgs.empty()) {
|
||||||
|
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator grpItErase = grpIt++;
|
||||||
|
msgIds.erase(grpItErase);
|
||||||
|
} else {
|
||||||
|
++grpIt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::updateDisplay(bool complete)
|
void GxsForumThreadWidget::updateDisplay(bool complete)
|
||||||
{
|
{
|
||||||
if (complete) {
|
if (complete) {
|
||||||
/* Not needed */
|
/* Fill complete */
|
||||||
|
requestGroupData();
|
||||||
|
insertThreads();
|
||||||
|
insertMessage();
|
||||||
|
|
||||||
|
mIgnoredMsgId.clear();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool updateGroup = false;
|
||||||
|
const std::list<RsGxsGroupId> &grpIdsMeta = getGrpIdsMeta();
|
||||||
|
if (std::find(grpIdsMeta.begin(), grpIdsMeta.end(), mForumId) != grpIdsMeta.end()) {
|
||||||
|
updateGroup = true;
|
||||||
|
}
|
||||||
|
|
||||||
const std::list<RsGxsGroupId> &grpIds = getGrpIds();
|
const std::list<RsGxsGroupId> &grpIds = getGrpIds();
|
||||||
if (std::find(grpIds.begin(), grpIds.end(), mForumId) != grpIds.end()) {
|
if (std::find(grpIds.begin(), grpIds.end(), mForumId) != grpIds.end()) {
|
||||||
|
updateGroup = true;
|
||||||
/* Update threads */
|
/* Update threads */
|
||||||
insertThreads();
|
insertThreads();
|
||||||
} else {
|
} else {
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgIds;
|
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgIds;
|
||||||
getAllMsgIds(msgIds);
|
getAllMsgIds(msgIds);
|
||||||
|
|
||||||
|
if (!mIgnoredMsgId.empty()) {
|
||||||
|
/* Filter ignored messages */
|
||||||
|
removeMessages(msgIds, mIgnoredMsgId);
|
||||||
|
mIgnoredMsgId.clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (msgIds.find(mForumId) != msgIds.end()) {
|
if (msgIds.find(mForumId) != msgIds.end()) {
|
||||||
/* Update threads */
|
/* Update threads */
|
||||||
insertThreads();
|
insertThreads();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (updateGroup) {
|
||||||
|
requestGroupData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
|
void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
|
||||||
@ -487,11 +527,15 @@ void GxsForumThreadWidget::changedThread()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
insertPost();
|
insertMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::clickedThread(QTreeWidgetItem *item, int column)
|
void GxsForumThreadWidget::clickedThread(QTreeWidgetItem *item, int column)
|
||||||
{
|
{
|
||||||
|
if (item == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (mFillThread) {
|
if (mFillThread) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -500,10 +544,6 @@ void GxsForumThreadWidget::clickedThread(QTreeWidgetItem *item, int column)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (column == COLUMN_THREAD_READ) {
|
if (column == COLUMN_THREAD_READ) {
|
||||||
QList<QTreeWidgetItem*> rows;
|
QList<QTreeWidgetItem*> rows;
|
||||||
rows.append(item);
|
rows.append(item);
|
||||||
@ -512,37 +552,6 @@ void GxsForumThreadWidget::clickedThread(QTreeWidgetItem *item, int column)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TODO
|
|
||||||
void GxsForumThreadWidget::forumMsgReadStatusChanged(const QString &forumId, const QString &msgId, int status)
|
|
||||||
{
|
|
||||||
if (mInMsgAsReadUnread) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (forumId.toStdString() == mCurrForumId) {
|
|
||||||
/* Search exisiting item */
|
|
||||||
QTreeWidgetItemIterator itemIterator(ui->threadTreeWidget);
|
|
||||||
QTreeWidgetItem *item = NULL;
|
|
||||||
while ((item = *itemIterator) != NULL) {
|
|
||||||
++itemIterator;
|
|
||||||
|
|
||||||
if (item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString() == msgId) {
|
|
||||||
// update status
|
|
||||||
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS, status);
|
|
||||||
|
|
||||||
QTreeWidgetItem *parentItem = item;
|
|
||||||
while (parentItem->parent()) {
|
|
||||||
parentItem = parentItem->parent();
|
|
||||||
}
|
|
||||||
calculateIconsAndFonts(parentItem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updateMessageSummaryList(forumId.toStdString());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void GxsForumThreadWidget::calculateIconsAndFonts(QTreeWidgetItem *item, bool &hasReadChilddren, bool &hasUnreadChilddren)
|
void GxsForumThreadWidget::calculateIconsAndFonts(QTreeWidgetItem *item, bool &hasReadChilddren, bool &hasUnreadChilddren)
|
||||||
{
|
{
|
||||||
uint32_t status = item->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
uint32_t status = item->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||||
@ -674,6 +683,28 @@ static void cleanupItems (QList<QTreeWidgetItem *> &items)
|
|||||||
items.clear();
|
items.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsForumThreadWidget::insertGroupData(const RsGxsForumGroup &group)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_FORUMS
|
||||||
|
std::cerr << "GxsForumThreadWidget::insertGroupData" << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
mSubscribeFlags = group.mMeta.mSubscribeFlags;
|
||||||
|
ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
|
||||||
|
mForumDescription = QString::fromUtf8(group.mDescription.c_str());
|
||||||
|
|
||||||
|
ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(mSubscribeFlags));
|
||||||
|
mStateHelper->setWidgetEnabled(ui->newthreadButton, (IS_GROUP_SUBSCRIBED(mSubscribeFlags)));
|
||||||
|
|
||||||
|
if (mThreadId.isNull() && !mStateHelper->isLoading(TOKEN_TYPE_MESSAGEDATA))
|
||||||
|
{
|
||||||
|
ui->threadTitle->setText(tr("Forum Description"));
|
||||||
|
ui->postText->setText(mForumDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
calculateIconsAndFonts();
|
||||||
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::fillThreadFinished()
|
void GxsForumThreadWidget::fillThreadFinished()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
@ -687,8 +718,7 @@ void GxsForumThreadWidget::fillThreadFinished()
|
|||||||
// current thread has finished, hide progressbar and release thread
|
// current thread has finished, hide progressbar and release thread
|
||||||
mFillThread = NULL;
|
mFillThread = NULL;
|
||||||
|
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_CURRENTFORUM, false);
|
mStateHelper->setLoading(TOKEN_TYPE_INSERT_THREADS, false);
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_INSERT_POST, false);
|
|
||||||
emit groupChanged(this);
|
emit groupChanged(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,7 +732,7 @@ void GxsForumThreadWidget::fillThreadFinished()
|
|||||||
std::cerr << "GxsForumThreadWidget::fillThreadFinished Add messages" << std::endl;
|
std::cerr << "GxsForumThreadWidget::fillThreadFinished Add messages" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mStateHelper->setActive(TOKEN_TYPE_CURRENTFORUM, true);
|
mStateHelper->setActive(TOKEN_TYPE_INSERT_THREADS, true);
|
||||||
ui->threadTreeWidget->setSortingEnabled(false);
|
ui->threadTreeWidget->setSortingEnabled(false);
|
||||||
|
|
||||||
/* add all messages in! */
|
/* add all messages in! */
|
||||||
@ -749,7 +779,6 @@ void GxsForumThreadWidget::fillThreadFinished()
|
|||||||
if (ui->filterLineEdit->text().isEmpty() == false) {
|
if (ui->filterLineEdit->text().isEmpty() == false) {
|
||||||
filterItems(ui->filterLineEdit->text());
|
filterItems(ui->filterLineEdit->text());
|
||||||
}
|
}
|
||||||
insertPost();
|
|
||||||
calculateIconsAndFonts();
|
calculateIconsAndFonts();
|
||||||
calculateUnreadCount();
|
calculateUnreadCount();
|
||||||
emit groupChanged(this);
|
emit groupChanged(this);
|
||||||
@ -886,6 +915,9 @@ void GxsForumThreadWidget::insertThreads()
|
|||||||
std::cerr << "GxsForumThreadWidget::insertThreads()" << std::endl;
|
std::cerr << "GxsForumThreadWidget::insertThreads()" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
mNavigatePendingMsgId.clear();
|
||||||
|
ui->progressBar->reset();
|
||||||
|
|
||||||
if (mFillThread) {
|
if (mFillThread) {
|
||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << "GxsForumThreadWidget::insertThreads() stop current fill thread" << std::endl;
|
std::cerr << "GxsForumThreadWidget::insertThreads() stop current fill thread" << std::endl;
|
||||||
@ -896,20 +928,15 @@ void GxsForumThreadWidget::insertThreads()
|
|||||||
thread->stop();
|
thread->stop();
|
||||||
delete(thread);
|
delete(thread);
|
||||||
|
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_CURRENTFORUM, false);
|
mStateHelper->setLoading(TOKEN_TYPE_INSERT_THREADS, false);
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_INSERT_POST, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mSubscribeFlags = 0;
|
|
||||||
mForumDescription.clear();
|
|
||||||
|
|
||||||
if (mForumId.isNull())
|
if (mForumId.isNull())
|
||||||
{
|
{
|
||||||
/* not an actual forum - clear */
|
/* not an actual forum - clear */
|
||||||
mStateHelper->setActive(TOKEN_TYPE_CURRENTFORUM, false);
|
mStateHelper->setActive(TOKEN_TYPE_INSERT_THREADS, false);
|
||||||
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
|
mStateHelper->clear(TOKEN_TYPE_INSERT_THREADS);
|
||||||
mStateHelper->clear(TOKEN_TYPE_CURRENTFORUM);
|
|
||||||
mStateHelper->clear(TOKEN_TYPE_INSERT_POST);
|
|
||||||
/* clear last stored forumID */
|
/* clear last stored forumID */
|
||||||
mForumId.clear();
|
mForumId.clear();
|
||||||
mLastForumID.clear();
|
mLastForumID.clear();
|
||||||
@ -921,25 +948,12 @@ void GxsForumThreadWidget::insertThreads()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Current Forum Info... then complete insertForumThreads().
|
|
||||||
requestGroup_CurrentForum();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GxsForumThreadWidget::insertForumThreads(const RsGxsForumGroup &group)
|
|
||||||
{
|
|
||||||
mSubscribeFlags = group.mMeta.mSubscribeFlags;
|
|
||||||
ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
|
|
||||||
mForumDescription = QString::fromUtf8(group.mDescription.c_str());
|
|
||||||
|
|
||||||
ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(mSubscribeFlags));
|
|
||||||
|
|
||||||
ui->progressBar->reset();
|
|
||||||
mStateHelper->setActive(TOKEN_TYPE_CURRENTFORUM, true);
|
|
||||||
|
|
||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << "GxsForumThreadWidget::insertThreads() Start filling Forum threads" << std::endl;
|
std::cerr << "GxsForumThreadWidget::insertThreads() Start filling Forum threads" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
mStateHelper->setLoading(TOKEN_TYPE_INSERT_THREADS, true);
|
||||||
|
|
||||||
// create fill thread
|
// create fill thread
|
||||||
mFillThread = new GxsForumsFillThread(this);
|
mFillThread = new GxsForumsFillThread(this);
|
||||||
|
|
||||||
@ -948,7 +962,6 @@ void GxsForumThreadWidget::insertForumThreads(const RsGxsForumGroup &group)
|
|||||||
mFillThread->mForumId = mForumId;
|
mFillThread->mForumId = mForumId;
|
||||||
mFillThread->mFilterColumn = ui->filterLineEdit->currentFilter();
|
mFillThread->mFilterColumn = ui->filterLineEdit->currentFilter();
|
||||||
mFillThread->mFilterColumn = COLUMN_THREAD_TITLE;
|
mFillThread->mFilterColumn = COLUMN_THREAD_TITLE;
|
||||||
mFillThread->mSubscribeFlags = mSubscribeFlags;
|
|
||||||
mFillThread->mExpandNewMessages = Settings->getForumExpandNewMessages();
|
mFillThread->mExpandNewMessages = Settings->getForumExpandNewMessages();
|
||||||
mFillThread->mViewType = ui->viewBox->currentIndex();
|
mFillThread->mViewType = ui->viewBox->currentIndex();
|
||||||
if (mLastViewType != mFillThread->mViewType || mLastForumID != mForumId) {
|
if (mLastViewType != mFillThread->mViewType || mLastForumID != mForumId) {
|
||||||
@ -1143,14 +1156,12 @@ void GxsForumThreadWidget::fillChildren(QTreeWidgetItem *parentItem, QTreeWidget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::insertPost()
|
void GxsForumThreadWidget::insertMessage()
|
||||||
{
|
{
|
||||||
if (mForumId.isNull())
|
if (mForumId.isNull())
|
||||||
{
|
{
|
||||||
mStateHelper->setActive(TOKEN_TYPE_CURRENTFORUM, false);
|
mStateHelper->setActive(TOKEN_TYPE_MESSAGEDATA, false);
|
||||||
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
|
mStateHelper->clear(TOKEN_TYPE_MESSAGEDATA);
|
||||||
mStateHelper->clear(TOKEN_TYPE_CURRENTFORUM);
|
|
||||||
mStateHelper->clear(TOKEN_TYPE_INSERT_POST);
|
|
||||||
|
|
||||||
ui->postText->clear();
|
ui->postText->clear();
|
||||||
ui->threadTitle->clear();
|
ui->threadTitle->clear();
|
||||||
@ -1159,15 +1170,15 @@ void GxsForumThreadWidget::insertPost()
|
|||||||
|
|
||||||
if (mThreadId.isNull())
|
if (mThreadId.isNull())
|
||||||
{
|
{
|
||||||
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
|
mStateHelper->setActive(TOKEN_TYPE_MESSAGEDATA, false);
|
||||||
mStateHelper->clear(TOKEN_TYPE_INSERT_POST);
|
mStateHelper->clear(TOKEN_TYPE_MESSAGEDATA);
|
||||||
|
|
||||||
ui->threadTitle->setText(tr("Forum Description"));
|
ui->threadTitle->setText(tr("Forum Description"));
|
||||||
ui->postText->setText(mForumDescription);
|
ui->postText->setText(mForumDescription);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, true);
|
mStateHelper->setActive(TOKEN_TYPE_MESSAGEDATA, true);
|
||||||
|
|
||||||
QTreeWidgetItem *item = ui->threadTreeWidget->currentItem();
|
QTreeWidgetItem *item = ui->threadTreeWidget->currentItem();
|
||||||
if (item) {
|
if (item) {
|
||||||
@ -1187,14 +1198,13 @@ void GxsForumThreadWidget::insertPost()
|
|||||||
|
|
||||||
/* blank text, incase we get nothing */
|
/* blank text, incase we get nothing */
|
||||||
ui->postText->clear();
|
ui->postText->clear();
|
||||||
/* request Post */
|
|
||||||
|
|
||||||
// Get Forum Post ... then complete insertPostData().
|
/* request Post */
|
||||||
RsGxsGrpMsgIdPair postId = std::make_pair(mForumId, mThreadId);
|
RsGxsGrpMsgIdPair msgId = std::make_pair(mForumId, mThreadId);
|
||||||
requestMsgData_InsertPost(postId);
|
requestMessageData(msgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::insertPostData(const RsGxsForumMsg &msg)
|
void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
|
||||||
{
|
{
|
||||||
/* As some time has elapsed since request - check that this is still the current msg.
|
/* As some time has elapsed since request - check that this is still the current msg.
|
||||||
* otherwise, another request will fill the data
|
* otherwise, another request will fill the data
|
||||||
@ -1209,12 +1219,14 @@ void GxsForumThreadWidget::insertPostData(const RsGxsForumMsg &msg)
|
|||||||
std::cerr << "\t or CurrThdId: " << mThreadId << " != msg.MsgId: " << msg.mMeta.mMsgId;
|
std::cerr << "\t or CurrThdId: " << mThreadId << " != msg.MsgId: " << msg.mMeta.mMsgId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
|
|
||||||
mStateHelper->clear(TOKEN_TYPE_INSERT_POST);
|
mStateHelper->setActive(TOKEN_TYPE_MESSAGEDATA, false);
|
||||||
|
mStateHelper->clear(TOKEN_TYPE_MESSAGEDATA);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, true);
|
mStateHelper->setActive(TOKEN_TYPE_MESSAGEDATA, true);
|
||||||
|
|
||||||
QTreeWidgetItem *item = ui->threadTreeWidget->currentItem();
|
QTreeWidgetItem *item = ui->threadTreeWidget->currentItem();
|
||||||
|
|
||||||
@ -1341,23 +1353,6 @@ void GxsForumThreadWidget::nextUnreadMessage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
#if 0
|
|
||||||
void GxsForumThreadWidget::removemessage()
|
|
||||||
{
|
|
||||||
//std::cerr << "GxsForumThreadWidget::removemessage()" << std::endl;
|
|
||||||
std::string cid, mid;
|
|
||||||
if (!getCurrentMsg(cid, mid))
|
|
||||||
{
|
|
||||||
//std::cerr << "GxsForumThreadWidget::removemessage()";
|
|
||||||
//std::cerr << " No Message selected" << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rsMsgs -> MessageDelete(mid);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* get selected messages
|
/* get selected messages
|
||||||
the messages tree is single selected, but who knows ... */
|
the messages tree is single selected, but who knows ... */
|
||||||
int GxsForumThreadWidget::getSelectedMsgCount(QList<QTreeWidgetItem*> *rows, QList<QTreeWidgetItem*> *rowsRead, QList<QTreeWidgetItem*> *rowsUnread)
|
int GxsForumThreadWidget::getSelectedMsgCount(QList<QTreeWidgetItem*> *rows, QList<QTreeWidgetItem*> *rowsRead, QList<QTreeWidgetItem*> *rowsUnread)
|
||||||
@ -1414,6 +1409,9 @@ void GxsForumThreadWidget::setMsgReadStatus(QList<QTreeWidgetItem*> &rows, bool
|
|||||||
uint32_t token;
|
uint32_t token;
|
||||||
rsGxsForums->setMessageReadStatus(token, msgPair, read);
|
rsGxsForums->setMessageReadStatus(token, msgPair, read);
|
||||||
|
|
||||||
|
/* Add message id to ignore list for the next updateDisplay */
|
||||||
|
mIgnoredMsgId.push_back(RsGxsMessageId(msgId));
|
||||||
|
|
||||||
(*row)->setData(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS, statusNew);
|
(*row)->setData(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS, statusNew);
|
||||||
|
|
||||||
QTreeWidgetItem *parentItem = *row;
|
QTreeWidgetItem *parentItem = *row;
|
||||||
@ -1432,7 +1430,6 @@ void GxsForumThreadWidget::setMsgReadStatus(QList<QTreeWidgetItem*> &rows, bool
|
|||||||
for (std::list<QTreeWidgetItem*>::iterator it = changedItems.begin(); it != changedItems.end(); ++it) {
|
for (std::list<QTreeWidgetItem*>::iterator it = changedItems.begin(); it != changedItems.end(); ++it) {
|
||||||
calculateIconsAndFonts(*it);
|
calculateIconsAndFonts(*it);
|
||||||
}
|
}
|
||||||
//#TODO updateMessageSummaryList(mForumId);
|
|
||||||
calculateUnreadCount();
|
calculateUnreadCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1514,7 +1511,7 @@ void GxsForumThreadWidget::setAllMessagesRead(bool read)
|
|||||||
|
|
||||||
bool GxsForumThreadWidget::navigate(const RsGxsMessageId &msgId)
|
bool GxsForumThreadWidget::navigate(const RsGxsMessageId &msgId)
|
||||||
{
|
{
|
||||||
if (mStateHelper->isLoading(TOKEN_TYPE_CURRENTFORUM)) {
|
if (mStateHelper->isLoading(TOKEN_TYPE_INSERT_THREADS)) {
|
||||||
mNavigatePendingMsgId = msgId;
|
mNavigatePendingMsgId = msgId;
|
||||||
|
|
||||||
/* No information if message is available */
|
/* No information if message is available */
|
||||||
@ -1561,7 +1558,7 @@ void GxsForumThreadWidget::subscribeGroup(bool subscribe)
|
|||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
rsGxsForums->subscribeToGroup(token, mForumId, subscribe);
|
rsGxsForums->subscribeToGroup(token, mForumId, subscribe);
|
||||||
// mThreadQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_TYPE_SUBSCRIBE_CHANGE);
|
// mTokenQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_TYPE_SUBSCRIBE_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::createmessage()
|
void GxsForumThreadWidget::createmessage()
|
||||||
@ -1719,117 +1716,122 @@ bool GxsForumThreadWidget::filterItem(QTreeWidgetItem *item, const QString &text
|
|||||||
/** Request / Response of Data ********************************/
|
/** Request / Response of Data ********************************/
|
||||||
/*********************** **** **** **** ***********************/
|
/*********************** **** **** **** ***********************/
|
||||||
|
|
||||||
void GxsForumThreadWidget::requestGroup_CurrentForum()
|
void GxsForumThreadWidget::requestGroupData()
|
||||||
{
|
{
|
||||||
ui->progressBar->reset();
|
mSubscribeFlags = 0;
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_CURRENTFORUM, true);
|
mForumDescription.clear();
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_INSERT_POST, true);
|
|
||||||
emit groupChanged(this);
|
|
||||||
|
|
||||||
mNavigatePendingMsgId.clear();
|
mTokenQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUPDATA);
|
||||||
|
|
||||||
|
if (mForumId.isNull()) {
|
||||||
|
mStateHelper->setActive(TOKEN_TYPE_GROUPDATA, false);
|
||||||
|
mStateHelper->setLoading(TOKEN_TYPE_GROUPDATA, false);
|
||||||
|
mStateHelper->clear(TOKEN_TYPE_GROUPDATA);
|
||||||
|
|
||||||
|
emit groupChanged(this);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mStateHelper->setLoading(TOKEN_TYPE_GROUPDATA, true);
|
||||||
|
emit groupChanged(this);
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||||
|
|
||||||
mThreadQueue->cancelActiveRequestTokens(TOKEN_TYPE_CURRENTFORUM);
|
|
||||||
|
|
||||||
std::list<RsGxsGroupId> grpIds;
|
std::list<RsGxsGroupId> grpIds;
|
||||||
grpIds.push_back(mForumId);
|
grpIds.push_back(mForumId);
|
||||||
|
|
||||||
std::cerr << "GxsForumThreadWidget::requestGroup_CurrentForum(" << mForumId << ")";
|
#ifdef DEBUG_FORUMS
|
||||||
|
std::cerr << "GxsForumThreadWidget::requestGroupData(" << mForumId << ")";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mThreadQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, TOKEN_TYPE_CURRENTFORUM);
|
mTokenQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, TOKEN_TYPE_GROUPDATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::loadGroup_CurrentForum(const uint32_t &token)
|
void GxsForumThreadWidget::loadGroupData(const uint32_t &token)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << "GxsForumThreadWidget::loadGroup_CurrentForum()";
|
std::cerr << "GxsForumThreadWidget::loadGroup_CurrentForum()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
std::vector<RsGxsForumGroup> groups;
|
std::vector<RsGxsForumGroup> groups;
|
||||||
rsGxsForums->getGroupData(token, groups);
|
rsGxsForums->getGroupData(token, groups);
|
||||||
|
|
||||||
|
mStateHelper->setLoading(TOKEN_TYPE_GROUPDATA, false);
|
||||||
|
|
||||||
if (groups.size() == 1)
|
if (groups.size() == 1)
|
||||||
{
|
{
|
||||||
insertForumThreads(groups[0]);
|
insertGroupData(groups[0]);
|
||||||
|
|
||||||
|
mStateHelper->setActive(TOKEN_TYPE_GROUPDATA, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "GxsForumThreadWidget::loadGroupSummary_CurrentForum() ERROR Invalid Number of Groups...";
|
std::cerr << "GxsForumThreadWidget::loadGroupSummary_CurrentForum() ERROR Invalid Number of Groups...";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_CURRENTFORUM, false);
|
mStateHelper->setActive(TOKEN_TYPE_GROUPDATA, false);
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_INSERT_POST, false);
|
mStateHelper->clear(TOKEN_TYPE_GROUPDATA);
|
||||||
mStateHelper->setActive(TOKEN_TYPE_CURRENTFORUM, false);
|
|
||||||
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
|
|
||||||
mStateHelper->clear(TOKEN_TYPE_CURRENTFORUM);
|
|
||||||
mStateHelper->clear(TOKEN_TYPE_INSERT_POST);
|
|
||||||
emit groupChanged(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit groupChanged(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************** **** **** **** ***********************/
|
/*********************** **** **** **** ***********************/
|
||||||
/*********************** **** **** **** ***********************/
|
/*********************** **** **** **** ***********************/
|
||||||
|
|
||||||
void GxsForumThreadWidget::requestMsgData_InsertPost(const RsGxsGrpMsgIdPair &msgId)
|
void GxsForumThreadWidget::requestMessageData(const RsGxsGrpMsgIdPair &msgId)
|
||||||
{
|
{
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_INSERT_POST, true);
|
mStateHelper->setLoading(TOKEN_TYPE_MESSAGEDATA, true);
|
||||||
|
|
||||||
#if 0
|
mTokenQueue->cancelActiveRequestTokens(TOKEN_TYPE_MESSAGEDATA);
|
||||||
RsTokReqOptions opts;
|
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
|
|
||||||
|
|
||||||
std::cerr << "GxsForumThreadWidget::requestMsgData_InsertPost(" << msgId.first << "," << msgId.second << ")";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
std::vector<RsGxsGrpMsgIdPair> msgIds;
|
|
||||||
msgIds.push_back(msgId);
|
|
||||||
uint32_t token;
|
|
||||||
mForumQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, TOKEN_TYPE_INSERT_POST);
|
|
||||||
#else
|
|
||||||
|
|
||||||
mThreadQueue->cancelActiveRequestTokens(TOKEN_TYPE_INSERT_POST);
|
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
|
|
||||||
std::cerr << "GxsForumThreadWidget::requestMsgData_InsertPost(" << msgId.first << "," << msgId.second << ")";
|
#ifdef DEBUG_FORUMS
|
||||||
|
std::cerr << "GxsForumThreadWidget::requestMessage(" << msgId.first << "," << msgId.second << ")";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect = msgIds[msgId.first];
|
std::vector<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||||
vect.push_back(msgId.second);
|
vect.push_back(msgId.second);
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mThreadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, TOKEN_TYPE_INSERT_POST);
|
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, TOKEN_TYPE_MESSAGEDATA);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::loadMsgData_InsertPost(const uint32_t &token)
|
void GxsForumThreadWidget::loadMessageData(const uint32_t &token)
|
||||||
{
|
{
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_INSERT_POST, false);
|
mStateHelper->setLoading(TOKEN_TYPE_MESSAGEDATA, false);
|
||||||
|
|
||||||
std::cerr << "GxsForumThreadWidget::loadMsgData_InsertPost()";
|
#ifdef DEBUG_FORUMS
|
||||||
|
std::cerr << "GxsForumThreadWidget::loadMessage()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
std::vector<RsGxsForumMsg> msgs;
|
std::vector<RsGxsForumMsg> msgs;
|
||||||
if (rsGxsForums->getMsgData(token, msgs)) {
|
if (rsGxsForums->getMsgData(token, msgs)) {
|
||||||
if (msgs.size() != 1) {
|
if (msgs.size() != 1) {
|
||||||
std::cerr << "GxsForumThreadWidget::loadMsgData_InsertPost() ERROR Wrong number of answers";
|
std::cerr << "GxsForumThreadWidget::loadMessage() ERROR Wrong number of answers";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
|
|
||||||
mStateHelper->clear(TOKEN_TYPE_INSERT_POST);
|
mStateHelper->setActive(TOKEN_TYPE_MESSAGEDATA, false);
|
||||||
|
mStateHelper->clear(TOKEN_TYPE_MESSAGEDATA);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
insertPostData(msgs[0]);
|
insertMessageData(msgs[0]);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "GxsForumThreadWidget::loadMsgData_InsertPost() ERROR Missing Message Data...";
|
std::cerr << "GxsForumThreadWidget::loadMessage() ERROR Missing Message Data...";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
|
mStateHelper->setActive(TOKEN_TYPE_MESSAGEDATA, false);
|
||||||
mStateHelper->clear(TOKEN_TYPE_INSERT_POST);
|
mStateHelper->clear(TOKEN_TYPE_MESSAGEDATA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1849,7 +1851,7 @@ void GxsForumThreadWidget::requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &
|
|||||||
vect.push_back(msgId.second);
|
vect.push_back(msgId.second);
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mThreadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, TOKEN_TYPE_REPLY_MESSAGE);
|
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, TOKEN_TYPE_REPLY_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::loadMsgData_ReplyMessage(const uint32_t &token)
|
void GxsForumThreadWidget::loadMsgData_ReplyMessage(const uint32_t &token)
|
||||||
@ -1884,17 +1886,17 @@ void GxsForumThreadWidget::loadRequest(const TokenQueue *queue, const TokenReque
|
|||||||
std::cerr << "GxsForumThreadWidget::loadRequest() UserType: " << req.mUserType;
|
std::cerr << "GxsForumThreadWidget::loadRequest() UserType: " << req.mUserType;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
if (queue == mThreadQueue)
|
if (queue == mTokenQueue)
|
||||||
{
|
{
|
||||||
/* now switch on req */
|
/* now switch on req */
|
||||||
switch(req.mUserType)
|
switch(req.mUserType)
|
||||||
{
|
{
|
||||||
case TOKEN_TYPE_CURRENTFORUM:
|
case TOKEN_TYPE_GROUPDATA:
|
||||||
loadGroup_CurrentForum(req.mToken);
|
loadGroupData(req.mToken);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOKEN_TYPE_INSERT_POST:
|
case TOKEN_TYPE_MESSAGEDATA:
|
||||||
loadMsgData_InsertPost(req.mToken);
|
loadMessageData(req.mToken);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOKEN_TYPE_REPLY_MESSAGE:
|
case TOKEN_TYPE_REPLY_MESSAGE:
|
||||||
|
@ -106,13 +106,10 @@ private slots:
|
|||||||
void fillThreadStatus(QString text);
|
void fillThreadStatus(QString text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void insertForumThreads(const RsGxsForumGroup &group);
|
void insertMessageData(const RsGxsForumMsg &msg);
|
||||||
void insertPostData(const RsGxsForumMsg &msg); // Second Half.
|
|
||||||
|
|
||||||
void insertThreads();
|
void insertThreads();
|
||||||
void insertPost();
|
void insertMessage();
|
||||||
|
|
||||||
// void forumMsgReadStatusChanged(const QString &forumId, const QString &msgId, int status);
|
|
||||||
|
|
||||||
void fillThreads(QList<QTreeWidgetItem *> &threadList, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
|
void fillThreads(QList<QTreeWidgetItem *> &threadList, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
|
||||||
void fillChildren(QTreeWidgetItem *parentItem, QTreeWidgetItem *newParentItem, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
|
void fillChildren(QTreeWidgetItem *parentItem, QTreeWidgetItem *newParentItem, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
|
||||||
@ -130,6 +127,16 @@ private:
|
|||||||
|
|
||||||
void processSettings(bool bLoad);
|
void processSettings(bool bLoad);
|
||||||
|
|
||||||
|
void requestGroupData();
|
||||||
|
void loadGroupData(const uint32_t &token);
|
||||||
|
void insertGroupData(const RsGxsForumGroup &group);
|
||||||
|
|
||||||
|
void requestMessageData(const RsGxsGrpMsgIdPair &msgId);
|
||||||
|
void loadMessageData(const uint32_t &token);
|
||||||
|
void requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &msgId);
|
||||||
|
void loadMsgData_ReplyMessage(const uint32_t &token);
|
||||||
|
|
||||||
|
private:
|
||||||
RsGxsGroupId mForumId;
|
RsGxsGroupId mForumId;
|
||||||
RsGxsGroupId mLastForumID;
|
RsGxsGroupId mLastForumID;
|
||||||
RsGxsMessageId mThreadId;
|
RsGxsMessageId mThreadId;
|
||||||
@ -139,19 +146,11 @@ private:
|
|||||||
bool mInMsgAsReadUnread;
|
bool mInMsgAsReadUnread;
|
||||||
int mLastViewType;
|
int mLastViewType;
|
||||||
RSTreeWidgetItemCompareRole *mThreadCompareRole;
|
RSTreeWidgetItemCompareRole *mThreadCompareRole;
|
||||||
TokenQueue *mThreadQueue;
|
TokenQueue *mTokenQueue;
|
||||||
GxsForumsFillThread *mFillThread;
|
GxsForumsFillThread *mFillThread;
|
||||||
unsigned int mUnreadCount;
|
unsigned int mUnreadCount;
|
||||||
unsigned int mNewCount;
|
unsigned int mNewCount;
|
||||||
|
|
||||||
void requestGroup_CurrentForum();
|
|
||||||
void loadGroup_CurrentForum(const uint32_t &token);
|
|
||||||
|
|
||||||
void requestMsgData_InsertPost(const RsGxsGrpMsgIdPair &msgId);
|
|
||||||
void loadMsgData_InsertPost(const uint32_t &token);
|
|
||||||
void requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &msgId);
|
|
||||||
void loadMsgData_ReplyMessage(const uint32_t &token);
|
|
||||||
|
|
||||||
/* Color definitions (for standard see qss.default) */
|
/* Color definitions (for standard see qss.default) */
|
||||||
QColor mTextColorRead;
|
QColor mTextColorRead;
|
||||||
QColor mTextColorUnread;
|
QColor mTextColorUnread;
|
||||||
@ -162,6 +161,7 @@ private:
|
|||||||
UIStateHelper *mStateHelper;
|
UIStateHelper *mStateHelper;
|
||||||
|
|
||||||
RsGxsMessageId mNavigatePendingMsgId;
|
RsGxsMessageId mNavigatePendingMsgId;
|
||||||
|
QList<RsGxsMessageId> mIgnoredMsgId;
|
||||||
|
|
||||||
Ui::GxsForumThreadWidget *ui;
|
Ui::GxsForumThreadWidget *ui;
|
||||||
};
|
};
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@ -97,6 +97,35 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="progressText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Loading</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QProgressBar" name="progressBar">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="LineEditClear" name="filterLineEdit">
|
<widget class="LineEditClear" name="filterLineEdit">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -227,43 +256,6 @@
|
|||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="progressBarLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="progressText">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Loading</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QProgressBar" name="progressBar">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>1000</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="threadLayout">
|
<layout class="QHBoxLayout" name="threadLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
@ -344,47 +336,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="4">
|
|
||||||
<widget class="QPushButton" name="nextButton">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>24</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>24</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Next Thread</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../images.qrc">
|
|
||||||
<normaloff>:/images/forward.png</normaloff>:/images/forward.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="13">
|
<item row="0" column="13">
|
||||||
<widget class="QPushButton" name="expandButton">
|
<widget class="QPushButton" name="expandButton">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -474,10 +425,7 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3">
|
<item row="0" column="3">
|
||||||
<widget class="QPushButton" name="previousButton">
|
<widget class="QToolButton" name="previousButton">
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -509,7 +457,48 @@
|
|||||||
<iconset resource="../images.qrc">
|
<iconset resource="../images.qrc">
|
||||||
<normaloff>:/images/back.png</normaloff>:/images/back.png</iconset>
|
<normaloff>:/images/back.png</normaloff>:/images/back.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="flat">
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
|
<widget class="QToolButton" name="nextButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Next Thread</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images.qrc">
|
||||||
|
<normaloff>:/images/forward.png</normaloff>:/images/forward.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -45,7 +45,6 @@ GxsForumsFillThread::GxsForumsFillThread(GxsForumThreadWidget *parent)
|
|||||||
mFillComplete = false;
|
mFillComplete = false;
|
||||||
|
|
||||||
mFilterColumn = 0;
|
mFilterColumn = 0;
|
||||||
mSubscribeFlags = 0;
|
|
||||||
|
|
||||||
mViewType = 0;
|
mViewType = 0;
|
||||||
mFlatView = false;
|
mFlatView = false;
|
||||||
|
@ -28,7 +28,6 @@ signals:
|
|||||||
public:
|
public:
|
||||||
RsGxsGroupId mForumId;
|
RsGxsGroupId mForumId;
|
||||||
int mFilterColumn;
|
int mFilterColumn;
|
||||||
int mSubscribeFlags;
|
|
||||||
bool mFillComplete;
|
bool mFillComplete;
|
||||||
int mViewType;
|
int mViewType;
|
||||||
bool mFlatView;
|
bool mFlatView;
|
||||||
|
Loading…
Reference in New Issue
Block a user