mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
fixed use of no avatar instead of default avatar image when creating a new ID
This commit is contained in:
parent
fae6314374
commit
5274a060e5
@ -46,6 +46,7 @@ IdEditDialog::IdEditDialog(QWidget *parent) :
|
||||
ui(new(Ui::IdEditDialog))
|
||||
{
|
||||
mIsNew = true;
|
||||
mAvatarIsSet = false;
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -126,6 +127,7 @@ void IdEditDialog::changeAvatar()
|
||||
ui->avatarLabel->setPicture(QPixmap::fromImage(img));
|
||||
ui->avatarLabel->setEnableZoom(true);
|
||||
ui->avatarLabel->setToolTip(tr("Use the mouse to zoom and adjust the image for your avatar."));
|
||||
mAvatarIsSet = true;
|
||||
|
||||
// shows the tooltip for a while
|
||||
QToolTip::showText( ui->avatarLabel->mapToGlobal( QPoint( 0, 0 ) ), ui->avatarLabel->toolTip() );
|
||||
@ -211,9 +213,11 @@ void IdEditDialog::setAvatar(const QPixmap &avatar)
|
||||
|
||||
if (!mAvatar.isNull()) {
|
||||
ui->avatarLabel->setPicture(avatar);
|
||||
mAvatarIsSet = true;
|
||||
} else {
|
||||
// we need to use the default pixmap here, generated from the ID
|
||||
ui->avatarLabel->setPicture(GxsIdDetails::makeDefaultIcon(RsGxsId(mEditGroup.mMeta.mGroupId)));
|
||||
ui->avatarLabel->setText(tr("No avatar chosen\ndefault will\nbe used"));
|
||||
mAvatarIsSet = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,13 +521,9 @@ void IdEditDialog::loadRecognTags()
|
||||
void IdEditDialog::submit()
|
||||
{
|
||||
if (mIsNew)
|
||||
{
|
||||
createId();
|
||||
}
|
||||
else
|
||||
{
|
||||
updateId();
|
||||
}
|
||||
}
|
||||
|
||||
void IdEditDialog::createId()
|
||||
@ -551,10 +551,10 @@ void IdEditDialog::createId()
|
||||
params.nickname = groupname.toUtf8().constData();
|
||||
params.isPgpLinked = (ui->radioButton_GpgId->isChecked());
|
||||
|
||||
if(mAvatarIsSet)
|
||||
{
|
||||
mAvatar = ui->avatarLabel->extractCroppedScaledPicture();
|
||||
|
||||
if (!mAvatar.isNull())
|
||||
{
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
|
@ -84,6 +84,7 @@ protected:
|
||||
RsGxsGroupId mGroupId;
|
||||
|
||||
QPixmap mAvatar; // Avatar from identity (not calculated)
|
||||
bool mAvatarIsSet;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user