mirror of https://github.com/PCSX2/pcsx2.git
Qt: Add option to disable global menus on Linux/macOS
This commit is contained in:
parent
8a1f2a151d
commit
0e7542cec5
|
@ -108,6 +108,11 @@ MainWindow::MainWindow()
|
|||
pxAssert(!g_main_window);
|
||||
g_main_window = this;
|
||||
|
||||
#ifndef _WIN32
|
||||
bool enable_global_menus = Host::GetBaseBoolSettingValue("UI", "GlobalMenus", true);
|
||||
QGuiApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, !enable_global_menus);
|
||||
#endif
|
||||
|
||||
// Native window rendering is broken in wayland.
|
||||
// Let's work around it by disabling it for every widget besides
|
||||
// DisplayWidget.
|
||||
|
@ -1829,6 +1834,15 @@ void MainWindow::onLanguageChanged()
|
|||
});
|
||||
}
|
||||
|
||||
void MainWindow::onGlobalMenusChanged()
|
||||
{
|
||||
recreate();
|
||||
|
||||
QtHost::RunOnUIThread([] {
|
||||
g_main_window->doSettings("Interface");
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::onInputRecNewActionTriggered()
|
||||
{
|
||||
const bool wasPaused = s_vm_paused;
|
||||
|
@ -2683,8 +2697,11 @@ SettingsWindow* MainWindow::getSettingsWindow()
|
|||
if (!m_settings_window)
|
||||
{
|
||||
m_settings_window = new SettingsWindow();
|
||||
connect(m_settings_window->getInterfaceSettingsWidget(), &InterfaceSettingsWidget::themeChanged, this, &MainWindow::onThemeChanged);
|
||||
connect(m_settings_window->getInterfaceSettingsWidget(), &InterfaceSettingsWidget::languageChanged, this, &MainWindow::onLanguageChanged);
|
||||
|
||||
InterfaceSettingsWidget* widget = m_settings_window->getInterfaceSettingsWidget();
|
||||
connect(widget, &InterfaceSettingsWidget::themeChanged, this, &MainWindow::onThemeChanged);
|
||||
connect(widget, &InterfaceSettingsWidget::languageChanged, this, &MainWindow::onLanguageChanged);
|
||||
connect(widget, &InterfaceSettingsWidget::globalMenusChanged, this, &MainWindow::onGlobalMenusChanged);
|
||||
connect(m_settings_window->getGameListSettingsWidget(), &GameListSettingsWidget::preferEnglishGameListChanged, this, [] {
|
||||
g_main_window->m_game_list_widget->refreshGridCovers();
|
||||
});
|
||||
|
|
|
@ -174,6 +174,7 @@ private Q_SLOTS:
|
|||
void updateLanguage();
|
||||
void onThemeChanged();
|
||||
void onLanguageChanged();
|
||||
void onGlobalMenusChanged();
|
||||
void onScreenshotActionTriggered();
|
||||
void onSaveGSDumpActionTriggered();
|
||||
void onBlockDumpActionToggled(bool checked);
|
||||
|
|
|
@ -108,6 +108,13 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
|
|||
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.language, "UI", "Language", QtHost::GetDefaultLanguage());
|
||||
connect(m_ui.language, QOverload<int>::of(&QComboBox::currentIndexChanged), [this]() { emit languageChanged(); });
|
||||
|
||||
#ifndef _WIN32
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.globalMenus, "UI", "GlobalMenus", true);
|
||||
connect(m_ui.globalMenus, &QCheckBox::checkStateChanged, [this]() { emit globalMenusChanged(); });
|
||||
#else
|
||||
m_ui.globalMenus->hide();
|
||||
#endif
|
||||
|
||||
// Per-game settings is special, we don't want to bind it if we're editing per-game settings.
|
||||
if (!dialog->isPerGameSettings())
|
||||
{
|
||||
|
@ -181,6 +188,9 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
|
|||
dialog->registerWidgetHelp(
|
||||
m_ui.disableWindowResizing, tr("Disable Window Resizing"), tr("Unchecked"),
|
||||
tr("Prevents the main window from being resized."));
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.globalMenus, tr("Enable Global Menus"), tr("Checked"),
|
||||
tr("Display menu bars in a system-wide location if possible rather than at the top of each window."));
|
||||
|
||||
onRenderToSeparateWindowChanged();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
Q_SIGNALS:
|
||||
void themeChanged();
|
||||
void languageChanged();
|
||||
void globalMenusChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onRenderToSeparateWindowChanged();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>698</width>
|
||||
<height>512</height>
|
||||
<height>574</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
@ -138,6 +138,12 @@
|
|||
<string>Preferences</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="language"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="theme"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="languageLabel">
|
||||
<property name="text">
|
||||
|
@ -145,9 +151,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="language"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="themeLabel">
|
||||
<property name="text">
|
||||
|
@ -155,8 +158,12 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="theme"/>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="globalMenus">
|
||||
<property name="text">
|
||||
<string>Enable Global Menus</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -215,7 +222,7 @@
|
|||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
|
Loading…
Reference in New Issue