[Linux] Add settings page (empty)

This commit is contained in:
Tim Gromeyer
2025-04-18 22:11:15 +02:00
committed by Tim Gromeyer
parent eacd862ef3
commit 3aeff4d986
4 changed files with 177 additions and 90 deletions

View File

@@ -31,6 +31,7 @@ qt_add_qml_module(applinux
BatteryIndicator.qml BatteryIndicator.qml
SegmentedControl.qml SegmentedControl.qml
PodColumn.qml PodColumn.qml
Icon.qml
) )
# Add the resource file # Add the resource file
@@ -46,6 +47,7 @@ qt_add_resources(applinux "resources"
assets/podpro.png assets/podpro.png
assets/podpro_case.png assets/podpro_case.png
assets/podmax.png assets/podmax.png
assets/fonts/SF-Symbols-6.ttf
) )
target_link_libraries(applinux target_link_libraries(applinux

13
linux/Icon.qml Normal file
View File

@@ -0,0 +1,13 @@
// Icon.qml
import QtQuick 2.15
Text {
property string icon: ""
font.family: iconFont.name
text: icon
FontLoader {
id: iconFont
source: "qrc:/icons/assets/fonts/SF-Symbols-6.ttf"
}
}

View File

@@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
@@ -10,110 +12,180 @@ ApplicationWindow {
onClosing: mainWindow.visible = false onClosing: mainWindow.visible = false
Column { // Mouse area for handling back/forward navigation
MouseArea {
anchors.fill: parent anchors.fill: parent
spacing: 20 acceptedButtons: Qt.BackButton | Qt.ForwardButton
padding: 20 onClicked: (mouse) => {
if (mouse.button === Qt.BackButton && stackView.depth > 1) {
// Connection status indicator (Apple-like pill shape) stackView.pop()
Rectangle { } else if (mouse.button === Qt.ForwardButton) {
anchors.horizontalCenter: parent.horizontalCenter console.log("Forward button pressed")
anchors.topMargin: 10
width: 120
height: 24
radius: 12
color: airPodsTrayApp.airpodsConnected ? "#30D158" : "#FF453A"
opacity: 0.8
visible: !airPodsTrayApp.airpodsConnected
Label {
anchors.centerIn: parent
text: airPodsTrayApp.airpodsConnected ? "Connected" : "Disconnected"
color: "white"
font.pixelSize: 12
font.weight: Font.Medium
} }
} }
}
// Battery Indicator Row StackView {
Row { id: stackView
anchors.horizontalCenter: parent.horizontalCenter anchors.fill: parent
spacing: 8 initialItem: mainPage
}
PodColumn { FontLoader {
isVisible: airPodsTrayApp.battery.leftPodAvailable id: iconFont
inEar: airPodsTrayApp.leftPodInEar source: "qrc:/icons/assets/fonts/SF-Symbols-6.ttf"
iconSource: "qrc:/icons/assets/" + airPodsTrayApp.podIcon }
batteryLevel: airPodsTrayApp.battery.leftPodLevel
isCharging: airPodsTrayApp.battery.leftPodCharging Component {
indicator: "L" id: mainPage
Item {
Column {
anchors.fill: parent
spacing: 20
padding: 20
// Connection status indicator (Apple-like pill shape)
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 10
width: 120
height: 24
radius: 12
color: airPodsTrayApp.airpodsConnected ? "#30D158" : "#FF453A"
opacity: 0.8
visible: !airPodsTrayApp.airpodsConnected
Label {
anchors.centerIn: parent
text: airPodsTrayApp.airpodsConnected ? "Connected" : "Disconnected"
color: "white"
font.pixelSize: 12
font.weight: Font.Medium
}
}
// Battery Indicator Row
Row {
anchors.horizontalCenter: parent.horizontalCenter
spacing: 8
PodColumn {
isVisible: airPodsTrayApp.battery.leftPodAvailable
inEar: airPodsTrayApp.leftPodInEar
iconSource: "qrc:/icons/assets/" + airPodsTrayApp.podIcon
batteryLevel: airPodsTrayApp.battery.leftPodLevel
isCharging: airPodsTrayApp.battery.leftPodCharging
indicator: "L"
}
PodColumn {
isVisible: airPodsTrayApp.battery.rightPodAvailable
inEar: airPodsTrayApp.rightPodInEar
iconSource: "qrc:/icons/assets/" + airPodsTrayApp.podIcon
batteryLevel: airPodsTrayApp.battery.rightPodLevel
isCharging: airPodsTrayApp.battery.rightPodCharging
indicator: "R"
}
PodColumn {
isVisible: airPodsTrayApp.battery.caseAvailable
inEar: true
iconSource: "qrc:/icons/assets/" + airPodsTrayApp.caseIcon
batteryLevel: airPodsTrayApp.battery.caseLevel
isCharging: airPodsTrayApp.battery.caseCharging
}
}
SegmentedControl {
anchors.horizontalCenter: parent.horizontalCenter
model: ["Off", "Noise Cancellation", "Transparency", "Adaptive"]
currentIndex: airPodsTrayApp.noiseControlMode
onCurrentIndexChanged: airPodsTrayApp.noiseControlMode = currentIndex
visible: airPodsTrayApp.airpodsConnected
}
Slider {
visible: airPodsTrayApp.adaptiveModeActive
from: 0
to: 100
stepSize: 1
value: airPodsTrayApp.adaptiveNoiseLevel
Timer {
id: debounceTimer
interval: 500
onTriggered: if (!parent.pressed) airPodsTrayApp.setAdaptiveNoiseLevel(parent.value)
}
onPressedChanged: if (!pressed) airPodsTrayApp.setAdaptiveNoiseLevel(value)
onValueChanged: if (pressed) debounceTimer.restart()
Label {
text: "Adaptive Noise Level: " + parent.value
anchors.top: parent.bottom
}
}
Switch {
text: "Conversational Awareness"
checked: airPodsTrayApp.conversationalAwareness
onCheckedChanged: airPodsTrayApp.conversationalAwareness = checked
}
Row {
spacing: 10
TextField {
id: newNameField
placeholderText: airPodsTrayApp.deviceName
maximumLength: 32
}
Button {
text: "Rename"
onClicked: airPodsTrayApp.renameAirPods(newNameField.text)
}
}
} }
PodColumn { RoundButton {
isVisible: airPodsTrayApp.battery.rightPodAvailable anchors.top: parent.top
inEar: airPodsTrayApp.rightPodInEar anchors.right: parent.right
iconSource: "qrc:/icons/assets/" + airPodsTrayApp.podIcon anchors.margins: 10
batteryLevel: airPodsTrayApp.battery.rightPodLevel font.family: iconFont.name
isCharging: airPodsTrayApp.battery.rightPodCharging font.pixelSize: 18
indicator: "R" text: "\uf958" // U+F958
} onClicked: stackView.push(settingsPage)
PodColumn {
isVisible: airPodsTrayApp.battery.caseAvailable
inEar: true
iconSource: "qrc:/icons/assets/" + airPodsTrayApp.caseIcon
batteryLevel: airPodsTrayApp.battery.caseLevel
isCharging: airPodsTrayApp.battery.caseCharging
} }
} }
}
SegmentedControl { Component {
anchors.horizontalCenter: parent.horizontalCenter id: settingsPage
model: ["Off", "Noise Cancellation", "Transparency", "Adaptive"] Item {
currentIndex: airPodsTrayApp.noiseControlMode // Add your settings page content here
onCurrentIndexChanged: airPodsTrayApp.noiseControlMode = currentIndex Column {
visible: airPodsTrayApp.airpodsConnected anchors.fill: parent
} spacing: 20
padding: 20
Slider { Label {
visible: airPodsTrayApp.adaptiveModeActive text: "Settings Page"
from: 0 anchors.horizontalCenter: parent.horizontalCenter
to: 100 }
stepSize: 1
value: airPodsTrayApp.adaptiveNoiseLevel
Timer {
id: debounceTimer
interval: 500
onTriggered: if (!parent.pressed) airPodsTrayApp.setAdaptiveNoiseLevel(parent.value)
} }
onPressedChanged: if (!pressed) airPodsTrayApp.setAdaptiveNoiseLevel(value) // Floating back button
onValueChanged: if (pressed) debounceTimer.restart() RoundButton {
anchors.top: parent.top
Label { anchors.left: parent.left
text: "Adaptive Noise Level: " + parent.value anchors.margins: 10
anchors.top: parent.bottom font.family: iconFont.name
} font.pixelSize: 18
} text: "\uecb1" // U+ECB1
onClicked: stackView.pop()
Switch {
text: "Conversational Awareness"
checked: airPodsTrayApp.conversationalAwareness
onCheckedChanged: airPodsTrayApp.conversationalAwareness = checked
}
Row {
spacing: 10
TextField {
placeholderText: airPodsTrayApp.deviceName
maximumLength: 32
}
Button {
text: "Rename"
onClicked: airPodsTrayApp.renameAirPods(newNameField.text)
} }
} }
} }

Binary file not shown.