diff --git a/src/components/Dialogs/AddTorrentDialog.vue b/src/components/Dialogs/AddTorrentDialog.vue index 6593e771..a4c38655 100644 --- a/src/components/Dialogs/AddTorrentDialog.vue +++ b/src/components/Dialogs/AddTorrentDialog.vue @@ -1,14 +1,12 @@ - - + @@ -228,7 +170,8 @@ onBeforeMount(async () => { - + @@ -238,27 +181,17 @@ onBeforeMount(async () => { - + - + @@ -266,19 +199,24 @@ onBeforeMount(async () => { - + - + - + - + - + diff --git a/src/stores/navbar.ts b/src/stores/navbar.ts index 7566fb2b..a1c7d0e3 100644 --- a/src/stores/navbar.ts +++ b/src/stores/navbar.ts @@ -1,15 +1,33 @@ +import { ContentLayout, StopCondition } from '@/constants/qbit/AppPreferences.ts' +import { usePreferenceStore } from '@/stores/preferences.ts' +import { Category } from '@/types/qbit/models' import { defineStore } from 'pinia' -import { computed, ref } from 'vue' +import { computed, reactive, ref } from 'vue' export const useNavbarStore = defineStore( 'navbar', () => { + const preferenceStore = usePreferenceStore() + const downloadData = ref(new Array(15).fill(0)) const uploadData = ref(new Array(15).fill(0)) const addTorrentDialogFiles = ref([]) const addTorrentDialogUrls = ref('') + const addTorrentDialogForm = reactive({ + autoTMM: false, + skipChecking: false, + sequentialDownload: false, + firstLastPiecePrio: false, + startNow: true, + contentLayout: ContentLayout.ORIGINAL, + stopCondition: StopCondition.NONE, + savepath: '', + category: null as Category | null, + tags: [] as string[] + }) + const pendingTorrentsCount = computed(() => addTorrentDialogFiles.value.length + addTorrentDialogUrls.value.split('\n').filter(url => url.trim() !== '').length) function pushDownloadData(data: number) { @@ -33,15 +51,33 @@ export const useNavbarStore = defineStore( } } + function resetAddTorrentDialogForm() { + addTorrentDialogUrls.value = '' + addTorrentDialogFiles.value = [] + + addTorrentDialogForm.autoTMM = preferenceStore.preferences!.auto_tmm_enabled + addTorrentDialogForm.skipChecking = false + addTorrentDialogForm.sequentialDownload = false + addTorrentDialogForm.firstLastPiecePrio = false + addTorrentDialogForm.startNow = !preferenceStore.preferences!.start_paused_enabled + addTorrentDialogForm.contentLayout = preferenceStore.preferences!.torrent_content_layout + addTorrentDialogForm.stopCondition = preferenceStore.preferences!.torrent_stop_condition + addTorrentDialogForm.savepath = preferenceStore.preferences!.save_path + addTorrentDialogForm.category = null + addTorrentDialogForm.tags = [] + } + return { downloadData, uploadData, addTorrentDialogFiles, addTorrentDialogUrls, + addTorrentDialogForm, pendingTorrentsCount, pushDownloadData, pushUploadData, - pushTorrentToQueue + pushTorrentToQueue, + resetAddTorrentDialogForm } }, {