Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Assets/Translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,16 @@
"panel": {
"available-devices": "Available devices",
"blocked": "Blocked",
"codec-aac": "AAC",
"codec-aptx": "aptX",
"codec-aptx-hd": "aptX HD",
"codec-cvsd": "CVSD",
"codec-lc3": "LC3",
"codec-ldac": "LDAC",
"codec-msbc": "mSBC",
"codec-open-blueman": "Open in Blueman Manager",
"codec-sbc": "SBC",
"codec-selector": "Codec",
"connected-devices": "Connected devices",
"device-address": "Device address",
"disabled": "Bluetooth is disabled",
Expand Down Expand Up @@ -1928,6 +1938,9 @@
"auto-connect-disabled": "Auto-connect disabled",
"auto-connect-enabled": "Auto-connect enabled",
"auto-connecting": "Connecting to {count} device(s)...",
"codec-apply-failed": "Failed to apply Bluetooth codec profile",
"codec-open-blueman": "Open Blueman Manager to apply codec: {codec}",
"codec-selector-unavailable": "Codec profile backend is unavailable",
"confirm-code": "Confirm code {value} on the other device.",
"connect-failed": "Failed to connect to device",
"disconnect-failed": "Failed to disconnect from device",
Expand Down
57 changes: 57 additions & 0 deletions Modules/Panels/Settings/Tabs/Connections/BluetoothSubTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,30 @@ Item {
readonly property bool canPair: BluetoothService.canPair(modelData)
readonly property bool isBusy: BluetoothService.isDeviceBusy(modelData)
readonly property bool isExpanded: root.expandedDeviceKey === BluetoothService.deviceKey(modelData)
readonly property var codecSelectorModel: BluetoothService.codecOptions(modelData)
readonly property string selectedCodecKey: BluetoothService.getSelectedCodecKey(modelData)
readonly property bool showCodecSelector: modelData.connected && BluetoothService.isAudioDevice(modelData) && device.codecSelectorModel.length > 0

function refreshCodecOptions() {
if (modelData.connected && BluetoothService.isAudioDevice(modelData)) {
BluetoothService.ensureCodecOptions(modelData);
}
}

onIsExpandedChanged: {
if (isExpanded) {
refreshCodecOptions();
}
}

Connections {
target: modelData
function onConnectedChanged() {
if (modelData.connected) {
device.refreshCodecOptions();
}
}
}

function getContentColors(defaultColors = [Color.mSurface, Color.mOnSurface]) {
if (modelData.pairing || modelData.state === BluetoothDeviceState.Connecting) {
Expand Down Expand Up @@ -689,6 +713,39 @@ Item {
onToggled: checked => BluetoothService.setDeviceAutoConnect(modelData, checked)
}
}

// --- Item 7: Codec selector ---
RowLayout {
visible: device.showCodecSelector
Layout.fillWidth: true
Layout.preferredWidth: 1
spacing: Style.marginXS
NIcon {
icon: "music"
pointSize: Style.fontSizeXS
color: Color.mOnSurface
}
NText {
text: I18n.tr("bluetooth.panel.codec-selector")
pointSize: Style.fontSizeXS
color: Color.mOnSurface
}
Item {
Layout.fillWidth: true
}
NComboBox {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
minimumWidth: 170
popupHeight: 220
baseSize: 0.7
label: ""
enabled: !BluetoothService.isCodecSwitchBusy(modelData)
model: device.codecSelectorModel
currentKey: device.selectedCodecKey
placeholder: I18n.tr("common.select")
onSelected: key => BluetoothService.setCodecForDevice(modelData, key)
}
}
}
}
}
Expand Down
Loading