mirror of
https://github.com/azahar-emu/azahar
synced 2025-11-06 15:09:58 +01:00
Fix and restore macOS native menu (#1111)
* Fix and restore macOS native menu * Handle menu more elegantly by making norole default Handle menu roles more universally by making norole default and manually define previously automatically assigned roles
This commit is contained in:
parent
cfe767e301
commit
bc1edd1f1a
@ -389,11 +389,6 @@ GMainWindow::GMainWindow(Core::System& system_)
|
||||
LOG_INFO(Frontend, "Host Swap: {:.2f} GiB", mem_info.total_swap_memory / f64{1_GiB});
|
||||
UpdateWindowTitle();
|
||||
|
||||
#ifdef __APPLE__
|
||||
// Workaround for https://github.com/azahar-emu/azahar/issues/933
|
||||
ui->menubar->setNativeMenuBar(false);
|
||||
#endif
|
||||
|
||||
show();
|
||||
|
||||
#ifdef ENABLE_QT_UPDATE_CHECKER
|
||||
@ -1001,7 +996,9 @@ void GMainWindow::ConnectWidgetEvents() {
|
||||
}
|
||||
|
||||
void GMainWindow::ConnectMenuEvents() {
|
||||
const auto connect_menu = [&](QAction* action, const auto& event_fn) {
|
||||
const auto connect_menu = [&](QAction* action, const auto& event_fn,
|
||||
QAction::MenuRole role = QAction::NoRole) {
|
||||
action->setMenuRole(role);
|
||||
connect(action, &QAction::triggered, this, event_fn);
|
||||
// Add actions to this window so that hiding menus in fullscreen won't disable them
|
||||
addAction(action);
|
||||
@ -1018,7 +1015,7 @@ void GMainWindow::ConnectMenuEvents() {
|
||||
connect_menu(ui->menu_Boot_Home_Menu->actions().at(region),
|
||||
[this, region] { OnMenuBootHomeMenu(region); });
|
||||
}
|
||||
connect_menu(ui->action_Exit, &QMainWindow::close);
|
||||
connect_menu(ui->action_Exit, &QMainWindow::close, QAction::QuitRole);
|
||||
connect_menu(ui->action_Load_Amiibo, &GMainWindow::OnLoadAmiibo);
|
||||
connect_menu(ui->action_Remove_Amiibo, &GMainWindow::OnRemoveAmiibo);
|
||||
|
||||
@ -1030,7 +1027,7 @@ void GMainWindow::ConnectMenuEvents() {
|
||||
QDesktopServices::openUrl(QUrl(QStringLiteral(
|
||||
"https://github.com/azahar-emu/compatibility-list/blob/master/CONTRIBUTING.md")));
|
||||
});
|
||||
connect_menu(ui->action_Configure, &GMainWindow::OnConfigure);
|
||||
connect_menu(ui->action_Configure, &GMainWindow::OnConfigure, QAction::PreferencesRole);
|
||||
connect_menu(ui->action_Configure_Current_Game, &GMainWindow::OnConfigurePerGame);
|
||||
|
||||
// View
|
||||
@ -1094,7 +1091,7 @@ void GMainWindow::ConnectMenuEvents() {
|
||||
connect_menu(ui->action_FAQ, []() {
|
||||
QDesktopServices::openUrl(QUrl(QStringLiteral("https://azahar-emu.org/pages/faq/")));
|
||||
});
|
||||
connect_menu(ui->action_About, &GMainWindow::OnMenuAboutCitra);
|
||||
connect_menu(ui->action_About, &GMainWindow::OnMenuAboutCitra, QAction::AboutRole);
|
||||
}
|
||||
|
||||
void GMainWindow::UpdateMenuState() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user