mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #2385 from RetroShare/v0.6.6-Official-Release
Recent fixes to V0.6.6 official release
This commit is contained in:
commit
3f50f6f2d6
@ -46,6 +46,7 @@ IdEditDialog::IdEditDialog(QWidget *parent) :
|
||||
ui(new(Ui::IdEditDialog))
|
||||
{
|
||||
mIsNew = true;
|
||||
mAvatarIsSet = false;
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -88,6 +89,11 @@ IdEditDialog::IdEditDialog(QWidget *parent) :
|
||||
connect(ui->toolButton_Tag5, SIGNAL(clicked(bool)), this, SLOT(rmTag5()));
|
||||
connect(ui->avatarButton, SIGNAL(clicked(bool)), this, SLOT(changeAvatar()));
|
||||
|
||||
connect(ui->avatarLabel,SIGNAL(cleared()),this,SLOT(avatarCleared()));
|
||||
|
||||
ui->avatarLabel->setEnableClear(true);
|
||||
ui->avatarLabel->setToolTip(tr("No Avatar chosen. A default image will be automatically displayed from your new identity."));
|
||||
|
||||
/* Initialize ui */
|
||||
ui->lineEdit_Nickname->setMaxLength(RSID_MAXIMUM_NICKNAME_SIZE);
|
||||
|
||||
@ -125,7 +131,8 @@ void IdEditDialog::changeAvatar()
|
||||
|
||||
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."));
|
||||
ui->avatarLabel->setToolTip(tr("Use the mouse to zoom and adjust the image for your avatar. Hit Del to remove it."));
|
||||
mAvatarIsSet = true;
|
||||
|
||||
// shows the tooltip for a while
|
||||
QToolTip::showText( ui->avatarLabel->mapToGlobal( QPoint( 0, 0 ) ), ui->avatarLabel->toolTip() );
|
||||
@ -205,16 +212,25 @@ void IdEditDialog::updateIdType(bool pseudo)
|
||||
}
|
||||
}
|
||||
|
||||
void IdEditDialog::avatarCleared()
|
||||
{
|
||||
setAvatar(QPixmap());
|
||||
}
|
||||
|
||||
void IdEditDialog::setAvatar(const QPixmap &avatar)
|
||||
{
|
||||
mAvatar = avatar;
|
||||
|
||||
if (!mAvatar.isNull()) {
|
||||
ui->avatarLabel->setPicture(avatar);
|
||||
mAvatarIsSet = true;
|
||||
ui->avatarLabel->setToolTip(tr("Use the mouse to zoom and adjust the image for your avatar. Hit Del to remove it."));
|
||||
} else {
|
||||
// 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")); // This clears up the image
|
||||
mAvatarIsSet = false;
|
||||
ui->avatarLabel->setToolTip(tr("No Avatar chosen. A default image will be automatically displayed from your new identity."));
|
||||
}
|
||||
}
|
||||
|
||||
void IdEditDialog::setupExistingId(const RsGxsGroupId& keyId)
|
||||
@ -517,13 +533,9 @@ void IdEditDialog::loadRecognTags()
|
||||
void IdEditDialog::submit()
|
||||
{
|
||||
if (mIsNew)
|
||||
{
|
||||
createId();
|
||||
}
|
||||
else
|
||||
{
|
||||
updateId();
|
||||
}
|
||||
}
|
||||
|
||||
void IdEditDialog::createId()
|
||||
@ -551,10 +563,10 @@ void IdEditDialog::createId()
|
||||
params.nickname = groupname.toUtf8().constData();
|
||||
params.isPgpLinked = (ui->radioButton_GpgId->isChecked());
|
||||
|
||||
mAvatar = ui->avatarLabel->extractCroppedScaledPicture();
|
||||
|
||||
if (!mAvatar.isNull())
|
||||
if(mAvatarIsSet)
|
||||
{
|
||||
mAvatar = ui->avatarLabel->extractCroppedScaledPicture();
|
||||
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
private slots:
|
||||
void idTypeToggled(bool checked);
|
||||
void submit();
|
||||
void avatarCleared();
|
||||
|
||||
void changeAvatar();
|
||||
|
||||
@ -84,6 +85,7 @@ protected:
|
||||
RsGxsGroupId mGroupId;
|
||||
|
||||
QPixmap mAvatar; // Avatar from identity (not calculated)
|
||||
bool mAvatarIsSet;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -310,6 +310,9 @@
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
|
@ -403,7 +403,7 @@ void ChatWidget::init(const ChatId &chat_id, const QString &title)
|
||||
continue;
|
||||
|
||||
QString name;
|
||||
if (chatId.isLobbyId() || chatId.isDistantChatId() || chatId.isPeerId())
|
||||
if (!chatId.isNotSet())
|
||||
{
|
||||
RsIdentityDetails details;
|
||||
|
||||
|
@ -236,7 +236,8 @@ RsFriendListModel::EntryIndex RsFriendListModel::EntryIndex::parent() const
|
||||
i.node_index = UNDEFINED_NODE_INDEX_VALUE;
|
||||
break;
|
||||
case ENTRY_TYPE_UNKNOWN:
|
||||
RS_ERR("Unknown Entry type for parent.");
|
||||
//Can be when request root index.
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
|
@ -1104,7 +1104,7 @@ QString nickname ;
|
||||
nickname = QString::fromUtf8(details.mNickname.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE) ;
|
||||
|
||||
|
||||
comment = QString("%1:%2<br/>%3:%4").arg(QApplication::translate("GxsIdDetails", "Identity name"),
|
||||
comment = QString("%1: %2<br/>%3: %4").arg(QApplication::translate("GxsIdDetails", "Identity name"),
|
||||
nickname,
|
||||
QApplication::translate("GxsIdDetails", "Identity Id"),
|
||||
QString::fromStdString(details.mId.toStdString()));
|
||||
|
@ -169,8 +169,11 @@ QVariant GxsIdRSTreeWidgetItem::data(int column, int role) const
|
||||
|
||||
QString embeddedImage;
|
||||
|
||||
if ( RsHtml::makeEmbeddedImage( pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio, Qt::SmoothTransformation ).toImage(), embeddedImage, 8*S * 8*S ) )
|
||||
if ( RsHtml::makeEmbeddedImage( pix.scaled(QSize(5*S,5*S), Qt::KeepAspectRatio, Qt::SmoothTransformation ).toImage(), embeddedImage, -1 ) )
|
||||
{
|
||||
embeddedImage.insert(embeddedImage.indexOf("src="), "style=\"float:left\" ");
|
||||
t = "<table><tr><td>" + embeddedImage + "</td><td>" + t + "</td></table>";
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
@ -217,6 +217,25 @@ float ChannelPostThumbnailView::thumbnail_h() const
|
||||
}
|
||||
}
|
||||
|
||||
void ZoomableLabel::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
switch(e->key())
|
||||
{
|
||||
case Qt::Key_Delete:
|
||||
|
||||
if(mClearEnabled)
|
||||
{
|
||||
mFullImage = QPixmap();
|
||||
emit cleared();
|
||||
e->accept();
|
||||
updateView();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
QLabel::keyPressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void ZoomableLabel::reset()
|
||||
{
|
||||
mCenterX = mFullImage.width()/2.0;
|
||||
|
@ -40,18 +40,22 @@ class ZoomableLabel: public QLabel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ZoomableLabel(QWidget *parent): QLabel(parent),mUseStyleSheet(true),mZoomFactor(1.0),mCenterX(0.0),mCenterY(0.0),mZoomEnabled(true) {}
|
||||
ZoomableLabel(QWidget *parent): QLabel(parent),mUseStyleSheet(true),mZoomFactor(1.0),mCenterX(0.0),mCenterY(0.0),mZoomEnabled(true),mClearEnabled(false) {}
|
||||
|
||||
void setPicture(const QPixmap& pix);
|
||||
void setEnableZoom(bool b) { mZoomEnabled = b; }
|
||||
void setEnableClear(bool b) { mClearEnabled = b; }
|
||||
void reset();
|
||||
QPixmap extractCroppedScaledPicture() const;
|
||||
void updateView();
|
||||
|
||||
virtual void keyPressEvent(QKeyEvent *ev) override;
|
||||
|
||||
const QPixmap& originalImage() const { return mFullImage ; }
|
||||
|
||||
signals:
|
||||
void clicked();
|
||||
void cleared();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *ev) override;
|
||||
@ -73,6 +77,7 @@ protected:
|
||||
int mLastX,mLastY;
|
||||
bool mMoving;
|
||||
bool mZoomEnabled;
|
||||
bool mClearEnabled;
|
||||
};
|
||||
|
||||
// Class to paint the thumbnails with title
|
||||
|
@ -563,11 +563,14 @@ QVariant RsGxsForumModel::toolTipRole(const ForumModelPostEntry& fmpe,int column
|
||||
return QVariant();
|
||||
|
||||
int S = QFontMetricsF(QApplication::font()).height();
|
||||
QImage pix( (*icons.begin()).pixmap(QSize(4*S,4*S)).toImage());
|
||||
QImage pix( (*icons.begin()).pixmap(QSize(5*S,5*S)).toImage());
|
||||
|
||||
QString embeddedImage;
|
||||
if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, 8*S * 8*S))
|
||||
if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(5*S,5*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, -1))
|
||||
{
|
||||
embeddedImage.insert(embeddedImage.indexOf("src="), "style=\"float:left\" ");
|
||||
comment = "<table><tr><td>" + embeddedImage + "</td><td>" + comment + "</td></table>";
|
||||
}
|
||||
|
||||
return comment;
|
||||
}
|
||||
|
@ -399,11 +399,14 @@ QVariant RsMessageModel::toolTipRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
|
||||
return QVariant();
|
||||
|
||||
int S = QFontMetricsF(QApplication::font()).height();
|
||||
QImage pix( (*icons.begin()).pixmap(QSize(4*S,4*S)).toImage());
|
||||
QImage pix( (*icons.begin()).pixmap(QSize(5*S,5*S)).toImage());
|
||||
|
||||
QString embeddedImage;
|
||||
if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, 8*S * 8*S))
|
||||
if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(5*S,5*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, -1))
|
||||
{
|
||||
embeddedImage.insert(embeddedImage.indexOf("src="), "style=\"float:left\" ");
|
||||
comment = "<table><tr><td>" + embeddedImage + "</td><td>" + comment + "</td></table>";
|
||||
}
|
||||
|
||||
return comment;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user