Disable settings depending on others and move default profile logic

This commit is contained in:
Preston 2020-10-06 09:38:35 -04:00
parent 5fd64afdb2
commit 382405cdfe
14 changed files with 66 additions and 16 deletions

View File

@ -70,6 +70,15 @@ export default Vue.extend({
}, },
searchSettings: function () { searchSettings: function () {
return this.$store.getters.getSearchSettings return this.$store.getters.getSearchSettings
},
profileList: function () {
return this.$store.getters.getProfileList
},
activeProfile: function () {
return this.$store.getters.getActiveProfile
},
defaultProfile: function () {
return this.$store.getters.getDefaultProfile
} }
}, },
mounted: function () { mounted: function () {
@ -256,8 +265,6 @@ export default Vue.extend({
enableCliPing: function () { enableCliPing: function () {
const v = this const v = this
electron.ipcRenderer.on('ping', function (event, message) { electron.ipcRenderer.on('ping', function (event, message) {
console.log('ping!')
console.log(message)
let url = message[message.length - 1] let url = message[message.length - 1]
if (url) { if (url) {
url = url.replace('freetube://', '') url = url.replace('freetube://', '')

View File

@ -42,6 +42,15 @@ export default Vue.extend({
} }
}, },
methods: { methods: {
handleHideRecommendedVideos: function (value) {
if (value) {
this.updatePlayNextVideo(false)
this.updateDefaultTheatreMode(true)
}
this.updateHideRecommendedVideos(value)
},
...mapActions([ ...mapActions([
'updateHideVideoViews', 'updateHideVideoViews',
'updateHideVideoLikesAndDislikes', 'updateHideVideoLikesAndDislikes',
@ -50,7 +59,9 @@ export default Vue.extend({
'updateHideRecommendedVideos', 'updateHideRecommendedVideos',
'updateHideTrendingVideos', 'updateHideTrendingVideos',
'updateHidePopularVideos', 'updateHidePopularVideos',
'updateHideLiveChat' 'updateHideLiveChat',
'updatePlayNextVideo',
'updateDefaultTheatreMode'
]) ])
} }
}) })

View File

@ -39,7 +39,7 @@
:label="$t('Settings.Distraction Free Settings.Hide Recommended Videos')" :label="$t('Settings.Distraction Free Settings.Hide Recommended Videos')"
:compact="true" :compact="true"
:default-value="hideRecommendedVideos" :default-value="hideRecommendedVideos"
@change="updateHideRecommendedVideos" @change="handleHideRecommendedVideos"
/> />
<ft-toggle-switch <ft-toggle-switch
:label="$t('Settings.Distraction Free Settings.Hide Trending Videos')" :label="$t('Settings.Distraction Free Settings.Hide Trending Videos')"

View File

@ -36,16 +36,6 @@ export default Vue.extend({
} }
}, },
mounted: function () { mounted: function () {
setTimeout(() => {
const profileIndex = this.profileList.findIndex((profile) => {
return profile._id === this.defaultProfile
})
if (profileIndex !== -1) {
this.updateActiveProfile(profileIndex)
}
}, 200)
$('#profileList').focusout(() => { $('#profileList').focusout(() => {
$('#profileList')[0].style.display = 'none' $('#profileList')[0].style.display = 'none'
}) })

View File

@ -14,6 +14,10 @@ export default Vue.extend({
compact: { compact: {
type: Boolean, type: Boolean,
default: false default: false
},
disabled: {
type: Boolean,
default: false
} }
}, },
data: function () { data: function () {

View File

@ -50,6 +50,9 @@
.switch-input:checked + & .switch-input:checked + &
background-color: var(--accent-color-light) background-color: var(--accent-color-light)
.switch-input:disabled + &
background-color: #9E9E9E
&:after &:after
left: 0 left: 0
width: 20px width: 20px
@ -63,3 +66,6 @@
-ms-transform: translate(80%, -50%) -ms-transform: translate(80%, -50%)
-webkit-transform: translate(80%, -50%) -webkit-transform: translate(80%, -50%)
transform: translate(80%, -50%) transform: translate(80%, -50%)
.switch-input:disabled + &
background-color: #BDBDBD

View File

@ -10,6 +10,7 @@
name="set-name" name="set-name"
class="switch-input" class="switch-input"
:checked="currentValue" :checked="currentValue"
:disabled="disabled"
@change="$emit('change', currentValue)" @change="$emit('change', currentValue)"
> >
<label <label

View File

@ -78,6 +78,10 @@ export default Vue.extend({
return this.$store.getters.getDefaultTheatreMode return this.$store.getters.getDefaultTheatreMode
}, },
hideRecommendedVideos: function () {
return this.$store.getters.getHideRecommendedVideos
},
formatNames: function () { formatNames: function () {
return [ return [
this.$t('Settings.Player Settings.Default Video Format.Dash Formats'), this.$t('Settings.Player Settings.Default Video Format.Dash Formats'),

View File

@ -31,6 +31,7 @@
<ft-toggle-switch <ft-toggle-switch
:label="$t('Settings.Player Settings.Enable Theatre Mode by Default')" :label="$t('Settings.Player Settings.Enable Theatre Mode by Default')"
:compact="true" :compact="true"
:disabled="hideRecommendedVideos"
:default-value="defaultTheatreMode" :default-value="defaultTheatreMode"
@change="updateDefaultTheatreMode" @change="updateDefaultTheatreMode"
/> />
@ -51,6 +52,7 @@
<ft-toggle-switch <ft-toggle-switch
:label="$t('Settings.Player Settings.Play Next Video')" :label="$t('Settings.Player Settings.Play Next Video')"
:compact="true" :compact="true"
:disabled="hideRecommendedVideos"
:default-value="playNextVideo" :default-value="playNextVideo"
@change="updatePlayNextVideo" @change="updatePlayNextVideo"
/> />

View File

@ -58,6 +58,14 @@ export default Vue.extend({
} }
}, },
handleRememberHistory: function (value) {
if (!value) {
this.updateSaveWatchedProgress(false)
}
this.updateRememberHistory(value)
},
handleRemoveHistory: function (option) { handleRemoveHistory: function (option) {
this.showRemoveHistoryPrompt = false this.showRemoveHistoryPrompt = false

View File

@ -11,13 +11,14 @@
:label="$t('Settings.Privacy Settings.Remember History')" :label="$t('Settings.Privacy Settings.Remember History')"
:compact="true" :compact="true"
:default-value="rememberHistory" :default-value="rememberHistory"
@change="updateRememberHistory" @change="handleRememberHistory"
/> />
</div> </div>
<div class="switchColumn"> <div class="switchColumn">
<ft-toggle-switch <ft-toggle-switch
:label="$t('Settings.Privacy Settings.Save Watched Progress')" :label="$t('Settings.Privacy Settings.Save Watched Progress')"
:compact="true" :compact="true"
:disabled="!rememberHistory"
:default-value="saveWatchedProgress" :default-value="saveWatchedProgress"
@change="updateSaveWatchedProgress" @change="updateSaveWatchedProgress"
/> />

View File

@ -95,6 +95,10 @@ export default Vue.extend({
return this.$store.getters.getActiveProfile return this.$store.getters.getActiveProfile
}, },
hideRecommendedVideos: function () {
return this.$store.getters.getHideRecommendedVideos
},
formatTypeNames: function () { formatTypeNames: function () {
return [ return [
this.$t('Change Format.Use Dash Formats').toUpperCase(), this.$t('Change Format.Use Dash Formats').toUpperCase(),

View File

@ -60,6 +60,7 @@
</div> </div>
<div class="videoOptions"> <div class="videoOptions">
<ft-icon-button <ft-icon-button
v-if="!hideRecommendedVideos"
:title="$t('Toggle Theatre Mode')" :title="$t('Toggle Theatre Mode')"
class="theatreModeButton option" class="theatreModeButton option"
icon="expand-alt" icon="expand-alt"

View File

@ -46,7 +46,7 @@ const getters = {
} }
const actions = { const actions = {
grabAllProfiles ({ dispatch, commit }, defaultName = null) { grabAllProfiles ({ rootState, dispatch, commit }, defaultName = null) {
profileDb.find({}, (err, results) => { profileDb.find({}, (err, results) => {
if (!err) { if (!err) {
if (results.length === 0) { if (results.length === 0) {
@ -65,6 +65,17 @@ const actions = {
return b.name - a.name return b.name - a.name
}) })
if (state.profileList.length < profiles.length) {
const profileIndex = profiles.findIndex((profile) => {
return profile._id === rootState.settings.defaultProfile
})
if (profileIndex !== -1) {
dispatch('updateActiveProfile', profileIndex)
}
}
commit('setProfileList', profiles) commit('setProfileList', profiles)
} }
} }