mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-02-18 00:02:02 +03:00
feat: improved per-torrent speed limits modal (#172)
Co-authored-by: Ievgen Sobko <ievgensobko@cloud.upwork.com>
This commit is contained in:
parent
5faa248395
commit
7bed9eef12
1 changed files with 7 additions and 5 deletions
|
@ -23,6 +23,9 @@
|
|||
:prepend-icon="mdiSpeedometer"
|
||||
suffix="KB/s"
|
||||
clearable
|
||||
autofocus
|
||||
@focus="$event.target.select()"
|
||||
@keydown.enter="setLimit"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
@ -80,24 +83,23 @@ export default {
|
|||
created() {
|
||||
switch (this.mode) {
|
||||
case 'download':
|
||||
this.limit = this.torrent.dl_limit / 1024
|
||||
this.limit = this.torrent.dl_limit > 0 ? this.limit = this.torrent.dl_limit / 1024 : '∞'
|
||||
break
|
||||
case 'upload':
|
||||
this.limit = this.torrent.up_limit / 1024
|
||||
this.limit = this.torrent.up_limit > 0 ? this.torrent.up_limit / 1024 : '∞'
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
setLimit() {
|
||||
switch (this.mode) {
|
||||
case 'download':
|
||||
qbit.setDownloadLimit([this.hash], this.limit * 1024 ?? -1)
|
||||
qbit.setDownloadLimit([this.hash], this.limit > 0 ? this.limit * 1024 : NaN)
|
||||
break
|
||||
case 'upload':
|
||||
qbit.setUploadLimit([this.hash], this.limit * 1024 ?? -1)
|
||||
qbit.setUploadLimit([this.hash], this.limit > 0 ? this.limit * 1024 : NaN)
|
||||
break
|
||||
default:
|
||||
break
|
||||
|
|
Loading…
Add table
Reference in a new issue