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 () {
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 () {
@ -256,8 +265,6 @@ export default Vue.extend({
enableCliPing: function () {
const v = this
electron.ipcRenderer.on('ping', function (event, message) {
console.log('ping!')
console.log(message)
let url = message[message.length - 1]
if (url) {
url = url.replace('freetube://', '')

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@ const getters = {
}
const actions = {
grabAllProfiles ({ dispatch, commit }, defaultName = null) {
grabAllProfiles ({ rootState, dispatch, commit }, defaultName = null) {
profileDb.find({}, (err, results) => {
if (!err) {
if (results.length === 0) {
@ -65,6 +65,17 @@ const actions = {
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)
}
}