commit 2ac0529201fe54ba801d55d4f70af02abf783343
parent 66a42c9da25c2c844421a0b9e345b35ace8a7311
Author: MTRNord <mtrnord1@gmail.com>
Date: Mon, 16 Oct 2017 23:55:15 +0200
Support more image types and add ability to select the text
Signed-off-by: MTRNord <mtrnord1@gmail.com>
Diffstat:
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/matrix/user.go b/matrix/user.go
@@ -16,6 +16,10 @@ import (
"image/draw"
// image/jpeg needed to load jpeg images
_ "image/jpeg"
+ // golang.org/x/image/webp needed to load webp images
+ _ "golang.org/x/image/webp"
+ // golang.org/x/image/bmp needed to load bmp images
+ _ "golang.org/x/image/bmp"
"image/png"
"strconv"
"unicode"
@@ -177,13 +181,8 @@ func GetUserAvatar(cli *gomatrix.Client, mxid string, size int) (avatarResp *gui
canvas := image.NewRGBA(srcIMG.Bounds())
cx := srcIMG.Bounds().Min.X + srcIMG.Bounds().Dx()/2
cy := srcIMG.Bounds().Min.Y + srcIMG.Bounds().Dy()/2
- localLog.Println("srcIMGBounds: ", srcIMG.Bounds())
- localLog.Println("srcIMGCx: ", cx)
- localLog.Println("srcIMGCy: ", cy)
- //outerRadius := math.Sqrt(math.Pow(float64(size), 2)+math.Pow(float64(size), 2)) / 2
draw.DrawMask(canvas, canvas.Bounds(), srcIMG, image.ZP, &circle{image.Point{cx, cy}, cx}, image.ZP, draw.Over)
- localLog.Println("modIMGBounds: ", canvas.Bounds())
avatar := gui.NewQPixmap()
buf := new(bytes.Buffer)
ConvErr := png.Encode(buf, canvas)
diff --git a/qml/ui/message.ui b/qml/ui/message.ui
@@ -70,6 +70,9 @@
<property name="wordWrap">
<bool>false</bool>
</property>
+ <property name="textInteractionFlags">
+ <set>Qt::NoTextInteraction</set>
+ </property>
</widget>
</widget>
</item>
@@ -83,7 +86,7 @@
<widget class="QLabel" name="sender">
<property name="font">
<font>
- <pointsize>12</pointsize>
+ <pointsize>14</pointsize>
</font>
</property>
<property name="text">
@@ -92,6 +95,9 @@
<property name="openExternalLinks">
<bool>true</bool>
</property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
</widget>
</item>
<item>
@@ -121,7 +127,7 @@ border-radius:5px;
<string>Test</string>
</property>
<property name="scaledContents">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@@ -135,6 +141,9 @@ border-radius:5px;
<property name="openExternalLinks">
<bool>true</bool>
</property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
</widget>
</item>
</layout>