mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Optimized GxsIdDetails::process to load the gxs details directly when the caller is the gui thread.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7967 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
533dc32e3b
commit
5e9acac013
@ -1097,13 +1097,15 @@ void MessagesDialog::insertMessages()
|
||||
|
||||
// From ....
|
||||
{
|
||||
bool setText = true;
|
||||
if (msgbox == RS_MSG_INBOX || msgbox == RS_MSG_OUTBOX) {
|
||||
if ((it->msgflags & RS_MSG_SYSTEM) && it->srcId == ownId) {
|
||||
text = "RetroShare";
|
||||
} else {
|
||||
if (it->msgflags & RS_MSG_DISTANT)
|
||||
{
|
||||
{
|
||||
// distant message
|
||||
setText = false;
|
||||
if (gotInfo || rsMsgs->getMessage(it->msgId, msgInfo)) {
|
||||
gotInfo = true;
|
||||
item->setId(RsGxsId(msgInfo.rsgxsid_srcId), COLUMN_FROM);
|
||||
@ -1146,15 +1148,17 @@ void MessagesDialog::insertMessages()
|
||||
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Couldn't find Msg" << std::endl;
|
||||
}
|
||||
}
|
||||
if(it->msgflags & RS_MSG_DISTANT)
|
||||
{
|
||||
if (setText)
|
||||
{
|
||||
item->setText(COLUMN_FROM, text);
|
||||
item->setData(COLUMN_FROM, ROLE_SORT, text + dateString);
|
||||
} else {
|
||||
item->setData(COLUMN_FROM, ROLE_SORT, item->text(COLUMN_FROM) + dateString);
|
||||
}
|
||||
}
|
||||
|
||||
// Subject
|
||||
text = QString::fromUtf8(it->title.c_str());
|
||||
text = QString::fromUtf8(it->title.c_str());
|
||||
|
||||
item->setText(COLUMN_SUBJECT, text);
|
||||
item->setData(COLUMN_SUBJECT, ROLE_SORT, text + dateString);
|
||||
|
@ -203,10 +203,11 @@ bool GxsIdDetails::process(const RsGxsId &id, GxsIdDetailsCallbackFunction callb
|
||||
// without one timer tick, but it causes the use of Pixmap in avatars within a threat that is different than
|
||||
// the GUI thread, which is not allowed by Qt => some avatars fail to load.
|
||||
|
||||
// if (rsIdentity && rsIdentity->getIdDetails(id, details)) {
|
||||
// callback(GXS_ID_DETAILS_TYPE_DONE, details, object, data);
|
||||
// return true;
|
||||
// }
|
||||
bool isGuiThread = (QThread::currentThread() == qApp->thread());
|
||||
if (isGuiThread && rsIdentity && rsIdentity->getIdDetails(id, details)) {
|
||||
callback(GXS_ID_DETAILS_TYPE_DONE, details, object, data);
|
||||
return true;
|
||||
}
|
||||
|
||||
details.mId = id;
|
||||
|
||||
@ -233,7 +234,7 @@ bool GxsIdDetails::process(const RsGxsId &id, GxsIdDetailsCallbackFunction callb
|
||||
}
|
||||
|
||||
/* Start timer */
|
||||
if (QThread::currentThread() == qApp->thread()) {
|
||||
if (isGuiThread) {
|
||||
/* Start timer directly */
|
||||
mInstance->doStartTimer();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user