Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: improved per-torrent speed limits modal (#172)
Co-authored-by: Ievgen Sobko <ievgensobko@cloud.upwork.com>
  • Loading branch information
IevgenSobko and Ievgen Sobko committed Mar 2, 2021
1 parent 5faa248 commit 7bed9ee
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/Modals/SpeedLimitModal.vue
Expand Up @@ -23,6 +23,9 @@
:prepend-icon="mdiSpeedometer"
suffix="KB/s"
clearable
autofocus
@focus="$event.target.select()"
@keydown.enter="setLimit"
/>
</v-col>
</v-row>
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7bed9ee

Please sign in to comment.