From 194c13c9a7532c27b339b35fc3d3bf6049045796 Mon Sep 17 00:00:00 2001 From: David Fumberger Date: Sat, 10 Apr 2021 15:37:14 +1000 Subject: [PATCH] Added battery indicator support - Added support for battery indicator. - Fixed layout when Pegasus is not in fullscreen mode. - Time and battery now only will show when in fullscreen mode. --- assets/images/battery-dark.png | Bin 0 -> 255 bytes assets/images/battery.png | Bin 0 -> 270 bytes components/BatteryIndicator.qml | 32 ++++++++++++++++++++++++++++++++ components/HeaderHome.qml | 29 +++++++++++++++++++++++++---- components/SystemsListLarge.qml | 4 ++-- theme.qml | 4 ++-- 6 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 assets/images/battery-dark.png create mode 100644 assets/images/battery.png create mode 100644 components/BatteryIndicator.qml diff --git a/assets/images/battery-dark.png b/assets/images/battery-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..f7c4ff9610661d4b8e7afb9c2726a0f2f1437fc8 GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^(m>3|!3HGnolma?Qk(@Ik;M!Q+`=Ht$S`Y;1W=H% zILO_JVcj{Imp~3nx}&cn1H;CC?mvmFK>id@7srqa#=BE4^13<*xaP-+EMS>?Vzq;| zl>>W-6Z;AV(F=@P5B%O77n(o$XThY+@|#ckq;0Z3;OZ7$rD3^yjyaR~nN0WU7ZY~O zvDW>|{c=U49dqvA1O06!Eq2nq^Nya`przKYw)Kt9pC=O5R%{y{>bL)tcxr#-g8HIv y`3Z($JHor&dy8e6NR&$+vKN-Ond@#AA_f>pUXO@geCxM=UMgu literal 0 HcmV?d00001 diff --git a/assets/images/battery.png b/assets/images/battery.png new file mode 100644 index 0000000000000000000000000000000000000000..4d07775267aae800292d32193b67b4d083f4f2c9 GIT binary patch literal 270 zcmeAS@N?(olHy`uVBq!ia0vp^(m>3|!3HGnolma?Qk(@Ik;M!Q+`=Ht$S`Y;1W=H% zILO_JVcj{Imp~3nx}&cn1H;CC?mvmFK>lJ+7srqa#=TSia~^WwX)V6QXys(C>Gwd( z%JDUuRcBtp+yhpPc?;$${AF_2yk74tSHn{DL2mkQ#io$0&GUb~Or96C;?!9=wu-KP zzGt1^rv&ZNxw~iaZVT@7;x^az%3d+(+W+sul*GhUDh_4I8p}`2y}B^Dhf6wv$I|%T zt$SHNB;ML?d9= 480 + } + + property var showBattery : { + return showStatusInfo && (api.device != null && api.device.batteryPercent) + } + id: home_header color: "transparent" width: parent.width @@ -86,17 +94,30 @@ Rectangle { KeyNavigation.down: mainFocus } + + BatteryIndicator { + id: battery_indicator + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: 20 + anchors.rightMargin: 32 + opacity: 0.5 + lightStyle: light + visible: showBattery + } + Text { id: header_time text: Qt.formatTime(new Date(), "hh:mm") - anchors.right: parent.right + anchors.right: parent.right anchors.top: parent.top anchors.topMargin: 16 - anchors.rightMargin: 32 + anchors.rightMargin: showBattery ? 70 : 32 color: light ? "#60ffffff" : "#60000000" font.pixelSize: 18 font.letterSpacing: -0.3 - font.bold: true + font.bold: true + visible: showStatusInfo } - + } \ No newline at end of file diff --git a/components/SystemsListLarge.qml b/components/SystemsListLarge.qml index 909db15..489b4df 100644 --- a/components/SystemsListLarge.qml +++ b/components/SystemsListLarge.qml @@ -74,8 +74,8 @@ ListView { Rectangle { property int bgIndex: -1 id: systemsBackground - width: 640 - height: 480 + width: layoutScreen.width + height: layoutScreen.height anchors.top: parent.top anchors.left: parent.left anchors.topMargin: -55 diff --git a/theme.qml b/theme.qml index cd84011..31d9c39 100644 --- a/theme.qml +++ b/theme.qml @@ -214,7 +214,7 @@ FocusScope { property var layoutScreen : { "width": 640, - "height": 480, + "height": parent.height, "background": theme.background, } @@ -235,7 +235,7 @@ FocusScope { property var layoutContainer : { "width": layoutScreen.width, - "height": layoutScreen.height - layoutHeader.height - layoutHeader.height, + "height": parent.height - layoutHeader.height - layoutHeader.height, "background": "transparent", }