plugin: Add function to open an URL

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-04-17 01:42:54 +02:00
parent 21d455b674
commit 48ba34538e
2 changed files with 12 additions and 0 deletions

View file

@ -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

View file

@ -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