mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Remove redundant function: hasAnyBattery()
This commit is contained in:
@@ -82,7 +82,7 @@ Loader {
|
||||
property real percent: BatteryService.batteryPercentage
|
||||
property bool charging: BatteryService.batteryCharging
|
||||
property bool pluggedIn: BatteryService.batteryPluggedIn
|
||||
property bool batteryVisible: isReady && BatteryService.hasAnyBattery()
|
||||
property bool batteryVisible: isReady
|
||||
}
|
||||
|
||||
Item {
|
||||
|
||||
@@ -109,7 +109,7 @@ Item {
|
||||
// Compact status indicators container (compact mode only)
|
||||
Rectangle {
|
||||
width: {
|
||||
var hasBattery = batteryIndicator.isReady && BatteryService.hasAnyBattery();
|
||||
var hasBattery = batteryIndicator.isReady;
|
||||
var hasKeyboard = keyboardLayout.currentLayout !== "Unknown";
|
||||
|
||||
if (hasBattery && hasKeyboard) {
|
||||
@@ -127,7 +127,7 @@ Item {
|
||||
topLeftRadius: Style.radiusL
|
||||
topRightRadius: Style.radiusL
|
||||
color: Color.mSurface
|
||||
visible: Settings.data.general.compactLockScreen && ((batteryIndicator.isReady && BatteryService.hasAnyBattery()) || keyboardLayout.currentLayout !== "Unknown")
|
||||
visible: Settings.data.general.compactLockScreen && ((batteryIndicator.isReady) || keyboardLayout.currentLayout !== "Unknown")
|
||||
|
||||
RowLayout {
|
||||
anchors.centerIn: parent
|
||||
@@ -136,7 +136,7 @@ Item {
|
||||
// Battery indicator
|
||||
RowLayout {
|
||||
spacing: Style.marginS
|
||||
visible: batteryIndicator.isReady && BatteryService.hasAnyBattery()
|
||||
visible: batteryIndicator.isReady
|
||||
|
||||
NIcon {
|
||||
icon: BatteryService.getIcon(Math.round(batteryIndicator.percent), batteryIndicator.charging, batteryIndicator.pluggedIn, batteryIndicator.isReady)
|
||||
@@ -449,19 +449,19 @@ Item {
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: batteryIndicator.isReady && BatteryService.hasAnyBattery()
|
||||
Layout.fillWidth: batteryIndicator.isReady
|
||||
}
|
||||
|
||||
// Battery and Keyboard Layout (full mode only)
|
||||
ColumnLayout {
|
||||
Layout.alignment: (batteryIndicator.isReady && BatteryService.hasAnyBattery()) ? (Qt.AlignRight | Qt.AlignVCenter) : Qt.AlignVCenter
|
||||
Layout.alignment: (batteryIndicator.isReady) ? (Qt.AlignRight | Qt.AlignVCenter) : Qt.AlignVCenter
|
||||
spacing: Style.marginM
|
||||
visible: (batteryIndicator.isReady && BatteryService.hasAnyBattery()) || keyboardLayout.currentLayout !== "Unknown"
|
||||
visible: (batteryIndicator.isReady) || keyboardLayout.currentLayout !== "Unknown"
|
||||
|
||||
// Battery
|
||||
RowLayout {
|
||||
spacing: Style.marginXS
|
||||
visible: batteryIndicator.isReady && BatteryService.hasAnyBattery()
|
||||
visible: batteryIndicator.isReady
|
||||
|
||||
NIcon {
|
||||
icon: BatteryService.getIcon(Math.round(batteryIndicator.percent), batteryIndicator.charging, batteryIndicator.pluggedIn, batteryIndicator.isReady)
|
||||
|
||||
@@ -202,10 +202,6 @@ Singleton {
|
||||
return "battery-off"; // New fallback icon clearly represent if nothing is true here.
|
||||
}
|
||||
|
||||
function hasAnyBattery() {
|
||||
return primaryDevice !== null;
|
||||
}
|
||||
|
||||
function getRateText(device) {
|
||||
if (!device || device.changeRate === undefined) {
|
||||
return "";
|
||||
|
||||
Reference in New Issue
Block a user