- 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:
thunder2 2015-03-09 20:41:14 +00:00
parent f6a1cbb3b2
commit 325a383fba
9 changed files with 131 additions and 83 deletions

View File

@ -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;
} }

View File

@ -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()));

View File

@ -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);

View File

@ -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,6 +120,7 @@ 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) {
if (!RsAutoUpdatePage::eventsLocked()) {
/* Stop timer */ /* Stop timer */
killTimer(mCheckTimerId); killTimer(mCheckTimerId);
mCheckTimerId = 0; mCheckTimerId = 0;
@ -172,6 +174,7 @@ void GxsIdDetails::timerEvent(QTimerEvent *event)
doStartTimer(); doStartTimer();
} }
} }
}
QObject::timerEvent(event); QObject::timerEvent(event);
} }

View File

@ -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,6 +41,8 @@ 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*/)
@ -54,7 +57,11 @@ static void fillGxsIdRSTreeWidgetItemCallback(GxsIdDetailsType type, const RsIde
switch (type) { switch (type) {
case GXS_ID_DETAILS_TYPE_EMPTY: case GXS_ID_DETAILS_TYPE_EMPTY:
item->processResult(true);
break;
case GXS_ID_DETAILS_TYPE_FAILED: case GXS_ID_DETAILS_TYPE_FAILED:
item->processResult(false);
break; break;
case GXS_ID_DETAILS_TYPE_LOADING: case GXS_ID_DETAILS_TYPE_LOADING:
@ -63,6 +70,7 @@ static void fillGxsIdRSTreeWidgetItemCallback(GxsIdDetailsType type, const RsIde
case GXS_ID_DETAILS_TYPE_DONE: case GXS_ID_DETAILS_TYPE_DONE:
GxsIdDetails::getIcons(details, icons); GxsIdDetails::getIcons(details, icons);
item->processResult(true);
break; break;
} }
toolTip = GxsIdDetails::getComment(details); toolTip = GxsIdDetails::getComment(details);
@ -90,18 +98,32 @@ static void fillGxsIdRSTreeWidgetItemCallback(GxsIdDetailsType type, const RsIde
item->setToolTip(column, toolTip); 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 (mIdFound) {
if (mColumn == column && mId == id) { if (mColumn == column && mId == id) {
return; 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()));
}
}

View File

@ -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

View File

@ -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));

View File

@ -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);

View File

@ -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