Model item events: add a media_http_url field
This commit is contained in:
parent
55e22ea948
commit
99017adc1d
1
TODO.md
1
TODO.md
|
@ -1,6 +1,7 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
- Image viewer:
|
- Image viewer:
|
||||||
|
- room avatar change event: test open, open externally, copy url & path
|
||||||
- open externally in context menu in timeline thumbnail, also button
|
- open externally in context menu in timeline thumbnail, also button
|
||||||
- hflickable: support kinetic scrolling disabler
|
- hflickable: support kinetic scrolling disabler
|
||||||
|
|
||||||
|
|
|
@ -838,6 +838,7 @@ class MatrixClient(nio.AsyncClient):
|
||||||
inline_content = content["body"],
|
inline_content = content["body"],
|
||||||
|
|
||||||
media_url = url,
|
media_url = url,
|
||||||
|
media_http_url = await self.mxc_to_http(url),
|
||||||
media_title = path.name,
|
media_title = path.name,
|
||||||
media_width = content["info"].get("w", 0),
|
media_width = content["info"].get("w", 0),
|
||||||
media_height = content["info"].get("h", 0),
|
media_height = content["info"].get("h", 0),
|
||||||
|
|
|
@ -280,6 +280,7 @@ class Event(ModelItem):
|
||||||
source: Optional[nio.Event] = None
|
source: Optional[nio.Event] = None
|
||||||
|
|
||||||
media_url: str = ""
|
media_url: str = ""
|
||||||
|
media_http_url: str = ""
|
||||||
media_title: str = ""
|
media_title: str = ""
|
||||||
media_width: int = 0
|
media_width: int = 0
|
||||||
media_height: int = 0
|
media_height: int = 0
|
||||||
|
|
|
@ -209,6 +209,7 @@ class NioCallbacks:
|
||||||
inline_content = ev.body,
|
inline_content = ev.body,
|
||||||
|
|
||||||
media_url = ev.url,
|
media_url = ev.url,
|
||||||
|
media_http_url = await self.client.mxc_to_http(ev.url),
|
||||||
media_title = ev.body,
|
media_title = ev.body,
|
||||||
media_width = info.get("w") or 0,
|
media_width = info.get("w") or 0,
|
||||||
media_height = info.get("h") or 0,
|
media_height = info.get("h") or 0,
|
||||||
|
@ -615,8 +616,10 @@ class NioCallbacks:
|
||||||
else:
|
else:
|
||||||
co = "%1 removed the room's picture"
|
co = "%1 removed the room's picture"
|
||||||
|
|
||||||
|
http = await self.client.mxc_to_http(ev.avatar_url)
|
||||||
|
|
||||||
await self.client.register_nio_event(
|
await self.client.register_nio_event(
|
||||||
room, ev, content=co, media_url=ev.avatar_url,
|
room, ev, content=co, media_url=ev.avatar_url, media_http_url=http,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -199,12 +199,7 @@ HColumnLayout {
|
||||||
qsTr("Copy audio address")
|
qsTr("Copy audio address")
|
||||||
|
|
||||||
visible: Boolean(text)
|
visible: Boolean(text)
|
||||||
onTriggered: py.callClientCoro(
|
onTriggered: Clipboard.text = model.media_http_url
|
||||||
chat.userId,
|
|
||||||
"mxc_to_http",
|
|
||||||
[contextMenu.media[1]],
|
|
||||||
httpUrl => Clipboard.text = httpUrl,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HMenuItem {
|
HMenuItem {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user