diff --git a/CMakeLists.txt b/CMakeLists.txt index e4ded991..f435efeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,6 @@ cmake_minimum_required(VERSION 3.16...3.25) -legacy_check() - -set(obs-websocket_VERSION 5.5.2) +set(obs-websocket_VERSION 5.5.6) set(OBS_WEBSOCKET_RPC_VERSION 1) include(cmake/obs-websocket-api.cmake) @@ -138,12 +136,14 @@ target_compile_definitions( target_compile_options( obs-websocket PRIVATE $<$:/wd4267> + $<$:/wd4996> $<$:-Wall> $<$:-Wno-error=float-conversion> $<$:-Wno-error=shadow> $<$:-Wno-error=format-overflow> $<$:-Wno-error=int-conversion> $<$:-Wno-error=comment> + $<$:-Wno-error=deprecated-declarations> $<$:-Wno-error=null-pointer-subtraction> $<$:-Wno-error=deprecated-declarations> $<$:-Wno-error=implicit-int-conversion> diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake deleted file mode 100644 index e0af604e..00000000 --- a/cmake/legacy.cmake +++ /dev/null @@ -1,188 +0,0 @@ -project(obs-websocket VERSION 5.5.2) -set(OBS_WEBSOCKET_RPC_VERSION 1) - -option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON) - -add_library(obs-websocket-api INTERFACE) -add_library(OBS::websocket-api ALIAS obs-websocket-api) - -target_sources(obs-websocket-api INTERFACE $ - $) - -target_link_libraries(obs-websocket-api INTERFACE OBS::libobs) - -target_include_directories(obs-websocket-api INTERFACE $ - $) - -set_target_properties(obs-websocket-api PROPERTIES PUBLIC_HEADER lib/obs-websocket-api.h) -# TODO: Seems like a new bug in legacy CMake, they are trying to export non-binary target -#export_target(obs-websocket-api) - -if(NOT ENABLE_WEBSOCKET OR NOT ENABLE_UI) - message(STATUS "OBS: DISABLED obs-websocket") - return() -endif() - -# Plugin tests flag -option(PLUGIN_TESTS "Enable plugin runtime tests" OFF) - -# Find Qt -find_qt(COMPONENTS Core Widgets Svg Network) - -# Find nlohmann JSON -find_package(nlohmann_json 3 REQUIRED) - -# Find qrcodegencpp -set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON) -find_package(qrcodegencpp REQUIRED) -set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF) - -# Find WebSocket++ -find_package(Websocketpp 0.8 REQUIRED) - -# Find Asio -find_package(Asio 1.12.1 REQUIRED) - -# Tell websocketpp not to use system boost -add_definitions(-DASIO_STANDALONE) - -# Configure files -configure_file(src/plugin-macros.h.in plugin-macros.generated.h) - -# Setup target -add_library(obs-websocket MODULE) -add_library(OBS::websocket ALIAS obs-websocket) - -set_target_properties( - obs-websocket - PROPERTIES AUTOMOC ON - AUTOUIC ON - AUTORCC ON) - -if(_QT_VERSION EQUAL 6 AND OS_WINDOWS) - set_target_properties(obs-websocket PROPERTIES AUTORCC_OPTIONS "--format-version;1") -endif() - -target_include_directories(obs-websocket PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) - -target_sources( - obs-websocket - PRIVATE src/obs-websocket.cpp - src/obs-websocket.h - src/Config.cpp - src/Config.h - src/forms/SettingsDialog.cpp - src/forms/SettingsDialog.h - src/forms/ConnectInfo.cpp - src/forms/ConnectInfo.h - src/forms/resources.qrc - src/WebSocketApi.cpp - src/WebSocketApi.h - src/websocketserver/WebSocketServer.cpp - src/websocketserver/WebSocketServer_Protocol.cpp - src/websocketserver/WebSocketServer.h - src/websocketserver/rpc/WebSocketSession.h - src/websocketserver/types/WebSocketCloseCode.h - src/websocketserver/types/WebSocketOpCode.h - src/eventhandler/EventHandler.cpp - src/eventhandler/EventHandler_General.cpp - src/eventhandler/EventHandler_Config.cpp - src/eventhandler/EventHandler_Scenes.cpp - src/eventhandler/EventHandler_Inputs.cpp - src/eventhandler/EventHandler_Transitions.cpp - src/eventhandler/EventHandler_Filters.cpp - src/eventhandler/EventHandler_Outputs.cpp - src/eventhandler/EventHandler_SceneItems.cpp - src/eventhandler/EventHandler_MediaInputs.cpp - src/eventhandler/EventHandler_Ui.cpp - src/eventhandler/EventHandler.h - src/eventhandler/types/EventSubscription.h - src/requesthandler/RequestHandler.cpp - src/requesthandler/RequestHandler_General.cpp - src/requesthandler/RequestHandler_Config.cpp - src/requesthandler/RequestHandler_Sources.cpp - src/requesthandler/RequestHandler_Scenes.cpp - src/requesthandler/RequestHandler_Inputs.cpp - src/requesthandler/RequestHandler_Transitions.cpp - src/requesthandler/RequestHandler_Filters.cpp - src/requesthandler/RequestHandler_SceneItems.cpp - src/requesthandler/RequestHandler_Outputs.cpp - src/requesthandler/RequestHandler_Stream.cpp - src/requesthandler/RequestHandler_Record.cpp - src/requesthandler/RequestHandler_MediaInputs.cpp - src/requesthandler/RequestHandler_Ui.cpp - src/requesthandler/RequestHandler.h - src/requesthandler/RequestBatchHandler.cpp - src/requesthandler/RequestBatchHandler.h - src/requesthandler/rpc/Request.cpp - src/requesthandler/rpc/Request.h - src/requesthandler/rpc/RequestBatchRequest.cpp - src/requesthandler/rpc/RequestBatchRequest.h - src/requesthandler/rpc/RequestResult.cpp - src/requesthandler/rpc/RequestResult.h - src/requesthandler/types/RequestStatus.h - src/requesthandler/types/RequestBatchExecutionType.h - src/utils/Crypto.cpp - src/utils/Crypto.h - src/utils/Json.cpp - src/utils/Json.h - src/utils/Obs.cpp - src/utils/Obs_StringHelper.cpp - src/utils/Obs_NumberHelper.cpp - src/utils/Obs_ArrayHelper.cpp - src/utils/Obs_ObjectHelper.cpp - src/utils/Obs_SearchHelper.cpp - src/utils/Obs_ActionHelper.cpp - src/utils/Obs.h - src/utils/Obs_VolumeMeter.cpp - src/utils/Obs_VolumeMeter.h - src/utils/Obs_VolumeMeter_Helpers.h - src/utils/Platform.cpp - src/utils/Platform.h - src/utils/Compat.cpp - src/utils/Compat.h - src/utils/Utils.h) - -target_link_libraries( - obs-websocket - PRIVATE OBS::libobs - OBS::frontend-api - OBS::websocket-api - Qt::Core - Qt::Widgets - Qt::Svg - Qt::Network - nlohmann_json::nlohmann_json - Websocketpp::Websocketpp - Asio::Asio - qrcodegencpp::qrcodegencpp) - -target_compile_features(obs-websocket PRIVATE cxx_std_17) - -set_target_properties(obs-websocket PROPERTIES FOLDER "plugins/obs-websocket") - -if(PLUGIN_TESTS) - target_compile_definitions(obs-websocket PRIVATE PLUGIN_TESTS) -endif() - -# Random other things -if(WIN32) - add_definitions(-D_WEBSOCKETPP_CPP11_STL_) -endif() - -if(MSVC) - target_compile_options(obs-websocket PRIVATE /wd4267 /wd4996) - target_link_options(obs-websocket PRIVATE "LINKER:/IGNORE:4099") -else() - target_compile_options( - obs-websocket - PRIVATE - -Wall - "$<$:-Wno-error=format-overflow>" - "$<$:-Wno-error=null-pointer-subtraction;-Wno-error=deprecated-declarations>" - ) -endif() - -# Final CMake helpers -setup_plugin_target(obs-websocket) -setup_target_resources(obs-websocket "obs-plugins/obs-websocket") diff --git a/data/locale/de-DE.ini b/data/locale/de-DE.ini index 44674561..c325cb94 100644 --- a/data/locale/de-DE.ini +++ b/data/locale/de-DE.ini @@ -31,7 +31,7 @@ OBSWebSocket.ConnectInfo.CopyText="Kopieren" OBSWebSocket.ConnectInfo.ServerIp="Server-IP (Geschätzt)" OBSWebSocket.ConnectInfo.ServerPort="Serverport" OBSWebSocket.ConnectInfo.ServerPassword="Serverpasswort" -OBSWebSocket.ConnectInfo.ServerPasswordPlaceholderText="Authentifizierung deaktiviert" +OBSWebSocket.ConnectInfo.ServerPasswordPlaceholderText="[Authentifizierung deaktiviert]" OBSWebSocket.ConnectInfo.QrTitle="QR-Code zum Verbinden" OBSWebSocket.TrayNotification.Identified.Title="Neue WebSocket-Verbindung" OBSWebSocket.TrayNotification.Identified.Body="Client %1 identifiziert." diff --git a/data/locale/gl-ES.ini b/data/locale/gl-ES.ini index 8da4fac4..8e06aecb 100644 --- a/data/locale/gl-ES.ini +++ b/data/locale/gl-ES.ini @@ -1,6 +1,41 @@ +OBSWebSocket.Plugin.Description="Control remoto de OBS Studio a través de WebSocket" +OBSWebSocket.Settings.DialogTitle="Configuración do servidor WebSocket" +OBSWebSocket.Settings.PluginSettingsTitle="Configuración do complemento" +OBSWebSocket.Settings.ServerEnable="Activar servidor WebSocket" +OBSWebSocket.Settings.AlertsEnable="Activar alertas na bandexa do sistema" +OBSWebSocket.Settings.DebugEnable="Activar rexistro de depuración" +OBSWebSocket.Settings.DebugEnableHoverText="Activa o rexistro de depuración para a instancia actual de OBS. Non se mantén ao cargar. Usa --websocket_debug para activar ao cargar." OBSWebSocket.Settings.ServerSettingsTitle="Configuración do servidor" +OBSWebSocket.Settings.AuthRequired="Activar autenticación" +OBSWebSocket.Settings.Password="Contrasinal do servidor" +OBSWebSocket.Settings.GeneratePassword="Xerar contrasinal" +OBSWebSocket.Settings.ServerPort="Porto do Servidor" +OBSWebSocket.Settings.ShowConnectInfo="Mostrar información de conexión" +OBSWebSocket.Settings.ShowConnectInfoWarningTitle="Advertencia: Actualmente en directo" +OBSWebSocket.Settings.ShowConnectInfoWarningMessage="Parece que un saída (transmisión, gravación, etc.) está actualmente activa." +OBSWebSocket.Settings.ShowConnectInfoWarningInfoText="Estás seguro de que queres mostrar a túa información de conexión?" +OBSWebSocket.Settings.Save.UserPasswordWarningTitle="Advertencia: Posible problema de seguridade" +OBSWebSocket.Settings.Save.UserPasswordWarningMessage="obs-websocket almacena o contrasinal do servidor en texto plano. Recoméndase encarecidamente utilizar un contrasinal xenerado por obs-websocket." +OBSWebSocket.Settings.Save.UserPasswordWarningInfoText="Estás seguro de que desexas usar o teu propio contrasinal?" +OBSWebSocket.Settings.Save.PasswordInvalidErrorTitle="Erro: configuración non válida" +OBSWebSocket.Settings.Save.PasswordInvalidErrorMessage="Debes usar un contrasinal de 6 ou máis caracteres." +OBSWebSocket.SessionTable.Title="Sesións WebSocket conectadas" +OBSWebSocket.SessionTable.RemoteAddressColumnTitle="Enderezo remoto" +OBSWebSocket.SessionTable.SessionDurationColumnTitle="Duración da sesión" +OBSWebSocket.SessionTable.MessagesInOutColumnTitle="Mensaxes de entrada/saída" +OBSWebSocket.SessionTable.IdentifiedTitle="Identificado" +OBSWebSocket.SessionTable.KickButtonColumnTitle="Expulsar?" +OBSWebSocket.SessionTable.KickButtonText="Expulsar" +OBSWebSocket.ConnectInfo.DialogTitle="Información de conexión de WebSocket" OBSWebSocket.ConnectInfo.CopyText="Copiar" +OBSWebSocket.ConnectInfo.ServerIp="IP do servidor (a mellor proposta)" OBSWebSocket.ConnectInfo.ServerPort="Porto do Servidor" OBSWebSocket.ConnectInfo.ServerPassword="Contrasinal do Servidor" +OBSWebSocket.ConnectInfo.ServerPasswordPlaceholderText="[Autenticación Desactivada]" +OBSWebSocket.ConnectInfo.QrTitle="Conectar con QR" +OBSWebSocket.TrayNotification.Identified.Title="Nova conexión WebSocket" OBSWebSocket.TrayNotification.Identified.Body="Cliente %1 identificado." +OBSWebSocket.TrayNotification.AuthenticationFailed.Title="Fallo na autenticación do WebSocket" +OBSWebSocket.TrayNotification.AuthenticationFailed.Body="O cliente %1 fallou na autenticación." +OBSWebSocket.TrayNotification.Disconnected.Title="Cliente WebSocket desconectado." OBSWebSocket.TrayNotification.Disconnected.Body="Cliente %1 desconectado." diff --git a/data/locale/ja-JP.ini b/data/locale/ja-JP.ini index c646b029..1c18cb20 100644 --- a/data/locale/ja-JP.ini +++ b/data/locale/ja-JP.ini @@ -22,7 +22,7 @@ OBSWebSocket.Settings.Save.PasswordInvalidErrorMessage="6文字以上のパス OBSWebSocket.SessionTable.Title="接続されているWebSocketセッション" OBSWebSocket.SessionTable.RemoteAddressColumnTitle="リモートアドレス" OBSWebSocket.SessionTable.SessionDurationColumnTitle="セッション時間" -OBSWebSocket.SessionTable.MessagesInOutColumnTitle="メッセージ In/Out" +OBSWebSocket.SessionTable.MessagesInOutColumnTitle="メッセージ 受信/送信" OBSWebSocket.SessionTable.IdentifiedTitle="識別" OBSWebSocket.SessionTable.KickButtonColumnTitle="キック?" OBSWebSocket.SessionTable.KickButtonText="キック" diff --git a/data/locale/ru-RU.ini b/data/locale/ru-RU.ini index 0c01a73e..c7087a77 100644 --- a/data/locale/ru-RU.ini +++ b/data/locale/ru-RU.ini @@ -15,7 +15,7 @@ OBSWebSocket.Settings.ShowConnectInfoWarningTitle="Предупреждение: OBSWebSocket.Settings.ShowConnectInfoWarningMessage="Похоже, что вывод (поток, запись и т. д.) в настоящее время уже выбран." OBSWebSocket.Settings.ShowConnectInfoWarningInfoText="Уверены, что хотите показать ваши сведения о подключении?" OBSWebSocket.Settings.Save.UserPasswordWarningTitle="Предупреждение: Потенциальная проблема безопасности" -OBSWebSocket.Settings.Save.UserPasswordWarningMessage="obs-websocket хранит пароль сервера в виде обычного текста. Настоятельно рекомендуется использовать пароль, сгенерированный obs-websock." +OBSWebSocket.Settings.Save.UserPasswordWarningMessage="obs-websocket хранит пароль сервера в виде обычного текста. Настоятельно рекомендуется использовать пароль, созданный obs-websocket." OBSWebSocket.Settings.Save.UserPasswordWarningInfoText="Уверены, что хотите использовать собственый пароль?" OBSWebSocket.Settings.Save.PasswordInvalidErrorTitle="Ошибка: Неверная конфигурация" OBSWebSocket.Settings.Save.PasswordInvalidErrorMessage="Вы должны использовать пароль длиной 6 или более символов." diff --git a/data/locale/tt-RU.ini b/data/locale/tt-RU.ini index e7ad03c2..1ef4e5de 100644 --- a/data/locale/tt-RU.ini +++ b/data/locale/tt-RU.ini @@ -7,3 +7,4 @@ OBSWebSocket.SessionTable.KickButtonText="Чыгару" OBSWebSocket.ConnectInfo.CopyText="Күчермә алу" OBSWebSocket.ConnectInfo.ServerPort="Сервер порты" OBSWebSocket.ConnectInfo.ServerPassword="Сервер серсүзе" +OBSWebSocket.TrayNotification.Disconnected.Title="WebSocket клиенты өзелде" diff --git a/data/locale/ug-CN.ini b/data/locale/ug-CN.ini index ef3134a3..cc3dcb20 100644 --- a/data/locale/ug-CN.ini +++ b/data/locale/ug-CN.ini @@ -1,2 +1,41 @@ +OBSWebSocket.Plugin.Description="WebSocket ئارقىلىق OBS Studio نى يىراقتىن تىزگىنلەش" +OBSWebSocket.Settings.DialogTitle="WebSocket مۇلازىمېتىر تەڭشىكى" +OBSWebSocket.Settings.PluginSettingsTitle="قىستۇرما تەڭشىكى" +OBSWebSocket.Settings.ServerEnable="WebSocket مۇلازىمېتىرنى قوزغىتىدۇ" +OBSWebSocket.Settings.AlertsEnable="سىستېما قورال تاختا ئاگاھلاندۇرۇشىنى قوزغىتىدۇ" +OBSWebSocket.Settings.DebugEnable="سازلاش خاتىرىسىنى قوزغىتىدۇ" +OBSWebSocket.Settings.DebugEnableHoverText="نۆۋەتتىكى OBS ئەمەلىي مىسالىنىڭ سازلاش خاتىرىسىنى قوزغىتىدۇ. كېيىنكى قېتىم يۈكلىگەندە قايتا تەڭشەش كېرەك.\n --websocket_debug ئىشلىتىلسە OBS نى يۈكلىگەندە كۈندىلىك خاتىرىنى قوزغىتىدۇ." +OBSWebSocket.Settings.ServerSettingsTitle="مۇلازىمېتىر تەڭشىكى" +OBSWebSocket.Settings.AuthRequired="كىملىك دەلىللەشنى قوزغىتىدۇ" +OBSWebSocket.Settings.Password="مۇلازىمېتىر ئىم" OBSWebSocket.Settings.GeneratePassword="ئىم ھاسىللا" +OBSWebSocket.Settings.ServerPort="مۇلازىمېتىر ئېغىزى" +OBSWebSocket.Settings.ShowConnectInfo="باغلىنىش ئۇچۇرىنى كۆرسەت" +OBSWebSocket.Settings.ShowConnectInfoWarningTitle="ئاگاھلاندۇرۇش: شۇئان سىن تارقىتىۋاتىدۇ" +OBSWebSocket.Settings.ShowConnectInfoWarningMessage="قارىغاندا ئاكتىپ چىقىرىۋاتقان (ئېقىم، سىن خاتىرىلەش قاتارلىق) باردەك قىلىدۇ." +OBSWebSocket.Settings.ShowConnectInfoWarningInfoText="راستتىنلا باغلىنىش ئۇچۇرىڭىزنى كۆرسىتەمسىز؟" +OBSWebSocket.Settings.Save.UserPasswordWarningTitle="ئاگاھلاندۇرۇش: يوشۇرۇن بىخەتەرلىك مەسىلىسى" +OBSWebSocket.Settings.Save.UserPasswordWarningMessage="obs-websocket مۇلازىمېتىر ئىمنى ساپ تېكىست ھالىتىدا ساقلايدۇ. obs-websocket نى ئىشلىتىش كۈچلۈك تەۋسىيە قىلىنىدۇ." +OBSWebSocket.Settings.Save.UserPasswordWarningInfoText="راستتىنلا ئۆزىڭىز بەلگىلىگەن ئىمنى ئىشلىتەمسىز؟" +OBSWebSocket.Settings.Save.PasswordInvalidErrorTitle="خاتالىق: ئىناۋەتسىز سەپلىمە" +OBSWebSocket.Settings.Save.PasswordInvalidErrorMessage="ئىم ئۈچۈن كەم دېگەندە 6 ياكى ئۇنىڭدىن كۆپ ھەرپ ئىشلىتىش كېرەك." +OBSWebSocket.SessionTable.Title="باغلانغان WebSocket سۆزلىشىشى" +OBSWebSocket.SessionTable.RemoteAddressColumnTitle="يىراقتىكى ئادرېس" +OBSWebSocket.SessionTable.SessionDurationColumnTitle="سۆزلىشىش داۋاملىشىش ۋاقتى" +OBSWebSocket.SessionTable.MessagesInOutColumnTitle="ئۇچۇر كىرىش/چىقىش" +OBSWebSocket.SessionTable.IdentifiedTitle="تونۇدى" +OBSWebSocket.SessionTable.KickButtonColumnTitle="تېپىلەمدۇ؟" +OBSWebSocket.SessionTable.KickButtonText="تەپ" +OBSWebSocket.ConnectInfo.DialogTitle="WebSocket باغلىنىش ئۇچۇرى" OBSWebSocket.ConnectInfo.CopyText="كۆچۈر" +OBSWebSocket.ConnectInfo.ServerIp="مۇلازىمېتىر IP (ئېھتىماللىقى يۇقىرى)" +OBSWebSocket.ConnectInfo.ServerPort="مۇلازىمېتىر ئېغىزى" +OBSWebSocket.ConnectInfo.ServerPassword="مۇلازىمېتىر ئىم" +OBSWebSocket.ConnectInfo.ServerPasswordPlaceholderText="[دەلىللەش چەكلەنگەن]" +OBSWebSocket.ConnectInfo.QrTitle="باغلىنىش QR كودى" +OBSWebSocket.TrayNotification.Identified.Title="يېڭى WebSocket باغلىنىش" +OBSWebSocket.TrayNotification.Identified.Body="خېرىدار %1 دەلىللەندى." +OBSWebSocket.TrayNotification.AuthenticationFailed.Title="WebSocket نى دەلىللىيەلمىدى" +OBSWebSocket.TrayNotification.AuthenticationFailed.Body="خېرىدار %1 دەلىللىيەلمىدى." +OBSWebSocket.TrayNotification.Disconnected.Title="WebSocket باغلىنىش ئۈزۈلدى" +OBSWebSocket.TrayNotification.Disconnected.Body="خېرىدار %1 ئۈزۈلدى." diff --git a/src/eventhandler/EventHandler_Scenes.cpp b/src/eventhandler/EventHandler_Scenes.cpp index 9dc22110..b8dcdf6e 100644 --- a/src/eventhandler/EventHandler_Scenes.cpp +++ b/src/eventhandler/EventHandler_Scenes.cpp @@ -109,6 +109,9 @@ void EventHandler::HandleCurrentProgramSceneChanged() { OBSSourceAutoRelease currentScene = obs_frontend_get_current_scene(); + if (!currentScene) + return; + json eventData; eventData["sceneName"] = obs_source_get_name(currentScene); eventData["sceneUuid"] = obs_source_get_uuid(currentScene); diff --git a/src/forms/SettingsDialog.cpp b/src/forms/SettingsDialog.cpp index c59d5fb9..eaf2027e 100644 --- a/src/forms/SettingsDialog.cpp +++ b/src/forms/SettingsDialog.cpp @@ -56,8 +56,13 @@ SettingsDialog::SettingsDialog(QWidget *parent) connect(sessionTableTimer, &QTimer::timeout, this, &SettingsDialog::FillSessionTable); connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &SettingsDialog::DialogButtonClicked); +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + connect(ui->enableAuthenticationCheckBox, &QCheckBox::checkStateChanged, this, + &SettingsDialog::EnableAuthenticationCheckBoxChanged); +#else connect(ui->enableAuthenticationCheckBox, &QCheckBox::stateChanged, this, &SettingsDialog::EnableAuthenticationCheckBoxChanged); +#endif connect(ui->generatePasswordButton, &QPushButton::clicked, this, &SettingsDialog::GeneratePasswordButtonClicked); connect(ui->showConnectInfoButton, &QPushButton::clicked, this, &SettingsDialog::ShowConnectInfoButtonClicked); connect(ui->serverPasswordLineEdit, &QLineEdit::textEdited, this, &SettingsDialog::PasswordEdited); diff --git a/src/requesthandler/RequestHandler_Config.cpp b/src/requesthandler/RequestHandler_Config.cpp index bc5aa7f9..e6f21b9c 100644 --- a/src/requesthandler/RequestHandler_Config.cpp +++ b/src/requesthandler/RequestHandler_Config.cpp @@ -289,9 +289,7 @@ RequestResult RequestHandler::CreateProfile(const Request &request) if (std::find(profiles.begin(), profiles.end(), profileName) != profiles.end()) return RequestResult::Error(RequestStatus::ResourceAlreadyExists); - QMainWindow *mainWindow = static_cast(obs_frontend_get_main_window()); - QMetaObject::invokeMethod(mainWindow, "NewProfile", Qt::BlockingQueuedConnection, - Q_ARG(QString, QString::fromStdString(profileName))); + obs_frontend_create_profile(profileName.c_str()); return RequestResult::Success(); } @@ -324,9 +322,7 @@ RequestResult RequestHandler::RemoveProfile(const Request &request) if (profiles.size() < 2) return RequestResult::Error(RequestStatus::NotEnoughResources); - QMainWindow *mainWindow = static_cast(obs_frontend_get_main_window()); - QMetaObject::invokeMethod(mainWindow, "DeleteProfile", Qt::BlockingQueuedConnection, - Q_ARG(QString, QString::fromStdString(profileName))); + obs_frontend_delete_profile(profileName.c_str()); return RequestResult::Success(); } diff --git a/src/utils/Json.cpp b/src/utils/Json.cpp index 68f05881..923020a4 100644 --- a/src/utils/Json.cpp +++ b/src/utils/Json.cpp @@ -178,7 +178,7 @@ json Utils::Json::ObsDataToJson(obs_data_t *d, bool includeDefault) bool Utils::Json::GetJsonFileContent(std::string fileName, json &content) { - std::ifstream f(fileName); + std::ifstream f(std::filesystem::u8path(fileName)); if (!f.is_open()) return false; @@ -195,9 +195,11 @@ bool Utils::Json::GetJsonFileContent(std::string fileName, json &content) bool Utils::Json::SetJsonFileContent(std::string fileName, const json &content, bool makeDirs) { + auto jsonFilePath = std::filesystem::u8path(fileName); + if (makeDirs) { + auto p = jsonFilePath.parent_path(); std::error_code ec; - auto p = std::filesystem::path(fileName).parent_path(); if (!ec && !std::filesystem::exists(p, ec)) std::filesystem::create_directories(p, ec); if (ec) { @@ -207,7 +209,7 @@ bool Utils::Json::SetJsonFileContent(std::string fileName, const json &content, } } - std::ofstream f(fileName); + std::ofstream f(jsonFilePath); if (!f.is_open()) { blog(LOG_ERROR, "[Utils::Json::SetJsonFileContent] Failed to open file `%s` for writing", fileName.c_str()); return false;