mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-04-24 23:24:38 +00:00
[Linux] Add cross device setting
This commit is contained in:
committed by
Tim Gromeyer
parent
816992fd8a
commit
1c7bdf987c
@@ -131,21 +131,6 @@ ApplicationWindow {
|
|||||||
checked: airPodsTrayApp.conversationalAwareness
|
checked: airPodsTrayApp.conversationalAwareness
|
||||||
onCheckedChanged: airPodsTrayApp.conversationalAwareness = checked
|
onCheckedChanged: airPodsTrayApp.conversationalAwareness = checked
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
|
||||||
spacing: 10
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: newNameField
|
|
||||||
placeholderText: airPodsTrayApp.deviceName
|
|
||||||
maximumLength: 32
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
text: "Rename"
|
|
||||||
onClicked: airPodsTrayApp.renameAirPods(newNameField.text)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RoundButton {
|
RoundButton {
|
||||||
@@ -179,12 +164,41 @@ ApplicationWindow {
|
|||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
spacing: 5 // Small gap between label and ComboBox
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: "Pause Behavior When Removing AirPods:"
|
||||||
|
}
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
width: parent.width // Ensures full width
|
||||||
model: ["Pause When One Removed", "Pause When Both Removed", "Never Pause"]
|
model: ["One Removed", "Both Removed", "Never"]
|
||||||
currentIndex: airPodsTrayApp.earDetectionBehavior
|
currentIndex: airPodsTrayApp.earDetectionBehavior
|
||||||
onActivated: {
|
onActivated: airPodsTrayApp.earDetectionBehavior = currentIndex
|
||||||
airPodsTrayApp.earDetectionBehavior = currentIndex
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Switch {
|
||||||
|
text: "Cross-Device Connectivity with Android"
|
||||||
|
checked: airPodsTrayApp.crossDeviceEnabled
|
||||||
|
onCheckedChanged: {
|
||||||
|
airPodsTrayApp.setCrossDeviceEnabled(checked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: 10
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: newNameField
|
||||||
|
placeholderText: airPodsTrayApp.deviceName
|
||||||
|
maximumLength: 32
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
text: "Rename"
|
||||||
|
onClicked: airPodsTrayApp.renameAirPods(newNameField.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class AirPodsTrayApp : public QObject {
|
|||||||
Q_PROPERTY(bool rightPodInEar READ isRightPodInEar NOTIFY primaryChanged)
|
Q_PROPERTY(bool rightPodInEar READ isRightPodInEar NOTIFY primaryChanged)
|
||||||
Q_PROPERTY(bool airpodsConnected READ areAirpodsConnected NOTIFY airPodsStatusChanged)
|
Q_PROPERTY(bool airpodsConnected READ areAirpodsConnected NOTIFY airPodsStatusChanged)
|
||||||
Q_PROPERTY(int earDetectionBehavior READ earDetectionBehavior WRITE setEarDetectionBehavior NOTIFY earDetectionBehaviorChanged)
|
Q_PROPERTY(int earDetectionBehavior READ earDetectionBehavior WRITE setEarDetectionBehavior NOTIFY earDetectionBehaviorChanged)
|
||||||
|
Q_PROPERTY(bool crossDeviceEnabled READ crossDeviceEnabled WRITE setCrossDeviceEnabled NOTIFY crossDeviceEnabledChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AirPodsTrayApp(bool debugMode)
|
AirPodsTrayApp(bool debugMode)
|
||||||
@@ -270,6 +271,20 @@ public slots:
|
|||||||
emit earDetectionBehaviorChanged(behavior);
|
emit earDetectionBehaviorChanged(behavior);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setCrossDeviceEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
if (CrossDevice.isEnabled == enabled)
|
||||||
|
{
|
||||||
|
LOG_INFO("Cross-device feature is already " << (enabled ? "enabled" : "disabled"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CrossDevice.isEnabled = enabled;
|
||||||
|
saveCrossDeviceEnabled();
|
||||||
|
connectToPhone();
|
||||||
|
emit crossDeviceEnabledChanged(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
bool writePacketToSocket(const QByteArray &packet, const QString &logMessage)
|
bool writePacketToSocket(const QByteArray &packet, const QString &logMessage)
|
||||||
{
|
{
|
||||||
if (socket && socket->isOpen())
|
if (socket && socket->isOpen())
|
||||||
@@ -578,10 +593,8 @@ private slots:
|
|||||||
{
|
{
|
||||||
char primary = data[6];
|
char primary = data[6];
|
||||||
char secondary = data[7];
|
char secondary = data[7];
|
||||||
m_primaryInEar = primary == 0x00;
|
m_primaryInEar = data[6] == 0x00;
|
||||||
m_secoundaryInEar = secondary == 0x00;
|
m_secoundaryInEar = data[7] == 0x00;
|
||||||
m_primaryInEar = primary == 0x00;
|
|
||||||
m_secoundaryInEar = secondary == 0x00;
|
|
||||||
m_earDetectionStatus = QString("Primary: %1, Secondary: %2")
|
m_earDetectionStatus = QString("Primary: %1, Secondary: %2")
|
||||||
.arg(getEarStatus(primary), getEarStatus(secondary));
|
.arg(getEarStatus(primary), getEarStatus(secondary));
|
||||||
LOG_INFO("Ear detection status: " << m_earDetectionStatus);
|
LOG_INFO("Ear detection status: " << m_earDetectionStatus);
|
||||||
|
|||||||
Reference in New Issue
Block a user