diff --git a/README.md b/README.md index 3596431..391eca4 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Create file `theme.conf.user` in theme folder. See `slice/theme.conf` for refere * `font` - overall font. Defaults to `Roboto`. * `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`. * `color_bg` - main background color. Defaults to `#222222`. * `color_button_bg_idle` - button background color (in idle state). Defaults to `#888888`. diff --git a/slice/Main.qml b/slice/Main.qml index bbddec6..a615a6d 100644 --- a/slice/Main.qml +++ b/slice/Main.qml @@ -58,6 +58,24 @@ Rectangle 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 { id: background @@ -66,7 +84,7 @@ Rectangle width: geometry.width + Math.abs(config.parallax_bg_shift*2) height: geometry.height source: config.background - fillMode: Image.PreserveAspectCrop + fillMode: bgFillMode() visible: status != Image.Error Behavior on x { NumberAnimation { duration: 150 } } diff --git a/slice/theme.conf b/slice/theme.conf index 1066c4e..80a7e9d 100644 --- a/slice/theme.conf +++ b/slice/theme.conf @@ -1,6 +1,7 @@ [General] font=Roboto background= +bg_mode=aspect parallax_bg_shift=20 color_bg=#222222 color_button_bg_idle=#888888