Skip to content

Commit

Permalink
[feature] allow toggle sequential download (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
slikie authored May 30, 2021
1 parent 908f299 commit 14792bc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ class Api {
return this.actionTorrents('setForceStart', hashes, { value: 'true' });
}

public toggleSequentialTorrents(hashes: string[]) {
return this.actionTorrents('toggleSequentialDownload', hashes);
}

public reannounceTorrents(hashes: string[]) {
return this.actionTorrents('reannounce', hashes);
}
Expand Down
18 changes: 16 additions & 2 deletions src/components/Torrents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@
vertical
inset
/>
<v-btn
icon
@click="toggleSequentialTorrents"
:title="$t('toggle_sequential')"
:disabled="!hasSelected"
>
<v-icon>mdi-transit-connection-variant</v-icon>
</v-btn>
<v-btn
icon
@click="setTorrentLocation"
Expand Down Expand Up @@ -180,7 +188,7 @@
<v-progress-linear
height="1.4em"
:value="row.item.progress * 100"
:color="row.item.state | stateColor(true)"
:color="row.item.state | stateColor(true, row.item.seq_dl)"
class="text-center ma-0"
>
<span :class="getProgressColorClass(row.item.progress)">
Expand Down Expand Up @@ -352,11 +360,14 @@ function getStateInfo(state: string) {
const item = getStateInfo(state);
return `mdi-${item.icon}`;
},
stateColor(state: string, isProgress?: boolean) {
stateColor(state: string, isProgress?: boolean, isSeqDL?: boolean) {
const item = getStateInfo(state);
if (!isProgress) {
return item.color;
}
if (isSeqDL) {
return '#e33371' // icon.color.secondary;
}
return item.color || '#0008';
},
Expand Down Expand Up @@ -480,6 +491,9 @@ export default class Torrents extends Vue {
await api.setForceStartTorrents(this.selectedHashes);
}
async toggleSequentialTorrents() {
await api.toggleSequentialTorrents(this.selectedHashes);
}
async pauseTorrents() {
await api.pauseTorrents(this.selectedHashes);
}
Expand Down
1 change: 1 addition & 0 deletions src/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default {
resume: 'Resume',
pause: 'Pause',
force_start: 'Force Start',
toggle_sequential: 'Toggle Sequential Download',
info: 'Info',
reset: 'Reset',
login: 'Login',
Expand Down

0 comments on commit 14792bc

Please sign in to comment.