New option: parallax_bg_shift

This commit is contained in:
Eric Kotato 2018-06-06 15:20:50 +03:00
parent 42f94cce03
commit 87f27c4550
3 changed files with 7 additions and 5 deletions

View file

@ -20,6 +20,7 @@ Create file `theme.conf.user` in theme folder. See `slice/theme.conf` for refere
* `font` - overall font. Defaults to `Roboto`. * `font` - overall font. Defaults to `Roboto`.
* `background` - path to background image. If not set, falls back to `color_bg`. Not set by default. * `background` - path to background image. If not set, falls back to `color_bg`. Not set by default.
* `parallax_bg_shift` - shifting of parallax background on tab change in pixels. `0` disables parallax motion. Negative values will scroll background in opposite direction. Default is `20`.
* `color_bg` - main background color. Defaults to `#222222`. * `color_bg` - main background color. Defaults to `#222222`.
* `color_button_bg_idle` - button background color (in idle state). Defaults to `#888888`. * `color_button_bg_idle` - button background color (in idle state). Defaults to `#888888`.
* `color_button_bg_hover` - button background color (in hover state). Defaults to `#aaaaaa`. * `color_button_bg_hover` - button background color (in hover state). Defaults to `#aaaaaa`.

View file

@ -15,7 +15,7 @@ Rectangle
{ {
name: "statePower" name: "statePower"
PropertyChanges { target: background; x: geometry.x } PropertyChanges { target: background; x: (config.parallax_bg_shift < 0 ? geometry.x - Math.abs(config.parallax_bg_shift*2) : geometry.x ) }
PropertyChanges { target: pagePower; enabled: true ; focus: true ; x: 0 } PropertyChanges { target: pagePower; enabled: true ; focus: true ; x: 0 }
PropertyChanges { target: pageSessions; enabled: false; focus: false; x: areaMain.width } PropertyChanges { target: pageSessions; enabled: false; focus: false; x: areaMain.width }
@ -30,7 +30,7 @@ Rectangle
{ {
name: "stateSessions" name: "stateSessions"
PropertyChanges { target: background; x: geometry.x - 20 } PropertyChanges { target: background; x: geometry.x - Math.abs(config.parallax_bg_shift) }
PropertyChanges { target: pagePower; enabled: false; focus: false; x: -areaMain.width } PropertyChanges { target: pagePower; enabled: false; focus: false; x: -areaMain.width }
PropertyChanges { target: pageSessions; enabled: true ; focus: true ; x: 0 } PropertyChanges { target: pageSessions; enabled: true ; focus: true ; x: 0 }
@ -44,7 +44,7 @@ Rectangle
{ {
name: "stateUsers" name: "stateUsers"
PropertyChanges { target: background; x: geometry.x - 40 } PropertyChanges { target: background; x: (config.parallax_bg_shift > 0 ? geometry.x - Math.abs(config.parallax_bg_shift*2) : geometry.x ) }
PropertyChanges { target: pagePower; enabled: false; focus: false; x: -areaMain.width * 2 } PropertyChanges { target: pagePower; enabled: false; focus: false; x: -areaMain.width * 2 }
PropertyChanges { target: pageSessions; enabled: false; focus: false; x: -areaMain.width } PropertyChanges { target: pageSessions; enabled: false; focus: false; x: -areaMain.width }
@ -61,9 +61,9 @@ Rectangle
Background Background
{ {
id: background id: background
x: geometry.x - 40 x: (config.parallax_bg_shift > 0 ? geometry.x - Math.abs(config.parallax_bg_shift*2) : geometry.x )
y: geometry.y y: geometry.y
width: geometry.width + 40 width: geometry.width + Math.abs(config.parallax_bg_shift*2)
height: geometry.height height: geometry.height
source: config.background source: config.background
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop

View file

@ -1,6 +1,7 @@
[General] [General]
font=Roboto font=Roboto
background= background=
parallax_bg_shift=20
color_bg=#222222 color_bg=#222222
color_button_bg_idle=#888888 color_button_bg_idle=#888888
color_button_bg_hover=#aaaaaa color_button_bg_hover=#aaaaaa