mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-07 05:55:37 -05:00
re-factor battery popout to not be scrollable
This commit is contained in:
@@ -19,7 +19,35 @@ Item {
|
|||||||
property bool unlocking: false
|
property bool unlocking: false
|
||||||
property var powerModal: null
|
property var powerModal: null
|
||||||
property string confirmAction: ""
|
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: ""
|
property string randomFact: ""
|
||||||
|
|
||||||
signal unlockRequested()
|
signal unlockRequested()
|
||||||
|
|||||||
@@ -76,9 +76,6 @@ PanelWindow {
|
|||||||
readonly property real screenHeight: root.screen ? root.screen.height : Screen.height
|
readonly property real screenHeight: root.screen ? root.screen.height : Screen.height
|
||||||
readonly property real targetWidth: Math.min(
|
readonly property real targetWidth: Math.min(
|
||||||
380, screenWidth - Theme.spacingL * 2)
|
380, screenWidth - Theme.spacingL * 2)
|
||||||
readonly property real targetHeight: Math.min(
|
|
||||||
450,
|
|
||||||
screenHeight - Theme.barHeight - Theme.spacingS * 2)
|
|
||||||
readonly property real calculatedX: {
|
readonly property real calculatedX: {
|
||||||
var centerX = root.triggerX + (root.triggerWidth / 2) - (targetWidth / 2)
|
var centerX = root.triggerX + (root.triggerWidth / 2) - (targetWidth / 2)
|
||||||
|
|
||||||
@@ -101,7 +98,7 @@ PanelWindow {
|
|||||||
asynchronous: true
|
asynchronous: true
|
||||||
active: batteryPopupVisible
|
active: batteryPopupVisible
|
||||||
width: targetWidth
|
width: targetWidth
|
||||||
height: targetHeight
|
height: item ? item.implicitHeight : 0
|
||||||
x: calculatedX
|
x: calculatedX
|
||||||
y: root.triggerY
|
y: root.triggerY
|
||||||
opacity: batteryPopupVisible ? 1 : 0
|
opacity: batteryPopupVisible ? 1 : 0
|
||||||
@@ -124,6 +121,7 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceComponent: Rectangle {
|
sourceComponent: Rectangle {
|
||||||
|
implicitHeight: contentColumn.height + Theme.spacingL * 2
|
||||||
color: Theme.popupBackground()
|
color: Theme.popupBackground()
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
border.color: Theme.outlineMedium
|
border.color: Theme.outlineMedium
|
||||||
@@ -181,17 +179,17 @@ PanelWindow {
|
|||||||
z: -1
|
z: -1
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Theme.spacingL
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: parent.width
|
id: contentColumn
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.margins: Theme.spacingL
|
||||||
spacing: Theme.spacingL
|
spacing: Theme.spacingL
|
||||||
|
|
||||||
Row {
|
Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
height: 32
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: BatteryService.batteryAvailable ? "Battery Information" : "Power Management"
|
text: BatteryService.batteryAvailable ? "Battery Information" : "Power Management"
|
||||||
@@ -201,16 +199,13 @@ PanelWindow {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
|
||||||
width: parent.width - 200
|
|
||||||
height: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 32
|
width: 32
|
||||||
height: 32
|
height: 32
|
||||||
radius: 16
|
radius: 16
|
||||||
color: closeBatteryArea.containsMouse ? Theme.errorHover : "transparent"
|
color: closeBatteryArea.containsMouse ? Theme.errorHover : "transparent"
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@@ -605,4 +600,3 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user