mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-19 22:40:36 -04: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
9 changed files with 131 additions and 83 deletions
|
@ -1108,7 +1108,7 @@ void MessagesDialog::insertMessages()
|
|||
setText = false;
|
||||
if (gotInfo || rsMsgs->getMessage(it->msgId, msgInfo)) {
|
||||
gotInfo = true;
|
||||
item->setId(RsGxsId(msgInfo.rsgxsid_srcId), COLUMN_FROM);
|
||||
item->setId(RsGxsId(msgInfo.rsgxsid_srcId), COLUMN_FROM, false);
|
||||
} else {
|
||||
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
|
||||
|
||||
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_ACTIVITY,QString::number(time(NULL)));
|
||||
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);
|
||||
|
||||
RsGxsId authorId = comment.mMeta.mAuthorId;
|
||||
item->setId(authorId, PCITEM_COLUMN_AUTHOR);
|
||||
item->setId(authorId, PCITEM_COLUMN_AUTHOR, false);
|
||||
|
||||
text = QString::number(comment.mScore);
|
||||
item->setText(PCITEM_COLUMN_SCORE, text);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <math.h>
|
||||
#include "GxsIdDetails.h"
|
||||
#include "retroshare-gui/RsAutoUpdatePage.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
|
@ -119,6 +120,7 @@ void GxsIdDetails::connectObject_locked(QObject *object, bool doConnect)
|
|||
void GxsIdDetails::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
if (event->timerId() == mCheckTimerId) {
|
||||
if (!RsAutoUpdatePage::eventsLocked()) {
|
||||
/* Stop timer */
|
||||
killTimer(mCheckTimerId);
|
||||
mCheckTimerId = 0;
|
||||
|
@ -172,6 +174,7 @@ void GxsIdDetails::timerEvent(QTimerEvent *event)
|
|||
doStartTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QObject::timerEvent(event);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "rshare.h"
|
||||
#include "GxsIdTreeWidgetItem.h"
|
||||
#include "GxsIdDetails.h"
|
||||
#include "util/HandleRichText.h"
|
||||
|
@ -40,6 +41,8 @@ GxsIdRSTreeWidgetItem::GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *
|
|||
|
||||
void GxsIdRSTreeWidgetItem::init()
|
||||
{
|
||||
mIdFound = false;
|
||||
mRetryWhenFailed = false;
|
||||
}
|
||||
|
||||
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) {
|
||||
case GXS_ID_DETAILS_TYPE_EMPTY:
|
||||
item->processResult(true);
|
||||
break;
|
||||
|
||||
case GXS_ID_DETAILS_TYPE_FAILED:
|
||||
item->processResult(false);
|
||||
break;
|
||||
|
||||
case GXS_ID_DETAILS_TYPE_LOADING:
|
||||
|
@ -63,6 +70,7 @@ static void fillGxsIdRSTreeWidgetItemCallback(GxsIdDetailsType type, const RsIde
|
|||
|
||||
case GXS_ID_DETAILS_TYPE_DONE:
|
||||
GxsIdDetails::getIcons(details, icons);
|
||||
item->processResult(true);
|
||||
break;
|
||||
}
|
||||
toolTip = GxsIdDetails::getComment(details);
|
||||
|
@ -90,18 +98,32 @@ static void fillGxsIdRSTreeWidgetItemCallback(GxsIdDetailsType type, const RsIde
|
|||
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 << std::endl;
|
||||
|
||||
if (mIdFound) {
|
||||
if (mColumn == column && mId == id) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mIdFound = false;
|
||||
mRetryWhenFailed = retryWhenFailed;
|
||||
|
||||
mId = id;
|
||||
mColumn = column;
|
||||
|
||||
startProcess();
|
||||
}
|
||||
|
||||
void GxsIdRSTreeWidgetItem::startProcess()
|
||||
{
|
||||
if (mRetryWhenFailed) {
|
||||
disconnect(rApp, SIGNAL(minuteTick()), this, SLOT(startProcess()));
|
||||
}
|
||||
|
||||
GxsIdDetails::process(mId, fillGxsIdRSTreeWidgetItemCallback, this);
|
||||
}
|
||||
|
||||
|
@ -110,3 +132,13 @@ bool GxsIdRSTreeWidgetItem::getId(RsGxsId &id)
|
|||
id = mId;
|
||||
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, QTreeWidgetItem *parent);
|
||||
|
||||
void setId(const RsGxsId &id, int column);
|
||||
void setId(const RsGxsId &id, int column, bool retryWhenFailed);
|
||||
bool getId(RsGxsId &id);
|
||||
|
||||
int idColumn() { return mColumn; }
|
||||
void processResult(bool success);
|
||||
|
||||
private slots:
|
||||
void startProcess();
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
RsGxsId mId;
|
||||
int mColumn;
|
||||
bool mIdFound;
|
||||
bool mRetryWhenFailed;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -850,7 +850,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
|
|||
item->setText(COLUMN_THREAD_DATE, text);
|
||||
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()));
|
||||
//#TODO
|
||||
#if 0
|
||||
|
@ -1013,7 +1013,7 @@ static void copyItem(QTreeWidgetItem *item, const QTreeWidgetItem *newItem)
|
|||
GxsIdRSTreeWidgetItem *gxsIdItem = dynamic_cast<GxsIdRSTreeWidgetItem*>(item);
|
||||
if (gxsIdItem) {
|
||||
/* Set new gxs id */
|
||||
gxsIdItem->setId(RsGxsId(authorId.toStdString()), i);
|
||||
gxsIdItem->setId(RsGxsId(authorId.toStdString()), i, false);
|
||||
} else {
|
||||
/* Copy text */
|
||||
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()));
|
||||
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. */
|
||||
parseArguments(args);
|
||||
|
||||
|
|
|
@ -142,6 +142,8 @@ signals:
|
|||
void blink(bool on);
|
||||
/** Global timer every second */
|
||||
void secondTick();
|
||||
/** Global timer every minute */
|
||||
void minuteTick();
|
||||
|
||||
private slots:
|
||||
/** Called when the application's main event loop has started. This method
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue