mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
fixed update of identity list when avatar is changed and changed avatar to use ZoomableLabel
This commit is contained in:
parent
5d805e3798
commit
ddc0a8c1ec
@ -644,6 +644,7 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
case RsGxsNotify::TYPE_PROCESSED: break ; // Happens when the group is subscribed. This is triggered by RsGenExchange::subscribeToGroup, so better not
|
||||
// call it again from here!!
|
||||
|
||||
case RsGxsNotify::TYPE_UPDATED:
|
||||
case RsGxsNotify::TYPE_PUBLISHED:
|
||||
{
|
||||
auto ev = std::make_shared<RsGxsIdentityEvent>();
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QMessageBox>
|
||||
#include <QToolTip>
|
||||
|
||||
#include "IdEditDialog.h"
|
||||
#include "ui_IdEditDialog.h"
|
||||
@ -100,6 +101,7 @@ IdEditDialog::~IdEditDialog() {}
|
||||
|
||||
void IdEditDialog::changeAvatar()
|
||||
{
|
||||
#ifdef TODO
|
||||
AvatarDialog dialog(this);
|
||||
|
||||
dialog.setAvatar(mAvatar);
|
||||
@ -109,6 +111,23 @@ void IdEditDialog::changeAvatar()
|
||||
|
||||
setAvatar(newAvatar);
|
||||
}
|
||||
#endif
|
||||
// For now we use a simpler method since AvatarDialog is not finished yet; we use the thumbnail viewer to allow the user to
|
||||
// select a proper scale/crop of a given image to make his/her avatar.
|
||||
|
||||
QString image_filename ;
|
||||
|
||||
if(!misc::getOpenFileName(this,RshareSettings::LASTDIR_IMAGES,tr("Import image"), tr("Image files (*.jpg *.png);;All files (*)"),image_filename))
|
||||
return;
|
||||
|
||||
QImage img(image_filename);
|
||||
|
||||
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."));
|
||||
|
||||
// shows the tooltip for a while
|
||||
QToolTip::showText( ui->avatarLabel->mapToGlobal( QPoint( 0, 0 ) ), ui->avatarLabel->toolTip() );
|
||||
}
|
||||
|
||||
void IdEditDialog::setupNewId(bool pseudo,bool enable_anon)
|
||||
@ -598,6 +617,8 @@ void IdEditDialog::updateId()
|
||||
|
||||
mEditGroup.mMeta.mGroupName = groupname.toUtf8().constData();
|
||||
|
||||
mAvatar = ui->avatarLabel->extractCroppedScaledPicture();
|
||||
|
||||
if (!mAvatar.isNull())
|
||||
{
|
||||
QByteArray ba;
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>542</width>
|
||||
<height>536</height>
|
||||
<width>593</width>
|
||||
<height>604</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -291,7 +291,7 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="avatarVLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="avatarLabel">
|
||||
<widget class="ZoomableLabel" name="avatarLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -330,7 +330,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="avatarButton">
|
||||
<property name="text">
|
||||
<string>Set Avatar</string>
|
||||
<string>Choose image...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -529,9 +529,13 @@
|
||||
<header>gui/common/HeaderFrame.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ZoomableLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
|
Loading…
Reference in New Issue
Block a user