mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 05:22:31 -04:00
Added avatar image to ConfCertDialog (defnax).
Added new class AvatarDefs to get the avatar for a ssl id or gpg id. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4585 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0591ef0432
commit
b35d32ef15
19 changed files with 282 additions and 248 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "../RsAutoUpdatePage.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
#include "gui/chat/HandleRichText.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
|
@ -228,25 +229,10 @@ void ChatMsgItem::updateAvatar(const QString &peer_id)
|
|||
return;
|
||||
}
|
||||
|
||||
unsigned char *data = NULL;
|
||||
int size = 0 ;
|
||||
|
||||
rsMsgs->getAvatarData(mPeerId,data,size);
|
||||
|
||||
if(size != 0)
|
||||
{
|
||||
// set the image
|
||||
QPixmap pix ;
|
||||
pix.loadFromData(data,size,"PNG") ;
|
||||
avatar_label->setPixmap(pix);
|
||||
delete[] data ;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
avatar_label->setPixmap(QPixmap(":/images/user/personal64.png"));
|
||||
}
|
||||
}
|
||||
QPixmap avatar;
|
||||
AvatarDefs::getAvatarFromSslId(mPeerId, avatar, ":/images/user/personal64.png");
|
||||
avatar_label->setPixmap(avatar);
|
||||
}
|
||||
|
||||
void ChatMsgItem::togglequickmessage()
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "gui/forums/CreateForumMsg.h"
|
||||
#include "gui/chat/HandleRichText.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -429,46 +430,26 @@ void ForumMsgItem::updateAvatar(const QString &peer_id)
|
|||
void ForumMsgItem::showAvatar(const std::string &peer_id, bool next)
|
||||
{
|
||||
std::string gpgId = next ? mGpgIdNext : mGpgIdPrev;
|
||||
QLabel *avatar = next ? nextavatarlabel : avatarlabel;
|
||||
QLabel *avatarLabel = next ? nextavatarlabel : avatarlabel;
|
||||
|
||||
if (gpgId.empty()) {
|
||||
avatar->setPixmap(QPixmap(":/images/user/personal64.png"));
|
||||
avatarLabel->setPixmap(QPixmap(":/images/user/personal64.png"));
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char *data = NULL;
|
||||
int size = 0 ;
|
||||
QPixmap avatar;
|
||||
|
||||
if (gpgId == rsPeers->getGPGOwnId()) {
|
||||
/* Its me */
|
||||
rsMsgs->getOwnAvatarData(data,size);
|
||||
AvatarDefs::getOwnAvatar(avatar, ":/images/user/personal64.png");
|
||||
} else {
|
||||
if (peer_id.empty()) {
|
||||
/* Show the first available avatar of one of the ssl ids */
|
||||
std::list<std::string> sslIds;
|
||||
if (rsPeers->getAssociatedSSLIds(gpgId, sslIds) == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<std::string>::iterator sslId;
|
||||
for (sslId = sslIds.begin(); sslId != sslIds.end(); sslId++) {
|
||||
rsMsgs->getAvatarData(*sslId,data,size);
|
||||
if (size) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
AvatarDefs::getAvatarFromGpgId(gpgId, avatar, ":/images/user/personal64.png");
|
||||
} else {
|
||||
rsMsgs->getAvatarData(peer_id,data,size);
|
||||
AvatarDefs::getAvatarFromSslId(peer_id, avatar, ":/images/user/personal64.png");
|
||||
}
|
||||
}
|
||||
|
||||
if(size != 0) {
|
||||
// set the image
|
||||
QPixmap pix ;
|
||||
pix.loadFromData(data,size,"PNG") ;
|
||||
avatar->setPixmap(pix);
|
||||
delete[] data ;
|
||||
} else {
|
||||
avatar->setPixmap(QPixmap(":/images/user/personal64.png"));
|
||||
}
|
||||
avatarLabel->setPixmap(avatar);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "SubFileItem.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
#include "gui/chat/HandleRichText.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "gui/notifyqt.h"
|
||||
|
||||
#include <retroshare/rsmsgs.h>
|
||||
|
@ -283,23 +284,8 @@ void MsgItem::updateAvatar(const QString &peer_id)
|
|||
return;
|
||||
}
|
||||
|
||||
unsigned char *data = NULL;
|
||||
int size = 0 ;
|
||||
|
||||
rsMsgs->getAvatarData(mPeerId,data,size);
|
||||
|
||||
if(size != 0)
|
||||
{
|
||||
// set the image
|
||||
QPixmap pix ;
|
||||
pix.loadFromData(data,size,"PNG") ;
|
||||
avatarlabel->setPixmap(pix);
|
||||
delete[] data ;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
avatarlabel->setPixmap(QPixmap(":/images/user/personal64.png"));
|
||||
}
|
||||
}
|
||||
QPixmap avatar;
|
||||
AvatarDefs::getAvatarFromSslId(mPeerId, avatar, ":/images/user/personal64.png");
|
||||
avatarlabel->setPixmap(avatar);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "../RsAutoUpdatePage.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
#include "gui/common/StatusDefs.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
|
||||
|
@ -315,24 +316,10 @@ void PeerItem::updateAvatar(const QString &peer_id)
|
|||
return;
|
||||
}
|
||||
|
||||
unsigned char *data = NULL;
|
||||
int size = 0 ;
|
||||
|
||||
rsMsgs->getAvatarData(mPeerId,data,size);
|
||||
|
||||
if(size != 0)
|
||||
{
|
||||
// set the image
|
||||
QPixmap pix ;
|
||||
pix.loadFromData(data,size,"PNG") ;
|
||||
avatar_label->setPixmap(pix);
|
||||
delete[] data ;
|
||||
}
|
||||
else
|
||||
{
|
||||
avatar_label->setPixmap(QPixmap(":/images/user/personal64.png"));
|
||||
}
|
||||
}
|
||||
QPixmap avatar;
|
||||
AvatarDefs::getAvatarFromSslId(mPeerId, avatar, ":/images/user/personal64.png");
|
||||
avatar_label->setPixmap(avatar);
|
||||
}
|
||||
|
||||
void PeerItem::togglequickmessage()
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "gui/msgs/MessageComposer.h"
|
||||
#include "gui/common/StatusDefs.h"
|
||||
#include "gui/connect/ConfCertDialog.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
|
||||
|
@ -385,23 +386,9 @@ void SecurityItem::updateAvatar(const QString &peer_id)
|
|||
return;
|
||||
}
|
||||
|
||||
unsigned char *data = NULL;
|
||||
int size = 0 ;
|
||||
|
||||
rsMsgs->getAvatarData(mSslId, data, size);
|
||||
|
||||
if(size != 0)
|
||||
{
|
||||
// set the image
|
||||
QPixmap pix ;
|
||||
pix.loadFromData(data,size,"PNG") ;
|
||||
avatar_label->setPixmap(pix);
|
||||
delete[] data ;
|
||||
}
|
||||
else
|
||||
{
|
||||
avatar_label->setPixmap(QPixmap(":/images/user/personal64.png"));
|
||||
}
|
||||
QPixmap avatar;
|
||||
AvatarDefs::getAvatarFromSslId(mSslId, avatar, ":/images/user/personal64.png");
|
||||
avatar_label->setPixmap(avatar);
|
||||
}
|
||||
|
||||
void SecurityItem::togglequickmessage()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue