NPanel: simplified screen/scaling management
This commit is contained in:
parent
6ea1e2b4c7
commit
82ac49ce85
28 changed files with 120 additions and 163 deletions
|
|
@ -10,12 +10,8 @@ import qs.Widgets
|
|||
NBox {
|
||||
id: root
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
Layout.fillHeight: true
|
||||
anchors.margins: Style.marginL * scaling
|
||||
|
||||
// No media player detected
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ NBox {
|
|||
tooltipText: "Open settings."
|
||||
onClicked: {
|
||||
settingsPanel.requestedTab = SettingsPanel.Tab.General
|
||||
settingsPanel.open(screen)
|
||||
settingsPanel.open()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ NBox {
|
|||
icon: "power"
|
||||
tooltipText: "Power menu."
|
||||
onClicked: {
|
||||
powerPanel.open(screen)
|
||||
powerPanel.open()
|
||||
sidePanel.close()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ NBox {
|
|||
id: root
|
||||
|
||||
Layout.preferredWidth: Style.baseWidgetSize * 2.625 * scaling
|
||||
implicitHeight: content.implicitHeight + Style.marginXS * 2 * scaling
|
||||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ NBox {
|
|||
onClicked: {
|
||||
var settingsPanel = PanelService.getPanel("settingsPanel")
|
||||
settingsPanel.requestedTab = SettingsPanel.Tab.WallpaperSelector
|
||||
settingsPanel.open(screen)
|
||||
settingsPanel.open()
|
||||
}
|
||||
onRightClicked: {
|
||||
WallpaperService.setRandomWallpaper()
|
||||
|
|
|
|||
|
|
@ -10,32 +10,14 @@ import qs.Widgets
|
|||
NPanel {
|
||||
id: root
|
||||
|
||||
panelWidth: 460 * scaling
|
||||
panelHeight: contentHeight
|
||||
|
||||
// Default height, will be modified via binding when the content is fully loaded
|
||||
property real contentHeight: 720 * scaling
|
||||
preferredWidth: 460
|
||||
preferredHeight: 730
|
||||
|
||||
panelContent: Item {
|
||||
id: content
|
||||
|
||||
property real cardSpacing: Style.marginL * scaling
|
||||
|
||||
width: root.panelWidth
|
||||
implicitHeight: layout.implicitHeight + (2 * cardSpacing)
|
||||
height: implicitHeight
|
||||
|
||||
// Update parent's contentHeight whenever our height changes
|
||||
onHeightChanged: {
|
||||
root.contentHeight = height
|
||||
}
|
||||
|
||||
onImplicitHeightChanged: {
|
||||
if (implicitHeight > 0) {
|
||||
root.contentHeight = implicitHeight
|
||||
}
|
||||
}
|
||||
|
||||
// Layout content
|
||||
ColumnLayout {
|
||||
id: layout
|
||||
|
|
@ -46,55 +28,45 @@ NPanel {
|
|||
|
||||
// Cards (consistent inter-card spacing via ColumnLayout spacing)
|
||||
ProfileCard {
|
||||
id: profileCard
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
WeatherCard {
|
||||
id: weatherCard
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// Middle section: media + stats column
|
||||
RowLayout {
|
||||
id: middleRow
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: 280 * scaling
|
||||
Layout.preferredHeight: Math.max(280 * scaling, statsCard.implicitHeight)
|
||||
Layout.preferredHeight: Math.max(310 * scaling)
|
||||
spacing: content.cardSpacing
|
||||
|
||||
// Media card
|
||||
MediaCard {
|
||||
id: mediaCard
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
// System monitors combined in one card
|
||||
SystemMonitorCard {
|
||||
id: statsCard
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
|
||||
// Bottom actions (two grouped rows of round buttons)
|
||||
RowLayout {
|
||||
id: bottomRow
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: 60 * scaling
|
||||
Layout.preferredHeight: Math.max(60 * scaling, powerProfilesCard.implicitHeight, utilitiesCard.implicitHeight)
|
||||
Layout.preferredHeight: Math.max(60 * scaling)
|
||||
spacing: content.cardSpacing
|
||||
|
||||
// Power Profiles switcher
|
||||
PowerProfilesCard {
|
||||
id: powerProfilesCard
|
||||
spacing: content.cardSpacing
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// Utilities buttons
|
||||
UtilitiesCard {
|
||||
id: utilitiesCard
|
||||
spacing: content.cardSpacing
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue