panel title bar: add title, action buttons slot, divider; bt to popup mode; move wifi/bt toggles to title bar
This commit is contained in:
parent
46f14d5d36
commit
d4407ee538
7 changed files with 128 additions and 184 deletions
|
|
@ -8,12 +8,43 @@ M.HoverPanel {
|
|||
|
||||
contentWidth: 250
|
||||
panelNamespace: "nova-bluetooth"
|
||||
popupMode: true
|
||||
panelTitle: "Bluetooth"
|
||||
titleActionsComponent: Component {
|
||||
Item {
|
||||
width: 20
|
||||
height: 20
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "\uF011"
|
||||
color: menuWindow._btEnabled ? menuWindow.accentColor : M.Theme.base04
|
||||
font.pixelSize: M.Theme.fontSize
|
||||
font.family: M.Theme.iconFontFamily
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: {
|
||||
powerProc._action = menuWindow._btEnabled ? "off" : "on";
|
||||
powerProc.running = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onVisibleChanged: if (visible)
|
||||
scanner.running = true
|
||||
|
||||
readonly property bool _busy: powerProc.running || toggleProc.running
|
||||
|
||||
property var _devices: []
|
||||
property bool _btEnabled: true
|
||||
|
||||
|
|
@ -56,8 +87,10 @@ M.HoverPanel {
|
|||
id: powerProc
|
||||
property string _action: ""
|
||||
command: ["bluetoothctl", "power", _action]
|
||||
onRunningChanged: if (!running)
|
||||
scanner.running = true
|
||||
onRunningChanged: if (!running) {
|
||||
scanner.running = true;
|
||||
menuWindow.keepOpen(500);
|
||||
}
|
||||
}
|
||||
|
||||
property Process _toggleProc: Process {
|
||||
|
|
@ -65,72 +98,10 @@ M.HoverPanel {
|
|||
property string action: ""
|
||||
property string mac: ""
|
||||
command: ["bluetoothctl", action, mac]
|
||||
onRunningChanged: if (!running)
|
||||
scanner.running = true
|
||||
}
|
||||
|
||||
// Bluetooth radio toggle header
|
||||
Item {
|
||||
width: menuWindow.contentWidth
|
||||
height: 36
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 4
|
||||
anchors.rightMargin: 4
|
||||
color: btHeaderHover.hovered ? M.Theme.base02 : "transparent"
|
||||
radius: M.Theme.radius
|
||||
onRunningChanged: if (!running) {
|
||||
scanner.running = true;
|
||||
menuWindow.keepOpen(500);
|
||||
}
|
||||
|
||||
Text {
|
||||
id: btHeaderIcon
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "\uF294"
|
||||
color: menuWindow._btEnabled ? menuWindow.accentColor : M.Theme.base04
|
||||
font.pixelSize: M.Theme.fontSize + 1
|
||||
font.family: M.Theme.iconFontFamily
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.left: btHeaderIcon.right
|
||||
anchors.leftMargin: 8
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "Bluetooth"
|
||||
color: menuWindow._btEnabled ? M.Theme.base05 : M.Theme.base04
|
||||
font.pixelSize: M.Theme.fontSize
|
||||
font.family: M.Theme.fontFamily
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "\uF011"
|
||||
color: menuWindow._btEnabled ? menuWindow.accentColor : M.Theme.base04
|
||||
font.pixelSize: M.Theme.fontSize
|
||||
font.family: M.Theme.iconFontFamily
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: btHeaderHover
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
TapHandler {
|
||||
onTapped: {
|
||||
powerProc._action = menuWindow._btEnabled ? "off" : "on";
|
||||
powerProc.running = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: menuWindow.contentWidth - 16
|
||||
height: 1
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: M.Theme.base03
|
||||
}
|
||||
|
||||
Repeater {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue