mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added mask to select which icons to show in RsGxsIdTreeWidgetItem. Kept only avatar in ChatLobby participant list
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8019 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a6b06fd41a
commit
c811d71738
@ -36,6 +36,7 @@
|
|||||||
#include "common/PeerDefs.h"
|
#include "common/PeerDefs.h"
|
||||||
#include "common/RSItemDelegate.h"
|
#include "common/RSItemDelegate.h"
|
||||||
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||||
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
#include "util/RsProtectedTimer.h"
|
#include "util/RsProtectedTimer.h"
|
||||||
#include "util/QtVersion.h"
|
#include "util/QtVersion.h"
|
||||||
@ -1058,7 +1059,7 @@ void MessagesDialog::insertMessages()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item = new GxsIdRSTreeWidgetItem(mMessageCompareRole);
|
item = new GxsIdRSTreeWidgetItem(mMessageCompareRole,GxsIdDetails::ICON_TYPE_AVATAR);
|
||||||
insertItem = true;
|
insertItem = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "gui/common/FriendSelectionDialog.h"
|
#include "gui/common/FriendSelectionDialog.h"
|
||||||
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||||
#include "gui/gxs/GxsIdChooser.h"
|
#include "gui/gxs/GxsIdChooser.h"
|
||||||
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
|
|
||||||
#include <retroshare/rsnotify.h>
|
#include <retroshare/rsnotify.h>
|
||||||
@ -394,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,GxsIdDetails::ICON_TYPE_AVATAR);
|
||||||
widgetitem->setId(it2->first,COLUMN_NAME, true) ;
|
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)));
|
||||||
|
@ -869,10 +869,12 @@ QString nickname = details.mNickname.empty()?tr("[Unknown]"):QString::fromUtf8(d
|
|||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icons)
|
void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icons,uint32_t icon_types)
|
||||||
{
|
{
|
||||||
QPixmap pix ;
|
QPixmap pix ;
|
||||||
|
|
||||||
|
if(icon_types & ICON_TYPE_AVATAR)
|
||||||
|
{
|
||||||
if(details.mAvatar.mSize == 0 || !pix.loadFromData(details.mAvatar.mData, details.mAvatar.mSize, "PNG"))
|
if(details.mAvatar.mSize == 0 || !pix.loadFromData(details.mAvatar.mData, details.mAvatar.mSize, "PNG"))
|
||||||
#if QT_VERSION < 0x040700
|
#if QT_VERSION < 0x040700
|
||||||
pix = QPixmap::fromImage(makeDefaultIcon(details.mId));
|
pix = QPixmap::fromImage(makeDefaultIcon(details.mId));
|
||||||
@ -884,7 +886,10 @@ void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icon
|
|||||||
QIcon idIcon(pix);
|
QIcon idIcon(pix);
|
||||||
//CreateIdIcon(id, idIcon);
|
//CreateIdIcon(id, idIcon);
|
||||||
icons.push_back(idIcon);
|
icons.push_back(idIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(icon_types & ICON_TYPE_PGP)
|
||||||
|
{
|
||||||
// ICON Logic.
|
// ICON Logic.
|
||||||
QIcon baseIcon;
|
QIcon baseIcon;
|
||||||
if (details.mPgpLinked)
|
if (details.mPgpLinked)
|
||||||
@ -898,6 +903,10 @@ void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icon
|
|||||||
baseIcon = QIcon(IMAGE_ANON);
|
baseIcon = QIcon(IMAGE_ANON);
|
||||||
|
|
||||||
icons.push_back(baseIcon);
|
icons.push_back(baseIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(icon_types & ICON_TYPE_RECOGN)
|
||||||
|
{
|
||||||
// Add In RecognTags Icons.
|
// Add In RecognTags Icons.
|
||||||
std::list<RsRecognTag>::const_iterator it;
|
std::list<RsRecognTag>::const_iterator it;
|
||||||
for (it = details.mRecognTags.begin(); it != details.mRecognTags.end(); ++it)
|
for (it = details.mRecognTags.begin(); it != details.mRecognTags.end(); ++it)
|
||||||
@ -908,6 +917,7 @@ void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icon
|
|||||||
icons.push_back(tagIcon);
|
icons.push_back(tagIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsIdDetails::GenerateCombinedPixmap(QPixmap &pixmap, const QList<QIcon> &icons, int iconSize)
|
void GxsIdDetails::GenerateCombinedPixmap(QPixmap &pixmap, const QList<QIcon> &icons, int iconSize)
|
||||||
|
@ -49,6 +49,11 @@ class GxsIdDetails : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static const int ICON_TYPE_AVATAR = 0x0001 ;
|
||||||
|
static const int ICON_TYPE_PGP = 0x0002 ;
|
||||||
|
static const int ICON_TYPE_RECOGN = 0x0004 ;
|
||||||
|
static const int ICON_TYPE_ALL = 0x0007 ;
|
||||||
|
|
||||||
GxsIdDetails();
|
GxsIdDetails();
|
||||||
virtual ~GxsIdDetails();
|
virtual ~GxsIdDetails();
|
||||||
|
|
||||||
@ -57,7 +62,7 @@ public:
|
|||||||
|
|
||||||
static QString getName(const RsIdentityDetails &details);
|
static QString getName(const RsIdentityDetails &details);
|
||||||
static QString getComment(const RsIdentityDetails &details);
|
static QString getComment(const RsIdentityDetails &details);
|
||||||
static void getIcons(const RsIdentityDetails &details, QList<QIcon> &icons);
|
static void getIcons(const RsIdentityDetails &details, QList<QIcon> &icons,uint32_t icon_types=ICON_TYPE_ALL);
|
||||||
|
|
||||||
static QString getEmptyIdText();
|
static QString getEmptyIdText();
|
||||||
static QString getLoadingText(const RsGxsId &id);
|
static QString getLoadingText(const RsGxsId &id);
|
||||||
|
@ -27,14 +27,14 @@
|
|||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
GxsIdRSTreeWidgetItem::GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidget *parent)
|
GxsIdRSTreeWidgetItem::GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, uint32_t icon_mask,QTreeWidget *parent)
|
||||||
: QObject(NULL), RSTreeWidgetItem(compareRole, parent), mColumn(0)
|
: QObject(NULL), RSTreeWidgetItem(compareRole, parent), mColumn(0), mIconTypeMask(icon_mask)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
GxsIdRSTreeWidgetItem::GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidgetItem *parent)
|
GxsIdRSTreeWidgetItem::GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, uint32_t icon_mask,QTreeWidgetItem *parent)
|
||||||
: QObject(NULL), RSTreeWidgetItem(compareRole, parent), mColumn(0)
|
: QObject(NULL), RSTreeWidgetItem(compareRole, parent), mColumn(0), mIconTypeMask(icon_mask)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ static void fillGxsIdRSTreeWidgetItemCallback(GxsIdDetailsType type, const RsIde
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GXS_ID_DETAILS_TYPE_DONE:
|
case GXS_ID_DETAILS_TYPE_DONE:
|
||||||
GxsIdDetails::getIcons(details, icons);
|
GxsIdDetails::getIcons(details, icons, item->iconTypeMask());
|
||||||
item->processResult(true);
|
item->processResult(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <retroshare/rsidentity.h>
|
#include <retroshare/rsidentity.h>
|
||||||
|
|
||||||
#include "gui/common/RSTreeWidgetItem.h"
|
#include "gui/common/RSTreeWidgetItem.h"
|
||||||
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
|
|
||||||
/*****
|
/*****
|
||||||
* NOTE: When the tree item is created within a thread you have to move the object
|
* NOTE: When the tree item is created within a thread you have to move the object
|
||||||
@ -39,15 +40,15 @@ class GxsIdRSTreeWidgetItem : public QObject, public RSTreeWidgetItem
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidget *parent = NULL);
|
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, uint32_t icon_mask=GxsIdDetails::ICON_TYPE_ALL,QTreeWidget *parent = NULL);
|
||||||
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidgetItem *parent);
|
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, uint32_t icon_mask,QTreeWidgetItem *parent);
|
||||||
|
|
||||||
void setId(const RsGxsId &id, int column, bool retryWhenFailed);
|
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);
|
void processResult(bool success);
|
||||||
|
uint32_t iconTypeMask() const { return mIconTypeMask ;}
|
||||||
private slots:
|
private slots:
|
||||||
void startProcess();
|
void startProcess();
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ private:
|
|||||||
int mColumn;
|
int mColumn;
|
||||||
bool mIdFound;
|
bool mIdFound;
|
||||||
bool mRetryWhenFailed;
|
bool mRetryWhenFailed;
|
||||||
|
uint32_t mIconTypeMask;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "gui/common/RSItemDelegate.h"
|
#include "gui/common/RSItemDelegate.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||||
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
#include "CreateGxsForumMsg.h"
|
#include "CreateGxsForumMsg.h"
|
||||||
#include "gui/msgs/MessageComposer.h"
|
#include "gui/msgs/MessageComposer.h"
|
||||||
@ -810,7 +811,7 @@ void GxsForumThreadWidget::fillThreadStatus(QString text)
|
|||||||
|
|
||||||
QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn)
|
QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn)
|
||||||
{
|
{
|
||||||
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole);
|
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole,GxsIdDetails::ICON_TYPE_ALL);
|
||||||
item->moveToThread(ui->threadTreeWidget->thread());
|
item->moveToThread(ui->threadTreeWidget->thread());
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
@ -893,7 +894,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
|
|||||||
|
|
||||||
QTreeWidgetItem *GxsForumThreadWidget::generateMissingItem(const RsGxsMessageId &msgId)
|
QTreeWidgetItem *GxsForumThreadWidget::generateMissingItem(const RsGxsMessageId &msgId)
|
||||||
{
|
{
|
||||||
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole);
|
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole,GxsIdDetails::ICON_TYPE_ALL);
|
||||||
item->setText(COLUMN_THREAD_TITLE, tr("[ ... Missing Message ... ]"));
|
item->setText(COLUMN_THREAD_TITLE, tr("[ ... Missing Message ... ]"));
|
||||||
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msgId.toStdString()));
|
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msgId.toStdString()));
|
||||||
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING, true);
|
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user