Add a new Transfers menu to allow pause all and resume all torrents

This commit is contained in:
Karan Thakkar
2016-10-14 15:46:31 +05:30
committed by Dan Flettre
parent 7cf1d96a80
commit d8c9014471
3 changed files with 38 additions and 0 deletions

View File

@@ -128,6 +128,26 @@ module.exports = class TorrentListController {
}
}
pauseAllTorrents () {
this.state.saved.torrents.forEach((torrentSummary) => {
if (torrentSummary.status === 'downloading') {
torrentSummary.status = 'paused'
ipcRenderer.send('wt-stop-torrenting', torrentSummary.infoHash)
sound.play('DISABLE')
}
})
}
resumeAllTorrents () {
this.state.saved.torrents.forEach((torrentSummary) => {
if (torrentSummary.status === 'paused') {
torrentSummary.status = 'downloading'
this.startTorrentingSummary(torrentSummary.torrentKey)
sound.play('ENABLE')
}
})
}
toggleTorrentFile (infoHash, index) {
const torrentSummary = TorrentSummary.getByKey(this.state, infoHash)
torrentSummary.selections[index] = !torrentSummary.selections[index]