1
0
Fork 0
mirror of https://github.com/VueTorrent/VueTorrent.git synced 2025-05-03 22:04:53 +03:00
This commit is contained in:
Daan Wijns 2021-01-24 10:05:39 +01:00 committed by GitHub
parent 2b84780545
commit f645ed6f54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 101 additions and 33 deletions
src/components/Modals

View file

@ -1,11 +1,16 @@
<template>
<v-dialog v-model="dialog" max-width="500px">
<v-dialog
v-model="dialog"
scrollable
max-width="500px"
:fullscreen="phoneLayout"
>
<v-card>
<v-container :class="`pa-0 project done`">
<v-card-title class="justify-center">
<h2>Add a new Torrent</h2>
</v-card-title>
<v-card-text>
<v-card-text class="pb-0">
<v-form ref="form" v-model="valid">
<v-container>
<v-row no-gutters>
@ -70,6 +75,7 @@
:items="availableCategories"
clearable
label="Category"
item-text="name"
:prepend-icon="mdiTag"
@input="categoryChanged"
/>
@ -87,24 +93,28 @@
<v-checkbox
v-model="start"
label="Start torrent"
hide-details
/>
</v-flex>
<v-flex xs12 sm6>
<v-checkbox
v-model="skip_checking"
label="Skip hash check"
hide-details
/>
</v-flex>
<v-flex xs12 sm6>
<v-checkbox
v-model="root_folder"
label="Create subfolder"
hide-details
/>
</v-flex>
<v-flex xs12 sm6>
<v-checkbox
v-model="autoTMM"
label="Automatic Torrent Management"
hide-details
/>
</v-flex>
</v-row>
@ -123,6 +133,18 @@
>
Add Torrent
</v-btn>
<v-fab-transition v-if="phoneLayout">
<v-btn
color="red"
dark
absolute
bottom
right
@click="close"
>
<v-icon>{{ mdiClose }}</v-icon>
</v-btn>
</v-fab-transition>
</v-card-actions>
</v-form>
</v-container>
@ -134,10 +156,11 @@
import { mapGetters } from 'vuex'
import Modal from '@/mixins/Modal'
import qbit from '@/services/qbit'
import { mdiFolder, mdiTag, mdiPaperclip, mdiLink } from '@mdi/js'
import { mdiFolder, mdiTag, mdiPaperclip, mdiLink, mdiClose } from '@mdi/js'
import { FullScreenModal } from '@/mixins'
export default {
name: 'AddModal',
mixins: [Modal],
mixins: [Modal, FullScreenModal],
props: ['initialMagnet'],
data() {
return {
@ -161,14 +184,11 @@ export default {
loading: false,
urls: null,
valid: false,
mdiFolder, mdiTag, mdiPaperclip, mdiLink
mdiFolder, mdiTag, mdiPaperclip, mdiLink, mdiClose
}
},
computed: {
...mapGetters(['getSettings', 'getCategories']),
settings() {
return this.getSettings()
},
validFile() {
return this.Files.length > 0
},
@ -178,20 +198,13 @@ export default {
savepath() {
let savePath = this.getSettings().save_path
if (this.category) {
savePath += this.category
const category = this.getCategories()[this.category]
if (category && category.savePath) savePath = category.savePath
savePath = this.category.savePath
}
return savePath
},
availableCategories() {
return Object.keys(this.getCategories())
}
},
watch: {
settings(newvalue) {
this.directory = newvalue.save_path
return this.getCategories()
}
},
created() {
@ -222,7 +235,7 @@ export default {
}
if (this.files.length) torrents.push(...this.files)
if (this.urls) params.urls = this.urls
if (this.category) params.category = this.category
if (this.category) params.category = this.category.name
if (!this.autoTMM) params.savepath = this.directory
qbit.addTorrents(params, torrents)
@ -241,7 +254,10 @@ export default {
this.category = null
this.directory = this.savepath
this.skip_checking = null
},
close() {
this.deleteModal()
}
}
}
</script>
</script>

View file

@ -1,7 +1,7 @@
<template>
<v-card flat>
<perfect-scrollbar>
<v-card-text :style="{ minHeight: phoneLayout ? '' : '75vh', maxHeight: '75vh'}">
<v-card-text class="pa-0" :style="{ minHeight: phoneLayout ? '' : '75vh', maxHeight: '75vh'}">
<v-treeview
v-model="selected"
:items="fileTree"
@ -27,7 +27,7 @@
autofocus
/>
</template>
<template #append="{ item }">
<template v-if="!$vuetify.breakpoint.smAndDown" #append="{ item }">
<span v-if="!item.icon">{{ item.children.length }} Files</span>
<div v-else>
<span>[{{ item.size }}]</span>

View file

@ -189,3 +189,4 @@ export default {
}
}
</style>