mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
feat(ui/views/App/Settings/SettingsVideo): supports video size
This commit is contained in:
parent
a7534951ed
commit
c00c0bcda6
3 changed files with 71 additions and 22 deletions
|
|
@ -177,6 +177,38 @@ void SettingsModel::setVideoFramerate (int framerate) {
|
|||
emit videoFramerateChanged(framerate);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
inline QVariantMap createMapFromVideoDefinition (const shared_ptr<const linphone::VideoDefinition> &definition) {
|
||||
QVariantMap map;
|
||||
|
||||
map["name"] = ::Utils::linphoneStringToQString(definition->getName());
|
||||
map["width"] = definition->getWidth();
|
||||
map["height"] = definition->getHeight();
|
||||
map["__definition"] = QVariant::fromValue(definition);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
QVariantList SettingsModel::getSupportedVideoDefinitions () const {
|
||||
QVariantList list;
|
||||
for (const auto &definition : linphone::Factory::get()->getSupportedVideoDefinitions())
|
||||
list << createMapFromVideoDefinition(definition);
|
||||
return list;
|
||||
}
|
||||
|
||||
QVariantMap SettingsModel::getVideoDefinition () const {
|
||||
return createMapFromVideoDefinition(CoreManager::getInstance()->getCore()->getPreferredVideoDefinition());
|
||||
}
|
||||
|
||||
void SettingsModel::setVideoDefinition (const QVariantMap &definition) {
|
||||
CoreManager::getInstance()->getCore()->setPreferredVideoDefinition(
|
||||
definition.value("__definition").value<shared_ptr<const linphone::VideoDefinition> >()->clone()
|
||||
);
|
||||
|
||||
emit videoDefinitionChanged(definition);
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Chat & calls.
|
||||
// =============================================================================
|
||||
|
|
|
|||
|
|
@ -56,6 +56,10 @@ class SettingsModel : public QObject {
|
|||
Q_PROPERTY(QString videoPreset READ getVideoPreset WRITE setVideoPreset NOTIFY videoPresetChanged);
|
||||
Q_PROPERTY(int videoFramerate READ getVideoFramerate WRITE setVideoFramerate NOTIFY videoFramerateChanged);
|
||||
|
||||
Q_PROPERTY(QVariantList supportedVideoDefinitions READ getSupportedVideoDefinitions CONSTANT);
|
||||
|
||||
Q_PROPERTY(QVariantMap videoDefinition READ getVideoDefinition WRITE setVideoDefinition NOTIFY videoDefinitionChanged);
|
||||
|
||||
// Chat & calls. -------------------------------------------------------------
|
||||
|
||||
Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged);
|
||||
|
|
@ -164,6 +168,11 @@ public:
|
|||
int getVideoFramerate () const;
|
||||
void setVideoFramerate (int framerate);
|
||||
|
||||
QVariantList getSupportedVideoDefinitions () const;
|
||||
|
||||
QVariantMap getVideoDefinition () const;
|
||||
void setVideoDefinition (const QVariantMap &definition);
|
||||
|
||||
// Chat & calls. -------------------------------------------------------------
|
||||
|
||||
bool getAutoAnswerStatus () const;
|
||||
|
|
@ -271,6 +280,8 @@ signals:
|
|||
void videoPresetChanged (const QString &preset);
|
||||
void videoFramerateChanged (int framerate);
|
||||
|
||||
void videoDefinitionChanged (const QVariantMap &definition);
|
||||
|
||||
// Chat & calls. -------------------------------------------------------------
|
||||
|
||||
void autoAnswerStatusChanged (bool status);
|
||||
|
|
@ -318,4 +329,6 @@ private:
|
|||
std::shared_ptr<linphone::Config> mConfig;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<const linphone::VideoDefinition> );
|
||||
|
||||
#endif // SETTINGS_MODEL_H_
|
||||
|
|
|
|||
|
|
@ -44,33 +44,25 @@ TabContainer {
|
|||
currentIndex: {
|
||||
var preset = SettingsModel.videoPreset
|
||||
|
||||
return Number(Utils.findIndex([ 'default', 'high-fps', 'custom' ], function (value) {
|
||||
return preset === value
|
||||
return Number(Utils.findIndex(model, function (value) {
|
||||
return preset === value.value
|
||||
}))
|
||||
}
|
||||
|
||||
model: ListModel {
|
||||
id: presets
|
||||
|
||||
ListElement {
|
||||
key: qsTr('presetDefault')
|
||||
value: 'default'
|
||||
}
|
||||
|
||||
ListElement {
|
||||
key: qsTr('presetHighFps')
|
||||
value: 'high-fps'
|
||||
}
|
||||
|
||||
ListElement {
|
||||
key: qsTr('presetCustom')
|
||||
value: 'custom'
|
||||
}
|
||||
}
|
||||
model: [{
|
||||
key: qsTr('presetDefault'),
|
||||
value: 'default'
|
||||
}, {
|
||||
key: qsTr('presetHighFps'),
|
||||
value: 'high-fps'
|
||||
}, {
|
||||
key: qsTr('presetCustom'),
|
||||
value: 'custom'
|
||||
}]
|
||||
|
||||
textRole: 'key'
|
||||
|
||||
onActivated: SettingsModel.videoPreset = presets.get(index).value
|
||||
onActivated: SettingsModel.videoPreset = model[index].value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -80,7 +72,19 @@ TabContainer {
|
|||
label: qsTr('videoSizeLabel')
|
||||
|
||||
ComboBox {
|
||||
// TODO
|
||||
currentIndex: Utils.findIndex(model, function (definition) {
|
||||
return definition.value.name === SettingsModel.videoDefinition.name
|
||||
})
|
||||
model: SettingsModel.supportedVideoDefinitions.map(function (definition) {
|
||||
return {
|
||||
key: definition.name + ' (' + definition.width + 'x' + definition.height + ')',
|
||||
value: definition
|
||||
}
|
||||
})
|
||||
|
||||
textRole: 'key'
|
||||
|
||||
onActivated: SettingsModel.videoDefinition = model[index].value
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue