New option: bg_mode
This commit is contained in:
parent
87f27c4550
commit
38494c1b9a
3 changed files with 21 additions and 1 deletions
|
|
@ -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.
|
||||||
|
* `bg_mode` - background image fill mode. Can be either `aspect`, `fill`, `tile` or `none`. Defaults to `aspect`.
|
||||||
* `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`.
|
* `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`.
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,24 @@ Rectangle
|
||||||
|
|
||||||
TextConstants { id: localeText }
|
TextConstants { id: localeText }
|
||||||
|
|
||||||
|
function bgFillMode() {
|
||||||
|
|
||||||
|
switch(config.bg_mode)
|
||||||
|
{
|
||||||
|
case "aspect":
|
||||||
|
return Image.PreserveAspectCrop;
|
||||||
|
|
||||||
|
case "fill":
|
||||||
|
return Image.Stretch;
|
||||||
|
|
||||||
|
case "tile":
|
||||||
|
return Image.Tile;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return Image.Pad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Background
|
Background
|
||||||
{
|
{
|
||||||
id: background
|
id: background
|
||||||
|
|
@ -66,7 +84,7 @@ Rectangle
|
||||||
width: geometry.width + Math.abs(config.parallax_bg_shift*2)
|
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: bgFillMode()
|
||||||
visible: status != Image.Error
|
visible: status != Image.Error
|
||||||
|
|
||||||
Behavior on x { NumberAnimation { duration: 150 } }
|
Behavior on x { NumberAnimation { duration: 150 } }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
[General]
|
[General]
|
||||||
font=Roboto
|
font=Roboto
|
||||||
background=
|
background=
|
||||||
|
bg_mode=aspect
|
||||||
parallax_bg_shift=20
|
parallax_bg_shift=20
|
||||||
color_bg=#222222
|
color_bg=#222222
|
||||||
color_button_bg_idle=#888888
|
color_button_bg_idle=#888888
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue