Auto-formatting
This commit is contained in:
parent
4510762a35
commit
b0917f5a25
6 changed files with 42 additions and 43 deletions
|
|
@ -21,7 +21,6 @@ Item {
|
||||||
implicitWidth: pill.width
|
implicitWidth: pill.width
|
||||||
implicitHeight: pill.height
|
implicitHeight: pill.height
|
||||||
|
|
||||||
|
|
||||||
// Helper to evaluate and possibly notify
|
// Helper to evaluate and possibly notify
|
||||||
function maybeNotify(percent, charging) {
|
function maybeNotify(percent, charging) {
|
||||||
const p = Math.round(percent)
|
const p = Math.round(percent)
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ Item {
|
||||||
|
|
||||||
NPill {
|
NPill {
|
||||||
id: pill
|
id: pill
|
||||||
|
|
||||||
rightOpen: BarWidgetRegistry.getNPillDirection(root)
|
rightOpen: BarWidgetRegistry.getNPillDirection(root)
|
||||||
icon: getIcon()
|
icon: getIcon()
|
||||||
iconCircleColor: Color.mPrimary
|
iconCircleColor: Color.mPrimary
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,11 @@ ColumnLayout {
|
||||||
radius: Style.radiusM * scaling
|
radius: Style.radiusM * scaling
|
||||||
|
|
||||||
color: {
|
color: {
|
||||||
if (availableDeviceArea.containsMouse){
|
if (availableDeviceArea.containsMouse) {
|
||||||
if (canDisconnect && !isBusy)
|
if (canDisconnect && !isBusy)
|
||||||
return Color.mError
|
return Color.mError
|
||||||
|
|
||||||
if(!isBusy)
|
if (!isBusy)
|
||||||
return Color.mTertiary
|
return Color.mTertiary
|
||||||
return Color.mPrimary
|
return Color.mPrimary
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +58,7 @@ ColumnLayout {
|
||||||
if (modelData.pairing || modelData.state === BluetoothDeviceState.Connecting)
|
if (modelData.pairing || modelData.state === BluetoothDeviceState.Connecting)
|
||||||
return Color.mPrimary
|
return Color.mPrimary
|
||||||
|
|
||||||
if (modelData.blocked )
|
if (modelData.blocked)
|
||||||
return Color.mError
|
return Color.mError
|
||||||
|
|
||||||
return Color.mSurfaceVariant
|
return Color.mSurfaceVariant
|
||||||
|
|
@ -68,7 +68,7 @@ ColumnLayout {
|
||||||
|
|
||||||
NTooltip {
|
NTooltip {
|
||||||
id: tooltip
|
id: tooltip
|
||||||
target: bluetoothDeviceRectangle
|
target: bluetoothDeviceRectangle
|
||||||
positionAbove: Settings.data.bar.position === "bottom"
|
positionAbove: Settings.data.bar.position === "bottom"
|
||||||
text: root.tooltipText
|
text: root.tooltipText
|
||||||
}
|
}
|
||||||
|
|
@ -210,7 +210,6 @@ ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Call to action
|
// Call to action
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.preferredWidth: 80 * scaling
|
Layout.preferredWidth: 80 * scaling
|
||||||
|
|
@ -240,7 +239,7 @@ ColumnLayout {
|
||||||
if (modelData.blocked) {
|
if (modelData.blocked) {
|
||||||
return "Blocked"
|
return "Blocked"
|
||||||
}
|
}
|
||||||
if(modelData.connected){
|
if (modelData.connected) {
|
||||||
return "Disconnect"
|
return "Disconnect"
|
||||||
}
|
}
|
||||||
return "Connect"
|
return "Connect"
|
||||||
|
|
@ -248,7 +247,7 @@ ColumnLayout {
|
||||||
font.pointSize: Style.fontSizeXS * scaling
|
font.pointSize: Style.fontSizeXS * scaling
|
||||||
font.weight: Style.fontWeightMedium
|
font.weight: Style.fontWeightMedium
|
||||||
color: {
|
color: {
|
||||||
|
|
||||||
if (availableDeviceArea.containsMouse) {
|
if (availableDeviceArea.containsMouse) {
|
||||||
return Color.mOnTertiary
|
return Color.mOnTertiary
|
||||||
}
|
}
|
||||||
|
|
@ -264,24 +263,25 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
||||||
id: availableDeviceArea
|
id: availableDeviceArea
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: (canConnect || canDisconnect) && !isBusy ? Qt.PointingHandCursor : (isBusy ? Qt.BusyCursor : Qt.ArrowCursor)
|
cursorShape: (canConnect || canDisconnect)
|
||||||
|
&& !isBusy ? Qt.PointingHandCursor : (isBusy ? Qt.BusyCursor : Qt.ArrowCursor)
|
||||||
onEntered: {
|
onEntered: {
|
||||||
if (root.tooltipText && !isBusy) {
|
if (root.tooltipText && !isBusy) {
|
||||||
tooltip.show()
|
tooltip.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onExited: {
|
onExited: {
|
||||||
if(root.tooltipText && !isBusy) {
|
if (root.tooltipText && !isBusy) {
|
||||||
tooltip.hide()
|
tooltip.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onClicked: function(mouse) {
|
onClicked: function (mouse) {
|
||||||
|
|
||||||
if (!modelData || modelData.pairing) {
|
if (!modelData || modelData.pairing) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -289,9 +289,8 @@ ColumnLayout {
|
||||||
if (root.tooltipText && !isBusy) {
|
if (root.tooltipText && !isBusy) {
|
||||||
tooltip.hide()
|
tooltip.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mouse.button === Qt.LeftButton) {
|
||||||
if (mouse.button === Qt.LeftButton){
|
|
||||||
if (modelData.connected) {
|
if (modelData.connected) {
|
||||||
BluetoothService.disconnectDevice(modelData)
|
BluetoothService.disconnectDevice(modelData)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -84,22 +84,25 @@ NPanel {
|
||||||
BluetoothDevicesList {
|
BluetoothDevicesList {
|
||||||
label: "Connected devices"
|
label: "Connected devices"
|
||||||
property var items: {
|
property var items: {
|
||||||
if (!BluetoothService.adapter || !Bluetooth.devices) return []
|
if (!BluetoothService.adapter || !Bluetooth.devices)
|
||||||
|
return []
|
||||||
var filtered = Bluetooth.devices.values.filter(dev => dev && !dev.blocked && dev.connected)
|
var filtered = Bluetooth.devices.values.filter(dev => dev && !dev.blocked && dev.connected)
|
||||||
return BluetoothService.sortDevices(filtered)
|
return BluetoothService.sortDevices(filtered)
|
||||||
}
|
}
|
||||||
model: items
|
model: items
|
||||||
visible: items.length > 0
|
visible: items.length > 0
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Known devices
|
// Known devices
|
||||||
BluetoothDevicesList {
|
BluetoothDevicesList {
|
||||||
label: "Known devices"
|
label: "Known devices"
|
||||||
tooltipText: "Left click to connect, right click to forget"
|
tooltipText: "Left click to connect, right click to forget"
|
||||||
property var items: {
|
property var items: {
|
||||||
if (!BluetoothService.adapter || !Bluetooth.devices) return []
|
if (!BluetoothService.adapter || !Bluetooth.devices)
|
||||||
var filtered = Bluetooth.devices.values.filter(dev => dev && !dev.blocked && !dev.connected && (dev.paired || dev.trusted))
|
return []
|
||||||
|
var filtered = Bluetooth.devices.values.filter(dev => dev && !dev.blocked && !dev.connected
|
||||||
|
&& (dev.paired || dev.trusted))
|
||||||
return BluetoothService.sortDevices(filtered)
|
return BluetoothService.sortDevices(filtered)
|
||||||
}
|
}
|
||||||
model: items
|
model: items
|
||||||
|
|
@ -111,7 +114,8 @@ NPanel {
|
||||||
BluetoothDevicesList {
|
BluetoothDevicesList {
|
||||||
label: "Available devices"
|
label: "Available devices"
|
||||||
property var items: {
|
property var items: {
|
||||||
if (!BluetoothService.adapter || !Bluetooth.devices) return []
|
if (!BluetoothService.adapter || !Bluetooth.devices)
|
||||||
|
return []
|
||||||
var filtered = Bluetooth.devices.values.filter(dev => dev && !dev.blocked && !dev.paired && !dev.trusted)
|
var filtered = Bluetooth.devices.values.filter(dev => dev && !dev.blocked && !dev.paired && !dev.trusted)
|
||||||
return BluetoothService.sortDevices(filtered)
|
return BluetoothService.sortDevices(filtered)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,8 @@ Singleton {
|
||||||
function canConnect(device) {
|
function canConnect(device) {
|
||||||
if (!device)
|
if (!device)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Paired
|
Paired
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ Singleton {
|
||||||
property list<var> ddcMonitors: []
|
property list<var> ddcMonitors: []
|
||||||
readonly property list<Monitor> monitors: variants.instances
|
readonly property list<Monitor> monitors: variants.instances
|
||||||
property bool appleDisplayPresent: false
|
property bool appleDisplayPresent: false
|
||||||
|
|
||||||
function getMonitorForScreen(screen: ShellScreen): var {
|
function getMonitorForScreen(screen: ShellScreen): var {
|
||||||
return monitors.find(m => m.modelData === screen)
|
return monitors.find(m => m.modelData === screen)
|
||||||
}
|
}
|
||||||
|
|
@ -75,29 +75,24 @@ Singleton {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
// Do not filter out invalid displays. For some reason --brief returns some invalid which works fine
|
// Do not filter out invalid displays. For some reason --brief returns some invalid which works fine
|
||||||
var displays = text.trim().split("\n\n")
|
var displays = text.trim().split("\n\n")
|
||||||
|
|
||||||
|
|
||||||
ddcProc.ddcMonitors = displays.map(d => {
|
ddcProc.ddcMonitors = displays.map(d => {
|
||||||
|
|
||||||
var ddcModelMatc = d.match(/This monitor does not support DDC\/CI/)
|
var ddcModelMatc = d.match(/This monitor does not support DDC\/CI/)
|
||||||
var modelMatch = d.match(/Model:\s*(.*)/)
|
var modelMatch = d.match(/Model:\s*(.*)/)
|
||||||
var busMatch = d.match(/I2C bus:[ ]*\/dev\/i2c-([0-9]+)/)
|
var busMatch = d.match(/I2C bus:[ ]*\/dev\/i2c-([0-9]+)/)
|
||||||
var ddcModel = ddcModelMatc ? ddcModelMatc.length > 0 : false
|
var ddcModel = ddcModelMatc ? ddcModelMatc.length > 0 : false
|
||||||
var model = modelMatch ? modelMatch[1] : "Unknown"
|
var model = modelMatch ? modelMatch[1] : "Unknown"
|
||||||
var bus = busMatch ? busMatch[1] : "Unknown"
|
var bus = busMatch ? busMatch[1] : "Unknown"
|
||||||
Logger.log(
|
Logger.log("Detected DDC Monitor:", model, "on bus", bus, "is DDC:",
|
||||||
"Detected DDC Monitor:", model,
|
!ddcModel)
|
||||||
"on bus", bus, "is DDC:", !ddcModel
|
return {
|
||||||
)
|
"model": model,
|
||||||
return {
|
"busNum": bus,
|
||||||
"model": model,
|
"isDdc": !ddcModel
|
||||||
"busNum": bus,
|
}
|
||||||
"isDdc": !ddcModel,
|
})
|
||||||
}
|
|
||||||
})
|
|
||||||
root.ddcMonitors = ddcProc.ddcMonitors.filter(m => m.isDdc)
|
root.ddcMonitors = ddcProc.ddcMonitors.filter(m => m.isDdc)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue