mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 21:45:38 -05:00
use loader pattern in control center
This commit is contained in:
@@ -33,54 +33,64 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// Output Tab - DankFlickable
|
||||
DankFlickable {
|
||||
// Output Tab - Loader
|
||||
Loader {
|
||||
width: parent.width
|
||||
height: parent.height - 48
|
||||
visible: audioTab.audioSubTab === 0
|
||||
clip: true
|
||||
contentHeight: outputColumn.height
|
||||
contentWidth: width
|
||||
active: audioTab.audioSubTab === 0
|
||||
asynchronous: true
|
||||
sourceComponent: Component {
|
||||
DankFlickable {
|
||||
clip: true
|
||||
contentHeight: outputColumn.height
|
||||
contentWidth: width
|
||||
|
||||
Column {
|
||||
id: outputColumn
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
Column {
|
||||
id: outputColumn
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: volumeComponent
|
||||
}
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: volumeComponent
|
||||
}
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: outputDevicesComponent
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: outputDevicesComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Input Tab - DankFlickable
|
||||
DankFlickable {
|
||||
// Input Tab - Loader
|
||||
Loader {
|
||||
width: parent.width
|
||||
height: parent.height - 48
|
||||
visible: audioTab.audioSubTab === 1
|
||||
clip: true
|
||||
contentHeight: inputColumn.height
|
||||
contentWidth: width
|
||||
active: audioTab.audioSubTab === 1
|
||||
asynchronous: true
|
||||
sourceComponent: Component {
|
||||
DankFlickable {
|
||||
clip: true
|
||||
contentHeight: inputColumn.height
|
||||
contentWidth: width
|
||||
|
||||
Column {
|
||||
id: inputColumn
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
Column {
|
||||
id: inputColumn
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: microphoneComponent
|
||||
}
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: microphoneComponent
|
||||
}
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: inputDevicesComponent
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: inputDevicesComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,102 +719,43 @@ PanelWindow {
|
||||
Theme.outline.b, 0.05)
|
||||
border.width: 1
|
||||
|
||||
NetworkTab {
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingS
|
||||
visible: root.currentTab === "network"
|
||||
active: root.currentTab === "network"
|
||||
asynchronous: true
|
||||
sourceComponent: Component {
|
||||
NetworkTab {}
|
||||
}
|
||||
}
|
||||
|
||||
AudioTab {
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingS
|
||||
visible: root.currentTab === "audio"
|
||||
active: root.currentTab === "audio"
|
||||
asynchronous: true
|
||||
sourceComponent: Component {
|
||||
AudioTab {}
|
||||
}
|
||||
}
|
||||
|
||||
BluetoothTab {
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingS
|
||||
visible: BluetoothService.available
|
||||
&& root.currentTab === "bluetooth"
|
||||
active: BluetoothService.available && root.currentTab === "bluetooth"
|
||||
asynchronous: true
|
||||
sourceComponent: Component {
|
||||
BluetoothTab {}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
property var brightnessDebounceTimer
|
||||
|
||||
brightnessDebounceTimer: Timer {
|
||||
property int pendingValue: 0
|
||||
|
||||
interval: BrightnessService.ddcAvailable ? 500 : 50
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
BrightnessService.setBrightnessInternal(pendingValue)
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingS
|
||||
visible: root.currentTab === "display"
|
||||
spacing: Theme.spacingL
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
visible: BrightnessService.brightnessAvailable
|
||||
|
||||
StyledText {
|
||||
text: "Brightness"
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
DankSlider {
|
||||
width: parent.width
|
||||
height: 24
|
||||
value: BrightnessService.brightnessLevel
|
||||
leftIcon: "brightness_low"
|
||||
rightIcon: "brightness_high"
|
||||
enabled: BrightnessService.brightnessAvailable
|
||||
showValue: true
|
||||
onSliderValueChanged: function (newValue) {
|
||||
parent.parent.brightnessDebounceTimer.pendingValue = newValue
|
||||
parent.parent.brightnessDebounceTimer.restart()
|
||||
}
|
||||
onSliderDragFinished: function (finalValue) {
|
||||
parent.parent.brightnessDebounceTimer.stop()
|
||||
BrightnessService.setBrightnessInternal(finalValue)
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "ddc changes can be slow to respond"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
visible: BrightnessService.ddcAvailable
|
||||
&& !BrightnessService.laptopBacklightAvailable
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
width: parent.width
|
||||
text: "Night Mode"
|
||||
description: "Apply warm color temperature to reduce eye strain"
|
||||
checked: SettingsData.nightModeEnabled
|
||||
onToggled: checked => {
|
||||
SettingsData.setNightModeEnabled(checked)
|
||||
}
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
width: parent.width
|
||||
text: "Light Mode"
|
||||
description: "Use light theme instead of dark theme"
|
||||
checked: SessionData.isLightMode
|
||||
onToggled: checked => {
|
||||
SessionData.setLightMode(checked)
|
||||
Theme.isLightMode = checked
|
||||
PortalService.setLightMode(checked)
|
||||
}
|
||||
active: root.currentTab === "display"
|
||||
asynchronous: true
|
||||
sourceComponent: Component {
|
||||
DisplayTab {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -371,6 +371,7 @@ PanelWindow {
|
||||
active: topBarContent.getWidgetVisible(model.widgetId)
|
||||
sourceComponent: topBarContent.getWidgetComponent(model.widgetId)
|
||||
opacity: topBarContent.getWidgetEnabled(model.enabled) ? 1 : 0
|
||||
asynchronous: true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -491,6 +492,8 @@ PanelWindow {
|
||||
active: topBarContent.getWidgetVisible(model.widgetId)
|
||||
sourceComponent: topBarContent.getWidgetComponent(model.widgetId)
|
||||
opacity: topBarContent.getWidgetEnabled(model.enabled) ? 1 : 0
|
||||
asynchronous: true
|
||||
|
||||
onLoaded: {
|
||||
if (item) {
|
||||
item.onWidthChanged.connect(centerSection.updateLayout)
|
||||
@@ -498,7 +501,6 @@ PanelWindow {
|
||||
item.spacerSize = Qt.binding(() => {
|
||||
return model.size || 20
|
||||
})
|
||||
|
||||
Qt.callLater(centerSection.updateLayout)
|
||||
}
|
||||
}
|
||||
@@ -537,6 +539,48 @@ PanelWindow {
|
||||
active: topBarContent.getWidgetVisible(model.widgetId)
|
||||
sourceComponent: topBarContent.getWidgetComponent(model.widgetId)
|
||||
opacity: topBarContent.getWidgetEnabled(model.enabled) ? 1 : 0
|
||||
asynchronous: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Component {
|
||||
id: clipboardComponent
|
||||
|
||||
Rectangle {
|
||||
width: 40
|
||||
height: 30
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
const baseColor = clipboardArea.containsMouse ? Theme.primaryHover : Theme.secondaryHover
|
||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
|
||||
baseColor.a * Theme.widgetTransparency)
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
name: "content_paste"
|
||||
size: Theme.iconSize - 6
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: clipboardArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
clipboardHistoryModalPopup.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -547,7 +591,6 @@ PanelWindow {
|
||||
LauncherButton {
|
||||
isActive: appDrawerPopout ? appDrawerPopout.isVisible : false
|
||||
section: {
|
||||
// Determine which section this loader is in by checking parent
|
||||
if (parent && parent.parent) {
|
||||
if (parent.parent === leftSection)
|
||||
return "left"
|
||||
@@ -556,7 +599,7 @@ PanelWindow {
|
||||
if (parent.parent === centerSection)
|
||||
return "center"
|
||||
}
|
||||
return "left" // default fallback
|
||||
return "left"
|
||||
}
|
||||
popupTarget: appDrawerPopout
|
||||
parentScreen: root.screen
|
||||
@@ -675,46 +718,6 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: clipboardComponent
|
||||
|
||||
Rectangle {
|
||||
width: 40
|
||||
height: 30
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
const baseColor = clipboardArea.containsMouse ? Theme.primaryHover : Theme.secondaryHover
|
||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
|
||||
baseColor.a * Theme.widgetTransparency)
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
name: "content_paste"
|
||||
size: Theme.iconSize - 6
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: clipboardArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
clipboardHistoryModalPopup.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: cpuUsageComponent
|
||||
|
||||
|
||||
Reference in New Issue
Block a user