mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Config: Don't persist debug mode to config
A request from the OBS developers. Debug mode tends to be enabled, then not remembered to be disabled, leading to logs that are both long and difficult to read. In some cases, the OBS logviewer may noticeably lock up the UI just trying to parse the long log file.
This commit is contained in:
parent
81636dcbfa
commit
f0c3bb2c14
@ -4,7 +4,7 @@ OBSWebSocket.Settings.PluginSettingsTitle="Plugin Settings"
|
||||
OBSWebSocket.Settings.ServerEnable="Enable WebSocket server"
|
||||
OBSWebSocket.Settings.AlertsEnable="Enable System Tray Alerts"
|
||||
OBSWebSocket.Settings.DebugEnable="Enable Debug Logging"
|
||||
OBSWebSocket.Settings.DebugEnableHoverText="Changing this requires the WebSocket server to restart. However, changing this will not automatically restart the obs-websocket server."
|
||||
OBSWebSocket.Settings.DebugEnableHoverText="Enables debug logging for the current instance of OBS. Does not persist on load. Use --websocket_debug to enable on load."
|
||||
|
||||
OBSWebSocket.Settings.ServerSettingsTitle="Server Settings"
|
||||
OBSWebSocket.Settings.AuthRequired="Enable Authentication"
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#define CMDLINE_WEBSOCKET_PORT "websocket_port"
|
||||
#define CMDLINE_WEBSOCKET_PASSWORD "websocket_password"
|
||||
#define CMDLINE_WEBSOCKET_DEBUG "websocket_debug"
|
||||
|
||||
Config::Config() :
|
||||
FirstLoad(true),
|
||||
@ -42,7 +43,6 @@ void Config::Load()
|
||||
|
||||
FirstLoad = config_get_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_FIRSTLOAD);
|
||||
ServerEnabled = config_get_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_ENABLED);
|
||||
DebugEnabled = config_get_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_DEBUG);
|
||||
AlertsEnabled = config_get_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_ALERTS);
|
||||
|
||||
QString portArgument = Utils::Platform::GetCommandLineArgument(CMDLINE_WEBSOCKET_PORT);
|
||||
@ -74,6 +74,9 @@ void Config::Load()
|
||||
ServerPassword = config_get_string(obsConfig, CONFIG_SECTION_NAME, PARAM_PASSWORD);
|
||||
}
|
||||
}
|
||||
|
||||
if (Utils::Platform::GetCommandLineFlagSet(CMDLINE_WEBSOCKET_DEBUG)) // Debug does not persist on reload, so we let people override it with a flag.
|
||||
DebugEnabled = true;
|
||||
}
|
||||
|
||||
void Config::Save()
|
||||
@ -89,7 +92,6 @@ void Config::Save()
|
||||
if (!PortOverridden) {
|
||||
config_set_uint(obsConfig, CONFIG_SECTION_NAME, PARAM_PORT, ServerPort);
|
||||
}
|
||||
config_set_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_DEBUG, DebugEnabled);
|
||||
config_set_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_ALERTS, AlertsEnabled);
|
||||
if (!PasswordOverridden) {
|
||||
config_set_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_AUTHREQUIRED, AuthRequired);
|
||||
@ -110,7 +112,6 @@ void Config::SetDefaultsToGlobalStore()
|
||||
config_set_default_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_FIRSTLOAD, FirstLoad);
|
||||
config_set_default_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_ENABLED, ServerEnabled);
|
||||
config_set_default_uint(obsConfig, CONFIG_SECTION_NAME, PARAM_PORT, ServerPort);
|
||||
config_set_default_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_DEBUG, DebugEnabled);
|
||||
config_set_default_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_ALERTS, AlertsEnabled);
|
||||
config_set_default_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_AUTHREQUIRED, AuthRequired);
|
||||
config_set_default_string(obsConfig, CONFIG_SECTION_NAME, PARAM_PASSWORD, QT_TO_UTF8(ServerPassword));
|
||||
|
@ -55,3 +55,13 @@ QString Utils::Platform::GetCommandLineArgument(QString arg)
|
||||
|
||||
return parser.value(cmdlineOption);
|
||||
}
|
||||
|
||||
bool Utils::Platform::GetCommandLineFlagSet(QString arg)
|
||||
{
|
||||
QCommandLineParser parser;
|
||||
QCommandLineOption cmdlineOption(arg, arg, arg, "");
|
||||
parser.addOption(cmdlineOption);
|
||||
parser.parse(QCoreApplication::arguments());
|
||||
|
||||
return parser.isSet(cmdlineOption);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ namespace Utils {
|
||||
namespace Platform {
|
||||
std::string GetLocalAddress();
|
||||
QString GetCommandLineArgument(QString arg);
|
||||
bool GetCommandLineFlagSet(QString arg);
|
||||
}
|
||||
|
||||
namespace Obs {
|
||||
|
Loading…
Reference in New Issue
Block a user