mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
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:
parent
ed228485d0
commit
53ab47cf4a
@ -19,7 +19,6 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
@ -163,7 +162,8 @@ void AvatarDialog::loadAvatarWidget()
|
|||||||
|
|
||||||
if(stickerTabs.count() == 0) {
|
if(stickerTabs.count() == 0) {
|
||||||
ui->nostickersLabel->setText("");
|
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);
|
ui->nostickersLabel->setText(message);
|
||||||
} else {
|
} else {
|
||||||
ui->infoframe->hide();
|
ui->infoframe->hide();
|
||||||
@ -243,7 +243,7 @@ void AvatarDialog::loadAvatarWidget()
|
|||||||
button->setFixedSize(QSize(buttonWidth, buttonHeight));
|
button->setFixedSize(QSize(buttonWidth, buttonHeight));
|
||||||
if(!iconcache.contains(fi.absoluteFilePath()))
|
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->setIcon(iconcache[fi.absoluteFilePath()]);
|
||||||
button->setToolTip(fi.fileName());
|
button->setToolTip(fi.fileName());
|
||||||
|
@ -88,33 +88,19 @@ 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);
|
|
||||||
|
|
||||||
if (img.isNull())
|
AvatarDialog dialog(this);
|
||||||
return;
|
|
||||||
|
|
||||||
setPixmap(img);
|
QPixmap avatar;
|
||||||
|
AvatarDefs::getOwnAvatar(avatar, "");
|
||||||
|
|
||||||
QByteArray data;
|
dialog.setAvatar(avatar);
|
||||||
QBuffer buffer(&data);
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
|
QByteArray newAvatar;
|
||||||
|
dialog.getAvatar(newAvatar);
|
||||||
|
|
||||||
buffer.open(QIODevice::WriteOnly);
|
rsMsgs->setOwnAvatarData((unsigned char *)(newAvatar.data()), newAvatar.size()) ; // last char 0 included.
|
||||||
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)
|
||||||
|
@ -18,6 +18,14 @@ HeaderFrame > QFrame#frame > QLabel#headerLabel {
|
|||||||
color: rgb(255, 255, 255);
|
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 */
|
||||||
|
|
||||||
GenCertDialog QLabel#genprofileinfo_label, QLabel#header_label, QLabel#entropy_label
|
GenCertDialog QLabel#genprofileinfo_label, QLabel#header_label, QLabel#entropy_label
|
||||||
|
Loading…
Reference in New Issue
Block a user