1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-08 22:48:28 -04:00

refactor(launcher): invert framemode emerge from top position

This commit is contained in:
purian23
2026-07-02 11:18:33 -04:00
parent 2128e6f14e
commit 4ae8ef927c
4 changed files with 174 additions and 101 deletions
@@ -43,6 +43,7 @@ Item {
signal queryChanged(string query) signal queryChanged(string query)
signal viewModeChanged(string sectionId, string mode) signal viewModeChanged(string sectionId, string mode)
signal searchQueryRequested(string query) signal searchQueryRequested(string query)
signal sectionExpanded(string sectionId)
Ref { Ref {
service: AppSearchService service: AppSearchService
@@ -1874,6 +1875,9 @@ Item {
selectedFlatIndex = getFirstItemIndex(); selectedFlatIndex = getFirstItemIndex();
} }
updateSelectedItem(); updateSelectedItem();
if (!newCollapsed[sectionId])
sectionExpanded(sectionId);
} }
function executeSelected() { function executeSelected() {
@@ -314,9 +314,13 @@ FocusScope {
} }
Item { Item {
id: contentHolder
anchors.fill: parent anchors.fill: parent
visible: !editMode visible: !editMode
readonly property bool inverted: (root.parentModal?.frameOwnsConnectedChrome ?? false) && (root.parentModal?.resolvedConnectedBarSide === "top")
readonly property bool _connectedArcAtHeader: inverted && !(root.parentModal?.launcherArcExtenderActive ?? false)
Item { Item {
id: footerBar id: footerBar
readonly property bool _connectedBottomEmerge: (root.parentModal?.frameOwnsConnectedChrome ?? false) && (root.parentModal?.resolvedConnectedBarSide === "bottom") readonly property bool _connectedBottomEmerge: (root.parentModal?.frameOwnsConnectedChrome ?? false) && (root.parentModal?.resolvedConnectedBarSide === "bottom")
@@ -325,11 +329,10 @@ FocusScope {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.leftMargin: root.parentModal?.borderWidth ?? 1 anchors.leftMargin: root.parentModal?.borderWidth ?? 1
anchors.rightMargin: root.parentModal?.borderWidth ?? 1 anchors.rightMargin: root.parentModal?.borderWidth ?? 1
anchors.bottomMargin: _connectedBottomEmerge ? 0 : (root.parentModal?.borderWidth ?? 1) y: contentHolder.inverted ? 0 : (parent.height - height - (_connectedBottomEmerge ? 0 : (root.parentModal?.borderWidth ?? 1)))
height: showFooter ? (_connectedArcAtFooter ? 76 : 36) : 0 height: showFooter ? ((_connectedArcAtFooter || contentHolder._connectedArcAtHeader) ? 76 : 36) : 0
visible: showFooter visible: showFooter
clip: true clip: true
@@ -446,20 +449,14 @@ FocusScope {
} }
} }
Column { Row {
id: searchRow
spacing: Theme.spacingS
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: footerBar.top
anchors.leftMargin: Theme.spacingM anchors.leftMargin: Theme.spacingM
anchors.rightMargin: Theme.spacingM anchors.rightMargin: Theme.spacingM
anchors.topMargin: Theme.spacingM y: contentHolder.inverted ? (parent.height - height - Theme.spacingM) : Theme.spacingM
spacing: Theme.spacingXS
clip: false
Row {
width: parent.width
spacing: Theme.spacingS
Rectangle { Rectangle {
id: pluginBadge id: pluginBadge
@@ -545,6 +542,19 @@ FocusScope {
} }
} }
Item {
id: contentStack
anchors.left: parent.left
anchors.right: parent.right
anchors.top: contentHolder.inverted ? footerBar.bottom : searchRow.bottom
anchors.bottom: contentHolder.inverted ? searchRow.top : footerBar.top
anchors.leftMargin: Theme.spacingM
anchors.rightMargin: Theme.spacingM
anchors.topMargin: contentHolder.inverted && !footerBar.showFooter ? Theme.spacingM : contentStack.gap
anchors.bottomMargin: contentHolder.inverted ? contentStack.gap : 0
readonly property real gap: Theme.spacingXS
clip: false
Row { Row {
id: categoryRow id: categoryRow
width: parent.width width: parent.width
@@ -552,6 +562,8 @@ FocusScope {
height: showPluginCategories ? 36 : 0 height: showPluginCategories ? 36 : 0
visible: showPluginCategories visible: showPluginCategories
spacing: Theme.spacingS spacing: Theme.spacingS
anchors.top: parent.top
anchors.topMargin: 0
clip: true clip: true
@@ -607,6 +619,8 @@ FocusScope {
width: parent.width width: parent.width
height: showFileFilters ? fileFilterContent.height : 0 height: showFileFilters ? fileFilterContent.height : 0
visible: showFileFilters visible: showFileFilters
anchors.top: parent.top
anchors.topMargin: 0
readonly property bool showFileFilters: controller.searchMode === "files" readonly property bool showFileFilters: controller.searchMode === "files"
@@ -746,8 +760,12 @@ FocusScope {
} }
Item { Item {
id: resultsSlot
width: parent.width width: parent.width
height: parent.height - searchField.height - categoryRow.height - fileFilterRow.height - actionPanel.height - Theme.spacingXS * ((categoryRow.visible ? 1 : 0) + (fileFilterRow.visible ? 1 : 0) + 2) anchors.top: fileFilterRow.visible ? fileFilterRow.bottom : (categoryRow.visible ? categoryRow.bottom : parent.top)
anchors.topMargin: (fileFilterRow.visible || categoryRow.visible) ? contentStack.gap : 0
anchors.bottom: actionPanel.top
anchors.bottomMargin: actionPanel.height > 0 || !contentHolder.inverted ? contentStack.gap : 0
opacity: { opacity: {
if (!root.parentModal) if (!root.parentModal)
return 1; return 1;
@@ -760,6 +778,7 @@ FocusScope {
id: resultsList id: resultsList
anchors.fill: parent anchors.fill: parent
controller: root.controller controller: root.controller
leadingSectionHeaderAtBottom: contentHolder.inverted
onItemRightClicked: (index, item, sceneX, sceneY) => { onItemRightClicked: (index, item, sceneX, sceneY) => {
if (item && contextMenu.hasContextMenuActions(item)) { if (item && contextMenu.hasContextMenuActions(item)) {
@@ -773,6 +792,7 @@ FocusScope {
ActionPanel { ActionPanel {
id: actionPanel id: actionPanel
width: parent.width width: parent.width
anchors.bottom: parent.bottom
selectedItem: controller.selectedItem selectedItem: controller.selectedItem
controller: controller controller: controller
} }
@@ -11,9 +11,11 @@ Item {
property var controller: null property var controller: null
property int gridColumns: controller?.gridColumns ?? 4 property int gridColumns: controller?.gridColumns ?? 4
property bool leadingSectionHeaderAtBottom: false
property var _visualRows: [] property var _visualRows: []
property var _flatIndexToRowMap: ({}) property var _flatIndexToRowMap: ({})
property var _cumulativeHeights: [] property var _cumulativeHeights: []
readonly property bool _bottomSectionHeaderActive: leadingSectionHeaderAtBottom && (controller?.sections?.length ?? 0) > 0
signal itemRightClicked(int index, var item, real mouseX, real mouseY) signal itemRightClicked(int index, var item, real mouseX, real mouseY)
@@ -28,6 +30,7 @@ Item {
var section = sections[s]; var section = sections[s];
var sectionId = section.id; var sectionId = section.id;
if (!root._bottomSectionHeaderActive || s > 0) {
cumHeights.push(cumY); cumHeights.push(cumY);
rows.push({ rows.push({
_rowId: "h_" + sectionId, _rowId: "h_" + sectionId,
@@ -37,6 +40,7 @@ Item {
height: 32 height: 32
}); });
cumY += 32; cumY += 32;
}
if (section.collapsed) if (section.collapsed)
continue; continue;
@@ -103,6 +107,7 @@ Item {
onGridColumnsChanged: Qt.callLater(_rebuildVisualModel) onGridColumnsChanged: Qt.callLater(_rebuildVisualModel)
onWidthChanged: Qt.callLater(_rebuildVisualModel) onWidthChanged: Qt.callLater(_rebuildVisualModel)
onLeadingSectionHeaderAtBottomChanged: Qt.callLater(_rebuildVisualModel)
Connections { Connections {
target: root.controller target: root.controller
@@ -117,12 +122,27 @@ Item {
root._cumulativeHeights = []; root._cumulativeHeights = [];
root._flatIndexToRowMap = {}; root._flatIndexToRowMap = {};
} }
function onSectionExpanded(sectionId) {
Qt.callLater(() => {
root._rebuildVisualModel();
Qt.callLater(() => root.revealExpandedSection(sectionId));
});
}
} }
function resetScroll() { function resetScroll() {
mainListView.contentY = mainListView.originY; mainListView.contentY = mainListView.originY;
} }
function revealExpandedSection(sectionId) {
for (var i = 0; i < _visualRows.length; i++) {
if (_visualRows[i].sectionId === sectionId) {
mainListView.positionViewAtIndex(i, ListView.Beginning);
return;
}
}
}
function ensureVisible(index) { function ensureVisible(index) {
if (index < 0 || !controller?.flatModel || index >= controller.flatModel.length) if (index < 0 || !controller?.flatModel || index >= controller.flatModel.length)
return; return;
@@ -194,6 +214,7 @@ Item {
id: listClip id: listClip
anchors.fill: parent anchors.fill: parent
anchors.topMargin: BlurService.enabled && stickyHeader.visible ? 32 : 0 anchors.topMargin: BlurService.enabled && stickyHeader.visible ? 32 : 0
anchors.bottomMargin: bottomSectionHeader.visible ? bottomSectionHeader.height : 0
clip: true clip: true
DankListView { DankListView {
@@ -332,6 +353,7 @@ Item {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: bottomSectionHeader.visible ? bottomSectionHeader.height : 0
height: 24 height: 24
z: 100 z: 100
visible: { visible: {
@@ -377,7 +399,7 @@ Item {
height: 32 height: 32
z: 101 z: 101
color: Theme.floatingSurface color: Theme.floatingSurface
visible: stickyHeaderSection !== null visible: !root._bottomSectionHeaderActive && stickyHeaderSection !== null
readonly property int versionTrigger: root.controller?.viewModeVersion ?? 0 readonly property int versionTrigger: root.controller?.viewModeVersion ?? 0
@@ -428,6 +450,30 @@ Item {
} }
} }
SectionHeader {
id: bottomSectionHeader
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
z: 101
visible: root._bottomSectionHeaderActive
section: visible ? root.controller.sections[0] : null
controller: root.controller
viewMode: {
var vt = root.controller?.viewModeVersion ?? 0;
void (vt);
return root.controller?.getSectionViewMode(section?.id ?? "") ?? "list";
}
canChangeViewMode: {
var vt = root.controller?.viewModeVersion ?? 0;
void (vt);
return root.controller?.canChangeSectionViewMode(section?.id ?? "") ?? false;
}
canCollapse: root.controller?.canCollapseSection(section?.id ?? "") ?? false
isSticky: true
popupAbove: true
}
Item { Item {
anchors.centerIn: parent anchors.centerIn: parent
visible: (!root.controller?.sections || root.controller.sections.length === 0) && !root.controller?.isFileSearching visible: (!root.controller?.sections || root.controller.sections.length === 0) && !root.controller?.isFileSearching
@@ -15,6 +15,8 @@ Rectangle {
property bool canChangeViewMode: true property bool canChangeViewMode: true
property bool canCollapse: true property bool canCollapse: true
property bool isSticky: false property bool isSticky: false
property bool popupAbove: false
property Item popupAboveItem: null
signal viewModeToggled signal viewModeToggled
@@ -122,9 +124,10 @@ Rectangle {
if (categoryPopup.visible) { if (categoryPopup.visible) {
categoryPopup.close(); categoryPopup.close();
} else { } else {
const pos = categoryChip.mapToItem(Overlay.overlay, 0, 0); const chipPos = categoryChip.mapToItem(Overlay.overlay, 0, 0);
categoryPopup.x = pos.x; const abovePos = (root.popupAboveItem ?? categoryChip).mapToItem(Overlay.overlay, 0, 0);
categoryPopup.y = pos.y + categoryChip.height + 4; categoryPopup.x = chipPos.x;
categoryPopup.y = root.popupAbove ? abovePos.y - categoryPopup.height - 4 : chipPos.y + categoryChip.height + 4;
categoryPopup.open(); categoryPopup.open();
} }
} }
@@ -325,7 +328,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
anchors.rightMargin: rightContent.width + Theme.spacingS anchors.rightMargin: rightContent.width + Theme.spacingS
cursorShape: root.canCollapse ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: root.canCollapse ? Qt.PointingHandCursor : Qt.ArrowCursor
enabled: root.canCollapse enabled: root.canCollapse && !leftContent.hasAppCategories
onClicked: { onClicked: {
if (root.canCollapse && root.controller && root.section) { if (root.canCollapse && root.controller && root.section) {
root.controller.toggleSection(root.section.id); root.controller.toggleSection(root.section.id);