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/RSItemDelegate.h"
|
||||
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "util/DateTime.h"
|
||||
#include "util/RsProtectedTimer.h"
|
||||
#include "util/QtVersion.h"
|
||||
@ -1058,7 +1059,7 @@ void MessagesDialog::insertMessages()
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
item = new GxsIdRSTreeWidgetItem(mMessageCompareRole);
|
||||
item = new GxsIdRSTreeWidgetItem(mMessageCompareRole,GxsIdDetails::ICON_TYPE_AVATAR);
|
||||
insertItem = true;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "gui/common/FriendSelectionDialog.h"
|
||||
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||
#include "gui/gxs/GxsIdChooser.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "util/HandleRichText.h"
|
||||
|
||||
#include <retroshare/rsnotify.h>
|
||||
@ -394,7 +395,7 @@ void ChatLobbyDialog::updateParticipantsList()
|
||||
{
|
||||
// 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->setText(COLUMN_NAME, participant);
|
||||
widgetitem->setText(COLUMN_ACTIVITY,QString::number(time(NULL)));
|
||||
|
@ -869,10 +869,12 @@ QString nickname = details.mNickname.empty()?tr("[Unknown]"):QString::fromUtf8(d
|
||||
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 ;
|
||||
|
||||
if(icon_types & ICON_TYPE_AVATAR)
|
||||
{
|
||||
if(details.mAvatar.mSize == 0 || !pix.loadFromData(details.mAvatar.mData, details.mAvatar.mSize, "PNG"))
|
||||
#if QT_VERSION < 0x040700
|
||||
pix = QPixmap::fromImage(makeDefaultIcon(details.mId));
|
||||
@ -884,7 +886,10 @@ void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icon
|
||||
QIcon idIcon(pix);
|
||||
//CreateIdIcon(id, idIcon);
|
||||
icons.push_back(idIcon);
|
||||
}
|
||||
|
||||
if(icon_types & ICON_TYPE_PGP)
|
||||
{
|
||||
// ICON Logic.
|
||||
QIcon baseIcon;
|
||||
if (details.mPgpLinked)
|
||||
@ -898,6 +903,10 @@ void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icon
|
||||
baseIcon = QIcon(IMAGE_ANON);
|
||||
|
||||
icons.push_back(baseIcon);
|
||||
}
|
||||
|
||||
if(icon_types & ICON_TYPE_RECOGN)
|
||||
{
|
||||
// Add In RecognTags Icons.
|
||||
std::list<RsRecognTag>::const_iterator 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GxsIdDetails::GenerateCombinedPixmap(QPixmap &pixmap, const QList<QIcon> &icons, int iconSize)
|
||||
|
@ -49,6 +49,11 @@ class GxsIdDetails : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
virtual ~GxsIdDetails();
|
||||
|
||||
@ -57,7 +62,7 @@ public:
|
||||
|
||||
static QString getName(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 getLoadingText(const RsGxsId &id);
|
||||
|
@ -27,14 +27,14 @@
|
||||
#include "util/HandleRichText.h"
|
||||
|
||||
/** Constructor */
|
||||
GxsIdRSTreeWidgetItem::GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidget *parent)
|
||||
: QObject(NULL), RSTreeWidgetItem(compareRole, parent), mColumn(0)
|
||||
GxsIdRSTreeWidgetItem::GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, uint32_t icon_mask,QTreeWidget *parent)
|
||||
: QObject(NULL), RSTreeWidgetItem(compareRole, parent), mColumn(0), mIconTypeMask(icon_mask)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
GxsIdRSTreeWidgetItem::GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidgetItem *parent)
|
||||
: QObject(NULL), RSTreeWidgetItem(compareRole, parent), mColumn(0)
|
||||
GxsIdRSTreeWidgetItem::GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, uint32_t icon_mask,QTreeWidgetItem *parent)
|
||||
: QObject(NULL), RSTreeWidgetItem(compareRole, parent), mColumn(0), mIconTypeMask(icon_mask)
|
||||
{
|
||||
init();
|
||||
}
|
||||
@ -69,7 +69,7 @@ static void fillGxsIdRSTreeWidgetItemCallback(GxsIdDetailsType type, const RsIde
|
||||
break;
|
||||
|
||||
case GXS_ID_DETAILS_TYPE_DONE:
|
||||
GxsIdDetails::getIcons(details, icons);
|
||||
GxsIdDetails::getIcons(details, icons, item->iconTypeMask());
|
||||
item->processResult(true);
|
||||
break;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <retroshare/rsidentity.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
|
||||
@ -39,15 +40,15 @@ class GxsIdRSTreeWidgetItem : public QObject, public RSTreeWidgetItem
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidget *parent = NULL);
|
||||
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidgetItem *parent);
|
||||
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, uint32_t icon_mask=GxsIdDetails::ICON_TYPE_ALL,QTreeWidget *parent = NULL);
|
||||
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, uint32_t icon_mask,QTreeWidgetItem *parent);
|
||||
|
||||
void setId(const RsGxsId &id, int column, bool retryWhenFailed);
|
||||
bool getId(RsGxsId &id);
|
||||
|
||||
int idColumn() { return mColumn; }
|
||||
void processResult(bool success);
|
||||
|
||||
uint32_t iconTypeMask() const { return mIconTypeMask ;}
|
||||
private slots:
|
||||
void startProcess();
|
||||
|
||||
@ -58,6 +59,7 @@ private:
|
||||
int mColumn;
|
||||
bool mIdFound;
|
||||
bool mRetryWhenFailed;
|
||||
uint32_t mIconTypeMask;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "gui/common/RSItemDelegate.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "CreateGxsForumMsg.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)
|
||||
{
|
||||
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole);
|
||||
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole,GxsIdDetails::ICON_TYPE_ALL);
|
||||
item->moveToThread(ui->threadTreeWidget->thread());
|
||||
|
||||
QString text;
|
||||
@ -893,7 +894,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
|
||||
|
||||
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->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msgId.toStdString()));
|
||||
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING, true);
|
||||
|
Loading…
Reference in New Issue
Block a user