From 171853124716ddf83a88fb961ce2def862a54173 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 2 Mar 2017 14:13:43 +0100 Subject: [PATCH] feat(ui/views/App/Settings/SettingsAudio): supports ring selection --- linphone-desktop/assets/languages/en.ts | 4 ++ linphone-desktop/assets/languages/fr.ts | 4 ++ .../src/components/settings/SettingsModel.cpp | 51 ++++++++++++------- .../src/components/settings/SettingsModel.hpp | 7 +++ .../ui/views/App/Settings/SettingsAudio.qml | 12 +++++ .../ui/views/App/Settings/SettingsUi.qml | 4 -- submodules/linphone | 2 +- 7 files changed, 62 insertions(+), 22 deletions(-) diff --git a/linphone-desktop/assets/languages/en.ts b/linphone-desktop/assets/languages/en.ts index 8e39c7bf1..7c0bb44cf 100644 --- a/linphone-desktop/assets/languages/en.ts +++ b/linphone-desktop/assets/languages/en.ts @@ -681,6 +681,10 @@ Server url not configured. ringerDeviceLabel Ringer device + + ringLabel + Ring + SettingsCallsChat diff --git a/linphone-desktop/assets/languages/fr.ts b/linphone-desktop/assets/languages/fr.ts index 3c8403453..be788e13e 100644 --- a/linphone-desktop/assets/languages/fr.ts +++ b/linphone-desktop/assets/languages/fr.ts @@ -691,6 +691,10 @@ Url du serveur non configurée. ringerDeviceLabel Périphérique de sonnerie + + ringLabel + Sonnerie + SettingsCallsChat diff --git a/linphone-desktop/src/components/settings/SettingsModel.cpp b/linphone-desktop/src/components/settings/SettingsModel.cpp index 8a8d2e5b0..479449f43 100644 --- a/linphone-desktop/src/components/settings/SettingsModel.cpp +++ b/linphone-desktop/src/components/settings/SettingsModel.cpp @@ -45,17 +45,17 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) { QVariantList SettingsModel::getAudioCodecs () const { QVariantList list; - for (const auto &codec : CoreManager::getInstance()->getCore()->getAudioCodecs()) { - QVariantMap map; - - map["mime"] = ::Utils::linphoneStringToQString(codec->getMimeType()); - map["channels"] = codec->getChannels(); - map["bitrate"] = codec->getNormalBitrate(); - map["type"] = codec->getType(); - map["isVbr"] = codec->isVbr(); - - list << map; - } + // for (const auto &codec : CoreManager::getInstance()->getCore()->getAudioCodecs()) { + // QVariantMap map; + // + // map["mime"] = ::Utils::linphoneStringToQString(codec->getMimeType()); + // map["channels"] = codec->getChannels(); + // map["bitrate"] = codec->getNormalBitrate(); + // map["type"] = codec->getType(); + // map["isVbr"] = codec->isVbr(); + // + // list << map; + // } return list; } @@ -121,6 +121,22 @@ void SettingsModel::setRingerDevice (const QString &device) { emit ringerDeviceChanged(device); } +// ----------------------------------------------------------------------------- + +QString SettingsModel::getRingPath () const { + return ::Utils::linphoneStringToQString(CoreManager::getInstance()->getCore()->getRing()); +} + +void SettingsModel::setRingPath (const QString &path) { + QString cleaned_path = QDir::cleanPath(path); + + CoreManager::getInstance()->getCore()->setRing( + ::Utils::qStringToLinphoneString(cleaned_path) + ); + + emit ringPathChanged(cleaned_path); +} + // ============================================================================= // Chat & calls. // ============================================================================= @@ -442,10 +458,11 @@ void SettingsModel::setTurnPassword (const QString &password) { shared_ptr auth_info = core->findAuthInfo(username, "", ""); if (auth_info) { - shared_ptr _auth_info = auth_info->clone(); + shared_ptr auth_info_clone = auth_info->clone(); + auth_info_clone->setPasswd(::Utils::qStringToLinphoneString(password)); + core->removeAuthInfo(auth_info); - _auth_info->setPasswd(::Utils::qStringToLinphoneString(password)); - core->addAuthInfo(_auth_info); + core->addAuthInfo(auth_info_clone); } else { auth_info = linphone::Factory::get()->createAuthInfo(username, username, ::Utils::qStringToLinphoneString(password), "", "", ""); core->addAuthInfo(auth_info); @@ -496,10 +513,10 @@ QString SettingsModel::getSavedScreenshotsFolder () const { } void SettingsModel::setSavedScreenshotsFolder (const QString &folder) { - QString _folder = QDir::cleanPath(folder) + QDir::separator(); + QString cleaned_folder = QDir::cleanPath(folder) + QDir::separator(); - m_config->setString(UI_SECTION, "saved_screenshots_folder", ::Utils::qStringToLinphoneString(_folder)); - emit savedScreenshotsFolderChanged(_folder); + m_config->setString(UI_SECTION, "saved_screenshots_folder", ::Utils::qStringToLinphoneString(cleaned_folder)); + emit savedScreenshotsFolderChanged(cleaned_folder); } // ----------------------------------------------------------------------------- diff --git a/linphone-desktop/src/components/settings/SettingsModel.hpp b/linphone-desktop/src/components/settings/SettingsModel.hpp index 06f0722b4..5e9758810 100644 --- a/linphone-desktop/src/components/settings/SettingsModel.hpp +++ b/linphone-desktop/src/components/settings/SettingsModel.hpp @@ -45,6 +45,8 @@ class SettingsModel : public QObject { Q_PROPERTY(QString playbackDevice READ getPlaybackDevice WRITE setPlaybackDevice NOTIFY playbackDeviceChanged); Q_PROPERTY(QString ringerDevice READ getRingerDevice WRITE setRingerDevice NOTIFY ringerDeviceChanged); + Q_PROPERTY(QString ringPath READ getRingPath WRITE setRingPath NOTIFY ringPathChanged); + // Chat & calls. ------------------------------------------------------------- Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged); @@ -137,6 +139,9 @@ public: QString getRingerDevice () const; void setRingerDevice (const QString &device); + QString getRingPath () const; + void setRingPath (const QString &path); + // Chat & calls. ------------------------------------------------------------- bool getAutoAnswerStatus () const; @@ -235,6 +240,8 @@ signals: void playbackDeviceChanged (const QString &device); void ringerDeviceChanged (const QString &device); + void ringPathChanged (const QString &path); + // Chat & calls. ------------------------------------------------------------- void autoAnswerStatusChanged (bool status); diff --git a/linphone-desktop/ui/views/App/Settings/SettingsAudio.qml b/linphone-desktop/ui/views/App/Settings/SettingsAudio.qml index 46923c627..3711eb8f0 100644 --- a/linphone-desktop/ui/views/App/Settings/SettingsAudio.qml +++ b/linphone-desktop/ui/views/App/Settings/SettingsAudio.qml @@ -58,5 +58,17 @@ TabContainer { } } } + + FormLine { + FormGroup { + label: qsTr('ringLabel') + + FileChooserButton { + selectedFile: SettingsModel.ringPath + + onAccepted: SettingsModel.ringPath = selectedFile + } + } + } } } diff --git a/linphone-desktop/ui/views/App/Settings/SettingsUi.qml b/linphone-desktop/ui/views/App/Settings/SettingsUi.qml index 2707fbddc..6785cf699 100644 --- a/linphone-desktop/ui/views/App/Settings/SettingsUi.qml +++ b/linphone-desktop/ui/views/App/Settings/SettingsUi.qml @@ -88,8 +88,6 @@ TabContainer { label: qsTr('savedScreenshotsLabel') FileChooserButton { - id: savedScreenshotsFolder - selectedFile: SettingsModel.savedScreenshotsFolder selectFolder: true @@ -101,8 +99,6 @@ TabContainer { label: qsTr('savedVideosLabel') FileChooserButton { - id: savedVideosFolder - selectedFile: SettingsModel.savedVideosFolder selectFolder: true diff --git a/submodules/linphone b/submodules/linphone index 8599aec3e..66e40d839 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 8599aec3e5cf04afa3780885ffd78a3063abed22 +Subproject commit 66e40d839c0705fcb673922e5b142cbc633c3680