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 ....
|
// From ....
|
||||||
{
|
{
|
||||||
|
bool setText = true;
|
||||||
if (msgbox == RS_MSG_INBOX || msgbox == RS_MSG_OUTBOX) {
|
if (msgbox == RS_MSG_INBOX || msgbox == RS_MSG_OUTBOX) {
|
||||||
if ((it->msgflags & RS_MSG_SYSTEM) && it->srcId == ownId) {
|
if ((it->msgflags & RS_MSG_SYSTEM) && it->srcId == ownId) {
|
||||||
text = "RetroShare";
|
text = "RetroShare";
|
||||||
} else {
|
} else {
|
||||||
if (it->msgflags & RS_MSG_DISTANT)
|
if (it->msgflags & RS_MSG_DISTANT)
|
||||||
{
|
{
|
||||||
// distant message
|
// distant message
|
||||||
|
setText = false;
|
||||||
if (gotInfo || rsMsgs->getMessage(it->msgId, msgInfo)) {
|
if (gotInfo || rsMsgs->getMessage(it->msgId, msgInfo)) {
|
||||||
gotInfo = true;
|
gotInfo = true;
|
||||||
item->setId(RsGxsId(msgInfo.rsgxsid_srcId), COLUMN_FROM);
|
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;
|
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Couldn't find Msg" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(it->msgflags & RS_MSG_DISTANT)
|
if (setText)
|
||||||
{
|
{
|
||||||
item->setText(COLUMN_FROM, text);
|
item->setText(COLUMN_FROM, text);
|
||||||
item->setData(COLUMN_FROM, ROLE_SORT, text + dateString);
|
item->setData(COLUMN_FROM, ROLE_SORT, text + dateString);
|
||||||
|
} else {
|
||||||
|
item->setData(COLUMN_FROM, ROLE_SORT, item->text(COLUMN_FROM) + dateString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subject
|
// Subject
|
||||||
text = QString::fromUtf8(it->title.c_str());
|
text = QString::fromUtf8(it->title.c_str());
|
||||||
|
|
||||||
item->setText(COLUMN_SUBJECT, text);
|
item->setText(COLUMN_SUBJECT, text);
|
||||||
item->setData(COLUMN_SUBJECT, ROLE_SORT, text + dateString);
|
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
|
// 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.
|
// the GUI thread, which is not allowed by Qt => some avatars fail to load.
|
||||||
|
|
||||||
// if (rsIdentity && rsIdentity->getIdDetails(id, details)) {
|
bool isGuiThread = (QThread::currentThread() == qApp->thread());
|
||||||
// callback(GXS_ID_DETAILS_TYPE_DONE, details, object, data);
|
if (isGuiThread && rsIdentity && rsIdentity->getIdDetails(id, details)) {
|
||||||
// return true;
|
callback(GXS_ID_DETAILS_TYPE_DONE, details, object, data);
|
||||||
// }
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
details.mId = id;
|
details.mId = id;
|
||||||
|
|
||||||
@ -233,7 +234,7 @@ bool GxsIdDetails::process(const RsGxsId &id, GxsIdDetailsCallbackFunction callb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Start timer */
|
/* Start timer */
|
||||||
if (QThread::currentThread() == qApp->thread()) {
|
if (isGuiThread) {
|
||||||
/* Start timer directly */
|
/* Start timer directly */
|
||||||
mInstance->doStartTimer();
|
mInstance->doStartTimer();
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user