Merge pull request #411 from kthchew/feature/menubar

This commit is contained in:
Sefa Eyeoglu
2022-04-17 23:19:51 +02:00
committed by GitHub
6 changed files with 408 additions and 126 deletions

View File

@ -41,6 +41,7 @@
#include <QMessageBox>
#include <QDir>
#include <QTextCharFormat>
#include <QMenuBar>
#include "updater/UpdateChecker.h"
@ -322,6 +323,8 @@ void LauncherPage::applySettings()
APPLICATION->setApplicationTheme(newAppTheme, false);
}
s->set("MenuBarInsteadOfToolBar", ui->preferMenuBarCheckBox->isChecked());
// Console settings
s->set("ShowConsole", ui->showConsoleCheck->isChecked());
s->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
@ -410,6 +413,13 @@ void LauncherPage::loadSettings()
}
}
// Toolbar/menu bar settings (not applicable if native menu bar is present)
ui->toolsBox->setEnabled(!QMenuBar().isNativeMenuBar());
#ifdef Q_OS_MACOS
ui->toolsBox->setVisible(!QMenuBar().isNativeMenuBar());
#endif
ui->preferMenuBarCheckBox->setChecked(s->get("MenuBarInsteadOfToolBar").toBool());
// Console settings
ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool());
ui->autoCloseConsoleCheck->setChecked(s->get("AutoCloseConsole").toBool());

View File

@ -290,6 +290,16 @@
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Colors</string>
</property>
<property name="buddy">
<cstring>themeComboBoxColors</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="themeComboBoxColors">
<property name="sizePolicy">
@ -303,13 +313,28 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Colors</string>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="toolsBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Tools</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="preferMenuBarCheckBox">
<property name="toolTip">
<string>The menubar is more friendly for keyboard-driven interaction.</string>
</property>
<property name="buddy">
<cstring>themeComboBoxColors</cstring>
<property name="text">
<string>Replace toolbar with menubar</string>
</property>
</widget>
</item>