mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
- Added re-check of "Not found" identities for chat lobby participants list.
- Added check of RsAutoUpdatePage::eventsLocked to GxsIdDetails::timerEvent. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8006 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f6a1cbb3b2
commit
325a383fba
@ -1108,7 +1108,7 @@ void MessagesDialog::insertMessages()
|
|||||||
setText = false;
|
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, false);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Couldn't find Msg" << std::endl;
|
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Couldn't find Msg" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ void ChatLobbyDialog::updateParticipantsList()
|
|||||||
// TE: Add Wigdet to participantsList with Checkbox, to mute Participant
|
// TE: Add Wigdet to participantsList with Checkbox, to mute Participant
|
||||||
|
|
||||||
widgetitem = new GxsIdRSTreeWidgetItem(mParticipantCompareRole);
|
widgetitem = new GxsIdRSTreeWidgetItem(mParticipantCompareRole);
|
||||||
widgetitem->setId(it2->first,COLUMN_NAME) ;
|
widgetitem->setId(it2->first,COLUMN_NAME, true) ;
|
||||||
//widgetitem->setText(COLUMN_NAME, participant);
|
//widgetitem->setText(COLUMN_NAME, participant);
|
||||||
widgetitem->setText(COLUMN_ACTIVITY,QString::number(time(NULL)));
|
widgetitem->setText(COLUMN_ACTIVITY,QString::number(time(NULL)));
|
||||||
widgetitem->setText(COLUMN_ID,QString::fromStdString(it2->first.toStdString()));
|
widgetitem->setText(COLUMN_ID,QString::fromStdString(it2->first.toStdString()));
|
||||||
|
@ -430,7 +430,7 @@ void GxsCommentTreeWidget::service_loadThread(const uint32_t &token)
|
|||||||
item->setText(PCITEM_COLUMN_COMMENT, text);
|
item->setText(PCITEM_COLUMN_COMMENT, text);
|
||||||
|
|
||||||
RsGxsId authorId = comment.mMeta.mAuthorId;
|
RsGxsId authorId = comment.mMeta.mAuthorId;
|
||||||
item->setId(authorId, PCITEM_COLUMN_AUTHOR);
|
item->setId(authorId, PCITEM_COLUMN_AUTHOR, false);
|
||||||
|
|
||||||
text = QString::number(comment.mScore);
|
text = QString::number(comment.mScore);
|
||||||
item->setText(PCITEM_COLUMN_SCORE, text);
|
item->setText(PCITEM_COLUMN_SCORE, text);
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "GxsIdDetails.h"
|
#include "GxsIdDetails.h"
|
||||||
|
#include "retroshare-gui/RsAutoUpdatePage.h"
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
|
|
||||||
@ -119,57 +120,59 @@ void GxsIdDetails::connectObject_locked(QObject *object, bool doConnect)
|
|||||||
void GxsIdDetails::timerEvent(QTimerEvent *event)
|
void GxsIdDetails::timerEvent(QTimerEvent *event)
|
||||||
{
|
{
|
||||||
if (event->timerId() == mCheckTimerId) {
|
if (event->timerId() == mCheckTimerId) {
|
||||||
/* Stop timer */
|
if (!RsAutoUpdatePage::eventsLocked()) {
|
||||||
killTimer(mCheckTimerId);
|
/* Stop timer */
|
||||||
mCheckTimerId = 0;
|
killTimer(mCheckTimerId);
|
||||||
|
mCheckTimerId = 0;
|
||||||
|
|
||||||
if (rsIdentity) {
|
if (rsIdentity) {
|
||||||
QMutexLocker lock(&mMutex);
|
QMutexLocker lock(&mMutex);
|
||||||
|
|
||||||
if (!mPendingData.empty()) {
|
if (!mPendingData.empty()) {
|
||||||
/* Check pending id's */
|
/* Check pending id's */
|
||||||
QList<CallbackData>::iterator dataIt;
|
QList<CallbackData>::iterator dataIt;
|
||||||
for (dataIt = mPendingData.begin(); dataIt != mPendingData.end(); ) {
|
for (dataIt = mPendingData.begin(); dataIt != mPendingData.end(); ) {
|
||||||
CallbackData &pendingData = *dataIt;
|
CallbackData &pendingData = *dataIt;
|
||||||
|
|
||||||
RsIdentityDetails details;
|
RsIdentityDetails details;
|
||||||
if (rsIdentity->getIdDetails(pendingData.mId, details)) {
|
if (rsIdentity->getIdDetails(pendingData.mId, details)) {
|
||||||
/* Got details */
|
/* Got details */
|
||||||
pendingData.mCallback(GXS_ID_DETAILS_TYPE_DONE, details, pendingData.mObject, pendingData.mData);
|
pendingData.mCallback(GXS_ID_DETAILS_TYPE_DONE, details, pendingData.mObject, pendingData.mData);
|
||||||
|
|
||||||
QObject *object = pendingData.mObject;
|
QObject *object = pendingData.mObject;
|
||||||
dataIt = mPendingData.erase(dataIt);
|
dataIt = mPendingData.erase(dataIt);
|
||||||
connectObject_locked(object, false);
|
connectObject_locked(object, false);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (++pendingData.mAttempt > MAX_ATTEMPTS) {
|
||||||
|
/* Max attempts reached, stop trying */
|
||||||
|
details.mId = pendingData.mId;
|
||||||
|
pendingData.mCallback(GXS_ID_DETAILS_TYPE_FAILED, details, pendingData.mObject, pendingData.mData);
|
||||||
|
|
||||||
|
QObject *object = pendingData.mObject;
|
||||||
|
dataIt = mPendingData.erase(dataIt);
|
||||||
|
connectObject_locked(object, false);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
++dataIt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++pendingData.mAttempt > MAX_ATTEMPTS) {
|
|
||||||
/* Max attempts reached, stop trying */
|
|
||||||
details.mId = pendingData.mId;
|
|
||||||
pendingData.mCallback(GXS_ID_DETAILS_TYPE_FAILED, details, pendingData.mObject, pendingData.mData);
|
|
||||||
|
|
||||||
QObject *object = pendingData.mObject;
|
|
||||||
dataIt = mPendingData.erase(dataIt);
|
|
||||||
connectObject_locked(object, false);
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
++dataIt;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
QMutexLocker lock(&mMutex);
|
QMutexLocker lock(&mMutex);
|
||||||
|
|
||||||
if (mPendingData.empty()) {
|
if (mPendingData.empty()) {
|
||||||
/* All done */
|
/* All done */
|
||||||
mInstance = NULL;
|
mInstance = NULL;
|
||||||
deleteLater();
|
deleteLater();
|
||||||
} else {
|
} else {
|
||||||
/* Start timer */
|
/* Start timer */
|
||||||
doStartTimer();
|
doStartTimer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "rshare.h"
|
||||||
#include "GxsIdTreeWidgetItem.h"
|
#include "GxsIdTreeWidgetItem.h"
|
||||||
#include "GxsIdDetails.h"
|
#include "GxsIdDetails.h"
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
@ -40,68 +41,89 @@ GxsIdRSTreeWidgetItem::GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *
|
|||||||
|
|
||||||
void GxsIdRSTreeWidgetItem::init()
|
void GxsIdRSTreeWidgetItem::init()
|
||||||
{
|
{
|
||||||
|
mIdFound = false;
|
||||||
|
mRetryWhenFailed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fillGxsIdRSTreeWidgetItemCallback(GxsIdDetailsType type, const RsIdentityDetails &details, QObject *object, const QVariant &/*data*/)
|
static void fillGxsIdRSTreeWidgetItemCallback(GxsIdDetailsType type, const RsIdentityDetails &details, QObject *object, const QVariant &/*data*/)
|
||||||
{
|
{
|
||||||
GxsIdRSTreeWidgetItem *item = dynamic_cast<GxsIdRSTreeWidgetItem*>(object);
|
GxsIdRSTreeWidgetItem *item = dynamic_cast<GxsIdRSTreeWidgetItem*>(object);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString toolTip;
|
QString toolTip;
|
||||||
QList<QIcon> icons;
|
QList<QIcon> icons;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GXS_ID_DETAILS_TYPE_EMPTY:
|
case GXS_ID_DETAILS_TYPE_EMPTY:
|
||||||
case GXS_ID_DETAILS_TYPE_FAILED:
|
item->processResult(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GXS_ID_DETAILS_TYPE_LOADING:
|
case GXS_ID_DETAILS_TYPE_FAILED:
|
||||||
icons.push_back(GxsIdDetails::getLoadingIcon(details.mId));
|
item->processResult(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GXS_ID_DETAILS_TYPE_DONE:
|
case GXS_ID_DETAILS_TYPE_LOADING:
|
||||||
GxsIdDetails::getIcons(details, icons);
|
icons.push_back(GxsIdDetails::getLoadingIcon(details.mId));
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
toolTip = GxsIdDetails::getComment(details);
|
|
||||||
|
|
||||||
int column = item->idColumn();
|
case GXS_ID_DETAILS_TYPE_DONE:
|
||||||
|
GxsIdDetails::getIcons(details, icons);
|
||||||
|
item->processResult(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
toolTip = GxsIdDetails::getComment(details);
|
||||||
|
|
||||||
item->setText(column, GxsIdDetails::getNameForType(type, details));
|
int column = item->idColumn();
|
||||||
item->setData(column, Qt::UserRole, QString::fromStdString(details.mId.toStdString()));
|
|
||||||
|
|
||||||
QPixmap combinedPixmap;
|
item->setText(column, GxsIdDetails::getNameForType(type, details));
|
||||||
if (!icons.empty()) {
|
item->setData(column, Qt::UserRole, QString::fromStdString(details.mId.toStdString()));
|
||||||
GxsIdDetails::GenerateCombinedPixmap(combinedPixmap, icons, 16);
|
|
||||||
}
|
|
||||||
item->setData(column, Qt::DecorationRole, combinedPixmap);
|
|
||||||
QImage pix ;
|
|
||||||
|
|
||||||
if(details.mAvatar.mSize == 0 || !pix.loadFromData(details.mAvatar.mData, details.mAvatar.mSize, "PNG"))
|
QPixmap combinedPixmap;
|
||||||
pix = GxsIdDetails::makeDefaultIcon(details.mId);
|
if (!icons.empty()) {
|
||||||
|
GxsIdDetails::GenerateCombinedPixmap(combinedPixmap, icons, 16);
|
||||||
|
}
|
||||||
|
item->setData(column, Qt::DecorationRole, combinedPixmap);
|
||||||
|
QImage pix ;
|
||||||
|
|
||||||
QString embeddedImage ;
|
if(details.mAvatar.mSize == 0 || !pix.loadFromData(details.mAvatar.mData, details.mAvatar.mSize, "PNG"))
|
||||||
|
pix = GxsIdDetails::makeDefaultIcon(details.mId);
|
||||||
|
|
||||||
if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(64,64),Qt::KeepAspectRatio,Qt::SmoothTransformation),embeddedImage,128*128))
|
QString embeddedImage ;
|
||||||
toolTip = "<table><tr><td>"+embeddedImage+"</td><td>" +toolTip+ "</td></table>" ;
|
|
||||||
|
|
||||||
item->setToolTip(column, toolTip);
|
if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(64,64),Qt::KeepAspectRatio,Qt::SmoothTransformation),embeddedImage,128*128))
|
||||||
|
toolTip = "<table><tr><td>"+embeddedImage+"</td><td>" +toolTip+ "</td></table>" ;
|
||||||
|
|
||||||
|
item->setToolTip(column, toolTip);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsIdRSTreeWidgetItem::setId(const RsGxsId &id, int column)
|
void GxsIdRSTreeWidgetItem::setId(const RsGxsId &id, int column, bool retryWhenFailed)
|
||||||
{
|
{
|
||||||
//std::cerr << " GxsIdRSTreeWidgetItem::setId(" << id << "," << column << ")";
|
//std::cerr << " GxsIdRSTreeWidgetItem::setId(" << id << "," << column << ")";
|
||||||
//std::cerr << std::endl;
|
//std::cerr << std::endl;
|
||||||
|
|
||||||
if (mColumn == column && mId == id) {
|
if (mIdFound) {
|
||||||
return;
|
if (mColumn == column && mId == id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mIdFound = false;
|
||||||
|
mRetryWhenFailed = retryWhenFailed;
|
||||||
|
|
||||||
mId = id;
|
mId = id;
|
||||||
mColumn = column;
|
mColumn = column;
|
||||||
|
|
||||||
|
startProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsIdRSTreeWidgetItem::startProcess()
|
||||||
|
{
|
||||||
|
if (mRetryWhenFailed) {
|
||||||
|
disconnect(rApp, SIGNAL(minuteTick()), this, SLOT(startProcess()));
|
||||||
|
}
|
||||||
|
|
||||||
GxsIdDetails::process(mId, fillGxsIdRSTreeWidgetItemCallback, this);
|
GxsIdDetails::process(mId, fillGxsIdRSTreeWidgetItemCallback, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,3 +132,13 @@ bool GxsIdRSTreeWidgetItem::getId(RsGxsId &id)
|
|||||||
id = mId;
|
id = mId;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsIdRSTreeWidgetItem::processResult(bool success)
|
||||||
|
{
|
||||||
|
mIdFound = success;
|
||||||
|
|
||||||
|
if (!mIdFound && mRetryWhenFailed) {
|
||||||
|
/* Try again */
|
||||||
|
connect(rApp, SIGNAL(minuteTick()), this, SLOT(startProcess()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -42,16 +42,22 @@ public:
|
|||||||
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidget *parent = NULL);
|
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidget *parent = NULL);
|
||||||
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidgetItem *parent);
|
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidgetItem *parent);
|
||||||
|
|
||||||
void setId(const RsGxsId &id, int column);
|
void setId(const RsGxsId &id, int column, bool retryWhenFailed);
|
||||||
bool getId(RsGxsId &id);
|
bool getId(RsGxsId &id);
|
||||||
|
|
||||||
int idColumn() { return mColumn; }
|
int idColumn() { return mColumn; }
|
||||||
|
void processResult(bool success);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void startProcess();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
RsGxsId mId;
|
RsGxsId mId;
|
||||||
int mColumn;
|
int mColumn;
|
||||||
|
bool mIdFound;
|
||||||
|
bool mRetryWhenFailed;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -850,7 +850,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
|
|||||||
item->setText(COLUMN_THREAD_DATE, text);
|
item->setText(COLUMN_THREAD_DATE, text);
|
||||||
item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort);
|
item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort);
|
||||||
|
|
||||||
item->setId(msg.mMeta.mAuthorId, COLUMN_THREAD_AUTHOR);
|
item->setId(msg.mMeta.mAuthorId, COLUMN_THREAD_AUTHOR, false);
|
||||||
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId.toStdString()));
|
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId.toStdString()));
|
||||||
//#TODO
|
//#TODO
|
||||||
#if 0
|
#if 0
|
||||||
@ -1013,7 +1013,7 @@ static void copyItem(QTreeWidgetItem *item, const QTreeWidgetItem *newItem)
|
|||||||
GxsIdRSTreeWidgetItem *gxsIdItem = dynamic_cast<GxsIdRSTreeWidgetItem*>(item);
|
GxsIdRSTreeWidgetItem *gxsIdItem = dynamic_cast<GxsIdRSTreeWidgetItem*>(item);
|
||||||
if (gxsIdItem) {
|
if (gxsIdItem) {
|
||||||
/* Set new gxs id */
|
/* Set new gxs id */
|
||||||
gxsIdItem->setId(RsGxsId(authorId.toStdString()), i);
|
gxsIdItem->setId(RsGxsId(authorId.toStdString()), i, false);
|
||||||
} else {
|
} else {
|
||||||
/* Copy text */
|
/* Copy text */
|
||||||
item->setText(i, newItem->text(i));
|
item->setText(i, newItem->text(i));
|
||||||
|
@ -120,6 +120,11 @@ Rshare::Rshare(QStringList args, int &argc, char **argv, const QString &dir)
|
|||||||
connect(timer, SIGNAL(timeout()), this, SLOT(blinkTimer()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(blinkTimer()));
|
||||||
timer->start();
|
timer->start();
|
||||||
|
|
||||||
|
timer = new QTimer(this);
|
||||||
|
timer->setInterval(60000);
|
||||||
|
connect(timer, SIGNAL(timeout()), this, SIGNAL(minuteTick()));
|
||||||
|
timer->start();
|
||||||
|
|
||||||
/* Read in all our command-line arguments. */
|
/* Read in all our command-line arguments. */
|
||||||
parseArguments(args);
|
parseArguments(args);
|
||||||
|
|
||||||
|
@ -142,6 +142,8 @@ signals:
|
|||||||
void blink(bool on);
|
void blink(bool on);
|
||||||
/** Global timer every second */
|
/** Global timer every second */
|
||||||
void secondTick();
|
void secondTick();
|
||||||
|
/** Global timer every minute */
|
||||||
|
void minuteTick();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/** Called when the application's main event loop has started. This method
|
/** Called when the application's main event loop has started. This method
|
||||||
|
Loading…
Reference in New Issue
Block a user