Update download-settings.js, download-settings.vue, and 3 more files...

This commit is contained in:
PrestonN 2022-06-05 17:25:05 -04:00
parent 1da7883223
commit cf1de6302c
5 changed files with 53 additions and 10 deletions

View File

@ -1,6 +1,7 @@
import Vue from 'vue' import Vue from 'vue'
import FtFlexBox from '../ft-flex-box/ft-flex-box.vue' import FtFlexBox from '../ft-flex-box/ft-flex-box.vue'
import FtToggleSwitch from '../ft-toggle-switch/ft-toggle-switch.vue' import FtToggleSwitch from '../ft-toggle-switch/ft-toggle-switch.vue'
import FtSelect from '../ft-select/ft-select.vue'
import FtButton from '../ft-button/ft-button.vue' import FtButton from '../ft-button/ft-button.vue'
import FtInput from '../ft-input/ft-input.vue' import FtInput from '../ft-input/ft-input.vue'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
@ -12,19 +13,36 @@ export default Vue.extend({
components: { components: {
'ft-toggle-switch': FtToggleSwitch, 'ft-toggle-switch': FtToggleSwitch,
'ft-flex-box': FtFlexBox, 'ft-flex-box': FtFlexBox,
'ft-select': FtSelect,
'ft-button': FtButton, 'ft-button': FtButton,
'ft-input': FtInput 'ft-input': FtInput
}, },
data: function () { data: function () {
return { return {
askForDownloadPath: this.$store.getters.getDownloadFolderPath === '' askForDownloadPath: false,
downloadBehaviorValues: [
'download',
'open'
]
} }
}, },
computed: { computed: {
downloadPath: function() { downloadPath: function() {
return this.$store.getters.getDownloadFolderPath return this.$store.getters.getDownloadFolderPath
},
downloadBehaviorNames: function () {
return [
this.$t('Settings.Download Settings.Download in app'),
this.$t('Settings.Download Settings.Open in web browser')
]
},
downloadBehavior: function () {
return this.$store.getters.getDownloadBehavior
} }
}, },
mounted: function () {
this.askForDownloadPath = this.downloadPath === ''
},
methods: { methods: {
handleDownloadingSettingChange: function (value) { handleDownloadingSettingChange: function (value) {
this.askForDownloadPath = value this.askForDownloadPath = value
@ -42,7 +60,8 @@ export default Vue.extend({
this.updateDownloadFolderPath(folder.filePaths[0]) this.updateDownloadFolderPath(folder.filePaths[0])
}, },
...mapActions([ ...mapActions([
'updateDownloadFolderPath' 'updateDownloadFolderPath',
'updateDownloadBehavior'
]) ])
} }

View File

@ -6,7 +6,19 @@
</h3> </h3>
</summary> </summary>
<hr> <hr>
<ft-flex-box class="downloadSettingsFlexBox"> <ft-flex-box>
<ft-select
:placeholder="$t('Settings.Download Settings.Download Behavior')"
:value="downloadBehavior"
:select-names="downloadBehaviorNames"
:select-values="downloadBehaviorValues"
@change="updateDownloadBehavior"
/>
</ft-flex-box>
<ft-flex-box
v-if="downloadBehavior === 'download'"
class="downloadSettingsFlexBox"
>
<ft-toggle-switch <ft-toggle-switch
:label="$t('Settings.Download Settings.Ask Download Path')" :label="$t('Settings.Download Settings.Ask Download Path')"
:default-value="askForDownloadPath" :default-value="askForDownloadPath"
@ -14,7 +26,7 @@
/> />
</ft-flex-box> </ft-flex-box>
<ft-flex-box <ft-flex-box
v-if="!askForDownloadPath" v-if="!askForDownloadPath && downloadBehavior === 'download'"
> >
<ft-input <ft-input
class="folderDisplay" class="folderDisplay"
@ -25,7 +37,7 @@
/> />
</ft-flex-box> </ft-flex-box>
<ft-flex-box <ft-flex-box
v-if="!askForDownloadPath" v-if="!askForDownloadPath && downloadBehavior === 'download'"
> >
<ft-button <ft-button
:label="$t('Settings.Download Settings.Choose Path')" :label="$t('Settings.Download Settings.Choose Path')"

View File

@ -179,6 +179,10 @@ export default Vue.extend({
}) })
}, },
downloadBehavior: function () {
return this.$store.getters.getDownloadBehavior
},
formatTypeOptions: function () { formatTypeOptions: function () {
return [ return [
{ {
@ -415,11 +419,15 @@ export default Vue.extend({
const linkName = selectedDownloadLinkOption.label const linkName = selectedDownloadLinkOption.label
const extension = this.grabExtensionFromUrl(linkName) const extension = this.grabExtensionFromUrl(linkName)
this.downloadMedia({ if (this.downloadBehavior === 'open') {
url: url, this.openExternalLink(url)
title: this.title, } else {
extension: extension this.downloadMedia({
}) url: url,
title: this.title,
extension: extension
})
}
}, },
grabExtensionFromUrl: function (url) { grabExtensionFromUrl: function (url) {

View File

@ -255,6 +255,7 @@ const state = {
videoPlaybackRateMouseScroll: false, videoPlaybackRateMouseScroll: false,
videoPlaybackRateInterval: 0.25, videoPlaybackRateInterval: 0.25,
downloadFolderPath: '', downloadFolderPath: '',
downloadBehavior: 'download',
enableScreenshot: false, enableScreenshot: false,
screenshotFormat: 'png', screenshotFormat: 'png',
screenshotQuality: 95, screenshotQuality: 95,

View File

@ -364,6 +364,9 @@ Settings:
Download Settings: Download Settings Download Settings: Download Settings
Ask Download Path: Ask for download path Ask Download Path: Ask for download path
Choose Path: Choose Path Choose Path: Choose Path
Download Behavior: Download Behavior
Download in app: Download in app
Open in web browser: Open in web browser
About: About:
#On About page #On About page
About: About About: About