summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainwindow.cpp10
-rw-r--r--src/settings.cpp10
-rw-r--r--src/settings.h5
-rw-r--r--src/settingsdialog.ui53
-rw-r--r--src/settingsdialoggeneral.cpp2
5 files changed, 57 insertions, 23 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 4d1c16ac..a7d7bddb 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -3645,10 +3645,14 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event)
{
// if the ui is locked, ignore the ALT key event
// alt-tabbing out of a game triggers this
- if (!UILocker::instance().locked()) {
- // if the menubar is hidden, pressing Alt will make it visible
+ auto& uilocker = UILocker::instance();
+ auto& settings = Settings::instance();
+ if (!uilocker.locked()) {
+ // if the menubar is hidden and showMenuBarOnAlt is true,
+ // pressing Alt will make it visible
if (event->key() == Qt::Key_Alt) {
- if (!ui->menuBar->isVisible()) {
+ bool showMenubarOnAlt = settings.interface().showMenubarOnAlt();
+ if (showMenubarOnAlt && !ui->menuBar->isVisible()) {
ui->menuBar->show();
}
}
diff --git a/src/settings.cpp b/src/settings.cpp
index 1e915603..d3cdc910 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -2301,6 +2301,16 @@ void InterfaceSettings::setShowChangeGameConfirmation(bool b)
set(m_Settings, "Settings", "show_change_game_confirmation", b);
}
+bool InterfaceSettings::showMenubarOnAlt() const
+{
+ return get<bool>(m_Settings, "Settings", "show_menubar_on_alt", true);
+}
+
+void InterfaceSettings::setShowMenubarOnAlt(bool b)
+{
+ set(m_Settings, "Settings", "show_menubar_on_alt", b);
+}
+
bool InterfaceSettings::doubleClicksOpenPreviews() const
{
return get<bool>(m_Settings, "Settings", "double_click_previews", true);
diff --git a/src/settings.h b/src/settings.h
index 6ddee308..d886e806 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -688,6 +688,11 @@ public:
bool showChangeGameConfirmation() const;
void setShowChangeGameConfirmation(bool b);
+ // whether to show the menubar when pressing the Alt key
+ //
+ bool showMenubarOnAlt() const;
+ void setShowMenubarOnAlt(bool b);
+
// whether double-clicks on files should try to open previews first
//
bool doubleClicksOpenPreviews() const;
diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui
index 434136ce..22bdfccd 100644
--- a/src/settingsdialog.ui
+++ b/src/settingsdialog.ui
@@ -23,8 +23,8 @@
<attribute name="title">
<string>General</string>
</attribute>
- <layout class="QGridLayout" name="gridLayout" rowstretch="0">
- <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0">
+ <item row="1" column="0">
<widget class="QScrollArea" name="generalScrollArea">
<property name="styleSheet">
<string notr="true">#generalScrollArea { background-color: transparent; }
@@ -44,8 +44,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>778</width>
- <height>501</height>
+ <width>780</width>
+ <height>502</height>
</rect>
</property>
<property name="autoFillBackground">
@@ -82,7 +82,7 @@
<property name="bottomMargin">
<number>9</number>
</property>
- <item row="0" column="2">
+ <item row="1" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -95,17 +95,7 @@
</property>
</spacer>
</item>
- <item row="0" column="0">
- <widget class="QComboBox" name="languageBox">
- <property name="toolTip">
- <string>The language of the user interface.</string>
- </property>
- <property name="whatsThis">
- <string>The language of the user interface.</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
+ <item row="1" column="1">
<widget class="LinkLabel" name="label_33">
<property name="toolTip">
<string>https://discord.gg/NRGqdt5suP</string>
@@ -118,6 +108,16 @@
</property>
</widget>
</item>
+ <item row="1" column="0">
+ <widget class="QComboBox" name="languageBox">
+ <property name="toolTip">
+ <string>The language of the user interface.</string>
+ </property>
+ <property name="whatsThis">
+ <string>The language of the user interface.</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -243,6 +243,19 @@
</widget>
</item>
<item>
+ <widget class="QCheckBox" name="showMenubarOnAlt">
+ <property name="toolTip">
+ <string>Show the menubar when the Alt key is pressed</string>
+ </property>
+ <property name="whatsThis">
+ <string>Show the menubar when the Alt key is pressed</string>
+ </property>
+ <property name="text">
+ <string>Show menubar when pressing Alt</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QCheckBox" name="doubleClickPreviews">
<property name="toolTip">
<string>Whether double-clicking on a file opens the preview window or launches the program associated with it. This applies to the Data tab as well as the Conflicts and Filetree tabs in the mod info window.</string>
@@ -1009,8 +1022,8 @@ If you disable this feature, MO will only display official DLCs this way. Please
<rect>
<x>0</x>
<y>0</y>
- <width>778</width>
- <height>501</height>
+ <width>780</width>
+ <height>502</height>
</rect>
</property>
<property name="autoFillBackground">
@@ -1689,8 +1702,8 @@ If you disable this feature, MO will only display official DLCs this way. Please
<rect>
<x>0</x>
<y>0</y>
- <width>778</width>
- <height>482</height>
+ <width>780</width>
+ <height>483</height>
</rect>
</property>
<property name="autoFillBackground">
diff --git a/src/settingsdialoggeneral.cpp b/src/settingsdialoggeneral.cpp
index 27038918..b0f40882 100644
--- a/src/settingsdialoggeneral.cpp
+++ b/src/settingsdialoggeneral.cpp
@@ -27,6 +27,7 @@ GeneralSettingsTab::GeneralSettingsTab(Settings& s, SettingsDialog& d)
// miscellaneous
ui->centerDialogs->setChecked(settings().geometry().centerDialogs());
ui->changeGameConfirmation->setChecked(settings().interface().showChangeGameConfirmation());
+ ui->showMenubarOnAlt->setChecked(settings().interface().showMenubarOnAlt());
ui->doubleClickPreviews->setChecked(settings().interface().doubleClicksOpenPreviews());
QObject::connect(
@@ -60,6 +61,7 @@ void GeneralSettingsTab::update()
// miscellaneous
settings().geometry().setCenterDialogs(ui->centerDialogs->isChecked());
settings().interface().setShowChangeGameConfirmation(ui->changeGameConfirmation->isChecked());
+ settings().interface().setShowMenubarOnAlt(ui->showMenubarOnAlt->isChecked());
settings().interface().setDoubleClicksOpenPreviews(ui->doubleClickPreviews->isChecked());
}