1
0
Fork 0
mirror of https://github.com/VueTorrent/VueTorrent.git synced 2025-05-02 05:22:00 +03:00
This commit is contained in:
Daan Wijns 2021-01-06 13:12:45 +01:00 committed by GitHub
parent 3ff434ffa8
commit 9ec4b09b28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 261 additions and 242 deletions
src/components/Modals
AddModal.vue
SettingsModal/Tabs
TorrentDetailModal/Tabs

View file

@ -195,8 +195,15 @@ export default {
this.$store.commit('FETCH_SETTINGS')
this.$store.commit('FETCH_CATEGORIES')
this.urls = this.initialMagnet
this.setSettings()
},
methods: {
setSettings() {
const settings = this.getSettings()
this.start = !settings.start_paused_enabled
this.autoTMM = settings.auto_tmm_enabled
this.root_folder = settings.create_subfolder_enabled
},
addDropFile(e) {
this.files.push(...Array.from(e.dataTransfer.files))
},

View file

@ -1,69 +1,81 @@
<template>
<v-container>
<v-card flat>
<v-card-text :style="{ minHeight: phoneLayout ? '' : '70vh'}">
<h3>When adding a torrent</h3>
<div class="settings_content ml-5 mr-5">
<perfect-scrollbar>
<v-card-text :style="{ minHeight: phoneLayout ? '' : '70vh', maxHeight: '70vh'}">
<h3>When adding a torrent</h3>
<div class="settings_content ml-5 mr-5">
<v-checkbox
v-model="settings.create_subfolder_enabled"
dense
:label="`Create subfolder for torrents with multiple files`"
/>
<v-checkbox
v-model="settings.start_paused_enabled"
dense
:label="`Do not start the download automatically`"
/>
</div>
<v-checkbox
v-model="settings.create_subfolder_enabled"
v-model="settings.preallocate_all"
dense
:label="`Create subfolder for torrents with multiple files`"
:label="`Pre-allocate disk space for all files`"
/>
<v-checkbox
v-model="settings.start_paused_enabled"
v-model="settings.incomplete_files_ext"
dense
:label="`Do not start the download automatically`"
:label="` Append .!qB extension to incomplete files`"
/>
</div>
<v-checkbox
v-model="settings.preallocate_all"
dense
:label="`Pre-allocate disk space for all files`"
/>
<v-checkbox
v-model="settings.incomplete_files_ext"
dense
:label="` Append .!qB extension to incomplete files`"
/>
<h3>Saving Management</h3>
<div class="settings_content ml-5 mr-5">
<v-row dense>
<v-col cols="5" class="d-flex align-center">
<h4>Default Save Path</h4>
</v-col>
<v-col>
<v-text-field
v-model="settings.save_path"
class="mb-2"
outlined
dense
hide-details
/>
</v-col>
</v-row>
<v-row dense>
<v-col cols="5">
<v-checkbox
v-model="settings.temp_path_enabled"
dense
:label="`Keep incomplete torrents in:`"
/>
</v-col>
<v-col>
<v-text-field
v-model="settings.temp_path"
class="mb-2"
outlined
dense
hide-details
:disabled="!settings.temp_path_enabled"
/>
</v-col>
</v-row>
</div>
</v-card-text>
<h3>Saving Management</h3>
<div class="settings_content ml-5 mr-5">
<v-checkbox
v-model="settings.auto_tmm_enabled"
dense
label="Automatic Torrent Management "
/>
<v-checkbox
v-model="settings.save_path_changed_tmm_enabled"
dense
label="Relocate Torrent when category changes"
/>
<v-row dense>
<v-col cols="5" class="d-flex align-center">
<h4>Default Save Path</h4>
</v-col>
<v-col>
<v-text-field
v-model="settings.save_path"
class="mb-2"
outlined
dense
hide-details
/>
</v-col>
</v-row>
<v-row dense>
<v-col cols="5">
<v-checkbox
v-model="settings.temp_path_enabled"
dense
:label="`Keep incomplete torrents in:`"
/>
</v-col>
<v-col>
<v-text-field
v-model="settings.temp_path"
class="mb-2"
outlined
dense
hide-details
:disabled="!settings.temp_path_enabled"
/>
</v-col>
</v-row>
</div>
</v-card-text>
</perfect-scrollbar>
</v-card>
</v-container>
</template>

View file

@ -66,7 +66,7 @@
color="green_accent"
>
<template #label>
Dense version of the dasbhoard
Dense version of the dashboard
</template>
</v-switch>
<v-switch

View file

@ -32,6 +32,36 @@
<div v-else>
<span>[{{ item.size }}]</span>
<span class="ml-4">{{ item.progress }}%</span>
<span class="ml-4">[ {{ item.priority | priority }} ]</span>
<v-menu
open-on-hover
top
>
<template #activator="{ on }">
<v-btn
class="mb-2 ml-4"
x-small
fab
v-on="on"
>
<v-icon>trending_up</v-icon>
</v-btn>
</template>
<v-list dense rounded>
<v-list-item
v-for="prio in priority_options"
:key="prio.value"
link
class="black--text"
@click="setFilePrio(item.id, prio.value)"
>
<v-icon>{{ prio.icon }}</v-icon>
<v-list-item-title class="ml-2 black--text" style="font-size: 12px">
{{ prio.name }}
</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
<v-btn
v-if="!item.editing"
class="mb-2 ml-4"
@ -71,8 +101,24 @@
import qbit from '@/services/qbit'
import { treeify } from '@/helpers'
import { FullScreenModal } from '@/mixins'
const FILE_PRIORITY_OPTIONS = [
{ name: 'max', icon: 'upgrade', value: 7 },
{ name: 'high', icon: 'arrow_drop_up', value: 6 },
{ name: 'normal', icon: 'trending_flat', value: 1 },
{ name: 'unwanted', icon: 'file_download_off', value: 0 }
]
export default {
name: 'Content',
filters: {
priority(value) {
if (value === 4) return 'normal'
const res = FILE_PRIORITY_OPTIONS.find(el => el.value === value)
return res ? res.name : 'undefined'
}
},
mixins: [FullScreenModal],
props: {
hash: String,
@ -82,7 +128,8 @@ export default {
return {
opened: null,
selected: [],
treeData: null
treeData: null,
priority_options: FILE_PRIORITY_OPTIONS
}
},
computed: {
@ -105,20 +152,23 @@ export default {
}
},
created() {
this.getTorrentFiles().then(() => {
this.opened = []
.concat(
...this.treeData
.map(file => file.name.split('/'))
.filter(f => f.splice(-1, 1))
)
.filter((f, index, self) => index === self.indexOf(f))
this.selected = this.treeData
.filter(file => file.priority !== 0)
.map(file => file.name)
})
this.initFiles()
},
methods: {
initFiles() {
this.getTorrentFiles().then(() => {
this.opened = []
.concat(
...this.treeData
.map(file => file.name.split('/'))
.filter(f => f.splice(-1, 1))
)
.filter((f, index, self) => index === self.indexOf(f))
this.selected = this.treeData
.filter(file => file.priority !== 0)
.map(file => file.name)
})
},
async getTorrentFiles() {
const { data } = await qbit.getTorrentFiles(this.hash)
data.forEach((d, i) => {
@ -162,7 +212,11 @@ export default {
qbit.renameFile(this.hash, item.id, item.newName)
item.name = item.newName
this.togleEditing(item)
},
setFilePrio(fileId, priority) {
qbit.setTorrentFilePriority(this.hash, [fileId], priority)
.then(() => this.initFiles())
}
}
}
</script>
</script>