1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-08 04:09:15 -04:00

refactor(control-center): consolidate detail section height rules

This commit is contained in:
purian23
2026-06-02 15:48:47 -04:00
parent 84fe2d751f
commit 1ee42506b6
3 changed files with 16 additions and 33 deletions
@@ -15,25 +15,6 @@ Item {
property var pluginDetailInstance: null
property var widgetModel: null
property var collapseCallback: null
property real maxAvailableHeight: 9999
function getDetailHeight(section) {
switch (true) {
case section === "wifi":
case section === "bluetooth":
case section === "builtin_vpn":
case section === "builtin_tailscale":
return Math.min(350, maxAvailableHeight);
case section.startsWith("brightnessSlider_"):
return Math.min(400, maxAvailableHeight);
case section.startsWith("plugin_"):
if (pluginDetailInstance?.ccDetailHeight)
return Math.min(pluginDetailInstance.ccDetailHeight, maxAvailableHeight);
return Math.min(250, maxAvailableHeight);
default:
return Math.min(250, maxAvailableHeight);
}
}
Loader {
id: pluginDetailLoader
@@ -3,6 +3,7 @@ import qs.Common
import qs.Services
import qs.Modules.ControlCenter.Widgets
import qs.Modules.ControlCenter.Components
import "../utils/detailHeight.js" as DetailHeightUtils
import "../utils/layout.js" as LayoutUtils
Column {
@@ -38,8 +39,6 @@ Column {
property real currentRowWidth: 0
property int expandedRowIndex: -1
property var colorPickerModal: null
// Detail instance of the currently expanded plugin section, so the grid can
// honor its dynamic ccDetailHeight instead of a fixed slot size.
property var activePluginDetailInstance: null
readonly property real _maxDetailHeight: {
@@ -76,17 +75,7 @@ Column {
}
function detailHeightForSection(section) {
if (!section)
return 0;
if (section === "wifi" || section === "bluetooth" || section === "builtin_vpn")
return Math.min(350, _maxDetailHeight);
if (section.startsWith("brightnessSlider_"))
return Math.min(400, _maxDetailHeight);
if (section.startsWith("plugin_")) {
const h = activePluginDetailInstance ? activePluginDetailInstance.ccDetailHeight : 0;
return Math.min(h > 0 ? h : 250, _maxDetailHeight);
}
return Math.min(250, _maxDetailHeight);
return DetailHeightUtils.detailHeightForSection(section, _maxDetailHeight, activePluginDetailInstance);
}
function calculateRowsAndWidgets() {
@@ -226,7 +215,6 @@ Column {
DetailHost {
id: detailHost
width: parent.width
maxAvailableHeight: root._maxDetailHeight
height: active ? (root.detailHeightForSection(root.expandedSection) + Theme.spacingS) : 0
clip: true
property string retainedSection: ""
@@ -0,0 +1,14 @@
function detailHeightForSection(section, maxHeight, pluginInstance) {
if (!section)
return 0;
if (section === "wifi" || section === "bluetooth"
|| section === "builtin_vpn" || section === "builtin_tailscale")
return Math.min(350, maxHeight);
if (section.startsWith("brightnessSlider_"))
return Math.min(400, maxHeight);
if (section.startsWith("plugin_")) {
const h = pluginInstance ? pluginInstance.ccDetailHeight : 0;
return Math.min(h > 0 ? h : 250, maxHeight);
}
return Math.min(250, maxHeight);
}