summary refs log tree commit diff
path: root/src/UserSettingsPage.cpp
diff options
context:
space:
mode:
authortrilene <trilene@runbox.com>2021-02-18 15:55:29 -0500
committertrilene <trilene@runbox.com>2021-02-18 15:55:29 -0500
commit8df10eeecac15ddb45ed4e350d33814ac4690f89 (patch)
tree3fbc9f2041926417b453eec6ba559b813904367e /src/UserSettingsPage.cpp
parentTranslated using Weblate (Hungarian) (diff)
downloadnheko-8df10eeecac15ddb45ed4e350d33814ac4690f89.tar.xz
Support desktop screen sharing on X11
Diffstat (limited to 'src/UserSettingsPage.cpp')
-rw-r--r--src/UserSettingsPage.cpp38
1 files changed, 31 insertions, 7 deletions
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp
index b6fdf504..186a03bb 100644
--- a/src/UserSettingsPage.cpp
+++ b/src/UserSettingsPage.cpp
@@ -107,13 +107,15 @@ UserSettings::load(std::optional<QString> profile)
         auto presenceValue = QMetaEnum::fromType<Presence>().keyToValue(tempPresence.c_str());
         if (presenceValue < 0)
                 presenceValue = 0;
-        presence_         = static_cast<Presence>(presenceValue);
-        ringtone_         = settings.value("user/ringtone", "Default").toString();
-        microphone_       = settings.value("user/microphone", QString()).toString();
-        camera_           = settings.value("user/camera", QString()).toString();
-        cameraResolution_ = settings.value("user/camera_resolution", QString()).toString();
-        cameraFrameRate_  = settings.value("user/camera_frame_rate", QString()).toString();
-        useStunServer_    = settings.value("user/use_stun_server", false).toBool();
+        presence_               = static_cast<Presence>(presenceValue);
+        ringtone_               = settings.value("user/ringtone", "Default").toString();
+        microphone_             = settings.value("user/microphone", QString()).toString();
+        camera_                 = settings.value("user/camera", QString()).toString();
+        cameraResolution_       = settings.value("user/camera_resolution", QString()).toString();
+        cameraFrameRate_        = settings.value("user/camera_frame_rate", QString()).toString();
+        screenShareFrameRate_   = settings.value("user/screen_share_frame_rate", 5).toInt();
+        screenShareRemoteVideo_ = settings.value("user/screen_share_remote_video", false).toBool();
+        useStunServer_          = settings.value("user/use_stun_server", false).toBool();
 
         if (profile) // set to "" if it's the default to maintain compatibility
                 profile_ = (*profile == "default") ? "" : *profile;
@@ -445,6 +447,26 @@ UserSettings::setCameraFrameRate(QString frameRate)
 }
 
 void
+UserSettings::setScreenShareFrameRate(int frameRate)
+{
+        if (frameRate == screenShareFrameRate_)
+                return;
+        screenShareFrameRate_ = frameRate;
+        emit screenShareFrameRateChanged(frameRate);
+        save();
+}
+
+void
+UserSettings::setScreenShareRemoteVideo(bool state)
+{
+        if (state == screenShareRemoteVideo_)
+                return;
+        screenShareRemoteVideo_ = state;
+        emit screenShareRemoteVideoChanged(state);
+        save();
+}
+
+void
 UserSettings::setProfile(QString profile)
 {
         if (profile == profile_)
@@ -593,6 +615,8 @@ UserSettings::save()
         settings.setValue("camera", camera_);
         settings.setValue("camera_resolution", cameraResolution_);
         settings.setValue("camera_frame_rate", cameraFrameRate_);
+        settings.setValue("screen_share_frame_rate", screenShareFrameRate_);
+        settings.setValue("screen_share_remote_video", screenShareRemoteVideo_);
         settings.setValue("use_stun_server", useStunServer_);
         settings.setValue("currentProfile", profile_);