mirror of
https://github.com/muesli/telephant
synced 2024-11-26 05:10:18 +00:00
Link to full-size media instead of the previews
This commit is contained in:
parent
c41ee5b1e7
commit
f7f79907db
7 changed files with 44 additions and 40 deletions
|
@ -32,6 +32,11 @@ type Follow struct {
|
||||||
FollowedBy bool
|
FollowedBy bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Media struct {
|
||||||
|
Preview string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
// MessageEvent describes an incoming message event.
|
// MessageEvent describes an incoming message event.
|
||||||
type MessageEvent struct {
|
type MessageEvent struct {
|
||||||
Account string
|
Account string
|
||||||
|
@ -44,7 +49,7 @@ type MessageEvent struct {
|
||||||
Notification bool
|
Notification bool
|
||||||
Post Post
|
Post Post
|
||||||
Follow Follow
|
Follow Follow
|
||||||
Media []string
|
Media []Media
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProfileEvent describes a profile event.
|
// ProfileEvent describes a profile event.
|
||||||
|
|
|
@ -322,7 +322,10 @@ func (mod *Account) handleNotification(n *mastodon.Notification) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range n.Status.MediaAttachments {
|
for _, v := range n.Status.MediaAttachments {
|
||||||
ev.Media = append(ev.Media, v.PreviewURL)
|
ev.Media = append(ev.Media, accounts.Media{
|
||||||
|
Preview: v.PreviewURL,
|
||||||
|
URL: v.URL,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,14 +422,20 @@ func (mod *Account) handleStatus(s *mastodon.Status) accounts.MessageEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range s.MediaAttachments {
|
for _, v := range s.MediaAttachments {
|
||||||
ev.Media = append(ev.Media, v.PreviewURL)
|
ev.Media = append(ev.Media, accounts.Media{
|
||||||
|
Preview: v.PreviewURL,
|
||||||
|
URL: v.URL,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.Reblog != nil {
|
if s.Reblog != nil {
|
||||||
ev.Forward = true
|
ev.Forward = true
|
||||||
|
|
||||||
for _, v := range s.Reblog.MediaAttachments {
|
for _, v := range s.Reblog.MediaAttachments {
|
||||||
ev.Media = append(ev.Media, v.PreviewURL)
|
ev.Media = append(ev.Media, accounts.Media{
|
||||||
|
Preview: v.PreviewURL,
|
||||||
|
URL: v.URL,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
ev.Post.URL = s.Reblog.URL
|
ev.Post.URL = s.Reblog.URL
|
||||||
|
|
|
@ -35,7 +35,8 @@ func messageFromEvent(event accounts.MessageEvent) *Message {
|
||||||
p.Liked = event.Post.Liked
|
p.Liked = event.Post.Liked
|
||||||
p.Shared = event.Post.Shared
|
p.Shared = event.Post.Shared
|
||||||
if len(event.Media) > 0 {
|
if len(event.Media) > 0 {
|
||||||
p.Media = event.Media[0]
|
p.MediaPreview = event.Media[0].Preview
|
||||||
|
p.MediaURL = event.Media[0].URL
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.Followed {
|
if p.Followed {
|
||||||
|
|
|
@ -34,7 +34,8 @@ const (
|
||||||
Followed
|
Followed
|
||||||
Following
|
Following
|
||||||
FollowedBy
|
FollowedBy
|
||||||
Media
|
MediaPreview
|
||||||
|
MediaURL
|
||||||
Editing
|
Editing
|
||||||
Liked
|
Liked
|
||||||
Shared
|
Shared
|
||||||
|
@ -79,7 +80,8 @@ type Message struct {
|
||||||
Followed bool
|
Followed bool
|
||||||
Following bool
|
Following bool
|
||||||
FollowedBy bool
|
FollowedBy bool
|
||||||
Media string
|
MediaPreview string
|
||||||
|
MediaURL string
|
||||||
Editing bool
|
Editing bool
|
||||||
Liked bool
|
Liked bool
|
||||||
Shared bool
|
Shared bool
|
||||||
|
@ -107,7 +109,8 @@ func (m *MessageModel) init() {
|
||||||
Followed: core.NewQByteArray2("followed", -1),
|
Followed: core.NewQByteArray2("followed", -1),
|
||||||
Following: core.NewQByteArray2("following", -1),
|
Following: core.NewQByteArray2("following", -1),
|
||||||
FollowedBy: core.NewQByteArray2("followedby", -1),
|
FollowedBy: core.NewQByteArray2("followedby", -1),
|
||||||
Media: core.NewQByteArray2("media", -1),
|
MediaPreview: core.NewQByteArray2("mediapreview", -1),
|
||||||
|
MediaURL: core.NewQByteArray2("mediaurl", -1),
|
||||||
Editing: core.NewQByteArray2("editing", -1),
|
Editing: core.NewQByteArray2("editing", -1),
|
||||||
Liked: core.NewQByteArray2("liked", -1),
|
Liked: core.NewQByteArray2("liked", -1),
|
||||||
Shared: core.NewQByteArray2("shared", -1),
|
Shared: core.NewQByteArray2("shared", -1),
|
||||||
|
@ -236,9 +239,13 @@ func (m *MessageModel) data(index *core.QModelIndex, role int) *core.QVariant {
|
||||||
{
|
{
|
||||||
return core.NewQVariant11(p.FollowedBy)
|
return core.NewQVariant11(p.FollowedBy)
|
||||||
}
|
}
|
||||||
case Media:
|
case MediaPreview:
|
||||||
{
|
{
|
||||||
return core.NewQVariant14(p.Media)
|
return core.NewQVariant14(p.MediaPreview)
|
||||||
|
}
|
||||||
|
case MediaURL:
|
||||||
|
{
|
||||||
|
return core.NewQVariant14(p.MediaURL)
|
||||||
}
|
}
|
||||||
case Editing:
|
case Editing:
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,8 @@ Popup {
|
||||||
property bool forward
|
property bool forward
|
||||||
property bool mention
|
property bool mention
|
||||||
property bool like
|
property bool like
|
||||||
property string media
|
property string mediapreview
|
||||||
|
property string mediaurl
|
||||||
property bool liked
|
property bool liked
|
||||||
property bool shared
|
property bool shared
|
||||||
|
|
||||||
|
@ -59,7 +60,8 @@ Popup {
|
||||||
forward: popup.forward
|
forward: popup.forward
|
||||||
mention: popup.mention
|
mention: popup.mention
|
||||||
like: popup.like
|
like: popup.like
|
||||||
media: popup.media
|
mediapreview: popup.mediapreview
|
||||||
|
mediaurl: popup.mediaurl
|
||||||
liked: popup.liked
|
liked: popup.liked
|
||||||
shared: popup.shared
|
shared: popup.shared
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,8 @@ ColumnLayout {
|
||||||
property bool followed: model.followed
|
property bool followed: model.followed
|
||||||
property bool following: model.following
|
property bool following: model.following
|
||||||
property bool followedby: model.followedby
|
property bool followedby: model.followedby
|
||||||
property string media: model.media
|
property string mediapreview: model.mediapreview
|
||||||
|
property string mediaurl: model.mediaurl
|
||||||
property bool liked: model.liked
|
property bool liked: model.liked
|
||||||
property bool shared: model.shared
|
property bool shared: model.shared
|
||||||
|
|
||||||
|
@ -198,21 +199,21 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButton {
|
ImageButton {
|
||||||
visible: media != ""
|
visible: mediapreview != ""
|
||||||
Layout.topMargin: 4
|
Layout.topMargin: 4
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
// Layout.maximumWidth: sourceSize.width
|
// Layout.maximumWidth: sourceSize.width
|
||||||
Layout.maximumHeight: (accountBridge.username == author && (like || forward)) ?
|
Layout.maximumHeight: (accountBridge.username == author && (like || forward)) ?
|
||||||
Math.min(384 / 3, paintedHeight + 8) :
|
Math.min(384 / 3, paintedHeight + 8) :
|
||||||
Math.min(384, paintedHeight + 8)
|
Math.min(384, paintedHeight + 8)
|
||||||
source: media
|
source: mediapreview
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
verticalAlignment: Image.AlignBottom
|
verticalAlignment: Image.AlignBottom
|
||||||
autoTransform: true
|
autoTransform: true
|
||||||
opacity: fadeMedia ? 0.2 : 1.0
|
opacity: fadeMedia ? 0.2 : 1.0
|
||||||
|
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
Qt.openUrlExternally(media)
|
Qt.openUrlExternally(mediaurl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +263,8 @@ ColumnLayout {
|
||||||
messagePopup.replytoauthor = replytoauthor
|
messagePopup.replytoauthor = replytoauthor
|
||||||
messagePopup.forward = forward
|
messagePopup.forward = forward
|
||||||
messagePopup.mention = mention
|
messagePopup.mention = mention
|
||||||
|
messagePopup.mediapreview = mediapreview
|
||||||
|
messagePopup.mediaurl = mediaurl
|
||||||
messagePopup.like = like
|
messagePopup.like = like
|
||||||
messagePopup.liked = liked
|
messagePopup.liked = liked
|
||||||
messagePopup.shared = shared
|
messagePopup.shared = shared
|
||||||
|
|
|
@ -8,33 +8,21 @@ ListModel {
|
||||||
avatar: "https://pbs.twimg.com/profile_images/779041781413507072/TaqJsdzS_normal.jpg"
|
avatar: "https://pbs.twimg.com/profile_images/779041781413507072/TaqJsdzS_normal.jpg"
|
||||||
body: "This is a very, very long test post, that should probably get word-wrapped. But does it work?"
|
body: "This is a very, very long test post, that should probably get word-wrapped. But does it work?"
|
||||||
createdat: "now"
|
createdat: "now"
|
||||||
actor: ""
|
|
||||||
actorname: ""
|
|
||||||
reply: false
|
reply: false
|
||||||
replytoid: ""
|
|
||||||
replytoauthor: ""
|
|
||||||
forward: false
|
forward: false
|
||||||
mention: false
|
mention: false
|
||||||
like: false
|
like: false
|
||||||
media: ""
|
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: ""
|
|
||||||
messageid: ""
|
|
||||||
author: ""
|
|
||||||
avatar: "https://pbs.twimg.com/profile_images/779041781413507072/TaqJsdzS_normal.jpg"
|
avatar: "https://pbs.twimg.com/profile_images/779041781413507072/TaqJsdzS_normal.jpg"
|
||||||
body: ""
|
|
||||||
createdat: "now"
|
createdat: "now"
|
||||||
actor: "afriend"
|
actor: "afriend"
|
||||||
actorname: "Alex Friend"
|
actorname: "Alex Friend"
|
||||||
reply: false
|
reply: false
|
||||||
replytoid: ""
|
|
||||||
replytoauthor: ""
|
|
||||||
forward: false
|
forward: false
|
||||||
mention: false
|
mention: false
|
||||||
like: false
|
like: false
|
||||||
followed: true
|
followed: true
|
||||||
media: ""
|
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "Some Guy With A Really Really Long Name"
|
name: "Some Guy With A Really Really Long Name"
|
||||||
|
@ -43,8 +31,6 @@ ListModel {
|
||||||
avatar: "https://pbs.twimg.com/profile_images/707382834827120640/R-Eb9YZB_normal.jpg"
|
avatar: "https://pbs.twimg.com/profile_images/707382834827120640/R-Eb9YZB_normal.jpg"
|
||||||
body: "This is a response"
|
body: "This is a response"
|
||||||
createdat: "now"
|
createdat: "now"
|
||||||
actor: ""
|
|
||||||
actorname: ""
|
|
||||||
reply: true
|
reply: true
|
||||||
replytoid: "901223685058703361"
|
replytoid: "901223685058703361"
|
||||||
replytoauthor: "mueslix"
|
replytoauthor: "mueslix"
|
||||||
|
@ -52,7 +38,6 @@ ListModel {
|
||||||
mention: false
|
mention: false
|
||||||
like: false
|
like: false
|
||||||
liked: true
|
liked: true
|
||||||
media: ""
|
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "Dummy User"
|
name: "Dummy User"
|
||||||
|
@ -64,13 +49,11 @@ ListModel {
|
||||||
actor: "mueslix"
|
actor: "mueslix"
|
||||||
actorname: "Christian Muehlhaeuser"
|
actorname: "Christian Muehlhaeuser"
|
||||||
reply: false
|
reply: false
|
||||||
replytoid: ""
|
|
||||||
replytoauthor: ""
|
|
||||||
forward: true
|
forward: true
|
||||||
mention: false
|
mention: false
|
||||||
like: false
|
like: false
|
||||||
shared: true
|
shared: true
|
||||||
media: "https://pbs.twimg.com/media/DIfdvcxXkAUXAvs.jpg"
|
mediapreview: "https://pbs.twimg.com/media/DIfdvcxXkAUXAvs.jpg"
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "Another User"
|
name: "Another User"
|
||||||
|
@ -82,12 +65,9 @@ ListModel {
|
||||||
actor: "mueslix"
|
actor: "mueslix"
|
||||||
actorname: "Christian Muehlhaeuser"
|
actorname: "Christian Muehlhaeuser"
|
||||||
reply: false
|
reply: false
|
||||||
replytoid: ""
|
|
||||||
replytoauthor: ""
|
|
||||||
forward: false
|
forward: false
|
||||||
mention: true
|
mention: true
|
||||||
like: false
|
like: false
|
||||||
media: ""
|
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "This Poster"
|
name: "This Poster"
|
||||||
|
@ -99,11 +79,8 @@ ListModel {
|
||||||
actor: "mueslix"
|
actor: "mueslix"
|
||||||
actorname: "Christian Muehlhaeuser"
|
actorname: "Christian Muehlhaeuser"
|
||||||
reply: false
|
reply: false
|
||||||
replytoid: ""
|
|
||||||
replytoauthor: ""
|
|
||||||
forward: false
|
forward: false
|
||||||
mention: false
|
mention: false
|
||||||
like: true
|
like: true
|
||||||
media: ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue