Add option to allow PC to sleep while streaming
This commit is contained in:
parent
73d84dc13f
commit
97d8274911
5 changed files with 30 additions and 2 deletions
|
|
@ -312,6 +312,7 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
|||
parser.addToggleOption("background-gamepad", "background gamepad input");
|
||||
parser.addToggleOption("reverse-scroll-direction", "inverted scroll direction");
|
||||
parser.addToggleOption("swap-gamepad-buttons", "swap A/B and X/Y gamepad buttons (Nintendo-style)");
|
||||
parser.addToggleOption("keep-awake", "prevent display sleep while streaming");
|
||||
parser.addChoiceOption("capture-system-keys", "capture system key combos", m_CaptureSysKeysModeMap.keys());
|
||||
parser.addChoiceOption("video-codec", "video codec", m_VideoCodecMap.keys());
|
||||
parser.addChoiceOption("video-decoder", "video decoder", m_VideoDecoderMap.keys());
|
||||
|
|
@ -423,6 +424,9 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
|||
// Resolve --swap-gamepad-buttons and --no-swap-gamepad-buttons options
|
||||
preferences->swapFaceButtons = parser.getToggleOptionValue("swap-gamepad-buttons", preferences->swapFaceButtons);
|
||||
|
||||
// Resolve --keep-awake and --no-keep-awake options
|
||||
preferences->keepAwake = parser.getToggleOptionValue("keep-awake", preferences->keepAwake);
|
||||
|
||||
// Resolve --capture-system-keys option
|
||||
if (parser.isSet("capture-system-keys")) {
|
||||
preferences->captureSysKeysMode = mapValue(m_CaptureSysKeysModeMap, parser.getChoiceOptionValue("capture-system-keys"));
|
||||
|
|
|
|||
|
|
@ -953,6 +953,23 @@ Flickable {
|
|||
ToolTip.visible: hovered
|
||||
ToolTip.text: qsTr("Updates your Discord status to display the name of the game you're streaming.")
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
visible: SystemProperties.hasDesktopEnvironment
|
||||
id: keepAwakeCheck
|
||||
width: parent.width
|
||||
text: qsTr("Keep PC awake while streaming")
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.keepAwake
|
||||
onCheckedChanged: {
|
||||
StreamingPreferences.keepAwake = checked
|
||||
}
|
||||
|
||||
ToolTip.delay: 1000
|
||||
ToolTip.timeout: 5000
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: qsTr("Prevents the display from going to sleep while a stream is active.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#define SER_REVERSESCROLL "reversescroll"
|
||||
#define SER_SWAPFACEBUTTONS "swapfacebuttons"
|
||||
#define SER_CAPTURESYSKEYS "capturesyskeys"
|
||||
#define SER_KEEPAWAKE "keepawake"
|
||||
#define SER_LANGUAGE "language"
|
||||
|
||||
#define CURRENT_DEFAULT_VER 1
|
||||
|
|
@ -95,6 +96,7 @@ void StreamingPreferences::reload()
|
|||
backgroundGamepad = settings.value(SER_BACKGROUNDGAMEPAD, false).toBool();
|
||||
reverseScrollDirection = settings.value(SER_REVERSESCROLL, false).toBool();
|
||||
swapFaceButtons = settings.value(SER_SWAPFACEBUTTONS, false).toBool();
|
||||
keepAwake = settings.value(SER_KEEPAWAKE, true).toBool();
|
||||
captureSysKeysMode = static_cast<CaptureSysKeysMode>(settings.value(SER_CAPTURESYSKEYS,
|
||||
static_cast<int>(CaptureSysKeysMode::CSK_OFF)).toInt());
|
||||
audioConfig = static_cast<AudioConfig>(settings.value(SER_AUDIOCFG,
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ public:
|
|||
Q_PROPERTY(bool backgroundGamepad MEMBER backgroundGamepad NOTIFY backgroundGamepadChanged)
|
||||
Q_PROPERTY(bool reverseScrollDirection MEMBER reverseScrollDirection NOTIFY reverseScrollDirectionChanged)
|
||||
Q_PROPERTY(bool swapFaceButtons MEMBER swapFaceButtons NOTIFY swapFaceButtonsChanged)
|
||||
Q_PROPERTY(bool keepAwake MEMBER keepAwake NOTIFY keepAwakeChanged)
|
||||
Q_PROPERTY(CaptureSysKeysMode captureSysKeysMode MEMBER captureSysKeysMode NOTIFY captureSysKeysModeChanged)
|
||||
Q_PROPERTY(Language language MEMBER language NOTIFY languageChanged);
|
||||
|
||||
|
|
@ -157,6 +158,7 @@ public:
|
|||
bool backgroundGamepad;
|
||||
bool reverseScrollDirection;
|
||||
bool swapFaceButtons;
|
||||
bool keepAwake;
|
||||
int packetSize;
|
||||
AudioConfig audioConfig;
|
||||
VideoCodecConfig videoCodecConfig;
|
||||
|
|
@ -195,6 +197,7 @@ signals:
|
|||
void reverseScrollDirectionChanged();
|
||||
void swapFaceButtonsChanged();
|
||||
void captureSysKeysModeChanged();
|
||||
void keepAwakeChanged();
|
||||
void languageChanged();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1468,8 +1468,10 @@ void Session::execInternal()
|
|||
// on macOS.
|
||||
SDL_StopTextInput();
|
||||
|
||||
// Disable the screen saver
|
||||
SDL_DisableScreenSaver();
|
||||
// Disable the screen saver if requested or running as embedded platform
|
||||
if (m_Preferences->keepAwake || !WMUtils::isRunningDesktopEnvironment()) {
|
||||
SDL_DisableScreenSaver();
|
||||
}
|
||||
|
||||
// Hide Qt's fake mouse cursor on EGLFS systems
|
||||
if (QGuiApplication::platformName() == "eglfs") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue