Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1037428
Image.qml
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
Image.qml
View Options
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2020-2023 tusooa <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import
QtQuick
2.15
import
QtQuick
.
Layouts
1.15
import
QtQuick
.
Controls
2.15
import
moe
.
kazv
.
mxc
.
kazv
0.0
as
MK
import
org
.
kde
.
kirigami
2.13
as
Kirigami
import
'.'
as
Types
import
'..'
as
Kazv
Simple
{
id: upper
property
var
gender:
'neutral'
property
var
body:
event
.
content
.
body
property
var
thumbnailFile:
imageInfo
.
thumbnail_file
||
{}
property
var
thumbnailInfo:
imageInfo
.
thumbnail_info
||
{}
property
var
thumbnailWidth:
thumbnailInfo
.
w
property
var
thumbnailHeight:
thumbnailInfo
.
h
property
var
imageInfo:
event
.
content
.
info
||
{}
property
var
imageFile:
event
.
content
.
file
||
{}
property
var
imageWidth:
imageInfo
.
w
property
var
imageHeight:
imageInfo
.
h
property
var
imageMxcUri:
fileHandler
.
encryptedFileMxcUri
||
fileHandler
.
unencryptedFileMxcUri
property
var
mediaId:
imageMxcUri
.
toString
().
split
(
'/'
).
slice
(
-
1
)[
0
]
property
var
innerContentWidth:
upper
.
contentMaxWidth
-
bubble
.
bubbleSpacing
property
var
jobManager:
kazvIOManager
property
var
mtxSdk:
matrixSdk
Kazv
.
FileHandler
{
id: fileHandler
eventContent:
event
.
content
autoCache:
true
kazvIOManager:
upper
.
jobManager
matrixSdk:
upper
.
mtxSdk
}
Types
.
MediaBubble
{
id: bubble
eventContent:
event
.
content
mediaId:
upper
.
mediaId
property
var
label:
Kazv
.
SelectableText
{
Layout.fillWidth:
true
wrapMode:
Text
.
Wrap
text:
l10n
.
get
(
'event-message-image-sent'
,
{
gender
,
body
})
}
property
var
image:
Image
{
id: image
source:
fileHandler
.
kazvIOJob
?
""
:
fileHandler
.
cachedFile
Layout.preferredWidth:
calcImageWidth
()
Layout.preferredHeight:
calcImageHeight
()
Layout.maximumWidth:
innerContentWidth
fillMode:
Image
.
PreserveAspectFit
}
ColumnLayout
{
id: layout
Layout.fillWidth:
true
data:
[
bubble
.
mediaFileMenu
,
bubble
.
label
,
bubble
.
image
,
bubble
.
progressBar
]
}
}
function
calcImageWidth
()
{
const
eventSpecWidth
=
thumbnailWidth
||
imageWidth
return
eventSpecWidth
||
image
.
implicitWidth
||
1
}
function
calcImageHeight
()
{
const
eventSpecHeight
=
thumbnailHeight
||
imageHeight
const
height
=
eventSpecHeight
||
image
.
implicitHeight
||
1
const
width
=
calcImageWidth
()
if
(
width
>
innerContentWidth
)
{
return
height
*
(
innerContentWidth
/
width
)
}
return
height
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, May 14, 7:16 AM (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
166683
Default Alt Text
Image.qml (2 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment