Browse Source

remove qdockwidget and replace it with overlay enabled/disabled

pull/2953/head
Maufeat 3 months ago
parent
commit
7029b8a535
  1. 2
      src/common/settings.h
  2. 37
      src/core/hle/service/am/applet_manager.cpp
  3. 1
      src/qt_common/config/uisettings.h
  4. 31
      src/yuzu/main.cpp
  5. 2
      src/yuzu/main.h
  6. 6
      src/yuzu/main.ui

2
src/common/settings.h

@ -759,6 +759,8 @@ struct Values {
// Add-Ons // Add-Ons
std::map<u64, std::vector<std::string>> disabled_addons; std::map<u64, std::vector<std::string>> disabled_addons;
Setting<bool> enable_overlay{linkage, false, "enable_overlay", Category::Core};
}; };
extern Values values; extern Values values;

37
src/core/hle/service/am/applet_manager.cpp

@ -266,24 +266,25 @@ void AppletManager::SetWindowSystem(WindowSystem* window_system) {
m_cv.wait(lk, [&] { return m_pending_process != nullptr; }); m_cv.wait(lk, [&] { return m_pending_process != nullptr; });
// Launch overlay applet before tracking the application, if available.
if (auto overlay_process = CreateProcess(m_system, static_cast<u64>(AppletProgramId::OverlayDisplay), 0, 0)) {
auto overlay_applet = std::make_shared<Applet>(m_system, std::move(overlay_process), false);
overlay_applet->program_id = static_cast<u64>(AppletProgramId::OverlayDisplay);
overlay_applet->applet_id = AppletId::OverlayDisplay;
overlay_applet->type = AppletType::OverlayApplet;
// Use PartialForeground so blending is enabled and overlay can be composed on top
overlay_applet->library_applet_mode = LibraryAppletMode::PartialForeground;
// Start with overlay visible but with low z-index (showing vignette behind app)
// Home button will toggle it to foreground (high z-index) to show full overlay
overlay_applet->window_visible = true;
// Enable home button watching so overlay can be toggled with home button
overlay_applet->home_button_short_pressed_blocked = false;
overlay_applet->home_button_long_pressed_blocked = false;
// Track as a non-application so WindowSystem routes it to m_overlay_display
m_window_system->TrackApplet(overlay_applet, false);
overlay_applet->process->Run();
LOG_INFO(Service_AM, "called, Overlay applet launched before application (initially hidden, watching home button)");
if (Settings::values.enable_overlay) {
if (auto overlay_process = CreateProcess(m_system, static_cast<u64>(AppletProgramId::OverlayDisplay), 0, 0)) {
auto overlay_applet = std::make_shared<Applet>(m_system, std::move(overlay_process), false);
overlay_applet->program_id = static_cast<u64>(AppletProgramId::OverlayDisplay);
overlay_applet->applet_id = AppletId::OverlayDisplay;
overlay_applet->type = AppletType::OverlayApplet;
// Use PartialForeground so blending is enabled and overlay can be composed on top
overlay_applet->library_applet_mode = LibraryAppletMode::PartialForeground;
// Start with overlay visible but with low z-index (showing vignette behind app)
// Home button will toggle it to foreground (high z-index) to show full overlay
overlay_applet->window_visible = true;
// Enable home button watching so overlay can be toggled with home button
overlay_applet->home_button_short_pressed_blocked = false;
overlay_applet->home_button_long_pressed_blocked = false;
// Track as a non-application so WindowSystem routes it to m_overlay_display
m_window_system->TrackApplet(overlay_applet, false);
overlay_applet->process->Run();
LOG_INFO(Service_AM, "called, Overlay applet launched before application (initially hidden, watching home button)");
}
} }
const auto& params = m_pending_parameters; const auto& params = m_pending_parameters;

1
src/qt_common/config/uisettings.h

@ -97,7 +97,6 @@ struct Values {
Setting<bool> single_window_mode{linkage, true, "singleWindowMode", Category::Ui}; Setting<bool> single_window_mode{linkage, true, "singleWindowMode", Category::Ui};
Setting<bool> fullscreen{linkage, false, "fullscreen", Category::Ui}; Setting<bool> fullscreen{linkage, false, "fullscreen", Category::Ui};
Setting<bool> display_titlebar{linkage, true, "displayTitleBars", Category::Ui};
Setting<bool> show_filter_bar{linkage, true, "showFilterBar", Category::Ui}; Setting<bool> show_filter_bar{linkage, true, "showFilterBar", Category::Ui};
Setting<bool> show_status_bar{linkage, true, "showStatusBar", Category::Ui}; Setting<bool> show_status_bar{linkage, true, "showStatusBar", Category::Ui};

31
src/yuzu/main.cpp

@ -1531,9 +1531,9 @@ void GMainWindow::RestoreUIState() {
ui->action_Fullscreen->setChecked(UISettings::values.fullscreen.GetValue()); ui->action_Fullscreen->setChecked(UISettings::values.fullscreen.GetValue());
ui->action_Display_Dock_Widget_Headers->setChecked(
UISettings::values.display_titlebar.GetValue());
OnDisplayTitleBars(ui->action_Display_Dock_Widget_Headers->isChecked());
ui->action_Enable_Overlay_Applet->setChecked(
Settings::values.enable_overlay.GetValue());
OnEnableOverlayApplet(ui->action_Enable_Overlay_Applet->isChecked());
ui->action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar.GetValue()); ui->action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar.GetValue());
game_list->SetFilterVisible(ui->action_Show_Filter_Bar->isChecked()); game_list->SetFilterVisible(ui->action_Show_Filter_Bar->isChecked());
@ -1657,7 +1657,7 @@ void GMainWindow::ConnectMenuEvents() {
// View // View
connect_menu(ui->action_Fullscreen, &GMainWindow::ToggleFullscreen); connect_menu(ui->action_Fullscreen, &GMainWindow::ToggleFullscreen);
connect_menu(ui->action_Single_Window_Mode, &GMainWindow::ToggleWindowMode); connect_menu(ui->action_Single_Window_Mode, &GMainWindow::ToggleWindowMode);
connect_menu(ui->action_Display_Dock_Widget_Headers, &GMainWindow::OnDisplayTitleBars);
connect_menu(ui->action_Enable_Overlay_Applet, &GMainWindow::OnEnableOverlayApplet);
connect_menu(ui->action_Show_Filter_Bar, &GMainWindow::OnToggleFilterBar); connect_menu(ui->action_Show_Filter_Bar, &GMainWindow::OnToggleFilterBar);
connect_menu(ui->action_Show_Status_Bar, &GMainWindow::OnToggleStatusBar); connect_menu(ui->action_Show_Status_Bar, &GMainWindow::OnToggleStatusBar);
@ -1752,6 +1752,8 @@ void GMainWindow::UpdateMenuState() {
ui->action_Firmware_From_ZIP->setEnabled(!emulation_running); ui->action_Firmware_From_ZIP->setEnabled(!emulation_running);
ui->action_Install_Keys->setEnabled(!emulation_running); ui->action_Install_Keys->setEnabled(!emulation_running);
ui->action_Enable_Overlay_Applet->setEnabled(!emulation_running);
for (QAction* action : applet_actions) { for (QAction* action : applet_actions) {
action->setEnabled(is_firmware_available && !emulation_running); action->setEnabled(is_firmware_available && !emulation_running);
} }
@ -1767,24 +1769,8 @@ void GMainWindow::UpdateMenuState() {
multiplayer_state->UpdateNotificationStatus(); multiplayer_state->UpdateNotificationStatus();
} }
void GMainWindow::OnDisplayTitleBars(bool show) {
QList<QDockWidget*> widgets = findChildren<QDockWidget*>();
if (show) {
for (QDockWidget* widget : widgets) {
QWidget* old = widget->titleBarWidget();
widget->setTitleBarWidget(nullptr);
if (old != nullptr)
delete old;
}
} else {
for (QDockWidget* widget : widgets) {
QWidget* old = widget->titleBarWidget();
widget->setTitleBarWidget(new QWidget());
if (old != nullptr)
delete old;
}
}
void GMainWindow::OnEnableOverlayApplet(bool enable) {
Settings::values.enable_overlay.SetValue(enable);
} }
void GMainWindow::SetupPrepareForSleep() { void GMainWindow::SetupPrepareForSleep() {
@ -4505,7 +4491,6 @@ void GMainWindow::UpdateUISettings() {
UISettings::values.state = saveState(); UISettings::values.state = saveState();
UISettings::values.single_window_mode = ui->action_Single_Window_Mode->isChecked(); UISettings::values.single_window_mode = ui->action_Single_Window_Mode->isChecked();
UISettings::values.fullscreen = ui->action_Fullscreen->isChecked(); UISettings::values.fullscreen = ui->action_Fullscreen->isChecked();
UISettings::values.display_titlebar = ui->action_Display_Dock_Widget_Headers->isChecked();
UISettings::values.show_filter_bar = ui->action_Show_Filter_Bar->isChecked(); UISettings::values.show_filter_bar = ui->action_Show_Filter_Bar->isChecked();
UISettings::values.show_status_bar = ui->action_Show_Status_Bar->isChecked(); UISettings::values.show_status_bar = ui->action_Show_Status_Bar->isChecked();
UISettings::values.first_start = false; UISettings::values.first_start = false;

2
src/yuzu/main.h

@ -390,7 +390,7 @@ private slots:
void OnToggleFilterBar(); void OnToggleFilterBar();
void OnToggleStatusBar(); void OnToggleStatusBar();
void OnGameListRefresh(); void OnGameListRefresh();
void OnDisplayTitleBars(bool);
void OnEnableOverlayApplet(bool);
void InitializeHotkeys(); void InitializeHotkeys();
void ToggleFullscreen(); void ToggleFullscreen();
bool UsingExclusiveFullscreen(); bool UsingExclusiveFullscreen();

6
src/yuzu/main.ui

@ -131,7 +131,7 @@
</action> </action>
<addaction name="action_Fullscreen"/> <addaction name="action_Fullscreen"/>
<addaction name="action_Single_Window_Mode"/> <addaction name="action_Single_Window_Mode"/>
<addaction name="action_Display_Dock_Widget_Headers"/>
<addaction name="action_Enable_Overlay_Applet"/>
<addaction name="action_Show_Filter_Bar"/> <addaction name="action_Show_Filter_Bar"/>
<addaction name="action_Show_Status_Bar"/> <addaction name="action_Show_Status_Bar"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -298,12 +298,12 @@
<enum>QAction::MenuRole::PreferencesRole</enum> <enum>QAction::MenuRole::PreferencesRole</enum>
</property> </property>
</action> </action>
<action name="action_Display_Dock_Widget_Headers">
<action name="action_Enable_Overlay_Applet">
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Display D&amp;ock Widget Headers</string>
<string>Enable Overlay Display Applet</string>
</property> </property>
</action> </action>
<action name="action_Show_Filter_Bar"> <action name="action_Show_Filter_Bar">

Loading…
Cancel
Save