1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 21:45:38 -05:00

meta: many resource usage improvements and consolidations

This commit is contained in:
bbedward
2025-07-24 12:44:11 -04:00
parent ee2cbd708d
commit e3e3788a37
34 changed files with 1614 additions and 1382 deletions

View File

@@ -0,0 +1,56 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls
import qs.Common
import qs.Widgets
ScrollView {
id: root
clip: true
ScrollBar.vertical.policy: ScrollBar.AsNeeded
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
Column {
width: root.width - 20
spacing: Theme.spacingL
topPadding: Theme.spacingM
bottomPadding: Theme.spacingL
// Display Settings
Column {
width: parent.width
spacing: Theme.spacingM
Row {
spacing: Theme.spacingS
DankIcon {
name: "monitor"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: "Display"
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Medium
anchors.verticalCenter: parent.verticalCenter
}
}
Rectangle {
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
}
DisplayTab {
width: parent.width
}
}
}
}

View File

@@ -0,0 +1,91 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls
import qs.Common
import qs.Widgets
ScrollView {
id: root
clip: true
ScrollBar.vertical.policy: ScrollBar.AsNeeded
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
Column {
width: root.width - 20
spacing: Theme.spacingL
topPadding: Theme.spacingM
bottomPadding: Theme.spacingL
// Profile Section
Column {
width: parent.width
spacing: Theme.spacingM
Row {
spacing: Theme.spacingS
DankIcon {
name: "person"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: "Profile"
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Medium
anchors.verticalCenter: parent.verticalCenter
}
}
Rectangle {
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
}
ProfileTab {
width: parent.width
}
}
// Wallpaper Section
Column {
width: parent.width
spacing: Theme.spacingM
Row {
spacing: Theme.spacingS
DankIcon {
name: "wallpaper"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: "Wallpaper"
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Medium
anchors.verticalCenter: parent.verticalCenter
}
}
Rectangle {
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
}
WallpaperTab {
width: parent.width
}
}
}
}

View File

