+ VueTorrent title: +
+@@ -136,6 +141,7 @@ export default { data() { return { paginationSizes: [5, 15, 30, 50], + titleOptions: ['Default', 'Global Speed', 'First Torrent Status'], Qbitversion: 0 } }, @@ -190,21 +196,20 @@ export default { this.webuiSettings.useDeviceDarkMode = val } }, - showSpeedInTitle: { + paginationSize: { get() { - return this.webuiSettings.showSpeedInTitle + return this.webuiSettings.paginationSize }, set(val) { - this.webuiSettings.showSpeedInTitle = val - document.title = 'VueTorrent' + this.webuiSettings.paginationSize = val } }, - paginationSize: { + title: { get() { - return this.webuiSettings.paginationSize + return this.webuiSettings.title }, set(val) { - this.webuiSettings.paginationSize = val + this.webuiSettings.title = val } }, version() { diff --git a/src/store/index.js b/src/store/index.js index 87d11098f3..50f6b0d981 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -57,6 +57,7 @@ export default new Vuex.Store({ showCurrentSpeed: true, showTrackerFilter: false, showSpeedInTitle: false, + title: 'Default', useDeviceDarkMode: true, paginationSize: 15, busyTorrentProperties: [ diff --git a/src/store/mutations.js b/src/store/mutations.js index 834b4048ac..b5c0aef4e7 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -1,7 +1,8 @@ import Torrent from '../models/Torrent' import Status from '../models/Status' import qbit from '../services/qbit' -import { formatBytes, getHostName } from '@/helpers' +import { getHostName } from '@/helpers' +import { setDocumentTitle } from '@/actions' export default { SET_APP_VERSION(state, version) { @@ -79,21 +80,22 @@ export default { } } - // torrent speed in title - if (state.webuiSettings.showSpeedInTitle) { - // eslint-disable-next-line max-len - document.title = `[D: ${formatBytes(state.status.dlspeed)}/s, U: ${formatBytes(state.status.upspeed)}/s] VueTorrent` - } - // torrents state.torrents = data.map(t => new Torrent(t)) + + // update document title + setDocumentTitle.updateTitle( + state.webuiSettings.title, + [state.status.dlspeed, state.status.upspeed], + state.torrents ? state.torrents[0] : null + ) }, FETCH_SETTINGS: async state => { const { data } = await qbit.getAppPreferences() state.settings = data }, UPDATE_SORT_OPTIONS: (state, { - hashes = [], + hashes = [], filter = null, category = null, tracker = null diff --git a/tests/helpers.js b/tests/helpers.js index f474f226cb..9ddac2b844 100644 --- a/tests/helpers.js +++ b/tests/helpers.js @@ -10,4 +10,4 @@ export function setup(component, propsData) { vuetify, propsData }) -} \ No newline at end of file +}