mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-31 04:03:30 +02:00
screensharing: add preference to set frame rate
GitLab: #514 Change-Id: I0f3dbf2dd31f84dc50a2fd17d153a299d06012fb
This commit is contained in:
parent
c681be5bf4
commit
cfd5617ce8
6 changed files with 82 additions and 3 deletions
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -5,6 +5,7 @@
|
|||
"string": "cpp",
|
||||
"string_view": "cpp",
|
||||
"ranges": "cpp",
|
||||
"thread": "cpp"
|
||||
"thread": "cpp",
|
||||
"xstring": "cpp"
|
||||
}
|
||||
}
|
|
@ -176,6 +176,8 @@ Item {
|
|||
property string selectFPS: qsTr("Select video frame rate (frames per second)")
|
||||
property string enableHWAccel: qsTr("Enable hardware acceleration")
|
||||
property string previewUnavailable: qsTr("Preview unavailable")
|
||||
property string screenSharing: qsTr("Screen Sharing")
|
||||
property string selectScreenSharingFPS: qsTr("Select screen sharing frame rate (frames per second)")
|
||||
|
||||
// BackupKeyPage
|
||||
property string backupAccountInfos: qsTr("Your account only exists on this device. " +
|
||||
|
|
|
@ -35,6 +35,7 @@ RowLayout {
|
|||
property alias enabled: comboBoxOfLayout.enabled
|
||||
property alias fontPointSize: comboBoxOfLayout.font.pointSize
|
||||
property alias modelIndex: comboBoxOfLayout.currentIndex
|
||||
property alias modelSize: comboBoxOfLayout.count
|
||||
|
||||
property int heightOfLayout: 30
|
||||
property int widthOfComboBox: 50
|
||||
|
|
|
@ -120,6 +120,7 @@ ColumnLayout {
|
|||
Layout.leftMargin: JamiTheme.preferredMarginSize
|
||||
|
||||
enabled: VideoDevices.listSize !== 0
|
||||
opacity: enabled ? 1.0 : 0.5
|
||||
|
||||
fontPointSize: JamiTheme.settingsFontSize
|
||||
widthOfComboBox: itemWidth
|
||||
|
@ -147,6 +148,7 @@ ColumnLayout {
|
|||
Layout.leftMargin: JamiTheme.preferredMarginSize
|
||||
|
||||
enabled: VideoDevices.listSize !== 0
|
||||
opacity: enabled ? 1.0 : 0.5
|
||||
|
||||
widthOfComboBox: itemWidth
|
||||
fontPointSize: JamiTheme.settingsFontSize
|
||||
|
@ -168,6 +170,7 @@ ColumnLayout {
|
|||
Layout.leftMargin: JamiTheme.preferredMarginSize
|
||||
|
||||
enabled: VideoDevices.listSize !== 0
|
||||
opacity: enabled ? 1.0 : 0.5
|
||||
|
||||
widthOfComboBox: itemWidth
|
||||
fontPointSize: JamiTheme.settingsFontSize
|
||||
|
@ -200,6 +203,8 @@ ColumnLayout {
|
|||
Rectangle {
|
||||
id: rectBox
|
||||
|
||||
visible: VideoDevices.listSize !== 0
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.preferredHeight: width * aspectRatio
|
||||
|
||||
|
@ -217,7 +222,6 @@ ColumnLayout {
|
|||
|
||||
lrcInstance: LRCInstance
|
||||
|
||||
visible: VideoDevices.listSize !== 0
|
||||
layer.enabled: true
|
||||
layer.effect: OpacityMask {
|
||||
maskSource: rectBox
|
||||
|
@ -240,4 +244,44 @@ ColumnLayout {
|
|||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
ElidedTextLabel {
|
||||
id: screenSharingSetTitle
|
||||
visible: screenSharingFPSComboBoxSetting.modelSize > 0
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: JamiTheme.preferredFieldHeight
|
||||
|
||||
eText: JamiStrings.screenSharing
|
||||
fontSize: JamiTheme.headerFontSize
|
||||
maxWidth: itemWidth * 2
|
||||
}
|
||||
|
||||
SettingsComboBox {
|
||||
id: screenSharingFPSComboBoxSetting
|
||||
|
||||
visible: modelSize > 0
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: JamiTheme.preferredFieldHeight
|
||||
Layout.leftMargin: JamiTheme.preferredMarginSize
|
||||
Layout.bottomMargin: JamiTheme.preferredMarginSize
|
||||
|
||||
widthOfComboBox: itemWidth
|
||||
fontPointSize: JamiTheme.settingsFontSize
|
||||
|
||||
tipText: JamiStrings.selectScreenSharingFPS
|
||||
labelText: JamiStrings.fps
|
||||
currentSelectionText: VideoDevices.screenSharingDefaultFps.toString()
|
||||
placeholderText: VideoDevices.screenSharingDefaultFps.toString()
|
||||
comboModel: ListModel { id: screenSharingFpsModel }
|
||||
role: "FPS"
|
||||
Component.onCompleted: {
|
||||
var elements = VideoDevices.getScreenSharingFpsModel()
|
||||
for (var item in elements) {
|
||||
screenSharingFpsModel.append({"FPS": elements[item]})
|
||||
}
|
||||
}
|
||||
|
||||
onActivated: VideoDevices.setDisplayFPS(screenSharingFpsModel.get(modelIndex).FPS)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,6 +206,14 @@ VideoDevices::VideoDevices(LRCInstance* lrcInstance, QObject* parent)
|
|||
this,
|
||||
&VideoDevices::onVideoDeviceEvent);
|
||||
|
||||
auto displaySettings = lrcInstance_->avModel().getDeviceSettings(DEVICE_DESKTOP);
|
||||
|
||||
auto desktopfpsSource = lrcInstance_->avModel().getDeviceCapabilities(DEVICE_DESKTOP);
|
||||
if (desktopfpsSource.contains(CHANNEL_DEFAULT) && !desktopfpsSource[CHANNEL_DEFAULT].empty()) {
|
||||
desktopfpsSourceModel_ = desktopfpsSource[CHANNEL_DEFAULT][0].second;
|
||||
if (desktopfpsSourceModel_.indexOf(displaySettings.rate) >= 0)
|
||||
set_screenSharingDefaultFps(displaySettings.rate);
|
||||
}
|
||||
updateData();
|
||||
}
|
||||
|
||||
|
@ -305,6 +313,22 @@ VideoDevices::setDefaultDeviceFps(int index)
|
|||
updateData();
|
||||
}
|
||||
|
||||
void
|
||||
VideoDevices::setDisplayFPS(const QString& fps)
|
||||
{
|
||||
auto settings = lrcInstance_->avModel().getDeviceSettings(DEVICE_DESKTOP);
|
||||
settings.id = DEVICE_DESKTOP;
|
||||
settings.rate = fps.toInt();
|
||||
lrcInstance_->avModel().setDeviceSettings(settings);
|
||||
set_screenSharingDefaultFps(fps.toInt());
|
||||
}
|
||||
|
||||
QVariant
|
||||
VideoDevices::getScreenSharingFpsModel()
|
||||
{
|
||||
return QVariant::fromValue(desktopfpsSourceModel_.toList());
|
||||
}
|
||||
|
||||
void
|
||||
VideoDevices::updateData()
|
||||
{
|
||||
|
@ -315,7 +339,7 @@ VideoDevices::updateData()
|
|||
auto defaultDeviceSettings = lrcInstance_->avModel().getDeviceSettings(defaultDevice);
|
||||
auto defaultDeviceCap = lrcInstance_->avModel().getDeviceCapabilities(defaultDevice);
|
||||
auto currentResRateList = defaultDeviceCap[defaultDeviceSettings.channel.isEmpty()
|
||||
? "default"
|
||||
? CHANNEL_DEFAULT
|
||||
: defaultDeviceSettings.channel];
|
||||
lrc::api::video::FrameratesList fpsList;
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ class VideoDevices : public QObject
|
|||
QML_RO_PROPERTY(QString, defaultName)
|
||||
QML_RO_PROPERTY(QString, defaultRes)
|
||||
QML_RO_PROPERTY(int, defaultFps)
|
||||
QML_PROPERTY(int, screenSharingDefaultFps)
|
||||
|
||||
public:
|
||||
explicit VideoDevices(LRCInstance* lrcInstance, QObject* parent = nullptr);
|
||||
|
@ -166,10 +167,12 @@ public:
|
|||
|
||||
Q_INVOKABLE QVariant fpsFilterModel();
|
||||
Q_INVOKABLE QVariant fpsSourceModel();
|
||||
Q_INVOKABLE QVariant getScreenSharingFpsModel();
|
||||
|
||||
Q_INVOKABLE void setDefaultDevice(int index, bool useSourceModel = false);
|
||||
Q_INVOKABLE void setDefaultDeviceRes(int index);
|
||||
Q_INVOKABLE void setDefaultDeviceFps(int index);
|
||||
Q_INVOKABLE void setDisplayFPS(const QString& fps);
|
||||
|
||||
const lrc::api::video::ResRateList& get_defaultResRateList();
|
||||
void set_defaultResRateList(lrc::api::video::ResRateList resRateList);
|
||||
|
@ -202,4 +205,8 @@ private:
|
|||
|
||||
lrc::api::video::ResRateList defaultResRateList_;
|
||||
lrc::api::video::FrameratesList defaultFpsList_;
|
||||
lrc::api::video::FrameratesList desktopfpsSourceModel_;
|
||||
|
||||
constexpr static const char DEVICE_DESKTOP[] = "desktop";
|
||||
constexpr static const char CHANNEL_DEFAULT[] = "default";
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue