mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-07 14:05:38 -05:00
General fixes to spacing and control center
This commit is contained in:
@@ -9,6 +9,7 @@ Singleton {
|
|||||||
|
|
||||||
property string networkStatus: "disconnected" // "ethernet", "wifi", "disconnected"
|
property string networkStatus: "disconnected" // "ethernet", "wifi", "disconnected"
|
||||||
property string ethernetIP: ""
|
property string ethernetIP: ""
|
||||||
|
property string ethernetInterface: ""
|
||||||
property string wifiIP: ""
|
property string wifiIP: ""
|
||||||
property bool wifiAvailable: false
|
property bool wifiAvailable: false
|
||||||
property bool wifiEnabled: true
|
property bool wifiEnabled: true
|
||||||
@@ -40,6 +41,7 @@ Singleton {
|
|||||||
} else {
|
} else {
|
||||||
root.networkStatus = "disconnected"
|
root.networkStatus = "disconnected"
|
||||||
root.ethernetIP = ""
|
root.ethernetIP = ""
|
||||||
|
root.ethernetInterface = ""
|
||||||
root.wifiIP = ""
|
root.wifiIP = ""
|
||||||
console.log("Setting network status to disconnected")
|
console.log("Setting network status to disconnected")
|
||||||
}
|
}
|
||||||
@@ -49,6 +51,7 @@ Singleton {
|
|||||||
} else {
|
} else {
|
||||||
root.networkStatus = "disconnected"
|
root.networkStatus = "disconnected"
|
||||||
root.ethernetIP = ""
|
root.ethernetIP = ""
|
||||||
|
root.ethernetInterface = ""
|
||||||
root.wifiIP = ""
|
root.wifiIP = ""
|
||||||
console.log("No network output, setting to disconnected")
|
console.log("No network output, setting to disconnected")
|
||||||
}
|
}
|
||||||
@@ -74,15 +77,23 @@ Singleton {
|
|||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: ethernetIPChecker
|
id: ethernetIPChecker
|
||||||
command: ["bash", "-c", "ip route get 1.1.1.1 | grep -oP 'src \\K\\S+' | head -1"]
|
command: ["bash", "-c", "ip route get 1.1.1.1 | grep -oP '(dev \\K\\S+|src \\K\\S+)' | tr '\\n' ' '"]
|
||||||
running: false
|
running: false
|
||||||
|
|
||||||
stdout: SplitParser {
|
stdout: SplitParser {
|
||||||
splitMarker: "\n"
|
splitMarker: "\n"
|
||||||
onRead: (data) => {
|
onRead: (data) => {
|
||||||
if (data.trim()) {
|
if (data.trim()) {
|
||||||
root.ethernetIP = data.trim()
|
const parts = data.trim().split(' ')
|
||||||
console.log("Ethernet IP:", root.ethernetIP)
|
if (parts.length >= 2) {
|
||||||
|
root.ethernetInterface = parts[0]
|
||||||
|
root.ethernetIP = parts[1]
|
||||||
|
console.log("Ethernet Interface:", root.ethernetInterface, "IP:", root.ethernetIP)
|
||||||
|
} else if (parts.length === 1) {
|
||||||
|
// Fallback if only IP is found
|
||||||
|
root.ethernetIP = parts[0]
|
||||||
|
console.log("Ethernet IP:", root.ethernetIP)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -517,7 +517,13 @@ PanelWindow {
|
|||||||
// App grid/list container
|
// App grid/list container
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - searchContainer.height - (searchField.text.length === 0 ? 128 : 60) - parent.spacing * 3
|
height: {
|
||||||
|
// Calculate more precise remaining height
|
||||||
|
let usedHeight = 40 + Theme.spacingL // Header
|
||||||
|
usedHeight += 52 + Theme.spacingL // Search container
|
||||||
|
usedHeight += (searchField.text.length === 0 ? 40 + Theme.spacingL : 0) // Category/controls when visible
|
||||||
|
return parent.height - usedHeight
|
||||||
|
}
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
// List view scroll container
|
// List view scroll container
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ PanelWindow {
|
|||||||
bottom: true
|
bottom: true
|
||||||
}
|
}
|
||||||
|
|
||||||
property int currentTab: 0 // 0: Network, 1: Audio, 2: Bluetooth, 3: Display
|
property string currentTab: "network" // "network", "audio", "bluetooth", "display"
|
||||||
property bool powerOptionsExpanded: false
|
property bool powerOptionsExpanded: false
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -511,7 +511,7 @@ PanelWindow {
|
|||||||
width: (parent.width - Theme.spacingXS * (tabCount - 1)) / tabCount
|
width: (parent.width - Theme.spacingXS * (tabCount - 1)) / tabCount
|
||||||
height: 40
|
height: 40
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: controlCenterPopup.currentTab === index ?
|
color: controlCenterPopup.currentTab === modelData.id ?
|
||||||
Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16) :
|
Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16) :
|
||||||
tabArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent"
|
tabArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent"
|
||||||
|
|
||||||
@@ -523,15 +523,15 @@ PanelWindow {
|
|||||||
text: modelData.icon
|
text: modelData.icon
|
||||||
font.family: Theme.iconFont
|
font.family: Theme.iconFont
|
||||||
font.pixelSize: Theme.iconSize - 4
|
font.pixelSize: Theme.iconSize - 4
|
||||||
color: controlCenterPopup.currentTab === index ? Theme.primary : Theme.surfaceText
|
color: controlCenterPopup.currentTab === modelData.id ? Theme.primary : Theme.surfaceText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: modelData.name
|
text: modelData.name
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: controlCenterPopup.currentTab === index ? Theme.primary : Theme.surfaceText
|
color: controlCenterPopup.currentTab === modelData.id ? Theme.primary : Theme.surfaceText
|
||||||
font.weight: controlCenterPopup.currentTab === index ? Font.Medium : Font.Normal
|
font.weight: controlCenterPopup.currentTab === modelData.id ? Font.Medium : Font.Normal
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -543,7 +543,7 @@ PanelWindow {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
controlCenterPopup.currentTab = index
|
controlCenterPopup.currentTab = modelData.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -591,13 +591,14 @@ PanelWindow {
|
|||||||
NetworkTab {
|
NetworkTab {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingM
|
anchors.margins: Theme.spacingM
|
||||||
visible: controlCenterPopup.currentTab === 0
|
visible: controlCenterPopup.currentTab === "network"
|
||||||
|
|
||||||
// Bind properties from root
|
// Bind properties from root
|
||||||
networkStatus: root.networkStatus
|
networkStatus: root.networkStatus
|
||||||
wifiAvailable: root.wifiAvailable
|
wifiAvailable: root.wifiAvailable
|
||||||
wifiEnabled: root.wifiEnabled
|
wifiEnabled: root.wifiEnabled
|
||||||
ethernetIP: root.ethernetIP
|
ethernetIP: root.ethernetIP
|
||||||
|
ethernetInterface: root.ethernetInterface
|
||||||
currentWifiSSID: root.currentWifiSSID
|
currentWifiSSID: root.currentWifiSSID
|
||||||
wifiIP: root.wifiIP
|
wifiIP: root.wifiIP
|
||||||
wifiSignalStrength: root.wifiSignalStrength
|
wifiSignalStrength: root.wifiSignalStrength
|
||||||
@@ -617,7 +618,7 @@ PanelWindow {
|
|||||||
AudioTab {
|
AudioTab {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingM
|
anchors.margins: Theme.spacingM
|
||||||
visible: controlCenterPopup.currentTab === 1
|
visible: controlCenterPopup.currentTab === "audio"
|
||||||
|
|
||||||
// Bind properties from root
|
// Bind properties from root
|
||||||
volumeLevel: root.volumeLevel
|
volumeLevel: root.volumeLevel
|
||||||
@@ -632,7 +633,7 @@ PanelWindow {
|
|||||||
BluetoothTab {
|
BluetoothTab {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingM
|
anchors.margins: Theme.spacingM
|
||||||
visible: controlCenterPopup.currentTab === 2
|
visible: controlCenterPopup.currentTab === "bluetooth"
|
||||||
|
|
||||||
// Bind properties from root
|
// Bind properties from root
|
||||||
bluetoothEnabled: root.bluetoothEnabled
|
bluetoothEnabled: root.bluetoothEnabled
|
||||||
@@ -643,7 +644,7 @@ PanelWindow {
|
|||||||
DisplayTab {
|
DisplayTab {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingM
|
anchors.margins: Theme.spacingM
|
||||||
visible: controlCenterPopup.currentTab === 3
|
visible: controlCenterPopup.currentTab === "display"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,12 @@ import "../../Services"
|
|||||||
Item {
|
Item {
|
||||||
id: networkTab
|
id: networkTab
|
||||||
|
|
||||||
property int networkSubTab: 0 // 0: Ethernet, 1: WiFi
|
property int networkSubTab: {
|
||||||
|
// Default to WiFi tab if WiFi is connected, otherwise Ethernet
|
||||||
|
if (networkStatus === "wifi") return 1
|
||||||
|
else if (networkStatus === "ethernet") return 0
|
||||||
|
else return 1 // Default to WiFi when nothing is connected
|
||||||
|
}
|
||||||
|
|
||||||
// Expose properties that the parent needs to bind to
|
// Expose properties that the parent needs to bind to
|
||||||
property bool wifiAutoRefreshEnabled: false
|
property bool wifiAutoRefreshEnabled: false
|
||||||
@@ -19,6 +24,7 @@ Item {
|
|||||||
property bool wifiAvailable: false
|
property bool wifiAvailable: false
|
||||||
property bool wifiEnabled: false
|
property bool wifiEnabled: false
|
||||||
property string ethernetIP: ""
|
property string ethernetIP: ""
|
||||||
|
property string ethernetInterface: ""
|
||||||
property string currentWifiSSID: ""
|
property string currentWifiSSID: ""
|
||||||
property string wifiIP: ""
|
property string wifiIP: ""
|
||||||
property string wifiSignalStrength: ""
|
property string wifiSignalStrength: ""
|
||||||
@@ -122,55 +128,63 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ethernet Tab Content
|
// Ethernet Tab Content
|
||||||
ScrollView {
|
Flickable {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - 48
|
height: parent.height - 48
|
||||||
visible: networkTab.networkSubTab === 0
|
visible: networkTab.networkSubTab === 0
|
||||||
clip: true
|
clip: true
|
||||||
|
contentWidth: width
|
||||||
|
contentHeight: ethernetContent.height
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
flickDeceleration: 8000
|
||||||
|
maximumFlickVelocity: 15000
|
||||||
|
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
ScrollBar.vertical: ScrollBar {
|
||||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
policy: ScrollBar.AsNeeded
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
id: ethernetContent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingL
|
spacing: Theme.spacingL
|
||||||
|
|
||||||
// Ethernet status card
|
// Ethernet status card
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 60
|
height: 70
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.3)
|
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.5)
|
||||||
border.color: networkTab.networkStatus === "ethernet" ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.3) : "transparent"
|
border.color: networkTab.networkStatus === "ethernet" ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||||
border.width: networkTab.networkStatus === "ethernet" ? 1 : 0
|
border.width: networkTab.networkStatus === "ethernet" ? 2 : 1
|
||||||
|
visible: networkTab.networkStatus === "ethernet" || networkTab.networkStatus === "disconnected"
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: Theme.spacingM
|
anchors.leftMargin: Theme.spacingL
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "lan"
|
text: "lan"
|
||||||
font.family: Theme.iconFont
|
font.family: Theme.iconFont
|
||||||
font.pixelSize: Theme.iconSize
|
font.pixelSize: Theme.iconSizeLarge - 4
|
||||||
color: networkTab.networkStatus === "ethernet" ? Theme.primary : Theme.surfaceText
|
color: networkTab.networkStatus === "ethernet" ? Theme.primary : Theme.surfaceText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
spacing: 2
|
spacing: 4
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Ethernet"
|
text: networkTab.networkStatus === "ethernet" ? (networkTab.ethernetInterface || "Ethernet") : "Ethernet"
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: networkTab.networkStatus === "ethernet" ? Theme.primary : Theme.surfaceText
|
color: networkTab.networkStatus === "ethernet" ? Theme.primary : Theme.surfaceText
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: networkTab.networkStatus === "ethernet" ? "Connected" : "Disconnected"
|
text: networkTab.networkStatus === "ethernet" ? (networkTab.ethernetIP || "Connected") : "Disconnected"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||||
}
|
}
|
||||||
@@ -218,74 +232,27 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ethernet details
|
|
||||||
Column {
|
|
||||||
width: parent.width
|
|
||||||
spacing: Theme.spacingM
|
|
||||||
visible: networkTab.networkStatus === "ethernet"
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "Connection Details"
|
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Medium
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width
|
|
||||||
height: 50
|
|
||||||
radius: Theme.cornerRadiusSmall
|
|
||||||
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08)
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Theme.spacingM
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: Theme.spacingM
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "language"
|
|
||||||
font.family: Theme.iconFont
|
|
||||||
font.pixelSize: Theme.iconSize
|
|
||||||
color: Theme.surfaceText
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
spacing: 2
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "IP Address"
|
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Medium
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: networkTab.ethernetIP || "192.168.1.100"
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WiFi Tab Content
|
// WiFi Tab Content
|
||||||
ScrollView {
|
Flickable {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - 48
|
height: parent.height - 48
|
||||||
visible: networkTab.networkSubTab === 1
|
visible: networkTab.networkSubTab === 1
|
||||||
clip: true
|
clip: true
|
||||||
|
contentWidth: width
|
||||||
|
contentHeight: wifiContent.height
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
flickDeceleration: 8000
|
||||||
|
maximumFlickVelocity: 15000
|
||||||
|
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
ScrollBar.vertical: ScrollBar {
|
||||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
policy: ScrollBar.AsNeeded
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
id: wifiContent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingL
|
spacing: Theme.spacingL
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,26 @@ PanelWindow {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: mainContainer
|
id: mainContainer
|
||||||
width: 600
|
width: 600
|
||||||
height: 650
|
height: {
|
||||||
|
// Calculate dynamic height based on content
|
||||||
|
let baseHeight = Theme.spacingXL * 2 + Theme.spacingL * 3 // Margins and spacing
|
||||||
|
|
||||||
|
// Add category section height if visible
|
||||||
|
if (categories.length > 1 || filteredModel.count > 0) {
|
||||||
|
baseHeight += 36 * 2 + Theme.spacingS + Theme.spacingM // Categories (2 rows)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add search field height
|
||||||
|
baseHeight += 56
|
||||||
|
|
||||||
|
// Add results height (limit to reasonable size)
|
||||||
|
let maxResultsHeight = 400
|
||||||
|
let actualResultsHeight = Math.min(filteredModel.count * (viewMode === "grid" ? 100 : 60), maxResultsHeight)
|
||||||
|
baseHeight += actualResultsHeight
|
||||||
|
|
||||||
|
// Ensure minimum and maximum bounds
|
||||||
|
return Math.min(Math.max(baseHeight, 300), parent.height - 40)
|
||||||
|
}
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: Theme.surfaceContainer
|
color: Theme.surfaceContainer
|
||||||
radius: Theme.cornerRadiusXLarge
|
radius: Theme.cornerRadiusXLarge
|
||||||
@@ -474,7 +493,7 @@ PanelWindow {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: resultsContainer
|
id: resultsContainer
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: Math.min(filteredModel.count * (viewMode === "grid" ? 100 : 60), 480)
|
height: parent.height - y // Use remaining space
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
// List view
|
// List view
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ ShellRoot {
|
|||||||
// Network properties from NetworkService
|
// Network properties from NetworkService
|
||||||
property string networkStatus: NetworkService.networkStatus
|
property string networkStatus: NetworkService.networkStatus
|
||||||
property string ethernetIP: NetworkService.ethernetIP
|
property string ethernetIP: NetworkService.ethernetIP
|
||||||
|
property string ethernetInterface: NetworkService.ethernetInterface
|
||||||
property string wifiIP: NetworkService.wifiIP
|
property string wifiIP: NetworkService.wifiIP
|
||||||
property bool bluetoothEnabled: BluetoothService.bluetoothEnabled
|
property bool bluetoothEnabled: BluetoothService.bluetoothEnabled
|
||||||
property bool bluetoothAvailable: BluetoothService.bluetoothAvailable
|
property bool bluetoothAvailable: BluetoothService.bluetoothAvailable
|
||||||
|
|||||||
Reference in New Issue
Block a user