From b4a3d6748666a13227d7ad6425d190e9f78896cf Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 28 Mar 2021 13:26:49 +0200 Subject: [PATCH] fixed use of no avatar instead of default avatar image when creating a new ID --- .../src/gui/Identity/IdEditDialog.cpp | 18 +++++++++--------- retroshare-gui/src/gui/Identity/IdEditDialog.h | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/retroshare-gui/src/gui/Identity/IdEditDialog.cpp b/retroshare-gui/src/gui/Identity/IdEditDialog.cpp index 7f9f179cb..20e169306 100644 --- a/retroshare-gui/src/gui/Identity/IdEditDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdEditDialog.cpp @@ -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,10 +213,12 @@ 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; + } } void IdEditDialog::setupExistingId(const RsGxsGroupId& keyId) @@ -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()); - mAvatar = ui->avatarLabel->extractCroppedScaledPicture(); - - if (!mAvatar.isNull()) + if(mAvatarIsSet) { + mAvatar = ui->avatarLabel->extractCroppedScaledPicture(); + QByteArray ba; QBuffer buffer(&ba); diff --git a/retroshare-gui/src/gui/Identity/IdEditDialog.h b/retroshare-gui/src/gui/Identity/IdEditDialog.h index 36eed2891..f3d49601f 100644 --- a/retroshare-gui/src/gui/Identity/IdEditDialog.h +++ b/retroshare-gui/src/gui/Identity/IdEditDialog.h @@ -84,6 +84,7 @@ protected: RsGxsGroupId mGroupId; QPixmap mAvatar; // Avatar from identity (not calculated) + bool mAvatarIsSet; }; #endif