mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-23 13:54:27 -04:00
commit
e8872c6780
6 changed files with 56 additions and 11 deletions
|
@ -49,6 +49,10 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
|
||||||
GxsFeedItem(feedHolder, feedId, group_meta.mGroupId, messageId, isHome, rsGxsChannels, autoUpdate),
|
GxsFeedItem(feedHolder, feedId, group_meta.mGroupId, messageId, isHome, rsGxsChannels, autoUpdate),
|
||||||
mGroupMeta(group_meta)
|
mGroupMeta(group_meta)
|
||||||
{
|
{
|
||||||
|
mLoadingGroup = false;
|
||||||
|
mLoadingMessage = false;
|
||||||
|
mLoadingComment = false;
|
||||||
|
|
||||||
mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded
|
mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded
|
||||||
mPost.mMeta.mGroupId = mGroupMeta.mGroupId;
|
mPost.mMeta.mGroupId = mGroupMeta.mGroupId;
|
||||||
|
|
||||||
|
@ -136,6 +140,19 @@ void GxsChannelPostItem::paintEvent(QPaintEvent *e)
|
||||||
|
|
||||||
GxsChannelPostItem::~GxsChannelPostItem()
|
GxsChannelPostItem::~GxsChannelPostItem()
|
||||||
{
|
{
|
||||||
|
auto timeout = std::chrono::steady_clock::now() + std::chrono::milliseconds(300);
|
||||||
|
|
||||||
|
while( (mLoadingGroup || mLoadingMessage || mLoadingComment)
|
||||||
|
&& std::chrono::steady_clock::now() < timeout)
|
||||||
|
{
|
||||||
|
RsDbg() << __PRETTY_FUNCTION__ << " is Waiting for "
|
||||||
|
<< (mLoadingGroup ? "Group " : "")
|
||||||
|
<< (mLoadingMessage ? "Message " : "")
|
||||||
|
<< (mLoadingComment ? "Comment " : "")
|
||||||
|
<< "loading." << std::endl;
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
}
|
||||||
|
|
||||||
delete(ui);
|
delete(ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,6 +294,7 @@ void GxsChannelPostItem::loadGroup()
|
||||||
std::cerr << "GxsChannelGroupItem::loadGroup()";
|
std::cerr << "GxsChannelGroupItem::loadGroup()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
mLoadingGroup = true;
|
||||||
|
|
||||||
RsThread::async([this]()
|
RsThread::async([this]()
|
||||||
{
|
{
|
||||||
|
@ -306,6 +324,7 @@ void GxsChannelPostItem::loadGroup()
|
||||||
* after a blocking call to RetroShare API complete */
|
* after a blocking call to RetroShare API complete */
|
||||||
|
|
||||||
mGroupMeta = group.mMeta;
|
mGroupMeta = group.mMeta;
|
||||||
|
mLoadingGroup = false;
|
||||||
|
|
||||||
}, this );
|
}, this );
|
||||||
});
|
});
|
||||||
|
@ -316,6 +335,8 @@ void GxsChannelPostItem::loadMessage()
|
||||||
std::cerr << "GxsChannelPostItem::loadMessage()";
|
std::cerr << "GxsChannelPostItem::loadMessage()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
mLoadingMessage = true;
|
||||||
|
|
||||||
RsThread::async([this]()
|
RsThread::async([this]()
|
||||||
{
|
{
|
||||||
// 1 - get group data
|
// 1 - get group data
|
||||||
|
@ -337,7 +358,11 @@ void GxsChannelPostItem::loadMessage()
|
||||||
#endif
|
#endif
|
||||||
const RsGxsChannelPost& post(posts[0]);
|
const RsGxsChannelPost& post(posts[0]);
|
||||||
|
|
||||||
RsQThreadUtils::postToObject( [post,this]() { setPost(post); }, this );
|
RsQThreadUtils::postToObject( [post,this]()
|
||||||
|
{
|
||||||
|
setPost(post);
|
||||||
|
mLoadingMessage = false;
|
||||||
|
}, this );
|
||||||
}
|
}
|
||||||
else if(comments.size() == 1)
|
else if(comments.size() == 1)
|
||||||
{
|
{
|
||||||
|
@ -356,7 +381,8 @@ void GxsChannelPostItem::loadMessage()
|
||||||
setMessageId(cmt.mMeta.mThreadId);
|
setMessageId(cmt.mMeta.mThreadId);
|
||||||
requestMessage();
|
requestMessage();
|
||||||
|
|
||||||
}, this );
|
mLoadingMessage = false;
|
||||||
|
}, this );
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -366,7 +392,11 @@ void GxsChannelPostItem::loadMessage()
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RsQThreadUtils::postToObject( [this]() { removeItem(); }, this );
|
RsQThreadUtils::postToObject( [this]()
|
||||||
|
{
|
||||||
|
removeItem();
|
||||||
|
mLoadingMessage = false;
|
||||||
|
}, this );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -377,6 +407,7 @@ void GxsChannelPostItem::loadComment()
|
||||||
std::cerr << "GxsChannelPostItem::loadComment()";
|
std::cerr << "GxsChannelPostItem::loadComment()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
mLoadingComment = true;
|
||||||
|
|
||||||
RsThread::async([this]()
|
RsThread::async([this]()
|
||||||
{
|
{
|
||||||
|
@ -407,6 +438,7 @@ void GxsChannelPostItem::loadComment()
|
||||||
sComButText = tr("Comments ").append("(%1)").arg(comNb);
|
sComButText = tr("Comments ").append("(%1)").arg(comNb);
|
||||||
|
|
||||||
ui->commentButton->setText(sComButText);
|
ui->commentButton->setText(sComButText);
|
||||||
|
mLoadingComment = false;
|
||||||
|
|
||||||
}, this );
|
}, this );
|
||||||
});
|
});
|
||||||
|
|
|
@ -119,7 +119,12 @@ private:
|
||||||
private:
|
private:
|
||||||
bool mInFill;
|
bool mInFill;
|
||||||
bool mCloseOnRead;
|
bool mCloseOnRead;
|
||||||
bool mLoaded;
|
bool mLoaded;
|
||||||
|
|
||||||
|
bool mLoadingMessage;
|
||||||
|
bool mLoadingGroup;
|
||||||
|
bool mLoadingComment;
|
||||||
|
|
||||||
|
|
||||||
RsGroupMetaData mGroupMeta;
|
RsGroupMetaData mGroupMeta;
|
||||||
RsGxsChannelPost mPost;
|
RsGxsChannelPost mPost;
|
||||||
|
|
|
@ -47,7 +47,13 @@ GxsForumMsgItem::GxsForumMsgItem(FeedHolder *feedHolder, uint32_t feedId, const
|
||||||
{
|
{
|
||||||
mMessage.mMeta.mMsgId = messageId; // useful for uniqueIdentifier() before the post is actually loaded
|
mMessage.mMeta.mMsgId = messageId; // useful for uniqueIdentifier() before the post is actually loaded
|
||||||
mMessage.mMeta.mGroupId = groupId;
|
mMessage.mMeta.mGroupId = groupId;
|
||||||
setup();
|
|
||||||
|
mLoadingGroup = false;
|
||||||
|
mLoadingMessage = false;
|
||||||
|
mLoadingSetAsRead = false;
|
||||||
|
mLoadingParentMessage = false;
|
||||||
|
|
||||||
|
setup();
|
||||||
|
|
||||||
requestGroup();
|
requestGroup();
|
||||||
requestMessage();
|
requestMessage();
|
||||||
|
|
|
@ -738,7 +738,8 @@ void MessageWidget::remove()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool deleteReal = false;
|
#ifdef TO_REMOVE
|
||||||
|
bool deleteReal = false;
|
||||||
if (msgInfo.msgflags & RS_MSG_TRASH) {
|
if (msgInfo.msgflags & RS_MSG_TRASH) {
|
||||||
deleteReal = true;
|
deleteReal = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -763,8 +764,8 @@ void MessageWidget::remove()
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
emit messageRemoved();
|
emit messageRemovalRequested(currMsgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageWidget::print()
|
void MessageWidget::print()
|
||||||
|
|
|
@ -61,6 +61,7 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void messageRemoved();
|
void messageRemoved();
|
||||||
|
void messageRemovalRequested(std::string);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void reply();
|
void reply();
|
||||||
|
|
|
@ -144,7 +144,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
||||||
|
|
||||||
msgWidget = new MessageWidget(true, this);
|
msgWidget = new MessageWidget(true, this);
|
||||||
ui.msgLayout->addWidget(msgWidget);
|
ui.msgLayout->addWidget(msgWidget);
|
||||||
connect(msgWidget, SIGNAL(messageRemoved()), this, SLOT(messageRemoved()));
|
connect(msgWidget, SIGNAL(messageRemovalRequested(std::string)), this, SLOT(removemessage()));
|
||||||
|
|
||||||
connectActions();
|
connectActions();
|
||||||
|
|
||||||
|
@ -838,7 +838,7 @@ void MessagesDialog::openAsWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
msgWidget->activateWindow();
|
msgWidget->activateWindow();
|
||||||
connect(msgWidget, SIGNAL(messageRemoved()), this, SLOT(messageRemoved()));
|
connect(msgWidget, SIGNAL(messageRemovalRequested(std::string)), this, SLOT(removemessage()));
|
||||||
|
|
||||||
/* window will destroy itself! */
|
/* window will destroy itself! */
|
||||||
}
|
}
|
||||||
|
@ -858,7 +858,7 @@ void MessagesDialog::openAsTab()
|
||||||
|
|
||||||
ui.tabWidget->addTab(msgWidget,FilesDefs::getIconFromQtResourcePath(IMAGE_MAIL), msgWidget->subject(true));
|
ui.tabWidget->addTab(msgWidget,FilesDefs::getIconFromQtResourcePath(IMAGE_MAIL), msgWidget->subject(true));
|
||||||
ui.tabWidget->setCurrentWidget(msgWidget);
|
ui.tabWidget->setCurrentWidget(msgWidget);
|
||||||
connect(msgWidget, SIGNAL(messageRemoved()), this, SLOT(messageRemoved()));
|
connect(msgWidget, SIGNAL(messageRemovalRequested(std::string)), this, SLOT(removemessage()));
|
||||||
|
|
||||||
/* window will destroy itself! */
|
/* window will destroy itself! */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue