Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/mixxxmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ void MixxxMainWindow::initializeWindow() {

#ifndef __APPLE__
void MixxxMainWindow::alwaysHideMenuBarDlg() {
// Don't show the dialog if the user unchecked "Ask me again"
if (!m_pCoreServices->getSettings()->getValue<bool>(
kMenuBarHintConfigKey, true)) {
return;
Expand Down Expand Up @@ -956,13 +957,15 @@ void MixxxMainWindow::connectMenuBar() {
#endif
}

/// Enable/disable listening to Alt key press for toggling the menubar.
#ifndef __APPLE__
void MixxxMainWindow::slotUpdateMenuBarAltKeyConnection() {
if (!m_pCoreServices->getKeyboardEventFilter() || !m_pMenuBar) {
return;
}

if (m_pCoreServices->getSettings()->getValue<bool>(kHideMenuBarConfigKey, false)) {
// with Qt::UniqueConnection we don't need to check whether we're already connected
connect(m_pCoreServices->getKeyboardEventFilter().get(),
&KeyboardEventFilter::altPressedWithoutKeys,
m_pMenuBar,
Expand Down Expand Up @@ -1238,7 +1241,7 @@ bool MixxxMainWindow::loadConfiguredSkin() {
return m_pCentralWidget != nullptr;
}

// Try to load default styles that can be overridden by skins
/// Try to load default styles that can be overridden by skins
void MixxxMainWindow::tryParseAndSetDefaultStyleSheet() {
const QString resPath = m_pCoreServices->getSettings()->getResourcePath();
QFile file(resPath + "/skins/default.qss");
Expand All @@ -1251,6 +1254,7 @@ void MixxxMainWindow::tryParseAndSetDefaultStyleSheet() {
}
}

/// Catch ToolTip and WindowStateChange events
bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) {
if (event->type() == QEvent::ToolTip) {
// always show tooltips in the preferences window
Expand Down Expand Up @@ -1307,12 +1311,21 @@ bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) {
QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, isFullScreenNow);
createMenuBar();
connectMenuBar();
// With a global menu we didn't show the menubar auto-hide dialog
// during (windowed) startup, so ask now.
}
#endif

#ifndef __APPLE__
#ifdef __LINUX__
// Only show the dialog if we are able to have the menubar in the
// main window, only then we're able to hide it.
if (!m_supportsGlobalMenuBar || isFullScreenNow)
#endif
{
alwaysHideMenuBarDlg();
slotUpdateMenuBarAltKeyConnection();
}
#endif

// This will toggle the Fullscreen checkbox and hide the menubar if
// we go fullscreen.
// Skip this during startup or the launchimage will be shifted
Expand Down