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:
thunder2 2011-09-02 10:22:44 +00:00
parent 0591ef0432
commit b35d32ef15
19 changed files with 282 additions and 248 deletions

View file

@ -32,11 +32,14 @@
#include <retroshare/rspeers.h>
#include <retroshare/rsdisc.h>
#include <retroshare/rsmsgs.h>
#include "gui/help/browser/helpbrowser.h"
#include "gui/common/PeerDefs.h"
#include "gui/common/StatusDefs.h"
#include "gui/RetroShareLink.h"
#include "gui/notifyqt.h"
#include "gui/common/AvatarDefs.h"
#ifndef MINIMAL_RSGUI
#include "gui/MainWindow.h"
@ -76,6 +79,10 @@ ConfCertDialog::ConfCertDialog(const std::string& id, QWidget *parent, Qt::WFlag
connect(ui.signKeyButton, SIGNAL(clicked()), this, SLOT(signGPGKey()));
connect(ui.trusthelpButton, SIGNAL(clicked()), this, SLOT(showHelpDialog()));
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updatePeersAvatar(const QString&)));
isOnlyGpg = false;
#ifndef MINIMAL_RSGUI
MainWindow *w = MainWindow::getInstance();
if (w) {
@ -136,6 +143,8 @@ void ConfCertDialog::load()
return;
}
isOnlyGpg = detail.isOnlyGPGdetail;
ui.name->setText(QString::fromUtf8(detail.name.c_str()));
ui.peerid->setText(QString::fromStdString(detail.id));
@ -326,6 +335,8 @@ void ConfCertDialog::load()
font.setStyle(QFont::StyleNormal);
ui.userCertificateText->setFont(font);
ui.userCertificateText->setText(QString::fromUtf8(invite.c_str()));
updatePeersAvatar(QString::fromStdString(mId));
}
@ -439,3 +450,20 @@ void ConfCertDialog::showHelpDialog(const QString &topic)
helpBrowser = new HelpBrowser(this);
helpBrowser->showWindow(topic);
}
void ConfCertDialog::updatePeersAvatar(const QString& peer_id)
{
if (isOnlyGpg) {
QPixmap avatar;
AvatarDefs::getAvatarFromGpgId(mId, avatar);
ui.AvatarLabel->setPixmap(avatar);
return;
}
if (mId == peer_id.toStdString()) {
QPixmap avatar;
AvatarDefs::getAvatarFromSslId(mId, avatar);
ui.AvatarLabel->setPixmap(avatar);
}
}