feat: Copy/open image, open last image

This commit is contained in:
Natsumi
2023-05-08 14:45:43 +12:00
parent 2a23e97cb6
commit 4387719907
4 changed files with 95 additions and 12 deletions

View File

@@ -89,8 +89,11 @@ speechSynthesis.getVoices();
$app.refreshCustomCss();
}
let carouselNavigation = { 'ArrowLeft': 0, 'ArrowRight': 2 }[e.key]
if (carouselNavigation !== undefined && $app.screenshotMetadataDialog?.visible) {
let carouselNavigation = {ArrowLeft: 0, ArrowRight: 2}[e.key];
if (
typeof carouselNavigation !== 'undefined' &&
$app.screenshotMetadataDialog?.visible
) {
$app.screenshotMetadataCarouselChange(carouselNavigation);
}
});
@@ -20636,16 +20639,16 @@ speechSynthesis.getVoices();
D.metadata.dateTime = Date.parse(json.creationDate);
}
this.showScreenshotMetadataDialog();
this.openScreenshotMetadataDialog();
};
$app.data.screenshotMetadataDialog = {
visible: false,
metadata: {},
isUploading: false
};
$app.methods.showScreenshotMetadataDialog = function () {
$app.methods.openScreenshotMetadataDialog = function () {
this.$nextTick(() =>
adjustDialogZ(this.$refs.screenshotMetadataDialog.$el)
);
@@ -20653,6 +20656,14 @@ speechSynthesis.getVoices();
D.visible = true;
};
$app.methods.showScreenshotMetadataDialog = function () {
var D = this.screenshotMetadataDialog;
if (!D.metadata.filePath) {
AppApi.GetLastScreenshot();
}
this.openScreenshotMetadataDialog();
};
$app.methods.screenshotMetadataCarouselChange = function (index) {
var D = this.screenshotMetadataDialog;
if (index === 0) {
@@ -20712,16 +20723,36 @@ speechSynthesis.getVoices();
* This function is called by .NET(CefCustomDragHandler#CefCustomDragHandler) when a file is dragged over a drop zone in the app window.
* @param {string} filePath - The full path to the file being dragged into the window
*/
$app.methods.dragEnterCef = function(filePath) {
this.currentlyDroppingFile = filePath
$app.methods.dragEnterCef = function (filePath) {
this.currentlyDroppingFile = filePath;
};
$app.methods.handleDrop = function(event) {
if (this.currentlyDroppingFile == null) return
console.log("Dropped file into window: ", this.currentlyDroppingFile)
$app.methods.handleDrop = function (event) {
if (this.currentlyDroppingFile === null) {
return;
}
console.log('Dropped file into window: ', this.currentlyDroppingFile);
AppApi.GetScreenshotMetadata(this.currentlyDroppingFile);
event.preventDefault()
event.preventDefault();
};
$app.methods.copyImageToClipboard = function (path) {
AppApi.CopyImageToClipboard(path).then(() => {
this.$message({
message: 'Image copied to clipboard',
type: 'success'
});
});
};
$app.methods.openImageFolder = function (path) {
AppApi.OpenImageFolder(path).then(() => {
this.$message({
message: 'Opened image folder',
type: 'success'
});
});
};
// YouTube API

View File

@@ -3846,9 +3846,16 @@ html
//- 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" @dragover.prevent @dragenter.prevent @drop="handleDrop" style="-webkit-app-region: drag")
span(style="margin-left:5px;color:#909399;font-family:monospace") {{ $t('dialog.screenshot_metadata.drag') }}
br
el-button(size="small" icon="el-icon-folder-opened" @click="AppApi.OpenScreenshotFileDialog()") {{ $t('dialog.screenshot_metadata.browse') }}
el-button(size="small" icon="el-icon-picture-outline" @click="AppApi.GetLastScreenshot()") {{ $t('dialog.screenshot_metadata.last_screenshot') }}
el-button(size="small" icon="el-icon-copy-document" @click="copyImageToClipboard(screenshotMetadataDialog.metadata.filePath)") {{ $t('dialog.screenshot_metadata.copy_image') }}
el-button(size="small" icon="el-icon-folder" @click="openImageFolder(screenshotMetadataDialog.metadata.filePath)") {{ $t('dialog.screenshot_metadata.open_folder') }}
el-button(v-if="API.currentUser.$isVRCPlus && screenshotMetadataDialog.metadata.filePath" size="small" icon="el-icon-upload2" @click="uploadScreenshotToGallery") {{ $t('dialog.screenshot_metadata.upload') }}
span(v-text="screenshotMetadataDialog.metadata.fileName" style="margin-left:5px")
br
br
span(v-text="screenshotMetadataDialog.metadata.fileName")
br
span(v-if="screenshotMetadataDialog.metadata.dateTime") {{ screenshotMetadataDialog.metadata.dateTime | formatDate('long') }}
span(v-if="screenshotMetadataDialog.metadata.fileResolution" v-text="screenshotMetadataDialog.metadata.fileResolution" style="margin-left:5px")

View File

@@ -1095,7 +1095,11 @@
},
"screenshot_metadata": {
"header": "Screenshot Metadata",
"drag": "Drag and drop a screenshot here",
"browse": "Browse",
"last_screenshot": "Last Screenshot",
"copy_image": "Copy Image",
"open_folder": "Open Folder",
"upload": "Upload"
}
},