Enabled to display identity icons for Distant peers on Message Composer and on Friend Selection Widget

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7811 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2014-12-30 23:14:34 +00:00
parent 57640379a8
commit d26ea4a642
2 changed files with 15 additions and 9 deletions

View File

@ -23,6 +23,7 @@
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include "FriendSelectionWidget.h" #include "FriendSelectionWidget.h"
#include "ui_FriendSelectionWidget.h" #include "ui_FriendSelectionWidget.h"
#include "gui/gxs/GxsIdDetails.h"
#include <retroshare-gui/RsAutoUpdatePage.h> #include <retroshare-gui/RsAutoUpdatePage.h>
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
#include "gui/common/RSTreeWidgetItem.h" #include "gui/common/RSTreeWidgetItem.h"
@ -526,6 +527,8 @@ void FriendSelectionWidget::secured_fillList()
RsIdentityDetails detail; RsIdentityDetails detail;
if (!rsIdentity->getIdDetails(RsGxsId(*gxsIt), detail)) if (!rsIdentity->getIdDetails(RsGxsId(*gxsIt), detail))
continue; /* BAD */ continue; /* BAD */
QPixmap identicon = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(*gxsIt))) ;
// make a widget per friend // make a widget per friend
gxsItem = new RSTreeWidgetItem(mCompareRole, IDTYPE_GXS); gxsItem = new RSTreeWidgetItem(mCompareRole, IDTYPE_GXS);
@ -533,9 +536,9 @@ void FriendSelectionWidget::secured_fillList()
QString name = QString::fromUtf8(detail.mNickname.c_str()); QString name = QString::fromUtf8(detail.mNickname.c_str());
gxsItem->setText(COLUMN_NAME, name + " ("+QString::fromStdString( (*gxsIt).toStdString() )+")"); gxsItem->setText(COLUMN_NAME, name + " ("+QString::fromStdString( (*gxsIt).toStdString() )+")");
gxsItem->setTextColor(COLUMN_NAME, textColorOnline()); //gxsItem->setTextColor(COLUMN_NAME, textColorOnline());
gxsItem->setFlags(Qt::ItemIsUserCheckable | gxsItem->flags()); gxsItem->setFlags(Qt::ItemIsUserCheckable | gxsItem->flags());
gxsItem->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(RS_STATUS_ONLINE))); gxsItem->setIcon(COLUMN_NAME, QIcon(identicon));
gxsItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.mId.toStdString())); gxsItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.mId.toStdString()));
gxsItem->setData(COLUMN_DATA, ROLE_SORT, "2 " + name); gxsItem->setData(COLUMN_DATA, ROLE_SORT, "2 " + name);

View File

@ -51,17 +51,18 @@
#include "gui/common/GroupDefs.h" #include "gui/common/GroupDefs.h"
#include "gui/common/StatusDefs.h" #include "gui/common/StatusDefs.h"
#include "gui/common/PeerDefs.h" #include "gui/common/PeerDefs.h"
#include "gui/common/TagDefs.h"
#include "gui/common/Emoticons.h"
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/common/Emoticons.h" #include "gui/connect/ConfCertDialog.h"
#include "textformat.h" #include "gui/gxs/GxsIdDetails.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/DateTime.h" #include "util/DateTime.h"
#include "TagsMenu.h"
#include "gui/common/TagDefs.h"
#include "gui/connect/ConfCertDialog.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/QtVersion.h" #include "util/QtVersion.h"
#include "textformat.h"
#include "TagsMenu.h"
#define IMAGE_GROUP16 ":/images/user/group16.png" #define IMAGE_GROUP16 ":/images/user/group16.png"
#define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png" #define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png"
@ -1444,16 +1445,18 @@ void MessageComposer::setRecipientToRow(int row, enumType type, destinationType
case PEER_TYPE_GXS: { case PEER_TYPE_GXS: {
RsIdentityDetails detail; RsIdentityDetails detail;
RsGxsId gid(id) ; RsGxsId gid(id) ;
if(!rsIdentity->getIdDetails(gid, detail)) if(!rsIdentity->getIdDetails(gid, detail))
{ {
std::cerr << "Can't get peer details from " << gid << std::endl; std::cerr << "Can't get peer details from " << gid << std::endl;
return ; return ;
} }
QPixmap identicon = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(gid))) ;
name = tr("Distant peer (name: %2, PGP key: %1)").arg(QString::fromStdString(gid.toStdString())).arg(QString::fromUtf8(detail.mNickname.c_str())) ; name = tr("Distant peer (name: %2, PGP key: %1)").arg(QString::fromStdString(gid.toStdString())).arg(QString::fromUtf8(detail.mNickname.c_str())) ;
icon = QIcon(StatusDefs::imageUser(RS_STATUS_ONLINE)); icon = QIcon(identicon);
} }
break ; break ;