- Add ComboBox for ringtone selection in Call Settings - Convert MKV ringtones to WAV format (Linphone only supports WAV) - Fix ComboSetting to support dialPlan type for international prefix - Disable account devices feature to prevent API errors - Disable automatic update check on startup - Add ringtone fallback to default when custom file not found - Fix ringtone dropdown to not override setting on initialization Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
161 lines
5.3 KiB
QML
Executable file
161 lines
5.3 KiB
QML
Executable file
|
||
import QtQuick
|
||
import QtQuick.Layouts
|
||
import QtQuick.Controls.Basic as Control
|
||
import QtQuick.Dialogs
|
||
import Linphone
|
||
import SettingsCpp 1.0
|
||
import UtilsCpp
|
||
import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle
|
||
import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils
|
||
|
||
AbstractSettingsLayout {
|
||
id: mainItem
|
||
width: parent?.width
|
||
contentModel: [
|
||
{
|
||
title: "",
|
||
subTitle: "",
|
||
contentComponent: genericParametersComponent
|
||
},
|
||
{
|
||
//: "Périphériques"
|
||
title: qsTr("settings_call_devices_title"),
|
||
//: "Vous pouvez modifier les périphériques de sortie audio, le microphone et la caméra de capture."
|
||
subTitle: qsTr("settings_call_devices_subtitle"),
|
||
contentComponent: multiMediaParametersComponent,
|
||
customWidth: 540,
|
||
customRightMargin: 36
|
||
}
|
||
]
|
||
|
||
onSave: {
|
||
SettingsCpp.save()
|
||
}
|
||
onUndo: SettingsCpp.undo()
|
||
|
||
FileDialog {
|
||
id: fileDialog
|
||
currentFolder: SettingsCpp.ringtoneFolder
|
||
onAccepted: SettingsCpp.ringtonePath = Utils.getSystemPathFromUri(selectedFile)
|
||
nameFilters: ["WAV files (*.wav)"]
|
||
options: FileDialog.ReadOnly
|
||
}
|
||
|
||
// Generic call parameters
|
||
//////////////////////////
|
||
|
||
Component {
|
||
id: genericParametersComponent
|
||
ColumnLayout {
|
||
spacing: Utils.getSizeWithScreenRatio(20)
|
||
SwitchSetting {
|
||
//: "Annulateur d'écho"
|
||
titleText: qsTr("settings_calls_echo_canceller_title")
|
||
//: "Évite que de l'écho soit entendu par votre correspondant"
|
||
subTitleText: qsTr("settings_calls_echo_canceller_subtitle")
|
||
propertyName: "echoCancellationEnabled"
|
||
propertyOwner: SettingsCpp
|
||
}
|
||
SwitchSetting {
|
||
Layout.fillWidth: true
|
||
//: "Activer l’enregistrement automatique des appels"
|
||
titleText: qsTr("settings_calls_auto_record_title")
|
||
propertyName: "automaticallyRecordCallsEnabled"
|
||
propertyOwner: SettingsCpp
|
||
visible: !SettingsCpp.disableCallRecordings
|
||
}
|
||
SwitchSetting {
|
||
//: Tonalités
|
||
titleText: qsTr("settings_call_enable_tones_title")
|
||
//: Activer les tonalités
|
||
subTitleText: qsTr("settings_call_enable_tones_subtitle")
|
||
propertyName: "callToneIndicationsEnabled"
|
||
propertyOwner: SettingsCpp
|
||
}
|
||
SwitchSetting {
|
||
//: "Autoriser la vidéo"
|
||
titleText: qsTr("settings_calls_enable_video_title")
|
||
propertyName: "videoEnabled"
|
||
propertyOwner: SettingsCpp
|
||
}
|
||
DecoratedTextField {
|
||
visible: !SettingsCpp.disableCommandLine
|
||
Layout.fillWidth: true
|
||
propertyName: "commandLine"
|
||
propertyOwner: SettingsCpp
|
||
//: Command line
|
||
title: qsTr("settings_calls_command_line_title")
|
||
placeHolder: qsTr("settings_calls_command_line_title_place_holder")
|
||
useTitleAsPlaceHolder: false
|
||
toValidate: true
|
||
}
|
||
ColumnLayout {
|
||
spacing: Utils.getSizeWithScreenRatio(10)
|
||
Text {
|
||
//: "Change ringtone"
|
||
text: qsTr("settings_calls_change_ringtone_title")
|
||
font: Typography.p2l
|
||
Layout.fillWidth: true
|
||
}
|
||
RowLayout {
|
||
spacing: Utils.getSizeWithScreenRatio(10)
|
||
Layout.fillWidth: true
|
||
property var ringtoneList: [
|
||
{ text: "Old Phone", file: "oldphone-mono.wav" },
|
||
{ text: "Notes of the Optimistic", file: "notes_of_the_optimistic.wav" },
|
||
{ text: "Four Hands Together", file: "four_hands_together.wav" },
|
||
{ text: "House Keeping", file: "house_keeping.wav" },
|
||
{ text: "It's a Game", file: "its_a_game.wav" },
|
||
{ text: "Leaving Dreams", file: "leaving_dreams.wav" },
|
||
{ text: "Soft as Snow", file: "soft_as_snow.wav" }
|
||
]
|
||
ComboBox {
|
||
id: ringtoneComboBox
|
||
Layout.fillWidth: true
|
||
Layout.preferredHeight: Utils.getSizeWithScreenRatio(49)
|
||
model: parent.ringtoneList
|
||
property bool initialized: false
|
||
currentIndex: {
|
||
var currentRingtone = SettingsCpp.ringtoneName
|
||
var list = parent.ringtoneList
|
||
for (var i = 0; i < list.length; i++) {
|
||
if (list[i].file === currentRingtone) return i
|
||
}
|
||
return -1 // Don't select anything if not in list
|
||
}
|
||
Component.onCompleted: initialized = true
|
||
onCurrentIndexChanged: {
|
||
if (!initialized) return // Skip during initialization
|
||
var list = parent.ringtoneList
|
||
if (currentIndex >= 0 && currentIndex < list.length) {
|
||
var selectedFile = list[currentIndex].file
|
||
SettingsCpp.ringtonePath = SettingsCpp.ringtoneFolder + "/" + selectedFile
|
||
console.log("Ringtone set to: " + SettingsCpp.ringtoneFolder + "/" + selectedFile)
|
||
}
|
||
}
|
||
}
|
||
RoundButton {
|
||
style: ButtonStyle.noBackground
|
||
icon.source: AppIcons.arrowSquareOut
|
||
onClicked: fileDialog.open()
|
||
//: Choose ringtone file
|
||
Accessible.name: qsTr("choose_ringtone_file_accessible_name")
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// Multimedia parameters
|
||
////////////////////////
|
||
|
||
Component {
|
||
id: multiMediaParametersComponent
|
||
MultimediaSettings {
|
||
ringerDevicesVisible: true
|
||
backgroundVisible: false
|
||
spacing: Utils.getSizeWithScreenRatio(20)
|
||
}
|
||
}
|
||
}
|