Added option to set background image (fixes #1)

This commit is contained in:
Eric Kotato 2018-05-31 03:10:54 +03:00
parent b34e5d9570
commit 9540ce5e1c
2 changed files with 22 additions and 0 deletions

View file

@ -6,6 +6,7 @@ Rectangle
{ {
id: root id: root
color: config.color_bg color: config.color_bg
property variant geometry: screenModel.geometry(screenModel.primary)
state: "stateUsers" state: "stateUsers"
states: states:
@ -14,6 +15,8 @@ Rectangle
{ {
name: "statePower" name: "statePower"
PropertyChanges { target: background; x: 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 }
PropertyChanges { target: pageUsers; enabled: false; focus: false; x: areaMain.width * 2 } PropertyChanges { target: pageUsers; enabled: false; focus: false; x: areaMain.width * 2 }
@ -27,6 +30,8 @@ Rectangle
{ {
name: "stateSessions" name: "stateSessions"
PropertyChanges { target: background; x: geometry.x - 20 }
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 }
PropertyChanges { target: pageUsers; enabled: false; focus: false; x: areaMain.width } PropertyChanges { target: pageUsers; enabled: false; focus: false; x: areaMain.width }
@ -39,6 +44,8 @@ Rectangle
{ {
name: "stateUsers" name: "stateUsers"
PropertyChanges { target: background; x: geometry.x - 40 }
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 }
PropertyChanges { target: pageUsers; enabled: true ; focus: true ; x: 0 } PropertyChanges { target: pageUsers; enabled: true ; focus: true ; x: 0 }
@ -51,6 +58,20 @@ Rectangle
TextConstants { id: localeText } TextConstants { id: localeText }
Background
{
id: background
x: geometry.x - 40
y: geometry.y
width: geometry.width + 40
height: geometry.height
source: config.background
fillMode: Image.PreserveAspectCrop
visible: status != Image.Error
Behavior on x { NumberAnimation { duration: 150 } }
}
Item Item
{ {
id: areaTop id: areaTop

View file

@ -1,5 +1,6 @@
[General] [General]
font=Roboto font=Roboto
background=
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