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 FtFlexBox from '../ft-flex-box/ft-flex-box.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 FtInput from '../ft-input/ft-input.vue'
import { mapActions } from 'vuex'
@ -12,19 +13,36 @@ export default Vue.extend({
components: {
'ft-toggle-switch': FtToggleSwitch,
'ft-flex-box': FtFlexBox,
'ft-select': FtSelect,
'ft-button': FtButton,
'ft-input': FtInput
},
data: function () {
return {
askForDownloadPath: this.$store.getters.getDownloadFolderPath === ''
askForDownloadPath: false,
downloadBehaviorValues: [
'download',
'open'
]
}
},
computed: {
downloadPath: function() {
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: {
handleDownloadingSettingChange: function (value) {
this.askForDownloadPath = value
@ -42,7 +60,8 @@ export default Vue.extend({
this.updateDownloadFolderPath(folder.filePaths[0])
},
...mapActions([
'updateDownloadFolderPath'
'updateDownloadFolderPath',
'updateDownloadBehavior'
])
}

View File

@ -6,7 +6,19 @@
</h3>
</summary>
<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
:label="$t('Settings.Download Settings.Ask Download Path')"
:default-value="askForDownloadPath"
@ -14,7 +26,7 @@
/>
</ft-flex-box>
<ft-flex-box
v-if="!askForDownloadPath"
v-if="!askForDownloadPath && downloadBehavior === 'download'"
>
<ft-input
class="folderDisplay"
@ -25,7 +37,7 @@
/>
</ft-flex-box>
<ft-flex-box
v-if="!askForDownloadPath"
v-if="!askForDownloadPath && downloadBehavior === 'download'"
>
<ft-button
: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 () {
return [
{
@ -415,11 +419,15 @@ export default Vue.extend({
const linkName = selectedDownloadLinkOption.label
const extension = this.grabExtensionFromUrl(linkName)
this.downloadMedia({
url: url,
title: this.title,
extension: extension
})
if (this.downloadBehavior === 'open') {
this.openExternalLink(url)
} else {
this.downloadMedia({
url: url,
title: this.title,
extension: extension
})
}
},
grabExtensionFromUrl: function (url) {

View File

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

View File

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