From 48ba34538e0b002ab5563900faf871ef9444f645 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sat, 17 Apr 2021 01:42:54 +0200 Subject: [PATCH] plugin: Add function to open an URL --- source/plugin.cpp | 8 ++++++++ source/plugin.hpp | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/source/plugin.cpp b/source/plugin.cpp index 5e92deee..e2e460fc 100644 --- a/source/plugin.cpp +++ b/source/plugin.cpp @@ -294,3 +294,11 @@ std::filesystem::path streamfx::config_file_path(std::string_view file) throw std::runtime_error("obs_module_get_config_path returned nullptr"); } } + +#ifdef ENABLE_FRONTEND +bool streamfx::open_url(std::string_view url) +{ + QUrl qurl = QString::fromUtf8(url.data()); + return QDesktopServices::openUrl(qurl); +} +#endif diff --git a/source/plugin.hpp b/source/plugin.hpp index 48797d17..41a6f3cc 100644 --- a/source/plugin.hpp +++ b/source/plugin.hpp @@ -28,4 +28,8 @@ namespace streamfx { std::filesystem::path data_file_path(std::string_view file); std::filesystem::path config_file_path(std::string_view file); + +#ifdef ENABLE_FRONTEND + bool open_url(std::string_view url); +#endif } // namespace streamfx