Improve avatar look and layouting
Thanks to red_sky for the feedback!
This commit is contained in:
parent
bde71a6cbc
commit
4f7a45a0a6
@ -31,6 +31,11 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
mipmap: true
|
||||
smooth: false
|
||||
|
||||
sourceSize.width: avatar.width
|
||||
sourceSize.height: avatar.height
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: OpacityMask {
|
||||
|
@ -12,7 +12,6 @@ RowLayout {
|
||||
property var view: chat
|
||||
|
||||
anchors.leftMargin: avatarSize + 4
|
||||
anchors.rightMargin: scrollbar.width
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
|
@ -14,7 +14,7 @@ Rectangle {
|
||||
property var colors: currentActivePalette
|
||||
property var systemInactive: SystemPalette { colorGroup: SystemPalette.Disabled }
|
||||
property var inactiveColors: currentInactivePalette ? currentInactivePalette : systemInactive
|
||||
property int avatarSize: 32
|
||||
property int avatarSize: 40
|
||||
|
||||
color: colors.window
|
||||
|
||||
@ -34,6 +34,9 @@ Rectangle {
|
||||
visible: timelineManager.timeline != null
|
||||
anchors.fill: parent
|
||||
|
||||
anchors.leftMargin: 4
|
||||
anchors.rightMargin: scrollbar.width
|
||||
|
||||
model: timelineManager.timeline
|
||||
|
||||
onModelChanged: {
|
||||
@ -54,7 +57,7 @@ Rectangle {
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
id: scrollbar
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
onPressedChanged: if (!pressed) chat.updatePosition()
|
||||
}
|
||||
|
@ -5,8 +5,6 @@ DelegateChooser {
|
||||
//role: "type" //< not supported in our custom implementation, have to use roleValue
|
||||
roleValue: model.type
|
||||
|
||||
width: parent.width
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: MtxEvent.TextMessage
|
||||
TextMessage {}
|
||||
|
@ -6,7 +6,7 @@ void
|
||||
MxcImageResponse::run()
|
||||
{
|
||||
if (m_requestedSize.isValid()) {
|
||||
QString fileName = QString("%1_%2x%3")
|
||||
QString fileName = QString("%1_%2x%3_crop")
|
||||
.arg(m_id)
|
||||
.arg(m_requestedSize.width())
|
||||
.arg(m_requestedSize.height());
|
||||
@ -23,7 +23,7 @@ MxcImageResponse::run()
|
||||
opts.mxc_url = "mxc://" + m_id.toStdString();
|
||||
opts.width = m_requestedSize.width() > 0 ? m_requestedSize.width() : -1;
|
||||
opts.height = m_requestedSize.height() > 0 ? m_requestedSize.height() : -1;
|
||||
opts.method = "scale";
|
||||
opts.method = "crop";
|
||||
http::client()->get_thumbnail(
|
||||
opts, [this, fileName](const std::string &res, mtx::http::RequestErr err) {
|
||||
if (err) {
|
||||
@ -38,8 +38,6 @@ MxcImageResponse::run()
|
||||
auto data = QByteArray(res.data(), res.size());
|
||||
cache::client()->saveImage(fileName, data);
|
||||
m_image.loadFromData(data);
|
||||
m_image = m_image.scaled(
|
||||
m_requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
m_image.setText("mxc url", "mxc://" + m_id);
|
||||
|
||||
emit finished();
|
||||
|
Loading…
Reference in New Issue
Block a user