diff --git a/Linphone/core/setting/SettingsCore.cpp b/Linphone/core/setting/SettingsCore.cpp index a4302480c..d8df64f0e 100644 --- a/Linphone/core/setting/SettingsCore.cpp +++ b/Linphone/core/setting/SettingsCore.cpp @@ -51,6 +51,15 @@ SettingsCore::SettingsCore(QObject *parent) : QObject(parent) { mEchoCancellationEnabled = settingsModel->getEchoCancellationEnabled(); mAutoDownloadReceivedFiles = settingsModel->getAutoDownloadReceivedFiles(); mAutomaticallyRecordCallsEnabled = settingsModel->getAutomaticallyRecordCallsEnabled(); + mRingtonePath = settingsModel->getRingtone(); + QFileInfo ringtone(mRingtonePath); + if (ringtone.exists()) { + mRingtoneFileName = ringtone.fileName(); + mRingtoneFolder = ringtone.absolutePath(); + } else { + mRingtoneFileName = mRingtonePath.right(mRingtonePath.lastIndexOf(QDir::separator())); + mRingtoneFolder = mRingtonePath.left(mRingtonePath.lastIndexOf(QDir::separator())); + } // Audio mCaptureDevices = settingsModel->getCaptureDevices(); @@ -210,6 +219,9 @@ SettingsCore::SettingsCore(const SettingsCore &settingsCore) { mDefaultDomain = settingsCore.mDefaultDomain; mShowAccountDevices = settingsCore.mShowAccountDevices; + + mRingtonePath = settingsCore.mRingtonePath; + mRingtoneFileName = settingsCore.mRingtoneFileName; } SettingsCore::~SettingsCore() { @@ -315,6 +327,10 @@ void SettingsCore::setSelf(QSharedPointer me) { }); }); + mSettingsModelConnection->makeConnectToModel(&SettingsModel::ringtoneChanged, [this](QString ringtonePath) { + mSettingsModelConnection->invokeToCore([this, ringtonePath]() { setRingtone(ringtonePath); }); + }); + mSettingsModelConnection->makeConnectToModel(&SettingsModel::videoDeviceChanged, [this](const QString device) { mSettingsModelConnection->invokeToCore([this, device]() { setVideoDevice(device); }); }); @@ -900,6 +916,30 @@ void SettingsCore::setFullLogsEnabled(bool enabled) { } } +void SettingsCore::setRingtone(QString path) { + if (mRingtonePath != path) { + mRingtonePath = path; + QFileInfo ringtone(path); + if (ringtone.exists()) { + mRingtoneFileName = ringtone.fileName(); + mRingtoneFolder = ringtone.absolutePath(); + } else { + mRingtoneFileName = mRingtonePath.right(mRingtonePath.lastIndexOf(QDir::separator())); + mRingtoneFolder = mRingtonePath.left(mRingtonePath.lastIndexOf(QDir::separator())); + } + emit ringtoneChanged(); + setIsSaved(false); + } +} + +QString SettingsCore::getRingtoneFileName() const { + return mRingtoneFileName; +} + +QString SettingsCore::getRingtonePath() const { + return mRingtonePath; +} + void SettingsCore::cleanLogs() const { mSettingsModelConnection->invokeToModel([this]() { SettingsModel::getInstance()->cleanLogs(); }); } @@ -984,6 +1024,7 @@ void SettingsCore::writeIntoModel(std::shared_ptr model) const { model->setRingerDevice(mRingerDevice); model->setCaptureDevice(mCaptureDevice); model->setPlaybackDevice(mPlaybackDevice); + model->setRingtone(mRingtonePath); model->setDefaultConferenceLayout( LinphoneEnums::toLinphone(LinphoneEnums::ConferenceLayout(mConferenceLayout["id"].toInt()))); @@ -1041,6 +1082,11 @@ void SettingsCore::writeFromModel(const std::shared_ptr &model) { mVideoEnabled = model->getVideoEnabled(); mEchoCancellationEnabled = model->getEchoCancellationEnabled(); mAutomaticallyRecordCallsEnabled = model->getAutomaticallyRecordCallsEnabled(); + mRingtonePath = model->getRingtone(); + QFileInfo ringtone(mRingtonePath); + mRingtoneFolder = ringtone.exists() ? ringtone.absolutePath() : ""; + mRingtoneFileName = + ringtone.exists() ? ringtone.fileName() : mRingtonePath.right(mRingtonePath.lastIndexOf(QDir::separator())); // Chat mAutoDownloadReceivedFiles = model->getAutoDownloadReceivedFiles(); diff --git a/Linphone/core/setting/SettingsCore.hpp b/Linphone/core/setting/SettingsCore.hpp index a14e7d1eb..d525b3af1 100644 --- a/Linphone/core/setting/SettingsCore.hpp +++ b/Linphone/core/setting/SettingsCore.hpp @@ -82,6 +82,9 @@ public: Q_PROPERTY(bool fullLogsEnabled READ getFullLogsEnabled WRITE setFullLogsEnabled NOTIFY fullLogsEnabledChanged) Q_PROPERTY(QString logsEmail READ getLogsEmail) Q_PROPERTY(QString logsFolder READ getLogsFolder) + Q_PROPERTY(QString ringtoneName READ getRingtoneFileName NOTIFY ringtoneChanged) + Q_PROPERTY(QString ringtonePath READ getRingtonePath WRITE setRingtone NOTIFY ringtoneChanged) + Q_PROPERTY(QString ringtoneFolder MEMBER mRingtoneFolder NOTIFY ringtoneChanged) Q_PROPERTY(bool dnd READ dndEnabled WRITE lEnableDnd NOTIFY dndChanged) Q_PROPERTY(bool isSaved READ isSaved WRITE setIsSaved NOTIFY isSavedChanged) @@ -196,6 +199,10 @@ public: bool getFullLogsEnabled() const; void setFullLogsEnabled(bool enabled); + void setRingtone(QString path); + QString getRingtoneFileName() const; + QString getRingtonePath() const; + Q_INVOKABLE void cleanLogs() const; Q_INVOKABLE void sendLogs() const; QString getLogsEmail() const; @@ -275,6 +282,8 @@ signals: void lSetCaptureDevice(QVariantMap device); void captureDeviceChanged(const QVariantMap &device); + void ringtoneChanged(); + void lSetConferenceLayout(QVariantMap layout); void conferenceLayoutChanged(); @@ -346,6 +355,10 @@ private: QVariantMap mPlaybackDevice; QVariantMap mRingerDevice; + QString mRingtonePath; + QString mRingtoneFileName; + QString mRingtoneFolder; + QVariantList mConferenceLayouts; QVariantMap mConferenceLayout; diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 141e2f62e..c96132b29 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -1161,64 +1161,76 @@ CallSettingsLayout - + settings_call_devices_title "Périphériques" Geräte - + settings_call_devices_subtitle "Vous pouvez modifier les périphériques de sortie audio, le microphone et la caméra de capture." Sie können die Audioausgabegeräte, Mikrofon und Kamera ändern. - + settings_calls_echo_canceller_title "Annulateur d'écho" Echo-Unterdrückung - + settings_calls_echo_canceller_subtitle "Évite que de l'écho soit entendu par votre correspondant" Verhindert, dass Echo von Ihrem Gesprächspartner gehört wird - + settings_calls_auto_record_title "Activer l’enregistrement automatique des appels" Automatische Anrufaufnahme aktivieren - + settings_call_enable_tones_title Tonalités Töne - + settings_call_enable_tones_subtitle Activer les tonalités Töne aktivieren - + settings_calls_enable_video_title "Autoriser la vidéo" Video aktivieren - + settings_calls_command_line_title Command line - + settings_calls_command_line_title_place_holder + + + settings_calls_change_ringtone_title + "Change ringtone" + + + + + settings_calls_current_ringtone_filename + Current ringtone : + + CallStatistics @@ -1303,33 +1315,33 @@ Anruf pausiert - + call_srtp_point_to_point_encrypted Appel chiffré de point à point Punkt-zu-Punkt verschlüsselter Anruf - + call_zrtp_sas_validation_required Vérification nécessaire Validierung erforderlich - - + + call_zrtp_end_to_end_encrypted Appel chiffré de bout en bout Ende-zu-Ende verschlüsselter Anruf - + call_not_encrypted "Appel non chiffré" Unverschlüsselter Anruf - - + + call_waiting_for_encryption_info "En attente de chiffrement" Warten auf Verschlüsselung @@ -1341,133 +1353,133 @@ - + conference_user_is_recording "Vous enregistrez la réunion" Sie nehmen die Besprechung auf - + call_user_is_recording "Vous enregistrez l'appel" Sie nehmen den Anruf auf - + conference_remote_is_recording "Un participant enregistre la réunion" Jemand nimmt die Besprechung auf - + call_remote_recording "%1 enregistre l'appel" %1 nimmt den Anruf auf - + call_stop_recording "Arrêter l'enregistrement" Aufnahme stoppen - + add Hinzufügen - + call_transfer_current_call_title "Transférer %1 à…" %1 weiterleiten an… - - + + call_transfer_confirm_dialog_tittle "Confirmer le transfert" Weiterleitung bestätigen - - + + call_transfer_confirm_dialog_message "Vous allez transférer %1 à %2." Sie werden %1 an %2 weiterleiten. - + call_action_start_new_call "Nouvel appel" Neuen Anruf starten - + call_action_show_dialer "Pavé numérique" Wähltastatur - + call_action_change_layout "Modifier la disposition" Layout ändern - + call_action_go_to_calls_list "Liste d'appel" Anrufliste - + Merger tous les appels call_action_merge_calls Alle Anrufe zusammenführen - + call_action_go_to_settings "Paramètres" Einstellungen - + conference_action_screen_sharing "Partage de votre écran" Bildschirm teilen - + conference_share_link_title Partager le lien de la réunion Besprechungs-Link teilen - + copied Copié Kopiert - + information_popup_meeting_address_copied_to_clipboard Le lien de la réunion a été copié dans le presse-papier Der Besprechungs-Link wurde in die Zwischenablage kopiert - - - + + + conference_participants_list_title "Participants (%1)" Teilnehmer (%1) - - + + group_call_participant_selected 1 ausgewählter Teilnehmer @@ -1475,18 +1487,18 @@ - + meeting_schedule_add_participants_title Teilnehmer hinzufügen - + call_encryption_title Chiffrement Verschlüsselung - + call_stats_title Statistiques Statistiken @@ -1789,7 +1801,7 @@ - + chat_room_delete "Delete" @@ -1812,7 +1824,7 @@ - + chat_room_leave "leave" @@ -1830,13 +1842,13 @@ - + chat_list_delete_chat_popup_title Delete the conversation ? - + chat_list_delete_chat_popup_message This conversation and all its messages will be deleted. Do You want to continue ? @@ -2266,13 +2278,13 @@ Error ConferenceInfoCore - + information_popup_error_title "Erreur" Fehler - + information_popup_disconnected_account_message "Votre compte est déconnecté" Ihr Konto ist getrennt @@ -3931,13 +3943,13 @@ Error Beschreibung hinzufügen - + meeting_schedule_add_participants_title "Ajouter des participants" Teilnehmer hinzufügen - + meeting_schedule_send_invitations_title "Envoyer une invitation aux participants" Einladung an Teilnehmer senden @@ -4993,31 +5005,31 @@ Pour les activer dans un projet commercial, merci de nous contacter. Start a group call ? - + reply_to_label Reply to %1 - + shared_medias_title Shared medias - + shared_documents_title Shared documents - + forward_to_title Forward to… - + conversations_title Conversations @@ -5166,7 +5178,7 @@ Pour les activer dans un projet commercial, merci de nous contacter. Utils - + nMinute @@ -5174,7 +5186,7 @@ Pour les activer dans un projet commercial, merci de nous contacter. - + nHour @@ -5182,8 +5194,8 @@ Pour les activer dans un projet commercial, merci de nous contacter. - - + + nDay @@ -5191,7 +5203,7 @@ Pour les activer dans un projet commercial, merci de nous contacter. - + nWeek @@ -5199,7 +5211,7 @@ Pour les activer dans un projet commercial, merci de nous contacter. - + nSeconds diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index eb75f5f91..ff0540f0a 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -1123,64 +1123,76 @@ CallSettingsLayout - + settings_call_devices_title "Périphériques" Devices - + settings_call_devices_subtitle "Vous pouvez modifier les périphériques de sortie audio, le microphone et la caméra de capture." You can change the audio output devices, microphone, and camera. - + settings_calls_echo_canceller_title "Annulateur d'écho" Echo canceller - + settings_calls_echo_canceller_subtitle "Évite que de l'écho soit entendu par votre correspondant" Prevents echo from being heard by your correspondent - + settings_calls_auto_record_title "Activer l’enregistrement automatique des appels" Enable automatic call recording - + settings_call_enable_tones_title Tonalités Tones - + settings_call_enable_tones_subtitle Activer les tonalités Enable tones - + settings_calls_enable_video_title "Autoriser la vidéo" Enable video - + settings_calls_command_line_title Command line Command Line to run upon incoming call - + settings_calls_command_line_title_place_holder command "https://example.com/?phone=$1&displayName=$2" + + + settings_calls_change_ringtone_title + "Change ringtone" + Change ringtone + + + + settings_calls_current_ringtone_filename + Current ringtone : + Current ringtone : + CallStatistics @@ -1265,33 +1277,33 @@ Call paused - + call_srtp_point_to_point_encrypted Appel chiffré de point à point Point-to-point encrypted call - + call_zrtp_sas_validation_required Vérification nécessaire Validation required - - + + call_zrtp_end_to_end_encrypted Appel chiffré de bout en bout End-to-end encrypted call - + call_not_encrypted "Appel non chiffré" Unencrypted call - - + + call_waiting_for_encryption_info "En attente de chiffrement" Waiting for encryption @@ -1303,133 +1315,133 @@ Call paused by remote - + conference_user_is_recording "Vous enregistrez la réunion" You are recording the meeting - + call_user_is_recording "Vous enregistrez l'appel" You are recording the call - + conference_remote_is_recording "Un participant enregistre la réunion" Someone is recording the meeting - + call_remote_recording "%1 enregistre l'appel" %1 records the call - + call_stop_recording "Arrêter l'enregistrement" Stop recording - + add Add - + call_transfer_current_call_title "Transférer %1 à…" Transfer %1 to… - - + + call_transfer_confirm_dialog_tittle "Confirmer le transfert" Confirm transfer - - + + call_transfer_confirm_dialog_message "Vous allez transférer %1 à %2." You are going to transfer %1 to %2. - + call_action_start_new_call "Nouvel appel" New call - + call_action_show_dialer "Pavé numérique" Dialer - + call_action_change_layout "Modifier la disposition" Change layout - + call_action_go_to_calls_list "Liste d'appel" Call list - + Merger tous les appels call_action_merge_calls Merge all calls - + call_action_go_to_settings "Paramètres" Settings - + conference_action_screen_sharing "Partage de votre écran" Share your screen - + conference_share_link_title Partager le lien de la réunion Share meeting link - + copied Copié Copied - + information_popup_meeting_address_copied_to_clipboard Le lien de la réunion a été copié dans le presse-papier Meeting link has been copied to the clipboard - - - + + + conference_participants_list_title "Participants (%1)" Participants (%1) - - + + group_call_participant_selected %1 selected participant @@ -1437,18 +1449,18 @@ - + meeting_schedule_add_participants_title Add participants - + call_encryption_title Chiffrement Encryption - + call_stats_title Statistiques Statistics @@ -1751,7 +1763,7 @@ Draft : %1 - + chat_room_delete "Delete" Delete @@ -1774,7 +1786,7 @@ Mark as read - + chat_room_leave "leave" Leave @@ -1792,13 +1804,13 @@ You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? - + chat_list_delete_chat_popup_title Delete the conversation ? Delete the conversation ? - + chat_list_delete_chat_popup_message This conversation and all its messages will be deleted. Do You want to continue ? This conversation and all its messages will be deleted. Do You want to continue ? @@ -2229,13 +2241,13 @@ Only your correspondent can decrypt them. ConferenceInfoCore - + information_popup_error_title "Erreur" Error - + information_popup_disconnected_account_message "Votre compte est déconnecté" Your account is disconnected @@ -2281,7 +2293,7 @@ Only your correspondent can decrypt them. contact_editor_mandatory_first_name_or_company_not_filled "Veuillez saisir un prénom ou un nom d'entreprise" - Please enter a first name or a company name + Please enter a first name or a company name @@ -3841,13 +3853,13 @@ Expiration : %1 Add a description - + meeting_schedule_add_participants_title "Ajouter des participants" Add participants - + meeting_schedule_send_invitations_title "Envoyer une invitation aux participants" Send an invitation to participants @@ -4882,31 +4894,31 @@ To enable them in a commercial project, please contact us. Start a group call ? - + reply_to_label Reply to %1 Reply to %1 - + shared_medias_title Shared medias Shared medias - + shared_documents_title Shared documents Shared documents - + forward_to_title Forward to… Froward to… - + conversations_title Conversations Conversations @@ -5055,7 +5067,7 @@ To enable them in a commercial project, please contact us. Utils - + nSeconds %1 second @@ -5063,7 +5075,7 @@ To enable them in a commercial project, please contact us. - + nMinute %1 minute @@ -5107,7 +5119,7 @@ To enable them in a commercial project, please contact us. Failed to create reply message - + nHour %1 hour @@ -5115,8 +5127,8 @@ To enable them in a commercial project, please contact us. - - + + nDay %1 day @@ -5124,7 +5136,7 @@ To enable them in a commercial project, please contact us. - + nWeek %1 week diff --git a/Linphone/data/languages/fr_FR.ts b/Linphone/data/languages/fr_FR.ts index 679ef1b91..ef97a0691 100644 --- a/Linphone/data/languages/fr_FR.ts +++ b/Linphone/data/languages/fr_FR.ts @@ -1123,64 +1123,76 @@ CallSettingsLayout - + settings_call_devices_title "Périphériques" Périphériques - + settings_call_devices_subtitle "Vous pouvez modifier les périphériques de sortie audio, le microphone et la caméra de capture." Vous pouvez modifier les périphériques de sortie audio, le microphone et la caméra de capture. - + settings_calls_echo_canceller_title "Annulateur d'écho" Annulateur d'écho - + settings_calls_echo_canceller_subtitle "Évite que de l'écho soit entendu par votre correspondant" Évite que de l'écho soit entendu par votre correspondant - + settings_calls_auto_record_title "Activer l’enregistrement automatique des appels" Activer l’enregistrement automatique des appels - + settings_call_enable_tones_title Tonalités Tonalités - + settings_call_enable_tones_subtitle Activer les tonalités Activer les tonalités - + settings_calls_enable_video_title "Autoriser la vidéo" Autoriser la vidéo - + settings_calls_command_line_title Command line Redirection vers outil externe lors d'un appel entrant. - + settings_calls_command_line_title_place_holder commande "https://exemple.com/?numero=$1&nom=$2" + + + settings_calls_change_ringtone_title + "Change ringtone" + Changer la sonnerie + + + + settings_calls_current_ringtone_filename + Current ringtone : + Sonnerie actuelle : + CallStatistics @@ -1265,33 +1277,33 @@ Appel mis en pause - + call_srtp_point_to_point_encrypted Appel chiffré de point à point Appel chiffré de point à point - + call_zrtp_sas_validation_required Vérification nécessaire Vérification nécessaire - - + + call_zrtp_end_to_end_encrypted Appel chiffré de bout en bout Appel chiffré de bout en bout - + call_not_encrypted "Appel non chiffré" Appel non chiffré - - + + call_waiting_for_encryption_info "En attente de chiffrement" En attente de chiffrement @@ -1303,133 +1315,133 @@ Appel mis en pause par votre correspondant - + conference_user_is_recording "Vous enregistrez la réunion" Vous enregistrez la réunion - + call_user_is_recording "Vous enregistrez l'appel" Vous enregistrez l'appel - + conference_remote_is_recording "Un participant enregistre la réunion" Un participant enregistre la réunion - + call_remote_recording "%1 enregistre l'appel" %1 enregistre l'appel - + call_stop_recording "Arrêter l'enregistrement" Arrêter l'enregistrement - + add Ajouter - + call_transfer_current_call_title "Transférer %1 à…" Transférer %1 à… - - + + call_transfer_confirm_dialog_tittle "Confirmer le transfert" Confirmer le transfert - - + + call_transfer_confirm_dialog_message "Vous allez transférer %1 à %2." Vous allez transférer %1 à %2. - + call_action_start_new_call "Nouvel appel" Nouvel appel - + call_action_show_dialer "Pavé numérique" Pavé numérique - + call_action_change_layout "Modifier la disposition" Modifier la disposition - + call_action_go_to_calls_list "Liste d'appel" Liste d'appel - + Merger tous les appels call_action_merge_calls Merger tous les appels - + call_action_go_to_settings "Paramètres" Paramètres - + conference_action_screen_sharing "Partage de votre écran" Partage de votre écran - + conference_share_link_title Partager le lien de la réunion Partager le lien de la réunion - + copied Copié Copié - + information_popup_meeting_address_copied_to_clipboard Le lien de la réunion a été copié dans le presse-papier Le lien de la réunion a été copié dans le presse-papier - - - + + + conference_participants_list_title "Participants (%1)" Participants (%1) - - + + group_call_participant_selected %1 participant sélectionné @@ -1437,18 +1449,18 @@ - + meeting_schedule_add_participants_title Ajouter des participants - + call_encryption_title Chiffrement Chiffrement - + call_stats_title Statistiques Statistiques @@ -1751,7 +1763,7 @@ Brouillon : %1 - + chat_room_delete "Delete" Supprimer @@ -1774,7 +1786,7 @@ Marquer comme lu - + chat_room_leave "leave" Quitter la conversation @@ -1792,13 +1804,13 @@ Vous ne pourrez plus envoyer ou recevoir de messages dans cette conversation. Souhaitez-vous continuer ? - + chat_list_delete_chat_popup_title Delete the conversation ? Supprimer la conversation ? - + chat_list_delete_chat_popup_message This conversation and all its messages will be deleted. Do You want to continue ? La conversation et tous ses messages seront supprimés. Souhaitez-vous continuer ? @@ -2229,13 +2241,13 @@ en bout. Seul votre correspondant peut les déchiffrer. ConferenceInfoCore - + information_popup_error_title "Erreur" Erreur - + information_popup_disconnected_account_message "Votre compte est déconnecté" Votre compte est déconnecté @@ -3841,13 +3853,13 @@ Expiration : %1 Ajouter une description - + meeting_schedule_add_participants_title "Ajouter des participants" Ajouter des participants - + meeting_schedule_send_invitations_title "Envoyer une invitation aux participants" Envoyer une invitation aux participants @@ -4882,31 +4894,31 @@ Pour les activer dans un projet commercial, merci de nous contacter.Démarrer un appel de groupe ? - + reply_to_label Reply to %1 Réponse à %1 - + shared_medias_title Shared medias Médias partagés - + shared_documents_title Shared documents Documents partagés - + forward_to_title Forward to… Transférer à… - + conversations_title Conversations Conversations @@ -5055,7 +5067,7 @@ Pour les activer dans un projet commercial, merci de nous contacter. Utils - + nMinute %1 minute @@ -5063,7 +5075,7 @@ Pour les activer dans un projet commercial, merci de nous contacter. - + nHour %1 heure @@ -5071,8 +5083,8 @@ Pour les activer dans un projet commercial, merci de nous contacter. - - + + nDay %1 jour @@ -5080,7 +5092,7 @@ Pour les activer dans un projet commercial, merci de nous contacter. - + nWeek %1 semaine @@ -5088,7 +5100,7 @@ Pour les activer dans un projet commercial, merci de nous contacter. - + nSeconds %1 seconde diff --git a/Linphone/model/setting/SettingsModel.cpp b/Linphone/model/setting/SettingsModel.cpp index efc6c0139..533a2afd4 100644 --- a/Linphone/model/setting/SettingsModel.cpp +++ b/Linphone/model/setting/SettingsModel.cpp @@ -405,6 +405,20 @@ void SettingsModel::setRingerDevice(QVariantMap device) { emit ringerDeviceChanged(device); } +void SettingsModel::setRingtone(QString ringtonePath) { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); + QFileInfo ringtone(ringtonePath); + if (ringtonePath.isEmpty() || !ringtone.exists()) { + } else { + CoreModel::getInstance()->getCore()->setRing(Utils::appStringToCoreString(ringtonePath)); + emit ringtoneChanged(ringtonePath); + } +} + +QString SettingsModel::getRingtone() const { + return Utils::coreStringToAppString(CoreModel::getInstance()->getCore()->getRing()); +} + // ----------------------------------------------------------------------------- QString SettingsModel::getVideoDevice() const { diff --git a/Linphone/model/setting/SettingsModel.hpp b/Linphone/model/setting/SettingsModel.hpp index 02d4f8426..34879a383 100644 --- a/Linphone/model/setting/SettingsModel.hpp +++ b/Linphone/model/setting/SettingsModel.hpp @@ -113,6 +113,9 @@ public: QVariantMap getRingerDevice() const; void setRingerDevice(QVariantMap device); + void setRingtone(QString ringtonePath); + QString getRingtone() const; + QString getVideoDevice() const; void setVideoDevice(QString device); @@ -233,6 +236,8 @@ signals: void ringerDeviceChanged(QVariantMap device); void videoDeviceChanged(QString device); + void ringtoneChanged(QString ringtonePath); + void conferenceLayoutChanged(); void mediaEncryptionChanged(); void mediaEncryptionMandatoryChanged(); diff --git a/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml index fa0d676af..a615e9e83 100644 --- a/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml @@ -2,9 +2,12 @@ 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 @@ -31,6 +34,14 @@ AbstractSettingsLayout { } onUndo: SettingsCpp.undo() + FileDialog { + id: fileDialog + currentFolder: SettingsCpp.ringtoneFolder + onAccepted: SettingsCpp.ringtonePath = Utils.getSystemPathFromUri(selectedFile) + nameFilters: ["WAV files (*.wav)", "MKV files (*.mkv)"] + options: FileDialog.ReadOnly + } + // Generic call parameters ////////////////////////// @@ -79,6 +90,44 @@ AbstractSettingsLayout { useTitleAsPlaceHolder: false toValidate: true } + RowLayout { + ColumnLayout { + Text { + //: "Change ringtone" + text: qsTr("settings_calls_change_ringtone_title") + font: Typography.p2l + Layout.fillWidth: true + } + RowLayout { + spacing: Math.round(3 * DefaultStyle.dp) + Text { + //: Current ringtone : + text: qsTr("settings_calls_current_ringtone_filename") + font: Typography.p1 + wrapMode: Text.WordWrap + color: DefaultStyle.main2_600 + } + Text { + text: SettingsCpp.ringtoneName.length !== 0 ? SettingsCpp.ringtoneName : "" + font { + pixelSize: Typography.p1.pixelSize + // weight: Typography.p1.weight + italic: true + } + color: DefaultStyle.main2_600 + Layout.fillWidth: true + } + } + } + Item{Layout.fillWidth: true} + RoundButton { + style: ButtonStyle.noBackground + icon.source: AppIcons.arrowSquareOut + onClicked: { + fileDialog.open() + } + } + } } } diff --git a/Linphone/view/Style/AppIcons.qml b/Linphone/view/Style/AppIcons.qml index d98952c23..88f1e5b9e 100644 --- a/Linphone/view/Style/AppIcons.qml +++ b/Linphone/view/Style/AppIcons.qml @@ -62,6 +62,7 @@ QtObject { property string arrowRight: "image://internal/arrow-right.svg" property string arrowUpRight: "image://internal/arrow-up-right.svg" property string arrowElbow: "image://internal/arrow-elbow-left.svg" + property string arrowSquareOut: "image://internal/arrow-square-out.svg" property string microphone: "image://internal/microphone.svg" property string microphoneSlash: "image://internal/microphone-slash.svg" property string camera: "image://internal/camera.svg"