feat: improved per-torrent speed limits modal (#172)

Co-authored-by: Ievgen Sobko <ievgensobko@cloud.upwork.com>
This commit is contained in:
Ievgen Sobko 2021-03-02 16:37:53 +02:00 committed by GitHub
parent 5faa248395
commit 7bed9eef12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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