From 5a772505b1f3645ee7d1d0d0dd71a95555b7283f Mon Sep 17 00:00:00 2001 From: bbedward Date: Wed, 13 Aug 2025 19:09:40 -0400 Subject: [PATCH] re-factor battery popout to not be scrollable --- Modules/Lock/LockScreenContent.qml | 30 +++++++++++++++++++++++++++++- Modules/TopBar/BatteryPopout.qml | 30 ++++++++++++------------------ 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/Modules/Lock/LockScreenContent.qml b/Modules/Lock/LockScreenContent.qml index cba8b417..d9604a80 100644 --- a/Modules/Lock/LockScreenContent.qml +++ b/Modules/Lock/LockScreenContent.qml @@ -19,7 +19,35 @@ Item { property bool unlocking: false property var powerModal: null property string confirmAction: "" - property var facts: ["Light takes 100,000 years to escape the Sun's core, then just 8 minutes to reach us.", "A teaspoon of neutron star matter would weigh a billion tons here on Earth.", "Right now, 100 trillion solar neutrinos are passing through your body every second.", "The Sun burns 4 million tons of itself into pure energy every second.", "The universe still glows with leftover heat from the Big Bang—just 2.7 degrees above absolute zero.", "There's a nebula out there that's actually colder than empty space itself.", "We've detected black holes crashing together by measuring spacetime stretch by less than 1/10,000th the width of a proton.", "Some cosmic radio bursts release more energy in milliseconds than our Sun does in days.", "Our galaxy might be crawling with billions of rogue planets drifting alone in the dark.", "Distant galaxies can move away from us faster than light because space itself is stretching.", "The edge of what we can see is 46.5 billion light-years away, even though the universe is only 13.8 billion years old.", "The universe is mostly invisible: 5% regular matter, 27% dark matter, 68% dark energy.", "A day on Venus lasts longer than its entire year around the Sun.", "On Mercury, the time between sunrises is 176 Earth days long.", "In about 4.5 billion years, our galaxy will smash into Andromeda.", "Most of the gold in your jewelry was forged when neutron stars collided somewhere in space.", "A black hole the mass of our Sun would take longer to evaporate than the current age of the universe... times a trillion trillion trillion trillion trillion.", "The fastest spinning star we know rotates 716 times per second.", "Cosmic rays create particles that shouldn't make it to Earth's surface, but time dilation lets them sneak through.", "Jupiter's magnetic field is so huge that if we could see it, it would look bigger than the Moon in our sky."] + property var facts: [ + "Light takes 100,000 years to escape the Sun's core, then just 8 minutes to reach us.", + "A teaspoon of neutron star matter would weigh a billion tons here on Earth.", + "Right now, 100 trillion solar neutrinos are passing through your body every second.", + "The Sun burns 4 million tons of itself into pure energy every second.", + "The universe still glows with leftover heat from the Big Bang—just 2.7 degrees above absolute zero.", + "There's a nebula out there that's actually colder than empty space itself.", + "We've detected black holes crashing together by measuring spacetime stretch by less than 1/10,000th the width of a proton.", + "Some cosmic radio bursts release more energy in milliseconds than our Sun does in days.", + "Our galaxy might be crawling with billions of rogue planets drifting alone in the dark.", + "Distant galaxies can move away from us faster than light because space itself is stretching.", + "The edge of what we can see is 46.5 billion light-years away, even though the universe is only 13.8 billion years old.", + "The universe is mostly invisible: 5% regular matter, 27% dark matter, 68% dark energy.", + "A day on Venus lasts longer than its entire year around the Sun.", + "On Mercury, the time between sunrises is 176 Earth days long.", + "In about 4.5 billion years, our galaxy will smash into Andromeda.", + "Most of the gold in your jewelry was forged when neutron stars collided somewhere in space.", + "The fastest spinning star we know rotates 716 times per second.", + "Cosmic rays create particles that shouldn't make it to Earth's surface, but time dilation lets them sneak through.", + "Jupiter's magnetic field is so huge that if we could see it, it would look bigger than the Moon in our sky.", + "Space is as empty as a 20-mile cube with a single grain of sand in it.", + "Voyager 1 launched in 1977—50 years later, it just barely left our solar system.", + "Counting to 2 septillion at one number per second takes the universe's age x 4.6 million.", + "A neutron star the size of your fist can spin 716 times per second.", + "After stars burn out, the universe will last trillions more years before black holes vanish.", + "Space is so vast, even speeding at light-speed, you'd never return past the cosmic horizon.", + "Space and time are linked: speeding through space slows your flow through time.", + "Ethyl formate found in the Milky Way smells like raspberries and rum." + ]; property string randomFact: "" signal unlockRequested() diff --git a/Modules/TopBar/BatteryPopout.qml b/Modules/TopBar/BatteryPopout.qml index d60010a9..26f978e7 100644 --- a/Modules/TopBar/BatteryPopout.qml +++ b/Modules/TopBar/BatteryPopout.qml @@ -76,9 +76,6 @@ PanelWindow { readonly property real screenHeight: root.screen ? root.screen.height : Screen.height readonly property real targetWidth: Math.min( 380, screenWidth - Theme.spacingL * 2) - readonly property real targetHeight: Math.min( - 450, - screenHeight - Theme.barHeight - Theme.spacingS * 2) readonly property real calculatedX: { var centerX = root.triggerX + (root.triggerWidth / 2) - (targetWidth / 2) @@ -101,7 +98,7 @@ PanelWindow { asynchronous: true active: batteryPopupVisible width: targetWidth - height: targetHeight + height: item ? item.implicitHeight : 0 x: calculatedX y: root.triggerY opacity: batteryPopupVisible ? 1 : 0 @@ -124,6 +121,7 @@ PanelWindow { } sourceComponent: Rectangle { + implicitHeight: contentColumn.height + Theme.spacingL * 2 color: Theme.popupBackground() radius: Theme.cornerRadius border.color: Theme.outlineMedium @@ -181,17 +179,17 @@ PanelWindow { z: -1 } - ScrollView { - anchors.fill: parent + Column { + id: contentColumn + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top anchors.margins: Theme.spacingL - clip: true + spacing: Theme.spacingL - Column { - width: parent.width - spacing: Theme.spacingL - - Row { + Item { width: parent.width + height: 32 StyledText { text: BatteryService.batteryAvailable ? "Battery Information" : "Power Management" @@ -201,16 +199,13 @@ PanelWindow { anchors.verticalCenter: parent.verticalCenter } - Item { - width: parent.width - 200 - height: 1 - } - Rectangle { width: 32 height: 32 radius: 16 color: closeBatteryArea.containsMouse ? Theme.errorHover : "transparent" + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter DankIcon { anchors.centerIn: parent @@ -601,7 +596,6 @@ PanelWindow { } } } - } } } }