fix(ui/views/App/Settings/SettingsVideo): fix a crash if the app was built without video support

This commit is contained in:
Ronan Abhamon 2017-06-12 15:15:00 +02:00
parent 6e440461c7
commit 667aa7e1c4
3 changed files with 15 additions and 5 deletions

View file

@ -182,6 +182,16 @@ void SettingsModel::setVideoFramerate (int framerate) {
inline QVariantMap createMapFromVideoDefinition (const shared_ptr<const linphone::VideoDefinition> &definition) {
QVariantMap map;
if (!definition) {
Q_ASSERT(!CoreManager::getInstance()->getCore()->videoSupported());
map["name"] = QStringLiteral("Bad EGG");
map["width"] = QStringLiteral("?????");
map["height"] = QStringLiteral("?????");
return map;
}
map["name"] = ::Utils::coreStringToAppString(definition->getName());
map["width"] = definition->getWidth();
map["height"] = definition->getHeight();

View file

@ -28,9 +28,9 @@ TabContainer {
label: qsTr('videoInputDeviceLabel')
ComboBox {
currentIndex: Utils.findIndex(model, function (device) {
currentIndex: Number(Utils.findIndex(model, function (device) {
return device === SettingsModel.videoDevice
})
})) // Number cast => Index is null if app does not support video.
model: SettingsModel.videoDevices
onActivated: SettingsModel.videoDevice = model[index]
@ -74,9 +74,9 @@ TabContainer {
label: qsTr('videoSizeLabel')
ComboBox {
currentIndex: Utils.findIndex(model, function (definition) {
currentIndex: Number(Utils.findIndex(model, function (definition) {
return definition.value.name === SettingsModel.videoDefinition.name
})
})) // Number cast => Index is null if app does not support video.
model: SettingsModel.supportedVideoDefinitions.map(function (definition) {
return {
key: definition.name + ' (' + definition.width + 'x' + definition.height + ')',

@ -1 +1 @@
Subproject commit 2b93067a78a0373f24ee868d5bd0523f6be15d14
Subproject commit df4cc8d7079e6191bf0bb389da809736c5607b70