From 81636dcbfa5adc415806a84fb5d85638bcc119ae Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sat, 5 Jun 2021 21:38:16 -0700 Subject: [PATCH] SettingsDialog: Show confirmation when video is active Show a confirmation dialog when the Show Connect Info button is clicked and video is active, to prevent users from unintentionally showing sensitive information while live. --- data/locale/en-US.ini | 3 +++ src/forms/SettingsDialog.cpp | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini index d00e16fe..af400081 100644 --- a/data/locale/en-US.ini +++ b/data/locale/en-US.ini @@ -12,6 +12,9 @@ OBSWebSocket.Settings.Password="Server Password" OBSWebSocket.Settings.GeneratePassword="Generate Password" OBSWebSocket.Settings.ServerPort="Server Port" OBSWebSocket.Settings.ShowConnectInfo="Show Connect Info" +OBSWebSocket.Settings.ShowConnectInfoWarningTitle="Warning: Currently Live" +OBSWebSocket.Settings.ShowConnectInfoWarningMessage="It appears that an output (stream, recording, etc.) is currently active." +OBSWebSocket.Settings.ShowConnectInfoWarningInfoText="Are you sure that you want to show your connect info?" OBSWebSocket.SessionTable.Title="Connected WebSocket Sessions" OBSWebSocket.SessionTable.RemoteAddressColumnTitle="Remote Address" diff --git a/src/forms/SettingsDialog.cpp b/src/forms/SettingsDialog.cpp index 5a1da870..49167ea5 100644 --- a/src/forms/SettingsDialog.cpp +++ b/src/forms/SettingsDialog.cpp @@ -215,6 +215,24 @@ void SettingsDialog::GeneratePasswordButtonClicked() void SettingsDialog::ShowConnectInfoButtonClicked() { + if (obs_video_active()) { + QMessageBox msgBox; + msgBox.setWindowTitle(obs_module_text("OBSWebSocket.Settings.ShowConnectInfoWarningTitle")); + msgBox.setText(obs_module_text("OBSWebSocket.Settings.ShowConnectInfoWarningMessage")); + msgBox.setInformativeText(obs_module_text("OBSWebSocket.Settings.ShowConnectInfoWarningInfoText")); + msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + msgBox.setDefaultButton(QMessageBox::No); + int ret = msgBox.exec(); + + switch (ret) { + case QMessageBox::Yes: + break; + case QMessageBox::No: + default: + return; + } + } + connectInfo->show(); connectInfo->activateWindow(); connectInfo->raise();