Commit 17185312 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Settings/SettingsAudio): supports ring selection

parent 773a8c76
...@@ -681,6 +681,10 @@ Server url not configured.</translation> ...@@ -681,6 +681,10 @@ Server url not configured.</translation>
<source>ringerDeviceLabel</source> <source>ringerDeviceLabel</source>
<translation>Ringer device</translation> <translation>Ringer device</translation>
</message> </message>
<message>
<source>ringLabel</source>
<translation>Ring</translation>
</message>
</context> </context>
<context> <context>
<name>SettingsCallsChat</name> <name>SettingsCallsChat</name>
......
...@@ -691,6 +691,10 @@ Url du serveur non configurée.</translation> ...@@ -691,6 +691,10 @@ Url du serveur non configurée.</translation>
<source>ringerDeviceLabel</source> <source>ringerDeviceLabel</source>
<translation>Périphérique de sonnerie</translation> <translation>Périphérique de sonnerie</translation>
</message> </message>
<message>
<source>ringLabel</source>
<translation>Sonnerie</translation>
</message>
</context> </context>
<context> <context>
<name>SettingsCallsChat</name> <name>SettingsCallsChat</name>
......
...@@ -45,17 +45,17 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) { ...@@ -45,17 +45,17 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
QVariantList SettingsModel::getAudioCodecs () const { QVariantList SettingsModel::getAudioCodecs () const {
QVariantList list; QVariantList list;
for (const auto &codec : CoreManager::getInstance()->getCore()->getAudioCodecs()) { // for (const auto &codec : CoreManager::getInstance()->getCore()->getAudioCodecs()) {
QVariantMap map; // QVariantMap map;
//
map["mime"] = ::Utils::linphoneStringToQString(codec->getMimeType()); // map["mime"] = ::Utils::linphoneStringToQString(codec->getMimeType());
map["channels"] = codec->getChannels(); // map["channels"] = codec->getChannels();
map["bitrate"] = codec->getNormalBitrate(); // map["bitrate"] = codec->getNormalBitrate();
map["type"] = codec->getType(); // map["type"] = codec->getType();
map["isVbr"] = codec->isVbr(); // map["isVbr"] = codec->isVbr();
//
list << map; // list << map;
} // }
return list; return list;
} }
...@@ -121,6 +121,22 @@ void SettingsModel::setRingerDevice (const QString &device) { ...@@ -121,6 +121,22 @@ void SettingsModel::setRingerDevice (const QString &device) {
emit ringerDeviceChanged(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. // Chat & calls.
// ============================================================================= // =============================================================================
...@@ -442,10 +458,11 @@ void SettingsModel::setTurnPassword (const QString &password) { ...@@ -442,10 +458,11 @@ void SettingsModel::setTurnPassword (const QString &password) {
shared_ptr<linphone::AuthInfo> auth_info = core->findAuthInfo(username, "", ""); shared_ptr<linphone::AuthInfo> auth_info = core->findAuthInfo(username, "", "");
if (auth_info) { if (auth_info) {
shared_ptr<linphone::AuthInfo> _auth_info = auth_info->clone(); shared_ptr<linphone::AuthInfo> auth_info_clone = auth_info->clone();
auth_info_clone->setPasswd(::Utils::qStringToLinphoneString(password));
core->removeAuthInfo(auth_info); core->removeAuthInfo(auth_info);
_auth_info->setPasswd(::Utils::qStringToLinphoneString(password)); core->addAuthInfo(auth_info_clone);
core->addAuthInfo(_auth_info);
} else { } else {
auth_info = linphone::Factory::get()->createAuthInfo(username, username, ::Utils::qStringToLinphoneString(password), "", "", ""); auth_info = linphone::Factory::get()->createAuthInfo(username, username, ::Utils::qStringToLinphoneString(password), "", "", "");
core->addAuthInfo(auth_info); core->addAuthInfo(auth_info);
...@@ -496,10 +513,10 @@ QString SettingsModel::getSavedScreenshotsFolder () const { ...@@ -496,10 +513,10 @@ QString SettingsModel::getSavedScreenshotsFolder () const {
} }
void SettingsModel::setSavedScreenshotsFolder (const QString &folder) { 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)); m_config->setString(UI_SECTION, "saved_screenshots_folder", ::Utils::qStringToLinphoneString(cleaned_folder));
emit savedScreenshotsFolderChanged(_folder); emit savedScreenshotsFolderChanged(cleaned_folder);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -45,6 +45,8 @@ class SettingsModel : public QObject { ...@@ -45,6 +45,8 @@ class SettingsModel : public QObject {
Q_PROPERTY(QString playbackDevice READ getPlaybackDevice WRITE setPlaybackDevice NOTIFY playbackDeviceChanged); Q_PROPERTY(QString playbackDevice READ getPlaybackDevice WRITE setPlaybackDevice NOTIFY playbackDeviceChanged);
Q_PROPERTY(QString ringerDevice READ getRingerDevice WRITE setRingerDevice NOTIFY ringerDeviceChanged); Q_PROPERTY(QString ringerDevice READ getRingerDevice WRITE setRingerDevice NOTIFY ringerDeviceChanged);
Q_PROPERTY(QString ringPath READ getRingPath WRITE setRingPath NOTIFY ringPathChanged);
// Chat & calls. ------------------------------------------------------------- // Chat & calls. -------------------------------------------------------------
Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged); Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged);
...@@ -137,6 +139,9 @@ public: ...@@ -137,6 +139,9 @@ public:
QString getRingerDevice () const; QString getRingerDevice () const;
void setRingerDevice (const QString &device); void setRingerDevice (const QString &device);
QString getRingPath () const;
void setRingPath (const QString &path);
// Chat & calls. ------------------------------------------------------------- // Chat & calls. -------------------------------------------------------------
bool getAutoAnswerStatus () const; bool getAutoAnswerStatus () const;
...@@ -235,6 +240,8 @@ signals: ...@@ -235,6 +240,8 @@ signals:
void playbackDeviceChanged (const QString &device); void playbackDeviceChanged (const QString &device);
void ringerDeviceChanged (const QString &device); void ringerDeviceChanged (const QString &device);
void ringPathChanged (const QString &path);
// Chat & calls. ------------------------------------------------------------- // Chat & calls. -------------------------------------------------------------
void autoAnswerStatusChanged (bool status); void autoAnswerStatusChanged (bool status);
......
...@@ -58,5 +58,17 @@ TabContainer { ...@@ -58,5 +58,17 @@ TabContainer {
} }
} }
} }
FormLine {
FormGroup {
label: qsTr('ringLabel')
FileChooserButton {
selectedFile: SettingsModel.ringPath
onAccepted: SettingsModel.ringPath = selectedFile
}
}
}
} }
} }
...@@ -88,8 +88,6 @@ TabContainer { ...@@ -88,8 +88,6 @@ TabContainer {
label: qsTr('savedScreenshotsLabel') label: qsTr('savedScreenshotsLabel')
FileChooserButton { FileChooserButton {
id: savedScreenshotsFolder
selectedFile: SettingsModel.savedScreenshotsFolder selectedFile: SettingsModel.savedScreenshotsFolder
selectFolder: true selectFolder: true
...@@ -101,8 +99,6 @@ TabContainer { ...@@ -101,8 +99,6 @@ TabContainer {
label: qsTr('savedVideosLabel') label: qsTr('savedVideosLabel')
FileChooserButton { FileChooserButton {
id: savedVideosFolder
selectedFile: SettingsModel.savedVideosFolder selectedFile: SettingsModel.savedVideosFolder
selectFolder: true selectFolder: true
......
linphone @ 66e40d83
Subproject commit 8599aec3e5cf04afa3780885ffd78a3063abed22 Subproject commit 66e40d839c0705fcb673922e5b142cbc633c3680
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment