Added to use on AvatarWidget on click the Avatar Dialog

* Added to use the Avatar Dialog for the AvatarWidget too
* Fixed the info text
* Update stylesheet for the info frame
This commit is contained in:
defnax 2021-01-19 22:30:35 +01:00
parent ed228485d0
commit 53ab47cf4a
3 changed files with 20 additions and 26 deletions

View File

@ -19,7 +19,6 @@
*******************************************************************************/
#include <QBuffer>
#include <QDesktopWidget>
#include <QFile>
#include <QDir>
#include <QGridLayout>
@ -163,7 +162,8 @@ void AvatarDialog::loadAvatarWidget()
if(stickerTabs.count() == 0) {
ui->nostickersLabel->setText("");
QString message = "No stickers installed.\nYou can install them by putting images into one of these folders:\n" + stickerFolders.join('\n');
QString message = "No stickers installed.\nYou can install them by putting images into one of these folders:\n" /*+ stickerFolders.join('\n')*/;
message += "RetroShare/stickers\n RetroShare/Data/stickers\n RetroShare/Data/Location/stickers";
ui->nostickersLabel->setText(message);
} else {
ui->infoframe->hide();
@ -243,7 +243,7 @@ void AvatarDialog::loadAvatarWidget()
button->setFixedSize(QSize(buttonWidth, buttonHeight));
if(!iconcache.contains(fi.absoluteFilePath()))
{
iconcache.insert(fi.absoluteFilePath(), FilesDefs::getPixmapFromQtResourcePath(fi.absoluteFilePath()).scaled(buttonWidth, buttonHeight, Qt::KeepAspectRatio));
iconcache.insert(fi.absoluteFilePath(), FilesDefs::getPixmapFromQtResourcePath(fi.absoluteFilePath()).scaled(buttonWidth, buttonHeight, Qt::KeepAspectRatio));
}
button->setIcon(iconcache[fi.absoluteFilePath()]);
button->setToolTip(fi.fileName());

View File

@ -88,33 +88,19 @@ void AvatarWidget::mouseReleaseEvent(QMouseEvent */*event*/)
if (!mFlag.isOwnId) {
return;
}
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Choose avatar"), AvatarDialog::RS_AVATAR_DEFAULT_IMAGE_W,AvatarDialog::RS_AVATAR_DEFAULT_IMAGE_H);
if (img.isNull())
return;
AvatarDialog dialog(this);
setPixmap(img);
QPixmap avatar;
AvatarDefs::getOwnAvatar(avatar, "");
QByteArray data;
QBuffer buffer(&data);
dialog.setAvatar(avatar);
if (dialog.exec() == QDialog::Accepted) {
QByteArray newAvatar;
dialog.getAvatar(newAvatar);
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.
// }
rsMsgs->setOwnAvatarData((unsigned char *)(newAvatar.data()), newAvatar.size()) ; // last char 0 included.
}
}
void AvatarWidget::setFrameType(FrameType type)

View File

@ -18,6 +18,14 @@ HeaderFrame > QFrame#frame > QLabel#headerLabel {
color: rgb(255, 255, 255);
}
AvatarDialog QFrame#infoframe
{
border: 1px solid #DCDC41;
border-radius: 6px;
background: #FFFFD7;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
}
/* GenCertDialog */
GenCertDialog QLabel#genprofileinfo_label, QLabel#header_label, QLabel#entropy_label