From 8b0cc92d10f3c3bac14bb123822e7ce4641f6e3b Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sat, 25 Apr 2020 00:57:38 +0200 Subject: [PATCH] ui: Fix incorrect namespace for Qt symbol Q_INIT_RESOURCE and Q_CLEANUP_RESOURCE can't be called from within a namespace and instead have to be in outside of the namespace, so by moving them into small inline functions we can fulfill this restriction. Related: #192 #155 --- source/ui/ui.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/ui/ui.cpp b/source/ui/ui.cpp index 18d7f2dd..9cf0cf5e 100644 --- a/source/ui/ui.cpp +++ b/source/ui/ui.cpp @@ -47,6 +47,16 @@ constexpr std::string_view _url_website = "https://streamfx.xaymar.com"; constexpr std::string_view _url_discord = "https://discordapp.com/invite/DaeJg7M"; constexpr std::string_view _url_github = "https://github.com/Xaymar/obs-StreamFX"; +inline void qt_init_resource() +{ + Q_INIT_RESOURCE(streamfx); +} + +inline void qt_cleanup_resource() +{ + Q_CLEANUP_RESOURCE(streamfx); +} + bool streamfx::ui::handler::have_shown_about_streamfx(bool shown) { if (shown) { @@ -69,7 +79,7 @@ streamfx::ui::handler::handler() _about_action(), _about_dialog() { // Qt Resources and Translators - Q_INIT_RESOURCE(streamfx); + qt_init_resource(); QCoreApplication::installTranslator(new streamfx::ui::translator(this)); // Handle all frontend events. @@ -116,7 +126,7 @@ streamfx::ui::handler::~handler() obs_frontend_remove_event_callback(frontend_event_handler, this); // Qt Resources and Translators - Q_CLEANUP_RESOURCE(streamfx); + qt_cleanup_resource(); } void streamfx::ui::handler::frontend_event_handler(obs_frontend_event event, void* private_data)