alt speed toggle

This commit is contained in:
Daan Wijns 2020-05-22 22:12:00 +02:00
parent bbbe89a290
commit 04975e1ce4
4 changed files with 44 additions and 15 deletions

View file

@ -117,11 +117,16 @@ export default {
qbit.addTorrents(params, torrents) qbit.addTorrents(params, torrents)
this.url = null this.resetForm()
this.$store.commit('TOGGLE_MODAL', 'addmodal') this.$store.commit('TOGGLE_MODAL', 'addmodal')
} }
}, },
resetForm(){
this.url = null
this.files = [],
this.directory = null
}
}, },
computed: { computed: {
...mapGetters(['getSettings']), ...mapGetters(['getSettings']),

View file

@ -148,7 +148,7 @@
<v-card flat style="margin-top: 30px;" color="secondary" class="ml-2 mr-2"> <v-card flat style="margin-top: 30px;" color="secondary" class="ml-2 mr-2">
<v-layout row wrap class="pa-3 project nav_upload mx-auto"> <v-layout row wrap class="pa-3 project nav_upload mx-auto">
<v-flex md6> <v-flex md6>
<div style="font-size: 0.95em; margin-top: 6px;" class="upload--text">Diskspace</div> <div style="font-size: 0.95em; margin-top: 6px;" class="upload--text">Free Space</div>
</v-flex> </v-flex>
<v-flex md5 class="ml-4"> <v-flex md5 class="ml-4">
<span class="upload--text title"> <span class="upload--text title">
@ -171,19 +171,35 @@
<v-container> <v-container>
<v-row justify="space-between" style="position:fixed; bottom: 0px; right: 15px;"> <v-row justify="space-between" style="position:fixed; bottom: 0px; right: 15px;">
<v-col> <v-col>
<v-list-item @click="logout" link> <v-tooltip top>
<v-icon class="pr-2 white--text">exit_to_app</v-icon> <template v-slot:activator="{ on }">
<v-list-item-title class="white--text" style="font-size:14px">Log out</v-list-item-title> <v-list-item v-on="on" @click="logout" link>
</v-list-item> <v-icon class="pr-2 white--text">exit_to_app</v-icon>
</v-list-item>
</template>
<span>Log out</span>
</v-tooltip>
</v-col> </v-col>
<v-col> <v-col>
<v-list-item @click="toggleTheme" link> <v-tooltip top>
<v-icon v-if="theme === 'Light'" class="pr-2 white--text">brightness_7</v-icon> <template v-slot:activator="{ on }">
<v-icon v-else class="pr-2 white--text">brightness_2</v-icon> <v-list-item v-on="on" @click="toggleSpeed" link>
<v-list-item-title class="white--text" style="font-size:14px"> <v-icon :color="altSpeed ? 'download' : ''" class="pr-2 white--text">speed</v-icon>
{{theme}} </v-list-item>
</v-list-item-title> </template>
</v-list-item> <span>Alt speeds</span>
</v-tooltip>
</v-col>
<v-col>
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-list-item v-on="on" @click="toggleTheme" link>
<v-icon v-if="theme === 'Light'" class="pr-2 white--text">brightness_7</v-icon>
<v-icon v-else class="pr-2 white--text">brightness_2</v-icon>
</v-list-item>
</template>
<span>{{theme}}</span>
</v-tooltip>
</v-col> </v-col>
</v-row> </v-row>
</v-container> </v-container>
@ -272,13 +288,19 @@ export default {
logout(){ logout(){
this.$store.commit('LOGOUT') this.$store.commit('LOGOUT')
this.$router.push('/login') this.$router.push('/login')
},
toggleSpeed(){
qbit.toggleSpeedLimitsMode()
} }
}, },
computed: { computed: {
...mapState(['stats', 'selected_torrents']), ...mapState(['stats', 'selected_torrents']),
...mapGetters(['getTheme']), ...mapGetters(['getTheme', 'getStats']),
theme() { theme() {
return this.getTheme() ? 'Dark' : 'Light' return this.getTheme() ? 'Dark' : 'Light'
},
altSpeed(){
return this.getStats().altSpeed
} }
}, },
created() { created() {

View file

@ -7,6 +7,7 @@ export default class Stat {
this.dlspeed = this.formatBytes(data.dl_info_speed, 1) this.dlspeed = this.formatBytes(data.dl_info_speed, 1)
this.upspeed = this.formatBytes(data.up_info_speed, 1) this.upspeed = this.formatBytes(data.up_info_speed, 1)
this.freeDiskSpace = this.formatBytes(data.free_space_on_disk) this.freeDiskSpace = this.formatBytes(data.free_space_on_disk)
this.altSpeed = data.use_alt_speed_limits
} }
} }

View file

@ -42,7 +42,8 @@ export default new Vuex.Store({
state.selected_torrents.includes(hash), state.selected_torrents.includes(hash),
getTheme: state => () => state.darkTheme, getTheme: state => () => state.darkTheme,
getModalState: state => name => state.modals[name.toLowerCase()], getModalState: state => name => state.modals[name.toLowerCase()],
getSettings: state => () => state.settings getSettings: state => () => state.settings,
getStats: state => () => state.stats
}, },
mutations: { mutations: {