mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-02-18 00:02:02 +03:00
feat: basic limit share ratio #308
This commit is contained in:
parent
b069ce490e
commit
2c1fc34ebd
2 changed files with 100 additions and 2 deletions
89
src/components/Modals/ShareLimitModal.vue
Normal file
89
src/components/Modals/ShareLimitModal.vue
Normal file
|
@ -0,0 +1,89 @@
|
|||
<template>
|
||||
<v-dialog
|
||||
v-model="dialog"
|
||||
scrollable
|
||||
content-class="rounded-form"
|
||||
max-width="500px"
|
||||
:fullscreen="isPhone"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title class="pa-0">
|
||||
<v-toolbar-title class="ma-4 primarytext--text">
|
||||
<h3>Limit ratio</h3>
|
||||
</v-toolbar-title>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-text-field
|
||||
v-model="limit"
|
||||
autofocus
|
||||
clearable
|
||||
label="Ratio Limit"
|
||||
:prepend-inner-icon="mdiSpeedometer"
|
||||
@focus="$event.target.select()"
|
||||
@keydown.enter="setLimit"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
<v-divider />
|
||||
<v-card-actions class="justify-end">
|
||||
<v-btn
|
||||
class="accent white--text elevation-0 px-4"
|
||||
@click="setLimit"
|
||||
>
|
||||
Save
|
||||
</v-btn>
|
||||
<v-btn
|
||||
class="error white--text elevation-0 px-4"
|
||||
@click="close"
|
||||
>
|
||||
Cancel
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { mdiSpeedometer, mdiClose } from '@mdi/js'
|
||||
import { Modal, FullScreenModal } from '@/mixins'
|
||||
import qbit from '@/services/qbit'
|
||||
export default {
|
||||
name: 'ShareLimitModal',
|
||||
mixins: [Modal, FullScreenModal],
|
||||
props: {
|
||||
mode: String,
|
||||
hash: String
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
limit: '',
|
||||
mdiSpeedometer, mdiClose
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['getTorrent']),
|
||||
torrent() {
|
||||
return this.getTorrent(this.hash)
|
||||
},
|
||||
isPhone() {
|
||||
return this.$vuetify.breakpoint.xsOnly
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setLimit() {
|
||||
console.log(this.limit || -2)
|
||||
qbit.setShareLimit([this.hash], this.limit || -2, -2)
|
||||
this.close()
|
||||
},
|
||||
close() {
|
||||
this.dialog = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -232,6 +232,12 @@
|
|||
Upload
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item @click="setShareLimit()">
|
||||
<v-icon>{{ mdiAccountGroup }}</v-icon>
|
||||
<v-list-item-title class="ml-2">
|
||||
Share
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-menu
|
||||
|
@ -293,7 +299,7 @@ import qbit from '@/services/qbit'
|
|||
import { General, TorrentSelect } from '@/mixins'
|
||||
import {
|
||||
mdiBullhorn, mdiPlaylistCheck, mdiArrowUp, mdiArrowDown, mdiPriorityLow,
|
||||
mdiInformation, mdiRenameBox, mdiFolder, mdiDelete,
|
||||
mdiInformation, mdiRenameBox, mdiFolder, mdiDelete, mdiAccountGroup,
|
||||
mdiPlay, mdiPause, mdiSelect, mdiPriorityHigh, mdiChevronRight,
|
||||
mdiFastForward, mdiShape, mdiHeadCog, mdiCheckboxMarked, mdiCheckboxBlankOutline,
|
||||
mdiSpeedometerSlow, mdiChevronUp, mdiChevronDown, mdiContentCopy, mdiMagnet
|
||||
|
@ -317,7 +323,7 @@ export default {
|
|||
{ name: 'bottom', icon: mdiPriorityLow, action: 'bottomPrio' }
|
||||
],
|
||||
mdiDelete, mdiPlay, mdiPause, mdiSelect, mdiFastForward,
|
||||
mdiFolder, mdiRenameBox, mdiInformation, mdiMagnet,
|
||||
mdiFolder, mdiRenameBox, mdiInformation, mdiMagnet, mdiAccountGroup,
|
||||
mdiPlaylistCheck, mdiPriorityHigh, mdiBullhorn, mdiChevronRight,
|
||||
mdiShape, mdiHeadCog, mdiCheckboxMarked, mdiCheckboxBlankOutline,
|
||||
mdiSpeedometerSlow, mdiChevronUp, mdiChevronDown, mdiContentCopy
|
||||
|
@ -388,6 +394,9 @@ export default {
|
|||
setLimit(mode) {
|
||||
this.createModal('SpeedLimitModal', { hash: this.torrent.hash, mode })
|
||||
},
|
||||
setShareLimit() {
|
||||
this.createModal('ShareLimitModal', { hash: this.torrent.hash })
|
||||
},
|
||||
forceResume() {
|
||||
qbit.forceStartTorrents(this.hashes)
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue