Commit 22fc353a authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Settings/SettingsAudio): filter capture/playback devices

parent 566b1c0e
...@@ -42,11 +42,26 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) { ...@@ -42,11 +42,26 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
// Audio. // Audio.
// ============================================================================= // =============================================================================
QStringList SettingsModel::getAudioDevices () const { QStringList SettingsModel::getCaptureDevices () const {
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
QStringList list; QStringList list;
for (const auto &device : CoreManager::getInstance()->getCore()->getSoundDevices()) for (const auto &device : core->getSoundDevices()) {
if (core->soundDeviceCanCapture(device))
list << ::Utils::coreStringToAppString(device); list << ::Utils::coreStringToAppString(device);
}
return list;
}
QStringList SettingsModel::getPlaybackDevices () const {
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
QStringList list;
for (const auto &device : core->getSoundDevices()) {
if (core->soundDeviceCanPlayback(device))
list << ::Utils::coreStringToAppString(device);
}
return list; return list;
} }
......
...@@ -37,7 +37,8 @@ class SettingsModel : public QObject { ...@@ -37,7 +37,8 @@ class SettingsModel : public QObject {
// Audio. -------------------------------------------------------------------- // Audio. --------------------------------------------------------------------
Q_PROPERTY(QStringList audioDevices READ getAudioDevices CONSTANT); Q_PROPERTY(QStringList captureDevices READ getCaptureDevices CONSTANT);
Q_PROPERTY(QStringList playbackDevices READ getPlaybackDevices CONSTANT);
Q_PROPERTY(QString captureDevice READ getCaptureDevice WRITE setCaptureDevice NOTIFY captureDeviceChanged); Q_PROPERTY(QString captureDevice READ getCaptureDevice WRITE setCaptureDevice NOTIFY captureDeviceChanged);
Q_PROPERTY(QString playbackDevice READ getPlaybackDevice WRITE setPlaybackDevice NOTIFY playbackDeviceChanged); Q_PROPERTY(QString playbackDevice READ getPlaybackDevice WRITE setPlaybackDevice NOTIFY playbackDeviceChanged);
...@@ -143,7 +144,8 @@ public: ...@@ -143,7 +144,8 @@ public:
// Audio. -------------------------------------------------------------------- // Audio. --------------------------------------------------------------------
QStringList getAudioDevices () const; QStringList getCaptureDevices () const;
QStringList getPlaybackDevices () const;
QString getCaptureDevice () const; QString getCaptureDevice () const;
void setCaptureDevice (const QString &device); void setCaptureDevice (const QString &device);
......
...@@ -29,7 +29,7 @@ TabContainer { ...@@ -29,7 +29,7 @@ TabContainer {
currentIndex: Utils.findIndex(model, function (device) { currentIndex: Utils.findIndex(model, function (device) {
return device === SettingsModel.playbackDevice return device === SettingsModel.playbackDevice
}) })
model: SettingsModel.audioDevices model: SettingsModel.playbackDevices
onActivated: SettingsModel.playbackDevice = model[index] onActivated: SettingsModel.playbackDevice = model[index]
} }
...@@ -44,7 +44,7 @@ TabContainer { ...@@ -44,7 +44,7 @@ TabContainer {
currentIndex: Utils.findIndex(model, function (device) { currentIndex: Utils.findIndex(model, function (device) {
return device === SettingsModel.captureDevice return device === SettingsModel.captureDevice
}) })
model: SettingsModel.audioDevices model: SettingsModel.captureDevices
onActivated: SettingsModel.captureDevice = model[index] onActivated: SettingsModel.captureDevice = model[index]
} }
...@@ -59,7 +59,7 @@ TabContainer { ...@@ -59,7 +59,7 @@ TabContainer {
currentIndex: Utils.findIndex(model, function (device) { currentIndex: Utils.findIndex(model, function (device) {
return device === SettingsModel.ringerDevice return device === SettingsModel.ringerDevice
}) })
model: SettingsModel.audioDevices model: SettingsModel.playbackDevices
onActivated: SettingsModel.ringerDevice = model[index] onActivated: SettingsModel.ringerDevice = model[index]
} }
......
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