From 04e52d143f3350f53b56a7e9c0db6a2baed84790 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sun, 31 May 2020 01:24:16 +0200 Subject: [PATCH] ui: Fix about dialog not being shown and move menu Moves the menu for StreamFX to the primary menu, so that it is not hidden under tools. This makes it clearer to the user if their installation of StreamFX is working correctly, in addition to reducing the steps necessary to use the menu. Also the 'About StreamFX' dialog now actually shows up for every update, as expected. --- source/ui/ui-common.hpp | 2 ++ source/ui/ui.cpp | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/source/ui/ui-common.hpp b/source/ui/ui-common.hpp index ee8373c..f87c267 100644 --- a/source/ui/ui-common.hpp +++ b/source/ui/ui-common.hpp @@ -27,7 +27,9 @@ #include #include #include +#include #include +#include #include #include #include diff --git a/source/ui/ui.cpp b/source/ui/ui.cpp index 9cf0cf5..6e2e1f3 100644 --- a/source/ui/ui.cpp +++ b/source/ui/ui.cpp @@ -111,11 +111,6 @@ streamfx::ui::handler::handler() _menu->addSeparator(); _about_action = _menu->addAction(QString::fromUtf8(D_TRANSLATE(_i18n_menu_about.data()))); connect(_about_action, &QAction::triggered, this, &streamfx::ui::handler::on_action_about); - if (!have_shown_about_streamfx()) { - // Automatically show it if it has not yet been shown. - _about_dialog->show(); - have_shown_about_streamfx(true); - } } } } @@ -143,9 +138,19 @@ void streamfx::ui::handler::frontend_event_handler(obs_frontend_event event, voi void streamfx::ui::handler::on_obs_loaded() { - // Add StreamFX menu. - _menu_action = reinterpret_cast(obs_frontend_add_tools_menu_qaction(D_TRANSLATE(_i18n_menu.data()))); + // Add an actual Menu entry. + QMainWindow* main_widget = reinterpret_cast(obs_frontend_get_main_window()); + _menu_action = new QAction(main_widget); _menu_action->setMenu(_menu); + _menu_action->setText(QString::fromUtf8(D_TRANSLATE(_i18n_menu.data()))); + main_widget->menuBar()->addAction(_menu_action); + + // Show the 'About StreamFX' dialog if that has not happened yet. + if (!have_shown_about_streamfx()) { + // Automatically show it if it has not yet been shown. + _about_dialog->show(); + have_shown_about_streamfx(true); + } } void streamfx::ui::handler::on_action_report_issue(bool)