A full-featured download manager.
refactor: add task to support addTaskOptions
Dr_rOot4ca4f5e60605
diff --git a/src/renderer/components/Task/AddTask.vue b/src/renderer/components/Task/AddTask.vueindex 767763df..b33a1728 100644--- a/src/renderer/components/Task/AddTask.vue+++ b/src/renderer/components/Task/AddTask.vue@@ -127,7 +127,7 @@import '@/components/Icons/inbox'const initialForm = (state) => {- const { addTaskUrl } = state.app+ const { addTaskUrl, addTaskOptions } = state.appconst { dir, split, newTaskShowDownloading } = state.preference.configconst result = {uris: addTaskUrl,@@ -139,7 +139,8 @@cookie: '',dir,split,- newTaskShowDownloading+ newTaskShowDownloading,+ ...addTaskOptions}return result}@@ -222,6 +223,7 @@},handleClose (done) {this.$store.dispatch('app/hideAddTaskDialog')+ this.$store.dispatch('app/updateAddTaskOptions', {})},handleClosed () {this.reset()@@ -258,6 +260,7 @@this.form.dir = dir},reset () {+ this.showAdvanced = falsethis.form = initialForm(this.$store.state)},handleCancel (formName) {@@ -369,6 +372,7 @@try {this.addTask(this.type, this.form)+this.$store.dispatch('app/hideAddTaskDialog')if (this.form.newTaskShowDownloading) {this.$router.push({diff --git a/src/renderer/store/modules/app.js b/src/renderer/store/modules/app.jsindex a7e648b0..ec045ce5 100644--- a/src/renderer/store/modules/app.js+++ b/src/renderer/store/modules/app.js@@ -20,13 +20,14 @@ const state = {downloadSpeed: 0,uploadSpeed: 0,numActive: 0,- numStopped: 0,- numWaiting: 0+ numWaiting: 0,+ numStopped: 0},addTaskVisible: false,addTaskType: 'uri',addTaskUrl: '',- addTaskTorrents: []+ addTaskTorrents: [],+ addTaskOptions: {}}const getters = {@@ -60,6 +61,11 @@ const mutations = {CHANGE_ADD_TASK_TORRENTS (state, fileList) {state.addTaskTorrents = [...fileList]},+ UPDATE_ADD_TASK_OPTIONS (state, options) {+ state.addTaskOptions = {+ ...options+ }+ },UPDATE_INTERVAL (state, millisecond) {let interval = millisecondif (millisecond > MAX_INTERVAL) {@@ -162,6 +168,9 @@ const actions = {addTaskAddTorrents ({ commit }, { fileList }) {commit('CHANGE_ADD_TASK_TORRENTS', fileList)},+ updateAddTaskOptions ({ commit }, options = {}) {+ commit('UPDATE_ADD_TASK_OPTIONS', options)+ },updateInterval ({ commit }, millisecond) {commit('UPDATE_INTERVAL', millisecond)},