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))
|
ui(new(Ui::IdEditDialog))
|
||||||
{
|
{
|
||||||
mIsNew = true;
|
mIsNew = true;
|
||||||
|
mAvatarIsSet = false;
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
@ -126,6 +127,7 @@ void IdEditDialog::changeAvatar()
|
|||||||
ui->avatarLabel->setPicture(QPixmap::fromImage(img));
|
ui->avatarLabel->setPicture(QPixmap::fromImage(img));
|
||||||
ui->avatarLabel->setEnableZoom(true);
|
ui->avatarLabel->setEnableZoom(true);
|
||||||
ui->avatarLabel->setToolTip(tr("Use the mouse to zoom and adjust the image for your avatar."));
|
ui->avatarLabel->setToolTip(tr("Use the mouse to zoom and adjust the image for your avatar."));
|
||||||
|
mAvatarIsSet = true;
|
||||||
|
|
||||||
// shows the tooltip for a while
|
// shows the tooltip for a while
|
||||||
QToolTip::showText( ui->avatarLabel->mapToGlobal( QPoint( 0, 0 ) ), ui->avatarLabel->toolTip() );
|
QToolTip::showText( ui->avatarLabel->mapToGlobal( QPoint( 0, 0 ) ), ui->avatarLabel->toolTip() );
|
||||||
@ -211,10 +213,12 @@ void IdEditDialog::setAvatar(const QPixmap &avatar)
|
|||||||
|
|
||||||
if (!mAvatar.isNull()) {
|
if (!mAvatar.isNull()) {
|
||||||
ui->avatarLabel->setPicture(avatar);
|
ui->avatarLabel->setPicture(avatar);
|
||||||
|
mAvatarIsSet = true;
|
||||||
} else {
|
} else {
|
||||||
// we need to use the default pixmap here, generated from the ID
|
// 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)
|
void IdEditDialog::setupExistingId(const RsGxsGroupId& keyId)
|
||||||
@ -517,13 +521,9 @@ void IdEditDialog::loadRecognTags()
|
|||||||
void IdEditDialog::submit()
|
void IdEditDialog::submit()
|
||||||
{
|
{
|
||||||
if (mIsNew)
|
if (mIsNew)
|
||||||
{
|
|
||||||
createId();
|
createId();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
updateId();
|
updateId();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdEditDialog::createId()
|
void IdEditDialog::createId()
|
||||||
@ -551,10 +551,10 @@ void IdEditDialog::createId()
|
|||||||
params.nickname = groupname.toUtf8().constData();
|
params.nickname = groupname.toUtf8().constData();
|
||||||
params.isPgpLinked = (ui->radioButton_GpgId->isChecked());
|
params.isPgpLinked = (ui->radioButton_GpgId->isChecked());
|
||||||
|
|
||||||
mAvatar = ui->avatarLabel->extractCroppedScaledPicture();
|
if(mAvatarIsSet)
|
||||||
|
|
||||||
if (!mAvatar.isNull())
|
|
||||||
{
|
{
|
||||||
|
mAvatar = ui->avatarLabel->extractCroppedScaledPicture();
|
||||||
|
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
QBuffer buffer(&ba);
|
QBuffer buffer(&ba);
|
||||||
|
|
||||||
|
@ -84,6 +84,7 @@ protected:
|
|||||||
RsGxsGroupId mGroupId;
|
RsGxsGroupId mGroupId;
|
||||||
|
|
||||||
QPixmap mAvatar; // Avatar from identity (not calculated)
|
QPixmap mAvatar; // Avatar from identity (not calculated)
|
||||||
|
bool mAvatarIsSet;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user