Skip to content

Commit

Permalink
feat: add Option to set opacity of not available scenes in scene list (
Browse files Browse the repository at this point in the history
…xbapps#1453)

Co-authored-by: crwxaj <52156245+crwxaj@users.noreply.github.com>
  • Loading branch information
toshski and crwxaj authored Nov 5, 2023
1 parent eb8cd13 commit 9e493d8
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 4 deletions.
2 changes: 2 additions & 0 deletions pkg/api/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type RequestSaveOptionsWeb struct {
SceneTrailerlist bool `json:"sceneTrailerlist"`
ShowScriptHeatmap bool `json:"showScriptHeatmap"`
UpdateCheck bool `json:"updateCheck"`
IsAvailOpacity int `json:"isAvailOpacity"`
}

type RequestSaveOptionsAdvanced struct {
Expand Down Expand Up @@ -382,6 +383,7 @@ func (i ConfigResource) saveOptionsWeb(req *restful.Request, resp *restful.Respo
config.Config.Web.SceneTrailerlist = r.SceneTrailerlist
config.Config.Web.ShowScriptHeatmap = r.ShowScriptHeatmap
config.Config.Web.UpdateCheck = r.UpdateCheck
config.Config.Web.IsAvailOpacity = r.IsAvailOpacity
config.SaveConfig()

resp.WriteHeaderAndEntity(http.StatusOK, r)
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type ObjectConfig struct {
SceneTrailerlist bool `default:"true" json:"sceneTrailerlist"`
ShowScriptHeatmap bool `default:"true" json:"showScriptHeatmap"`
UpdateCheck bool `default:"true" json:"updateCheck"`
IsAvailOpacity int `default:"40" json:"isAvailOpacity"`
} `json:"web"`
Advanced struct {
ShowInternalSceneId bool `default:"false" json:"showInternalSceneId"`
Expand Down
1 change: 1 addition & 0 deletions pkg/config/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type ObjectState struct {
SceneTrailerlist bool `json:"sceneTrailerlist"`
ShowScriptHeatmap bool `json:"showScriptHeatmap"`
UpdateCheck bool `json:"updateCheck"`
IsAvailOpacity int `json:"isAvailOpacity"`
} `json:"web"`
DLNA struct {
Running bool `json:"running"`
Expand Down
4 changes: 4 additions & 0 deletions ui/src/store/optionsWeb.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const state = {
showHspFile: true,
showSubtitlesFile: true,
sceneTrailerlist: true,
updateCheck: true,
isAvailOpacity: 40,
showScriptHeatmap: false,
updateCheck: true
}
Expand Down Expand Up @@ -42,6 +44,7 @@ const actions = {
state.web.sceneTrailerlist = data.config.web.sceneTrailerlist
state.web.showScriptHeatmap = data.config.web.showScriptHeatmap
state.web.updateCheck = data.config.web.updateCheck
state.web.isAvailOpacity = data.config.web.isAvailOpacity
state.loading = false
})
},
Expand All @@ -64,6 +67,7 @@ const actions = {
state.web.sceneTrailerlist = data.sceneTrailerlist
state.web.showScriptHeatmap = data.showScriptHeatmap
state.web.updateCheck = data.updateCheck
state.web.isAvailOpacity = data.isAvailOpacity
state.loading = false
})
}
Expand Down
8 changes: 7 additions & 1 deletion ui/src/views/actors/ActorCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="card is-shadowless">
<div class="card-image">
<div class="bbox"
v-bind:style="{backgroundImage: `url(${getImageURL(actor.image_url)})`, backgroundSize: 'contain', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', opacity:isAvailable(actor) ? 1.0 : 0.4}"
v-bind:style="{backgroundImage: `url(${getImageURL(actor.image_url)})`, backgroundSize: 'contain', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', opacity:isAvailable(actor) ? 1.0 : isAvailOpactiy}"
@click="showDetails(actor)"
@mouseover="preview = true"
@mouseleave="preview = false">
Expand Down Expand Up @@ -69,6 +69,12 @@ export default {
}
},
computed: {
isAvailOpactiy () {
if (this.$store.state.optionsWeb.web.isAvailOpacity == undefined) {
return .4
}
return this.$store.state.optionsWeb.web.isAvailOpacity / 100
},
},
methods: {
getImageURL (u) {
Expand Down
19 changes: 18 additions & 1 deletion ui/src/views/options/sections/InterfaceWeb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@
show subtitles File button
</b-switch>
</b-field>
<b-field label="Opacity of unavailable scenes">
<div class="columns">
<div class="column is-two-thirds">
<b-slider :min="0" :max="100" :step="10" :tooltip="false" v-model="isAvailOpacity" opacity:isAvailOpacity></b-slider>
</div>
</div>
<b-field>
<b-switch v-model="ScriptHeatmap" type="is-dark">
show Script Heatmap
Expand Down Expand Up @@ -221,9 +227,20 @@ export default {
this.$store.state.optionsWeb.web.showSubtitlesFile = value
}
},
isAvailOpacity: {
get () {
if (this.$store.state.optionsWeb.web.isAvailOpacity == undefined) {
return 40
}
return this.$store.state.optionsWeb.web.isAvailOpacity
},
set (value) {
this.$store.state.optionsWeb.web.isAvailOpacity = value
}
},
isLoading: function () {
return this.$store.state.optionsWeb.loading
}
}
}
}
</script>
Expand Down
10 changes: 8 additions & 2 deletions ui/src/views/scenes/SceneCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="card is-shadowless">
<div class="card-image">
<div class="bbox"
v-bind:style="{backgroundImage: `url(${getImageURL(item.cover_url)})`, backgroundSize: 'contain', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', opacity:item.is_available ? 1.0 : 0.4}"
v-bind:style="{backgroundImage: `url(${getImageURL(item.cover_url)})`, backgroundSize: 'contain', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', opacity:item.is_available ? 1.0 : this.isAvailOpactiy}"
@click="showDetails(item)"
@mouseover="preview = true"
@mouseleave="preview = false">
Expand Down Expand Up @@ -134,7 +134,13 @@ export default {
}
})
return count
}
},
isAvailOpactiy () {
if (this.$store.state.optionsWeb.web.isAvailOpacity == undefined) {
return .4
}
return this.$store.state.optionsWeb.web.isAvailOpacity / 100
},
},
methods: {
getImageURL (u) {
Expand Down

0 comments on commit 9e493d8

Please sign in to comment.