mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-27 07:47:03 -05:00
bypass useless avatar dialog when choosing own avatar
This commit is contained in:
parent
6e7a86058d
commit
74b8ed0633
@ -145,17 +145,14 @@
|
|||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" rowspan="2">
|
<item row="0" column="0" rowspan="2">
|
||||||
<widget class="AvatarWidget" name="avatar">
|
<widget class="AvatarWidget" name="avatar">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||||
<width>61</width>
|
<horstretch>0</horstretch>
|
||||||
<height>61</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="scaledContents">
|
||||||
<size>
|
<bool>false</bool>
|
||||||
<width>61</width>
|
|
||||||
<height>61</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -18,12 +18,15 @@
|
|||||||
* *
|
* *
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <QBuffer>
|
||||||
|
|
||||||
#include <rshare.h>
|
#include <rshare.h>
|
||||||
#include <retroshare/rsstatus.h>
|
#include <retroshare/rsstatus.h>
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
|
|
||||||
#include "gui/notifyqt.h"
|
#include "gui/notifyqt.h"
|
||||||
|
#include "util/misc.h"
|
||||||
#include "gui/common/AvatarDefs.h"
|
#include "gui/common/AvatarDefs.h"
|
||||||
#include "gui/common/AvatarDialog.h"
|
#include "gui/common/AvatarDialog.h"
|
||||||
|
|
||||||
@ -85,19 +88,33 @@ void AvatarWidget::mouseReleaseEvent(QMouseEvent */*event*/)
|
|||||||
if (!mFlag.isOwnId) {
|
if (!mFlag.isOwnId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Choose avatar"), AvatarDialog::RS_AVATAR_DEFAULT_IMAGE_W,AvatarDialog::RS_AVATAR_DEFAULT_IMAGE_H);
|
||||||
|
|
||||||
AvatarDialog dialog(this);
|
if (img.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
QPixmap avatar;
|
setPixmap(img);
|
||||||
AvatarDefs::getOwnAvatar(avatar, "");
|
|
||||||
|
|
||||||
dialog.setAvatar(avatar);
|
QByteArray data;
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
QBuffer buffer(&data);
|
||||||
QByteArray newAvatar;
|
|
||||||
dialog.getAvatar(newAvatar);
|
|
||||||
|
|
||||||
rsMsgs->setOwnAvatarData((unsigned char *)(newAvatar.data()), newAvatar.size()) ; // last char 0 included.
|
buffer.open(QIODevice::WriteOnly);
|
||||||
}
|
img.save(&buffer, "PNG"); // writes image into a in PNG format
|
||||||
|
|
||||||
|
rsMsgs->setOwnAvatarData((unsigned char *)(data.data()), data.size()) ; // last char 0 included.
|
||||||
|
|
||||||
|
// AvatarDialog dialog(this);
|
||||||
|
//
|
||||||
|
// QPixmap avatar;
|
||||||
|
// AvatarDefs::getOwnAvatar(avatar, "");
|
||||||
|
//
|
||||||
|
// dialog.setAvatar(avatar);
|
||||||
|
// if (dialog.exec() == QDialog::Accepted) {
|
||||||
|
// QByteArray newAvatar;
|
||||||
|
// dialog.getAvatar(newAvatar);
|
||||||
|
//
|
||||||
|
// rsMsgs->setOwnAvatarData((unsigned char *)(newAvatar.data()), newAvatar.size()) ; // last char 0 included.
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarWidget::setFrameType(FrameType type)
|
void AvatarWidget::setFrameType(FrameType type)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user