mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 04:42:18 +02:00
UI: Fix case where cef func may not be present
Due to a particular... plugin we all know and love, the new QCefWidget::executeJavascript() function may not actually be present as it should be. So, we have to verify that it's available, and only use it in that case.
This commit is contained in:
parent
c946090203
commit
78cb2aa361
@ -116,6 +116,7 @@ struct QCefCookieManager;
|
|||||||
|
|
||||||
QCef *cef = nullptr;
|
QCef *cef = nullptr;
|
||||||
QCefCookieManager *panel_cookies = nullptr;
|
QCefCookieManager *panel_cookies = nullptr;
|
||||||
|
bool cef_js_avail = false;
|
||||||
|
|
||||||
void DestroyPanelCookieManager();
|
void DestroyPanelCookieManager();
|
||||||
|
|
||||||
@ -2022,6 +2023,7 @@ void OBSBasic::OBSInit()
|
|||||||
|
|
||||||
#ifdef BROWSER_AVAILABLE
|
#ifdef BROWSER_AVAILABLE
|
||||||
cef = obs_browser_init_panel();
|
cef = obs_browser_init_panel();
|
||||||
|
cef_js_avail = cef && obs_browser_qcef_version() >= 3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OBSDataAutoRelease obsData = obs_get_private_data();
|
OBSDataAutoRelease obsData = obs_get_private_data();
|
||||||
@ -8493,7 +8495,7 @@ YouTubeAppDock *OBSBasic::GetYouTubeAppDock()
|
|||||||
|
|
||||||
void OBSBasic::NewYouTubeAppDock()
|
void OBSBasic::NewYouTubeAppDock()
|
||||||
{
|
{
|
||||||
if (!cef)
|
if (!cef_js_avail)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (youtubeAppDock)
|
if (youtubeAppDock)
|
||||||
@ -8504,7 +8506,7 @@ void OBSBasic::NewYouTubeAppDock()
|
|||||||
|
|
||||||
void OBSBasic::DeleteYouTubeAppDock()
|
void OBSBasic::DeleteYouTubeAppDock()
|
||||||
{
|
{
|
||||||
if (!cef)
|
if (!cef_js_avail)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (youtubeAppDock)
|
if (youtubeAppDock)
|
||||||
|
@ -1267,6 +1267,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern bool cef_js_avail;
|
||||||
|
|
||||||
class SceneRenameDelegate : public QStyledItemDelegate {
|
class SceneRenameDelegate : public QStyledItemDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -771,7 +771,7 @@ void OBSBasicSettings::on_connectAccount_clicked()
|
|||||||
if (!!auth) {
|
if (!!auth) {
|
||||||
OnAuthConnected();
|
OnAuthConnected();
|
||||||
#ifdef YOUTUBE_ENABLED
|
#ifdef YOUTUBE_ENABLED
|
||||||
if (cef && IsYouTubeService(service)) {
|
if (cef_js_avail && IsYouTubeService(service)) {
|
||||||
if (!main->GetYouTubeAppDock()) {
|
if (!main->GetYouTubeAppDock()) {
|
||||||
main->NewYouTubeAppDock();
|
main->NewYouTubeAppDock();
|
||||||
}
|
}
|
||||||
@ -822,7 +822,7 @@ void OBSBasicSettings::on_disconnectAccount_clicked()
|
|||||||
ui->connectedAccountText->setVisible(false);
|
ui->connectedAccountText->setVisible(false);
|
||||||
|
|
||||||
#ifdef YOUTUBE_ENABLED
|
#ifdef YOUTUBE_ENABLED
|
||||||
if (cef && IsYouTubeService(service)) {
|
if (cef_js_avail && IsYouTubeService(service)) {
|
||||||
if (!main->GetYouTubeAppDock()) {
|
if (!main->GetYouTubeAppDock()) {
|
||||||
main->NewYouTubeAppDock();
|
main->NewYouTubeAppDock();
|
||||||
}
|
}
|
||||||
|
@ -4248,7 +4248,7 @@ void OBSBasicSettings::on_listWidget_itemSelectionChanged()
|
|||||||
void OBSBasicSettings::UpdateYouTubeAppDockSettings()
|
void OBSBasicSettings::UpdateYouTubeAppDockSettings()
|
||||||
{
|
{
|
||||||
#if defined(BROWSER_ENABLED) && defined(YOUTUBE_ENABLED)
|
#if defined(BROWSER_ENABLED) && defined(YOUTUBE_ENABLED)
|
||||||
if (cef) {
|
if (cef_js_avail) {
|
||||||
std::string service = ui->service->currentText().toStdString();
|
std::string service = ui->service->currentText().toStdString();
|
||||||
if (IsYouTubeService(service)) {
|
if (IsYouTubeService(service)) {
|
||||||
if (!main->GetYouTubeAppDock()) {
|
if (!main->GetYouTubeAppDock()) {
|
||||||
|
@ -50,7 +50,7 @@ YouTubeAppDock::~YouTubeAppDock()
|
|||||||
|
|
||||||
bool YouTubeAppDock::IsYTServiceSelected()
|
bool YouTubeAppDock::IsYTServiceSelected()
|
||||||
{
|
{
|
||||||
if (!cef)
|
if (!cef_js_avail)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
obs_service_t *service_obj = OBSBasic::Get()->GetService();
|
obs_service_t *service_obj = OBSBasic::Get()->GetService();
|
||||||
@ -429,7 +429,7 @@ YoutubeApiWrappers *YouTubeAppDock::GetYTApi()
|
|||||||
|
|
||||||
void YouTubeAppDock::CleanupYouTubeUrls()
|
void YouTubeAppDock::CleanupYouTubeUrls()
|
||||||
{
|
{
|
||||||
if (!cef)
|
if (!cef_js_avail)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static constexpr const char *YOUTUBE_VIDEO_URL =
|
static constexpr const char *YOUTUBE_VIDEO_URL =
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 291464d6988083411e7369fc53eba6d5ef07ff67
|
Subproject commit 7fe8b0b16ed092cecec825105d1ebabd0e2167c2
|
Loading…
Reference in New Issue
Block a user