From 9e0887c474df9a655f8fae316d92c7e3e734cba3 Mon Sep 17 00:00:00 2001 From: voidarc Date: Thu, 6 Aug 2026 10:09:32 +0100 Subject: [PATCH] deleted everything lol --- Bar/Center.qml | 263 -------------------- Bar/Center/Expanded.qml | 55 ----- Bar/Center/Mpris.qml | 62 ----- Bar/Center/NotificationDisplay.qml | 49 ---- Bar/Center/NotificationList.qml | 307 ----------------------- Bar/Left.qml | 70 ------ Bar/Left/WorkspaceContainer.qml | 86 ------- Bar/Left/WorkspaceSelector.qml | 87 ------- Bar/Right.qml | 27 -- Bar/Right/Battery.qml | 28 --- Bar/Right/Bluetooth.qml | 98 -------- Bar/Right/Bluetooth/Expanded.qml | 384 ----------------------------- 12 files changed, 1516 deletions(-) delete mode 100644 Bar/Center.qml delete mode 100644 Bar/Center/Expanded.qml delete mode 100644 Bar/Center/Mpris.qml delete mode 100644 Bar/Center/NotificationDisplay.qml delete mode 100644 Bar/Center/NotificationList.qml delete mode 100644 Bar/Left.qml delete mode 100644 Bar/Left/WorkspaceContainer.qml delete mode 100644 Bar/Left/WorkspaceSelector.qml delete mode 100644 Bar/Right.qml delete mode 100644 Bar/Right/Battery.qml delete mode 100644 Bar/Right/Bluetooth.qml delete mode 100644 Bar/Right/Bluetooth/Expanded.qml diff --git a/Bar/Center.qml b/Bar/Center.qml deleted file mode 100644 index 103cd75..0000000 --- a/Bar/Center.qml +++ /dev/null @@ -1,263 +0,0 @@ -pragma ComponentBehavior: Bound -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Hyprland -import Quickshell.Services.Mpris -import Quickshell.Services.Notifications -import "../Color.js" as Colors -import "../Components/" -import "../Services/" -import "./Center" - -Container { - id: root - - property Notification latestNotification: NotificationManager.getLatestNotification() || null - required property HyprlandMonitor monitor - property NotificationServer notifServer: NotificationManager.notif - property string previousState - - boxColor: Colors.mauve - defaultItem: time - exclusiveMonitor: root.monitor - exclusiveToScreen: true - - states: [ - State { - name: "" - - PropertyChanges { - root.boxHeight: 28 - root.boxRadius: 9 - root.boxWidth: 100 - root.visibleTopMargin: 0 - } - - StateChangeScript { - script: { - if (root.previousState != "hovered") { - root.stack.replace(time); - } - root.previousState = ""; - } - } - }, - State { - name: "hovered" - - PropertyChanges { - root.boxHeight: 35 - root.boxRadius: 15 - root.boxWidth: 110 - root.visibleTopMargin: 0 - } - - StateChangeScript { - script: { - root.previousState = "hovered"; - } - } - }, - State { - name: "mprisToast" - - PropertyChanges { - root.boxHeight: 35 - root.boxRadius: 15 - root.boxWidth: 350 - root.visibleTopMargin: 0 - } - - StateChangeScript { - script: { - root.previousState = "mpris"; - root.stack.replace(mpris); - } - } - }, - State { - name: "expanded" - - PropertyChanges { - root.boxHeight: 140 - root.boxRadius: 30 - root.boxWidth: 300 - root.visibleTopMargin: 0 - } - - StateChangeScript { - script: { - if (root.state != "notifications") { - root.stack.replace(fullTime); - root.previousState = "expanded"; - } - } - } - }, - State { - extend: "expanded" - name: "notifications" - - PropertyChanges { - root.boxHeight: 320 - } - }, - State { - name: "notified" - - PropertyChanges { - root.boxHeight: 90 - root.boxRadius: 30 - root.boxWidth: 330 - root.visibleTopMargin: 20 - } - - StateChangeScript { - script: { - root.stack.replace(notification); - root.previousState = "notified"; - } - } - } - ] - - hover.onHoveredChanged: { - if (hover.hovered == true) { - if (root.state == "notified") { - root.state = "notified"; - notificationViewTimer.stop(); - } else if (MprisManager.getPlaying() == true) { - root.state = "mprisToast"; - } else { - root.state = "hovered"; - } - } else { - root.state = ""; - } - } - onLatestNotificationChanged: { - if (latestNotification != null && Hyprland.focusedMonitor == monitor) { - if (root.latestNotification.lastGeneration == false) { - root.state = "notified"; - notificationViewTimer.restart(); - } - } - } - tap.onTapped: { - root.state == "hovered" ? root.state = "expanded" : undefined; - } - - Connections { - function onTrackChanged() { - if (Hyprland.focusedMonitor == root.monitor) { - musicToastTimer.restart(); - if (root.state == "") { - root.state = "mprisToast"; - } - } - } - - target: MprisManager.defaultPlayer - } - - Timer { - id: notificationViewTimer - - interval: 3000 - repeat: false - running: false - - onTriggered: { - root.state = ""; - } - } - - Timer { - id: musicToastTimer - - interval: 3000 - repeat: false - running: false - - onTriggered: { - if (!root.hover.hovered) { - root.state = ""; - } - } - } - - Component { - id: time - - Item { - CenteredText { - text: Time.time - } - } - } - - Component { - id: mpris - - Mpris { - TapHandler { - onTapped: root.state = "expanded" - } - - TapHandler { - acceptedButtons: Qt.RightButton - - onTapped: MprisManager.skip() - } - - TapHandler { - acceptedButtons: Qt.MiddleButton - - onTapped: MprisManager.prev() - } - } - } - - Component { - id: fullTime - - Expanded { - NotificationList { - id: notifList - - animEnabled: false - radius: root.boxRadius - rootState: root.state - server: root.notifServer - state: "" - - TapHandler { - onTapped: { - notifList.animEnabled = true; - root.state = "notifications"; - Qt.callLater(() => { - notifList.animEnabled = false; - }); - } - } - } - } - } - - Component { - id: notification - - NotificationDisplay { - body: root.latestNotification.body - summary: root.latestNotification.summary - - TapHandler { - onTapped: { - root.state = "notifications"; - root.stack.replace(fullTime); - } - } - } - } -} diff --git a/Bar/Center/Expanded.qml b/Bar/Center/Expanded.qml deleted file mode 100644 index 2908700..0000000 --- a/Bar/Center/Expanded.qml +++ /dev/null @@ -1,55 +0,0 @@ -import QtQuick -import Quickshell -import "../../Color.js" as Colors -import "../../Components/" -import "../../Services/" - -Item { - id: fullTimeRoot - - Rectangle { - anchors.fill: parent - radius: 30 - - gradient: MidpointGradient { - color: Colors.red - } - } - - Item { - id: timeColumnContainer - - anchors.fill: parent - - Column { - id: timeColumn - - spacing: 5 - - anchors { - centerIn: parent - } - - StyledText { - anchors.horizontalCenter: parent.horizontalCenter - color: Colors.surface0 - text: Time.time - - font { - pointSize: 30 - } - } - - StyledText { - anchors.horizontalCenter: parent.horizontalCenter - color: Colors.surface1 - text: Time.date - - font { - pointSize: 9 - weight: 400 - } - } - } - } -} diff --git a/Bar/Center/Mpris.qml b/Bar/Center/Mpris.qml deleted file mode 100644 index 51adfe2..0000000 --- a/Bar/Center/Mpris.qml +++ /dev/null @@ -1,62 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell.Services.Mpris -import "../../Color.js" as Colors -import "../../Components/" -import "../../Services/" - -Item { - id: root - - property MprisPlayer player: MprisManager.defaultPlayer - - Rectangle { - color: Colors.red - radius: 5 - - anchors { - bottomMargin: 15 - fill: parent - leftMargin: 10 - rightMargin: parent.width - ((parent.width * MprisManager.pos) - 10) - topMargin: 15 - } - } - - RowLayout { - anchors { - bottomMargin: 2 - fill: parent - leftMargin: 7 - rightMargin: 7 - topMargin: 2 - } - - Item { - Layout.fillHeight: true - Layout.preferredWidth: height - - Image { - anchors.fill: parent - fillMode: Image.PreserveAspectFit - source: MprisManager.defaultPlayer.trackArtUrl - } - } - - Item { - Layout.fillHeight: true - Layout.fillWidth: true - - StyledText { - elide: Qt.ElideRight - horizontalAlignment: Qt.AlignHCenter - text: MprisManager.defaultPlayer.trackArtist + " - " + MprisManager.defaultPlayer.trackTitle - verticalAlignment: Qt.AlignVCenter - - anchors { - fill: parent - } - } - } - } -} diff --git a/Bar/Center/NotificationDisplay.qml b/Bar/Center/NotificationDisplay.qml deleted file mode 100644 index 65a27e3..0000000 --- a/Bar/Center/NotificationDisplay.qml +++ /dev/null @@ -1,49 +0,0 @@ -import QtQuick -import Quickshell -import Quickshell.Services.Notifications -import "../../Color.js" as Colors -import "../../Components/" -import "../../Services/" - -Item { - id: root - - required property string body - required property string summary - - Rectangle { - anchors.fill: parent - radius: 30 - - gradient: MidpointGradient { - color: Colors.green - midpoint: 0.7 - } - } - - Column { - anchors.centerIn: parent - spacing: 5 - - StyledText { - anchors.horizontalCenter: parent.horizontalCenter - font.pointSize: 11 - text: root.summary - } - - StyledText { - elide: Text.ElideRight - horizontalAlignment: Text.AlignHCenter - maximumLineCount: 2 - text: root.body - verticalAlignment: Text.AlignVCenter - width: root.width - 20 - wrapMode: Text.WordWrap - - font { - pointSize: 10 - weight: 500 - } - } - } -} diff --git a/Bar/Center/NotificationList.qml b/Bar/Center/NotificationList.qml deleted file mode 100644 index c6372c9..0000000 --- a/Bar/Center/NotificationList.qml +++ /dev/null @@ -1,307 +0,0 @@ -import QtQuick -import QtQuick.Effects -import Quickshell -import Quickshell.Services.Notifications -import "../../Color.js" as Colors -import "../../Components/" -import "../../Services/" - -Item { - id: root - - required property bool animEnabled - required property double radius - required property string rootState - required property NotificationServer server - - Behavior on anchors.topMargin { - enabled: root.animEnabled - - SpringAnimation { - damping: 0.35 - spring: 4 - } - } - states: [ - State { - name: "" - when: root.rootState != "notifications" - - PropertyChanges { - root.anchors.topMargin: root.parent.height - 21 - } - }, - State { - name: "expanded" - when: root.rootState == "notifications" - - PropertyChanges { - root.anchors.topMargin: 5 - } - } - ] - - anchors { - bottom: parent.bottom - left: parent.left - right: parent.right - top: parent.top - topMargin: parent.height - 21 - } - - Rectangle { - id: background - - anchors.fill: parent - color: Colors.surface0 - radius: root.radius - 3 - - states: [ - State { - name: "" - when: root.rootState != "notifications" - - PropertyChanges {} - }, - State { - name: "expanded" - when: root.rootState == "notifications" - - PropertyChanges { - background.anchors.bottomMargin: 5 - background.anchors.leftMargin: 5 - background.anchors.rightMargin: 5 - } - } - ] - - anchors { - bottomMargin: 15 - leftMargin: 20 - rightMargin: 20 - } - } - - Item { - id: notifListContainer - - anchors.fill: parent - clip: true - opacity: 0 - - anchors { - bottomMargin: 5 - leftMargin: 5 - rightMargin: 5 - topMargin: 5 - } - - CenteredText { - color: Colors.overlay0 - text: "No Notifications" - visible: root.server.trackedNotifications.values.length <= 0 - } - - ListView { - id: notifScrollingList - - anchors.fill: parent - boundsBehavior: Flickable.StopAtBounds - height: Math.min(contentHeight, parent.height) - implicitHeight: background.height - model: root.server.trackedNotifications.values.length - spacing: 7 - - delegate: Item { - id: notifRoot - - property Notification currentNotif: root.server.trackedNotifications.values[(notifRoot.notifLen - - 1) - index] - required property real index - property real notifLen: root.server.trackedNotifications.values.length - - height: 50 - width: ListView.view.width - - states: [ - State { - name: "" - when: notifHover.hovered == false - }, - State { - name: "hovered" - when: notifHover.hovered == false - - PropertyChanges {} - } - ] - - HoverHandler { - id: notifHover - } - - Rectangle { - id: dismissButton - - color: Colors.red - implicitWidth: 100 - radius: 10 - - Behavior on anchors.rightMargin { - NumberAnimation { - duration: 100 - } - } - states: [ - State { - name: "" - when: notifHover.hovered == false - }, - State { - name: "hovered" - when: notifHover.hovered == true - - PropertyChanges { - dismissButton.anchors.rightMargin: 5 - } - } - ] - - StyledText { - color: Colors.surface0 - font.pointSize: 15 - horizontalAlignment: Qt.AlignRight - text: "󰩹" - verticalAlignment: Qt.AlignVCenter - - anchors { - fill: parent - rightMargin: 14 - } - } - - TapHandler { - onTapped: { - notifRoot.currentNotif.dismiss(); - } - } - - anchors { - bottom: parent.bottom - bottomMargin: 3 - right: parent.right - rightMargin: 10 - top: parent.top - topMargin: 3 - } - } - - Rectangle { - id: textContainer - - anchors.fill: parent - clip: true - color: Colors.surface2 - radius: 9 - - Behavior on anchors.rightMargin { - NumberAnimation { - duration: 100 - } - } - states: [ - State { - name: "" - when: notifHover.hovered == false - }, - State { - name: "hovered" - when: notifHover.hovered == true - - PropertyChanges { - textContainer.anchors.rightMargin: 40 - } - } - ] - - Column { - id: textColumn - - anchors { - centerIn: parent - left: parent.left - right: parent.right - } - - StyledText { - color: Colors.text - horizontalAlignment: Text.AlignHCenter - text: notifRoot.currentNotif.summary - verticalAlignment: Text.AlignVCenter - width: notifRoot.width - 10 - } - - StyledText { - color: Colors.subtext1 - horizontalAlignment: Text.AlignHCenter - text: notifRoot.currentNotif.body - verticalAlignment: Text.AlignVCenter - width: notifRoot.width - 10 - } - } - } - } - - anchors { - bottomMargin: 5 - leftMargin: 10 - rightMargin: 10 - topMargin: 5 - } - } - } - - MultiEffect { - id: notifListClipper - - anchors.fill: notifListContainer - maskEnabled: true - maskSource: clipsource - opacity: 0 - source: notifListContainer - - Behavior on opacity { - NumberAnimation { - duration: 100 - } - } - states: [ - State { - name: "" - when: root.rootState != "notifications" - - PropertyChanges { - notifListClipper.opacity: 0 - } - }, - State { - name: "expanded" - when: root.rootState == "notifications" - - PropertyChanges { - notifListClipper.opacity: 1 - } - } - ] - } - - Rectangle { - id: clipsource - - anchors.fill: background - color: "black" - layer.enabled: true - radius: background.radius - visible: false - } -} diff --git a/Bar/Left.qml b/Bar/Left.qml deleted file mode 100644 index 99ff888..0000000 --- a/Bar/Left.qml +++ /dev/null @@ -1,70 +0,0 @@ -pragma ComponentBehavior: Bound -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Hyprland -import Quickshell.Services.Notifications -import "../Color.js" as Colors -import "../Components/" -import "../Services/" -import "./Center" -import "./Left/" - -Container { - id: root - - property double extraHoveredWidth: 0 - required property HyprlandMonitor monitor - property double rowLeftMargin: 4 - property double rowSpacing: 3 - property double rowYmargin: 3 - property double selectorFocusedExtra: 15 - property double selectorHeight: 20 - property double selectorWidth: 20 - property double spacing: 3 - property double workspaceNumber: WorkspaceManager.getNumberOfWorkspaces(monitor) - - boxHeight: 25 - boxWidth: (selectorWidth * workspaceNumber) + ((2 * rowLeftMargin) + (rowSpacing * ( - workspaceNumber - 1))) + extraHoveredWidth + (hoverHandler.hovered == true - ? selectorFocusedExtra : 0) - exclusiveMonitor: monitor - - defaultItem: WorkspaceContainer { - extraHoveredWidth: root.extraHoveredWidth - monitor: root.monitor - rowLeftMargin: root.rowLeftMargin - rowSpacing: root.rowSpacing - rowYmargin: root.rowYmargin - selectorFocusedExtra: root.selectorFocusedExtra - selectorHeight: root.selectorHeight - selectorWidth: root.selectorWidth - } - Behavior on rowYmargin { - SpringAnimation { - damping: 0.3 - spring: 4 - } - } - states: [ - State { - name: "" - when: !hoverHandler.hovered - }, - State { - name: "hovered" - when: hoverHandler.hovered - - PropertyChanges { - root.boxHeight: 40 - root.extraHoveredWidth: 25 - root.rowYmargin: 5 - root.selectorWidth: 40 - } - } - ] - - HoverHandler { - id: hoverHandler - } -} diff --git a/Bar/Left/WorkspaceContainer.qml b/Bar/Left/WorkspaceContainer.qml deleted file mode 100644 index 65ccc38..0000000 --- a/Bar/Left/WorkspaceContainer.qml +++ /dev/null @@ -1,86 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Hyprland -import "../../Color.js" as Colors -import "../../Components/" -import "../../Services/" - -Item { - id: root - - required property double extraHoveredWidth - required property HyprlandMonitor monitor - required property double rowLeftMargin - required property double rowSpacing - required property double rowYmargin - required property double selectorFocusedExtra - required property double selectorHeight - required property double selectorWidth - - Item { - id: newWorkspaceButton - - implicitWidth: 20 - opacity: root.extraHoveredWidth > 0 ? 1 : 0 - - Behavior on opacity { - NumberAnimation { - duration: 100 - } - } - - TapHandler { - id: tapHandler - - onTapped: WorkspaceManager.activateNextFreeWorkspace() - } - - anchors { - bottom: parent.bottom - bottomMargin: 5 + root.rowYmargin - right: parent.right - rightMargin: 4 - top: parent.top - topMargin: 5 + root.rowYmargin - } - - Rectangle { - anchors.fill: parent - color: Colors.green - radius: 4 - - StyledText { - anchors.centerIn: parent - text: "+" - } - } - } - - Row { - spacing: root.rowSpacing - - anchors { - bottom: parent.bottom - bottomMargin: root.rowYmargin - left: parent.left - leftMargin: root.rowLeftMargin - top: parent.top - topMargin: root.rowYmargin - } - - Repeater { - model: WorkspaceManager.getWorkspacesForMonitor(root.monitor) - - WorkspaceSelector { - required property HyprlandWorkspace modelData - - extraHoveredWidth: root.extraHoveredWidth - selectorFocusedExtra: root.selectorFocusedExtra - selectorHeight: root.selectorHeight - selectorWidth: root.selectorWidth - workspace: modelData - } - } - } -} diff --git a/Bar/Left/WorkspaceSelector.qml b/Bar/Left/WorkspaceSelector.qml deleted file mode 100644 index 3111d51..0000000 --- a/Bar/Left/WorkspaceSelector.qml +++ /dev/null @@ -1,87 +0,0 @@ -import QtQuick -import QtQuick.Controls -import Quickshell -import Quickshell.Hyprland -import "../../Color.js" as Colors -import "../../Components/" -import "../../Services/" - -Item { - id: root - - required property double extraHoveredWidth - property bool hovered: extraHoveredWidth > 0 ? true : false - property color selectorColor: Colors.surface2 - required property double selectorFocusedExtra - required property double selectorHeight - required property double selectorWidth - required property HyprlandWorkspace workspace - property string workspaceState: WorkspaceManager.getWorkspaceState(workspace) - - implicitWidth: selectorWidth + (root.hovered == true ? (root.workspaceState == "focused" - ? selectorFocusedExtra : 0) : 0) - - Behavior on implicitWidth { - SpringAnimation { - damping: 0.3 - spring: 4 - } - } - states: [ - State { - name: "" - when: root.workspaceState == "inactive" - - PropertyChanges { - root.selectorColor: Colors.surface2 - } - }, - State { - name: "active" - when: root.workspaceState == "active" - - PropertyChanges { - root.selectorColor: Colors.overlay2 - } - }, - State { - name: "focused" - when: root.workspaceState == "focused" - - PropertyChanges { - root.selectorColor: Colors.lavender - } - } - ] - - TapHandler { - id: tapHandler - - onTapped: root.workspace.activate() - } - - anchors { - bottom: parent.bottom - top: parent.top - } - - Rectangle { - color: root.selectorColor - radius: 6 - - Behavior on color { - ColorAnimation { - duration: 100 - } - } - - anchors { - fill: parent - } - - CenteredText { - font.pointSize: 10.5 - text: root.workspace.id - } - } -} diff --git a/Bar/Right.qml b/Bar/Right.qml deleted file mode 100644 index 093d19d..0000000 --- a/Bar/Right.qml +++ /dev/null @@ -1,27 +0,0 @@ -pragma ComponentBehavior: Bound -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Hyprland -import Quickshell.Services.Notifications -import "../Color.js" as Colors -import "../Components/" -import "../Services/" -import "./Center" -import "./Right/" - -Row { - id: root - - required property HyprlandMonitor monitor - - spacing: 10 - - Battery { - exclusiveMonitor: root.monitor - } - - Bluetooth { - exclusiveMonitor: root.monitor - } -} diff --git a/Bar/Right/Battery.qml b/Bar/Right/Battery.qml deleted file mode 100644 index 3b5f605..0000000 --- a/Bar/Right/Battery.qml +++ /dev/null @@ -1,28 +0,0 @@ -pragma ComponentBehavior: Bound -import QtQuick -import Quickshell -import Quickshell.Services.UPower -import "../../Color.js" as Colors -import "../../Components/" -import "../../Services/" -import "Bluetooth" - -Container { - id: root - - animOffset: 160 - boxColor: Colors.green - boxHeight: 25 - boxWidth: 40 - defaultItem: icon - exclusiveToScreen: true - forceHidden: BatteryManager.battery.isLaptopBattery - - Component { - id: icon - - CenteredText { - text: BatteryManager.batteryPercentage - } - } -} diff --git a/Bar/Right/Bluetooth.qml b/Bar/Right/Bluetooth.qml deleted file mode 100644 index a3df4db..0000000 --- a/Bar/Right/Bluetooth.qml +++ /dev/null @@ -1,98 +0,0 @@ -pragma ComponentBehavior: Bound -import QtQuick -import Quickshell -import Quickshell.Bluetooth -import "../../Color.js" as Colors -import "../../Components/" -import "../../Services/" -import "Bluetooth" - -Container { - id: root - - property bool shown: false - - animOffset: 200 - boxColor: Colors.peach - boxHeight: 25 - boxWidth: 30 - defaultItem: icon - exclusiveToScreen: true - forceHidden: !(root.shown || BluetoothManager.getConnected()) - hoverableWhenHidden: true - state: "" - - states: [ - State { - name: "" - - PropertyChanges { - root.boxHeight: 25 - root.boxWidth: 30 - } - - StateChangeScript { - script: { - root.stack.replace(icon); - } - } - }, - State { - name: "expanded" - - PropertyChanges { - root.boxHeight: 250 - root.boxRadius: 20 - root.boxWidth: 350 - } - - StateChangeScript { - script: { - root.stack.replace(expanded); - root.shown = true; - } - } - } - ] - - hover.onHoveredChanged: { - if (hover.hovered == false) { - root.state = ""; - hoverIntervalTimer.start(); - } else { - root.shown = true; - hoverIntervalTimer.start(); - } - } - tap.onTapped: state = "expanded" - - Timer { - id: hoverIntervalTimer - - interval: 500 - repeat: false - running: false - - onTriggered: { - if (root.hover.hovered == false) { - root.shown = false; - } - } - } - - Component { - id: icon - - Item { - CenteredText { - text: BluetoothManager.getConnected() == true ? "󰂱" : "󰂲" - } - } - } - - Component { - id: expanded - - Expanded {} - } -} diff --git a/Bar/Right/Bluetooth/Expanded.qml b/Bar/Right/Bluetooth/Expanded.qml deleted file mode 100644 index 71b4f61..0000000 --- a/Bar/Right/Bluetooth/Expanded.qml +++ /dev/null @@ -1,384 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell.Bluetooth -import "../../../Color.js" as Colors -import "../../../Components/" -import "../../../Services/" - -Item { - id: root - - property double topBarHeight: 35 - - Rectangle { - color: Colors.surface0 - radius: 17 - - anchors { - bottomMargin: 5 - fill: parent - leftMargin: 5 - rightMargin: 5 - topMargin: 5 - } - - Rectangle { - id: topBar - - property double topBarHeight: root.topBarHeight - - color: Colors.peach - implicitHeight: topBarHeight - radius: 9 - - anchors { - left: parent.left - leftMargin: 5 - right: parent.right - rightMargin: 5 - top: parent.top - topMargin: 5 - } - - RowLayout { - id: topBarRow - - property double topBarRowPadding: 4 - - spacing: 3 - - anchors { - left: parent.left - leftMargin: topBarRowPadding - right: parent.right - rightMargin: topBarRowPadding - top: parent.top - topMargin: topBarRowPadding - } - - Rectangle { - Layout.fillWidth: true - // color: Qt.lighter(Colors.peach, 1.2) - color: Colors.surface1 - implicitHeight: topBar.topBarHeight - (topBarRow.topBarRowPadding * 2) - radius: 6 - - StyledText { - anchors.verticalCenter: parent.verticalCenter - color: Colors.text - horizontalAlignment: Qt.AlignLeft - text: " " + BluetoothManager.defaultAdapterName - } - } - - Rectangle { - id: scanButton - - color: Qt.lighter(Colors.peach, 1.15) - implicitHeight: topBar.topBarHeight - (topBarRow.topBarRowPadding * 2) - implicitWidth: topBar.topBarHeight - (topBarRow.topBarRowPadding * 2) - radius: 6 - - Behavior on color { - ColorAnimation { - duration: 100 - } - } - states: [ - State { - name: "hovered" - - PropertyChanges { - scanButton.color: Colors.green - } - } - ] - - border { - color: Colors.surface0 - width: 2 - } - - HoverHandler { - onHoveredChanged: hovered == true ? scanButton.state = "hovered" : scanButton.state = "" - } - - TapHandler { - onTapped: { - BluetoothManager.toggleDiscover(); - } - } - - CenteredText { - id: scanButtonText - - text: "" - - NumberAnimation { - id: animateRotation - - duration: 1000 - from: 0 - loops: Animation.Infinite - properties: "rotation" - running: BluetoothManager.defaultAdapter.discovering - target: scanButtonText - to: 360 - - onStopped: { - scanButton.rotation = 0; - } - } - } - } - } - } - - ListView { - boundsBehavior: Flickable.StopAtBounds - clip: true - model: BluetoothManager.getDevicesList() - spacing: 5 - - delegate: Item { - id: deviceRoot - - required property real index - required property BluetoothDevice modelData - - height: 55 - width: ListView.view.width - - Rectangle { - id: containerBox - - anchors.fill: parent - clip: true - color: Colors.peach - radius: 7 - - Rectangle { - anchors.centerIn: parent - color: Colors.green - implicitHeight: parent.height - 10 - implicitWidth: parent.width * (deviceRoot.modelData.batteryAvailable == true - ? deviceRoot.modelData.battery : 0) - 10 - opacity: 0.7 - radius: 7 - visible: deviceRoot.modelData.batteryAvailable == true - } - - RowLayout { - anchors { - bottomMargin: 4 - fill: parent - leftMargin: 4 - rightMargin: 4 - topMargin: 4 - } - - Rectangle { - Layout.fillHeight: true - Layout.preferredWidth: height - color: deviceRoot.modelData.connected ? Colors.green : Qt.lighter(Colors.peach, 1.25) - radius: 5 - - CenteredText { - color: Colors.surface0 - font.pointSize: 30 - text: BluetoothManager.getIcon(deviceRoot.modelData.icon) - } - } - - ColumnLayout { - Layout.fillWidth: true - - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - color: Qt.lighter(Colors.peach, 1.15) - radius: 4 - - StyledText { - anchors.fill: parent - anchors.verticalCenter: parent.verticalCenter - elide: Qt.ElideRight - text: deviceRoot.modelData.name - } - } - - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - color: "transparent" - - StyledText { - anchors.fill: parent - anchors.verticalCenter: parent.verticalCenter - color: Colors.surface2 - font.weight: 300 - text: deviceRoot.modelData.address - } - } - } - - Item { - Layout.fillHeight: true - Layout.preferredWidth: height - - RowLayout { - anchors.fill: parent - - Rectangle { - id: itemEntry - - Layout.fillHeight: true - Layout.fillWidth: true - color: Colors.red - radius: 3 - - Loader { - id: deleteButtonLoader - - anchors.fill: parent - sourceComponent: forgetButton - - states: [ - State { - name: "" - when: deviceRoot.modelData.connected == false - - PropertyChanges { - deleteButtonLoader.sourceComponent: forgetButton - } - }, - State { - name: "connected" - when: deviceRoot.modelData.connected == true - - PropertyChanges { - deleteButtonLoader.sourceComponent: disconnectButton - } - } - ] - } - - Component { - id: disconnectButton - - Item { - anchors.fill: parent - - TapHandler { - onTapped: deviceRoot.modelData.disconnect() - } - - CenteredText { - text: "" - } - } - } - - Component { - id: forgetButton - - Item { - anchors.fill: parent - - TapHandler { - onTapped: deviceRoot.modelData.forget() - } - - CenteredText { - text: "󰩹" - } - } - } - } - - Rectangle { - id: greenButton - - property Component loadedItem: connectButton - - Layout.fillHeight: true - Layout.fillWidth: true - color: Colors.green - radius: 3 - - states: [ - State { - name: "" - when: deviceRoot.modelData.paired == true - - PropertyChanges { - greenButton.color: Colors.green - greenButton.loadedItem: connectButton - } - }, - State { - name: "unpaired" - when: deviceRoot.modelData.paired == false - - PropertyChanges { - greenButton.color: Colors.blue - greenButton.loadedItem: pairButton - } - } - ] - - Loader { - anchors.fill: parent - sourceComponent: greenButton.loadedItem - } - - Component { - id: connectButton - - Item { - anchors.fill: parent - - CenteredText { - text: "󱘖" - } - - TapHandler { - onTapped: deviceRoot.modelData.connect() - } - } - } - - Component { - id: pairButton - - Item { - anchors.fill: parent - - CenteredText { - text: "" - } - - TapHandler { - onTapped: { - deviceRoot.modelData.pair(); - } - } - } - } - } - } - } - } - } - } - - anchors { - bottomMargin: 5 - fill: parent - leftMargin: 5 - rightMargin: 5 - topMargin: 10 + root.topBarHeight - } - } - } -}