@@ -43,21 +43,21 @@ Column {
visible: parent.hasImage
}
Image {
CachingImage {
id: avatarImageSource
source: {
imagePath: {
if (Prefs.profileImage === "")
return "";
if (Prefs.profileImage.startsWith("/"))
return "file://" + Prefs.profileImage;
return Prefs.profileImage;
return Prefs.profileImage;
}
smooth: true
asynchronous: true
mipmap: true
maxCacheSize: 80
cache: true
visible: false
}
@@ -223,7 +223,7 @@ Column {
id: profileBrowserLoader
active: false
FileBrowser {
DankFileBrowser {
id: profileBrowser
browserTitle: "Select Profile Image"
browserIcon: "person"

View File

@@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import QtQuick
import qs.Common
import qs.Widgets
@@ -8,30 +10,71 @@ Column {
property string title: ""
property string iconName: ""
property alias content: contentLoader.sourceComponent
property bool expanded: false
property bool collapsible: true
property bool lazyLoad: true
width: parent.width
spacing: Theme.spacingM
spacing: expanded ? Theme.spacingM : 0
// Section header
Row {
MouseArea {
width: parent.width
spacing: Theme.spacingS
DankIcon {
name: iconName
size: Theme.iconSize - 2
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
height: headerRow.height
enabled: collapsible
hoverEnabled: collapsible
Rectangle {
anchors.fill: parent
color: parent.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent"
radius: Theme.radiusS
}
Text {
text: title
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Medium
anchors.verticalCenter: parent.verticalCenter
}
Row {
id: headerRow
width: parent.width
spacing: Theme.spacingS
topPadding: Theme.spacingS
bottomPadding: Theme.spacingS
DankIcon {
name: root.collapsible ? (root.expanded ? "expand_less" : "expand_more") : root.iconName
size: Theme.iconSize - 2
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
Behavior on rotation {
NumberAnimation {
duration: Appearance.anim.durations.fast
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standard
}
}
}
DankIcon {
name: root.iconName
size: Theme.iconSize - 4
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
visible: root.collapsible
}
Text {
text: root.title
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Medium
anchors.verticalCenter: parent.verticalCenter
}
}
onClicked: {
if (collapsible) {
expanded = !expanded
}
}
}
// Divider
@@ -39,6 +82,7 @@ Column {
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
visible: expanded || !collapsible
}
// Content
@@ -46,6 +90,24 @@ Column {
id: contentLoader
width: parent.width
active: lazyLoad ? expanded || !collapsible : true
visible: expanded || !collapsible
asynchronous: true
Behavior on opacity {
NumberAnimation {
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standard
}
}
opacity: visible ? 1 : 0
}
Component.onCompleted: {
if (!collapsible) {
expanded = true
}
}
}

View File

@@ -0,0 +1,91 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls
import qs.Common
import qs.Widgets
ScrollView {
id: root
clip: true
ScrollBar.vertical.policy: ScrollBar.AsNeeded
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
Column {
width: root.width - 20
spacing: Theme.spacingL
topPadding: Theme.spacingM
bottomPadding: Theme.spacingL
// Top Bar Widgets
Column {
width: parent.width
spacing: Theme.spacingM
Row {
spacing: Theme.spacingS
DankIcon {
name: "widgets"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: "Top Bar Widgets"
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Medium
anchors.verticalCenter: parent.verticalCenter
}
}
Rectangle {
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
}
WidgetsTab {
width: parent.width
}
}
// Workspaces
Column {
width: parent.width
spacing: Theme.spacingM
Row {
spacing: Theme.spacingS
DankIcon {
name: "tab"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: "Workspaces"
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Medium
anchors.verticalCenter: parent.verticalCenter
}
}
Rectangle {
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
}
WorkspaceTab {
width: parent.width
}
}
}
}

View File

@@ -270,7 +270,13 @@ Column {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
Theme.switchTheme(10, true);
if (ToastService.wallpaperErrorStatus === "matugen_missing") {
ToastService.showError("matugen not found - install matugen package for dynamic theming");
} else if (ToastService.wallpaperErrorStatus === "error") {
ToastService.showError("Wallpaper processing failed - check wallpaper path");
} else {
Theme.switchTheme(10, true);
}
}
}

View File

@@ -3,6 +3,7 @@ import QtQuick.Controls
import QtQuick.Effects
import Quickshell
import qs.Common
import qs.Services
import qs.Widgets
Column {
@@ -36,12 +37,13 @@ Column {
border.color: Theme.outline
border.width: 1
Image {
CachingImage {
anchors.fill: parent
anchors.margins: 1
source: Prefs.wallpaperPath ? "file://" + Prefs.wallpaperPath : ""
imagePath: Prefs.wallpaperPath || ""
fillMode: Image.PreserveAspectCrop
visible: Prefs.wallpaperPath !== ""
maxCacheSize: 120
layer.enabled: true
layer.effect: MultiEffect {
maskEnabled: true
@@ -204,21 +206,32 @@ Column {
DankToggle {
id: toggle
anchors.verticalCenter: parent.verticalCenter
checked: Prefs.wallpaperDynamicTheming
onCheckedChanged: {
if (activeFocus) {
Prefs.setWallpaperDynamicTheming(checked);
checked: Theme.isDynamicTheme
enabled: ToastService.wallpaperErrorStatus !== "matugen_missing"
onToggled: (toggled) => {
if (toggled) {
Theme.switchTheme(10, true)
} else {
Theme.switchTheme(0)
}
}
}
}
StyledText {
text: "matugen not detected"
font.pixelSize: Theme.fontSizeSmall
color: Theme.error
visible: ToastService.wallpaperErrorStatus === "matugen_missing"
width: parent.width
}
}
LazyLoader {
id: wallpaperBrowserLoader
active: false
FileBrowser {
DankFileBrowser {
id: wallpaperBrowser
browserTitle: "Select Wallpaper"
browserIcon: "wallpaper"