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>
<source>ringerDeviceLabel</source>
<translation>Ringer device</translation>
</message>
<message>
<source>ringLabel</source>
<translation>Ring</translation>
</message>
</context>
<context>
<name>SettingsCallsChat</name>
......
......@@ -691,6 +691,10 @@ Url du serveur non configurée.</translation>
<source>ringerDeviceLabel</source>
<translation>Périphérique de sonnerie</translation>
</message>
<message>
<source>ringLabel</source>
<translation>Sonnerie</translation>
</message>
</context>
<context>
<name>SettingsCallsChat</name>
......
......@@ -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<linphone::AuthInfo> auth_info = core->findAuthInfo(username, "", "");
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);
_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);
}
// -----------------------------------------------------------------------------
......
......@@ -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);
......
......@@ -58,5 +58,17 @@ TabContainer {
}
}
}
FormLine {
FormGroup {
label: qsTr('ringLabel')
FileChooserButton {
selectedFile: SettingsModel.ringPath
onAccepted: SettingsModel.ringPath = selectedFile
}
}
}
}
}
......@@ -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
......
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