mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
BatteryPanel: fix scaling
This commit is contained in:
@@ -10,8 +10,8 @@ import qs.Widgets
|
||||
NPanel {
|
||||
id: root
|
||||
|
||||
preferredWidth: 350
|
||||
preferredHeight: 210
|
||||
preferredWidth: 350 * Style.uiScaleRatio
|
||||
preferredHeight: 210 * Style.uiScaleRatio
|
||||
panelKeyboardFocus: true
|
||||
|
||||
property var optionsModel: []
|
||||
@@ -19,16 +19,13 @@ NPanel {
|
||||
function updateOptionsModel() {
|
||||
let newOptions = [{
|
||||
"id": BatteryService.ChargingMode.Full,
|
||||
"label": "battery.panel.full",
|
||||
"icon": "battery-4"
|
||||
"label": "battery.panel.full"
|
||||
}, {
|
||||
"id": BatteryService.ChargingMode.Balanced,
|
||||
"label": "battery.panel.balanced",
|
||||
"icon": "battery-3"
|
||||
"label": "battery.panel.balanced"
|
||||
}, {
|
||||
"id": BatteryService.ChargingMode.Lifespan,
|
||||
"label": "battery.panel.lifespan",
|
||||
"icon": "battery-2"
|
||||
"label": "battery.panel.lifespan"
|
||||
}]
|
||||
root.optionsModel = newOptions
|
||||
}
|
||||
@@ -42,17 +39,17 @@ NPanel {
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginL * scaling
|
||||
spacing: Style.marginM * scaling
|
||||
anchors.margins: Style.marginL
|
||||
spacing: Style.marginM
|
||||
|
||||
// HEADER
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginM * scaling
|
||||
spacing: Style.marginM
|
||||
|
||||
NText {
|
||||
text: I18n.tr("battery.panel.title")
|
||||
pointSize: Style.fontSizeL * scaling
|
||||
pointSize: Style.fontSizeL
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Color.mOnSurface
|
||||
Layout.fillWidth: true
|
||||
@@ -62,7 +59,7 @@ NPanel {
|
||||
id: batteryManagerSwitch
|
||||
checked: BatteryService.chargingMode !== BatteryService.ChargingMode.Disabled
|
||||
onToggled: checked => BatteryService.toggleEnabled(checked)
|
||||
baseSize: Style.baseWidgetSize * 0.65 * scaling
|
||||
baseSize: Style.baseWidgetSize * 0.65
|
||||
}
|
||||
|
||||
NIconButton {
|
||||
@@ -90,7 +87,7 @@ NPanel {
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: Style.marginM * scaling
|
||||
spacing: Style.marginM
|
||||
|
||||
Repeater {
|
||||
model: optionsModel
|
||||
@@ -114,7 +111,7 @@ NPanel {
|
||||
ColumnLayout {
|
||||
visible: BatteryService.chargingMode === BatteryService.ChargingMode.Disabled
|
||||
anchors.fill: parent
|
||||
spacing: Style.marginM * scaling
|
||||
spacing: Style.marginM
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
@@ -122,7 +119,7 @@ NPanel {
|
||||
|
||||
NText {
|
||||
text: I18n.tr("battery.panel.disabled")
|
||||
pointSize: Style.fontSizeL * scaling
|
||||
pointSize: Style.fontSizeL
|
||||
color: Color.mOnSurfaceVariant
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user