Screenshot metadata dialog (#490)

* docs: Add json schema for screenshot metadata

* feat(.NET): Add function to open a file and read screenshot metadata to AppApi

* refactor(.NET): Check initial file dialog directory before set

Paranoia is fun

* refactor(.NET): Stop reading entire png files into memory to check 8 bytes

* refactor(.NET): Handle endianness and keyword encoding correctly for screenshots

* docs: Add xmldocs and some comments to parts of the screenshot helper

* screenshot metadata dialog

* screenshot metadata dialog 1

* fix: file dialog open bool not resetting properly

* screenshot metadata dialog 2

* fix: Stop png parser from dying on bad files

Parser would keep reading past a file's IEND chunk, and it finally found one that had junk data past IEND. It died. This fixes that.

It also encapsulates the Read function in a try/catch so VRCX doesn't crash if it fails due to a corrupted file.

* fix: buggy carousel transition animation

---------

Co-authored-by: Teacup <git@teadev.xyz>
This commit is contained in:
Natsumi
2023-02-19 10:14:29 +13:00
committed by GitHub
parent d56e00dd3c
commit 1e4b427254
6 changed files with 560 additions and 34 deletions

View File

@@ -1403,6 +1403,7 @@ html
el-button-group
el-button(size="small" icon="el-icon-s-operation" @click="showVRChatConfig()") VRChat config.json
el-button(size="small" icon="el-icon-s-operation" @click="showLaunchOptions()") {{ $t('view.settings.advanced.advanced.launch_options') }}
el-button(size="small" icon="el-icon-picture" @click="showScreenshotMetadataDialog()") {{ $t('view.settings.advanced.advanced.screenshot_metadata') }}
div.options-container
span.sub-header {{ $t('view.settings.advanced.advanced.pending_offline.header') }}
div.options-container-item
@@ -3795,6 +3796,40 @@ html
template(#footer)
el-button(type="primary" size="small" :disabled="inviteGroupDialog.loading || !inviteGroupDialog.userIds.length" @click="sendGroupInvite()") Invite
//- dialog: screenshot metadata
el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" ref="screenshotMetadataDialog" :visible.sync="screenshotMetadataDialog.visible" :title="$t('dialog.screenshot_metadata.header')" width="1050px")
div(v-if="screenshotMetadataDialog.visible")
el-button(size="small" icon="el-icon-folder-opened" @click="AppApi.OpenScreenshotFileDialog()") {{ $t('dialog.screenshot_metadata.browse') }}
br
span(v-text="screenshotMetadataDialog.metadata.fileName")
el-tag(v-if="screenshotMetadataDialog.metadata.fileSize" type="info" effect="plain" size="mini" style="margin-left:5px" v-text="screenshotMetadataDialog.metadata.fileSize")
br
location(v-if="screenshotMetadataDialog.metadata.world" :location="screenshotMetadataDialog.metadata.world.instanceId" :hint="screenshotMetadataDialog.metadata.world.name")
br
span.x-link(v-if="screenshotMetadataDialog.metadata.author" v-text="screenshotMetadataDialog.metadata.author.displayName" @click="showUserDialog(screenshotMetadataDialog.metadata.author.id)" style="color:#909399;font-family:monospace")
br
el-carousel(ref="screenshotMetadataCarousel" :interval="0" initial-index="1" indicator-position="none" arrow="always" height="600px" style="margin-top:10px" @change="screenshotMetadataCarouselChange")
el-carousel-item
el-popover(placement="top" width="700px" trigger="click")
img.x-link(slot="reference" v-lazy="screenshotMetadataDialog.metadata.previousFilePath" style="width:100%;height:100%;object-fit:contain")
img(v-lazy="screenshotMetadataDialog.metadata.previousFilePath" style="height:700px")
el-carousel-item
el-popover(placement="top" width="700px" trigger="click")
img.x-link(slot="reference" v-lazy="screenshotMetadataDialog.metadata.filePath" style="width:100%;height:100%;object-fit:contain")
img(v-lazy="screenshotMetadataDialog.metadata.filePath" style="height:700px")
el-carousel-item
el-popover(placement="top" width="700px" trigger="click")
img.x-link(slot="reference" v-lazy="screenshotMetadataDialog.metadata.nextFilePath" style="width:100%;height:100%;object-fit:contain")
img(v-lazy="screenshotMetadataDialog.metadata.nextFilePath" style="height:700px")
br
template(v-if="screenshotMetadataDialog.metadata.error")
pre(v-text="screenshotMetadataDialog.metadata.error")
br
span(v-for="user in screenshotMetadataDialog.metadata.players" style="margin-top:5px")
span.x-link(v-text="user.displayName" @click="lookupUser(user)")
span(v-if="user.x" v-text="'('+user.x+', '+user.y+', '+user.z+')'" style="margin-left:5px;color:#909399;font-family:monospace")
br
//- dialog: open source software notice
el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" :visible.sync="ossDialog" :title="$t('dialog.open_source.header')" width="650px")
div(v-if="ossDialog" style="height:350px;overflow:hidden scroll;word-break:break-all")