Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improved per-torrent speed limits modal #172

Merged
merged 1 commit into from Mar 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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